[Libreoffice-commits] core.git: registry/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Sat Sep 5 17:54:50 UTC 2020


 registry/source/keyimpl.cxx |    4 ++--
 registry/source/regimpl.cxx |   10 +++++-----
 2 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 7fc98802ecd6d9e198ae37269f10522286db987e
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Tue Sep 1 17:14:10 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Sat Sep 5 19:54:05 2020 +0200

    Create OUString from storeFindData m_pszName and m_nLength
    
    ...assuming that (a) m_nLength does always reflect the actual m_pszName length,
    and (b) that way of constructing an OUString from a pointer was not chosen
    deliberately to cut of the string at a potential embedded NUL.
    
    (This change is a prerequisite for making the OUString ctor taking a raw pointer
    explicit.)
    
    Change-Id: I75519825cd6b60a7c308a3697bfbfc40afb2d1c8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102076
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx
index f3cb2d00b34e..e76512e9e19a 100644
--- a/registry/source/keyimpl.cxx
+++ b/registry/source/keyimpl.cxx
@@ -111,7 +111,7 @@ RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubK
     {
         if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR )
         {
-            OUString const sSubKeyName = iter.m_pszName;
+            OUString const sSubKeyName(iter.m_pszName, iter.m_nLength);
 
             ORegKey* pOpenSubKey = nullptr;
             _ret = pKey->openKey(sSubKeyName, reinterpret_cast<RegKeyHandle*>(&pOpenSubKey));
@@ -175,7 +175,7 @@ RegError ORegKey::getKeyNames(const OUString& keyName,
     {
         if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR)
         {
-            OUString const sSubKeyName = iter.m_pszName;
+            OUString const sSubKeyName(iter.m_pszName, iter.m_nLength);
 
             OUString sFullKeyName(pKey->getName());
             if (sFullKeyName.getLength() > 1)
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index 000d82fdd927..583cddd295d1 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -820,7 +820,7 @@ RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey)
 
     while (_err == store_E_None)
     {
-        OUString const keyName = iter.m_pszName;
+        OUString const keyName(iter.m_pszName, iter.m_nLength);
 
         if (iter.m_nAttrib & STORE_ATTRIB_ISDIR)
         {
@@ -867,7 +867,7 @@ RegError ORegistry::loadKey(RegKeyHandle hKey, const OUString& regFileName,
 
     while (_err == store_E_None)
     {
-        OUString const keyName = iter.m_pszName;
+        OUString const keyName(iter.m_pszName, iter.m_nLength);
 
         if (iter.m_nAttrib & STORE_ATTRIB_ISDIR)
         {
@@ -1221,7 +1221,7 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey,
 
     while (_err == store_E_None)
     {
-        OUString const sName = iter.m_pszName;
+        OUString const sName(iter.m_pszName, iter.m_nLength);
 
         if (iter.m_nAttrib & STORE_ATTRIB_ISDIR)
         {
@@ -1266,7 +1266,7 @@ RegError ORegistry::dumpRegistry(RegKeyHandle hKey) const
 
     while (_err == store_E_None)
     {
-        sName = iter.m_pszName;
+        sName = OUString(iter.m_pszName, iter.m_nLength);
 
         if (iter.m_nAttrib & STORE_ATTRIB_ISDIR)
         {
@@ -1552,7 +1552,7 @@ RegError ORegistry::dumpKey(const OUString& sPath, const OUString& sName, sal_In
 
     while (_err == store_E_None)
     {
-        sSubName = iter.m_pszName;
+        sSubName = OUString(iter.m_pszName, iter.m_nLength);
 
         if (iter.m_nAttrib & STORE_ATTRIB_ISDIR)
         {


More information about the Libreoffice-commits mailing list