X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6c9a19aabab3a878b565e6c2a5f2a3824277c4dc..b7ceceb1861d7583c0a544c608fcf583367e6e92:/src/msw/regconf.cpp diff --git a/src/msw/regconf.cpp b/src/msw/regconf.cpp index 050ef4646f..af4dc5ab68 100644 --- a/src/msw/regconf.cpp +++ b/src/msw/regconf.cpp @@ -9,7 +9,7 @@ // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "regconf.h" #endif @@ -124,7 +124,7 @@ wxRegConfig::wxRegConfig(const wxString& appName, const wxString& vendorName, m_keyLocal.ReserveMemoryForName(MEMORY_PREALLOC); m_keyLocalRoot.SetName(wxRegKey::HKCU, SOFTWARE_KEY + str); - m_keyLocal.SetName(m_keyLocalRoot, _T("")); + m_keyLocal.SetName(m_keyLocalRoot, wxEmptyString); if ( bDoUseGlobal ) { @@ -134,7 +134,7 @@ wxRegConfig::wxRegConfig(const wxString& appName, const wxString& vendorName, m_keyGlobal.ReserveMemoryForName(MEMORY_PREALLOC); m_keyGlobalRoot.SetName(wxRegKey::HKLM, SOFTWARE_KEY + str); - m_keyGlobal.SetName(m_keyGlobalRoot, _T("")); + m_keyGlobal.SetName(m_keyGlobalRoot, wxEmptyString); } // Create() will Open() if key already exists @@ -245,7 +245,8 @@ void wxRegConfig::SetPath(const wxString& strPath) size_t len = strFullPath.length(); const wxChar *end = src + len; - wxChar *dst = m_strPath.GetWriteBuf(len); + wxStringBufferLength buf(m_strPath, len); + wxChar *dst = buf; wxChar *start = dst; for ( ; src < end; src++, dst++ ) @@ -337,8 +338,7 @@ void wxRegConfig::SetPath(const wxString& strPath) } *dst = _T('\0'); - - m_strPath.UngetWriteBuf(dst - start); + buf.SetLength(dst - start); } #ifdef WX_DEBUG_SET_PATH @@ -355,7 +355,8 @@ void wxRegConfig::SetPath(const wxString& strPath) size_t len = m_strPath.length(); const wxChar *src = m_strPath.c_str(); - wxChar *dst = strRegPath.GetWriteBuf(len); + wxStringBufferLength buf(strRegPath, len); + wxChar *dst = buf; const wxChar *end = src + len; for ( ; src < end; src++, dst++ ) @@ -366,7 +367,7 @@ void wxRegConfig::SetPath(const wxString& strPath) *dst = *src; } - strRegPath.UngetWriteBuf(len); + buf.SetLength(len); } // this is not needed any longer as we don't create keys unnecessarily any @@ -385,13 +386,14 @@ void wxRegConfig::SetPath(const wxString& strPath) // change current key(s) m_keyLocal.SetName(m_keyLocalRoot, strRegPath); - m_keyGlobal.SetName(m_keyGlobalRoot, strRegPath); - // don't create it right now, wait until it is accessed - //m_keyLocal.Create(); + if ( GetStyle() & wxCONFIG_USE_GLOBAL_FILE ) + { + m_keyGlobal.SetName(m_keyGlobalRoot, strRegPath); - wxLogNull nolog; - m_keyGlobal.Open(); + wxLogNull nolog; + m_keyGlobal.Open(); + } } // ----------------------------------------------------------------------------