summaryrefslogtreecommitdiff
path: root/registry/tools
diff options
context:
space:
mode:
authorMatthias Huetsch [mhu] <matthias.huetsch@sun.com>2010-03-04 15:19:41 +0100
committerMatthias Huetsch [mhu] <matthias.huetsch@sun.com>2010-03-04 15:19:41 +0100
commit709ee7e9b098fa7074d84d3faab7aa5cd5ebf73b (patch)
treed58e2e95e278a2c864877950904c7bc27dbe3e41 /registry/tools
parentffca8743e16d5afd101df88aa50f2c8735830e53 (diff)
mhu22: #i105430# #i108349# Fixed registry:ORegKey reference counting to avoid redundant closeKey()/flush() calls.
Diffstat (limited to 'registry/tools')
-rw-r--r--registry/tools/checksingleton.cxx9
-rw-r--r--registry/tools/regcompare.cxx9
-rw-r--r--registry/tools/regmerge.cxx31
3 files changed, 22 insertions, 27 deletions
diff --git a/registry/tools/checksingleton.cxx b/registry/tools/checksingleton.cxx
index 7900b1db7a62..ba32ae038ba8 100644
--- a/registry/tools/checksingleton.cxx
+++ b/registry/tools/checksingleton.cxx
@@ -30,6 +30,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_registry.hxx"
+
#include <stdio.h>
#include <string.h>
@@ -455,10 +456,10 @@ int _cdecl main( int argc, char * argv[] )
sal_Bool bSingletonsExist = checkSingletons(singletonKey, typeKey);
- indexRoot.closeKey();
- typeRoot.closeKey();
- typeKey.closeKey();
- singletonKey.closeKey();
+ indexRoot.releaseKey();
+ typeRoot.releaseKey();
+ typeKey.releaseKey();
+ singletonKey.releaseKey();
if ( indexReg.close() )
{
fprintf(stderr, "%s: closing registry \"%s\" failed\n",
diff --git a/registry/tools/regcompare.cxx b/registry/tools/regcompare.cxx
index f41103afb826..73662007dcad 100644
--- a/registry/tools/regcompare.cxx
+++ b/registry/tools/regcompare.cxx
@@ -30,6 +30,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_registry.hxx"
+
#include <stdio.h>
#include <string.h>
@@ -2276,8 +2277,8 @@ static sal_uInt32 compareKeys(RegistryKey& key1, RegistryKey& key2)
{
nError += compareKeys(subKey1, subKey2);
}
- subKey1.closeKey();
- subKey2.closeKey();
+ subKey1.releaseKey();
+ subKey2.releaseKey();
++iter;
}
@@ -2380,8 +2381,8 @@ int _cdecl main( int argc, char * argv[] )
}
}
- key1.closeKey();
- key2.closeKey();
+ key1.releaseKey();
+ key2.releaseKey();
if ( reg1.close() )
{
fprintf(stdout, "%s: closing registry \"%s\" failed\n",
diff --git a/registry/tools/regmerge.cxx b/registry/tools/regmerge.cxx
index 45cab0927b10..4fcb19a03c00 100644
--- a/registry/tools/regmerge.cxx
+++ b/registry/tools/regmerge.cxx
@@ -34,7 +34,7 @@
#include <stdio.h>
#include <string.h>
-#include "registry/registry.h"
+#include "registry/registry.hxx"
#include <rtl/ustring.hxx>
#include <rtl/alloc.h>
#include <osl/process.h>
@@ -207,9 +207,7 @@ int main( int argc, char * argv[] )
int _cdecl main( int argc, char * argv[] )
#endif
{
- RegHandle hReg;
- RegKeyHandle hRootKey;
- bool bVerbose = checkCommandArgs(argc, argv);
+ bool bVerbose = checkCommandArgs(argc, argv);
if (realargc < 4)
{
@@ -219,9 +217,11 @@ int _cdecl main( int argc, char * argv[] )
}
::rtl::OUString regName( convertToFileUrl(realargv[1]) );
- if (reg_openRegistry(regName.pData, &hReg, REG_READWRITE))
+
+ Registry reg;
+ if (reg.open(regName, REG_READWRITE) != REG_NO_ERROR)
{
- if (reg_createRegistry(regName.pData, &hReg))
+ if (reg.create(regName) != REG_NO_ERROR)
{
if (bVerbose)
fprintf(stderr, "open registry \"%s\" failed\n", realargv[1]);
@@ -230,17 +230,16 @@ int _cdecl main( int argc, char * argv[] )
}
}
- if (!reg_openRootKey(hReg, &hRootKey))
+ RegistryKey rootKey;
+ if (reg.openRootKey(rootKey) == REG_NO_ERROR)
{
::rtl::OUString mergeKeyName( ::rtl::OUString::createFromAscii(realargv[2]) );
::rtl::OUString targetRegName;
for (int i = 3; i < realargc; i++)
{
targetRegName = convertToFileUrl(realargv[i]);
- RegError _ret = reg_mergeKey(
- hRootKey, mergeKeyName.pData, targetRegName.pData, sal_False,
- bVerbose);
- if (_ret)
+ RegError _ret = reg.mergeKey(rootKey, mergeKeyName, targetRegName, sal_False, bVerbose);
+ if (_ret != REG_NO_ERROR)
{
if (_ret == REG_MERGE_CONFLICT)
{
@@ -262,13 +261,7 @@ int _cdecl main( int argc, char * argv[] )
}
}
- if (reg_closeKey(hRootKey))
- {
- if (bVerbose)
- fprintf(stderr, "closing root key of registry \"%s\" failed\n",
- realargv[1]);
- exit(-3);
- }
+ rootKey.releaseKey();
} else
{
if (bVerbose)
@@ -277,7 +270,7 @@ int _cdecl main( int argc, char * argv[] )
exit(-4);
}
- if (reg_closeRegistry(hReg))
+ if (reg.close() != REG_NO_ERROR)
{
if (bVerbose)
fprintf(stderr, "closing registry \"%s\" failed\n", realargv[1]);