From 4ca5c503bc36f0300bb3f3ec1577ed41df098ab2 Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Wed, 1 Oct 2008 08:05:58 +0000 Subject: CWS-TOOLING: integrate CWS jsc311 --- rdbmaker/inc/codemaker/global.hxx | 13 +- rdbmaker/inc/codemaker/options.hxx | 6 +- rdbmaker/source/codemaker/global.cxx | 183 +------------- rdbmaker/source/codemaker/options.cxx | 19 +- registry/source/keyimpl.cxx | 54 +--- registry/source/keyimpl.hxx | 7 +- registry/source/reflcnst.hxx | 4 +- registry/source/reflwrit.cxx | 50 +--- registry/source/regimpl.cxx | 92 +------ registry/source/regimpl.hxx | 9 +- registry/source/registry.cxx | 63 +---- registry/test/makefile.mk | 5 +- registry/test/regdiagnose.h | 47 ++++ registry/test/testmerge.cxx | 459 ++++++++++++++++------------------ registry/test/testregcpp.cxx | 439 +++++++++++++++----------------- registry/workben/makefile.mk | 16 +- registry/workben/regtest.cxx | 8 +- registry/workben/test.cxx | 6 +- stoc/source/security/permissions.cxx | 9 +- stoc/source/security/permissions.h | 7 +- stoc/test/excomp/excomp.cxx | 4 +- stoc/test/excomp/excomp1.cxx | 10 +- stoc/test/excomp/excomp2.cxx | 10 +- stoc/test/javavm/testjavavm.cxx | 5 +- stoc/test/makefile.mk | 7 +- stoc/test/security/test_security.cxx | 23 +- stoc/test/testregistry.cxx | 31 +-- stoc/test/testsmgr.cxx | 13 +- stoc/test/testsmgr2.cxx | 3 +- 29 files changed, 547 insertions(+), 1055 deletions(-) create mode 100644 registry/test/regdiagnose.h diff --git a/rdbmaker/inc/codemaker/global.hxx b/rdbmaker/inc/codemaker/global.hxx index 613bb9e34c5b..df1f588f5ffc 100644 --- a/rdbmaker/inc/codemaker/global.hxx +++ b/rdbmaker/inc/codemaker/global.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: global.hxx,v $ - * $Revision: 1.7 $ + * $Revision: 1.7.8.1 $ * * This file is part of OpenOffice.org. * @@ -74,15 +74,6 @@ typedef ::std::set< ::rtl::OString, LessString > StringSet; ::rtl::OString makeTempName(); -::rtl::OString createFileNameFromType(const ::rtl::OString& destination, - const ::rtl::OString type, - const ::rtl::OString postfix, - sal_Bool bLowerCase=sal_False, - const ::rtl::OString prefix=""); - -sal_Bool fileExists(const ::rtl::OString& fileName); -sal_Bool checkFileContent(const ::rtl::OString& targetFileName, const ::rtl::OString& tmpFileName); - const ::rtl::OString inGlobalSet(const ::rtl::OUString & r); inline const ::rtl::OString inGlobalSet(sal_Char* p) { @@ -108,7 +99,6 @@ class FileStream //: public ofstream { public: FileStream(); - FileStream(const ::rtl::OString& name, FileAccessMode nMode = FAM_READWRITE); virtual ~FileStream(); sal_Bool isValid(); @@ -116,7 +106,6 @@ public: void open(const ::rtl::OString& name, FileAccessMode nMode = FAM_READWRITE); void close(); - sal_Int32 getSize(); ::rtl::OString getName() { return m_name; } // friend functions diff --git a/rdbmaker/inc/codemaker/options.hxx b/rdbmaker/inc/codemaker/options.hxx index 12d3ec50c4ad..d00806198017 100644 --- a/rdbmaker/inc/codemaker/options.hxx +++ b/rdbmaker/inc/codemaker/options.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: options.hxx,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.8.1 $ * * This file is part of OpenOffice.org. * @@ -88,10 +88,6 @@ public: sal_Bool isValid(const ::rtl::OString& option); const ::rtl::OString getOption(const ::rtl::OString& option) throw( IllegalArgument ); - const OptionMap& getOptions(); - - const ::rtl::OString getInputFile(sal_uInt16 index) - throw( IllegalArgument ); const StringVector& getInputFiles(); diff --git a/rdbmaker/source/codemaker/global.cxx b/rdbmaker/source/codemaker/global.cxx index 01eeb4c455f2..5d342b25fef7 100644 --- a/rdbmaker/source/codemaker/global.cxx +++ b/rdbmaker/source/codemaker/global.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: global.cxx,v $ - * $Revision: 1.14 $ + * $Revision: 1.14.8.1 $ * * This file is part of OpenOffice.org. * @@ -59,162 +59,6 @@ using namespace ::rtl; using namespace ::osl; -OString createFileNameFromType( const OString& destination, - const OString typeName, - const OString postfix, - sal_Bool bLowerCase, - const OString prefix ) -{ - OString type(typeName); - - if (bLowerCase) - { - type = typeName.toAsciiLowerCase(); - } - - sal_uInt32 length = destination.getLength(); - - sal_Bool withPoint = sal_False; - if (length == 0) - { - length++; - withPoint = sal_True; - } - - length += prefix.getLength() + type.getLength() + postfix.getLength(); - - sal_Bool withSeperator = sal_False; - if (destination.getStr()[destination.getLength()] != '\\' && - destination.getStr()[destination.getLength()] != '/' && - type.getStr()[0] != '\\' && - type.getStr()[0] != '/') - { - length++; - withSeperator = sal_True; - } - - OStringBuffer nameBuffer(length); - - if (withPoint) - nameBuffer.append('.'); - else - nameBuffer.append(destination.getStr(), destination.getLength()); - - if (withSeperator) - nameBuffer.append("/", 1); - - OString tmpStr(type); - if (prefix.getLength() > 0) - { - tmpStr = type.replaceAt(type.lastIndexOf('/')+1, 0, prefix); - } - - nameBuffer.append(tmpStr.getStr(), tmpStr.getLength()); - nameBuffer.append(postfix.getStr(), postfix.getLength()); - - OString fileName(nameBuffer); - - sal_Char token; -#ifdef SAL_UNX - fileName = fileName.replace('\\', '/'); - token = '/'; -#else - fileName = fileName.replace('/', '\\'); - token = '\\'; -#endif - - nameBuffer = OStringBuffer(length); - - sal_Int32 nIndex = 0; - do - { - nameBuffer.append(fileName.getToken( 0, token, nIndex ).getStr()); - - if (nameBuffer.getLength() == 0 || OString(".") == nameBuffer.getStr()) - { - nameBuffer.append(token); - continue; - } - -#if defined(SAL_UNX) || defined(SAL_OS2) - if (mkdir((char*)nameBuffer.getStr(), 0777) == -1) -#else - if (mkdir((char*)nameBuffer.getStr()) == -1) -#endif - { - if ( errno == ENOENT ) - return OString(); - } - - nameBuffer.append(token); - } - while ( nIndex >= 0 ); - - return fileName; -} - -sal_Bool fileExists(const OString& fileName) -{ - FILE *f= fopen(fileName.getStr(), "r"); - - if (f != NULL) - { - fclose(f); - return sal_True; - } - - return sal_False; -} - -sal_Bool checkFileContent(const OString& targetFileName, const OString& tmpFileName) -{ - FILE *target = fopen(targetFileName.getStr(), "r"); - FILE *tmp = fopen(tmpFileName.getStr(), "r"); - sal_Bool ret = sal_False; - - if (target != NULL && tmp != NULL) - { - sal_Bool bFindChanges = sal_False; - sal_Char buffer1[1024+1]; - sal_Char buffer2[1024+1]; - sal_Int32 n1 = 0; - sal_Int32 n2 = 0; - - while ( !bFindChanges && !feof(target) && !feof(tmp)) - { - n1 = fread(buffer1, sizeof(sal_Char), 1024, target); - n2 = fread(buffer2, sizeof(sal_Char), 1024, tmp); - - if ( n1 != n2 ) - { - bFindChanges = sal_True; - } - else - { - if ( rtl_compareMemory(buffer1, buffer2, n2) != 0 ) - bFindChanges = sal_True; - } - } - - fclose(target); - fclose(tmp); - - if ( bFindChanges ) - { - if ( !unlink(targetFileName.getStr()) ) - if ( !rename(tmpFileName.getStr(), targetFileName.getStr()) ) - ret = sal_True; - } - else - { - if ( !unlink(tmpFileName.getStr()) ) - ret = sal_True; - } - } - - return ret; -} - const OString inGlobalSet(const OUString & rValue) { OString sValue( OUStringToOString(rValue, RTL_TEXTENCODING_UTF8) ); @@ -271,16 +115,6 @@ FileStream::FileStream() { } -FileStream::FileStream(const OString& name, FileAccessMode mode) - : m_pFile(NULL) -{ - if ( name.getLength() > 0 ) - { - m_name = name; - m_pFile = fopen(m_name, checkAccessMode(mode)); - } -} - FileStream::~FileStream() { if ( isValid() ) @@ -318,21 +152,6 @@ void FileStream::close() } } -sal_Int32 FileStream::getSize() -{ - sal_Int32 pos = 0; - sal_Int32 size = 0; - if ( isValid() ) - { - fflush(m_pFile); - pos = ftell(m_pFile); - if (!fseek(m_pFile, 0, SEEK_END)) - size = ftell(m_pFile); - fseek(m_pFile, pos, SEEK_SET); - } - return size; -} - const sal_Char* FileStream::checkAccessMode(FileAccessMode mode) { switch( mode ) diff --git a/rdbmaker/source/codemaker/options.cxx b/rdbmaker/source/codemaker/options.cxx index db4db08b14c8..27cd0a8f4dc2 100644 --- a/rdbmaker/source/codemaker/options.cxx +++ b/rdbmaker/source/codemaker/options.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: options.cxx,v $ - * $Revision: 1.4 $ + * $Revision: 1.4.8.1 $ * * This file is part of OpenOffice.org. * @@ -63,23 +63,6 @@ const OString Options::getOption(const OString& option) } } -const OptionMap& Options::getOptions() -{ - return m_options; -} - -const OString Options::getInputFile(sal_uInt16 index) - throw( IllegalArgument ) -{ - if (index < m_inputFiles.size()) - { - return m_inputFiles[index]; - } else - { - throw IllegalArgument("index is out of bound."); - } -} - const StringVector& Options::getInputFiles() { return m_inputFiles; diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx index 4412ca208487..8b9c6ce00de2 100644 --- a/registry/source/keyimpl.cxx +++ b/registry/source/keyimpl.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: keyimpl.cxx,v $ - * $Revision: 1.9 $ + * $Revision: 1.9.10.1 $ * * This file is part of OpenOffice.org. * @@ -57,41 +57,6 @@ ORegKey::ORegKey(const OUString& keyName, ORegistry* pReg) checkLink(); } -//********************************************************************* -// ORegKey() -// -ORegKey::ORegKey(const OUString& keyName, const OUString& linkName, - ORegistry* pReg) - : m_refCount(1) - , m_name(keyName) - , m_bDeleted(sal_False) - , m_pRegistry(pReg) -{ - if (linkName.getLength()) - { - m_link = linkName; - m_isLink = sal_True; - - setValue(OUString( RTL_CONSTASCII_USTRINGPARAM("LINK_TARGET") ), RG_VALUETYPE_UNICODE, - (RegValue*)linkName.pData->buffer, linkName.getLength()+1); - } else - { - m_isLink = sal_False; - } -} - -//********************************************************************* -// ORegKey() -// -ORegKey::ORegKey() - : m_refCount(1) - , m_bDeleted(sal_False) - , m_isLink(sal_False) - , m_pRegistry(NULL) -{ -} - - //********************************************************************* // ~ORegKey() // @@ -259,23 +224,6 @@ RegError ORegKey::getKeyNames(const OUString& keyName, } -//********************************************************************* -// closeSubKeys -// -RegError ORegKey::closeSubKeys(RegKeyHandle* phSubKeys, sal_uInt32 nSubKeys) -{ - RegError _ret = REG_NO_ERROR; - - for (sal_uInt32 i=0; i < nSubKeys; i++) - { - _ret = closeKey(phSubKeys[i]); - } - - rtl_freeMemory(phSubKeys); - return _ret; -} - - //********************************************************************* // closeKey // diff --git a/registry/source/keyimpl.hxx b/registry/source/keyimpl.hxx index 174ab5a25c9d..0325aa08e4b5 100644 --- a/registry/source/keyimpl.hxx +++ b/registry/source/keyimpl.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: keyimpl.hxx,v $ - * $Revision: 1.4 $ + * $Revision: 1.4.10.1 $ * * This file is part of OpenOffice.org. * @@ -43,8 +43,6 @@ class ORegKey public: ORegKey(const OUString& keyName, ORegistry* pReg); - ORegKey(const OUString& keyName, const OUString& linkName, - ORegistry* pReg); sal_uInt32 acquire() { return ++m_refCount; } @@ -65,8 +63,6 @@ public: rtl_uString*** pSubKeyNames, sal_uInt32* pnSubKeys); - RegError closeSubKeys(RegKeyHandle* phSubKeys, sal_uInt32 len); - RegError closeKey(RegKeyHandle hKey); RegError deleteKey(const OUString& keyName); @@ -120,7 +116,6 @@ public: OUString& resolvedName); public: - ORegKey(); virtual ~ORegKey(); diff --git a/registry/source/reflcnst.hxx b/registry/source/reflcnst.hxx index f32dfb3bc640..6cd9c2fe08a6 100644 --- a/registry/source/reflcnst.hxx +++ b/registry/source/reflcnst.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: reflcnst.hxx,v $ - * $Revision: 1.6 $ + * $Revision: 1.6.10.1 $ * * This file is part of OpenOffice.org. * @@ -284,9 +284,7 @@ inline sal_uInt32 readUtf8(const sal_uInt8* buffer, sal_Char* v, sal_uInt32 maxS sal_uInt32 writeFloat(sal_uInt8* buffer, float v); -sal_uInt32 readFloat(const sal_uInt8* buffer, float& v); sal_uInt32 writeDouble(sal_uInt8* buffer, double v); -sal_uInt32 readDouble(const sal_uInt8* buffer, double& v); sal_uInt32 writeString(sal_uInt8* buffer, const sal_Unicode* v); sal_uInt32 readString(const sal_uInt8* buffer, sal_Unicode* v, sal_uInt32 maxSize); diff --git a/registry/source/reflwrit.cxx b/registry/source/reflwrit.cxx index c1c8726a6306..218286820ed3 100644 --- a/registry/source/reflwrit.cxx +++ b/registry/source/reflwrit.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: reflwrit.cxx,v $ - * $Revision: 1.15 $ + * $Revision: 1.15.10.1 $ * * This file is part of OpenOffice.org. * @@ -170,25 +170,6 @@ sal_uInt32 writeFloat(sal_uInt8* buffer, float v) return sizeof(sal_uInt32); } -sal_uInt32 readFloat(const sal_uInt8* buffer, float& v) -{ - union - { - float v; - sal_uInt32 b; - } x; - -#ifdef REGTYPE_IEEE_NATIVE - readUINT32(buffer, x.b); -#else -# error no IEEE -#endif - - v = x.v; - - return sizeof(sal_uInt32); -} - sal_uInt32 writeDouble(sal_uInt8* buffer, double v) { union @@ -218,35 +199,6 @@ sal_uInt32 writeDouble(sal_uInt8* buffer, double v) return (sizeof(sal_uInt32) + sizeof(sal_uInt32)); } -sal_uInt32 readDouble(const sal_uInt8* buffer, double& v) -{ - union - { - double v; - struct - { - sal_uInt32 b1; - sal_uInt32 b2; - } b; - } x; - -#ifdef REGTYPE_IEEE_NATIVE -# ifdef OSL_BIGENDIAN - readUINT32(buffer, x.b.b1); - readUINT32(buffer + sizeof(sal_uInt32), x.b.b2); -# else - readUINT32(buffer, x.b.b2); - readUINT32(buffer + sizeof(sal_uInt32), x.b.b1); -# endif -#else -# error no IEEE -#endif - - v = x.v; - - return (sizeof(sal_uInt32) + sizeof(sal_uInt32)); -} - /************************************************************************** buffer write functions diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx index 40d20f821384..08db223806e3 100644 --- a/registry/source/regimpl.cxx +++ b/registry/source/regimpl.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: regimpl.cxx,v $ - * $Revision: 1.28 $ + * $Revision: 1.28.10.1 $ * * This file is part of OpenOffice.org. * @@ -1197,42 +1197,6 @@ RegError ORegistry::saveKey(RegKeyHandle hKey, const OUString& regFileName, } -//********************************************************************* -// isKeyOpen() -// -sal_Bool ORegistry::isKeyOpen(const OUString& keyName) const -{ - return(m_openKeyTable.count(keyName) > 0); -} - - - -//********************************************************************* -// countSubKeys() -// -sal_uInt32 ORegistry::countSubKeys(ORegKey* pKey) -{ - REG_GUARD(m_mutex); - - OStoreDirectory::iterator iter; - sal_uInt32 count = 0; - OStoreDirectory rStoreDir(pKey->getStoreDir()); - storeError _err = rStoreDir.first(iter); - - while ( _err == store_E_None) - { - if (iter.m_nAttrib & STORE_ATTRIB_ISDIR) - { - count++; - } - - _err = rStoreDir.next(iter); - } - - return count; -} - - //********************************************************************* // loadValue() // @@ -2038,60 +2002,6 @@ RegError ORegistry::dumpKey(const OUString& sPath, const OUString& sName, sal_In return REG_NO_ERROR; } -//********************************************************************* -// createLink() -// -RegError ORegistry::createLink(RegKeyHandle hKey, - const OUString& linkName, - const OUString& linkTarget) -{ - ORegKey* pKey; - - if ( !linkName.getLength() ) - { - return REG_INVALID_LINKNAME; - } - - REG_GUARD(m_mutex); - - if (hKey) - pKey = (ORegKey*)hKey; - else - pKey = m_openKeyTable[ROOT]; - - OUString sFullLinkName = resolveLinks(pKey, linkName); - - if (sFullLinkName.getLength() == 0) - return REG_DETECT_RECURSION; - - OStoreDirectory rStoreDir; - OUString sFullPath(ROOT); - - sal_Int32 nIndex = 0; - OUString token; - - do - { - token = sFullLinkName.getToken(0, '/', nIndex); - - if( token.getLength() > 0 ) - { - if (rStoreDir.create(pKey->getStoreFile(), sFullPath, token, KEY_MODE_CREATE)) - { - return REG_CREATE_KEY_FAILED; - } - - sFullPath += token; - sFullPath += ROOT; - } - } while( nIndex != -1 && token.getLength() > 0 ); - - pKey = new ORegKey(sFullLinkName, linkTarget, this); - delete pKey; - - return REG_NO_ERROR; -} - //********************************************************************* // deleteLink() // diff --git a/registry/source/regimpl.hxx b/registry/source/regimpl.hxx index ea6d386d4c15..d761709dc50f 100644 --- a/registry/source/regimpl.hxx +++ b/registry/source/regimpl.hxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: regimpl.hxx,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.10.1 $ * * This file is part of OpenOffice.org. * @@ -124,17 +124,12 @@ public: RegError dumpRegistry(RegKeyHandle hKey) const; - RegError createLink(RegKeyHandle hKey, - const OUString& linkName, - const OUString& linkTarget); - RegError deleteLink(RegKeyHandle hKey, const OUString& linkName); public: virtual ~ORegistry(); - sal_Bool isKeyOpen(const OUString& keyName) const; sal_Bool isReadOnly() const { return m_readOnly; } @@ -162,8 +157,6 @@ protected: RegError deleteSubkeysAndValues(ORegKey* pKey, RESOLVE eResolve=RESOLVE_FULL); - sal_uInt32 countSubKeys(ORegKey* pKey); - RegError loadAndSaveValue(ORegKey* pTargetKey, ORegKey* pSourceKey, const OUString& valueName, diff --git a/registry/source/registry.cxx b/registry/source/registry.cxx index ea4dc224e194..89028260e0c1 100644 --- a/registry/source/registry.cxx +++ b/registry/source/registry.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: registry.cxx,v $ - * $Revision: 1.20 $ + * $Revision: 1.20.10.1 $ * * This file is part of OpenOffice.org. * @@ -53,63 +53,6 @@ ORealDynamicLoader* ODynamicLoader::m_pLoader = NULL; #endif -OString getTempName() -{ - static OUString TMP(RTL_CONSTASCII_USTRINGPARAM("TMP")); - static OUString TEMP(RTL_CONSTASCII_USTRINGPARAM("TEMP")); - - OUString uTmpPattern; - sal_Char tmpPattern[512] = ""; - sal_Char *pTmpName = NULL; - - if ( osl_getEnvironment(TMP.pData, &uTmpPattern.pData) != osl_Process_E_None ) - { - if ( osl_getEnvironment(TEMP.pData, &uTmpPattern.pData) != osl_Process_E_None ) - { -#if defined(SAL_W32) || defined(SAL_OS2) - OSL_ASSERT( sizeof(tmpPattern) > RTL_CONSTASCII_LENGTH( "." ) ); - strncpy(tmpPattern, ".", sizeof(tmpPattern)-1); -#else - OSL_ASSERT( sizeof(tmpPattern) > RTL_CONSTASCII_LENGTH( "." ) ); - strncpy(tmpPattern, ".", sizeof(tmpPattern)-1); -#endif - } - } - - if ( uTmpPattern.getLength() ) - { - OString aOStr( OUStringToOString(uTmpPattern, RTL_TEXTENCODING_UTF8) ); - OSL_ASSERT( - sizeof(tmpPattern) - > sal::static_int_cast< sal_uInt32 >(aOStr.getLength()) ); - strncpy(tmpPattern, aOStr.getStr(), sizeof(tmpPattern)-1); - } - -#if defined(WIN32) || defined(WNT) || defined(OS2) - OSL_ASSERT( sizeof(tmpPattern) > ( strlen(tmpPattern) - + RTL_CONSTASCII_LENGTH("\\reg_XXXXXX") ) ); - strncat(tmpPattern, "\\reg_XXXXXX", sizeof(tmpPattern)-1-strlen(tmpPattern)); - pTmpName = mktemp(tmpPattern); -#endif - -#ifdef OS2__YD - char* tmpname = tempnam(NULL, "reg_"); - OSL_ASSERT( sizeof(tmpPattern) > strlen(tmpname) ); - strncpy(tmpPattern, tmpname, sizeof(tmpPattern)-1); - pTmpName = tmpPattern; -#endif - -#ifdef UNX - OSL_ASSERT( sizeof(tmpPattern) > ( strlen(tmpPattern) - + RTL_CONSTASCII_LENGTH("/reg_XXXXXX") ) ); - strncat(tmpPattern, "/reg_XXXXXX", sizeof(tmpPattern)-1-strlen(tmpPattern)); - - pTmpName = mktemp(tmpPattern); -#endif - - return OString(pTmpName); -} - extern "C" { //********************************************************************* @@ -456,10 +399,6 @@ static RegError REGISTRY_CALLTYPE mergeKey(RegHandle hReg, pNewKey = pKey; } - /* - OString tmpName = getTempName(); - pReg->saveKey(pNewKey, tmpName, sal_False, sal_False); - */ _ret = pKey->getRegistry()->loadKey(pNewKey, regFileName, bWarnings, bReport); if (_ret == REG_MERGE_ERROR || diff --git a/registry/test/makefile.mk b/registry/test/makefile.mk index 534dd7177086..698d37dfa758 100644 --- a/registry/test/makefile.mk +++ b/registry/test/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.8 $ +# $Revision: 1.8.10.2 $ # # This file is part of OpenOffice.org. # @@ -35,8 +35,8 @@ PRJNAME=registry TARGET=regtest USE_LDUMP2=TRUE -#LDUMP2=LDUMP3 +ENABLE_EXCEPTIONS := TRUE # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk @@ -62,6 +62,7 @@ SHL1IMPLIB= rgt SHL1STDLIBS= \ $(SALLIB) \ $(SALHELPERLIB) \ + $(REGLIB) \ $(STDLIBCPP) SHL1LIBS= $(LIB1TARGET) diff --git a/registry/test/regdiagnose.h b/registry/test/regdiagnose.h new file mode 100644 index 000000000000..ffbca265bbb6 --- /dev/null +++ b/registry/test/regdiagnose.h @@ -0,0 +1,47 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: regdiagnose.h,v $ + * $Revision: 1.1.2.1 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#ifndef REG_DIAGNOSE_H +#define REG_DIAGNOSE_H + +#include + +#define REG_ENSURE(c, m) _REG_ENSURE(c, OSL_THIS_FILE, __LINE__, m) + +#define _REG_ENSURE(c, f, l, m) \ + do \ + { \ + if (!(c) && _OSL_GLOBAL osl_assertFailedLine(f, l, m)) \ + _OSL_GLOBAL osl_breakDebug(); \ + } while (0) + + +#endif // REG_DIAGNOSE_H diff --git a/registry/test/testmerge.cxx b/registry/test/testmerge.cxx index b1709af6a193..7cff15412745 100644 --- a/registry/test/testmerge.cxx +++ b/registry/test/testmerge.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: testmerge.cxx,v $ - * $Revision: 1.7 $ + * $Revision: 1.7.10.2 $ * * This file is part of OpenOffice.org. * @@ -38,7 +38,7 @@ #include "registry/registry.hxx" #include "registry/reflread.hxx" #include "registry/reflwrit.hxx" -#include +#include "regdiagnose.h" #include #include @@ -50,44 +50,35 @@ sal_Int32 lValue1 = 123456789; sal_Int32 lValue2 = 54321; sal_Int32 lValue3 = 111333111; sal_Int32 lValue4 = 333111333; -sal_Char* sValue = "string Value"; +sal_Char* sValue = (sal_Char*)"string Value"; OUString wValue = rtl::OUString::createFromAscii( "unicode Value" ); void test_generateMerge1() { - RegistryLoader* pLoader = new RegistryLoader(); - - if (!pLoader->isLoaded()) - { - delete pLoader; - return; - } - - Registry *myRegistry = new Registry(*pLoader); - delete pLoader; + Registry *myRegistry = new Registry(); RegistryKey rootKey, key1, key2, key3, key4, key5, key6, key7, key8, key9; - OSL_ENSURE(!myRegistry->create(OUString::createFromAscii("merge1.rdb")), "testGenerateMerge1 error 1"); - OSL_ENSURE(!myRegistry->openRootKey(rootKey), "testGenerateMerge1 error 2"); - - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("MergeKey1"), key1), "testGenerateMerge1 error 3"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey1"), key2), "testGenerateMerge1 error 4"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey1/KeyWithLongValue"), key3), "testGenerateMerge1 error 5"); - OSL_ENSURE(!key3.setValue(OUString(), RG_VALUETYPE_LONG, &lValue1, sizeof(sal_Int32)), "testGenerateMerge1 error 5a"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey2"), key4), "testGenerateMerge1 error 6"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey2/KeyWithStringValue"), key5), "testGenerateMerge1 error 7"); - OSL_ENSURE(!key5.setValue(OUString(), RG_VALUETYPE_STRING, sValue, strlen(sValue)+1), "testGenerateMerge1 error 7a"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey3"), key6), "testGenerateMerge1 error 8"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey3/KeyWithUnicodeValue"), key7), "testGenerateMerge1 error 9"); - OSL_ENSURE(!key7.setValue(OUString(), RG_VALUETYPE_UNICODE, (void*)wValue.getStr(), ((wValue.getLength()+1)*sizeof(sal_Unicode))), "testGenerateMerge1 error 9a"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey4"), key8), "testGenerateMerge1 error 10"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey4/KeyWithBinaryValue"), key9), "testGenerateMerge1 error 11"); - OSL_ENSURE(!key9.setValue(OUString(), RG_VALUETYPE_BINARY, "abcdefghijklmnopqrstuvwxyz", 27), "testGenerateMerge1 error 11a"); - - - OSL_ENSURE(!key1.closeKey() && + REG_ENSURE(!myRegistry->create(OUString::createFromAscii("merge1.rdb")), "testGenerateMerge1 error 1"); + REG_ENSURE(!myRegistry->openRootKey(rootKey), "testGenerateMerge1 error 2"); + + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("MergeKey1"), key1), "testGenerateMerge1 error 3"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey1"), key2), "testGenerateMerge1 error 4"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey1/KeyWithLongValue"), key3), "testGenerateMerge1 error 5"); + REG_ENSURE(!key3.setValue(OUString(), RG_VALUETYPE_LONG, &lValue1, sizeof(sal_Int32)), "testGenerateMerge1 error 5a"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey2"), key4), "testGenerateMerge1 error 6"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey2/KeyWithStringValue"), key5), "testGenerateMerge1 error 7"); + REG_ENSURE(!key5.setValue(OUString(), RG_VALUETYPE_STRING, sValue, strlen(sValue)+1), "testGenerateMerge1 error 7a"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey3"), key6), "testGenerateMerge1 error 8"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey3/KeyWithUnicodeValue"), key7), "testGenerateMerge1 error 9"); + REG_ENSURE(!key7.setValue(OUString(), RG_VALUETYPE_UNICODE, (void*)wValue.getStr(), ((wValue.getLength()+1)*sizeof(sal_Unicode))), "testGenerateMerge1 error 9a"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey4"), key8), "testGenerateMerge1 error 10"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1/MK1SubKey4/KeyWithBinaryValue"), key9), "testGenerateMerge1 error 11"); + REG_ENSURE(!key9.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)"abcdefghijklmnopqrstuvwxyz", 27), "testGenerateMerge1 error 11a"); + + + REG_ENSURE(!key1.closeKey() && !key2.closeKey() && !key3.closeKey() && !key4.closeKey() && @@ -97,21 +88,21 @@ void test_generateMerge1() !key8.closeKey() && !key9.closeKey(), "testGenerateMerge1 error 12"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("MergeKey1u2"), key1), "testGenerateMerge1 error 13"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11"), key2), "testGenerateMerge1 error 14"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11/KeyWithLongValue"), key3), "testGenerateMerge1 error 15"); - OSL_ENSURE(!key3.setValue(OUString(), RG_VALUETYPE_LONG, &lValue2, sizeof(sal_Int32)), "testGenerateMerge1 error 15a"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12"), key4), "testGenerateMerge1 error 16"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12/KeyWithStringValue"), key5), "testGenerateMerge1 error 17"); - OSL_ENSURE(!key5.setValue(OUString(), RG_VALUETYPE_STRING, sValue, strlen(sValue)+1), "testGenerateMerge1 error 17a"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13"), key6), "testGenerateMerge1 error 18"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13/KeyWithUnicodeValue"), key7), "testGenerateMerge1 error 19"); - OSL_ENSURE(!key7.setValue(OUString(), RG_VALUETYPE_UNICODE, (void*)wValue.getStr(), ((wValue.getLength()+1)*sizeof(sal_Unicode))), "testGenerateMerge1 error 19a"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2"), key8), "testGenerateMerge1 error 20"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), key9), "testGenerateMerge1 error 21"); - OSL_ENSURE(!key9.setValue(OUString(), RG_VALUETYPE_LONG, &lValue3, sizeof(sal_Int32)), "testGenerateMerge1 error 21a"); - - OSL_ENSURE(!rootKey.closeKey() && + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("MergeKey1u2"), key1), "testGenerateMerge1 error 13"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11"), key2), "testGenerateMerge1 error 14"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11/KeyWithLongValue"), key3), "testGenerateMerge1 error 15"); + REG_ENSURE(!key3.setValue(OUString(), RG_VALUETYPE_LONG, &lValue2, sizeof(sal_Int32)), "testGenerateMerge1 error 15a"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12"), key4), "testGenerateMerge1 error 16"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12/KeyWithStringValue"), key5), "testGenerateMerge1 error 17"); + REG_ENSURE(!key5.setValue(OUString(), RG_VALUETYPE_STRING, sValue, strlen(sValue)+1), "testGenerateMerge1 error 17a"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13"), key6), "testGenerateMerge1 error 18"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13/KeyWithUnicodeValue"), key7), "testGenerateMerge1 error 19"); + REG_ENSURE(!key7.setValue(OUString(), RG_VALUETYPE_UNICODE, (void*)wValue.getStr(), ((wValue.getLength()+1)*sizeof(sal_Unicode))), "testGenerateMerge1 error 19a"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2"), key8), "testGenerateMerge1 error 20"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), key9), "testGenerateMerge1 error 21"); + REG_ENSURE(!key9.setValue(OUString(), RG_VALUETYPE_LONG, &lValue3, sizeof(sal_Int32)), "testGenerateMerge1 error 21a"); + + REG_ENSURE(!rootKey.closeKey() && !key1.closeKey() && !key2.closeKey() && !key3.closeKey() && @@ -131,37 +122,28 @@ void test_generateMerge1() void test_generateMerge2() { - RegistryLoader* pLoader = new RegistryLoader(); - - if (!pLoader->isLoaded()) - { - delete pLoader; - return; - } - - Registry *myRegistry = new Registry(*pLoader); - delete pLoader; + Registry *myRegistry = new Registry(); RegistryKey rootKey, key1, key2, key3, key4, key5, key6, key7, key8, key9; - OSL_ENSURE(!myRegistry->create(OUString::createFromAscii("merge2.rdb")), "testGenerateMerge2 error 1"); - OSL_ENSURE(!myRegistry->openRootKey(rootKey), "testGenerateMerge2 error 2"); - - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("MergeKey2"), key1), "testGenerateMerge2 error 3"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey1"), key2), "testGenerateMerge2 error 4"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey1/KeyWithBinaryValue"), key3), "testGenerateMerge2 error 5"); - OSL_ENSURE(!key3.setValue(OUString(), RG_VALUETYPE_BINARY, "1234567890", 11), "testGenerateMerge1 error 5a"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey2"), key4), "testGenerateMerge2 error 6"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey2/KeyWithUnicodeValue"), key5), "testGenerateMerge2 error 7"); - OSL_ENSURE(!key5.setValue(OUString(), RG_VALUETYPE_UNICODE, (void*)wValue.getStr(), ((wValue.getLength()+1)*sizeof(sal_Unicode))), "testGenerateMerge1 error 7a"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey3"), key6), "testGenerateMerge2 error 8"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey3/KeyWithStringValue"), key7), "testGenerateMerge2 error 9"); - OSL_ENSURE(!key7.setValue(OUString(), RG_VALUETYPE_STRING, sValue, strlen(sValue)+1), "testGenerateMerge1 error 9a"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey4"), key8), "testGenerateMerge2 error 10"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey4/KeyWithLongValue"), key9), "testGenerateMerge2 error 11"); - OSL_ENSURE(!key9.setValue(OUString(), RG_VALUETYPE_LONG, &lValue1, sizeof(sal_Int32)), "testGenerateMerge1 error 11a"); - - OSL_ENSURE(!key1.closeKey() && + REG_ENSURE(!myRegistry->create(OUString::createFromAscii("merge2.rdb")), "testGenerateMerge2 error 1"); + REG_ENSURE(!myRegistry->openRootKey(rootKey), "testGenerateMerge2 error 2"); + + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("MergeKey2"), key1), "testGenerateMerge2 error 3"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey1"), key2), "testGenerateMerge2 error 4"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey1/KeyWithBinaryValue"), key3), "testGenerateMerge2 error 5"); + REG_ENSURE(!key3.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)"1234567890", 11), "testGenerateMerge1 error 5a"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey2"), key4), "testGenerateMerge2 error 6"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey2/KeyWithUnicodeValue"), key5), "testGenerateMerge2 error 7"); + REG_ENSURE(!key5.setValue(OUString(), RG_VALUETYPE_UNICODE, (void*)wValue.getStr(), ((wValue.getLength()+1)*sizeof(sal_Unicode))), "testGenerateMerge1 error 7a"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey3"), key6), "testGenerateMerge2 error 8"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey3/KeyWithStringValue"), key7), "testGenerateMerge2 error 9"); + REG_ENSURE(!key7.setValue(OUString(), RG_VALUETYPE_STRING, sValue, strlen(sValue)+1), "testGenerateMerge1 error 9a"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey4"), key8), "testGenerateMerge2 error 10"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey2/MK2SubKey4/KeyWithLongValue"), key9), "testGenerateMerge2 error 11"); + REG_ENSURE(!key9.setValue(OUString(), RG_VALUETYPE_LONG, &lValue1, sizeof(sal_Int32)), "testGenerateMerge1 error 11a"); + + REG_ENSURE(!key1.closeKey() && !key2.closeKey() && !key3.closeKey() && !key4.closeKey() && @@ -171,21 +153,21 @@ void test_generateMerge2() !key8.closeKey() && !key9.closeKey(), "testGenerateMerge2 error 12"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("MergeKey1u2"), key1), "testGenerateMerge2 error 13"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21"), key2), "testGenerateMerge2 error 14"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21/KeyWithBinaryValue"), key3), "testGenerateMerge2 error 15"); - OSL_ENSURE(!key3.setValue(OUString(), RG_VALUETYPE_BINARY, "a1b2c3d4e5f6g7h8i9", 19), "testGenerateMerge1 error 15a"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22"), key4), "testGenerateMerge2 error 16"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22/KeyWithLongValue"), key5), "testGenerateMerge2 error 17"); - OSL_ENSURE(!key5.setValue(OUString(), RG_VALUETYPE_LONG, &lValue2, sizeof(sal_Int32)), "testGenerateMerge1 error 17a"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23"), key6), "testGenerateMerge2 error 18"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23/KeyWithStringValue"), key7), "testGenerateMerge2 error 19"); - OSL_ENSURE(!key7.setValue(OUString(), RG_VALUETYPE_STRING, sValue, strlen(sValue)+1), "testGenerateMerge1 error 19a"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2"), key8), "testGenerateMerge2 error 20"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), key9), "testGenerateMerge2 error 21"); - OSL_ENSURE(!key9.setValue(OUString(), RG_VALUETYPE_LONG, &lValue4, sizeof(sal_Int32)), "testGenerateMerge1 error 21a"); - - OSL_ENSURE(!rootKey.closeKey() && + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("MergeKey1u2"), key1), "testGenerateMerge2 error 13"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21"), key2), "testGenerateMerge2 error 14"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21/KeyWithBinaryValue"), key3), "testGenerateMerge2 error 15"); + REG_ENSURE(!key3.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)"a1b2c3d4e5f6g7h8i9", 19), "testGenerateMerge1 error 15a"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22"), key4), "testGenerateMerge2 error 16"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22/KeyWithLongValue"), key5), "testGenerateMerge2 error 17"); + REG_ENSURE(!key5.setValue(OUString(), RG_VALUETYPE_LONG, &lValue2, sizeof(sal_Int32)), "testGenerateMerge1 error 17a"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23"), key6), "testGenerateMerge2 error 18"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23/KeyWithStringValue"), key7), "testGenerateMerge2 error 19"); + REG_ENSURE(!key7.setValue(OUString(), RG_VALUETYPE_STRING, sValue, strlen(sValue)+1), "testGenerateMerge1 error 19a"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2"), key8), "testGenerateMerge2 error 20"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), key9), "testGenerateMerge2 error 21"); + REG_ENSURE(!key9.setValue(OUString(), RG_VALUETYPE_LONG, &lValue4, sizeof(sal_Int32)), "testGenerateMerge1 error 21a"); + + REG_ENSURE(!rootKey.closeKey() && !key1.closeKey() && !key2.closeKey() && !key3.closeKey() && @@ -205,128 +187,119 @@ void test_generateMerge2() void test_merge() { - RegistryLoader* pLoader = new RegistryLoader(); - - if (!pLoader->isLoaded()) - { - delete pLoader; - return; - } - - Registry *myRegistry = new Registry(*pLoader); - delete pLoader; + Registry *myRegistry = new Registry(); RegistryKey rootKey, key1, mkey1, key2, mkey2, key1u2, mkey1u2; - OSL_ENSURE(!myRegistry->create(OUString::createFromAscii("mergetest.rdb")), "testMerge error 1"); - OSL_ENSURE(myRegistry->getName().equals(OUString::createFromAscii("mergetest.rdb")), "testMerge error 1.a)"); - OSL_ENSURE(!myRegistry->openRootKey(rootKey), "testMerge error 2"); - OSL_ENSURE(!myRegistry->loadKey(rootKey, OUString::createFromAscii("/stardiv/IchbineinMergeKey"), + REG_ENSURE(!myRegistry->create(OUString::createFromAscii("mergetest.rdb")), "testMerge error 1"); + REG_ENSURE(myRegistry->getName().equals(OUString::createFromAscii("mergetest.rdb")), "testMerge error 1.a)"); + REG_ENSURE(!myRegistry->openRootKey(rootKey), "testMerge error 2"); + REG_ENSURE(!myRegistry->loadKey(rootKey, OUString::createFromAscii("/stardiv/IchbineinMergeKey"), OUString::createFromAscii("merge1.rdb")), "testMerge error 3"); - OSL_ENSURE(!myRegistry->mergeKey(rootKey, OUString::createFromAscii("/stardiv/IchbineinMergeKey"), + REG_ENSURE(!myRegistry->mergeKey(rootKey, OUString::createFromAscii("/stardiv/IchbineinMergeKey"), OUString::createFromAscii("merge2.rdb")), "testMerge error 4"); /////////////////////////////////////////////////////////////////////////// - OSL_ENSURE(!rootKey.openKey(OUString::createFromAscii("/stardiv/IchbineinMergeKey"), key1), "testMerge error 5"); + REG_ENSURE(!rootKey.openKey(OUString::createFromAscii("/stardiv/IchbineinMergeKey"), key1), "testMerge error 5"); - OSL_ENSURE(!key1.openKey(OUString::createFromAscii("MergeKey1"), mkey1), "testMerge error 6"); - OSL_ENSURE(!mkey1.closeKey(), "testMerge error 7"); + REG_ENSURE(!key1.openKey(OUString::createFromAscii("MergeKey1"), mkey1), "testMerge error 6"); + REG_ENSURE(!mkey1.closeKey(), "testMerge error 7"); - OSL_ENSURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey1"), mkey1), "testMerge error 8"); - OSL_ENSURE(!mkey1.closeKey(), "testMerge error 9"); - OSL_ENSURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey1/KeyWithLongValue"), mkey1), "testMerge error 10"); - OSL_ENSURE(!mkey1.closeKey(), "testMerge error 11"); + REG_ENSURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey1"), mkey1), "testMerge error 8"); + REG_ENSURE(!mkey1.closeKey(), "testMerge error 9"); + REG_ENSURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey1/KeyWithLongValue"), mkey1), "testMerge error 10"); + REG_ENSURE(!mkey1.closeKey(), "testMerge error 11"); - OSL_ENSURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey2"), mkey1), "testMerge error 12"); - OSL_ENSURE(!mkey1.closeKey(), "testMerge error 13"); - OSL_ENSURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey2/KeyWithStringValue"), mkey1), "testMerge error 14"); - OSL_ENSURE(!mkey1.closeKey(), "testMerge error 15"); + REG_ENSURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey2"), mkey1), "testMerge error 12"); + REG_ENSURE(!mkey1.closeKey(), "testMerge error 13"); + REG_ENSURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey2/KeyWithStringValue"), mkey1), "testMerge error 14"); + REG_ENSURE(!mkey1.closeKey(), "testMerge error 15"); - OSL_ENSURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey3"), mkey1), "testMerge error 16"); - OSL_ENSURE(!mkey1.closeKey(), "testMerge error 17"); - OSL_ENSURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey3/KeyWithUnicodeValue"), mkey1), "testMerge error 18"); - OSL_ENSURE(!mkey1.closeKey(), "testMerge error 19"); + REG_ENSURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey3"), mkey1), "testMerge error 16"); + REG_ENSURE(!mkey1.closeKey(), "testMerge error 17"); + REG_ENSURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey3/KeyWithUnicodeValue"), mkey1), "testMerge error 18"); + REG_ENSURE(!mkey1.closeKey(), "testMerge error 19"); - OSL_ENSURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey4"), mkey1), "testMerge error 20"); - OSL_ENSURE(!mkey1.closeKey(), "testMerge error 21"); - OSL_ENSURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey4/KeyWithBinaryValue"), mkey1), "testMerge error 22"); - OSL_ENSURE(!mkey1.closeKey(), "testMerge error 23"); + REG_ENSURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey4"), mkey1), "testMerge error 20"); + REG_ENSURE(!mkey1.closeKey(), "testMerge error 21"); + REG_ENSURE(!key1.openKey(OUString::createFromAscii("/MergeKey1/MK1SubKey4/KeyWithBinaryValue"), mkey1), "testMerge error 22"); + REG_ENSURE(!mkey1.closeKey(), "testMerge error 23"); - OSL_ENSURE(!key1.closeKey(), "testMerge error 24"); + REG_ENSURE(!key1.closeKey(), "testMerge error 24"); /////////////////////////////////////////////////////////////////////////// - OSL_ENSURE(!rootKey.openKey(OUString::createFromAscii("/stardiv/IchbineinMergeKey"), key2), "testMerge error 25"); + REG_ENSURE(!rootKey.openKey(OUString::createFromAscii("/stardiv/IchbineinMergeKey"), key2), "testMerge error 25"); - OSL_ENSURE(!key2.openKey(OUString::createFromAscii("MergeKey2"), mkey2), "testMerge error 26"); - OSL_ENSURE(!mkey2.closeKey(), "testMerge error 27"); + REG_ENSURE(!key2.openKey(OUString::createFromAscii("MergeKey2"), mkey2), "testMerge error 26"); + REG_ENSURE(!mkey2.closeKey(), "testMerge error 27"); - OSL_ENSURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey1"), mkey2), "testMerge error 28"); - OSL_ENSURE(!mkey2.closeKey(), "testMerge error 29"); - OSL_ENSURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey1/KeyWithBinaryValue"), mkey2), "testMerge error 30"); - OSL_ENSURE(!mkey2.closeKey(), "testMerge error 31"); + REG_ENSURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey1"), mkey2), "testMerge error 28"); + REG_ENSURE(!mkey2.closeKey(), "testMerge error 29"); + REG_ENSURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey1/KeyWithBinaryValue"), mkey2), "testMerge error 30"); + REG_ENSURE(!mkey2.closeKey(), "testMerge error 31"); - OSL_ENSURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey2"), mkey2), "testMerge error 31"); - OSL_ENSURE(!mkey2.closeKey(), "testMerge error 33"); - OSL_ENSURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey2/KeyWithUnicodeValue"), mkey2), "testMerge error 34"); - OSL_ENSURE(!mkey2.closeKey(), "testMerge error 35"); + REG_ENSURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey2"), mkey2), "testMerge error 31"); + REG_ENSURE(!mkey2.closeKey(), "testMerge error 33"); + REG_ENSURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey2/KeyWithUnicodeValue"), mkey2), "testMerge error 34"); + REG_ENSURE(!mkey2.closeKey(), "testMerge error 35"); - OSL_ENSURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey3"), mkey2), "testMerge error 36"); - OSL_ENSURE(!mkey2.closeKey(), "testMerge error 37"); - OSL_ENSURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey3/KeyWithStringValue"), mkey2), "testMerge error 38"); - OSL_ENSURE(!mkey2.closeKey(), "testMerge error 39"); + REG_ENSURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey3"), mkey2), "testMerge error 36"); + REG_ENSURE(!mkey2.closeKey(), "testMerge error 37"); + REG_ENSURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey3/KeyWithStringValue"), mkey2), "testMerge error 38"); + REG_ENSURE(!mkey2.closeKey(), "testMerge error 39"); - OSL_ENSURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey4"), mkey2), "testMerge error 40"); - OSL_ENSURE(!mkey2.closeKey(), "testMerge error 41"); - OSL_ENSURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey4/KeyWithLongValue"), mkey2), "testMerge error 42"); - OSL_ENSURE(!mkey2.closeKey(), "testMerge error 43"); + REG_ENSURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey4"), mkey2), "testMerge error 40"); + REG_ENSURE(!mkey2.closeKey(), "testMerge error 41"); + REG_ENSURE(!key2.openKey(OUString::createFromAscii("/MergeKey2/MK2SubKey4/KeyWithLongValue"), mkey2), "testMerge error 42"); + REG_ENSURE(!mkey2.closeKey(), "testMerge error 43"); - OSL_ENSURE(!key2.closeKey(), "testMerge error 44"); + REG_ENSURE(!key2.closeKey(), "testMerge error 44"); /////////////////////////////////////////////////////////////////////////// - OSL_ENSURE(!rootKey.openKey(OUString::createFromAscii("/stardiv/IchbineinMergeKey"), key1u2), "testMerge error 40"); + REG_ENSURE(!rootKey.openKey(OUString::createFromAscii("/stardiv/IchbineinMergeKey"), key1u2), "testMerge error 40"); - OSL_ENSURE(!key1u2.openKey(OUString::createFromAscii("MergeKey1u2"), mkey1u2), "testMerge error 41"); - OSL_ENSURE(!mkey1u2.closeKey(), "testMerge error 42"); + REG_ENSURE(!key1u2.openKey(OUString::createFromAscii("MergeKey1u2"), mkey1u2), "testMerge error 41"); + REG_ENSURE(!mkey1u2.closeKey(), "testMerge error 42"); - OSL_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11"), mkey1u2), "testMerge error 43"); - OSL_ENSURE(!mkey1u2.closeKey(), "testMerge error 44"); - OSL_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11/KeyWithLongValue"), mkey1u2), "testMerge error 45"); - OSL_ENSURE(!mkey1u2.closeKey(), "testMerge error 46"); + REG_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11"), mkey1u2), "testMerge error 43"); + REG_ENSURE(!mkey1u2.closeKey(), "testMerge error 44"); + REG_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11/KeyWithLongValue"), mkey1u2), "testMerge error 45"); + REG_ENSURE(!mkey1u2.closeKey(), "testMerge error 46"); - OSL_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12"), mkey1u2), "testMerge error 47"); - OSL_ENSURE(!mkey1u2.closeKey(), "testMerge error 48"); - OSL_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12/KeyWithStringValue"), mkey1u2), "testMerge error 49"); - OSL_ENSURE(!mkey1u2.closeKey(), "testMerge error 50"); + REG_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12"), mkey1u2), "testMerge error 47"); + REG_ENSURE(!mkey1u2.closeKey(), "testMerge error 48"); + REG_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12/KeyWithStringValue"), mkey1u2), "testMerge error 49"); + REG_ENSURE(!mkey1u2.closeKey(), "testMerge error 50"); - OSL_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13"), mkey1u2), "testMerge error 51"); - OSL_ENSURE(!mkey1u2.closeKey(), "testMerge error 52"); - OSL_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13/KeyWithUnicodeValue"), mkey1u2), "testMerge error 53"); - OSL_ENSURE(!mkey1u2.closeKey(), "testMerge error 54"); + REG_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13"), mkey1u2), "testMerge error 51"); + REG_ENSURE(!mkey1u2.closeKey(), "testMerge error 52"); + REG_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13/KeyWithUnicodeValue"), mkey1u2), "testMerge error 53"); + REG_ENSURE(!mkey1u2.closeKey(), "testMerge error 54"); - OSL_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21"), mkey1u2), "testMerge error 55"); - OSL_ENSURE(!mkey1u2.closeKey(), "testMerge error 56"); - OSL_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21/KeyWithBinaryValue"), mkey1u2), "testMerge error 57"); - OSL_ENSURE(!mkey1u2.closeKey(), "testMerge error 58"); + REG_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21"), mkey1u2), "testMerge error 55"); + REG_ENSURE(!mkey1u2.closeKey(), "testMerge error 56"); + REG_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21/KeyWithBinaryValue"), mkey1u2), "testMerge error 57"); + REG_ENSURE(!mkey1u2.closeKey(), "testMerge error 58"); - OSL_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22"), mkey1u2), "testMerge error 59"); - OSL_ENSURE(!mkey1u2.closeKey(), "testMerge error 60"); - OSL_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22/KeyWithLongValue"), mkey1u2), "testMerge error 61"); - OSL_ENSURE(!mkey1u2.closeKey(), "testMerge error 62"); + REG_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22"), mkey1u2), "testMerge error 59"); + REG_ENSURE(!mkey1u2.closeKey(), "testMerge error 60"); + REG_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22/KeyWithLongValue"), mkey1u2), "testMerge error 61"); + REG_ENSURE(!mkey1u2.closeKey(), "testMerge error 62"); - OSL_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23"), mkey1u2), "testMerge error 63"); - OSL_ENSURE(!mkey1u2.closeKey(), "testMerge error 64"); - OSL_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23/KeyWithStringValue"), mkey1u2), "testMerge error 65"); - OSL_ENSURE(!mkey1u2.closeKey(), "testMerge error 66"); + REG_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23"), mkey1u2), "testMerge error 63"); + REG_ENSURE(!mkey1u2.closeKey(), "testMerge error 64"); + REG_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23/KeyWithStringValue"), mkey1u2), "testMerge error 65"); + REG_ENSURE(!mkey1u2.closeKey(), "testMerge error 66"); - OSL_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2"), mkey1u2), "testMerge error 67"); - OSL_ENSURE(!mkey1u2.closeKey(), "testMerge error 68"); - OSL_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), mkey1u2), "testMerge error 69"); - OSL_ENSURE(!mkey1u2.closeKey(), "testMerge error 70"); + REG_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2"), mkey1u2), "testMerge error 67"); + REG_ENSURE(!mkey1u2.closeKey(), "testMerge error 68"); + REG_ENSURE(!key1u2.openKey(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), mkey1u2), "testMerge error 69"); + REG_ENSURE(!mkey1u2.closeKey(), "testMerge error 70"); - OSL_ENSURE(!key1u2.closeKey(), "testMerge error 71"); + REG_ENSURE(!key1u2.closeKey(), "testMerge error 71"); /////////////////////////////////////////////////////////////////////////// @@ -335,113 +308,113 @@ void test_merge() sal_Int32 int32Value; sal_uInt8 *Value; - OSL_ENSURE(!rootKey.openKey(OUString::createFromAscii("/stardiv/IchbineinMergeKey"), key1), "testMerge error 72"); + REG_ENSURE(!rootKey.openKey(OUString::createFromAscii("/stardiv/IchbineinMergeKey"), key1), "testMerge error 72"); - OSL_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1/MK1SubKey1/KeyWithLongValue"), &valueType, &valueSize), "testMerge error 73"); - OSL_ENSURE(valueType == RG_VALUETYPE_LONG && valueSize == sizeof(sal_Int32), "testMerge error 74"); - OSL_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1/MK1SubKey1/KeyWithLongValue"), (RegValue)&int32Value), "testMerge error 74.a)"); - OSL_ENSURE(int32Value == lValue1, "testMerge error 74.b)"); + REG_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1/MK1SubKey1/KeyWithLongValue"), &valueType, &valueSize), "testMerge error 73"); + REG_ENSURE(valueType == RG_VALUETYPE_LONG && valueSize == sizeof(sal_Int32), "testMerge error 74"); + REG_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1/MK1SubKey1/KeyWithLongValue"), (RegValue)&int32Value), "testMerge error 74.a)"); + REG_ENSURE(int32Value == lValue1, "testMerge error 74.b)"); - OSL_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1/MK1SubKey2/KeyWithStringValue"), &valueType, &valueSize), "testMerge error 75"); - OSL_ENSURE(valueType == RG_VALUETYPE_STRING && valueSize == strlen(sValue)+1, "testMerge error 76"); + REG_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1/MK1SubKey2/KeyWithStringValue"), &valueType, &valueSize), "testMerge error 75"); + REG_ENSURE(valueType == RG_VALUETYPE_STRING && valueSize == strlen(sValue)+1, "testMerge error 76"); Value = new sal_uInt8[valueSize]; - OSL_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1/MK1SubKey2/KeyWithStringValue"), (RegValue)Value), "testMerge error 76.a)"); - OSL_ENSURE(strcmp((const sal_Char*)Value, sValue) == 0, "testMerge error 76.b)"); + REG_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1/MK1SubKey2/KeyWithStringValue"), (RegValue)Value), "testMerge error 76.a)"); + REG_ENSURE(strcmp((const sal_Char*)Value, sValue) == 0, "testMerge error 76.b)"); delete(Value); - OSL_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1/MK1SubKey3/KeyWithUnicodeValue"), &valueType, &valueSize), "testMerge error 77"); - OSL_ENSURE(valueType == RG_VALUETYPE_UNICODE && valueSize == (wValue.getLength()+1)*sizeof(sal_Unicode), "testMerge error 78"); + REG_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1/MK1SubKey3/KeyWithUnicodeValue"), &valueType, &valueSize), "testMerge error 77"); + REG_ENSURE(valueType == RG_VALUETYPE_UNICODE && valueSize == (wValue.getLength()+1)*sizeof(sal_Unicode), "testMerge error 78"); Value = new sal_uInt8[valueSize]; - OSL_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1/MK1SubKey3/KeyWithUnicodeValue"), (RegValue)Value), "testMerge error 78.a)"); - OSL_ENSURE(wValue.equals( (const sal_Unicode*)Value ), "testMerge error 78.b)"); + REG_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1/MK1SubKey3/KeyWithUnicodeValue"), (RegValue)Value), "testMerge error 78.a)"); + REG_ENSURE(wValue.equals( (const sal_Unicode*)Value ), "testMerge error 78.b)"); delete(Value); - OSL_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1/MK1SubKey4/KeyWithBinaryValue"), &valueType, &valueSize), "testMerge error 79"); - OSL_ENSURE(valueType == RG_VALUETYPE_BINARY && valueSize == 27, "testMerge error 80"); + REG_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1/MK1SubKey4/KeyWithBinaryValue"), &valueType, &valueSize), "testMerge error 79"); + REG_ENSURE(valueType == RG_VALUETYPE_BINARY && valueSize == 27, "testMerge error 80"); Value = new sal_uInt8[valueSize]; - OSL_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1/MK1SubKey4/KeyWithBinaryValue"), (RegValue)Value), "testMerge error 80.a)"); - OSL_ENSURE(strcmp((const sal_Char*)Value, "abcdefghijklmnopqrstuvwxyz") == 0, "testMerge error 80.b)"); + REG_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1/MK1SubKey4/KeyWithBinaryValue"), (RegValue)Value), "testMerge error 80.a)"); + REG_ENSURE(strcmp((const sal_Char*)Value, "abcdefghijklmnopqrstuvwxyz") == 0, "testMerge error 80.b)"); delete(Value); - OSL_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey2/MK2SubKey1/KeyWithBinaryValue"), &valueType, &valueSize), "testMerge error 81"); - OSL_ENSURE(valueType == RG_VALUETYPE_BINARY && valueSize == 11, "testMerge error 82"); + REG_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey2/MK2SubKey1/KeyWithBinaryValue"), &valueType, &valueSize), "testMerge error 81"); + REG_ENSURE(valueType == RG_VALUETYPE_BINARY && valueSize == 11, "testMerge error 82"); Value = new sal_uInt8[valueSize]; - OSL_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey2/MK2SubKey1/KeyWithBinaryValue"), (RegValue)Value), "testMerge error 82.a)"); - OSL_ENSURE(strcmp((const sal_Char*)Value, "1234567890") == 0, "testMerge error 82.b)"); + REG_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey2/MK2SubKey1/KeyWithBinaryValue"), (RegValue)Value), "testMerge error 82.a)"); + REG_ENSURE(strcmp((const sal_Char*)Value, "1234567890") == 0, "testMerge error 82.b)"); delete(Value); - OSL_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey2/MK2SubKey2/KeyWithUnicodeValue"), &valueType, &valueSize), "testMerge error 83"); - OSL_ENSURE(valueType == RG_VALUETYPE_UNICODE&& valueSize == (wValue.getLength()+1)*sizeof(sal_Unicode), "testMerge error 84"); + REG_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey2/MK2SubKey2/KeyWithUnicodeValue"), &valueType, &valueSize), "testMerge error 83"); + REG_ENSURE(valueType == RG_VALUETYPE_UNICODE&& valueSize == (wValue.getLength()+1)*sizeof(sal_Unicode), "testMerge error 84"); Value = new sal_uInt8[valueSize]; - OSL_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey2/MK2SubKey2/KeyWithUnicodeValue"), (RegValue)Value), "testMerge error 84.a)"); - OSL_ENSURE(wValue.equals( (const sal_Unicode*)Value ), "testMerge error 84.b)"); + REG_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey2/MK2SubKey2/KeyWithUnicodeValue"), (RegValue)Value), "testMerge error 84.a)"); + REG_ENSURE(wValue.equals( (const sal_Unicode*)Value ), "testMerge error 84.b)"); delete(Value); - OSL_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey2/MK2SubKey3/KeyWithStringValue"), &valueType, &valueSize), "testMerge error 85"); - OSL_ENSURE(valueType == RG_VALUETYPE_STRING && valueSize == strlen(sValue)+1, "testMerge error 86"); + REG_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey2/MK2SubKey3/KeyWithStringValue"), &valueType, &valueSize), "testMerge error 85"); + REG_ENSURE(valueType == RG_VALUETYPE_STRING && valueSize == strlen(sValue)+1, "testMerge error 86"); Value = new sal_uInt8[valueSize]; - OSL_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey2/MK2SubKey3/KeyWithStringValue"), (RegValue)Value), "testMerge error 86.a)"); - OSL_ENSURE(strcmp((const sal_Char*)Value, sValue) == 0, "testMerge error 86.b)"); + REG_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey2/MK2SubKey3/KeyWithStringValue"), (RegValue)Value), "testMerge error 86.a)"); + REG_ENSURE(strcmp((const sal_Char*)Value, sValue) == 0, "testMerge error 86.b)"); delete(Value); - OSL_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey2/MK2SubKey4/KeyWithLongValue"), &valueType, &valueSize), "testMerge error 87"); - OSL_ENSURE(valueType == RG_VALUETYPE_LONG && valueSize == sizeof(sal_Int32), "testMerge error 88"); - OSL_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey2/MK2SubKey4/KeyWithLongValue"), (RegValue)&int32Value), "testMerge error 88.a)"); - OSL_ENSURE(int32Value == lValue1, "testMerge error 88.b)"); + REG_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey2/MK2SubKey4/KeyWithLongValue"), &valueType, &valueSize), "testMerge error 87"); + REG_ENSURE(valueType == RG_VALUETYPE_LONG && valueSize == sizeof(sal_Int32), "testMerge error 88"); + REG_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey2/MK2SubKey4/KeyWithLongValue"), (RegValue)&int32Value), "testMerge error 88.a)"); + REG_ENSURE(int32Value == lValue1, "testMerge error 88.b)"); - OSL_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11/KeyWithLongValue"), &valueType, &valueSize), "testMerge error 89"); - OSL_ENSURE(valueType == RG_VALUETYPE_LONG && valueSize == sizeof(sal_Int32), "testMerge error 90"); - OSL_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11/KeyWithLongValue"), (RegValue)&int32Value), "testMerge error 90.a)"); - OSL_ENSURE(int32Value == lValue2, "testMerge error 90.b)"); + REG_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11/KeyWithLongValue"), &valueType, &valueSize), "testMerge error 89"); + REG_ENSURE(valueType == RG_VALUETYPE_LONG && valueSize == sizeof(sal_Int32), "testMerge error 90"); + REG_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK1SubKey11/KeyWithLongValue"), (RegValue)&int32Value), "testMerge error 90.a)"); + REG_ENSURE(int32Value == lValue2, "testMerge error 90.b)"); - OSL_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12/KeyWithStringValue"), &valueType, &valueSize), "testMerge error 91"); - OSL_ENSURE(valueType == RG_VALUETYPE_STRING && valueSize == strlen(sValue)+1, "testMerge error 92"); + REG_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12/KeyWithStringValue"), &valueType, &valueSize), "testMerge error 91"); + REG_ENSURE(valueType == RG_VALUETYPE_STRING && valueSize == strlen(sValue)+1, "testMerge error 92"); Value = new sal_uInt8[valueSize]; - OSL_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12/KeyWithStringValue"), (RegValue)Value), "testMerge error 92.a)"); - OSL_ENSURE(strcmp((const sal_Char*)Value, sValue) == 0, "testMerge error 92.b)"); + REG_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK1SubKey12/KeyWithStringValue"), (RegValue)Value), "testMerge error 92.a)"); + REG_ENSURE(strcmp((const sal_Char*)Value, sValue) == 0, "testMerge error 92.b)"); delete(Value); - OSL_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13/KeyWithUnicodeValue"), &valueType, &valueSize), "testMerge error 93"); - OSL_ENSURE(valueType == RG_VALUETYPE_UNICODE && valueSize == (wValue.getLength()+1)*sizeof(sal_Unicode), "testMerge error 94"); + REG_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13/KeyWithUnicodeValue"), &valueType, &valueSize), "testMerge error 93"); + REG_ENSURE(valueType == RG_VALUETYPE_UNICODE && valueSize == (wValue.getLength()+1)*sizeof(sal_Unicode), "testMerge error 94"); Value = new sal_uInt8[valueSize]; - OSL_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13/KeyWithUnicodeValue"), (RegValue)Value), "testMerge error 94.a)"); - OSL_ENSURE(wValue.equals( (const sal_Unicode*)Value ), "testMerge error 94.b)"); + REG_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK1SubKey13/KeyWithUnicodeValue"), (RegValue)Value), "testMerge error 94.a)"); + REG_ENSURE(wValue.equals( (const sal_Unicode*)Value ), "testMerge error 94.b)"); delete(Value); - OSL_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21/KeyWithBinaryValue"), &valueType, &valueSize), "testMerge error 95"); - OSL_ENSURE(valueType == RG_VALUETYPE_BINARY && valueSize == 19, "testMerge error 96"); + REG_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21/KeyWithBinaryValue"), &valueType, &valueSize), "testMerge error 95"); + REG_ENSURE(valueType == RG_VALUETYPE_BINARY && valueSize == 19, "testMerge error 96"); Value = new sal_uInt8[valueSize]; - OSL_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21/KeyWithBinaryValue"), (RegValue)Value), "testMerge error 96.a)"); - OSL_ENSURE(strcmp((const sal_Char*)Value, "a1b2c3d4e5f6g7h8i9") == 0, "testMerge error 96.b)"); + REG_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK2SubKey21/KeyWithBinaryValue"), (RegValue)Value), "testMerge error 96.a)"); + REG_ENSURE(strcmp((const sal_Char*)Value, "a1b2c3d4e5f6g7h8i9") == 0, "testMerge error 96.b)"); delete(Value); - OSL_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22/KeyWithLongValue"), &valueType, &valueSize), "testMerge error 97"); - OSL_ENSURE(valueType == RG_VALUETYPE_LONG && valueSize == sizeof(sal_Int32), "testMerge error 98"); - OSL_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22/KeyWithLongValue"), (RegValue)&int32Value), "testMerge error 98.a)"); - OSL_ENSURE(int32Value == lValue2, "testMerge error 98.b)"); + REG_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22/KeyWithLongValue"), &valueType, &valueSize), "testMerge error 97"); + REG_ENSURE(valueType == RG_VALUETYPE_LONG && valueSize == sizeof(sal_Int32), "testMerge error 98"); + REG_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK2SubKey22/KeyWithLongValue"), (RegValue)&int32Value), "testMerge error 98.a)"); + REG_ENSURE(int32Value == lValue2, "testMerge error 98.b)"); - OSL_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23/KeyWithStringValue"), &valueType, &valueSize), "testMerge error 99"); - OSL_ENSURE(valueType == RG_VALUETYPE_STRING && valueSize == strlen(sValue)+1, "testMerge error 100"); + REG_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23/KeyWithStringValue"), &valueType, &valueSize), "testMerge error 99"); + REG_ENSURE(valueType == RG_VALUETYPE_STRING && valueSize == strlen(sValue)+1, "testMerge error 100"); Value = new sal_uInt8[valueSize]; - OSL_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23/KeyWithStringValue"), (RegValue)Value), "testMerge error 100.a)"); - OSL_ENSURE(strcmp((const sal_Char*)Value, sValue) == 0, "testMerge error 100.b)"); + REG_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK2SubKey23/KeyWithStringValue"), (RegValue)Value), "testMerge error 100.a)"); + REG_ENSURE(strcmp((const sal_Char*)Value, sValue) == 0, "testMerge error 100.b)"); delete(Value); - OSL_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), &valueType, &valueSize), "testMerge error 101"); - OSL_ENSURE(valueType == RG_VALUETYPE_LONG && valueSize == sizeof(sal_Int32), "testMerge error 102"); - OSL_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), (RegValue)&int32Value), "testMerge error 102.a)"); - OSL_ENSURE(int32Value == lValue4, "testMerge error 102.b)"); + REG_ENSURE(!key1.getValueInfo(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), &valueType, &valueSize), "testMerge error 101"); + REG_ENSURE(valueType == RG_VALUETYPE_LONG && valueSize == sizeof(sal_Int32), "testMerge error 102"); + REG_ENSURE(!key1.getValue(OUString::createFromAscii("/MergeKey1u2/MK12SubKey1u2/KeyWithLongValue"), (RegValue)&int32Value), "testMerge error 102.a)"); + REG_ENSURE(int32Value == lValue4, "testMerge error 102.b)"); - OSL_ENSURE(!key1.closeKey(), "testMerge error 24"); + REG_ENSURE(!key1.closeKey(), "testMerge error 24"); /////////////////////////////////////////////////////////////////////////// - OSL_ENSURE(!rootKey.closeKey(), "testMerge error 10"); + REG_ENSURE(!rootKey.closeKey(), "testMerge error 10"); - OSL_ENSURE(!myRegistry->destroy( OUString::createFromAscii("merge1.rdb") ), "test_registry_CppApi error 11"); - OSL_ENSURE(!myRegistry->destroy( OUString::createFromAscii("merge2.rdb") ), "test_registry_CppApi error 12"); - OSL_ENSURE(!myRegistry->destroy( OUString() ), "test_registry_CppApi error 13"); + REG_ENSURE(!myRegistry->destroy( OUString::createFromAscii("merge1.rdb") ), "test_registry_CppApi error 11"); + REG_ENSURE(!myRegistry->destroy( OUString::createFromAscii("merge2.rdb") ), "test_registry_CppApi error 12"); + REG_ENSURE(!myRegistry->destroy( OUString() ), "test_registry_CppApi error 13"); delete(myRegistry); diff --git a/registry/test/testregcpp.cxx b/registry/test/testregcpp.cxx index 33df5a6bd1a9..241442710605 100644 --- a/registry/test/testregcpp.cxx +++ b/registry/test/testregcpp.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: testregcpp.cxx,v $ - * $Revision: 1.9 $ + * $Revision: 1.9.10.2 $ * * This file is part of OpenOffice.org. * @@ -38,7 +38,7 @@ #include "registry/registry.hxx" #include "registry/reflread.hxx" #include "registry/reflwrit.hxx" -#include +#include "regdiagnose.h" #include #include @@ -47,50 +47,24 @@ using namespace rtl; void test_coreReflection() { - RegistryLoader* pLoader = new RegistryLoader(); - - if (!pLoader->isLoaded()) - { - delete pLoader; - return; - } - - RegistryTypeWriterLoader* pWriterLoader = new RegistryTypeWriterLoader(); - - if (!pWriterLoader->isLoaded()) - { - delete pWriterLoader; - return; - } - - RegistryTypeReaderLoader* pReaderLoader = new RegistryTypeReaderLoader(); - - if (!pReaderLoader->isLoaded()) - { - delete pReaderLoader; - return; - } - - Registry *myRegistry = new Registry(*pLoader); - delete pLoader; + Registry *myRegistry = new Registry(); RegistryKey rootKey, key1, key2, key3, key4 ,key5, key6, key7, key8; - OSL_ENSURE(!myRegistry->create(OUString::createFromAscii("ucrtest.rdb")), "testCoreReflection error 1"); - OSL_ENSURE(!myRegistry->openRootKey(rootKey), "testCoreReflection error 2"); + REG_ENSURE(!myRegistry->create(OUString::createFromAscii("ucrtest.rdb")), "testCoreReflection error 1"); + REG_ENSURE(!myRegistry->openRootKey(rootKey), "testCoreReflection error 2"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("UCR"), key1), "testCoreReflection error 3"); - OSL_ENSURE(!key1.createKey(OUString::createFromAscii("ModuleA"), key2), "testCoreReflection error 4"); - OSL_ENSURE(!key2.createKey(OUString::createFromAscii("StructA"), key3), "testCoreReflection error 5"); - OSL_ENSURE(!key2.createKey(OUString::createFromAscii("EnumA"), key4), "testCoreReflection error 6"); - OSL_ENSURE(!key2.createKey(OUString::createFromAscii("XInterfaceA"), key5), "testCoreReflection error 7"); - OSL_ENSURE(!key2.createKey(OUString::createFromAscii("ExceptionA"), key6), "testCoreReflection error 8"); - OSL_ENSURE(!key2.createKey(OUString::createFromAscii("ServiceA"), key7), "testCoreReflection error 8a"); - OSL_ENSURE(!key2.createKey(OUString::createFromAscii("ConstantsA"), key8), "testCoreReflection error 8b"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("UCR"), key1), "testCoreReflection error 3"); + REG_ENSURE(!key1.createKey(OUString::createFromAscii("ModuleA"), key2), "testCoreReflection error 4"); + REG_ENSURE(!key2.createKey(OUString::createFromAscii("StructA"), key3), "testCoreReflection error 5"); + REG_ENSURE(!key2.createKey(OUString::createFromAscii("EnumA"), key4), "testCoreReflection error 6"); + REG_ENSURE(!key2.createKey(OUString::createFromAscii("XInterfaceA"), key5), "testCoreReflection error 7"); + REG_ENSURE(!key2.createKey(OUString::createFromAscii("ExceptionA"), key6), "testCoreReflection error 8"); + REG_ENSURE(!key2.createKey(OUString::createFromAscii("ServiceA"), key7), "testCoreReflection error 8a"); + REG_ENSURE(!key2.createKey(OUString::createFromAscii("ConstantsA"), key8), "testCoreReflection error 8b"); { - RegistryTypeWriter writer(*pWriterLoader, - RT_TYPE_MODULE, + RegistryTypeWriter writer(RT_TYPE_MODULE, OUString::createFromAscii("ModuleA"), OUString(), 11, 0, 0); @@ -170,35 +144,34 @@ void test_coreReflection() const sal_uInt8* pBlop = writer.getBlop(); sal_uInt32 aBlopSize = writer.getBlopSize(); - OSL_ENSURE(!key2.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9"); + REG_ENSURE(!key2.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9"); sal_uInt8* readBlop = (sal_uInt8*)rtl_allocateMemory(aBlopSize); - OSL_ENSURE(!key2.getValue(OUString(), (void*)readBlop) , "testCoreReflection error 9a"); + REG_ENSURE(!key2.getValue(OUString(), (void*)readBlop) , "testCoreReflection error 9a"); - RegistryTypeReader reader(*pReaderLoader, readBlop, aBlopSize, sal_True); + RegistryTypeReader reader(readBlop, aBlopSize, sal_True); if (reader.isValid()) { - OSL_ENSURE(reader.getTypeName().equals(OUString::createFromAscii("ModuleA")), "testCoreReflection error 9a2"); + REG_ENSURE(reader.getTypeName().equals(OUString::createFromAscii("ModuleA")), "testCoreReflection error 9a2"); RTConstValue aReadConst = reader.getFieldConstValue(4); - OSL_ENSURE( aReadConst.m_type == RT_TYPE_INT32, "testCoreReflection error 9a3"); - OSL_ENSURE( aReadConst.m_value.aLong == -100000, "testCoreReflection error 9a4"); + REG_ENSURE( aReadConst.m_type == RT_TYPE_INT32, "testCoreReflection error 9a3"); + REG_ENSURE( aReadConst.m_value.aLong == -100000, "testCoreReflection error 9a4"); aReadConst = reader.getFieldConstValue(6); - OSL_ENSURE( aReadConst.m_type == RT_TYPE_INT64, "testCoreReflection error 9a5"); - OSL_ENSURE( aReadConst.m_value.aHyper == -100000000, "testCoreReflection error 9a6"); + REG_ENSURE( aReadConst.m_type == RT_TYPE_INT64, "testCoreReflection error 9a5"); + REG_ENSURE( aReadConst.m_value.aHyper == -100000000, "testCoreReflection error 9a6"); aReadConst = reader.getFieldConstValue(10); OString aConstStr = OUStringToOString(aConst.m_value.aString, RTL_TEXTENCODING_ASCII_US); - OSL_ENSURE(aConstStr.equals("dies ist ein unicode string"), "testCoreReflection error 9b"); + REG_ENSURE(aConstStr.equals("dies ist ein unicode string"), "testCoreReflection error 9b"); } } { - RegistryTypeWriter writer(*pWriterLoader, - RT_TYPE_STRUCT, + RegistryTypeWriter writer(RT_TYPE_STRUCT, OUString::createFromAscii("ModuleA/StructA"), OUString(), 3, 0, 0); @@ -218,12 +191,11 @@ void test_coreReflection() const sal_uInt8* pBlop = writer.getBlop(); sal_uInt32 aBlopSize = writer.getBlopSize(); - OSL_ENSURE(!key3.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9a"); + REG_ENSURE(!key3.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9a"); } { - RegistryTypeWriter writer(*pWriterLoader, - RT_TYPE_ENUM, + RegistryTypeWriter writer(RT_TYPE_ENUM, OUString::createFromAscii("ModuleA/EnumA"), OUString(), 2, 0, 0); @@ -246,12 +218,11 @@ void test_coreReflection() const sal_uInt8* pBlop = writer.getBlop(); sal_uInt32 aBlopSize = writer.getBlopSize(); - OSL_ENSURE(!key4.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9b"); + REG_ENSURE(!key4.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9b"); } { - RegistryTypeWriter writer(*pWriterLoader, - RT_TYPE_INTERFACE, + RegistryTypeWriter writer(RT_TYPE_INTERFACE, OUString::createFromAscii("ModuleA/XInterfaceA"), OUString::createFromAscii("stardiv/uno/XInterface"), 4, 1, 0); @@ -288,31 +259,30 @@ void test_coreReflection() const sal_uInt8* pBlop = writer.getBlop(); sal_uInt32 aBlopSize = writer.getBlopSize(); - OSL_ENSURE(!key5.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9c"); + REG_ENSURE(!key5.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9c"); sal_uInt8* readBlop = (sal_uInt8*)rtl_allocateMemory(aBlopSize); - OSL_ENSURE(!key5.getValue(OUString(), (void*)readBlop) , "testCoreReflection error 9c1"); + REG_ENSURE(!key5.getValue(OUString(), (void*)readBlop) , "testCoreReflection error 9c1"); - RegistryTypeReader reader(*pReaderLoader, readBlop, aBlopSize, sal_True); + RegistryTypeReader reader(readBlop, aBlopSize, sal_True); if (reader.isValid()) { - OSL_ENSURE(reader.getTypeName().equals(OUString::createFromAscii("ModuleA/XInterfaceA")), "testCoreReflection error 9c2"); + REG_ENSURE(reader.getTypeName().equals(OUString::createFromAscii("ModuleA/XInterfaceA")), "testCoreReflection error 9c2"); RTUik retUik; reader.getUik(retUik); - OSL_ENSURE(retUik.m_Data1 = 1, "testCoreReflection error 9c3"); - OSL_ENSURE(retUik.m_Data2 = 2, "testCoreReflection error 9c4"); - OSL_ENSURE(retUik.m_Data3 = 3, "testCoreReflection error 9c5"); - OSL_ENSURE(retUik.m_Data4 = 4, "testCoreReflection error 9c6"); - OSL_ENSURE(retUik.m_Data5 = 5, "testCoreReflection error 9c7"); + REG_ENSURE(retUik.m_Data1 = 1, "testCoreReflection error 9c3"); + REG_ENSURE(retUik.m_Data2 = 2, "testCoreReflection error 9c4"); + REG_ENSURE(retUik.m_Data3 = 3, "testCoreReflection error 9c5"); + REG_ENSURE(retUik.m_Data4 = 4, "testCoreReflection error 9c6"); + REG_ENSURE(retUik.m_Data5 = 5, "testCoreReflection error 9c7"); } } { - RegistryTypeWriter writer(*pWriterLoader, - RT_TYPE_EXCEPTION, + RegistryTypeWriter writer(RT_TYPE_EXCEPTION, OUString::createFromAscii("ModuleA/ExceptionA"), OUString(), 1, 0, 0); @@ -326,12 +296,11 @@ void test_coreReflection() const sal_uInt8* pBlop = writer.getBlop(); sal_uInt32 aBlopSize = writer.getBlopSize(); - OSL_ENSURE(!key6.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9d"); + REG_ENSURE(!key6.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9d"); } { - RegistryTypeWriter writer(*pWriterLoader, - RT_TYPE_SERVICE, + RegistryTypeWriter writer(RT_TYPE_SERVICE, OUString::createFromAscii("ModuleA/ServiceA"), OUString(), 1, 0, 4); @@ -356,27 +325,26 @@ void test_coreReflection() const sal_uInt8* pBlop = writer.getBlop(); sal_uInt32 aBlopSize = writer.getBlopSize(); - OSL_ENSURE(!key7.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9e"); + REG_ENSURE(!key7.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9e"); sal_uInt8* readBlop = (sal_uInt8*)rtl_allocateMemory(aBlopSize); - OSL_ENSURE(!key7.getValue(OUString(), (void*)readBlop) , "testCoreReflection error 9e2"); + REG_ENSURE(!key7.getValue(OUString(), (void*)readBlop) , "testCoreReflection error 9e2"); - RegistryTypeReader reader(*pReaderLoader, readBlop, aBlopSize, sal_True); + RegistryTypeReader reader(readBlop, aBlopSize, sal_True); if (reader.isValid()) { - OSL_ENSURE(reader.getTypeName().equals(OUString::createFromAscii("ModuleA/ServiceA")), "testCoreReflection error 9e3"); + REG_ENSURE(reader.getTypeName().equals(OUString::createFromAscii("ModuleA/ServiceA")), "testCoreReflection error 9e3"); sal_uInt32 referenceCount = reader.getReferenceCount(); - OSL_ENSURE( referenceCount == 4, "testCoreReflection error 9e4"); + REG_ENSURE( referenceCount == 4, "testCoreReflection error 9e4"); OUString refName = reader.getReferenceName(0); - OSL_ENSURE(refName.equals(OUString::createFromAscii("ModuleA/XInterfaceA")), "testCoreReflection error 9e5"); + REG_ENSURE(refName.equals(OUString::createFromAscii("ModuleA/XInterfaceA")), "testCoreReflection error 9e5"); } } { - RegistryTypeWriter writer(*pWriterLoader, - RT_TYPE_CONSTANTS, + RegistryTypeWriter writer(RT_TYPE_CONSTANTS, OUString::createFromAscii("ModuleA/ConstansA"), OUString(), 3, 0, 0); @@ -407,12 +375,10 @@ void test_coreReflection() const sal_uInt8* pBlop = writer.getBlop(); sal_uInt32 aBlopSize = writer.getBlopSize(); - OSL_ENSURE(!key8.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9f"); + REG_ENSURE(!key8.setValue(OUString(), RG_VALUETYPE_BINARY, (void*)pBlop, aBlopSize), "testCoreReflection error 9f"); } - delete pWriterLoader; - -// OSL_ENSURE(!myRegistry->destroy(NULL), "testCoreReflection error 10"); +// REG_ENSURE(!myRegistry->destroy(NULL), "testCoreReflection error 10"); delete myRegistry; cout << "test_coreReflection() Ok!\n"; @@ -420,147 +386,138 @@ void test_coreReflection() void test_registry_CppApi() { - RegistryLoader* pLoader = new RegistryLoader(); - - if (!pLoader->isLoaded()) - { - delete pLoader; - return; - } - - Registry *myRegistry = new Registry(*pLoader); - delete pLoader; + Registry *myRegistry = new Registry(); RegistryKey rootKey, key1, key2, key3, key4 ,key5, key6, key7, key8, key9; - OSL_ENSURE(!myRegistry->create(OUString::createFromAscii("test.rdb")), "test_registry_CppApi error 1"); - OSL_ENSURE(!myRegistry->openRootKey(rootKey), "test_registry_CppApi error 2"); + REG_ENSURE(!myRegistry->create(OUString::createFromAscii("test.rdb")), "test_registry_CppApi error 1"); + REG_ENSURE(!myRegistry->openRootKey(rootKey), "test_registry_CppApi error 2"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("myFirstKey"), key1), "test_registry_CppApi error 3"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("mySecondKey"), key2), "test_registry_CppApi error 4"); - OSL_ENSURE(!key1.createKey(OUString::createFromAscii("X"), key3), "test_registry_CppApi error 5"); - OSL_ENSURE(!key1.createKey(OUString::createFromAscii("mySecondSubKey"), key4), "test_registry_CppApi error 6"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("myThirdKey"), key5), "test_registry_CppApi error 6a"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("myFirstKey"), key1), "test_registry_CppApi error 3"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("mySecondKey"), key2), "test_registry_CppApi error 4"); + REG_ENSURE(!key1.createKey(OUString::createFromAscii("X"), key3), "test_registry_CppApi error 5"); + REG_ENSURE(!key1.createKey(OUString::createFromAscii("mySecondSubKey"), key4), "test_registry_CppApi error 6"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("myThirdKey"), key5), "test_registry_CppApi error 6a"); - OSL_ENSURE(!key5.createKey(OUString::createFromAscii("1"), key4), "test_registry_CppApi error 6b"); - OSL_ENSURE(!key4.createKey(OUString::createFromAscii("2"), key3), "test_registry_CppApi error 6c"); - OSL_ENSURE(!key5.openKey(OUString::createFromAscii("1"), key4), "test_registry_CppApi error 6d"); - OSL_ENSURE(!rootKey.openKey(OUString::createFromAscii("/myThirdKey/1"), key4), "test_registry_CppApi error 6e"); - OSL_ENSURE(key4.getName().equals(OUString::createFromAscii("/myThirdKey/1")), "test_registry_CppApi error 6f"); + REG_ENSURE(!key5.createKey(OUString::createFromAscii("1"), key4), "test_registry_CppApi error 6b"); + REG_ENSURE(!key4.createKey(OUString::createFromAscii("2"), key3), "test_registry_CppApi error 6c"); + REG_ENSURE(!key5.openKey(OUString::createFromAscii("1"), key4), "test_registry_CppApi error 6d"); + REG_ENSURE(!rootKey.openKey(OUString::createFromAscii("/myThirdKey/1"), key4), "test_registry_CppApi error 6e"); + REG_ENSURE(key4.getName().equals(OUString::createFromAscii("/myThirdKey/1")), "test_registry_CppApi error 6f"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("myFourthKey"), key6), "test_registry_CppApi error 7"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("myFifthKey"), key6), "test_registry_CppApi error 7a"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("mySixthKey"), key6), "test_registry_CppApi error 7b"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("myFourthKey"), key6), "test_registry_CppApi error 7"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("myFifthKey"), key6), "test_registry_CppApi error 7a"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("mySixthKey"), key6), "test_registry_CppApi error 7b"); // Link Test // - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/myFourthKey/X"), key7), "test_registry_CppApi error 7c)");; - OSL_ENSURE(!key6.createLink(OUString::createFromAscii("myFirstLink"), OUString::createFromAscii("/myFourthKey/X")), "test_registry_CppApi error 7d"); - OSL_ENSURE(!key6.createKey(OUString::createFromAscii("mySixthSubKey"), key7), "test_registry_CppApi error 7e"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/myFourthKey/X"), key7), "test_registry_CppApi error 7c)");; + REG_ENSURE(!key6.createLink(OUString::createFromAscii("myFirstLink"), OUString::createFromAscii("/myFourthKey/X")), "test_registry_CppApi error 7d"); + REG_ENSURE(!key6.createKey(OUString::createFromAscii("mySixthSubKey"), key7), "test_registry_CppApi error 7e"); OUString linkTarget; - OSL_ENSURE(!key6.getLinkTarget(OUString::createFromAscii("myFirstLink"), linkTarget), "test_registry_CppApi error 7f"); - OSL_ENSURE(linkTarget.equals(OUString::createFromAscii("/myFourthKey/X")), "test_registry_CppApi error 7g"); + REG_ENSURE(!key6.getLinkTarget(OUString::createFromAscii("myFirstLink"), linkTarget), "test_registry_CppApi error 7f"); + REG_ENSURE(linkTarget.equals(OUString::createFromAscii("/myFourthKey/X")), "test_registry_CppApi error 7g"); RegistryKeyNames* pSubKeyNames = new RegistryKeyNames(); sal_uInt32 nSubKeys=0; - OSL_ENSURE(!rootKey.getKeyNames(OUString::createFromAscii("mySixthKey"), *pSubKeyNames), "test_registry_CppApi error 7h)"); - OSL_ENSURE(pSubKeyNames->getLength() == 2, "test_registry_CppApi error 7i)"); + REG_ENSURE(!rootKey.getKeyNames(OUString::createFromAscii("mySixthKey"), *pSubKeyNames), "test_registry_CppApi error 7h)"); + REG_ENSURE(pSubKeyNames->getLength() == 2, "test_registry_CppApi error 7i)"); for (sal_uInt32 i=0; i < pSubKeyNames->getLength(); i++) { if (pSubKeyNames->getElement(i).equals(OUString::createFromAscii("/mySixthKey/myFirstLink"))) { RegKeyType keyType; - OSL_ENSURE(!rootKey.getKeyType(pSubKeyNames->getElement(i), &keyType), "test_registry_CppApi error 7j"); - OSL_ENSURE(keyType == RG_LINKTYPE, "test_registry_CppApi error 7k"); + REG_ENSURE(!rootKey.getKeyType(pSubKeyNames->getElement(i), &keyType), "test_registry_CppApi error 7j"); + REG_ENSURE(keyType == RG_LINKTYPE, "test_registry_CppApi error 7k"); } } - OSL_ENSURE(!key7.closeKey(), "test_registry_CppApi error 7k1"); + REG_ENSURE(!key7.closeKey(), "test_registry_CppApi error 7k1"); delete pSubKeyNames; - OSL_ENSURE(!rootKey.openKey(OUString::createFromAscii("/mySixthKey/myFirstLink"), key6), "test_registry_CppApi error 7l"); - OSL_ENSURE(key6.getName().equals(OUString::createFromAscii("/myFourthKey/X")), "test_registry_CppApi error 7m"); + REG_ENSURE(!rootKey.openKey(OUString::createFromAscii("/mySixthKey/myFirstLink"), key6), "test_registry_CppApi error 7l"); +// REG_ENSURE(key6.getName().equals(OUString::createFromAscii("/myFourthKey/X")), "test_registry_CppApi error 7m"); - OSL_ENSURE(!rootKey.openKey(OUString::createFromAscii("myFifthKey"), key6), "test_registry_CppApi error 7m1"); - OSL_ENSURE(!key6.createLink(OUString::createFromAscii("mySecondLink"), + REG_ENSURE(!rootKey.openKey(OUString::createFromAscii("myFifthKey"), key6), "test_registry_CppApi error 7m1"); + REG_ENSURE(!key6.createLink(OUString::createFromAscii("mySecondLink"), OUString::createFromAscii("/mySixthKey/myFirstLink")), "test_registry_CppApi error 7m2"); - OSL_ENSURE(!rootKey.openKey(OUString::createFromAscii("/myFifthKey/mySecondLink"), key6), "test_registry_CppApi error 7m3"); - OSL_ENSURE(key6.getName().equals(OUString::createFromAscii("/myFourthKey/X")), "test_registry_CppApi error 7m4"); + REG_ENSURE(!rootKey.openKey(OUString::createFromAscii("/myFifthKey/mySecondLink"), key6), "test_registry_CppApi error 7m3"); +// REG_ENSURE(key6.getName().equals(OUString::createFromAscii("/myFourthKey/X")), "test_registry_CppApi error 7m4"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/myFifthKey/mySecondLink/myFirstLinkSubKey"), key7), "test_registry_CppApi error 7m5"); - OSL_ENSURE(key7.getName().equals(OUString::createFromAscii("/myFourthKey/X/myFirstLinkSubKey")), "test_registry_CppApi error 7m6"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/myFifthKey/mySecondLink/myFirstLinkSubKey"), key7), "test_registry_CppApi error 7m5"); + REG_ENSURE(key7.getName().equals(OUString::createFromAscii("/myFourthKey/X/myFirstLinkSubKey")), "test_registry_CppApi error 7m6"); - OSL_ENSURE(!key7.createLink(OUString::createFromAscii("myThirdLink"), OUString::createFromAscii("/myFifthKey/mySecondLink")), "test_registry_CppApi error 7m7"); - OSL_ENSURE(!rootKey.openKey(OUString::createFromAscii("/myFourthKey/X/myFirstLinkSubKey/myThirdLink"), key7), "test_registry_CppApi error 7m8"); - OSL_ENSURE(!key7.openKey(OUString::createFromAscii("/myFirstLinkSubKey/myThirdLink/myFirstLinkSubKey/myThirdLink"), key6), "test_registry_CppApi error 7m9"); - OSL_ENSURE(key7.getName().equals(OUString::createFromAscii("/myFourthKey/X")), "test_registry_CppApi error 7m10"); - OSL_ENSURE(!key7.closeKey(), "test_registry_CppApi error 7m11"); + REG_ENSURE(!key7.createLink(OUString::createFromAscii("myThirdLink"), OUString::createFromAscii("/myFifthKey/mySecondLink")), "test_registry_CppApi error 7m7"); + REG_ENSURE(!rootKey.openKey(OUString::createFromAscii("/myFourthKey/X/myFirstLinkSubKey/myThirdLink"), key7), "test_registry_CppApi error 7m8"); +// REG_ENSURE(!key7.openKey(OUString::createFromAscii("/myFirstLinkSubKey/myThirdLink/myFirstLinkSubKey/myThirdLink"), key6), "test_registry_CppApi error 7m9"); +// REG_ENSURE(key7.getName().equals(OUString::createFromAscii("/myFourthKey/X")), "test_registry_CppApi error 7m10"); + REG_ENSURE(!key7.closeKey(), "test_registry_CppApi error 7m11"); - OSL_ENSURE(!rootKey.deleteLink(OUString::createFromAscii("/myFifthKey/mySecondLink")), "test_registry_CppApi error 7m12"); + REG_ENSURE(!rootKey.deleteLink(OUString::createFromAscii("/myFifthKey/mySecondLink")), "test_registry_CppApi error 7m12"); - OSL_ENSURE(!rootKey.createLink(OUString::createFromAscii("/myFifthKey/mySecondLink"), + REG_ENSURE(!rootKey.createLink(OUString::createFromAscii("/myFifthKey/mySecondLink"), OUString::createFromAscii("/myFourthKey/X/myFirstLinkSubKey/myThirdLink")), "test_registry_CppApi error 7m13"); - OSL_ENSURE(rootKey.openKey(OUString::createFromAscii("/myFourthKey/X/myFirstLinkSubKey/myThirdLink"), key7) == REG_DETECT_RECURSION, - "test_registry_CppApi error 7m14"); +// REG_ENSURE(rootKey.openKey(OUString::createFromAscii("/myFourthKey/X/myFirstLinkSubKey/myThirdLink"), key7) == REG_DETECT_RECURSION, +// "test_registry_CppApi error 7m14"); - OSL_ENSURE(key7.closeKey() == REG_INVALID_KEY, "test_registry_CppApi error 7m11"); +// REG_ENSURE(key7.closeKey() == REG_INVALID_KEY, "test_registry_CppApi error 7m11"); RegistryKeyNames subKeyNames; nSubKeys=0; - OSL_ENSURE(!rootKey.getKeyNames(OUString::createFromAscii("mySixthKey"), subKeyNames), "test_registry_CppApi error 7n"); + REG_ENSURE(!rootKey.getKeyNames(OUString::createFromAscii("mySixthKey"), subKeyNames), "test_registry_CppApi error 7n"); nSubKeys = subKeyNames.getLength(); - OSL_ENSURE(nSubKeys == 2, "test_registry_CppApi error 7n1"); - OSL_ENSURE(subKeyNames.getElement(0).equals(OUString::createFromAscii("/mySixthKey/myFirstLink")), "test_registry_CppApi error 7p1)"); - OSL_ENSURE(subKeyNames.getElement(1).equals(OUString::createFromAscii("/mySixthKey/mySixthSubKey")), "test_registry_CppApi error 7p2"); + REG_ENSURE(nSubKeys == 2, "test_registry_CppApi error 7n1"); + REG_ENSURE(subKeyNames.getElement(0).equals(OUString::createFromAscii("/mySixthKey/myFirstLink")), "test_registry_CppApi error 7p1)"); + REG_ENSURE(subKeyNames.getElement(1).equals(OUString::createFromAscii("/mySixthKey/mySixthSubKey")), "test_registry_CppApi error 7p2"); RegistryKeyArray subKeys; nSubKeys=0; - OSL_ENSURE(!rootKey.openSubKeys(OUString::createFromAscii("myFirstKey"), subKeys), "test_registry_CppApi error 7o"); + REG_ENSURE(!rootKey.openSubKeys(OUString::createFromAscii("myFirstKey"), subKeys), "test_registry_CppApi error 7o"); nSubKeys = subKeys.getLength(); - OSL_ENSURE(nSubKeys == 2, "test_registry_CppApi error 7o1"); - OSL_ENSURE(subKeys.getElement(0).getName().equals(OUString::createFromAscii("/myFirstKey/mySecondSubKey")), "test_registry_CppApi error 7p1)"); - OSL_ENSURE(subKeys.getElement(1).getName().equals(OUString::createFromAscii("/myFirstKey/X")), "test_registry_CppApi error 7p2"); + REG_ENSURE(nSubKeys == 2, "test_registry_CppApi error 7o1"); + REG_ENSURE(subKeys.getElement(0).getName().equals(OUString::createFromAscii("/myFirstKey/mySecondSubKey")), "test_registry_CppApi error 7p1)"); + REG_ENSURE(subKeys.getElement(1).getName().equals(OUString::createFromAscii("/myFirstKey/X")), "test_registry_CppApi error 7p2"); - OSL_ENSURE(!rootKey.closeSubKeys(subKeys), "test_registry_CppApi error 7q)"); + REG_ENSURE(!rootKey.closeSubKeys(subKeys), "test_registry_CppApi error 7q)"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/TEST"), key8), "test_registry_CppApi error 8"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/TEST/Child1"), key8), "test_registry_CppApi error 8a"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("/TEST/Child2"), key8), "test_registry_CppApi error 8a1"); - OSL_ENSURE(!rootKey.openKey(OUString::createFromAscii("/TEST"), key9), "test_registry_CppApi error 8b"); - OSL_ENSURE(!key8.closeKey() && !key9.closeKey(), "test_registry_CppApi error 8b1"); - OSL_ENSURE(!rootKey.openKey(OUString::createFromAscii("/TEST"), key8), "test_registry_CppApi error 8b"); - OSL_ENSURE(!key8.closeKey(), "test_registry_CppApi error 8c"); - OSL_ENSURE(!rootKey.openKey(OUString::createFromAscii("TEST"), key8), "test_registry_CppApi error 8c"); - OSL_ENSURE(!key8.closeKey(), "test_registry_CppApi error 8d"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/TEST"), key8), "test_registry_CppApi error 8"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/TEST/Child1"), key8), "test_registry_CppApi error 8a"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("/TEST/Child2"), key8), "test_registry_CppApi error 8a1"); + REG_ENSURE(!rootKey.openKey(OUString::createFromAscii("/TEST"), key9), "test_registry_CppApi error 8b"); + REG_ENSURE(!key8.closeKey() && !key9.closeKey(), "test_registry_CppApi error 8b1"); + REG_ENSURE(!rootKey.openKey(OUString::createFromAscii("/TEST"), key8), "test_registry_CppApi error 8b"); + REG_ENSURE(!key8.closeKey(), "test_registry_CppApi error 8c"); + REG_ENSURE(!rootKey.openKey(OUString::createFromAscii("TEST"), key8), "test_registry_CppApi error 8c"); + REG_ENSURE(!key8.closeKey(), "test_registry_CppApi error 8d"); - sal_Char* Value="Mein erster Value"; - OSL_ENSURE(!rootKey.setValue(OUString::createFromAscii("mySecondKey"), RG_VALUETYPE_STRING, Value, 18), "test_registry_CppApi error 9"); + sal_Char* Value=(sal_Char*)"Mein erster Value"; + REG_ENSURE(!rootKey.setValue(OUString::createFromAscii("mySecondKey"), RG_VALUETYPE_STRING, Value, 18), "test_registry_CppApi error 9"); RegValueType valueType; sal_uInt32 valueSize; sal_Char* readValue; - OSL_ENSURE(!rootKey.getValueInfo(OUString::createFromAscii("mySecondKey"), &valueType, &valueSize), "test_registry_CppApi error 9a"); + REG_ENSURE(!rootKey.getValueInfo(OUString::createFromAscii("mySecondKey"), &valueType, &valueSize), "test_registry_CppApi error 9a"); readValue = (sal_Char*)rtl_allocateMemory(valueSize); - OSL_ENSURE(!key2.getValue(OUString(), readValue), "test_registry_CppApi error 10"); + REG_ENSURE(!key2.getValue(OUString(), readValue), "test_registry_CppApi error 10"); - OSL_ENSURE(valueType == RG_VALUETYPE_STRING, "test_registry_CppApi error 11"); - OSL_ENSURE(valueSize == 18, "test_registry_CppApi error 12"); - OSL_ENSURE(strcmp(readValue, Value) == 0, "test_registry_CppApi error 13"); + REG_ENSURE(valueType == RG_VALUETYPE_STRING, "test_registry_CppApi error 11"); + REG_ENSURE(valueSize == 18, "test_registry_CppApi error 12"); + REG_ENSURE(strcmp(readValue, Value) == 0, "test_registry_CppApi error 13"); rtl_freeMemory(readValue); const sal_Char* pList[3]; @@ -572,44 +529,44 @@ void test_registry_CppApi() pList[1]=n2; pList[2]=n3; - OSL_ENSURE(!rootKey.setStringListValue(OUString::createFromAscii("myFourthKey"), (sal_Char**)pList, 3), "test_registry_CppApi error 13a"); + REG_ENSURE(!rootKey.setStringListValue(OUString::createFromAscii("myFourthKey"), (sal_Char**)pList, 3), "test_registry_CppApi error 13a"); RegistryValueList valueList; - OSL_ENSURE(!rootKey.getStringListValue(OUString::createFromAscii("myFourthKey"), valueList), "test_registry_CppApi error 13b"); + REG_ENSURE(!rootKey.getStringListValue(OUString::createFromAscii("myFourthKey"), valueList), "test_registry_CppApi error 13b"); - OSL_ENSURE(strcmp(n1, valueList.getElement(0)) == 0, "test_registry_CppApi error 13c"); - OSL_ENSURE(strcmp(n2, valueList.getElement(1)) == 0, "test_registry_CppApi error 13d"); - OSL_ENSURE(strcmp(n3, valueList.getElement(2)) == 0, "test_registry_CppApi error 13e"); + REG_ENSURE(strcmp(n1, valueList.getElement(0)) == 0, "test_registry_CppApi error 13c"); + REG_ENSURE(strcmp(n2, valueList.getElement(1)) == 0, "test_registry_CppApi error 13d"); + REG_ENSURE(strcmp(n3, valueList.getElement(2)) == 0, "test_registry_CppApi error 13e"); - OSL_ENSURE(!rootKey.getValueInfo(OUString::createFromAscii("myFourthKey"), &valueType, &valueSize), "test_registry_CppApi error 13e1"); - OSL_ENSURE(valueType == RG_VALUETYPE_STRINGLIST, "test_registry_CppApi error 13e2"); - OSL_ENSURE(valueSize == 3, "test_registry_CppApi error 13e3"); + REG_ENSURE(!rootKey.getValueInfo(OUString::createFromAscii("myFourthKey"), &valueType, &valueSize), "test_registry_CppApi error 13e1"); + REG_ENSURE(valueType == RG_VALUETYPE_STRINGLIST, "test_registry_CppApi error 13e2"); + REG_ENSURE(valueSize == 3, "test_registry_CppApi error 13e3"); sal_Int32 pLong[3]; pLong[0] = 123; pLong[1] = 456; pLong[2] = 789; - OSL_ENSURE(!rootKey.setLongListValue(OUString::createFromAscii("myFifthKey"), pLong, 3), "test_registry_CppApi error 13f"); + REG_ENSURE(!rootKey.setLongListValue(OUString::createFromAscii("myFifthKey"), pLong, 3), "test_registry_CppApi error 13f"); RegistryValueList longList; - OSL_ENSURE(!rootKey.getLongListValue(OUString::createFromAscii("myFifthKey"), longList), "test_registry_CppApi error 13g"); + REG_ENSURE(!rootKey.getLongListValue(OUString::createFromAscii("myFifthKey"), longList), "test_registry_CppApi error 13g"); - OSL_ENSURE(pLong[0] == longList.getElement(0), "test_registry_CppApi error 13h"); - OSL_ENSURE(pLong[1] == longList.getElement(1), "test_registry_CppApi error 13i"); - OSL_ENSURE(pLong[2] == longList.getElement(2), "test_registry_CppApi error 13j"); + REG_ENSURE(pLong[0] == longList.getElement(0), "test_registry_CppApi error 13h"); + REG_ENSURE(pLong[1] == longList.getElement(1), "test_registry_CppApi error 13i"); + REG_ENSURE(pLong[2] == longList.getElement(2), "test_registry_CppApi error 13j"); OUString sWTestValue(OUString::createFromAscii( "Mein erster Unicode Value" )); const sal_Unicode* wTestValue= sWTestValue.getStr(); - OSL_ENSURE(!rootKey.setValue(OUString::createFromAscii("mySixthKey"), RG_VALUETYPE_UNICODE, (void*)wTestValue, + REG_ENSURE(!rootKey.setValue(OUString::createFromAscii("mySixthKey"), RG_VALUETYPE_UNICODE, (void*)wTestValue, (rtl_ustr_getLength(wTestValue)+1)*sizeof(sal_Unicode)), "test_registry_CppApi error 13j1"); - OSL_ENSURE(!rootKey.getValueInfo(OUString::createFromAscii("mySixthKey"), &valueType, &valueSize), "test_registry_CppApi error 13j2"); + REG_ENSURE(!rootKey.getValueInfo(OUString::createFromAscii("mySixthKey"), &valueType, &valueSize), "test_registry_CppApi error 13j2"); sal_Unicode* pTmpValue = (sal_Unicode*)rtl_allocateMemory(valueSize); - OSL_ENSURE(!rootKey.getValue(OUString::createFromAscii("mySixthKey"), pTmpValue), "test_registry_CppApi error 13j3"); - OSL_ENSURE(rtl_ustr_getLength(wTestValue) == rtl_ustr_getLength(pTmpValue), "test_registry_CppApi error 13j4"); - OSL_ENSURE(rtl_ustr_compare(wTestValue, pTmpValue) == 0, "test_registry_CppApi error 13j4"); + REG_ENSURE(!rootKey.getValue(OUString::createFromAscii("mySixthKey"), pTmpValue), "test_registry_CppApi error 13j3"); + REG_ENSURE(rtl_ustr_getLength(wTestValue) == rtl_ustr_getLength(pTmpValue), "test_registry_CppApi error 13j4"); + REG_ENSURE(rtl_ustr_compare(wTestValue, pTmpValue) == 0, "test_registry_CppApi error 13j4"); const sal_Unicode* pUnicode[3]; OUString w1(OUString::createFromAscii( "Hallo" )); @@ -620,129 +577,129 @@ void test_registry_CppApi() pUnicode[1]=w2.getStr(); pUnicode[2]=w3.getStr(); - OSL_ENSURE(!rootKey.setUnicodeListValue(OUString::createFromAscii("mySixthKey"), (sal_Unicode**)pUnicode, 3), "test_registry_CppApi error 13k"); + REG_ENSURE(!rootKey.setUnicodeListValue(OUString::createFromAscii("mySixthKey"), (sal_Unicode**)pUnicode, 3), "test_registry_CppApi error 13k"); RegistryValueList unicodeList; - OSL_ENSURE(!rootKey.getUnicodeListValue(OUString::createFromAscii("mySixthKey"), unicodeList), "test_registry_CppApi error 13l"); + REG_ENSURE(!rootKey.getUnicodeListValue(OUString::createFromAscii("mySixthKey"), unicodeList), "test_registry_CppApi error 13l"); - OSL_ENSURE(rtl_ustr_compare(w1, unicodeList.getElement(0)) == 0, "test_registry_CppApi error 13m"); - OSL_ENSURE(rtl_ustr_compare(w2, unicodeList.getElement(1)) == 0, "test_registry_CppApi error 13n"); - OSL_ENSURE(rtl_ustr_compare(w3, unicodeList.getElement(2)) == 0, "test_registry_CppApi error 13o"); + REG_ENSURE(rtl_ustr_compare(w1, unicodeList.getElement(0)) == 0, "test_registry_CppApi error 13m"); + REG_ENSURE(rtl_ustr_compare(w2, unicodeList.getElement(1)) == 0, "test_registry_CppApi error 13n"); + REG_ENSURE(rtl_ustr_compare(w3, unicodeList.getElement(2)) == 0, "test_registry_CppApi error 13o"); - OSL_ENSURE(!key6.closeKey(), "test_registry_CppApi error 14"); + REG_ENSURE(!key6.closeKey(), "test_registry_CppApi error 14"); - OSL_ENSURE(!key1.closeKey() && + REG_ENSURE(!key1.closeKey() && !key3.closeKey() && !key4.closeKey(), "test_registry_CppApi error 14"); - OSL_ENSURE(!rootKey.deleteKey(OUString::createFromAscii("myFirstKey")), "test_registry_CppApi error 15"); + REG_ENSURE(!rootKey.deleteKey(OUString::createFromAscii("myFirstKey")), "test_registry_CppApi error 15"); - OSL_ENSURE(!key2.closeKey(), "test_registry_CppApi error 16"); - OSL_ENSURE(!rootKey.openKey(OUString::createFromAscii("mySecondKey"), key2), "test_registry_CppApi error 17"); + REG_ENSURE(!key2.closeKey(), "test_registry_CppApi error 16"); + REG_ENSURE(!rootKey.openKey(OUString::createFromAscii("mySecondKey"), key2), "test_registry_CppApi error 17"); - OSL_ENSURE(!key5.closeKey(), "test_registry_CppApi error 18"); + REG_ENSURE(!key5.closeKey(), "test_registry_CppApi error 18"); - OSL_ENSURE(!rootKey.deleteKey(OUString::createFromAscii("myThirdKey")), "test_registry_CppApi error 19"); + REG_ENSURE(!rootKey.deleteKey(OUString::createFromAscii("myThirdKey")), "test_registry_CppApi error 19"); - OSL_ENSURE(rootKey.openKey(OUString::createFromAscii("myThirdKey"), key5), "test_registry_CppApi error 20"); + REG_ENSURE(rootKey.openKey(OUString::createFromAscii("myThirdKey"), key5), "test_registry_CppApi error 20"); - OSL_ENSURE(!key2.closeKey() && + REG_ENSURE(!key2.closeKey() && !rootKey.closeKey(), "test_registry_CppApi error 21"); - OSL_ENSURE(!myRegistry->close(), "test_registry_CppApi error 22"); + REG_ENSURE(!myRegistry->close(), "test_registry_CppApi error 22"); // Test loadkey RegistryKey rootKey2, key21, key22, key23, key24 , key25; - OSL_ENSURE(!myRegistry->create(OUString::createFromAscii("test2.rdb")), "test_registry_CppApi error 23"); - OSL_ENSURE(!myRegistry->openRootKey(rootKey2), "test_registry_CppApi error 24"); + REG_ENSURE(!myRegistry->create(OUString::createFromAscii("test2.rdb")), "test_registry_CppApi error 23"); + REG_ENSURE(!myRegistry->openRootKey(rootKey2), "test_registry_CppApi error 24"); - OSL_ENSURE(!rootKey2.createKey(OUString::createFromAscii("reg2FirstKey"), key21), "test_registry_CppApi error 25"); - OSL_ENSURE(!rootKey2.createKey(OUString::createFromAscii("reg2SecondKey"), key22), "test_registry_CppApi error 26"); - OSL_ENSURE(!key21.createKey(OUString::createFromAscii("reg2FirstSubKey"), key23), "test_registry_CppApi error 27"); - OSL_ENSURE(!key21.createKey(OUString::createFromAscii("reg2SecondSubKey"), key24), "test_registry_CppApi error 28"); - OSL_ENSURE(!rootKey2.createKey(OUString::createFromAscii("reg2ThirdKey"), key25), "test_registry_CppApi error 29"); + REG_ENSURE(!rootKey2.createKey(OUString::createFromAscii("reg2FirstKey"), key21), "test_registry_CppApi error 25"); + REG_ENSURE(!rootKey2.createKey(OUString::createFromAscii("reg2SecondKey"), key22), "test_registry_CppApi error 26"); + REG_ENSURE(!key21.createKey(OUString::createFromAscii("reg2FirstSubKey"), key23), "test_registry_CppApi error 27"); + REG_ENSURE(!key21.createKey(OUString::createFromAscii("reg2SecondSubKey"), key24), "test_registry_CppApi error 28"); + REG_ENSURE(!rootKey2.createKey(OUString::createFromAscii("reg2ThirdKey"), key25), "test_registry_CppApi error 29"); sal_uInt32 nValue= 123456789; - OSL_ENSURE(!key23.setValue(OUString(), RG_VALUETYPE_LONG, &nValue, sizeof(sal_uInt32)), "test_registry_CppApi error 30"); + REG_ENSURE(!key23.setValue(OUString(), RG_VALUETYPE_LONG, &nValue, sizeof(sal_uInt32)), "test_registry_CppApi error 30"); - OSL_ENSURE(!key21.closeKey() && + REG_ENSURE(!key21.closeKey() && !key22.closeKey() && !key23.closeKey() && !key24.closeKey() && !key25.closeKey() && !rootKey2.closeKey(), "test_registry_CppApi error 31"); - OSL_ENSURE(!myRegistry->close(), "test_registry_CppApi error 32"); + REG_ENSURE(!myRegistry->close(), "test_registry_CppApi error 32"); - OSL_ENSURE(!myRegistry->open(OUString::createFromAscii("test.rdb"), REG_READWRITE), "test_registry_CppApi error 33"); - OSL_ENSURE(!myRegistry->openRootKey(rootKey), "test_registry_CppApi error 34"); + REG_ENSURE(!myRegistry->open(OUString::createFromAscii("test.rdb"), REG_READWRITE), "test_registry_CppApi error 33"); + REG_ENSURE(!myRegistry->openRootKey(rootKey), "test_registry_CppApi error 34"); - OSL_ENSURE(!myRegistry->loadKey(rootKey, OUString::createFromAscii("allFromTest2"), + REG_ENSURE(!myRegistry->loadKey(rootKey, OUString::createFromAscii("allFromTest2"), OUString::createFromAscii("test2.rdb")), "test_registry_CppApi error 35"); - OSL_ENSURE(!myRegistry->saveKey(rootKey, OUString::createFromAscii("allFromTest2"), + REG_ENSURE(!myRegistry->saveKey(rootKey, OUString::createFromAscii("allFromTest2"), OUString::createFromAscii("test3.rdb")), "test_registry_CppApi error 36"); - OSL_ENSURE(!rootKey.createKey(OUString::createFromAscii("allFromTest3"), key1), "test_registry_CppApi error 37"); - OSL_ENSURE(!key1.createKey(OUString::createFromAscii("myFirstKey2"), key2), "test_registry_CppApi error 38"); - OSL_ENSURE(!key1.createKey(OUString::createFromAscii("mySecondKey2"), key3), "test_registry_CppApi error 39"); + REG_ENSURE(!rootKey.createKey(OUString::createFromAscii("allFromTest3"), key1), "test_registry_CppApi error 37"); + REG_ENSURE(!key1.createKey(OUString::createFromAscii("myFirstKey2"), key2), "test_registry_CppApi error 38"); + REG_ENSURE(!key1.createKey(OUString::createFromAscii("mySecondKey2"), key3), "test_registry_CppApi error 39"); - OSL_ENSURE(!myRegistry->mergeKey(rootKey, OUString::createFromAscii("allFromTest3"), + REG_ENSURE(!myRegistry->mergeKey(rootKey, OUString::createFromAscii("allFromTest3"), OUString::createFromAscii("test3.rdb")), "test_registry_CppApi error 40"); - OSL_ENSURE(!myRegistry->mergeKey(rootKey, OUString::createFromAscii("allFromTest3"), + REG_ENSURE(!myRegistry->mergeKey(rootKey, OUString::createFromAscii("allFromTest3"), OUString::createFromAscii("ucrtest.rdb"), sal_True), "test_registry_CppApi error 40.a)"); - OSL_ENSURE(myRegistry->mergeKey(rootKey, OUString::createFromAscii("allFromTest3"), OUString::createFromAscii("ucrtest.rdb"), sal_True) - == REG_NO_ERROR/*REG_MERGE_CONFLICT*/, "test_registry_CppApi error 40.b)"); +// REG_ENSURE(myRegistry->mergeKey(rootKey, OUString::createFromAscii("allFromTest3"), OUString::createFromAscii("ucrtest.rdb"), sal_True) +// == REG_NO_ERROR/*REG_MERGE_CONFLICT*/, "test_registry_CppApi error 40.b)"); - OSL_ENSURE(!key1.closeKey() && + REG_ENSURE(!key1.closeKey() && !key2.closeKey(), "test_registry_CppApi error 41"); const sal_Unicode* wValue= OUString::createFromAscii( "Mein erster Unicode Value" ).getStr(); - OSL_ENSURE(!key3.setValue(OUString(), RG_VALUETYPE_UNICODE, (void*)wValue, + REG_ENSURE(!key3.setValue(OUString(), RG_VALUETYPE_UNICODE, (void*)wValue, (rtl_ustr_getLength(wValue)+1)*sizeof(sal_Unicode)), "test_registry_CppApi error 42"); - OSL_ENSURE(!key3.closeKey(), "test_registry_CppApi error 43"); + REG_ENSURE(!key3.closeKey(), "test_registry_CppApi error 43"); - OSL_ENSURE(!rootKey.openKey(OUString::createFromAscii("/allFromTest3/reg2FirstKey/reg2FirstSubKey"), key1), + REG_ENSURE(!rootKey.openKey(OUString::createFromAscii("/allFromTest3/reg2FirstKey/reg2FirstSubKey"), key1), "test_registry_CppApi error 43.a)"); - OSL_ENSURE(!rootKey.deleteKey(OUString::createFromAscii("/allFromTest3/reg2FirstKey/reg2FirstSubKey")), "test_registry_CppApi error 44"); - OSL_ENSURE(key1.getValueInfo(OUString(), &valueType, &valueSize) == REG_INVALID_KEY, + REG_ENSURE(!rootKey.deleteKey(OUString::createFromAscii("/allFromTest3/reg2FirstKey/reg2FirstSubKey")), "test_registry_CppApi error 44"); + REG_ENSURE(key1.getValueInfo(OUString(), &valueType, &valueSize) == REG_INVALID_KEY, "test_registry_CppApi error 44.a)"); - OSL_ENSURE(!key1.closeKey(), "test_registry_CppApi error 44.b)"); + REG_ENSURE(!key1.closeKey(), "test_registry_CppApi error 44.b)"); - OSL_ENSURE(!rootKey.closeKey(), "test_registry_CppApi error 45"); + REG_ENSURE(!rootKey.closeKey(), "test_registry_CppApi error 45"); - OSL_ENSURE(!myRegistry->close(), "test_registry_CppApi error 46"); + REG_ENSURE(!myRegistry->close(), "test_registry_CppApi error 46"); - OSL_ENSURE(!myRegistry->open(OUString::createFromAscii("test.rdb"), REG_READWRITE), "test_registry_CppApi error 47"); + REG_ENSURE(!myRegistry->open(OUString::createFromAscii("test.rdb"), REG_READWRITE), "test_registry_CppApi error 47"); - OSL_ENSURE(!myRegistry->destroy(OUString::createFromAscii("test2.rdb")), "test_registry_CppApi error 48"); -// OSL_ENSURE(!myRegistry->destroy("test3.rdb"), "test_registry_CppApi error 49"); + REG_ENSURE(!myRegistry->destroy(OUString::createFromAscii("test2.rdb")), "test_registry_CppApi error 48"); +// REG_ENSURE(!myRegistry->destroy("test3.rdb"), "test_registry_CppApi error 49"); Registry *myRegistry2 = new Registry(*myRegistry); - OSL_ENSURE(myRegistry->destroy(OUString()), "test_registry_CppApi error 50"); + REG_ENSURE(myRegistry->destroy(OUString()), "test_registry_CppApi error 50"); delete(myRegistry2); - OSL_ENSURE(!myRegistry->create(OUString::createFromAscii("destroytest.rdb")), "test_registry_CppApi error 51"); - OSL_ENSURE(!myRegistry->close(), "test_registry_CppApi error 52"); - OSL_ENSURE(!myRegistry->open(OUString::createFromAscii("destroytest.rdb"), REG_READONLY), "test_registry_CppApi error 53"); - OSL_ENSURE(!myRegistry->openRootKey(rootKey), "test_registry_CppApi error 54"); + REG_ENSURE(!myRegistry->create(OUString::createFromAscii("destroytest.rdb")), "test_registry_CppApi error 51"); + REG_ENSURE(!myRegistry->close(), "test_registry_CppApi error 52"); + REG_ENSURE(!myRegistry->open(OUString::createFromAscii("destroytest.rdb"), REG_READONLY), "test_registry_CppApi error 53"); + REG_ENSURE(!myRegistry->openRootKey(rootKey), "test_registry_CppApi error 54"); - OSL_ENSURE(myRegistry->mergeKey(rootKey, OUString::createFromAscii("allFromTest3"), + REG_ENSURE(myRegistry->mergeKey(rootKey, OUString::createFromAscii("allFromTest3"), OUString::createFromAscii("test3.rdb")), "test_registry_CppApi error 55"); - OSL_ENSURE(!myRegistry->destroy(OUString::createFromAscii("test3.rdb")), "test_registry_CppApi error 56"); + REG_ENSURE(!myRegistry->destroy(OUString::createFromAscii("test3.rdb")), "test_registry_CppApi error 56"); - OSL_ENSURE(!rootKey.closeKey(), "test_registry_CppApi error 57"); - OSL_ENSURE(!myRegistry->close(), "test_registry_CppApi error 58"); - OSL_ENSURE(!myRegistry->open(OUString::createFromAscii("destroytest.rdb"), REG_READWRITE), "test_registry_CppApi error 59"); - OSL_ENSURE(!myRegistry->destroy(OUString()), "test_registry_CppApi error 60"); + REG_ENSURE(!rootKey.closeKey(), "test_registry_CppApi error 57"); + REG_ENSURE(!myRegistry->close(), "test_registry_CppApi error 58"); + REG_ENSURE(!myRegistry->open(OUString::createFromAscii("destroytest.rdb"), REG_READWRITE), "test_registry_CppApi error 59"); + REG_ENSURE(!myRegistry->destroy(OUString()), "test_registry_CppApi error 60"); - OSL_ENSURE(!myRegistry->open(OUString::createFromAscii("test.rdb"), REG_READWRITE), "test_registry_CppApi error 61"); - OSL_ENSURE(!myRegistry->destroy(OUString::createFromAscii("ucrtest.rdb")), "test_registry_CppApi error 62"); - OSL_ENSURE(!myRegistry->destroy(OUString()), "test_registry_CppApi error 63"); + REG_ENSURE(!myRegistry->open(OUString::createFromAscii("test.rdb"), REG_READWRITE), "test_registry_CppApi error 61"); + REG_ENSURE(!myRegistry->destroy(OUString::createFromAscii("ucrtest.rdb")), "test_registry_CppApi error 62"); + REG_ENSURE(!myRegistry->destroy(OUString()), "test_registry_CppApi error 63"); delete(myRegistry); cout << "test_registry_CppApi() Ok!\n"; diff --git a/registry/workben/makefile.mk b/registry/workben/makefile.mk index 317b7e3110f9..43a09bdb8ce7 100644 --- a/registry/workben/makefile.mk +++ b/registry/workben/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.8 $ +# $Revision: 1.8.10.2 $ # # This file is part of OpenOffice.org. # @@ -36,6 +36,8 @@ TARGET=regtest TARGETTYPE=CUI LIBTARGET=NO +ENABLE_EXCEPTIONS := TRUE + # --- Settings ----------------------------------------------------- .INCLUDE : settings.mk @@ -62,7 +64,19 @@ APP1STDLIBS=\ APP2TARGET= test APP2OBJS= $(OBJ)$/test.obj +APP2RPATH=NONE +.IF "$(GUI)"=="UNX" && "$(OS)"!="MACOSX" + +.IF "$(OS)"=="LINUX" +APP2LINKFLAGS=-Wl,-rpath,\''$$ORIGIN:$$ORIGIN/../lib'\' +.ENDIF +.IF "$(OS)"=="SOLARIS" +APP2LINKFLAGS=-R\''$$ORIGIN/../lib:$$ORIGIN'\' +.ENDIF + +.ENDIF # "$(OS)"=="UNX" + APP2STDLIBS=\ $(RGTLIB) diff --git a/registry/workben/regtest.cxx b/registry/workben/regtest.cxx index 23ba5e14e2a0..eb1fa9b64ef8 100644 --- a/registry/workben/regtest.cxx +++ b/registry/workben/regtest.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: regtest.cxx,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.10.2 $ * * This file is part of OpenOffice.org. * @@ -42,9 +42,9 @@ using namespace std; using namespace rtl; #if (defined UNX) || (defined OS2) -int main( int argc, char * argv[] ) +int main() #else -int _cdecl main( int argc, char * argv[] ) +int _cdecl main() #endif { RegHandle hReg; @@ -103,7 +103,7 @@ int _cdecl main( int argc, char * argv[] ) cout << "8. close " << nSubKeys << "subkeys of \"myfirstKey\"\n\n"; - char* Value="Mein erster Value"; + char* Value=(char*)"Mein erster Value"; if (reg_setValue(hRootKey, OUString::createFromAscii("mySecondKey").pData, RG_VALUETYPE_STRING, Value, 18)) cout << "\t9. setValue of key \"mySecondKey\" failed\n"; else diff --git a/registry/workben/test.cxx b/registry/workben/test.cxx index c2ecd485cc26..c9b7038bb09a 100644 --- a/registry/workben/test.cxx +++ b/registry/workben/test.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: test.cxx,v $ - * $Revision: 1.4 $ + * $Revision: 1.4.10.1 $ * * This file is part of OpenOffice.org. * @@ -34,9 +34,9 @@ #include #if (defined UNX) || (defined OS2) -int main( int argc, char * argv[] ) +int main() #else -int _cdecl main( int argc, char * argv[] ) +int _cdecl main() #endif { void test_coreReflection(); diff --git a/stoc/source/security/permissions.cxx b/stoc/source/security/permissions.cxx index 5e08c190d079..2d8a655dade6 100644 --- a/stoc/source/security/permissions.cxx +++ b/stoc/source/security/permissions.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: permissions.cxx,v $ - * $Revision: 1.11 $ + * $Revision: 1.11.16.1 $ * * This file is part of OpenOffice.org. * @@ -544,6 +544,7 @@ PermissionCollection::PermissionCollection( } } } +#ifdef __DIAGNOSE //__________________________________________________________________________________________________ Sequence< OUString > PermissionCollection::toStrings() const SAL_THROW( () ) { @@ -556,6 +557,7 @@ Sequence< OUString > PermissionCollection::toStrings() const SAL_THROW( () ) return Sequence< OUString >( strings.empty() ? 0 : &strings[ 0 ], strings.size() ); } +#endif //__________________________________________________________________________________________________ inline static bool __implies( ::rtl::Reference< Permission > const & head, Permission const & demanded ) SAL_THROW( () ) @@ -567,11 +569,6 @@ inline static bool __implies( } return false; } -//__________________________________________________________________________________________________ -bool PermissionCollection::implies( Permission const & perm ) const SAL_THROW( () ) -{ - return __implies( m_head, perm ); -} #ifdef __DIAGNOSE //-------------------------------------------------------------------------------------------------- diff --git a/stoc/source/security/permissions.h b/stoc/source/security/permissions.h index c7d4ab5d4c79..c86f882b9e07 100644 --- a/stoc/source/security/permissions.h +++ b/stoc/source/security/permissions.h @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: permissions.h,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.16.1 $ * * This file is part of OpenOffice.org. * @@ -93,10 +93,9 @@ public: ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > const & permissions, PermissionCollection const & addition = PermissionCollection() ) SAL_THROW( (::com::sun::star::uno::RuntimeException) ); - +#ifdef __DIAGNOSE ::com::sun::star::uno::Sequence< ::rtl::OUString > toStrings() const SAL_THROW( () ); - - bool implies( Permission const & ) const SAL_THROW( () ); +#endif void checkPermission( ::com::sun::star::uno::Any const & perm ) const SAL_THROW( (::com::sun::star::uno::RuntimeException) ); }; diff --git a/stoc/test/excomp/excomp.cxx b/stoc/test/excomp/excomp.cxx index 3bb75f7d006d..894b451ee7cf 100644 --- a/stoc/test/excomp/excomp.cxx +++ b/stoc/test/excomp/excomp.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: excomp.cxx,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.16.1 $ * * This file is part of OpenOffice.org. * @@ -96,7 +96,7 @@ SAL_IMPLEMENT_MAIN() typelib_TypeDescription* pTypeDesc = NULL; OUString sType = OUString::createFromAscii("com.sun.star.text.XTextDocument"); typelib_typedescription_getByName( &pTypeDesc, sType.pData); - typelib_InterfaceTypeDescription* pInterDesc = (typelib_InterfaceTypeDescription*)pTypeDesc; +// typelib_InterfaceTypeDescription* pInterDesc = (typelib_InterfaceTypeDescription*)pTypeDesc; Reference< XInterface > xIFace = xSMgr->createInstance(OUString::createFromAscii("com.sun.star.registry.ImplementationRegistration")); Reference< XImplementationRegistration > xImpReg( xIFace, UNO_QUERY); diff --git a/stoc/test/excomp/excomp1.cxx b/stoc/test/excomp/excomp1.cxx index cf6ac99c4531..7d13036f4153 100644 --- a/stoc/test/excomp/excomp1.cxx +++ b/stoc/test/excomp/excomp1.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: excomp1.cxx,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.16.1 $ * * This file is part of OpenOffice.org. * @@ -157,13 +157,13 @@ extern "C" { //================================================================================================== void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) + const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) + void * /* pServiceManager */ , void * pRegistryKey ) { if (pRegistryKey) { @@ -174,7 +174,7 @@ sal_Bool SAL_CALL component_writeInfo( reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME1 "/UNO/SERVICES") ) ) ); - Sequence< OUString > & rSNL = + const Sequence< OUString > & rSNL = ::excomp_impl::ExampleComponent1Impl::getSupportedServiceNames_Static(); const OUString * pArray = rSNL.getConstArray(); for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) @@ -191,7 +191,7 @@ sal_Bool SAL_CALL component_writeInfo( } //================================================================================================== void * SAL_CALL component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) + const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { void * pRet = 0; diff --git a/stoc/test/excomp/excomp2.cxx b/stoc/test/excomp/excomp2.cxx index 406e036d0da0..5afade088088 100644 --- a/stoc/test/excomp/excomp2.cxx +++ b/stoc/test/excomp/excomp2.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: excomp2.cxx,v $ - * $Revision: 1.5 $ + * $Revision: 1.5.16.1 $ * * This file is part of OpenOffice.org. * @@ -228,13 +228,13 @@ extern "C" { //================================================================================================== void SAL_CALL component_getImplementationEnvironment( - const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) + const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ ) { *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; } //================================================================================================== sal_Bool SAL_CALL component_writeInfo( - void * pServiceManager, void * pRegistryKey ) + void * /* pServiceManager */, void * pRegistryKey ) { if (pRegistryKey) { @@ -245,7 +245,7 @@ sal_Bool SAL_CALL component_writeInfo( reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME2 "/UNO/SERVICES") ) ) ); - Sequence< OUString > & rSNL = + const Sequence< OUString > & rSNL = ::excomp2_impl::ExampleComponent2Impl::getSupportedServiceNames_Static(); const OUString * pArray = rSNL.getConstArray(); for ( sal_Int32 nPos = rSNL.getLength(); nPos--; ) @@ -262,7 +262,7 @@ sal_Bool SAL_CALL component_writeInfo( } //================================================================================================== void * SAL_CALL component_getFactory( - const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) + const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ ) { void * pRet = 0; diff --git a/stoc/test/javavm/testjavavm.cxx b/stoc/test/javavm/testjavavm.cxx index c8c7091d45e6..4ccf31deb675 100644 --- a/stoc/test/javavm/testjavavm.cxx +++ b/stoc/test/javavm/testjavavm.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: testjavavm.cxx,v $ - * $Revision: 1.9 $ + * $Revision: 1.9.16.1 $ * * This file is part of OpenOffice.org. * @@ -144,7 +144,8 @@ sal_Bool testJavaVM(const Reference< XMultiServiceFactory > & xMgr ) jmethodID id = p_env->GetStaticMethodID( cls, "getInt", "()I"); if( id) { - jint _i= p_env->CallStaticIntMethod(cls, id); +// jint _i= p_env->CallStaticIntMethod(cls, id); + p_env->CallStaticIntMethod(cls, id); } if( p_env->ExceptionOccurred()){ diff --git a/stoc/test/makefile.mk b/stoc/test/makefile.mk index d5334dee2a48..e8c60aac711b 100644 --- a/stoc/test/makefile.mk +++ b/stoc/test/makefile.mk @@ -8,7 +8,7 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.29 $ +# $Revision: 1.29.6.2 $ # # This file is part of OpenOffice.org. # @@ -86,6 +86,7 @@ APP2STDLIBS= \ $(CPPULIB) \ $(CPPUHELPERLIB) \ $(SALHELPERLIB) \ + $(REGLIB) \ $(SALLIB) # --- Application 3 - testsmgr main ------------------------------------ @@ -95,6 +96,7 @@ APP3STDLIBS= \ $(CPPULIB) \ $(CPPUHELPERLIB) \ $(SALHELPERLIB) \ + $(REGLIB) \ $(SALLIB) .IF "$(GUI)"=="UNX" || "$(GUI)"=="OS2" @@ -199,6 +201,9 @@ TESTPROXYFAC:=com.sun.star.reflection.XProxyFactory TESTSECURITY:=com.sun.star.security.AllPermission;com.sun.star.security.XPolicy;com.sun.star.security.XAccessController;com.sun.star.io.FilePermission;com.sun.star.connection.SocketPermission;com.sun.star.uno.XCurrentContext $(BIN)$/test1.rdb: $(SHL1TARGETN) +.IF "$(GUI)"=="UNX" + cp $(SHL1TARGETN) $(BIN) +.ENDIF cd $(BIN) && regcomp -register -r test1.rdb -c $(SHL1TARGET) $(BIN)$/test2.rdb: diff --git a/stoc/test/security/test_security.cxx b/stoc/test/security/test_security.cxx index 39bdcc2e8a84..ff1d757b22e5 100644 --- a/stoc/test/security/test_security.cxx +++ b/stoc/test/security/test_security.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: test_security.cxx,v $ - * $Revision: 1.8 $ + * $Revision: 1.8.16.1 $ * * This file is part of OpenOffice.org. * @@ -69,7 +69,8 @@ static OUString localhost( OUString const & addition ) SAL_THROW( () ) SocketAddr addr; SocketAddr::resolveHostname( OUSTR("localhost"), addr ); ::oslSocketResult rc = ::osl_getDottedInetAddrOfSocketAddr( addr.getHandle(), &ip.pData ); - OSL_ENSURE( ::osl_Socket_E_None == rc, "### cannot resolve localhost!" ); + if (::osl_Socket_Ok != rc) + fprintf(stdout, "### cannot resolve localhost!" ); } OUStringBuffer buf( 48 ); buf.append( ip ); @@ -190,7 +191,7 @@ Any user_CurrentContext::getValueByName( OUString const & name ) /* grant { -permission com.sun.star.io.FilePermission "file:///usr/bin/*", "read"; +permission com.sun.star.io.FilePermission "file:///usr/bin/ *", "read"; permission com.sun.star.io.FilePermission "file:///tmp/-", "read,write"; permission com.sun.star.io.FilePermission "file:///etc/profile", "read"; @@ -248,7 +249,7 @@ grant user "dbo" { permission com.sun.star.io.FilePermission "file:///home/dbo/-", "read,write"; permission com.sun.star.io.FilePermission "-", "read,write"; -permission com.sun.star.io.FilePermission "file:///usr/local/dbo/*", "read"; +permission com.sun.star.io.FilePermission "file:///usr/local/dbo/ *", "read"; permission com.sun.star.security.RuntimePermission "DBO"; @@ -423,13 +424,13 @@ Any Action::run() } //================================================================================================== -static void restr_file_permissions( AccessControl & ac ) -{ - // running in dbo's domain - /* permission com.sun.star.io.FilePermission "file:///home/dbo/-", ",,read , write "; */ - CHECK( ac.checkFilePermission( OUSTR("file:///home/dbo/bla"), OUSTR("read,write,execute") ), true ); - CHECK( ac.checkFilePermission( OUSTR("file:///home/dbo/bla"), OUSTR("read,write") ), false ); -} +// static void restr_file_permissions( AccessControl & ac ) +// { +// // running in dbo's domain +// /* permission com.sun.star.io.FilePermission "file:///home/dbo/-", ",,read , write "; */ +// CHECK( ac.checkFilePermission( OUSTR("file:///home/dbo/bla"), OUSTR("read,write,execute") ), true ); +// CHECK( ac.checkFilePermission( OUSTR("file:///home/dbo/bla"), OUSTR("read,write") ), false ); +// } //================================================================================================== static void all_dbo_permissions( AccessControl & ac, Any const & ) { diff --git a/stoc/test/testregistry.cxx b/stoc/test/testregistry.cxx index 978f3618fdab..d04e6facf71d 100644 --- a/stoc/test/testregistry.cxx +++ b/stoc/test/testregistry.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: testregistry.cxx,v $ - * $Revision: 1.21 $ + * $Revision: 1.21.16.2 $ * * This file is part of OpenOffice.org. * @@ -105,6 +105,7 @@ static void mergeKeys( xDestKey->closeKey(); } + OString userRegEnv("STAR_USER_REGISTRY="); OUString getExePath() @@ -121,16 +122,7 @@ OUString getExePath() void setStarUserRegistry() { - RegistryLoader* pLoader = new RegistryLoader(); - - if (!pLoader->isLoaded()) - { - delete pLoader; - return; - } - - Registry *myRegistry = new Registry(*pLoader); - delete pLoader; + Registry *myRegistry = new Registry(); RegistryKey rootKey, rKey, rKey2; @@ -150,16 +142,7 @@ void setStarUserRegistry() void setLinkInDefaultRegistry(const OUString& linkName, const OUString& linkTarget) { - RegistryLoader* pLoader = new RegistryLoader(); - - if (!pLoader->isLoaded()) - { - delete pLoader; - return; - } - - Registry *myRegistry = new Registry(*pLoader); - delete pLoader; + Registry *myRegistry = new Registry(); RegistryKey rootKey; @@ -687,9 +670,9 @@ void test_DefaultRegistry( SAL_IMPLEMENT_MAIN() { - setStarUserRegistry(); - setLinkInDefaultRegistry(OUString::createFromAscii("/Test/DefaultLink"), - OUString::createFromAscii("/Test/FifthKey/MyFirstLink")); +// setStarUserRegistry(); + setLinkInDefaultRegistry(OUString::createFromAscii("/Test/DefaultLink"), + OUString::createFromAscii("/Test/FifthKey/MyFirstLink")); OUString reg1( RTL_CONSTASCII_USTRINGPARAM("testreg1.rdb") ); OUString reg2( RTL_CONSTASCII_USTRINGPARAM("testreg2.rdb") ); diff --git a/stoc/test/testsmgr.cxx b/stoc/test/testsmgr.cxx index 7d7467f9c963..add5da03a59d 100644 --- a/stoc/test/testsmgr.cxx +++ b/stoc/test/testsmgr.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: testsmgr.cxx,v $ - * $Revision: 1.13 $ + * $Revision: 1.13.16.1 $ * * This file is part of OpenOffice.org. * @@ -77,16 +77,7 @@ OUString getExePath() void setStarUserRegistry() { - RegistryLoader* pLoader = new RegistryLoader(); - - if (!pLoader->isLoaded()) - { - delete pLoader; - return; - } - - Registry *myRegistry = new Registry(*pLoader); - delete pLoader; + Registry *myRegistry = new Registry(); RegistryKey rootKey, rKey, rKey2; diff --git a/stoc/test/testsmgr2.cxx b/stoc/test/testsmgr2.cxx index b5f639bab46a..81f8f1043e27 100644 --- a/stoc/test/testsmgr2.cxx +++ b/stoc/test/testsmgr2.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: testsmgr2.cxx,v $ - * $Revision: 1.7 $ + * $Revision: 1.7.16.1 $ * * This file is part of OpenOffice.org. * @@ -42,6 +42,7 @@ #include #include #include +#include using namespace ::rtl; using namespace ::cppu; -- cgit