X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2ba4130573b01a7427f8fdd8349093f830ddfbd9..b5435dccd098ae153c3b7b3b8fca8dd0d763986c:/src/msw/regconf.cpp diff --git a/src/msw/regconf.cpp b/src/msw/regconf.cpp index c63a563d6a..2a5325bc15 100644 --- a/src/msw/regconf.cpp +++ b/src/msw/regconf.cpp @@ -6,7 +6,7 @@ // Created: 27.04.98 // RCS-ID: $Id$ // Copyright: (c) 1998 Vadim Zeitlin -// Licence: wxWindows license +// Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -43,7 +43,7 @@ // ---------------------------------------------------------------------------- // we put our data in HKLM\SOFTWARE_KEY\appname -#define SOFTWARE_KEY wxString("Software\\") +#define SOFTWARE_KEY wxString(wxT("Software\\")) // ---------------------------------------------------------------------------- // global functions @@ -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 @@ -350,21 +350,25 @@ void wxRegConfig::SetPath(const wxString& strPath) // registry APIs want backslashes instead of slashes wxString strRegPath; - size_t len = m_strPath.length(); + if ( !m_strPath.empty() ) + { + size_t len = m_strPath.length(); - const wxChar *src = m_strPath.c_str(); - wxChar *dst = strRegPath.GetWriteBuf(len); + const wxChar *src = m_strPath.c_str(); + wxStringBufferLength buf(strRegPath, len); + wxChar *dst = buf; - const wxChar *end = src + len; - for ( ; src < end; src++, dst++ ) - { - if ( *src == wxCONFIG_PATH_SEPARATOR ) - *dst = _T('\\'); - else - *dst = *src; - } + const wxChar *end = src + len; + for ( ; src < end; src++, dst++ ) + { + if ( *src == wxCONFIG_PATH_SEPARATOR ) + *dst = _T('\\'); + else + *dst = *src; + } - strRegPath.UngetWriteBuf(len); + buf.SetLength(len); + } // this is not needed any longer as we don't create keys unnecessarily any // more (now it is done on demand, i.e. only when they're going to contain @@ -693,7 +697,7 @@ bool wxRegConfig::DeleteEntry(const wxString& value, bool WXUNUSED(bGroupIfEmpty if ( m_keyLocal.IsEmpty() ) { wxString strKey = GetPath().AfterLast(wxCONFIG_PATH_SEPARATOR); - SetPath(".."); // changes m_keyLocal + SetPath(_T("..")); // changes m_keyLocal return LocalKey().DeleteKey(strKey); } }