summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_intel/call.s16
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx7
-rw-r--r--cli_ure/version/version.txt24
-rw-r--r--cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx20
-rwxr-xr-xcpputools/source/regcomplazy/regcomplazy.cxx62
-rw-r--r--idlc/source/astdump.cxx4
-rw-r--r--idlc/source/idlcproduce.cxx22
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx16
-rw-r--r--jvmfwk/plugins/sunmajor/pluginlib/util.cxx25
-rw-r--r--offapi/com/sun/star/chart/XChartDataArray.idl2
-rw-r--r--offapi/com/sun/star/chart/XChartDocument.idl28
-rw-r--r--offapi/com/sun/star/chart/XComplexDescriptionAccess.idl98
-rw-r--r--offapi/com/sun/star/chart/makefile.mk1
-rw-r--r--offapi/com/sun/star/chart2/InterpretedData.idl4
-rw-r--r--offapi/com/sun/star/chart2/XChartTypeTemplate.idl8
-rw-r--r--offapi/com/sun/star/chart2/XDataInterpreter.idl9
-rw-r--r--offapi/com/sun/star/chart2/XDiagram.idl4
-rw-r--r--offapi/com/sun/star/chart2/XInternalDataProvider.idl13
-rw-r--r--offapi/com/sun/star/chart2/data/XDataReceiver.idl18
-rw-r--r--offapi/com/sun/star/configuration/ConfigurationRegistry.idl4
-rw-r--r--offapi/com/sun/star/deployment/LicenseException.idl8
-rw-r--r--offapi/com/sun/star/deployment/LicenseIndividualAgreementException.idl7
-rw-r--r--offapi/com/sun/star/document/XDocumentRecovery.idl127
-rw-r--r--offapi/com/sun/star/document/makefile.mk1
-rw-r--r--offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl15
-rw-r--r--offapi/com/sun/star/frame/XController2.idl11
-rw-r--r--offapi/com/sun/star/report/XReportDefinition.idl6
-rw-r--r--offapi/com/sun/star/sdb/DatabaseInteractionHandler.idl71
-rw-r--r--offapi/com/sun/star/sdb/DefinitionContent.idl8
-rw-r--r--offapi/com/sun/star/sdb/DocumentDefinition.idl6
-rw-r--r--offapi/com/sun/star/sdb/InteractionHandler.idl55
-rw-r--r--offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl86
-rw-r--r--offapi/com/sun/star/sdb/makefile.mk1
-rw-r--r--offapi/com/sun/star/sdb/tools/XConnectionSupplier.idl67
-rw-r--r--offapi/com/sun/star/sdb/tools/XIndexAlteration.idl96
-rw-r--r--offapi/com/sun/star/sdb/tools/XKeyAlteration.idl96
-rw-r--r--offapi/com/sun/star/sdb/tools/XTableAlteration.idl115
-rw-r--r--offapi/com/sun/star/sdb/tools/XTableRename.idl78
-rw-r--r--offapi/com/sun/star/sdb/tools/XViewAccess.idl88
-rw-r--r--offapi/com/sun/star/sdb/tools/makefile.mk8
-rw-r--r--offapi/com/sun/star/sheet/DataPilotDescriptor.idl34
-rw-r--r--offapi/com/sun/star/sheet/DataPilotTable.idl12
-rw-r--r--offapi/com/sun/star/task/DocumentMacroConfirmationRequest.idl7
-rw-r--r--offapi/com/sun/star/task/DocumentMacroConfirmationRequest2.idl80
-rw-r--r--offapi/com/sun/star/task/InteractionHandler.idl32
-rw-r--r--offapi/com/sun/star/task/makefile.mk1
-rw-r--r--offapi/com/sun/star/text/RedlinePortion.idl4
-rw-r--r--offapi/com/sun/star/text/XFormField.idl36
-rwxr-xr-xoffapi/com/sun/star/text/textfield/MetadataField.idl11
-rw-r--r--offapi/com/sun/star/util/Duration.idl4
-rw-r--r--offapi/prj/build.lst4
-rw-r--r--offapi/type_reference/typelibrary_history.txt10
-rw-r--r--offapi/type_reference/types.rdbbin6717440 -> 7307264 bytes
-rw-r--r--registry/inc/registry/registry.hxx36
-rw-r--r--registry/source/keyimpl.cxx164
-rw-r--r--registry/source/keyimpl.hxx74
-rw-r--r--registry/source/regimpl.cxx281
-rw-r--r--registry/source/regimpl.hxx62
-rw-r--r--registry/source/registry.cxx201
-rw-r--r--registry/source/regkey.cxx545
-rw-r--r--registry/tools/checksingleton.cxx9
-rw-r--r--registry/tools/regcompare.cxx9
-rw-r--r--registry/tools/regmerge.cxx31
-rw-r--r--sal/inc/osl/diagnose.hxx14
-rw-r--r--sal/inc/osl/file.h8
-rw-r--r--sal/osl/unx/file.cxx23
-rw-r--r--sal/osl/unx/signal.c11
-rw-r--r--sal/osl/unx/socket.c4
-rw-r--r--sal/osl/w32/file_dirvol.cxx217
-rw-r--r--sal/osl/w32/file_url.cxx325
-rw-r--r--sal/osl/w32/file_url.h6
-rw-r--r--sal/osl/w32/module.cxx (renamed from sal/osl/w32/module.c)77
-rw-r--r--sal/osl/w32/path_helper.hxx43
-rw-r--r--sal/osl/w32/process.cxx (renamed from sal/osl/w32/process.c)94
-rw-r--r--sal/osl/w32/profile.cxx (renamed from sal/osl/w32/profile.c)323
-rw-r--r--sal/osl/w32/signal.cxx (renamed from sal/osl/w32/signal.c)67
-rw-r--r--sal/osl/w32/system.h12
-rw-r--r--sal/osl/w32/tempfile.cxx28
-rw-r--r--sal/rtl/source/hash.cxx70
-rw-r--r--sal/rtl/source/hash.h10
-rw-r--r--sal/rtl/source/ustring.c16
-rw-r--r--stoc/source/invocation_adapterfactory/iafactory.cxx25
-rw-r--r--stoc/source/javavm/javavm.cxx33
-rw-r--r--store/inc/store/store.hxx424
-rw-r--r--store/inc/store/store.inl451
-rw-r--r--store/source/lockbyte.cxx34
-rw-r--r--store/source/lockbyte.hxx30
-rw-r--r--store/source/storbase.hxx17
-rw-r--r--store/source/storbios.cxx863
-rw-r--r--store/source/storbios.hxx47
-rw-r--r--store/source/stordata.cxx102
-rw-r--r--store/source/stordata.hxx2
-rw-r--r--store/source/storpage.cxx8
-rw-r--r--store/source/stortree.cxx125
-rw-r--r--store/workben/makefile.mk2
-rw-r--r--store/workben/t_base.cxx11
-rw-r--r--udkapi/com/sun/star/reflection/XInterfaceAttributeTypeDescription2.idl3
-rw-r--r--unoil/climaker/version.txt6
98 files changed, 3230 insertions, 3283 deletions
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/call.s b/bridges/source/cpp_uno/gcc3_linux_intel/call.s
index f345e3a764ac..45d7c5308d30 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/call.s
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/call.s
@@ -9,7 +9,8 @@ privateSnippetExecutorGeneral:
.LCFIg0:
movl %esp,%ebp
.LCFIg1:
- subl $0x4,%esp # 32bit returnValue
+ subl $0x8,%esp # 32bit returnValue, and preserve potential 128bit
+ # stack alignment
pushl %esp # 32bit &returnValue
pushl %ecx # 32bit pCallStack
pushl %edx # 32bit nVtableOffset
@@ -30,6 +31,7 @@ privateSnippetExecutorVoid:
.LCFIv0:
movl %esp,%ebp
.LCFIv1:
+ andl $0xFFFFFFF0,%esp # preserve potential 128bit stack alignment
pushl $0 # 32bit null pointer (returnValue not used)
pushl %ecx # 32bit pCallStack
pushl %edx # 32bit nVtableOffset
@@ -49,7 +51,8 @@ privateSnippetExecutorHyper:
.LCFIh0:
movl %esp,%ebp
.LCFIh1:
- subl $0x8,%esp # 64bit returnValue
+ subl $0x8,%esp # 64bit returnValue (preserves potential 128bit
+ # stack alignment)
pushl %esp # 32bit &returnValue
pushl %ecx # 32bit pCallStack
pushl %edx # 32bit nVtableOffset
@@ -71,7 +74,8 @@ privateSnippetExecutorFloat:
.LCFIf0:
movl %esp,%ebp
.LCFIf1:
- subl $0x4,%esp # 32bit returnValue
+ subl $0x8,%esp # 32bit returnValue, and preserve potential 128bit
+ # stack alignment
pushl %esp # 32bit &returnValue
pushl %ecx # 32bit pCallStack
pushl %edx # 32bit nVtableOffset
@@ -92,7 +96,8 @@ privateSnippetExecutorDouble:
.LCFId0:
movl %esp,%ebp
.LCFId1:
- subl $0x8,%esp # 64bit returnValue
+ subl $0x8,%esp # 64bit returnValue (preserves potential 128bit
+ # stack alignment)
pushl %esp # 32bit &returnValue
pushl %ecx # 32bit pCallStack
pushl %edx # 32bit nVtableOffset
@@ -113,7 +118,8 @@ privateSnippetExecutorClass:
.LCFIc0:
movl %esp,%ebp
.LCFIc1:
- subl $0x4,%esp # 32bit returnValue
+ subl $0x8,%esp # 32bit returnValue, and preserve potential 128bit
+ # stack alignment
pushl %esp # 32bit &returnValue
pushl %ecx # 32bit pCallStack
pushl %edx # 32bit nVtableOffset
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
index afd202f683cf..4d1d3f2f8ca4 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
@@ -84,6 +84,13 @@ void callVirtualMethod(
void * stackptr;
asm volatile (
"mov %%esp, %6\n\t"
+ // preserve potential 128bit stack alignment
+ "and $0xfffffff0, %%esp\n\t"
+ "mov %0, %%eax\n\t"
+ "lea -4(,%%eax,4), %%eax\n\t"
+ "and $0xf, %%eax\n\t"
+ "sub $0xc, %%eax\n\t"
+ "add %%eax, %%esp\n\t"
// copy values
"mov %0, %%eax\n\t"
"mov %%eax, %%edx\n\t"
diff --git a/cli_ure/version/version.txt b/cli_ure/version/version.txt
index d90b3ac4446a..15dac78d4ed8 100644
--- a/cli_ure/version/version.txt
+++ b/cli_ure/version/version.txt
@@ -25,23 +25,23 @@
#
#*************************************************************************
-CLI_URETYPES_NEW_VERSION=1.0.4.0
-CLI_URETYPES_OLD_VERSION=1.0.0.0-1.0.3.0
-CLI_URETYPES_POLICY_VERSION=4.0.0.0
+CLI_URETYPES_NEW_VERSION=1.0.6.0
+CLI_URETYPES_OLD_VERSION=1.0.0.0-1.0.5.0
+CLI_URETYPES_POLICY_VERSION=6.0.0.0
CLI_URETYPES_POLICY_ASSEMBLY=policy.1.0.cli_uretypes
-CLI_BASETYPES_NEW_VERSION=1.0.15.0
-CLI_BASETYPES_OLD_VERSION=1.0.0.0-1.0.14.0
-CLI_BASETYPES_POLICY_VERSION=15.0.0.0
+CLI_BASETYPES_NEW_VERSION=1.0.17.0
+CLI_BASETYPES_OLD_VERSION=1.0.0.0-1.0.16.0
+CLI_BASETYPES_POLICY_VERSION=17.0.0.0
CLI_BASETYPES_POLICY_ASSEMBLY=policy.1.0.cli_basetypes
-CLI_URE_NEW_VERSION=1.0.18.0
-CLI_URE_OLD_VERSION=1.0.0.0-1.0.17.0
-CLI_URE_POLICY_VERSION=18.0.0.0
+CLI_URE_NEW_VERSION=1.0.20.0
+CLI_URE_OLD_VERSION=1.0.0.0-1.0.19.0
+CLI_URE_POLICY_VERSION=20.0.0.0
CLI_URE_POLICY_ASSEMBLY=policy.1.0.cli_ure
-CLI_CPPUHELPER_NEW_VERSION=1.0.18.0
-CLI_CPPUHELPER_OLD_VERSION=1.0.0.0-1.0.17.0
-CLI_CPPUHELPER_POLICY_VERSION=18.0.0.0
+CLI_CPPUHELPER_NEW_VERSION=1.0.20.0
+CLI_CPPUHELPER_OLD_VERSION=1.0.0.0-1.0.19.0
+CLI_CPPUHELPER_POLICY_VERSION=20.0.0.0
CLI_CPPUHELPER_POLICY_ASSEMBLY=policy.1.0.cli_cppuhelper
diff --git a/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx b/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx
index 7b7657fc79ed..344203e38762 100644
--- a/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx
+++ b/cppu/source/helper/purpenv/helper_purpenv_Proxy.cxx
@@ -275,10 +275,12 @@ static uno::TypeDescription getAcquireMethod(void)
typelib_TypeDescriptionReference * type_XInterface =
* typelib_static_type_getByTypeClass(typelib_TypeClass_INTERFACE);
- typelib_InterfaceTypeDescription * pTXInterfaceDescr = 0;
- TYPELIB_DANGER_GET ((typelib_TypeDescription **)&pTXInterfaceDescr, type_XInterface);
- uno::TypeDescription acquire(pTXInterfaceDescr->ppAllMembers[1]);
- TYPELIB_DANGER_RELEASE((typelib_TypeDescription *)pTXInterfaceDescr);
+ typelib_TypeDescription * pTXInterfaceDescr = 0;
+ TYPELIB_DANGER_GET (&pTXInterfaceDescr, type_XInterface);
+ uno::TypeDescription acquire(
+ reinterpret_cast< typelib_InterfaceTypeDescription * >(
+ pTXInterfaceDescr)->ppAllMembers[1]);
+ TYPELIB_DANGER_RELEASE(pTXInterfaceDescr);
return acquire;
}
@@ -288,10 +290,12 @@ static uno::TypeDescription getReleaseMethod(void)
typelib_TypeDescriptionReference * type_XInterface =
* typelib_static_type_getByTypeClass(typelib_TypeClass_INTERFACE);
- typelib_InterfaceTypeDescription * pTXInterfaceDescr = 0;
- TYPELIB_DANGER_GET ((typelib_TypeDescription **)&pTXInterfaceDescr, type_XInterface);
- uno::TypeDescription release(pTXInterfaceDescr->ppAllMembers[2]);
- TYPELIB_DANGER_RELEASE((typelib_TypeDescription *)pTXInterfaceDescr);
+ typelib_TypeDescription * pTXInterfaceDescr = 0;
+ TYPELIB_DANGER_GET (&pTXInterfaceDescr, type_XInterface);
+ uno::TypeDescription release(
+ reinterpret_cast< typelib_InterfaceTypeDescription * >(
+ pTXInterfaceDescr)->ppAllMembers[2]);
+ TYPELIB_DANGER_RELEASE(pTXInterfaceDescr);
return release;
}
diff --git a/cpputools/source/regcomplazy/regcomplazy.cxx b/cpputools/source/regcomplazy/regcomplazy.cxx
index 367ac02510e5..13c09c8d1c94 100755
--- a/cpputools/source/regcomplazy/regcomplazy.cxx
+++ b/cpputools/source/regcomplazy/regcomplazy.cxx
@@ -46,16 +46,11 @@ using namespace ::rtl;
typedef ::std::vector< ::rtl::OString > OSVector;
-typedef ::std::pair< ::rtl::OString, OSVector > DataPair;
-
-typedef ::std::vector< DataPair > DataVector;
-
struct CompDescriptor {
OString sImplementationName;
OString sComponentName;
OString sLoaderName;
OSVector vSupportedServices;
- DataVector vData;
};
typedef ::std::vector< CompDescriptor > CDescrVector;
@@ -144,28 +139,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
OString sToken(sTmp);
if (sTmp.pData->buffer[sTmp.getLength()-1] == '\x0D')
sToken = sTmp.copy(0, sTmp.getLength()-1);
-
- if (sToken.indexOf("[Data]") >= 0) {
- do {
- OString sTmp2 = sDescr.getToken(0, '\x0A', nTokenIndex);
- OString sToken2(sTmp2);
- if (sTmp2.pData->buffer[sTmp2.getLength()-1] == '\x0D')
- sToken2 = sTmp2.copy(0, sTmp2.getLength()-1);
-
- if ((sToken2.getLength() > 0) && (sToken2.pData->buffer[0] != '[')) {
- OString dataKey(sToken2.copy(0, sToken2.indexOf('=')));
- OString sValues(sToken2.copy(sToken2.indexOf('=')+1));
- sal_Int32 nVIndex = 0;
- OSVector vValues;
- do {
- OString sValue = sValues.getToken(0, ';', nVIndex);
- vValues.push_back(sValue);
- } while (nVIndex >= 0 );
- descr.vData.push_back(DataPair(dataKey, vValues));
- } else
- break;
- } while (nTokenIndex >= 0 );
- }
if ( sToken.indexOf("[ComponentDescriptor]") >= 0) {
if (bFirst)
bFirst = false;
@@ -244,41 +217,6 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
subKey.setValue(OUString(), RG_VALUETYPE_STRING,
(sal_Char*)sCompName.getStr(), sCompName.getLength()+1);
- if ((*comp_iter).vData.size() > 0) {
- usKeyName = OUSTR("DATA");
- RegistryKey dataKey, valueKey;
- key.createKey(usKeyName, dataKey);
-
- DataVector::const_iterator data_iter = ((*comp_iter).vData).begin();
- do {
- OUString sDataKey(OSToOUS((*data_iter).first));
- dataKey.createKey(sDataKey, valueKey);
-
- OSVector::const_iterator value_iter = ((*data_iter).second).begin();
- int vlen = (*data_iter).second.size();
- sal_Char** pValueList = (sal_Char**)rtl_allocateZeroMemory(
- vlen * sizeof(sal_Char*));
- int i = 0;
- do {
- pValueList[i] = (sal_Char*)rtl_allocateZeroMemory(
- (*value_iter).getLength()+1 * sizeof(sal_Char));
- rtl_copyMemory(pValueList[i], (sal_Char*)(*value_iter).getStr(),
- (*value_iter).getLength()+1);
- i++;
- value_iter++;
- } while (value_iter != (*data_iter).second.end());
-
- valueKey.setStringListValue(OUString(), pValueList, vlen);
-
- // free memory
- for (i=0; i<vlen; i++)
- rtl_freeMemory(pValueList[i]);
- rtl_freeMemory(pValueList);
-
- data_iter++;
- } while (data_iter != (*comp_iter).vData.end());
- }
-
usKeyName = OUSTR("UNO/SERVICES");
key.createKey(usKeyName, subKey);
diff --git a/idlc/source/astdump.cxx b/idlc/source/astdump.cxx
index 2c8a7d8b6638..3934cfb67e19 100644
--- a/idlc/source/astdump.cxx
+++ b/idlc/source/astdump.cxx
@@ -134,6 +134,10 @@ sal_Bool AstModule::dump(RegistryKey& rKey)
}
}
}
+ if ( getNodeType() == NT_root )
+ {
+ localKey.releaseKey();
+ }
return AstDeclaration::dump(rKey);
}
diff --git a/idlc/source/idlcproduce.cxx b/idlc/source/idlcproduce.cxx
index b7c4bc57dfc3..e20b7da1c42b 100644
--- a/idlc/source/idlcproduce.cxx
+++ b/idlc/source/idlcproduce.cxx
@@ -146,11 +146,11 @@ sal_Int32 SAL_CALL produceFile(const OString& regFileName)
return 1;
}
- Registry regFile;
-
removeIfExists(regTmpName);
OString urlRegTmpName = convertToFileUrl(regTmpName);
- if ( regFile.create(OStringToOUString(urlRegTmpName, RTL_TEXTENCODING_UTF8)) )
+
+ Registry regFile;
+ if ( regFile.create(OStringToOUString(urlRegTmpName, RTL_TEXTENCODING_UTF8)) != REG_NO_ERROR )
{
fprintf(stderr, "%s: could not create registry file '%s'\n",
pOptions->getProgramName().getStr(), regTmpName.getStr());
@@ -161,7 +161,7 @@ sal_Int32 SAL_CALL produceFile(const OString& regFileName)
}
RegistryKey rootKey;
- if ( regFile.openRootKey(rootKey) )
+ if ( regFile.openRootKey(rootKey) != REG_NO_ERROR )
{
fprintf(stderr, "%s: could not open root of registry file '%s'\n",
pOptions->getProgramName().getStr(), regFileName.getStr());
@@ -174,7 +174,7 @@ sal_Int32 SAL_CALL produceFile(const OString& regFileName)
// produce registry file
if ( !idlc()->getRoot()->dump(rootKey) )
{
- rootKey.closeKey();
+ rootKey.releaseKey();
regFile.close();
regFile.destroy(OStringToOUString(regFileName, RTL_TEXTENCODING_UTF8));
removeIfExists(regFileName);
@@ -182,16 +182,8 @@ sal_Int32 SAL_CALL produceFile(const OString& regFileName)
return 1;
}
- if ( rootKey.closeKey() )
- {
- fprintf(stderr, "%s: could not close root of registry file '%s'\n",
- pOptions->getProgramName().getStr(), regFileName.getStr());
- removeIfExists(regTmpName);
- removeIfExists(regFileName);
- cleanPath();
- return 1;
- }
- if ( regFile.close() )
+ rootKey.releaseKey();
+ if ( regFile.close() != REG_NO_ERROR )
{
fprintf(stderr, "%s: could not close registry file '%s'\n",
pOptions->getProgramName().getStr(), regFileName.getStr());
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
index f84bcb4f9ec0..896342b5389d 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx
@@ -175,7 +175,7 @@ rtl::OUString getRuntimeLib(const rtl::ByteSequence & data)
jmp_buf jmp_jvm_abort;
sig_atomic_t g_bInGetJavaVM = 0;
-void abort_handler()
+extern "C" void JNICALL abort_handler()
{
// If we are within JNI_CreateJavaVM then we jump back into getJavaVM
if( g_bInGetJavaVM != 0 )
@@ -508,20 +508,6 @@ javaPluginError jfw_plugin_startJavaVirtualMachine(
return JFW_PLUGIN_E_VM_CREATION_FAILED;
}
- // The office sets a signal handler at startup. That causes a crash
- // with java 1.3 under Solaris. To make it work, we set back the
- // handler
-#ifdef UNX
- struct sigaction act;
- act.sa_handler=SIG_DFL;
- act.sa_flags= 0;
- sigaction( SIGSEGV, &act, NULL);
- sigaction( SIGPIPE, &act, NULL);
- sigaction( SIGBUS, &act, NULL);
- sigaction( SIGILL, &act, NULL);
- sigaction( SIGFPE, &act, NULL);
-#endif
-
// Some testing with Java 1.4 showed that JavaVMOption.optionString has to
// be encoded with the system encoding (i.e., osl_getThreadTextEncoding):
JavaVMInitArgs vm_args;
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
index a911b75f85ab..bd49956c8baf 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
@@ -124,7 +124,7 @@ extern VendorSupportMapEntry gVendorMap[];
bool getSDKInfoFromRegistry(vector<OUString> & vecHome);
bool getJREInfoFromRegistry(vector<OUString>& vecJavaHome);
-rtl::OUString decodeOutput(const rtl::OString& s);
+bool decodeOutput(const rtl::OString& s, rtl::OUString* out);
@@ -452,7 +452,9 @@ bool getJavaProps(const OUString & exePath,
break;
JFW_TRACE2(OString("[Java framework] line:\" ")
+ aLine + OString(" \".\n"));
- OUString sLine = decodeOutput(aLine);
+ OUString sLine;
+ if (!decodeOutput(aLine, &sLine))
+ continue;
JFW_TRACE2(OString("[Java framework] line:\" ")
+ OString( CHAR_POINTER(sLine)) + OString(" \".\n"));
sLine = sLine.trim();
@@ -486,8 +488,9 @@ bool getJavaProps(const OUString & exePath,
readable strings. The strings are encoded as integer values separated
by spaces.
*/
-rtl::OUString decodeOutput(const rtl::OString& s)
+bool decodeOutput(const rtl::OString& s, rtl::OUString* out)
{
+ OSL_ASSERT(out != 0);
OUStringBuffer buff(512);
sal_Int32 nIndex = 0;
do
@@ -495,14 +498,19 @@ rtl::OUString decodeOutput(const rtl::OString& s)
OString aToken = s.getToken( 0, ' ', nIndex );
if (aToken.getLength())
{
+ for (sal_Int32 i = 0; i < aToken.getLength(); ++i)
+ {
+ if (aToken[i] < '0' || aToken[i] > '9')
+ return false;
+ }
sal_Unicode value = (sal_Unicode)(aToken.toInt32());
buff.append(value);
}
} while (nIndex >= 0);
- OUString sDecoded(buff.makeStringAndClear());
- JFW_TRACE2(sDecoded);
- return sDecoded;
+ *out = buff.makeStringAndClear();
+ JFW_TRACE2(*out);
+ return true;
}
@@ -793,8 +801,9 @@ OUString resolveDirPath(const OUString & path)
{
OUString ret;
OUString sResolved;
+ //getAbsoluteFileURL also resolves links
if (File::getAbsoluteFileURL(
- rtl::OUString(), path, sResolved) != File::E_None)
+ OUSTR("file:///"), path, sResolved) != File::E_None)
return OUString();
//check if this is a valid path and if it is a directory
@@ -824,7 +833,7 @@ OUString resolveFilePath(const OUString & path)
OUString sResolved;
if (File::getAbsoluteFileURL(
- rtl::OUString(), path, sResolved) != File::E_None)
+ OUSTR("file:///"), path, sResolved) != File::E_None)
return OUString();
//check if this is a valid path to a file or and if it is a link
diff --git a/offapi/com/sun/star/chart/XChartDataArray.idl b/offapi/com/sun/star/chart/XChartDataArray.idl
index 011597f41f66..4e7519864382 100644
--- a/offapi/com/sun/star/chart/XChartDataArray.idl
+++ b/offapi/com/sun/star/chart/XChartDataArray.idl
@@ -39,6 +39,8 @@
/** gives access to data represented as an array of rows.
+ <p>Can be obtained from interface <type>XChartDocument</type> via method getData().</p>
+
<p>If used for an <type>XYDiagram</type>, the row number 0
represents the <i>x</i>-values.</p>
*/
diff --git a/offapi/com/sun/star/chart/XChartDocument.idl b/offapi/com/sun/star/chart/XChartDocument.idl
index 05966982b992..14322c6edf4a 100644
--- a/offapi/com/sun/star/chart/XChartDocument.idl
+++ b/offapi/com/sun/star/chart/XChartDocument.idl
@@ -136,20 +136,38 @@ published interface XChartDocument: com::sun::star::frame::XModel
//-------------------------------------------------------------------------
/** @returns
- the data source of the chart.
+ the data of the chart.
- @see ChartData
+ <p>The returned object supports interface <type>XChartDataArray</type>
+ which can be used to access the concrete data.</p>
+
+ <p>Since OOo 3.3 the returned object also supports interface <type>XComplexDescriptionAccess</type>
+ which can be used to access complex hierarchical axis descriptions.</p>
+
+ @see XChartData
+ @see XChartDataArray
+ @see XComplexDescriptionAccess
*/
com::sun::star::chart::XChartData getData();
//-------------------------------------------------------------------------
- /** attaches an external data source to the chart.
+ /** attaches data to the chart.
+
+ <p>The given object needs to support interface <type>XChartDataArray</type>.</p>
+
+ <p>Since OOo 3.3 if the given object might support interface <type>XComplexDescriptionAccess</type>
+ which allows to set complex hierarchical axis descriptions.</p>
+
+ <p>The given data is copied before it is applied to the chart.
+ So changing xData after this call will have no effect on the chart.</p>
- @see ChartData
+ @see XChartData
+ @see XChartDataArray
+ @see XComplexDescriptionAccess
@param xData
- the component that provides the new data.
+ the object that provides the new data.
*/
void attachData( [in] com::sun::star::chart::XChartData xData );
diff --git a/offapi/com/sun/star/chart/XComplexDescriptionAccess.idl b/offapi/com/sun/star/chart/XComplexDescriptionAccess.idl
new file mode 100644
index 000000000000..4e5af5f3ba83
--- /dev/null
+++ b/offapi/com/sun/star/chart/XComplexDescriptionAccess.idl
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * 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
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __com_sun_star_chart_XComplexDescriptionAccess_idl__
+#define __com_sun_star_chart_XComplexDescriptionAccess_idl__
+
+#ifndef __com_sun_star_chart_XChartDataArray_idl__
+#include <com/sun/star/chart/XChartDataArray.idl>
+#endif
+
+//=============================================================================
+
+ module com { module sun { module star { module chart {
+
+//=============================================================================
+
+/** Offers access to complex column and row descriptions.
+
+<p>Can be obtained from interface <type>XChartDocument</type> via method getData().</p>
+
+@since OOo 3.3
+*/
+
+published interface XComplexDescriptionAccess : XChartDataArray
+{
+ //-------------------------------------------------------------------------
+
+ /** retrieves the description texts for all rows.
+
+ @returns
+ a sequence of sequences of strings representing the descriptions
+ of all rows. The outer index represents different rows.
+ The inner index represents the different levels (usually there is only one).
+ */
+ sequence< sequence< string > > getComplexRowDescriptions();
+
+ //-------------------------------------------------------------------------
+
+ /** sets the description texts for all rows.
+
+ @param rRowDescriptions
+ a sequence of sequences of strings representing the descriptions of all
+ rows. The outer index represents different rows.
+ The inner index represents the different levels (usually there is only one).
+ */
+ void setComplexRowDescriptions( [in] sequence< sequence< string > > rRowDescriptions );
+
+ //-------------------------------------------------------------------------
+
+ /** retrieves the description texts for all columns.
+
+ @returns
+ a sequence of sequences of strings representing the descriptions
+ of all columns. The outer index represents different columns.
+ The inner index represents the different levels (usually there is only one).
+ */
+ sequence< sequence< string > > getComplexColumnDescriptions();
+
+ //-------------------------------------------------------------------------
+
+ /** sets the description texts for all columns.
+
+ @param rColumnDescriptions
+ a sequence of sequences of strings which represent the descriptions of
+ all columns. The outer index represents different columns.
+ The inner index represents the different levels (usually there is only one).
+ */
+ void setComplexColumnDescriptions( [in] sequence< sequence< string > > rColumnDescriptions );
+};
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
diff --git a/offapi/com/sun/star/chart/makefile.mk b/offapi/com/sun/star/chart/makefile.mk
index 7e3c01393824..2c0b93256b3b 100644
--- a/offapi/com/sun/star/chart/makefile.mk
+++ b/offapi/com/sun/star/chart/makefile.mk
@@ -103,6 +103,7 @@ IDLFILES=\
XChartDataArray.idl\
XChartDataChangeEventListener.idl\
XChartDocument.idl\
+ XComplexDescriptionAccess.idl\
XDiagram.idl\
XStatisticDisplay.idl\
XTwoAxisXSupplier.idl\
diff --git a/offapi/com/sun/star/chart2/InterpretedData.idl b/offapi/com/sun/star/chart2/InterpretedData.idl
index dfa2b27493ce..0eedd9c44df3 100644
--- a/offapi/com/sun/star/chart2/InterpretedData.idl
+++ b/offapi/com/sun/star/chart2/InterpretedData.idl
@@ -51,10 +51,6 @@ struct InterpretedData
/**
*/
data::XLabeledDataSequence Categories;
-
- /**
- */
- sequence< data::XLabeledDataSequence > UnusedData;
};
} ; // chart2
diff --git a/offapi/com/sun/star/chart2/XChartTypeTemplate.idl b/offapi/com/sun/star/chart2/XChartTypeTemplate.idl
index 5f8947baaed7..05308ba7dfcf 100644
--- a/offapi/com/sun/star/chart2/XChartTypeTemplate.idl
+++ b/offapi/com/sun/star/chart2/XChartTypeTemplate.idl
@@ -78,12 +78,10 @@ interface XChartTypeTemplate : ::com::sun::star::uno::XInterface
[in] data::XDataSource xDataSource,
[in] sequence< com::sun::star::beans::PropertyValue > aArguments );
- /** Return the names of parameters that are interpreted in the
- <member>createDiagramByDataSource</member> method.
-
- @see StandardChartTypeTemplateParameters
+ /** @return
+ <TRUE/> if the template does support categories
*/
- sequence< string > getAvailableCreationParameterNames();
+ boolean supportsCategories();
/** Analyses the given diagram and reinterprets its
<type>DataSeries</type> and <type>Categories</type> and
diff --git a/offapi/com/sun/star/chart2/XDataInterpreter.idl b/offapi/com/sun/star/chart2/XDataInterpreter.idl
index d6cd1b19ee50..14238dc531a5 100644
--- a/offapi/com/sun/star/chart2/XDataInterpreter.idl
+++ b/offapi/com/sun/star/chart2/XDataInterpreter.idl
@@ -74,10 +74,6 @@ interface XDataInterpreter : ::com::sun::star::uno::XInterface
/** Re-interprets the data given in <code>aInterpretedData</code>
while keeping the number of data series and the categories.
-
- <p>the data passed in
- <member>InterpretedData::UnusedData</member> may be used to be
- added to existing <type>DataSeries</type>.</p>
*/
InterpretedData reinterpretDataSeries( [in] InterpretedData aInterpretedData );
@@ -85,11 +81,6 @@ interface XDataInterpreter : ::com::sun::star::uno::XInterface
<member>reinterpretDataSeries</member> call can be done
without data loss.
- <p>if this method returns <TRUE/>, a call to
- <member>reinterpretDataSeries</member> should leave the
- <member>InterpretedData::UnusedData</member> list
- untouched.</p>
-
@return
<TRUE/>, if the data given in
<code>aInterpretedData</code> has a similar structure than
diff --git a/offapi/com/sun/star/chart2/XDiagram.idl b/offapi/com/sun/star/chart2/XDiagram.idl
index c38f8b0824f7..3836489b7aed 100644
--- a/offapi/com/sun/star/chart2/XDiagram.idl
+++ b/offapi/com/sun/star/chart2/XDiagram.idl
@@ -87,10 +87,6 @@ interface XDiagram : ::com::sun::star::uno::XInterface
colors for data series (or data points) in the diagram.
*/
void setDefaultColorScheme( [in] XColorScheme xColorScheme );
-
- void setUnusedData( [in] sequence< data::XLabeledDataSequence > aUnusedData );
-
- sequence< data::XLabeledDataSequence > getUnusedData();
};
} ; // chart2
diff --git a/offapi/com/sun/star/chart2/XInternalDataProvider.idl b/offapi/com/sun/star/chart2/XInternalDataProvider.idl
index 5504e7f79abe..a1f9caa64092 100644
--- a/offapi/com/sun/star/chart2/XInternalDataProvider.idl
+++ b/offapi/com/sun/star/chart2/XInternalDataProvider.idl
@@ -39,7 +39,7 @@ module star
module chart2
{
-/** An internal DataProvider that has more access to data that a plain
+/** An internal DataProvider that has more access to data than a plain
DataProvider.
*/
interface XInternalDataProvider : com::sun::star::chart2::data::XDataProvider
@@ -73,6 +73,17 @@ interface XInternalDataProvider : com::sun::star::chart2::data::XDataProvider
it has to be explicitly registered via this method.</p>
*/
void registerDataSequenceForChanges( [in] data::XDataSequence xSeq );
+
+ /** insert an additional sequence for categories nLevel>=1;
+ categories at level 0 are always present and cannot be inserted or deleted
+ @since OOo 3.3
+ */
+ void insertComplexCategoryLevel( [in] long nLevel );
+ /** deletes an additional sequence for categories at nLevel>=1;
+ categories at level 0 are always present and cannot be deleted
+ @since OOo 3.3
+ */
+ void deleteComplexCategoryLevel( [in] long nLevel );
};
} ; // chart2
diff --git a/offapi/com/sun/star/chart2/data/XDataReceiver.idl b/offapi/com/sun/star/chart2/data/XDataReceiver.idl
index fa8cd9823c00..10602cee2f34 100644
--- a/offapi/com/sun/star/chart2/data/XDataReceiver.idl
+++ b/offapi/com/sun/star/chart2/data/XDataReceiver.idl
@@ -73,24 +73,6 @@ interface XDataReceiver : ::com::sun::star::uno::XInterface
*/
void attachDataProvider( [in] XDataProvider xProvider );
- /** Sets the data for the chart as a whole. When this method is
- called, all currently set data is removed. It is replaced by
- the data that is returned by the current
- <type>XDataProvider</type> by using the given range
- representation.
-
- @param aRangeRepresentation
- This range representation must be in a format that is
- understood by the currently attached
- <type>XDataProvider</type>.
-
- @throws com::sun::star::lang::IllegalArgumentException
- If the range representation could not dealt with by the
- current data provider, or there is currently no data
- provider at all.
- */
-// void setRangeRepresentation( [in] string aRangeRepresentation )
-// raises( com::sun::star::lang::IllegalArgumentException );
void setArguments( [in] sequence< com::sun::star::beans::PropertyValue > aArguments )
raises( com::sun::star::lang::IllegalArgumentException );
diff --git a/offapi/com/sun/star/configuration/ConfigurationRegistry.idl b/offapi/com/sun/star/configuration/ConfigurationRegistry.idl
index c3b98b115a52..870af90e7986 100644
--- a/offapi/com/sun/star/configuration/ConfigurationRegistry.idl
+++ b/offapi/com/sun/star/configuration/ConfigurationRegistry.idl
@@ -43,6 +43,10 @@ module com { module sun { module star { module configuration {
/* provides access to a configuration tree as a registry.
+ <p>This service is deprecated,
+ <type scope="com.sun.star.configuration">ConfigurationProvider</type> should
+ be used instead.</p>
+
<p> Using the <type scope="com::sun::star::registry">XSimpleRegistry</type>
interface, the service can be bound to a subtree within the
configuration tree, as provided by an
diff --git a/offapi/com/sun/star/deployment/LicenseException.idl b/offapi/com/sun/star/deployment/LicenseException.idl
index ac4396f6db43..4d3996da191b 100644
--- a/offapi/com/sun/star/deployment/LicenseException.idl
+++ b/offapi/com/sun/star/deployment/LicenseException.idl
@@ -47,6 +47,14 @@ exception LicenseException : com::sun::star::uno::Exception
/** contains the text of the license.
*/
string Text;
+
+ /** indicates if the user can prevent to show the license
+
+ Represents the attribute value
+ /description/registration/simple-license/@suppress-if-required
+ from the description.xml
+ */
+ boolean SuppressIfRequired;
};
}; }; }; };
diff --git a/offapi/com/sun/star/deployment/LicenseIndividualAgreementException.idl b/offapi/com/sun/star/deployment/LicenseIndividualAgreementException.idl
index 67b82664c03d..4239d14f075f 100644
--- a/offapi/com/sun/star/deployment/LicenseIndividualAgreementException.idl
+++ b/offapi/com/sun/star/deployment/LicenseIndividualAgreementException.idl
@@ -45,6 +45,13 @@ exception LicenseIndividualAgreementException : com::sun::star::uno::Exception
Contains the file name only.
*/
string ExtensionName;
+ /** indicates if the user can prevent to show the license
+
+ Represents the attribute value
+ /description/registration/simple-license/@suppress-if-required
+ from the description.xml
+ */
+ boolean SuppressIfRequired;
};
}; }; }; };
diff --git a/offapi/com/sun/star/document/XDocumentRecovery.idl b/offapi/com/sun/star/document/XDocumentRecovery.idl
new file mode 100644
index 000000000000..e5bf521d07f0
--- /dev/null
+++ b/offapi/com/sun/star/document/XDocumentRecovery.idl
@@ -0,0 +1,127 @@
+/*************************************************************************
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2009 by Sun Microsystems, Inc.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+************************************************************************/
+
+#ifndef __offapcom_sun_star_document_XDocumentRecovery_idl__
+#define __offapcom_sun_star_document_XDocumentRecovery_idl__
+
+#include <com/sun/star/beans/PropertyValue.idl>
+#include <com/sun/star/io/IOException.idl>
+#include <com/sun/star/lang/WrappedTargetException.idl>
+
+//=============================================================================
+
+module com { module sun { module star { module document {
+
+//=============================================================================
+
+/** is the interface to be implemented by documents who wish to participate in
+ the document emergency-save / recovery process.
+ */
+interface XDocumentRecovery
+{
+ /** determines whether the document has been modified since the last call to <member>storeToRecoveryFile</member>.
+
+ <p>If <code>storeToRecoveryFile</code> has not been called before, this method returns whether the document
+ has been modified since it has been loaded respectively created.</p>
+
+ <p>When saving a session, either in case of a emergency (when OpenOffice.org crashed), or during a
+ periodic session save as configured by the user, <member>storeToRecoveryFile</member> is called for every
+ document where <code>wasModifiedSinceLastSave</code> returns <TRUE/>.</p>
+
+ <p>It's allowed to implement this method sloppy, by returning <TRUE/> in cases where it is not sure whether
+ the document actually has been modified. So, the most simple implementation could simply delegate this call
+ to <member scope="com::sun::star::util">XModifiable::isModified</member>. (Well, actually that's the
+ second simple implementation, the <em>most</em> simple one would, still egitimately, always return <TRUE/>.)</p>
+
+ <p>However, in such a case, the document might be saved more often than needed. In particular during the
+ periodic session save, this might become a problem when saving is expensive, for a single document
+ or the sum of all open documents.</p>
+ */
+ boolean wasModifiedSinceLastSave();
+
+ /** does an emergency save of the document
+
+ <p>A default implementation of this method could simply delegate this call to
+ <member scope="com::sun::star::frame">XStorable::storeToURL</member>.</p>
+
+ @param TargetLocation
+ specifies the URL of the location to which the document should be emergency-saved.
+
+ @param MediaDescriptor
+ contains additional arguments for the save process, for instance an StatusIndicator.
+
+ @see MediaDescriptor
+ */
+ void storeToRecoveryFile(
+ [in] string TargetLocation,
+ [in] sequence< ::com::sun::star::beans::PropertyValue > MediaDescriptor
+ )
+ raises ( ::com::sun::star::io::IOException,
+ ::com::sun::star::lang::WrappedTargetException
+ );
+
+ /** recovers the document after a previous emergency or session save.
+
+ <p>The document itself has previously been created, but <em>not</em> loaded
+ (via <member scope="com::sun::star::frame">XLoadable::load</member>) or initialized (via
+ <member scope="com::sun::star::frame">XLoadable::initNew</member>).</p>
+
+ <p>Upon successful return, the document must be fully initialized. In particular, the
+ caller is not responsible for calling <member scope="com::sun::star::frame">XModel::attachResource</member>.
+ Instead, the implementation is responsible to do so, if required.</p>
+
+ <p>A default implementation of this method could simply delegate this call to
+ <member scope="::com::sun::star::frame:">XLodable::load</member>, followed by
+ <member scope="com::sun::star::frame">XModel::attachResource</member>.</p>
+
+ @param SourceLocation
+ specifies the URL of the location to which the document was previously emergency-saved.
+
+ @param SalvagedFile
+ specifies the original URL of the file which had been emergency-saved. If this is empty,
+ then the file should be recovered from its original location.
+
+ @param MediaDescriptor
+ contains additional arguments for the load process, for instance an StatusIndicator.
+
+ @see MediaDescriptor
+ */
+ void recoverFromFile(
+ [in] string SourceLocation,
+ [in] string SalvagedFile,
+ [in] sequence< ::com::sun::star::beans::PropertyValue > MediaDescriptor
+ )
+ raises ( ::com::sun::star::io::IOException,
+ ::com::sun::star::lang::WrappedTargetException
+ );
+};
+
+//=============================================================================
+
+}; }; }; };
+
+//=============================================================================
+
+#endif
diff --git a/offapi/com/sun/star/document/makefile.mk b/offapi/com/sun/star/document/makefile.mk
index 2d9b6211af4e..48394a65008c 100644
--- a/offapi/com/sun/star/document/makefile.mk
+++ b/offapi/com/sun/star/document/makefile.mk
@@ -83,6 +83,7 @@ IDLFILES=\
XDocumentInsertable.idl\
XDocumentProperties.idl\
XDocumentPropertiesSupplier.idl\
+ XDocumentRecovery.idl\
XDocumentSubStorageSupplier.idl\
XEmbeddedObjectResolver.idl\
XEmbeddedObjectSupplier.idl\
diff --git a/offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl b/offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl
index c8baeb14a54b..733db10e61b1 100644
--- a/offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl
+++ b/offapi/com/sun/star/embed/EmbeddedObjectDescriptor.idl
@@ -51,6 +51,8 @@
#include <com/sun/star/frame/XDispatchProviderInterceptor.idl>
#endif
+#include <com/sun/star/embed/XStorage.idl>
+
//============================================================================
module com { module sun { module star { module embed {
@@ -89,6 +91,19 @@ service EmbeddedObjectDescriptor
[optional,property] ::com::sun::star::frame::XDispatchProviderInterceptor
OutplaceDispatchInterceptor;
+ /** denotes the storage from which the embedded object is to be recovered.
+
+ <p>Upon activating the embedded object, it is normally loaded from a storage as denoted by
+ the parameters to the <type>XEmbedObjectCreator</type> method calls.</p>
+
+ <p>You can pass a non-<NULL/> <code>RecoveryStorage</code> in the object descriptor if you wish to load the
+ embedded object from an alternate storage.</p>
+
+ <p>The object will still be based on the storage denoted in the <code>XEmbedObjectCreator</code> method
+ call, i.e., subsequent save operations will still use that storage. <code>RecoveryStorage</code> is used
+ at loading time only, and then discarded.</p>
+ */
+ [optional, property] XStorage RecoveryStorage;
};
//============================================================================
diff --git a/offapi/com/sun/star/frame/XController2.idl b/offapi/com/sun/star/frame/XController2.idl
index b1e92ff63823..2c0157d99309 100644
--- a/offapi/com/sun/star/frame/XController2.idl
+++ b/offapi/com/sun/star/frame/XController2.idl
@@ -29,6 +29,7 @@
#include <com/sun/star/frame/XController.idl>
#include <com/sun/star/awt/XWindow.idl>
+#include <com/sun/star/beans/PropertyValue.idl>
//=============================================================================
@@ -58,6 +59,16 @@ interface XController2 : XController
- if it's passed there, a view/controller pair of the same type will be created.</p>
*/
[readonly, attribute] string ViewControllerName;
+
+ /** denotes the arguments used to create the instance.
+
+ <p>Usually, controllers are created via <member>XModel2::createViewController</member>, where the
+ caller can pass not only a controller name, but also arguments parametrizing the to-be-created instance.
+ Those arguments used at creation time can subsequently be retrieved using the <code>CreationArguments</code>
+ member.</p>
+ */
+ [readonly, attribute] sequence< ::com::sun::star::beans::PropertyValue >
+ CreationArguments;
};
//=============================================================================
diff --git a/offapi/com/sun/star/report/XReportDefinition.idl b/offapi/com/sun/star/report/XReportDefinition.idl
index 199737ab8c6d..9af58a8d702e 100644
--- a/offapi/com/sun/star/report/XReportDefinition.idl
+++ b/offapi/com/sun/star/report/XReportDefinition.idl
@@ -72,8 +72,8 @@
#ifndef __com_sun_star_awt_Size_idl__
#include <com/sun/star/awt/Size.idl>
#endif
-#ifndef __com_sun_star_util_XModifiable_idl__
-#include <com/sun/star/util/XModifiable.idl>
+#ifndef __com_sun_star_util_XModifiable2_idl__
+#include <com/sun/star/util/XModifiable2.idl>
#endif
#ifndef __com_sun_star_document_XEventBroadcaster_idl__
#include <com/sun/star/document/XEventBroadcaster.idl>
@@ -155,7 +155,7 @@ interface XReportDefinition
of the document without saving any changes.
</p>
*/
- interface com::sun::star::util::XModifiable;
+ interface com::sun::star::util::XModifiable2;
/** allows the creation of sub reports.
*/
diff --git a/offapi/com/sun/star/sdb/DatabaseInteractionHandler.idl b/offapi/com/sun/star/sdb/DatabaseInteractionHandler.idl
new file mode 100644
index 000000000000..891929514826
--- /dev/null
+++ b/offapi/com/sun/star/sdb/DatabaseInteractionHandler.idl
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * 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: InteractionHandler.idl,v $
+ * $Revision: 1.12 $
+ *
+ * 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
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __com_sun_star_sdb_InteractionHandler_idl__
+#define __com_sun_star_sdb_InteractionHandler_idl__
+
+module com { module sun { module star { module task {
+ interface XInteractionHandler2;
+}; }; }; };
+
+module com { module sun { module star { module sdb {
+
+/** describes a service which is able to handle database-related interactions.
+
+ <p>Usually, you will not instantiate this service directly. Instead, you'll instantiate a generic
+ <type scope="com::sun::star::task">InteractionHandler</type> service, and pass it your request. Based on
+ configuration data, this implementation will decide where to forward the request to.</p>
+
+ <p>By default, the <code>DatabaseInteractionHandler</code> feels responsible (as per configuration) for the
+ following interaction types:
+ <ul>
+ <li><b>database related errors</b><br/>
+ The general structure to transport such errors is the <type scope="com::sun::star::sdbc">SQLException</type>,
+ and if your interaction request supplies such a <code>SQLException</code> (or an instance of any derived class),
+ the handler will display a generic error dialog, which is able to travel the object chain which may be contained
+ in the exception.
+ </li>
+ <li><b>parameter requests</b><br/>
+ If your interaction request supplies an <type scope="com::sun::star::sdb">ParametersRequest</type>,
+ the handler will open a standard dialog asking the user to fill in parameter values.
+ <br/>
+ In the case you want to use this feature of the handler, you should supply a special continuation
+ (<type scope="com::sun::star::sdb">XInteractionSupplyParameters</type>) as well, so the
+ handler can return the entered information.
+ </li>
+ </ul>
+ </p>
+*/
+service DatabaseInteractionHandler: com::sun::star::task::XInteractionHandler2;
+
+//=============================================================================
+
+}; }; }; };
+
+#endif
diff --git a/offapi/com/sun/star/sdb/DefinitionContent.idl b/offapi/com/sun/star/sdb/DefinitionContent.idl
index 9538174ba3c3..d5ce22d9ff09 100644
--- a/offapi/com/sun/star/sdb/DefinitionContent.idl
+++ b/offapi/com/sun/star/sdb/DefinitionContent.idl
@@ -27,9 +27,8 @@
#ifndef __com_sun_star_sdb_DefinitionContent_idl__
#define __com_sun_star_sdb_DefinitionContent_idl__
-#ifndef __com_sun_star_ucb_Content_idl__
#include <com/sun/star/ucb/Content.idl>
-#endif
+#include <com/sun/star/container/XHierarchicalName.idl>
//=============================================================================
@@ -60,6 +59,11 @@ service DefinitionContent
<p>Additional commands might be supported by derived services.</p>
*/
service ::com::sun::star::ucb::Content;
+
+ /** provides access to the complete name of the content within its hierarchy
+ @since OOo 3.3
+ */
+ interface ::com::sun::star::container::XHierarchicalName;
};
//=============================================================================
diff --git a/offapi/com/sun/star/sdb/DocumentDefinition.idl b/offapi/com/sun/star/sdb/DocumentDefinition.idl
index 29157d1cc9c7..c8f07fb69a18 100644
--- a/offapi/com/sun/star/sdb/DocumentDefinition.idl
+++ b/offapi/com/sun/star/sdb/DocumentDefinition.idl
@@ -71,6 +71,12 @@ service DocumentDefinition
the sub document could be closed. Reasons for not closing the document include vetos by
third parties, for instance, because the user opened a dialog modal to the sub document,
or a long-running task such as printing is currently running.</li>
+ <li><strong>show</strong>: shows the sub document. This is useful if you previously opened the
+ document hidden, or if you previously hide it using the <em>hide</em> command.<br/>
+ The <em>open</em> command is not available if the sub document has not been loaded, yet.</li>
+ <li><strong>hide</strong>: hides the sub document. In opposite to the <em>close</em> command,
+ only the document window is hidden, but the document is kept loaded. A subsequent execution
+ of the <em>show</em> command will show the window, again.</li>
</ul>
*/
service DefinitionContent;
diff --git a/offapi/com/sun/star/sdb/InteractionHandler.idl b/offapi/com/sun/star/sdb/InteractionHandler.idl
index 203cfef2008d..e76ef3d66f34 100644
--- a/offapi/com/sun/star/sdb/InteractionHandler.idl
+++ b/offapi/com/sun/star/sdb/InteractionHandler.idl
@@ -34,56 +34,11 @@ module com { module sun { module star { module task {
module com { module sun { module star { module sdb {
/** is a service for user interaction for databases.
- <p>
- interaction requests that the handler can provide are:
- <ul>
- <li><b>database related errors</b><br/>
- The general structure to transport such errors is the
- <type scope="com::sun::star::sdbc">SQLException</type>
- , and if your
- <type scope="com::sun::star::task">XInteractionRequest</type>
- supplies such a
- <type scope="com::sun::star::sdbc">SQLException</type>
- (or an instance of any derived class),
- the handler will display a generic error dialog, which is able
- to travel the object chain which may be contained in the exception.
- </li>
- <li><b>authentication</b><br/>
- If your
- <type scope="com::sun::star::task">XInteractionRequest</type>
- (see
- <member scope="com::sun::star::task">XInteractionHandler::handle()</member>
- ) supplies a
- <type scope="com::sun::star::ucb">AuthenticationRequest</type>
- , the handler will open a standard login
- dialog to allow user authentication.
- <br/>
- Besides the using the members of the AuthenticationRequest in the usual manner, the member <em>Server</em>
- (if not empty) is interpreted as datasource name, thus leading to a slightly different message when
- requesting the user to enter it's login data.
- <br/>
- In the case you want to use this authentication feature, you should supply a special authentication
- continuation (
- <type scope="com::sun::star::ucb">XInteractionSupplyAuthentication</type>
- ) as well, so the
- handler can return to you, the entered information.
- </li>
- <li><b>parameter requests</b><br/>
- If your
- <type scope="com::sun::star::task">XInteractionRequest</type>
- supplies an
- <type scope="com::sun::star::sdb">ParametersRequest</type>
- , the handler will open a standard dialog asking
- the user to fill in parameter values.
- <br/>
- In the case you want to use this feature of the handler, you should supply a special continuation
- (
- <type scope="com::sun::star::sdb">XInteractionSupplyParameters</type>
- ) as well, so the
- handler can return to you, the entered information.
- </li>
- </ul>
- </p>
+ @deprecated
+ Do not use this service anymore. Instead, create a generic <type scope="com::sun::star::task">InteractionHandler</type>
+ instance, and pass it your request. It will determine, based on configuration data, which concrete interaction
+ handler implementation to use for a specific request. In particular, requests formerly server by this service here
+ are by default passed to a <type>DatabaseInteractionHandler</type>.
*/
published service InteractionHandler: com::sun::star::task::XInteractionHandler;
diff --git a/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl b/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl
index e5d72c066bdf..7c14255045e1 100644
--- a/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl
+++ b/offapi/com/sun/star/sdb/application/XDatabaseDocumentUI.idl
@@ -28,30 +28,15 @@
#ifndef __com_sun_star_sdb_application_XDatabaseDocumentUI_idl__
#define __com_sun_star_sdb_application_XDatabaseDocumentUI_idl__
-#ifndef __com_sun_star_sdbc_XDataSource_idl__
#include <com/sun/star/sdbc/XDataSource.idl>
-#endif
-#ifndef __com_sun_star_sdbc_SQLException_idl__
#include <com/sun/star/sdbc/SQLException.idl>
-#endif
-#ifndef __com_sun_star_sdbc_XConnection_idl__
#include <com/sun/star/sdbc/XConnection.idl>
-#endif
-#ifndef __com_sun_star_awt_XWindow_idl__
#include <com/sun/star/awt/XWindow.idl>
-#endif
-#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
#include <com/sun/star/lang/IllegalArgumentException.idl>
-#endif
-#ifndef __com_sun_star_container_NoSuchElementException_idl__
#include <com/sun/star/container/NoSuchElementException.idl>
-#endif
-#ifndef __com_sun_star_lang_XComponent_idl__
#include <com/sun/star/lang/XComponent.idl>
-#endif
-#ifndef __com_sun_star_beans_PropertyValue_idl__
#include <com/sun/star/beans/PropertyValue.idl>
-#endif
+#include <com/sun/star/beans/Pair.idl>
//=============================================================================
@@ -133,6 +118,29 @@ interface XDatabaseDocumentUI
[attribute, readonly] sequence< ::com::sun::star::lang::XComponent >
SubComponents;
+ /** identifies the given sub component
+
+ @param SubComponent
+ the component to identify. Must be one of the components in <member>SubComponents</member>.
+
+ @return
+ a record describing the sub component. The first element of the returned pair is the type
+ of the component, denoted by one of the <type>DatabaseObject</type> constants. The second
+ element is the name of the component. For object types which support nested structures (forms
+ and reports, actually), this might be a hierachical name. If the sub component has been newly created,
+ and not yet saved, this name is empty.
+
+ @throws ::com::sun::star::lang::IllegalArgumentException
+ if the given component is not one of the controller's sub components
+ */
+ ::com::sun::star::beans::Pair< long, string >
+ identifySubComponent(
+ [in] ::com::sun::star::lang::XComponent SubComponent
+ )
+ raises (
+ ::com::sun::star::lang::IllegalArgumentException
+ );
+
/** closes all sub components of the database document.
<p>During working with the database, the user might open different sub components:
@@ -264,6 +272,52 @@ interface XDatabaseDocumentUI
raises ( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::sdbc::SQLException );
+
+ /** creates a new sub component of the given type
+
+ @param ObjectType
+ specifies the type of the object, must be one of the <type>DatabaseObject</type>
+ constants.
+
+ @param DocumentDefinition
+ Upon successful return, and if and only if <arg>ObjectType</arg> equals <member>DatabaseObject::FORM</member>
+ or <member>DatabaseObject::REPORT</member>, this will contain the <type scope="com::sun::star::sdb">DocumentDefinition</type>
+ object which controls the sub component.
+ */
+ ::com::sun::star::lang::XComponent createComponent(
+ [in] long ObjectType,
+ [out] ::com::sun::star::lang::XComponent DocumentDefinition )
+ raises ( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::sdbc::SQLException );
+
+ /** creates a new sub component of the given type
+
+ <p>In opposite to <member>createComponent</member>, this method allows you to specify
+ additional arguments which are passed to the to-be-loaded component.</p>
+
+ <p>The meaning of the the arguments is defined at the service which is effectively
+ created. See the <a href="#component_types">above table</a> for a list of those
+ services.</p>
+
+ @param ObjectType
+ specifies the type of the object, must be one of the <type>DatabaseObject</type>
+ constants.
+
+ @param DocumentDefinition
+ Upon successful return, and if and only if <arg>ObjectType</arg> equals <member>DatabaseObject::FORM</member>
+ or <member>DatabaseObject::REPORT</member>, this will contain the <type scope="com::sun::star::sdb">DocumentDefinition</type>
+ object which controls the sub component.<br/>
+ You can use this object to control various aspects of the sub component. For instance, you could decide
+ to create the component hidden, by passing a <code>Hidden</code> flag (set to <TRUE/>) in <arg>Arguments</arg>,
+ manipulate the component, and then finally show it by invoking the <code>show</code> command at the
+ definition object.
+ */
+ ::com::sun::star::lang::XComponent createComponentWithArguments(
+ [in] long ObjectType,
+ [in] sequence< ::com::sun::star::beans::PropertyValue > Arguments,
+ [out] ::com::sun::star::lang::XComponent DocumentDefinition )
+ raises ( ::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::sdbc::SQLException );
};
//=============================================================================
diff --git a/offapi/com/sun/star/sdb/makefile.mk b/offapi/com/sun/star/sdb/makefile.mk
index 03aa5a2460c9..975bf03e7712 100644
--- a/offapi/com/sun/star/sdb/makefile.mk
+++ b/offapi/com/sun/star/sdb/makefile.mk
@@ -58,6 +58,7 @@ IDLFILES=\
DatabaseContext.idl \
DatabaseDocument.idl \
DatabaseEnvironment.idl \
+ DatabaseInteractionHandler.idl \
DatabaseRegistrationEvent.idl \
DataColumn.idl \
DataSettings.idl \
diff --git a/offapi/com/sun/star/sdb/tools/XConnectionSupplier.idl b/offapi/com/sun/star/sdb/tools/XConnectionSupplier.idl
new file mode 100644
index 000000000000..c0ec570ccf60
--- /dev/null
+++ b/offapi/com/sun/star/sdb/tools/XConnectionSupplier.idl
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * 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: XConnectionSupplier.idl,v $
+ * $Revision: 1.3 $
+ *
+ * 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
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_sdb_tools_XConnectionSupplier_idl__
+#define __com_sun_star_sdb_tools_XConnectionSupplier_idl__
+
+#include <com/sun/star/sdbc/XConnection.idl>
+#ifndef __com_sun_star_lang_XInitialization_idl__
+#include <com/sun/star/lang/XInitialization.idl>
+#endif
+#ifndef __com_sun_star_beans_XPropertySet_idl__
+#include <com/sun/star/beans/XPropertySet.idl>
+#endif
+
+//=============================================================================
+module com { module sun { module star { module sdb { module tools {
+//=============================================================================
+
+//-----------------------------------------------------------------------------
+/** allows to access the active connection
+
+ @see com::sun::star::sdbcx::XConnection
+
+ @since OOo 3.3
+*/
+interface XConnectionSupplier
+{
+ /** returns the source connection.
+ */
+ [attribute, readonly] com::sun::star::sdbc::XConnection ActiveConnection;
+
+ interface com::sun::star::lang::XInitialization;
+
+};
+//=============================================================================
+}; }; }; }; };
+//=============================================================================
+
+#endif
+
diff --git a/offapi/com/sun/star/sdb/tools/XIndexAlteration.idl b/offapi/com/sun/star/sdb/tools/XIndexAlteration.idl
new file mode 100644
index 000000000000..fdc7ce517ca8
--- /dev/null
+++ b/offapi/com/sun/star/sdb/tools/XIndexAlteration.idl
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * 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: XIndexAlteration.idl,v $
+ * $Revision: 1.3 $
+ *
+ * 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
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_sdb_tools_XIndexAlteration_idl__
+#define __com_sun_star_sdb_tools_XIndexAlteration_idl__
+
+#ifndef __com_sun_star_sdbc_SQLException_idl__
+#include <com/sun/star/sdbc/SQLException.idl>
+#endif
+#include <com/sun/star/sdb/tools/XConnectionSupplier.idl>
+#ifndef __com_sun_star_lang_XInitialization_idl__
+#include <com/sun/star/lang/XInitialization.idl>
+#endif
+#ifndef __com_sun_star_beans_XPropertySet_idl__
+#include <com/sun/star/beans/XPropertySet.idl>
+#endif
+
+//=============================================================================
+module com { module sun { module star { module sdb { module tools {
+//=============================================================================
+
+//-----------------------------------------------------------------------------
+/** allows to alter the indexes of a table.
+
+ @see com::sun::star::sdb::DataSource::Settings
+ @see com::sun::star::sdbcx::XAppend
+ @see com::sun::star::sdbcx::XDrop
+
+ @since OOo 3.3
+*/
+interface XIndexAlteration
+{
+ interface XConnectionSupplier;
+
+ /** drops an object of the related container identified by its name.
+ @param table
+ the table to be altered
+ @param index
+ the name of the column to be dropped
+ @throws com::sun::star::sdbc::SQLException
+ if a database access error occurs.
+ */
+ void dropIndex([in] com::sun::star::beans::XPropertySet table,[in] string index)
+ raises ( com::sun::star::sdbc::SQLException);
+
+ /** creates a new object using the given descriptor and appends it
+ to the related container.
+ <b>
+ Note:
+ </b>
+ The descriptor will not be changed and can be used again to append another object.
+ @param table
+ the table to be altered
+ @param descriptor
+ the descriptor which should be serve to append a new object
+ @throws com::sun::star::sdbc::SQLException
+ if a database access error occurs.
+ */
+ void addIndex([in] com::sun::star::beans::XPropertySet table,[in]com::sun::star::beans::XPropertySet descriptor)
+ raises (com::sun::star::sdbc::SQLException);
+
+
+};
+//=============================================================================
+}; }; }; }; };
+//=============================================================================
+
+#endif
+
diff --git a/offapi/com/sun/star/sdb/tools/XKeyAlteration.idl b/offapi/com/sun/star/sdb/tools/XKeyAlteration.idl
new file mode 100644
index 000000000000..44389dfe64fd
--- /dev/null
+++ b/offapi/com/sun/star/sdb/tools/XKeyAlteration.idl
@@ -0,0 +1,96 @@
+/*************************************************************************
+ *
+ * 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: XKeyAlteration.idl,v $
+ * $Revision: 1.3 $
+ *
+ * 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
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_sdb_tools_XKeyAlteration_idl__
+#define __com_sun_star_sdb_tools_XKeyAlteration_idl__
+
+#ifndef __com_sun_star_sdbc_SQLException_idl__
+#include <com/sun/star/sdbc/SQLException.idl>
+#endif
+#include <com/sun/star/sdb/tools/XConnectionSupplier.idl>
+#ifndef __com_sun_star_lang_XInitialization_idl__
+#include <com/sun/star/lang/XInitialization.idl>
+#endif
+#ifndef __com_sun_star_beans_XPropertySet_idl__
+#include <com/sun/star/beans/XPropertySet.idl>
+#endif
+
+//=============================================================================
+module com { module sun { module star { module sdb { module tools {
+//=============================================================================
+
+//-----------------------------------------------------------------------------
+/** allows to alter the keys of a table.
+
+ @see com::sun::star::sdb::DataSource::Settings
+ @see com::sun::star::sdbcx::XAppend
+ @see com::sun::star::sdbcx::XDrop
+
+ @since OOo 3.3
+*/
+interface XKeyAlteration
+{
+ interface XConnectionSupplier;
+
+ /** drops an object of the related container identified by its name.
+ @param table
+ the table to be altered
+ @param key
+ the key to be dropped
+ @throws com::sun::star::sdbc::SQLException
+ if a database access error occurs.
+ */
+ void dropKey([in] com::sun::star::beans::XPropertySet table,[in] com::sun::star::beans::XPropertySet key)
+ raises ( com::sun::star::sdbc::SQLException);
+
+ /** creates a new object using the given descriptor and appends it
+ to the related container.
+ <b>
+ Note:
+ </b>
+ The descriptor will not be changed and can be used again to append another object.
+ @param table
+ the table to be altered
+ @param descriptor
+ the descriptor which should be serve to append a new object
+ @throws com::sun::star::sdbc::SQLException
+ if a database access error occurs.
+ */
+ void addKey([in] com::sun::star::beans::XPropertySet table,[in]com::sun::star::beans::XPropertySet descriptor)
+ raises (com::sun::star::sdbc::SQLException);
+
+
+};
+//=============================================================================
+}; }; }; }; };
+//=============================================================================
+
+#endif
+
diff --git a/offapi/com/sun/star/sdb/tools/XTableAlteration.idl b/offapi/com/sun/star/sdb/tools/XTableAlteration.idl
new file mode 100644
index 000000000000..fe0fe494fead
--- /dev/null
+++ b/offapi/com/sun/star/sdb/tools/XTableAlteration.idl
@@ -0,0 +1,115 @@
+/*************************************************************************
+ *
+ * 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: XTableAlteration.idl,v $
+ * $Revision: 1.3 $
+ *
+ * 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
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_sdb_tools_XTableAlteration_idl__
+#define __com_sun_star_sdb_tools_XTableAlteration_idl__
+
+#ifndef __com_sun_star_sdbc_SQLException_idl__
+#include <com/sun/star/sdbc/SQLException.idl>
+#endif
+#include <com/sun/star/sdb/tools/XConnectionSupplier.idl>
+#ifndef __com_sun_star_lang_XInitialization_idl__
+#include <com/sun/star/lang/XInitialization.idl>
+#endif
+#ifndef __com_sun_star_beans_XPropertySet_idl__
+#include <com/sun/star/beans/XPropertySet.idl>
+#endif
+
+//=============================================================================
+module com { module sun { module star { module sdb { module tools {
+//=============================================================================
+
+//-----------------------------------------------------------------------------
+/** allows to alter a table.
+
+ @see com::sun::star::sdb::DataSource::Settings
+ @see com::sun::star::sdbcx::ColumnDescriptor
+ @see com::sun::star::sdbcx::XAlterTable
+ @see com::sun::star::sdbcx::XAppend
+ @see com::sun::star::sdbcx::XDrop
+
+ @since OOo 3.3
+*/
+interface XTableAlteration
+{
+ interface XConnectionSupplier;
+
+ /** alter the column defined by name
+
+ @param table
+ the table to be altered
+
+ @param columnName
+ the name of the column to be changed
+
+ @param columnDescriptor
+ the column descriptor with the information of the new column definition
+
+ @throws com::sun::star::sdbc::SQLException
+ @see com::sun::star::sdbcx::XAlterTable
+ */
+ void alterColumnByName( [in] com::sun::star::beans::XPropertySet table, [in] string columnName, [in] com::sun::star::beans::XPropertySet columnDescriptor)
+ raises ( com::sun::star::sdbc::SQLException );
+
+ /** creates a new object using the given descriptor and appends it
+ to the related container.
+ <b>
+ Note:
+ </b>
+ The descriptor will not be changed and can be used again to append another object.
+ @param table
+ the table to be altered
+ @param descriptor
+ the descriptor which should be serve to append a new object
+ @throws com::sun::star::sdbc::SQLException
+ if a database access error occurs.
+ @see com::sun::star::sdbcx::XAppend
+ */
+ void addColumn([in] com::sun::star::beans::XPropertySet table,[in]com::sun::star::beans::XPropertySet descriptor)
+ raises (com::sun::star::sdbc::SQLException);
+
+ /** drops an object of the related container identified by its name.
+ @param table
+ the table to be altered
+ @param columnName
+ the name of the column to be dropped
+ @throws com::sun::star::sdbc::SQLException
+ if a database access error occurs.
+ @see com::sun::star::sdbcx::XDrop
+ */
+ void dropColumn([in] com::sun::star::beans::XPropertySet table,[in]string columnName)
+ raises ( com::sun::star::sdbc::SQLException);
+};
+//=============================================================================
+}; }; }; }; };
+//=============================================================================
+
+#endif
+
diff --git a/offapi/com/sun/star/sdb/tools/XTableRename.idl b/offapi/com/sun/star/sdb/tools/XTableRename.idl
new file mode 100644
index 000000000000..f61d736bae8c
--- /dev/null
+++ b/offapi/com/sun/star/sdb/tools/XTableRename.idl
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * 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: XTableRename.idl,v $
+ * $Revision: 1.3 $
+ *
+ * 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
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_sdb_tools_XTableRename_idl__
+#define __com_sun_star_sdb_tools_XTableRename_idl__
+
+#ifndef __com_sun_star_sdbc_SQLException_idl__
+#include <com/sun/star/sdbc/SQLException.idl>
+#endif
+#include <com/sun/star/sdb/tools/XConnectionSupplier.idl>
+#ifndef __com_sun_star_lang_XInitialization_idl__
+#include <com/sun/star/lang/XInitialization.idl>
+#endif
+#ifndef __com_sun_star_beans_XPropertySet_idl__
+#include <com/sun/star/beans/XPropertySet.idl>
+#endif
+
+//=============================================================================
+module com { module sun { module star { module sdb { module tools {
+//=============================================================================
+
+//-----------------------------------------------------------------------------
+/** allows to rename table.
+
+ @see com::sun::star::sdb::DataSource::Settings
+
+ @since OOo 3.3
+*/
+interface XTableRename
+{
+ interface XConnectionSupplier;
+
+ /** rename the given table to the new name
+
+ @param table
+ the table to be renamed
+ @param newName
+ the new name of the table
+ @throws com::sun::star::sdbc::SQLException
+ */
+ void rename( [in] com::sun::star::beans::XPropertySet table, [in] string newName)
+ raises ( com::sun::star::sdbc::SQLException );
+
+
+};
+//=============================================================================
+}; }; }; }; };
+//=============================================================================
+
+#endif
+
diff --git a/offapi/com/sun/star/sdb/tools/XViewAccess.idl b/offapi/com/sun/star/sdb/tools/XViewAccess.idl
new file mode 100644
index 000000000000..e64727341e81
--- /dev/null
+++ b/offapi/com/sun/star/sdb/tools/XViewAccess.idl
@@ -0,0 +1,88 @@
+/*************************************************************************
+ *
+ * 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: XViewAccess.idl,v $
+ * $Revision: 1.3 $
+ *
+ * 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
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_sdb_tools_XViewAccess_idl__
+#define __com_sun_star_sdb_tools_XViewAccess_idl__
+
+#ifndef __com_sun_star_sdbc_SQLException_idl__
+#include <com/sun/star/sdbc/SQLException.idl>
+#endif
+#include <com/sun/star/sdb/tools/XConnectionSupplier.idl>
+#ifndef __com_sun_star_lang_XInitialization_idl__
+#include <com/sun/star/lang/XInitialization.idl>
+#endif
+#ifndef __com_sun_star_beans_XPropertySet_idl__
+#include <com/sun/star/beans/XPropertySet.idl>
+#endif
+
+//=============================================================================
+module com { module sun { module star { module sdb { module tools {
+//=============================================================================
+
+//-----------------------------------------------------------------------------
+/** allows to fetch and to change the sql statements of views
+
+ @see com::sun::star::sdb::DataSource::Settings
+ @see com::sun::star::sdbcx::View
+
+ @since OOo 3.3
+*/
+interface XViewAccess
+{
+ interface XConnectionSupplier;
+
+ /** returns the SQL statement of the view
+
+ @param view
+ the table to be renamed
+ @throws com::sun::star::sdbc::SQLException
+ */
+ string getCommand( [in] com::sun::star::beans::XPropertySet view)
+ raises ( com::sun::star::sdbc::SQLException );
+
+ /** allows to alter the SQL statement of a view
+
+ @param view
+ the view to be altered
+
+ @param command
+ the new SQL statement
+
+ @throws com::sun::star::sdbc::SQLException
+ */
+ void alterCommand( [in] com::sun::star::beans::XPropertySet view, [in] string command)
+ raises ( com::sun::star::sdbc::SQLException );
+};
+//=============================================================================
+}; }; }; }; };
+//=============================================================================
+
+#endif
+
diff --git a/offapi/com/sun/star/sdb/tools/makefile.mk b/offapi/com/sun/star/sdb/tools/makefile.mk
index ab57745142a4..1bc7e6b11c7d 100644
--- a/offapi/com/sun/star/sdb/tools/makefile.mk
+++ b/offapi/com/sun/star/sdb/tools/makefile.mk
@@ -44,7 +44,13 @@ IDLFILES=\
XConnectionTools.idl \
XDataSourceMetaData.idl \
XObjectNames.idl \
- XTableName.idl
+ XTableName.idl \
+ XTableRename.idl \
+ XViewAccess.idl \
+ XTableAlteration.idl \
+ XKeyAlteration.idl \
+ XIndexAlteration.idl \
+ XConnectionSupplier.idl
# ------------------------------------------------------------------
.INCLUDE : target.mk
diff --git a/offapi/com/sun/star/sheet/DataPilotDescriptor.idl b/offapi/com/sun/star/sheet/DataPilotDescriptor.idl
index 8e303601cb95..992afdef5ed9 100644
--- a/offapi/com/sun/star/sheet/DataPilotDescriptor.idl
+++ b/offapi/com/sun/star/sheet/DataPilotDescriptor.idl
@@ -40,6 +40,10 @@
#include <com/sun/star/beans/XPropertySet.idl>
#endif
+#ifndef __com_sun_star_beans_PropertyValue_idl__
+#include <com/sun/star/beans/PropertyValue.idl>
+#endif
+
//=============================================================================
module com { module sun { module star { module sheet {
@@ -73,6 +77,36 @@ published service DataPilotDescriptor
//=========================================================================
+ /** specifies parameters to create the data pilot table from a database.
+
+ @see DatabaseImportDescriptor
+ @since OOo 3.3.0
+
+ */
+ [optional, property] sequence< com::sun::star::beans::PropertyValue > ImportDescriptor;
+
+ //-------------------------------------------------------------------------
+
+ /** specifies the name of a <type>DataPilotSource</type> implementation
+ for the data pilot table.
+
+ @since OOo 3.3.0
+
+ */
+ [optional, property] string SourceServiceName;
+
+ //-------------------------------------------------------------------------
+
+ /** specifies arguments that are passed to the implementation named by
+ <member>SourceServiceName</member>.
+
+ @since OOo 3.3.0
+
+ */
+ [optional, property] sequence< com::sun::star::beans::PropertyValue > ServiceArguments;
+
+ //-------------------------------------------------------------------------
+
/** specifies the orientation of the field.
*/
[optional, property] boolean IgnoreEmptyRows;
diff --git a/offapi/com/sun/star/sheet/DataPilotTable.idl b/offapi/com/sun/star/sheet/DataPilotTable.idl
index db09028abd42..c2385c46e5fa 100644
--- a/offapi/com/sun/star/sheet/DataPilotTable.idl
+++ b/offapi/com/sun/star/sheet/DataPilotTable.idl
@@ -36,6 +36,10 @@
#include <com/sun/star/sheet/XDataPilotTable.idl>
#endif
+#ifndef __com_sun_star_util_XModifyBroadcaster_idl__
+#include <com/sun/star/util/XModifyBroadcaster.idl>
+#endif
+
//=============================================================================
module com { module sun { module star { module sheet {
@@ -58,6 +62,14 @@ published service DataPilotTable
*/
interface com::sun::star::sheet::XDataPilotTable;
+ //-------------------------------------------------------------------------
+
+ /** allows notification of modifications to the data pilot table.
+
+ @since OOo 3.3.0
+
+ */
+ [optional] interface com::sun::star::util::XModifyBroadcaster;
};
//=============================================================================
diff --git a/offapi/com/sun/star/task/DocumentMacroConfirmationRequest.idl b/offapi/com/sun/star/task/DocumentMacroConfirmationRequest.idl
index d05158a4db82..a115e914afb8 100644
--- a/offapi/com/sun/star/task/DocumentMacroConfirmationRequest.idl
+++ b/offapi/com/sun/star/task/DocumentMacroConfirmationRequest.idl
@@ -48,7 +48,8 @@ exception DocumentMacroConfirmationRequest : ClassifiedInteractionRequest
*/
string DocumentURL;
- /** refers to the storage which the document was last committed to.
+ /** refers to the storage related to the last commited version of the
+ document.
This storage is necessary e.g. for displaying the existing signatures to
the user, to allow him a decision whether or not to trust those signatures
@@ -59,6 +60,10 @@ exception DocumentMacroConfirmationRequest : ClassifiedInteractionRequest
::com::sun::star::embed::XStorage
DocumentStorage;
+ /** contains informations about the ODF version of the document
+ */
+ string DocumentVersion;
+
/** contains informations about the signatures in the document
*/
sequence< ::com::sun::star::security::DocumentSignatureInformation >
diff --git a/offapi/com/sun/star/task/DocumentMacroConfirmationRequest2.idl b/offapi/com/sun/star/task/DocumentMacroConfirmationRequest2.idl
deleted file mode 100644
index cfdae9f435d3..000000000000
--- a/offapi/com/sun/star/task/DocumentMacroConfirmationRequest2.idl
+++ /dev/null
@@ -1,80 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef __com_sun_star_task_DocumentMacroConfirmationRequest2_idl__
-#define __com_sun_star_task_DocumentMacroConfirmationRequest2_idl__
-
-#include <com/sun/star/task/ClassifiedInteractionRequest.idl>
-#include <com/sun/star/embed/XStorage.idl>
-#include <com/sun/star/security/DocumentSignatureInformation.idl>
-
-
-//=============================================================================
-
-module com { module sun { module star { module task {
-
-//=============================================================================
-
-/** describes the request to approve or deny the execution of macros contained in
- a document.
- */
-exception DocumentMacroConfirmationRequest2 : ClassifiedInteractionRequest
-{
- /** specifies the URL of the document which contains macros whose execution
- should be approved or rejected.
- */
- string DocumentURL;
-
- /** refers to the zip-storage related to the last commited version of the
- document.
-
- This storage is necessary e.g. for displaying the existing signatures to
- the user, to allow him a decision whether or not to trust those signatures
- and thus the signed macros.
-
- @see ::com::sun::star::security::XDocumentDigitalSignatures::showScriptingContentSignatures
- */
- ::com::sun::star::embed::XStorage
- DocumentZipStorage;
-
- /** contains informations about the ODF version of the document
- */
- string DocumentVersion;
-
- /** contains informations about the signatures in the document
- */
- sequence< ::com::sun::star::security::DocumentSignatureInformation >
- DocumentSignatureInformation;
-};
-
-//=============================================================================
-
-}; }; }; };
-
-//=============================================================================
-
-#endif
diff --git a/offapi/com/sun/star/task/InteractionHandler.idl b/offapi/com/sun/star/task/InteractionHandler.idl
index c6785e831748..f772754d6d56 100644
--- a/offapi/com/sun/star/task/InteractionHandler.idl
+++ b/offapi/com/sun/star/task/InteractionHandler.idl
@@ -36,11 +36,15 @@ module com { module sun { module star {
module com { module sun { module star { module task {
//============================================================================
-/** An interaction request handler that lets the user handle a number of well
- known requests via GUI dialogs (and the
- <type scope="com::sun::star::task">PasswordContainer</type> service).
+/** An interaction request handler that lets the user handle requests via GUI dialogs.
- <P>The well known requests handled by this service include
+ <p>The interaction handler service has a numerof of <a href="#built_in_handler">built-in handlers</a>, responsible
+ for a lot of well known interactions. Additionally, there's a configuration module which allows to
+ <a href="#configuring_handlers">configure additional handlers</a>, responsible for arbitrary requests.</a></p>
+
+ <a name="built_in_handler"></a>
+ <h3>Built-in Handlers</h3>
+ The following well-known requests can be dealt with by the built-in handlers:
<UL>
<LI><type scope="com::sun::star::ucb">AuthenticationRequest</type></LI>
<LI><type scope="com::sun::star::ucb">CertificateValidationRequest</type></LI>
@@ -131,6 +135,26 @@ module com { module sun { module star { module task {
only. The names of the two volumes involved (two
<atom>string</atom>s).</DD>
</DL></P>
+
+ <a name="configuring_handlers"></a>
+ <h3>Configurating additional Handlers</h3>
+
+ <p>It is possible to configure additional interaction handlers, to which certain requests can be delegated. The
+ configuration node <code>/org.openoffice.Interaction/InteractionHandlers</code> is evaluated and respected
+ by the <code>InteractionHandler</code> implementation.</p>
+
+ <p>A custom interaction handler can declare itself responsible for an arbitrary number of UNO types, specified
+ by full-qualified type name. Also, for each type, it can specify whether it is responsible for only this particular
+ type, or all possibly existent derived types.</p>
+
+ <p>Whenever the <code>InteractionHandler</code> encounteres a request it cannot fulfill itself, it will examine
+ the configuration, to find a handler implementation for the request, and delegate it to the first matching
+ handler.</p>
+
+ <p>If multiple custom interaction handlers declare themself responsible for the same request type, it is not
+ defined which handler will actully be invoked. Thus, when deploying a custom interaction handler, ensure
+ that the types you specify are general enough to cover all requests you want to handle, but also specific
+ enough to not cover requests which other handlers might be interested in.</p>
*/
published service InteractionHandler
{
diff --git a/offapi/com/sun/star/task/makefile.mk b/offapi/com/sun/star/task/makefile.mk
index 98a66038bef2..3b622b469b63 100644
--- a/offapi/com/sun/star/task/makefile.mk
+++ b/offapi/com/sun/star/task/makefile.mk
@@ -41,7 +41,6 @@ PACKAGE=com$/sun$/star$/task
IDLFILES=\
ClassifiedInteractionRequest.idl\
DocumentMacroConfirmationRequest.idl\
- DocumentMacroConfirmationRequest2.idl\
DocumentPasswordRequest.idl\
DocumentMSPasswordRequest.idl\
ErrorCodeRequest.idl\
diff --git a/offapi/com/sun/star/text/RedlinePortion.idl b/offapi/com/sun/star/text/RedlinePortion.idl
index be39882474c3..c399d976e04a 100644
--- a/offapi/com/sun/star/text/RedlinePortion.idl
+++ b/offapi/com/sun/star/text/RedlinePortion.idl
@@ -52,7 +52,7 @@ published service RedlinePortion
/** contains the name of the author of the change.*/
[readonly, property] string RedlineAuthor;
/** contains the date and time of the change.*/
- [readonly, property] com::sun::star::util::DateTime RedlineDataTime;
+ [readonly, property] com::sun::star::util::DateTime RedlineDateTime;
/** contains a comment for the change.*/
[readonly, property] string RedlineComment;
/** contains the type of the change
@@ -70,7 +70,7 @@ published service RedlinePortion
<p> The elements of the sequence are:</p>
<UL>
<LI><P>string RedlineAuthor; </P>
- <LI><P>com::sun::star::util::DateTime RedlineDataTime; </P>
+ <LI><P>com::sun::star::util::DateTime RedlineDateTime; </P>
<LI><P>string RedlineComment; </P>
<LI><P>string RedlineType; </P>
</UL>
diff --git a/offapi/com/sun/star/text/XFormField.idl b/offapi/com/sun/star/text/XFormField.idl
index f1f2d1bab9b9..53555728ba40 100644
--- a/offapi/com/sun/star/text/XFormField.idl
+++ b/offapi/com/sun/star/text/XFormField.idl
@@ -1,26 +1,20 @@
- #ifndef __com_sun_star_text_XFormField_idl__
- #define __com_sun_star_text_XFormField_idl__
+#ifndef __com_sun_star_text_XFormField_idl__
+#define __com_sun_star_text_XFormField_idl__
- #ifndef __com_sun_star_uno_XInterface_idl__
- #include <com/sun/star/uno/XInterface.idl>
- #endif
+#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/container/XNameContainer.idl>
- module com { module sun { module star { module text {
+module com { module sun { module star { module text {
-/** @deprecated
- */
- interface XFormField: com::sun::star::uno::XInterface
- {
- short getType();
- short getRes();
- string getDescription( );
+ /** @deprecated
+ */
+ interface XFormField : com::sun::star::uno::XInterface
+ {
+ string getFieldType();
+ void setFieldType([in] string fieldType);
+ com::sun::star::container::XNameContainer getParameters();
+ };
- void setType([in] short fieldType );
- void setRes([in] short res );
- void setDescription([in] string description );
+}; }; }; };
- };
-
- }; }; }; };
-
- #endif
+#endif
diff --git a/offapi/com/sun/star/text/textfield/MetadataField.idl b/offapi/com/sun/star/text/textfield/MetadataField.idl
index 64918b12849f..85541457aef7 100755
--- a/offapi/com/sun/star/text/textfield/MetadataField.idl
+++ b/offapi/com/sun/star/text/textfield/MetadataField.idl
@@ -50,7 +50,8 @@
module com { module sun { module star { module text { module textfield {
//=============================================================================
-/** is a <type>TextField</type> whose content is specified by RDF metadata.
+/** is a <type scope="com::sun::star::text">TextField</type> whose content
+ is specified by RDF metadata.
@since OOo 3.2
@@ -59,8 +60,8 @@ module com { module sun { module star { module text { module textfield {
service MetadataField
{
//-------------------------------------------------------------------------
- /** None of the properties of <type>TextContent</type> are
- supported. */
+ /** None of the properties of
+ <type scope="com::sun::star::text">TextContent</type> are supported. */
service com::sun::star::text::TextField;
//-------------------------------------------------------------------------
@@ -73,8 +74,8 @@ service MetadataField
interface com::sun::star::text::XText;
//-------------------------------------------------------------------------
- /** The <type>TextContent</type>s that are contained in the
- <type>MetadataField</type> can be enumerated. */
+ /** The <type scope="com::sun::star::text">TextContent</type>s that are
+ contained in the <type>MetadataField</type> can be enumerated. */
interface com::sun::star::container::XEnumerationAccess;
//-------------------------------------------------------------------------
diff --git a/offapi/com/sun/star/util/Duration.idl b/offapi/com/sun/star/util/Duration.idl
index 1832b4af4a55..ef544189210f 100644
--- a/offapi/com/sun/star/util/Duration.idl
+++ b/offapi/com/sun/star/util/Duration.idl
@@ -87,9 +87,9 @@ struct Duration
unsigned short Seconds;
//--------------------------------------------------------------------
- /** contains the hundredth seconds.
+ /** contains the milliseconds.
*/
- unsigned short HundredthSeconds;
+ unsigned short MilliSeconds;
};
diff --git a/offapi/prj/build.lst b/offapi/prj/build.lst
index 226741529436..a0be2398f429 100644
--- a/offapi/prj/build.lst
+++ b/offapi/prj/build.lst
@@ -94,7 +94,7 @@ oa offapi\com\sun\star\xsd nmake - all oa_xsd NULL
oa offapi\com\sun\star\inspection nmake - all oa_inspection NULL
oa offapi\com\sun\star\ui nmake - all oa_ui NULL
oa offapi\com\sun\star\ui\dialogs nmake - all oa_ui_dialogs NULL
-oa offapi\com\sun\star nmake - all - NULL
+oa offapi\com\sun\star nmake - all oa_starme NULL
oa offapi\com\sun\star\security nmake - all oa_security NULL
oa offapi\com\sun\star\xml\crypto\sax nmake - all oa_crypto_sax oa_wrapper oa_csax NULL
oa offapi\com\sun\star\xml\crypto nmake - all oa_crypto oa_wrapper oa_security NULL
@@ -105,4 +105,4 @@ oa offapi\com\sun\star\rendering nmake - all oa_rendering oa_geometry NU
oa offapi\com\sun\star\rdf nmake - all oa_rdf oa_datatransfer oa_text NULL
oa offapi\com\sun\star\office nmake - all oa_office oa_text NULL
oa offapi\drafts\com\sun\star\form nmake - all oa_drafts_form NULL
-oa offapi\util nmake - all oa_util oa_auth oa_awt oa_awttree oa_awtgrid oa_chart oa_chart2 oa_chart2_data oa_config oa_configbootstrap oa_configbackend oa_configbackend_xml oa_datatrans_clip oa_datatrans_dnd oa_datatransfer oa_docu oa_draw oa_draw_framework oa_embed oa_fcomp oa_finsp oa_fcontr oa_fieldmaster oa_form oa_xforms oa_formula oa_frame oa_i18n oa_inst oa_ldap oa_ling2 oa_logging oa_mail oa_media oa_mozilla oa_packages oa_manifest oa_zippackage oa_plug oa_pres oa_animations oa_putil oa_resrc oa_sax oa_xml_input oa_scan oa_sdb oa_sdbtools oa_sdbapp oa_sdbc oa_sdbcx oa_setup oa_sheet oa_style oa_svg oa_sync oa_sync2 oa_system oa_table oa_task oa_text oa_textfield oa_docinfo oa_ucb oa_view oa_xml oa_xml_dom oa_xml_xpath oa_xml_views oa_xml_events oa_image oa_xsd oa_inspection oa_ui oa_ui_dialogs oa_accessibility oa_form_binding oa_form_validation oa_form_submission oa_fruntime oa_geometry oa_rendering oa_sfprovider oa_sfbrowse oa_drafts_form oa_deployment oa_deploymenttest oa_deployment_ui oa_frame_status oa_gallery oa_graphic oa_security oa_crypto_sax oa_crypto oa_csax oa_wrapper oa_script oa_smarttags oa_report oa_reportins oa_reportmeta oa_rdf oa_oooimprovement oa_office NULL
+oa offapi\util nmake - all oa_util oa_auth oa_awt oa_awttree oa_awtgrid oa_chart oa_chart2 oa_chart2_data oa_config oa_configbootstrap oa_configbackend oa_configbackend_xml oa_datatrans_clip oa_datatrans_dnd oa_datatransfer oa_docu oa_draw oa_draw_framework oa_embed oa_fcomp oa_finsp oa_fcontr oa_fieldmaster oa_form oa_xforms oa_formula oa_frame oa_i18n oa_inst oa_ldap oa_ling2 oa_logging oa_mail oa_media oa_mozilla oa_packages oa_manifest oa_zippackage oa_plug oa_pres oa_animations oa_putil oa_resrc oa_sax oa_xml_input oa_scan oa_sdb oa_sdbtools oa_sdbapp oa_sdbc oa_sdbcx oa_setup oa_sheet oa_style oa_svg oa_sync oa_sync2 oa_system oa_table oa_task oa_text oa_textfield oa_docinfo oa_ucb oa_view oa_xml oa_xml_dom oa_xml_xpath oa_xml_views oa_xml_events oa_image oa_xsd oa_inspection oa_ui oa_ui_dialogs oa_accessibility oa_form_binding oa_form_validation oa_form_submission oa_fruntime oa_geometry oa_rendering oa_sfprovider oa_sfbrowse oa_drafts_form oa_deployment oa_deploymenttest oa_deployment_ui oa_frame_status oa_gallery oa_graphic oa_security oa_crypto_sax oa_crypto oa_csax oa_wrapper oa_script oa_smarttags oa_report oa_reportins oa_reportmeta oa_rdf oa_oooimprovement oa_office oa_prestextfield oa_starme NULL
diff --git a/offapi/type_reference/typelibrary_history.txt b/offapi/type_reference/typelibrary_history.txt
index 70f0e1d0cb35..086397e8967e 100644
--- a/offapi/type_reference/typelibrary_history.txt
+++ b/offapi/type_reference/typelibrary_history.txt
@@ -141,10 +141,16 @@
to maybevoid and deprecate. They should be removed in a future version. The
implementation will never return them.
-25/02/09 (MST, JSC): TaskID=i96209
+02/25/09 (MST, JSC): TaskID=i96209
rename module css.text.FieldMaster to css.text.fieldmaster.
the implementation handles both variants.
-15/05/09 (MST, JSC): TaskID=i101965
+05/15/09 (MST, JSC): TaskID=i101965
fix read-only status of properties of css.text.TextPortion
+02/12/10 (JSC): TaskID=i107712, i107695
+ correct typo in com.sun.star.text.RedlinePortion. Property
+ RedLineDataTime have to be RedlineDateTime.
+ Update reference type library with the version of OOo 3.2. The new
+ reference type library is taken from the release source tree OOO320 m12.
+
diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb
index f9a30cdbbd53..22b8904052ff 100644
--- a/offapi/type_reference/types.rdb
+++ b/offapi/type_reference/types.rdb
Binary files differ
diff --git a/registry/inc/registry/registry.hxx b/registry/inc/registry/registry.hxx
index 00a763737413..7ded0738cd72 100644
--- a/registry/inc/registry/registry.hxx
+++ b/registry/inc/registry/registry.hxx
@@ -483,6 +483,9 @@ public:
/// closes explicitly the current key
inline RegError closeKey();
+ /// releases the current key
+ inline void releaseKey();
+
/** sets a value of a key.
@param keyName specifies the name of the key which value will be set.
@@ -807,19 +810,18 @@ inline void RegistryKey::setRegistry(Registry& registry)
inline RegistryKey::~RegistryKey()
{
if (m_hImpl)
- m_registry.m_pApi->closeKey(m_hImpl);
+ m_registry.m_pApi->releaseKey(m_hImpl);
}
inline RegistryKey& RegistryKey::operator = (const RegistryKey& toAssign)
{
m_registry = toAssign.m_registry;
- if (m_hImpl != toAssign.m_hImpl)
- {
+ if (toAssign.m_hImpl)
+ m_registry.m_pApi->acquireKey(toAssign.m_hImpl);
+ if (m_hImpl)
m_registry.m_pApi->releaseKey(m_hImpl);
- m_hImpl = toAssign.m_hImpl;
- m_registry.m_pApi->acquireKey(m_hImpl);
- }
+ m_hImpl = toAssign.m_hImpl;
return *this;
}
@@ -945,6 +947,14 @@ inline RegError RegistryKey::closeKey()
return REG_INVALID_KEY;
}
+inline void RegistryKey::releaseKey()
+{
+ if (m_registry.isValid() && (m_hImpl != 0))
+ {
+ m_registry.m_pApi->releaseKey(m_hImpl), m_hImpl = 0;
+ }
+}
+
inline RegError RegistryKey::setValue(const ::rtl::OUString& keyName,
RegValueType valueType,
RegValue pValue,
@@ -1163,15 +1173,13 @@ inline Registry::~Registry()
inline Registry& Registry::operator = (const Registry& toAssign)
{
-
- if (m_hImpl != toAssign.m_hImpl)
- {
- m_pApi->release(m_hImpl);
- m_pApi = toAssign.m_pApi;
- m_hImpl = toAssign.m_hImpl;
- }
+ if (toAssign.m_hImpl)
+ toAssign.m_pApi->acquire(toAssign.m_hImpl);
if (m_hImpl)
- m_pApi->acquire(m_hImpl);
+ m_pApi->release(m_hImpl);
+
+ m_pApi = toAssign.m_pApi;
+ m_hImpl = toAssign.m_hImpl;
return *this;
}
diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx
index 17f84a3b3973..9496aee84d8e 100644
--- a/registry/source/keyimpl.cxx
+++ b/registry/source/keyimpl.cxx
@@ -28,13 +28,17 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_registry.hxx"
-#include "reflcnst.hxx"
-
#include "keyimpl.hxx"
-#include <rtl/alloc.h>
-#include <rtl/memory.h>
+
+#include "reflcnst.hxx"
+#include "rtl/alloc.h"
+#include "rtl/memory.h"
#include "rtl/ustrbuf.hxx"
+using rtl::OUString;
+using rtl::OUStringBuffer;
+using namespace store;
+
namespace { static char const VALUE_PREFIX[] = "$VL_"; }
//*********************************************************************
@@ -43,9 +47,35 @@ namespace { static char const VALUE_PREFIX[] = "$VL_"; }
ORegKey::ORegKey(const OUString& keyName, ORegistry* pReg)
: m_refCount(1)
, m_name(keyName)
- , m_bDeleted(sal_False)
+ , m_bDeleted(0)
+ , m_bModified(0)
, m_pRegistry(pReg)
-{}
+{
+}
+
+//*********************************************************************
+// ~ORegKey()
+//
+ORegKey::~ORegKey()
+{
+ OSL_POSTCOND(m_refCount == 0, "registry::ORegKey::dtor(): refcount not zero.");
+}
+
+//*********************************************************************
+// acquireKey
+//
+RegError ORegKey::acquireKey(RegKeyHandle hKey)
+{
+ return m_pRegistry->acquireKey(hKey);
+}
+
+//*********************************************************************
+// releaseKey
+//
+RegError ORegKey::releaseKey(RegKeyHandle hKey)
+{
+ return m_pRegistry->releaseKey(hKey);
+}
//*********************************************************************
// createKey
@@ -61,7 +91,7 @@ RegError ORegKey::createKey(const OUString& keyName, RegKeyHandle* phNewKey)
//
RegError ORegKey::openKey(const OUString& keyName, RegKeyHandle* phOpenKey)
{
- return (m_pRegistry->openKey(this, keyName, phOpenKey));
+ return m_pRegistry->openKey(this, keyName, phOpenKey);
}
@@ -70,33 +100,24 @@ RegError ORegKey::openKey(const OUString& keyName, RegKeyHandle* phOpenKey)
//
RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubKeys, sal_uInt32* pnSubKeys)
{
- ORegKey* pKey;
- OUString sFullKeyName, sSubKeyName;
- RegKeyHandle hSKey = 0, hSubKey;
- RegError _ret = REG_NO_ERROR;
- sal_uInt32 nSubKeys;
- ORegKey* *subKeys;
+ RegError _ret = REG_NO_ERROR;
+
+ *phOpenSubKeys = 0;
+ *pnSubKeys = 0;
+ ORegKey* pKey = this;
if ( keyName.getLength() )
{
- _ret = openKey(keyName, &hSKey);
- if (_ret)
- {
- *phOpenSubKeys = NULL;
- *pnSubKeys = 0;
+ _ret = openKey(keyName, (RegKeyHandle*)&pKey);
+ if (_ret != REG_NO_ERROR)
return _ret;
- }
-
- pKey = (ORegKey*)hSKey;
- } else
- {
- pKey = this;
}
- nSubKeys = pKey->countSubKeys();
-
+ sal_uInt32 nSubKeys = pKey->countSubKeys();
*pnSubKeys = nSubKeys;
- subKeys = (ORegKey**)rtl_allocateZeroMemory(nSubKeys * sizeof(ORegKey*));
+
+ ORegKey** pSubKeys;
+ pSubKeys = (ORegKey**)rtl_allocateZeroMemory(nSubKeys * sizeof(ORegKey*));
OStoreDirectory::iterator iter;
OStoreDirectory rStoreDir(pKey->getStoreDir());
@@ -107,22 +128,19 @@ RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubK
{
if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR )
{
- sSubKeyName = iter.m_pszName;
- sFullKeyName = pKey->getName();
- if (sFullKeyName.getLength() > 1)
- sFullKeyName += m_pRegistry->ROOT;
- sFullKeyName += sSubKeyName;
+ OUString const sSubKeyName = iter.m_pszName;
- _ret = pKey->openKey(sSubKeyName, &hSubKey);
- if (_ret)
+ ORegKey* pOpenSubKey = 0;
+ _ret = pKey->openKey(sSubKeyName, (RegKeyHandle*)&pOpenSubKey);
+ if (_ret != REG_NO_ERROR)
{
*phOpenSubKeys = NULL;
*pnSubKeys = 0;
- rtl_freeMemory(subKeys);
- return _ret;
+ rtl_freeMemory(pSubKeys); // @@@ leaking 'pSubKeys[0...nSubkeys-1]'
+ return _ret; // @@@ leaking 'pKey'
}
- subKeys[nSubKeys] = ((ORegKey*)hSubKey);
+ pSubKeys[nSubKeys] = pOpenSubKey;
nSubKeys++;
}
@@ -130,10 +148,10 @@ RegError ORegKey::openSubKeys(const OUString& keyName, RegKeyHandle** phOpenSubK
_err = rStoreDir.next(iter);
}
- *phOpenSubKeys = (RegKeyHandle*)subKeys;
+ *phOpenSubKeys = (RegKeyHandle*)pSubKeys;
if (keyName.getLength())
{
- closeKey(hSKey);
+ (void) releaseKey(pKey);
}
return REG_NO_ERROR;
}
@@ -146,35 +164,28 @@ RegError ORegKey::getKeyNames(const OUString& keyName,
rtl_uString*** pSubKeyNames,
sal_uInt32* pnSubKeys)
{
- ORegKey* pKey;
- OUString sFullKeyName, sSubKeyName;
- RegError _ret = REG_NO_ERROR;
- sal_uInt32 nSubKeys;
- rtl_uString** pSubKeys;
+ RegError _ret = REG_NO_ERROR;
+
+ *pSubKeyNames = 0;
+ *pnSubKeys = 0;
+ ORegKey* pKey = this;
if (keyName.getLength())
{
_ret = openKey(keyName, (RegKeyHandle*)&pKey);
- if (_ret)
- {
- *pSubKeyNames = NULL;
- *pnSubKeys = 0;
+ if (_ret != REG_NO_ERROR)
return _ret;
- }
- } else
- {
- pKey = this;
}
- nSubKeys = pKey->countSubKeys();
-
+ sal_uInt32 nSubKeys = pKey->countSubKeys();
*pnSubKeys = nSubKeys;
+
+ rtl_uString** pSubKeys = 0;
pSubKeys = (rtl_uString**)rtl_allocateZeroMemory(nSubKeys * sizeof(rtl_uString*));
OStoreDirectory::iterator iter;
OStoreDirectory rStoreDir(pKey->getStoreDir());
storeError _err = rStoreDir.first(iter);
- OUString subKey;
nSubKeys = 0;
@@ -182,14 +193,14 @@ RegError ORegKey::getKeyNames(const OUString& keyName,
{
if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR)
{
- sSubKeyName = iter.m_pszName;
- sFullKeyName = pKey->getName();
+ OUString const sSubKeyName = iter.m_pszName;
+
+ OUString sFullKeyName(pKey->getName());
if (sFullKeyName.getLength() > 1)
sFullKeyName += m_pRegistry->ROOT;
sFullKeyName += sSubKeyName;
- subKey = sFullKeyName;
- rtl_uString_newFromString(&pSubKeys[nSubKeys], subKey.pData);
+ rtl_uString_newFromString(&pSubKeys[nSubKeys], sFullKeyName.pData);
nSubKeys++;
}
@@ -200,7 +211,7 @@ RegError ORegKey::getKeyNames(const OUString& keyName,
*pSubKeyNames = pSubKeys;
if (keyName.getLength())
{
- closeKey((RegKeyHandle)pKey);
+ releaseKey(pKey);
}
return REG_NO_ERROR;
}
@@ -349,7 +360,6 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal
break;
}
-
sal_uInt32 writenBytes;
if ( rValue.writeAt(0, pBuffer, VALUE_HEADERSIZE+size, writenBytes) )
{
@@ -361,8 +371,8 @@ RegError ORegKey::setValue(const OUString& valueName, RegValueType vType, RegVal
rtl_freeMemory(pBuffer);
return REG_SET_VALUE_FAILED;
}
+ setModified();
- //rValue.flush();
rtl_freeMemory(pBuffer);
return REG_NO_ERROR;
}
@@ -420,8 +430,8 @@ RegError ORegKey::setLongListValue(const OUString& valueName, sal_Int32* pValueL
rtl_freeMemory(pBuffer);
return REG_SET_VALUE_FAILED;
}
+ setModified();
- //rValue.flush();
rtl_freeMemory(pBuffer);
return REG_NO_ERROR;
}
@@ -488,8 +498,8 @@ RegError ORegKey::setStringListValue(const OUString& valueName, sal_Char** pValu
rtl_freeMemory(pBuffer);
return REG_SET_VALUE_FAILED;
}
+ setModified();
- //rValue.flush();
rtl_freeMemory(pBuffer);
return REG_NO_ERROR;
}
@@ -556,8 +566,8 @@ RegError ORegKey::setUnicodeListValue(const OUString& valueName, sal_Unicode** p
rtl_freeMemory(pBuffer);
return REG_SET_VALUE_FAILED;
}
+ setModified();
- //rValue.flush();
rtl_freeMemory(pBuffer);
return REG_NO_ERROR;
}
@@ -626,7 +636,6 @@ RegError ORegKey::getValue(const OUString& valueName, RegValue value) const
return REG_INVALID_VALUE;
}
-// rtl_copyMemory(value, pBuffer, valueSize);
switch (valueType)
{
case RG_VALUETYPE_NOT_DEFINED:
@@ -970,33 +979,30 @@ RegError ORegKey::getUnicodeListValue(const OUString& valueName, sal_Unicode***
//
RegError ORegKey::getKeyType(const OUString& name, RegKeyType* pKeyType) const
{
- ORegKey* pKey;
- RegError _ret = REG_NO_ERROR;
-
*pKeyType = RG_KEYTYPE;
REG_GUARD(m_pRegistry->m_mutex);
if ( name.getLength() )
{
- _ret = ((ORegKey*)this)->openKey(
- name, (RegKeyHandle*)&pKey);
- if (_ret)
+ ORegKey* pThis = const_cast< ORegKey* >(this);
+
+ RegKeyHandle hKey = 0;
+ RegError _ret = pThis->openKey(name, &hKey);
+ if (_ret != REG_NO_ERROR)
return _ret;
- ((ORegKey*)this)->closeKey((RegKeyHandle)pKey);
- return _ret;
- } else
- {
- return _ret;
+ (void) pThis->releaseKey(hKey);
}
+
+ return REG_NO_ERROR;
}
RegError ORegKey::getResolvedKeyName(const OUString& keyName,
OUString& resolvedName)
{
- if (keyName.getLength() == 0) {
+ if (keyName.getLength() == 0)
return REG_INVALID_KEYNAME;
- }
+
resolvedName = getFullPath(keyName);
return REG_NO_ERROR;
}
diff --git a/registry/source/keyimpl.hxx b/registry/source/keyimpl.hxx
index f579040ab039..c2558b4f8394 100644
--- a/registry/source/keyimpl.hxx
+++ b/registry/source/keyimpl.hxx
@@ -30,16 +30,14 @@
#include <registry/registry.h>
#include "regimpl.hxx"
-#include <rtl/string.hxx>
-
-using namespace rtl;
-using namespace store;
+#include <rtl/ustring.hxx>
class ORegKey
{
public:
- ORegKey(const OUString& keyName, ORegistry* pReg);
+ ORegKey(const rtl::OUString& keyName, ORegistry* pReg);
+ ~ORegKey();
sal_uInt32 acquire()
{ return ++m_refCount; }
@@ -47,68 +45,77 @@ public:
sal_uInt32 release()
{ return --m_refCount; }
- RegError createKey(const OUString& keyName, RegKeyHandle* phNewKey);
+ RegError acquireKey(RegKeyHandle hKey);
+ RegError releaseKey(RegKeyHandle hKey);
+
+ RegError createKey(const rtl::OUString& keyName, RegKeyHandle* phNewKey);
- RegError openKey(const OUString& keyName, RegKeyHandle* phOpenKey);
+ RegError openKey(const rtl::OUString& keyName, RegKeyHandle* phOpenKey);
- RegError openSubKeys(const OUString& keyName,
+ RegError openSubKeys(const rtl::OUString& keyName,
RegKeyHandle** phOpenSubKeys,
sal_uInt32* pnSubKeys);
- RegError getKeyNames(const OUString& keyName,
+ RegError getKeyNames(const rtl::OUString& keyName,
rtl_uString*** pSubKeyNames,
sal_uInt32* pnSubKeys);
RegError closeKey(RegKeyHandle hKey);
- RegError deleteKey(const OUString& keyName);
+ RegError deleteKey(const rtl::OUString& keyName);
- RegError getValueInfo(const OUString& valueName,
+ RegError getValueInfo(const rtl::OUString& valueName,
RegValueType* pValueTye,
sal_uInt32* pValueSize) const;
- RegError setValue(const OUString& valueName,
+ RegError setValue(const rtl::OUString& valueName,
RegValueType vType,
RegValue value,
sal_uInt32 vSize);
- RegError setLongListValue(const OUString& valueName,
+ RegError setLongListValue(const rtl::OUString& valueName,
sal_Int32* pValueList,
sal_uInt32 len);
- RegError setStringListValue(const OUString& valueName,
+ RegError setStringListValue(const rtl::OUString& valueName,
sal_Char** pValueList,
sal_uInt32 len);
- RegError setUnicodeListValue(const OUString& valueName,
+ RegError setUnicodeListValue(const rtl::OUString& valueName,
sal_Unicode** pValueList,
sal_uInt32 len);
- RegError getValue(const OUString& valueName, RegValue value) const;
+ RegError getValue(const rtl::OUString& valueName, RegValue value) const;
- RegError getLongListValue(const OUString& valueName,
+ RegError getLongListValue(const rtl::OUString& valueName,
sal_Int32** pValueList,
sal_uInt32* pLen) const;
- RegError getStringListValue(const OUString& valueName,
+ RegError getStringListValue(const rtl::OUString& valueName,
sal_Char*** pValueList,
sal_uInt32* pLen) const;
- RegError getUnicodeListValue(const OUString& valueName,
+ RegError getUnicodeListValue(const rtl::OUString& valueName,
sal_Unicode*** pValueList,
sal_uInt32* pLen) const;
- RegError getKeyType(const OUString& name,
+ RegError getKeyType(const rtl::OUString& name,
RegKeyType* pKeyType) const;
- RegError getResolvedKeyName(const OUString& keyName,
- OUString& resolvedName);
+ RegError getResolvedKeyName(const rtl::OUString& keyName,
+ rtl::OUString& resolvedName);
+
+ bool isDeleted() const
+ { return m_bDeleted != 0; }
- sal_Bool isDeleted() const
- { return m_bDeleted; }
+ void setDeleted (sal_Bool bKeyDeleted)
+ { m_bDeleted = bKeyDeleted ? 1 : 0; }
- void setDeleted(sal_Bool bKeyDeleted)
- { m_bDeleted = bKeyDeleted; }
+ bool isModified() const
+ { return m_bModified != 0; }
+
+ void setModified (bool bModified = true)
+ { m_bModified = bModified ? 1 : 0; }
sal_Bool isReadOnly() const
{ return m_pRegistry->isReadOnly(); }
@@ -118,28 +125,27 @@ public:
ORegistry* getRegistry() const
{ return m_pRegistry; }
- const OStoreFile& getStoreFile() const
+ const store::OStoreFile& getStoreFile() const
{ return m_pRegistry->getStoreFile(); }
- OStoreDirectory getStoreDir();
+ store::OStoreDirectory getStoreDir();
- const OUString& getName() const
+ const rtl::OUString& getName() const
{ return m_name; }
sal_uInt32 getRefCount() const
{ return m_refCount; }
- OUString getFullPath(OUString const & path) const;
+ rtl::OUString getFullPath(rtl::OUString const & path) const;
private:
sal_uInt32 m_refCount;
- OUString m_name;
- sal_Bool m_bDeleted;
+ rtl::OUString m_name;
+ int m_bDeleted:1;
+ int m_bModified:1;
ORegistry* m_pRegistry;
};
-
-
#endif
diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index 8d0c98b57041..2d3322c25b13 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -28,6 +28,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_registry.hxx"
+#include "regimpl.hxx"
+
#include <memory>
#include <string.h>
#include <stdio.h>
@@ -39,18 +41,6 @@
#include <unistd.h>
#endif
-#ifdef MACOSX
-// Get the store.hxx inlines non-inline, solves crashes in cppumaker
-#define inline
-#endif
-
-#include "regimpl.hxx"
-
-#ifdef MACOSX
-// Get the store.hxx inlines non-inline, solves crashes in cppumaker
-#undef inline
-#endif
-
#ifndef __REGISTRY_REFLREAD_HXX__
#include <registry/reflread.hxx>
#endif
@@ -64,19 +54,19 @@
#include "registry/types.h"
#include "registry/version.h"
-#ifndef __REFLCNST_HXX__
#include "reflcnst.hxx"
-#endif
#include "keyimpl.hxx"
+
#include <osl/thread.h>
#include <rtl/alloc.h>
#include <rtl/memory.h>
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
-#ifndef _ODL_FILE_HXX_
#include <osl/file.hxx>
-#endif
+using namespace rtl;
+using namespace osl;
+using namespace store;
#if defined ( GCC ) && ( defined ( SCO ) )
sal_helper::ORealDynamicLoader* sal_helper::ODynamicLoader<RegistryTypeReader_Api>::m_pLoader = NULL;
@@ -467,11 +457,9 @@ ORegistry::ORegistry()
//
ORegistry::~ORegistry()
{
- if (m_openKeyTable.count(ROOT) > 0)
- {
- m_openKeyTable[ROOT]->release();
- delete(m_openKeyTable[ROOT]);
- }
+ ORegKey* pRootKey = m_openKeyTable[ROOT];
+ if (pRootKey != 0)
+ (void) releaseKey(pRootKey);
if (m_file.isValid())
m_file.close();
@@ -546,8 +534,7 @@ RegError ORegistry::closeRegistry()
if (m_file.isValid())
{
- closeKey(m_openKeyTable[ROOT]);
- m_file.flush();
+ (void) releaseKey(m_openKeyTable[ROOT]);
m_file.close();
m_isOpen = sal_False;
return REG_NO_ERROR;
@@ -595,7 +582,7 @@ RegError ORegistry::destroyRegistry(const OUString& regName)
if (m_file.isValid())
{
- closeKey(m_openKeyTable[ROOT]);
+ releaseKey(m_openKeyTable[ROOT]);
m_file.close();
m_isOpen = sal_False;
@@ -621,6 +608,39 @@ RegError ORegistry::destroyRegistry(const OUString& regName)
}
//*********************************************************************
+// acquireKey
+//
+RegError ORegistry::acquireKey (RegKeyHandle hKey)
+{
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
+
+ REG_GUARD(m_mutex);
+ pKey->acquire();
+
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
+// releaseKey
+//
+RegError ORegistry::releaseKey (RegKeyHandle hKey)
+{
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
+
+ REG_GUARD(m_mutex);
+ if (pKey->release() == 0)
+ {
+ m_openKeyTable.erase(pKey->getName());
+ delete pKey;
+ }
+ return REG_NO_ERROR;
+}
+
+//*********************************************************************
// createKey
//
RegError ORegistry::createKey(RegKeyHandle hKey, const OUString& keyName,
@@ -718,6 +738,7 @@ RegError ORegistry::openKey(RegKeyHandle hKey, const OUString& keyName,
default:
break;
}
+
std::auto_ptr< ORegKey > p(new ORegKey(path, this));
i = m_openKeyTable.insert(std::make_pair(path, p.get())).first;
p.release();
@@ -734,56 +755,51 @@ RegError ORegistry::openKey(RegKeyHandle hKey, const OUString& keyName,
//
RegError ORegistry::closeKey(RegKeyHandle hKey)
{
- ORegKey* pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
REG_GUARD(m_mutex);
- if (m_openKeyTable.count(pKey->getName()) > 0)
+ OUString const aKeyName (pKey->getName());
+ if (!(m_openKeyTable.count(aKeyName) > 0))
+ return REG_KEY_NOT_OPEN;
+
+ if (pKey->isModified())
{
- if (pKey->getRefCount() == 1)
+ ORegKey * pRootKey = getRootKey();
+ if (pKey != pRootKey)
{
- m_openKeyTable.erase(pKey->getName());
- delete(pKey);
- hKey = NULL;
- } else
+ // propagate "modified" state to RootKey.
+ pRootKey->setModified();
+ }
+ else
{
- pKey->release();
+ // closing modified RootKey, flush registry file.
+ OSL_TRACE("registry::ORegistry::closeKey(): flushing modified RootKey");
+ (void) m_file.flush();
}
-
- return REG_NO_ERROR;
- } else
- {
- return REG_KEY_NOT_OPEN;
+ pKey->setModified(false);
+ (void) releaseKey(pRootKey);
}
-}
+ return releaseKey(pKey);
+}
//*********************************************************************
// deleteKey
//
RegError ORegistry::deleteKey(RegKeyHandle hKey, const OUString& keyName)
{
- ORegKey* pKey;
- RegError _ret = REG_NO_ERROR;
-
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
if ( !keyName.getLength() )
- {
return REG_INVALID_KEYNAME;
- }
REG_GUARD(m_mutex);
- if (hKey)
- pKey = (ORegKey*)hKey;
- else
+ if (!pKey)
pKey = m_openKeyTable[ROOT];
- OUString sFullKeyName = pKey->getFullPath(keyName);
-
- pKey = m_openKeyTable[ROOT];
- _ret = eraseKey(pKey, sFullKeyName);
-
- return _ret;
+ OUString sFullKeyName(pKey->getFullPath(keyName));
+ return eraseKey(m_openKeyTable[ROOT], sFullKeyName);
}
RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName)
@@ -822,17 +838,15 @@ RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName)
sFullPath += ROOT;
}
- RegKeyHandle hOldKey;
- _ret = pKey->openKey(keyName, &hOldKey);
- if (_ret)
- {
+ ORegKey* pOldKey = 0;
+ _ret = pKey->openKey(keyName, (RegKeyHandle*)&pOldKey);
+ if (_ret != REG_NO_ERROR)
return _ret;
- }
- _ret = deleteSubkeysAndValues((ORegKey*)hOldKey);
- if (_ret)
+ _ret = deleteSubkeysAndValues(pOldKey);
+ if (_ret != REG_NO_ERROR)
{
- pKey->closeKey(hOldKey);
+ pKey->closeKey(pOldKey);
return _ret;
}
@@ -840,47 +854,39 @@ RegError ORegistry::eraseKey(ORegKey* pKey, const OUString& keyName)
tmpName += ROOT;
OStoreFile sFile(pKey->getStoreFile());
-
if ( sFile.isValid() && sFile.remove(sFullPath, tmpName) )
{
return REG_DELETE_KEY_FAILED;
}
- //sFile.flush();
+ pOldKey->setModified();
// set flag deleted !!!
- ((ORegKey*)hOldKey)->setDeleted(sal_True);
+ pOldKey->setDeleted(sal_True);
- _ret = pKey->closeKey(hOldKey);
- if (_ret)
- {
- return _ret;
- }
-
- return REG_NO_ERROR;
+ return pKey->closeKey(pOldKey);
}
-
//*********************************************************************
-// deleteSubKeys
+// deleteSubKeysAndValues
//
RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey)
{
OStoreDirectory::iterator iter;
- OUString keyName;
RegError _ret = REG_NO_ERROR;
OStoreDirectory rStoreDir(pKey->getStoreDir());
storeError _err = rStoreDir.first(iter);
while ( _err == store_E_None )
{
- keyName = iter.m_pszName;
+ OUString const keyName = iter.m_pszName;
if (iter.m_nAttrib & STORE_ATTRIB_ISDIR)
{
_ret = eraseKey(pKey, keyName);
if (_ret)
return _ret;
- } else
+ }
+ else
{
OUString sFullPath(pKey->getName());
@@ -891,7 +897,7 @@ RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey)
{
return REG_DELETE_VALUE_FAILED;
}
- //((OStoreFile&)pKey->getStoreFile()).flush();
+ pKey->setModified();
}
_err = rStoreDir.next(iter);
@@ -907,119 +913,99 @@ RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey)
RegError ORegistry::loadKey(RegKeyHandle hKey, const OUString& regFileName,
sal_Bool bWarnings, sal_Bool bReport)
{
- RegError _ret = REG_NO_ERROR;
- ORegistry* pReg;
- ORegKey *pKey, *pRootKey;
+ RegError _ret = REG_NO_ERROR;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
- pReg = new ORegistry();
+ std::auto_ptr< ORegistry > pReg (new ORegistry());
_ret = pReg->initRegistry(regFileName, REG_READONLY);
- if (_ret)
- {
+ if (_ret != REG_NO_ERROR)
return _ret;
- }
-
- pKey = (ORegKey*)hKey;
- pRootKey = pReg->getRootKey();
+ ORegKey* pRootKey = pReg->getRootKey();
REG_GUARD(m_mutex);
OStoreDirectory::iterator iter;
- OUString keyName;
OStoreDirectory rStoreDir(pRootKey->getStoreDir());
storeError _err = rStoreDir.first(iter);
while ( _err == store_E_None )
{
- keyName = iter.m_pszName;
+ OUString const keyName = iter.m_pszName;
if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR )
{
_ret = loadAndSaveKeys(pKey, pRootKey, keyName, 0, bWarnings, bReport);
- } else
+ }
+ else
{
_ret = loadAndSaveValue(pKey, pRootKey, keyName, 0, bWarnings, bReport);
}
- if (_ret == REG_MERGE_ERROR ||
- (_ret == REG_MERGE_CONFLICT && bWarnings))
- {
- rStoreDir = OStoreDirectory();
- pRootKey->release();
- delete(pReg);
- return _ret;
- }
+ if (_ret == REG_MERGE_ERROR)
+ break;
+ if (_ret == REG_MERGE_CONFLICT && bWarnings)
+ break;
_err = rStoreDir.next(iter);
}
rStoreDir = OStoreDirectory();
- pRootKey->release();
- delete(pReg);
+ (void) pReg->releaseKey(pRootKey);
return _ret;
}
//*********************************************************************
-// loadKey
+// saveKey
//
RegError ORegistry::saveKey(RegKeyHandle hKey, const OUString& regFileName,
sal_Bool bWarnings, sal_Bool bReport)
{
- RegError _ret = REG_NO_ERROR;
- ORegistry* pReg;
- ORegKey *pKey, *pRootKey;
+ RegError _ret = REG_NO_ERROR;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
- pReg = new ORegistry();
+ std::auto_ptr< ORegistry > pReg (new ORegistry());
_ret = pReg->initRegistry(regFileName, REG_CREATE);
- if (_ret)
- {
+ if (_ret != REG_NO_ERROR)
return _ret;
- }
-
- pKey = (ORegKey*)hKey;
- pRootKey = pReg->getRootKey();
+ ORegKey* pRootKey = pReg->getRootKey();
REG_GUARD(m_mutex);
OStoreDirectory::iterator iter;
- OUString keyName;
OStoreDirectory rStoreDir(pKey->getStoreDir());
storeError _err = rStoreDir.first(iter);
while ( _err == store_E_None )
{
- keyName = iter.m_pszName;
+ OUString const keyName = iter.m_pszName;
if ( iter.m_nAttrib & STORE_ATTRIB_ISDIR )
{
_ret = loadAndSaveKeys(pRootKey, pKey, keyName,
pKey->getName().getLength(),
bWarnings, bReport);
- } else
+ }
+ else
{
_ret = loadAndSaveValue(pRootKey, pKey, keyName,
pKey->getName().getLength(),
bWarnings, bReport);
}
- if (_ret)
- {
- pRootKey->release();
- delete(pReg);
- return _ret;
- }
+ if (_ret != REG_NO_ERROR)
+ break;
_err = rStoreDir.next(iter);
}
- pRootKey->release();
- delete(pReg);
- return REG_NO_ERROR;
+ (void) pReg->releaseKey(pRootKey);
+ return _ret;
}
//*********************************************************************
-// loadValue()
+// loadAndSaveValue()
//
RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey,
ORegKey* pSourceKey,
@@ -1062,7 +1048,6 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey,
{
return REG_VALUE_NOT_EXISTS;
}
- //pSourceKey->getStoreFile().flush();
pBuffer = (sal_uInt8*)rtl_allocateMemory(VALUE_HEADERSIZE);
@@ -1134,13 +1119,13 @@ RegError ORegistry::loadAndSaveValue(ORegKey* pTargetKey,
rtl_freeMemory(pBuffer);
return REG_INVALID_VALUE;
}
- //rTargetFile.flush();
if (rwBytes != nSize)
{
rtl_freeMemory(pBuffer);
return REG_INVALID_VALUE;
}
+ pTargetKey->setModified();
rtl_freeMemory(pBuffer);
return _ret;
@@ -1354,7 +1339,7 @@ RegError ORegistry::mergeModuleValue(OStoreStream& rTargetValue,
}
//*********************************************************************
-// loadKeys()
+// loadAndSaveKeys()
//
RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey,
ORegKey* pSourceKey,
@@ -1363,7 +1348,6 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey,
sal_Bool bWarnings,
sal_Bool bReport)
{
- ORegKey* pTmpKey;
RegError _ret = REG_NO_ERROR;
OUString sRelPath(pSourceKey->getName().copy(nCut));
OUString sFullPath;
@@ -1374,11 +1358,10 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey,
if (sRelPath.getLength() > 1 || sFullPath.getLength() == 0)
sFullPath += ROOT;
- OUString sFullKeyName = sFullPath;
- OStoreDirectory rStoreDir;
-
+ OUString sFullKeyName = sFullPath;
sFullKeyName += keyName;
+ OStoreDirectory rStoreDir;
if (rStoreDir.create(pTargetKey->getStoreFile(), sFullPath, keyName, KEY_MODE_CREATE))
{
return REG_CREATE_KEY_FAILED;
@@ -1389,21 +1372,18 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey,
m_openKeyTable[sFullKeyName]->setDeleted(sal_False);
}
- _ret = pSourceKey->openKey(
- keyName, (RegKeyHandle*)&pTmpKey);
- if (_ret)
- {
+ ORegKey* pTmpKey = 0;
+ _ret = pSourceKey->openKey(keyName, (RegKeyHandle*)&pTmpKey);
+ if (_ret != REG_NO_ERROR)
return _ret;
- }
OStoreDirectory::iterator iter;
- OUString sName;
OStoreDirectory rTmpStoreDir(pTmpKey->getStoreDir());
storeError _err = rTmpStoreDir.first(iter);
while ( _err == store_E_None)
{
- sName = iter.m_pszName;
+ OUString const sName = iter.m_pszName;
if (iter.m_nAttrib & STORE_ATTRIB_ISDIR)
{
@@ -1415,17 +1395,15 @@ RegError ORegistry::loadAndSaveKeys(ORegKey* pTargetKey,
sName, nCut, bWarnings, bReport);
}
- if (_ret == REG_MERGE_ERROR ||
- (_ret == REG_MERGE_CONFLICT && bWarnings))
- {
- pSourceKey->closeKey(pTmpKey);
- return _ret;
- }
+ if (_ret == REG_MERGE_ERROR)
+ break;
+ if (_ret == REG_MERGE_CONFLICT && bWarnings)
+ break;
_err = rTmpStoreDir.next(iter);
}
- pSourceKey->closeKey(pTmpKey);
+ pSourceKey->releaseKey(pTmpKey);
return _ret;
}
@@ -1479,21 +1457,6 @@ RegError ORegistry::dumpRegistry(RegKeyHandle hKey) const
return REG_NO_ERROR;
}
-RegError ORegistry::flush()
-{
- REG_GUARD(m_mutex);
-
- if (m_file.isValid())
- {
- m_file.flush();
- return REG_NO_ERROR;
- } else
- {
- return REG_REGISTRY_NOT_EXISTS;
- }
-}
-
-
//*********************************************************************
// dumpValue()
//
diff --git a/registry/source/regimpl.hxx b/registry/source/regimpl.hxx
index 739ca57b73d1..7523bb586749 100644
--- a/registry/source/regimpl.hxx
+++ b/registry/source/regimpl.hxx
@@ -29,10 +29,10 @@
#define _REGIMPL_HXX_
#include <set>
-
#include <hash_map>
#include <registry/registry.h>
+#include <rtl/ustring.hxx>
#include <osl/mutex.hxx>
#include <store/store.hxx>
@@ -59,11 +59,10 @@
#define REG_CREATE 0x0004 // allow write accesses
#define REG_GUARD(mutex) \
- Guard< Mutex > aGuard( mutex );
+ osl::Guard< osl::Mutex > aGuard( mutex );
-using namespace rtl;
-using namespace osl;
-using namespace store;
+// @@@ using namespace rtl;
+// @@@ using namespace osl;
class ORegKey;
class RegistryTypeReader;
@@ -79,39 +78,40 @@ public:
sal_uInt32 release()
{ return --m_refCount; }
- RegError initRegistry(const OUString& name,
+ RegError initRegistry(const rtl::OUString& name,
RegAccessMode accessMode);
RegError closeRegistry();
- RegError destroyRegistry(const OUString& name);
+ RegError destroyRegistry(const rtl::OUString& name);
+
+ RegError acquireKey(RegKeyHandle hKey);
+ RegError releaseKey(RegKeyHandle hKey);
RegError createKey(RegKeyHandle hKey,
- const OUString& keyName,
+ const rtl::OUString& keyName,
RegKeyHandle* phNewKey);
RegError openKey(RegKeyHandle hKey,
- const OUString& keyName,
+ const rtl::OUString& keyName,
RegKeyHandle* phOpenKey);
RegError closeKey(RegKeyHandle hKey);
- RegError deleteKey(RegKeyHandle hKey, const OUString& keyName);
+ RegError deleteKey(RegKeyHandle hKey, const rtl::OUString& keyName);
RegError loadKey(RegKeyHandle hKey,
- const OUString& regFileName,
+ const rtl::OUString& regFileName,
sal_Bool bWarings=sal_False,
sal_Bool bReport=sal_False);
RegError saveKey(RegKeyHandle hKey,
- const OUString& regFileName,
+ const rtl::OUString& regFileName,
sal_Bool bWarings=sal_False,
sal_Bool bReport=sal_False);
RegError dumpRegistry(RegKeyHandle hKey) const;
- RegError flush();
-
~ORegistry();
sal_Bool isReadOnly() const
@@ -122,62 +122,62 @@ public:
ORegKey* getRootKey();
- const OStoreFile& getStoreFile()
+ const store::OStoreFile& getStoreFile()
{ return m_file; }
- const OUString& getName() const
+ const rtl::OUString& getName() const
{ return m_name; }
friend class ORegKey;
private:
- RegError eraseKey(ORegKey* pKey, const OUString& keyName);
+ RegError eraseKey(ORegKey* pKey, const rtl::OUString& keyName);
RegError deleteSubkeysAndValues(ORegKey* pKey);
RegError loadAndSaveValue(ORegKey* pTargetKey,
ORegKey* pSourceKey,
- const OUString& valueName,
+ const rtl::OUString& valueName,
sal_uInt32 nCut,
sal_Bool bWarnings=sal_False,
sal_Bool bReport=sal_False);
- RegError checkBlop(OStoreStream& rValue,
- const OUString& sTargetPath,
+ RegError checkBlop(store::OStoreStream& rValue,
+ const rtl::OUString& sTargetPath,
sal_uInt32 srcValueSize,
sal_uInt8* pSrcBuffer,
sal_Bool bReport=sal_False);
- RegError mergeModuleValue(OStoreStream& rTargetValue,
+ RegError mergeModuleValue(store::OStoreStream& rTargetValue,
RegistryTypeReader& reader,
RegistryTypeReader& reader2);
RegError loadAndSaveKeys(ORegKey* pTargetKey,
ORegKey* pSourceKey,
- const OUString& keyName,
+ const rtl::OUString& keyName,
sal_uInt32 nCut,
sal_Bool bWarnings=sal_False,
sal_Bool bReport=sal_False);
- RegError dumpValue(const OUString& sPath,
- const OUString& sName,
+ RegError dumpValue(const rtl::OUString& sPath,
+ const rtl::OUString& sName,
sal_Int16 nSpace) const;
- RegError dumpKey(const OUString& sPath,
- const OUString& sName,
+ RegError dumpKey(const rtl::OUString& sPath,
+ const rtl::OUString& sName,
sal_Int16 nSpace) const;
- typedef std::hash_map< OUString, ORegKey*, OUStringHash > KeyMap;
+ typedef std::hash_map< rtl::OUString, ORegKey*, rtl::OUStringHash > KeyMap;
sal_uInt32 m_refCount;
- Mutex m_mutex;
+ osl::Mutex m_mutex;
sal_Bool m_readOnly;
sal_Bool m_isOpen;
- OUString m_name;
- OStoreFile m_file;
+ rtl::OUString m_name;
+ store::OStoreFile m_file;
KeyMap m_openKeyTable;
- const OUString ROOT;
+ const rtl::OUString ROOT;
};
#endif
diff --git a/registry/source/registry.cxx b/registry/source/registry.cxx
index aa7d7cedcc27..ea858f062f51 100644
--- a/registry/source/registry.cxx
+++ b/registry/source/registry.cxx
@@ -27,13 +27,13 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_registry.hxx"
+
#include <registry/registry.h>
#include <registry/registry.hxx>
#include <osl/process.h>
-#include "regimpl.hxx"
-#ifndef _REGKEY_HXX_
+
#include "keyimpl.hxx"
-#endif
+#include "regimpl.hxx"
#include "regkey.hxx"
#if defined(WIN32) || defined(WNT) || defined(OS2)
@@ -257,46 +257,42 @@ static RegError REGISTRY_CALLTYPE loadKey(RegHandle hReg,
rtl_uString* keyName,
rtl_uString* regFileName)
{
- ORegistry *pReg;
- ORegKey *pKey, *pNewKey;
- RegError _ret;
- if (hReg)
- {
- pReg = (ORegistry*)hReg;
- if (!pReg->isOpen())
- return REG_REGISTRY_NOT_OPEN;
- } else
- {
+ ORegistry* pReg = static_cast< ORegistry* >(hReg);
+ if (!pReg)
return REG_INVALID_REGISTRY;
- }
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ if (!pReg->isOpen())
+ return REG_REGISTRY_NOT_OPEN;
- if (pKey->getRegistry() != pReg || pKey->isDeleted())
- return REG_INVALID_KEY;
- } else
- {
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
return REG_INVALID_KEY;
- }
+ if (pKey->getRegistry() != pReg)
+ return REG_INVALID_KEY;
+ if (pKey->isDeleted())
+ return REG_INVALID_KEY;
if (pKey->isReadOnly())
return REG_REGISTRY_READONLY;
- if (!pKey->openKey(keyName, (RegKeyHandle*)&pNewKey))
+
+ ORegKey* pNewKey = 0;
+ RegError _ret = pKey->openKey(keyName, (RegKeyHandle*)&pNewKey);
+ if (_ret == REG_NO_ERROR)
{
- pKey->closeKey(pNewKey);
+ pKey->releaseKey(pNewKey);
pKey->deleteKey(keyName);
}
- if ((_ret = pKey->createKey(keyName, (RegKeyHandle*)&pNewKey)))
+ _ret = pKey->createKey(keyName, (RegKeyHandle*)&pNewKey);
+ if (_ret != REG_NO_ERROR)
return _ret;
- if ((_ret = pReg->loadKey(pNewKey, regFileName)))
+ _ret = pReg->loadKey(pNewKey, regFileName);
+ if (_ret != REG_NO_ERROR)
{
- pKey->closeKey(pNewKey);
+ pKey->releaseKey(pNewKey);
pKey->deleteKey(keyName);
return _ret;
}
@@ -312,41 +308,36 @@ static RegError REGISTRY_CALLTYPE saveKey(RegHandle hReg,
rtl_uString* keyName,
rtl_uString* regFileName)
{
- ORegistry *pReg;
- ORegKey *pKey, *pNewKey;
- RegError _ret;
- if (hReg)
- {
- pReg = (ORegistry*)hReg;
- if (!pReg->isOpen())
- return REG_REGISTRY_NOT_OPEN;
- } else
- {
+ ORegistry* pReg = static_cast< ORegistry* >(hReg);
+ if (!pReg)
return REG_INVALID_REGISTRY;
- }
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ if (!pReg->isOpen())
+ return REG_REGISTRY_NOT_OPEN;
- if (pKey->getRegistry() != pReg || pKey->isDeleted())
- return REG_INVALID_KEY;
- } else
- {
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
+
+ if (pKey->getRegistry() != pReg)
+ return REG_INVALID_KEY;
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
- }
- if ((_ret = pKey->openKey(keyName, (RegKeyHandle*)&pNewKey)))
+ ORegKey* pNewKey = 0;
+ RegError _ret = pKey->openKey(keyName, (RegKeyHandle*)&pNewKey);
+ if (_ret != REG_NO_ERROR)
return _ret;
- if ((_ret = pReg->saveKey(pNewKey, regFileName)))
+ _ret = pReg->saveKey(pNewKey, regFileName);
+ if (_ret != REG_NO_ERROR)
{
- pKey->closeKey(pNewKey);
+ (void) pKey->releaseKey(pNewKey);
return _ret;
}
- return pKey->closeKey(pNewKey);
+ return pKey->releaseKey(pNewKey);
}
//*********************************************************************
@@ -359,114 +350,68 @@ static RegError REGISTRY_CALLTYPE mergeKey(RegHandle hReg,
sal_Bool bWarnings,
sal_Bool bReport)
{
- ORegistry *pReg;
- ORegKey *pKey, *pNewKey;
- RegError _ret;
-
- if (hReg)
- {
- pReg = (ORegistry*)hReg;
- if (!pReg->isOpen())
- return(REG_REGISTRY_NOT_OPEN);
- } else
- {
+ ORegistry* pReg = static_cast< ORegistry* >(hReg);
+ if (!pReg)
return REG_INVALID_REGISTRY;
- }
-
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ if (!pReg->isOpen())
+ return REG_REGISTRY_NOT_OPEN;
- if (pKey->getRegistry() != pReg || pKey->isDeleted())
- return REG_INVALID_KEY;
- } else
- {
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
+ if (pKey->getRegistry() != pReg)
+ return REG_INVALID_KEY;
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
- }
-
if (pKey->isReadOnly())
return REG_REGISTRY_READONLY;
if (keyName->length)
{
- if ((_ret = pKey->createKey(keyName, (RegKeyHandle*)&pNewKey) ))
+ ORegKey* pNewKey = 0;
+ RegError _ret = pKey->createKey(keyName, (RegKeyHandle*)&pNewKey);
+ if (_ret != REG_NO_ERROR)
return _ret;
- } else
- {
- pNewKey = pKey;
- }
-
- _ret = pKey->getRegistry()->loadKey(pNewKey, regFileName, bWarnings, bReport);
-
- if (_ret == REG_MERGE_ERROR ||
- (_ret == REG_MERGE_CONFLICT && bWarnings))
- {
- pKey->closeKey(pNewKey);
- return _ret;
- }
- /*
- if (_ret)
- {
- if (_ret == REG_MERGE_ERROR ||
- (_ret == REG_MERGE_CONFLICT && bWarnings))
+ _ret = pReg->loadKey(pNewKey, regFileName, bWarnings, bReport);
+ if (_ret == REG_MERGE_ERROR || (_ret == REG_MERGE_CONFLICT && bWarnings))
{
- pKey->closeKey(pNewKey);
- pKey->deleteKey(keyName);
- pKey->createKey(keyName, (RegKeyHandle*)&pNewKey);
- pReg->loadKey(pNewKey, tmpName, sal_False, sal_False);
+ if (pNewKey != pKey)
+ (void) pKey->closeKey(pNewKey);
+ else
+ (void) pKey->releaseKey(pNewKey);
+ return _ret;
}
- destroyRegistry(hReg, tmpName);
-
- pKey->closeKey(pNewKey);
- return _ret;
+ return (pNewKey != pKey) ? pKey->closeKey(pNewKey) : pKey->releaseKey(pNewKey);
}
- destroyRegistry(hReg, tmpName);
- */
- _ret = pKey->closeKey(pNewKey);
-
- if (_ret == REG_NO_ERROR )
- _ret = pReg->flush();
- return _ret;
+ return pReg->loadKey(pKey, regFileName, bWarnings, bReport);
}
-
//*********************************************************************
// dumpRegistry
//
static RegError REGISTRY_CALLTYPE dumpRegistry(RegHandle hReg,
RegKeyHandle hKey)
{
- ORegistry *pReg;
- ORegKey *pKey;
-
- if (hReg)
- {
- pReg = (ORegistry*)hReg;
- if (!pReg->isOpen())
- return REG_REGISTRY_NOT_OPEN;
- } else
- {
+ ORegistry* pReg = static_cast< ORegistry* >(hReg);
+ if (!pReg)
return REG_INVALID_REGISTRY;
- }
-
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ if (!pReg->isOpen())
+ return REG_REGISTRY_NOT_OPEN;
- if (pKey->getRegistry() != pReg || pKey->isDeleted())
- return REG_INVALID_KEY;
- } else
- {
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
+ if (pKey->getRegistry() != pReg)
+ return REG_INVALID_KEY;
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
- }
return pReg->dumpRegistry(hKey);
}
-
//*********************************************************************
// initRegistry_Api
//
diff --git a/registry/source/regkey.cxx b/registry/source/regkey.cxx
index 61153ed15170..c65de7e3e2ca 100644
--- a/registry/source/regkey.cxx
+++ b/registry/source/regkey.cxx
@@ -29,21 +29,25 @@
#include "precompiled_registry.hxx"
#include "regkey.hxx"
+
#include <registry/registry.hxx>
#include <rtl/alloc.h>
#include "regimpl.hxx"
#include "keyimpl.hxx"
+using rtl::OUString;
//*********************************************************************
// acquireKey
//
void REGISTRY_CALLTYPE acquireKey(RegKeyHandle hKey)
{
- ORegKey* pKey = (ORegKey*) hKey;
-
- if (pKey != NULL)
- pKey->acquire();
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (pKey != 0)
+ {
+ ORegistry* pReg = pKey->getRegistry();
+ (void) pReg->acquireKey(pKey);
+ }
}
@@ -52,12 +56,11 @@ void REGISTRY_CALLTYPE acquireKey(RegKeyHandle hKey)
//
void REGISTRY_CALLTYPE releaseKey(RegKeyHandle hKey)
{
- ORegKey* pKey = (ORegKey*) hKey;
-
- if (pKey)
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (pKey != 0)
{
- if (pKey->release() == 0)
- delete pKey;
+ ORegistry* pReg = pKey->getRegistry();
+ (void) pReg->releaseKey(pKey);
}
}
@@ -67,13 +70,8 @@ void REGISTRY_CALLTYPE releaseKey(RegKeyHandle hKey)
//
sal_Bool REGISTRY_CALLTYPE isKeyReadOnly(RegKeyHandle hKey)
{
- if (hKey)
- {
- return ((ORegKey*)hKey)->isReadOnly();
- } else
- {
- return sal_False;
- }
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ return (pKey != 0) ? pKey->isReadOnly() : sal_False;
}
@@ -82,9 +80,10 @@ sal_Bool REGISTRY_CALLTYPE isKeyReadOnly(RegKeyHandle hKey)
//
RegError REGISTRY_CALLTYPE getKeyName(RegKeyHandle hKey, rtl_uString** pKeyName)
{
- if (hKey)
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (pKey)
{
- rtl_uString_assign( pKeyName, ((ORegKey*)hKey)->getName().pData );
+ rtl_uString_assign( pKeyName, pKey->getName().pData );
return REG_NO_ERROR;
} else
{
@@ -101,22 +100,14 @@ RegError REGISTRY_CALLTYPE createKey(RegKeyHandle hKey,
rtl_uString* keyName,
RegKeyHandle* phNewKey)
{
- ORegKey* pKey;
+ *phNewKey = 0;
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
- if (pKey->isDeleted())
- {
- phNewKey = NULL;
- return REG_INVALID_KEY;
- }
- } else
- {
- phNewKey = NULL;
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
- }
if (pKey->isReadOnly())
return REG_REGISTRY_READONLY;
@@ -131,22 +122,14 @@ RegError REGISTRY_CALLTYPE openKey(RegKeyHandle hKey,
rtl_uString* keyName,
RegKeyHandle* phOpenKey)
{
- ORegKey* pKey;
+ *phOpenKey = 0;
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
- if (pKey->isDeleted())
- {
- phOpenKey = NULL;
- return REG_INVALID_KEY;
- }
- } else
- {
- phOpenKey = NULL;
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
- }
return pKey->openKey(keyName, phOpenKey);
}
@@ -159,24 +142,15 @@ RegError REGISTRY_CALLTYPE openSubKeys(RegKeyHandle hKey,
RegKeyHandle** pphSubKeys,
sal_uInt32* pnSubKeys)
{
- ORegKey* pKey;
+ *pphSubKeys = NULL;
+ *pnSubKeys = 0;
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
- if (pKey->isDeleted())
- {
- *pphSubKeys = NULL;
- *pnSubKeys = 0;
- return REG_INVALID_KEY;
- }
- } else
- {
- *pphSubKeys = NULL;
- *pnSubKeys = 0;
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
- }
return pKey->openSubKeys(keyName, pphSubKeys, pnSubKeys);
}
@@ -187,43 +161,30 @@ RegError REGISTRY_CALLTYPE openSubKeys(RegKeyHandle hKey,
RegError REGISTRY_CALLTYPE closeSubKeys(RegKeyHandle* phSubKeys,
sal_uInt32 nSubKeys)
{
- RegError _ret = REG_NO_ERROR;
+ if (phSubKeys == 0 || nSubKeys == 0)
+ return REG_INVALID_KEY;
- if (phSubKeys != 0 && nSubKeys != 0)
+ ORegistry* pReg = ((ORegKey*)(phSubKeys[0]))->getRegistry();
+ for (sal_uInt32 i = 0; i < nSubKeys; i++)
{
- ORegistry* pReg = NULL;
-
- pReg = ((ORegKey*)phSubKeys[0])->getRegistry();
-
- for (sal_uInt32 i=0; (i < nSubKeys) && (_ret == REG_NO_ERROR); i++)
- {
- _ret = pReg->closeKey(phSubKeys[i]);
- }
-
- rtl_freeMemory(phSubKeys);
+ (void) pReg->closeKey(phSubKeys[i]);
}
- else
- _ret = REG_INVALID_KEY;
+ rtl_freeMemory(phSubKeys);
- return _ret;
+ return REG_NO_ERROR;
}
-
//*********************************************************************
// deleteKey
//
RegError REGISTRY_CALLTYPE deleteKey(RegKeyHandle hKey,
rtl_uString* keyName)
{
- ORegKey* pKey;
-
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
- if (pKey->isDeleted())
- return REG_INVALID_KEY;
- } else
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
if (pKey->isReadOnly())
@@ -237,24 +198,13 @@ RegError REGISTRY_CALLTYPE deleteKey(RegKeyHandle hKey,
//
RegError REGISTRY_CALLTYPE closeKey(RegKeyHandle hKey)
{
- ORegKey* pKey;
- ORegistry* pReg;
-
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
-
- pReg = pKey->getRegistry();
-
- if (pReg->closeKey(hKey))
- return REG_INVALID_KEY;
- } else
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
return REG_INVALID_KEY;
- return REG_NO_ERROR;
+ return pKey->closeKey(hKey);
}
-
//*********************************************************************
// setValue
//
@@ -264,15 +214,11 @@ RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey,
RegValue pData,
sal_uInt32 valueSize)
{
- ORegKey* pKey;
-
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
- if (pKey->isDeleted())
- return REG_INVALID_KEY;
- } else
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
if (pKey->isReadOnly())
@@ -281,24 +227,22 @@ RegError REGISTRY_CALLTYPE setValue(RegKeyHandle hKey,
OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
if (keyName->length)
{
- RegKeyHandle hSubKey;
- ORegKey* pSubKey;
- RegError _ret1 = pKey->openKey(keyName, &hSubKey);
- if (_ret1)
+ ORegKey* pSubKey = 0;
+ RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ if (_ret1 != REG_NO_ERROR)
return _ret1;
- pSubKey = (ORegKey*)hSubKey;
_ret1 = pSubKey->setValue(valueName, valueType, pData, valueSize);
- if (_ret1)
+ if (_ret1 != REG_NO_ERROR)
{
- RegError _ret2 = pKey->closeKey(hSubKey);
+ RegError _ret2 = pKey->closeKey(pSubKey);
if (_ret2)
return _ret2;
else
return _ret1;
}
- return pKey->closeKey(hSubKey);
+ return pKey->closeKey(pSubKey);
}
return pKey->setValue(valueName, valueType, pData, valueSize);
@@ -312,15 +256,11 @@ RegError REGISTRY_CALLTYPE setLongListValue(RegKeyHandle hKey,
sal_Int32* pValueList,
sal_uInt32 len)
{
- ORegKey* pKey;
-
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
- if (pKey->isDeleted())
- return REG_INVALID_KEY;
- } else
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
if (pKey->isReadOnly())
@@ -329,24 +269,22 @@ RegError REGISTRY_CALLTYPE setLongListValue(RegKeyHandle hKey,
OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
if (keyName->length)
{
- RegKeyHandle hSubKey;
- ORegKey* pSubKey;
- RegError _ret1 = pKey->openKey(keyName, &hSubKey);
- if (_ret1)
+ ORegKey* pSubKey = 0;
+ RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ if (_ret1 != REG_NO_ERROR)
return _ret1;
- pSubKey = (ORegKey*)hSubKey;
_ret1 = pSubKey->setLongListValue(valueName, pValueList, len);
- if (_ret1)
+ if (_ret1 != REG_NO_ERROR)
{
- RegError _ret2 = pKey->closeKey(hSubKey);
- if (_ret2)
+ RegError _ret2 = pKey->closeKey(pSubKey);
+ if (_ret2 != REG_NO_ERROR)
return _ret2;
else
return _ret1;
}
- return pKey->closeKey(hSubKey);
+ return pKey->closeKey(pSubKey);
}
return pKey->setLongListValue(valueName, pValueList, len);
@@ -360,15 +298,11 @@ RegError REGISTRY_CALLTYPE setStringListValue(RegKeyHandle hKey,
sal_Char** pValueList,
sal_uInt32 len)
{
- ORegKey* pKey;
-
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
- if (pKey->isDeleted())
- return REG_INVALID_KEY;
- } else
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
if (pKey->isReadOnly())
@@ -377,24 +311,22 @@ RegError REGISTRY_CALLTYPE setStringListValue(RegKeyHandle hKey,
OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
if (keyName->length)
{
- RegKeyHandle hSubKey;
- ORegKey* pSubKey;
- RegError _ret1 = pKey->openKey(keyName, &hSubKey);
- if (_ret1)
+ ORegKey* pSubKey = 0;
+ RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ if (_ret1 != REG_NO_ERROR)
return _ret1;
- pSubKey = (ORegKey*)hSubKey;
_ret1 = pSubKey->setStringListValue(valueName, pValueList, len);
- if (_ret1)
+ if (_ret1 != REG_NO_ERROR)
{
- RegError _ret2 = pKey->closeKey(hSubKey);
- if (_ret2)
+ RegError _ret2 = pKey->closeKey(pSubKey);
+ if (_ret2 != REG_NO_ERROR)
return _ret2;
else
return _ret1;
}
- return pKey->closeKey(hSubKey);
+ return pKey->closeKey(pSubKey);
}
return pKey->setStringListValue(valueName, pValueList, len);
@@ -408,15 +340,11 @@ RegError REGISTRY_CALLTYPE setUnicodeListValue(RegKeyHandle hKey,
sal_Unicode** pValueList,
sal_uInt32 len)
{
- ORegKey* pKey;
-
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
- if (pKey->isDeleted())
- return REG_INVALID_KEY;
- } else
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
if (pKey->isReadOnly())
@@ -425,24 +353,22 @@ RegError REGISTRY_CALLTYPE setUnicodeListValue(RegKeyHandle hKey,
OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
if (keyName->length)
{
- RegKeyHandle hSubKey;
- ORegKey* pSubKey;
- RegError _ret1 = pKey->openKey(keyName, &hSubKey);
- if (_ret1)
+ ORegKey* pSubKey = 0;
+ RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ if (_ret1 != REG_NO_ERROR)
return _ret1;
- pSubKey = (ORegKey*)hSubKey;
_ret1 = pSubKey->setUnicodeListValue(valueName, pValueList, len);
- if (_ret1)
+ if (_ret1 != REG_NO_ERROR)
{
- RegError _ret2 = pKey->closeKey(hSubKey);
- if (_ret2)
+ RegError _ret2 = pKey->closeKey(pSubKey);
+ if (_ret2 != REG_NO_ERROR)
return _ret2;
else
return _ret1;
}
- return pKey->closeKey(hSubKey);
+ return pKey->closeKey(pSubKey);
}
return pKey->setUnicodeListValue(valueName, pValueList, len);
@@ -456,49 +382,41 @@ RegError REGISTRY_CALLTYPE getValueInfo(RegKeyHandle hKey,
RegValueType* pValueType,
sal_uInt32* pValueSize)
{
- ORegKey* pKey;
- RegValueType valueType;
- sal_uInt32 valueSize;
-
*pValueType = RG_VALUETYPE_NOT_DEFINED;
*pValueSize = 0;
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
- if (pKey->isDeleted())
- return REG_INVALID_KEY;
- } else
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
+ RegValueType valueType;
+ sal_uInt32 valueSize;
+
OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
if (keyName->length)
{
- RegKeyHandle hSubKey;
- ORegKey* pSubKey;
- RegError _ret = pKey->openKey(keyName, &hSubKey);
- if (_ret)
+ ORegKey* pSubKey = 0;
+ RegError _ret = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ if (_ret != REG_NO_ERROR)
return _ret;
- pSubKey = (ORegKey*)hSubKey;
- if (pSubKey->getValueInfo(valueName, &valueType, &valueSize))
+ if (pSubKey->getValueInfo(valueName, &valueType, &valueSize) != REG_NO_ERROR)
{
- _ret = pKey->closeKey(hSubKey);
- if (_ret)
- return _ret;
- else
- return REG_INVALID_VALUE;
+ (void) pKey->releaseKey(pSubKey);
+ return REG_INVALID_VALUE;
}
*pValueType = valueType;
*pValueSize = valueSize;
- return pKey->closeKey(hSubKey);
+ return pKey->releaseKey(pSubKey);
}
- if (pKey->getValueInfo(valueName, &valueType, &valueSize))
+ if (pKey->getValueInfo(valueName, &valueType, &valueSize) != REG_NO_ERROR)
{
return REG_INVALID_VALUE;
}
@@ -516,52 +434,29 @@ RegError REGISTRY_CALLTYPE getValue(RegKeyHandle hKey,
rtl_uString* keyName,
RegValue pValue)
{
- ORegKey* pKey;
-
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
- if (pKey->isDeleted())
- {
- pValue = NULL;
- return REG_INVALID_KEY;
- }
- } else
- {
- pValue = NULL;
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
- }
OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
if (keyName->length)
{
- RegKeyHandle hSubKey;
- ORegKey* pSubKey;
- RegError _ret1 = pKey->openKey(keyName, &hSubKey);
- if (_ret1)
- {
- pValue = NULL;
+ ORegKey* pSubKey = 0;
+ RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ if (_ret1 != REG_NO_ERROR)
return _ret1;
- }
- pSubKey = (ORegKey*)hSubKey;
_ret1 = pSubKey->getValue(valueName, pValue);
- if (_ret1)
+ if (_ret1 != REG_NO_ERROR)
{
- RegError _ret2 = pKey->closeKey(hSubKey);
- if (_ret2)
- {
- pValue = NULL;
- return _ret2;
- } else
- {
- pValue = NULL;
- return _ret1;
- }
+ (void) pKey->releaseKey(pSubKey);
+ return _ret1;
}
- return pKey->closeKey(hSubKey);
+ return pKey->releaseKey(pSubKey);
}
return pKey->getValue(valueName, pValue);
@@ -575,58 +470,32 @@ RegError REGISTRY_CALLTYPE getLongListValue(RegKeyHandle hKey,
sal_Int32** pValueList,
sal_uInt32* pLen)
{
- ORegKey* pKey;
+ OSL_PRECOND((pValueList != 0) && (pLen != 0), "registry::getLongListValue(): invalid parameter");
+ *pValueList = 0, *pLen = 0;
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
- if (pKey->isDeleted())
- {
- pValueList = NULL;
- *pLen = 0;
- return REG_INVALID_KEY;
- }
- } else
- {
- pValueList = NULL;
- *pLen = 0;
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
- }
OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
if (keyName->length)
{
- RegKeyHandle hSubKey;
- ORegKey* pSubKey;
- RegError _ret1 = pKey->openKey(keyName, &hSubKey);
- if (_ret1)
- {
- pValueList = NULL;
- *pLen = 0;
+ ORegKey* pSubKey = 0;
+ RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ if (_ret1 != REG_NO_ERROR)
return _ret1;
- }
-
- pSubKey = (ORegKey*)hSubKey;
_ret1 = pSubKey->getLongListValue(valueName, pValueList, pLen);
- if (_ret1)
+ if (_ret1 != REG_NO_ERROR)
{
- RegError _ret2 = pKey->closeKey(hSubKey);
- if (_ret2)
- {
- pValueList = NULL;
- *pLen = 0;
- return _ret2;
- } else
- {
- pValueList = NULL;
- *pLen = 0;
- return _ret1;
- }
+ (void) pKey->releaseKey(pSubKey);
+ return _ret1;
}
- return pKey->closeKey(hSubKey);
+ return pKey->releaseKey(pSubKey);
}
return pKey->getLongListValue(valueName, pValueList, pLen);
@@ -640,58 +509,32 @@ RegError REGISTRY_CALLTYPE getStringListValue(RegKeyHandle hKey,
sal_Char*** pValueList,
sal_uInt32* pLen)
{
- ORegKey* pKey;
+ OSL_PRECOND((pValueList != 0) && (pLen != 0), "registry::getStringListValue(): invalid parameter");
+ *pValueList = 0, *pLen = 0;
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
- if (pKey->isDeleted())
- {
- pValueList = NULL;
- *pLen = 0;
- return REG_INVALID_KEY;
- }
- } else
- {
- pValueList = NULL;
- *pLen = 0;
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
- }
OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
if (keyName->length)
{
- RegKeyHandle hSubKey;
- ORegKey* pSubKey;
- RegError _ret1 = pKey->openKey(keyName, &hSubKey);
- if (_ret1)
- {
- pValueList = NULL;
- *pLen = 0;
+ ORegKey* pSubKey = 0;
+ RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ if (_ret1 != REG_NO_ERROR)
return _ret1;
- }
-
- pSubKey = (ORegKey*)hSubKey;
_ret1 = pSubKey->getStringListValue(valueName, pValueList, pLen);
- if (_ret1)
+ if (_ret1 != REG_NO_ERROR)
{
- RegError _ret2 = pKey->closeKey(hSubKey);
- if (_ret2)
- {
- pValueList = NULL;
- *pLen = 0;
- return _ret2;
- } else
- {
- pValueList = NULL;
- *pLen = 0;
- return _ret1;
- }
+ (void) pKey->releaseKey(pSubKey);
+ return _ret1;
}
- return pKey->closeKey(hSubKey);
+ return pKey->releaseKey(pSubKey);
}
return pKey->getStringListValue(valueName, pValueList, pLen);
@@ -705,58 +548,32 @@ RegError REGISTRY_CALLTYPE getUnicodeListValue(RegKeyHandle hKey,
sal_Unicode*** pValueList,
sal_uInt32* pLen)
{
- ORegKey* pKey;
+ OSL_PRECOND((pValueList != 0) && (pLen != 0), "registry::getUnicodeListValue(): invalid parameter");
+ *pValueList = 0, *pLen = 0;
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
- if (pKey->isDeleted())
- {
- pValueList = NULL;
- *pLen = 0;
- return REG_INVALID_KEY;
- }
- } else
- {
- pValueList = NULL;
- *pLen = 0;
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
- }
OUString valueName( RTL_CONSTASCII_USTRINGPARAM("value") );
if (keyName->length)
{
- RegKeyHandle hSubKey;
- ORegKey* pSubKey;
- RegError _ret1 = pKey->openKey(keyName, &hSubKey);
- if (_ret1)
- {
- pValueList = NULL;
- *pLen = 0;
+ ORegKey* pSubKey = 0;
+ RegError _ret1 = pKey->openKey(keyName, (RegKeyHandle*)&pSubKey);
+ if (_ret1 != REG_NO_ERROR)
return _ret1;
- }
-
- pSubKey = (ORegKey*)hSubKey;
_ret1 = pSubKey->getUnicodeListValue(valueName, pValueList, pLen);
- if (_ret1)
+ if (_ret1 != REG_NO_ERROR)
{
- RegError _ret2 = pKey->closeKey(hSubKey);
- if (_ret2)
- {
- pValueList = NULL;
- *pLen = 0;
- return _ret2;
- } else
- {
- pValueList = NULL;
- *pLen = 0;
- return _ret1;
- }
+ (void) pKey->releaseKey(pSubKey);
+ return _ret1;
}
- return pKey->closeKey(hSubKey);
+ return pKey->releaseKey(pSubKey);
}
return pKey->getUnicodeListValue(valueName, pValueList, pLen);
@@ -806,7 +623,6 @@ RegError REGISTRY_CALLTYPE freeValueList(RegValueType valueType,
return REG_NO_ERROR;
}
-
//*********************************************************************
// createLink
//
@@ -830,15 +646,11 @@ RegError REGISTRY_CALLTYPE getKeyType(RegKeyHandle hKey,
rtl_uString* keyName,
RegKeyType* pKeyType)
{
- ORegKey* pKey;
-
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
- if (pKey->isDeleted())
- return REG_INVALID_KEY;
- } else
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
return pKey->getKeyType(keyName, pKeyType);
@@ -861,26 +673,20 @@ RegError REGISTRY_CALLTYPE getResolvedKeyName(RegKeyHandle hKey,
sal_Bool,
rtl_uString** pResolvedName)
{
- ORegKey *pKey;
- RegError _ret = REG_NO_ERROR;
-
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
- if (pKey->isDeleted())
- return REG_INVALID_KEY;
- } else
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
OUString resolvedName;
- _ret = pKey->getResolvedKeyName(keyName, resolvedName);
- if (!_ret)
+ RegError _ret = pKey->getResolvedKeyName(keyName, resolvedName);
+ if (_ret == REG_NO_ERROR)
rtl_uString_assign(pResolvedName, resolvedName.pData);
return _ret;
}
-
//*********************************************************************
// getKeyNames
//
@@ -889,15 +695,11 @@ RegError REGISTRY_CALLTYPE getKeyNames(RegKeyHandle hKey,
rtl_uString*** pSubKeyNames,
sal_uInt32* pnSubKeys)
{
- ORegKey* pKey;
-
- if (hKey)
- {
- pKey = (ORegKey*)hKey;
+ ORegKey* pKey = static_cast< ORegKey* >(hKey);
+ if (!pKey)
+ return REG_INVALID_KEY;
- if (pKey->isDeleted())
- return REG_INVALID_KEY;
- } else
+ if (pKey->isDeleted())
return REG_INVALID_KEY;
return pKey->getKeyNames(keyName, pSubKeyNames, pnSubKeys);
@@ -1205,7 +1007,6 @@ RegError REGISTRY_CALLTYPE reg_getLinkTarget(RegKeyHandle hKey,
return getLinkTarget(hKey, linkName, pLinkTarget);
}
-
//*********************************************************************
// reg_getResolvedKeyName
//
@@ -1214,14 +1015,8 @@ RegError REGISTRY_CALLTYPE reg_getResolvedKeyName(RegKeyHandle hKey,
sal_Bool firstLinkOnly,
rtl_uString** pResolvedName)
{
- ORegKey *pKey;
-
- if (hKey)
- pKey = (ORegKey*)hKey;
- else
+ if (!hKey)
return REG_INVALID_KEY;
return getResolvedKeyName(hKey, keyName, firstLinkOnly, pResolvedName);
}
-
-
diff --git a/registry/tools/checksingleton.cxx b/registry/tools/checksingleton.cxx
index 7f5397b2d609..4353721ad0b0 100644
--- a/registry/tools/checksingleton.cxx
+++ b/registry/tools/checksingleton.cxx
@@ -27,6 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_registry.hxx"
+
#include <stdio.h>
#include <string.h>
@@ -452,10 +453,10 @@ int _cdecl main( int argc, char * argv[] )
sal_Bool bSingletonsExist = checkSingletons(singletonKey, typeKey);
- indexRoot.closeKey();
- typeRoot.closeKey();
- typeKey.closeKey();
- singletonKey.closeKey();
+ indexRoot.releaseKey();
+ typeRoot.releaseKey();
+ typeKey.releaseKey();
+ singletonKey.releaseKey();
if ( indexReg.close() )
{
fprintf(stderr, "%s: closing registry \"%s\" failed\n",
diff --git a/registry/tools/regcompare.cxx b/registry/tools/regcompare.cxx
index 44984454622f..4e95d884de30 100644
--- a/registry/tools/regcompare.cxx
+++ b/registry/tools/regcompare.cxx
@@ -27,6 +27,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_registry.hxx"
+
#include <stdio.h>
#include <string.h>
@@ -2273,8 +2274,8 @@ static sal_uInt32 compareKeys(RegistryKey& key1, RegistryKey& key2)
{
nError += compareKeys(subKey1, subKey2);
}
- subKey1.closeKey();
- subKey2.closeKey();
+ subKey1.releaseKey();
+ subKey2.releaseKey();
++iter;
}
@@ -2377,8 +2378,8 @@ int _cdecl main( int argc, char * argv[] )
}
}
- key1.closeKey();
- key2.closeKey();
+ key1.releaseKey();
+ key2.releaseKey();
if ( reg1.close() )
{
fprintf(stdout, "%s: closing registry \"%s\" failed\n",
diff --git a/registry/tools/regmerge.cxx b/registry/tools/regmerge.cxx
index 330a1f5c4b66..06786a9b993e 100644
--- a/registry/tools/regmerge.cxx
+++ b/registry/tools/regmerge.cxx
@@ -31,7 +31,7 @@
#include <stdio.h>
#include <string.h>
-#include "registry/registry.h"
+#include "registry/registry.hxx"
#include <rtl/ustring.hxx>
#include <rtl/alloc.h>
#include <osl/process.h>
@@ -204,9 +204,7 @@ int main( int argc, char * argv[] )
int _cdecl main( int argc, char * argv[] )
#endif
{
- RegHandle hReg;
- RegKeyHandle hRootKey;
- bool bVerbose = checkCommandArgs(argc, argv);
+ bool bVerbose = checkCommandArgs(argc, argv);
if (realargc < 4)
{
@@ -216,9 +214,11 @@ int _cdecl main( int argc, char * argv[] )
}
::rtl::OUString regName( convertToFileUrl(realargv[1]) );
- if (reg_openRegistry(regName.pData, &hReg, REG_READWRITE))
+
+ Registry reg;
+ if (reg.open(regName, REG_READWRITE) != REG_NO_ERROR)
{
- if (reg_createRegistry(regName.pData, &hReg))
+ if (reg.create(regName) != REG_NO_ERROR)
{
if (bVerbose)
fprintf(stderr, "open registry \"%s\" failed\n", realargv[1]);
@@ -227,17 +227,16 @@ int _cdecl main( int argc, char * argv[] )
}
}
- if (!reg_openRootKey(hReg, &hRootKey))
+ RegistryKey rootKey;
+ if (reg.openRootKey(rootKey) == REG_NO_ERROR)
{
::rtl::OUString mergeKeyName( ::rtl::OUString::createFromAscii(realargv[2]) );
::rtl::OUString targetRegName;
for (int i = 3; i < realargc; i++)
{
targetRegName = convertToFileUrl(realargv[i]);
- RegError _ret = reg_mergeKey(
- hRootKey, mergeKeyName.pData, targetRegName.pData, sal_False,
- bVerbose);
- if (_ret)
+ RegError _ret = reg.mergeKey(rootKey, mergeKeyName, targetRegName, sal_False, bVerbose);
+ if (_ret != REG_NO_ERROR)
{
if (_ret == REG_MERGE_CONFLICT)
{
@@ -259,13 +258,7 @@ int _cdecl main( int argc, char * argv[] )
}
}
- if (reg_closeKey(hRootKey))
- {
- if (bVerbose)
- fprintf(stderr, "closing root key of registry \"%s\" failed\n",
- realargv[1]);
- exit(-3);
- }
+ rootKey.releaseKey();
} else
{
if (bVerbose)
@@ -274,7 +267,7 @@ int _cdecl main( int argc, char * argv[] )
exit(-4);
}
- if (reg_closeRegistry(hReg))
+ if (reg.close() != REG_NO_ERROR)
{
if (bVerbose)
fprintf(stderr, "closing registry \"%s\" failed\n", realargv[1]);
diff --git a/sal/inc/osl/diagnose.hxx b/sal/inc/osl/diagnose.hxx
index 72883d994d4a..e7360e93349e 100644
--- a/sal/inc/osl/diagnose.hxx
+++ b/sal/inc/osl/diagnose.hxx
@@ -125,19 +125,17 @@ public:
VoidPointerSet::const_iterator iPos(m_data.m_addresses.begin());
VoidPointerSet::const_iterator const iEnd(m_data.m_addresses.end());
for ( ; iPos != iEnd; ++iPos ) {
- T const* pLeakingObj = static_cast<T const*>(*iPos);
- OSL_ASSERT( pLeakingObj != 0 );
- static_cast<void>(pLeakingObj);
+ OSL_ASSERT( *iPos != 0 );
}
}
return bRet;
}
- void registerObject( T const* pObj ) {
+ void registerObject( void const* pObj ) {
osl_detail_ObjectRegistry_registerObject(m_data, pObj);
}
- void revokeObject( T const* pObj ) {
+ void revokeObject( void const* pObj ) {
osl_detail_ObjectRegistry_revokeObject(m_data, pObj);
}
@@ -188,12 +186,10 @@ public:
protected:
DebugBase() {
- StaticObjectRegistry::get().registerObject(
- static_cast<InheritingClassT const*>(this) );
+ StaticObjectRegistry::get().registerObject( this );
}
~DebugBase() {
- StaticObjectRegistry::get().revokeObject(
- static_cast<InheritingClassT const*>(this) );
+ StaticObjectRegistry::get().revokeObject( this );
}
private:
diff --git a/sal/inc/osl/file.h b/sal/inc/osl/file.h
index 1320a6f68ae5..29196469fa61 100644
--- a/sal/inc/osl/file.h
+++ b/sal/inc/osl/file.h
@@ -811,6 +811,14 @@ oslFileError SAL_CALL osl_getFileSize( oslFileHandle Handle, sal_uInt64 *pSize )
*/
#define osl_File_MapFlag_RandomAccess ((sal_uInt32)(0x1))
+/** Map flag denoting that the mapped address space will be accessed by the
+ process soon (and it is advantageous for the operating system to already
+ start paging in the data).
+
+ @since UDK 3.2.12
+ */
+#define osl_File_MapFlag_WillNeed ((sal_uInt32)(0x2))
+
/** Map a shared file into memory.
@since UDK 3.2.10
diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx
index 216162e616d6..cc0c041bc328 100644
--- a/sal/osl/unx/file.cxx
+++ b/sal/osl/unx/file.cxx
@@ -1079,6 +1079,29 @@ SAL_CALL osl_mapFile (
}
}
}
+ if (uFlags & osl_File_MapFlag_WillNeed)
+ {
+ // On Linux, madvise(..., MADV_WILLNEED) appears to have the undesirable
+ // effect of not returning until the data has actually been paged in, so
+ // that its net effect would typically be to slow down the process
+ // (which could start processing at the beginning of the data while the
+ // OS simultaneously pages in the rest); on other platforms, it remains
+ // to be evaluated whether madvise or equivalent is available and
+ // actually useful:
+#if defined MACOSX
+ int e = posix_madvise(p, nLength, POSIX_MADV_WILLNEED);
+ if (e != 0)
+ {
+ OSL_TRACE(
+ "posix_madvise(..., POSIX_MADV_WILLNEED) failed with %d", e);
+ }
+#elif defined SOLARIS
+ if (madvise(static_cast< caddr_t >(p), nLength, MADV_WILLNEED) != 0)
+ {
+ OSL_TRACE("madvise(..., MADV_WILLNEED) failed with %d", errno);
+ }
+#endif
+ }
return osl_File_E_None;
}
diff --git a/sal/osl/unx/signal.c b/sal/osl/unx/signal.c
index df9ad8f27515..c5141fa02260 100644
--- a/sal/osl/unx/signal.c
+++ b/sal/osl/unx/signal.c
@@ -199,6 +199,7 @@ static sal_Bool InitSignal()
int i;
struct sigaction act;
struct sigaction oact;
+ sigset_t unset;
if (is_soffice_Impl())
{
@@ -280,6 +281,16 @@ static sal_Bool InitSignal()
}
}
+ /* Clear signal mask inherited from parent process (on Mac OS X, upon a
+ crash soffice re-execs itself from within the signal handler, so the
+ second soffice would have the guilty signal blocked and would freeze upon
+ encountering a similar crash again): */
+ if (sigemptyset(&unset) < 0 ||
+ pthread_sigmask(SIG_SETMASK, &unset, NULL) < 0)
+ {
+ OSL_TRACE("sigemptyset or pthread_sigmask failed");
+ }
+
return sal_True;
}
diff --git a/sal/osl/unx/socket.c b/sal/osl/unx/socket.c
index c901aa7b505d..c8faf6c028f5 100644
--- a/sal/osl/unx/socket.c
+++ b/sal/osl/unx/socket.c
@@ -1858,6 +1858,9 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket)
pSocket->m_nLastError=0;
nFD = pSocket->m_Socket;
+ if (nFD == OSL_INVALID_SOCKET)
+ return;
+
pSocket->m_Socket = OSL_INVALID_SOCKET;
#if defined(LINUX)
@@ -1904,6 +1907,7 @@ void SAL_CALL osl_closeSocket(oslSocket pSocket)
#endif /* OSL_DEBUG_LEVEL */
close(nConnFD);
}
+ pSocket->m_bIsAccepting = sal_False;
}
#endif /* LINUX */
diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index d74f78fb30e2..09bdec7988c3 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -34,6 +34,7 @@
#include "file_url.h"
#include "file_error.h"
+
#include "path_helper.hxx"
#include "osl/diagnose.h"
@@ -291,7 +292,7 @@ struct DirectoryItem_Impl
WIN32_FIND_DATA FindData;
TCHAR cDriveString[MAX_PATH];
};
- TCHAR szFullPath[MAX_PATH];
+ rtl_uString* m_pFullPath;
BOOL bFullPathNormalized;
int nRefCount;
};
@@ -310,7 +311,7 @@ struct Directory_Impl
HANDLE hDirectory;
HANDLE hEnumDrives;
};
- TCHAR szDirectoryPath[MAX_PATH];
+ rtl_uString* m_pDirectoryPath;
};
//#####################################################
@@ -395,34 +396,48 @@ typedef struct tagDIRECTORY
} DIRECTORY, *PDIRECTORY, FAR *LPDIRECTORY;
//#####################################################
-static HANDLE WINAPI OpenDirectory(LPCTSTR lpszPath)
+static HANDLE WINAPI OpenDirectory( rtl_uString* pPath)
{
- LPDIRECTORY pDirectory = (LPDIRECTORY)HeapAlloc(GetProcessHeap(), 0, sizeof(DIRECTORY));
+ LPDIRECTORY pDirectory = NULL;
- if (pDirectory)
+ if ( pPath )
{
- TCHAR szFileMask[MAX_PATH];
- int nLen;
+ sal_uInt32 nLen = rtl_uString_getLength( pPath );
+ if ( nLen )
+ {
+ TCHAR* pSuffix = 0;
+ sal_uInt32 nSuffLen = 0;
+
+ if ( pPath->buffer[nLen - 1] != L'\\' )
+ {
+ pSuffix = L"\\*.*";
+ nSuffLen = 4;
+ }
+ else
+ {
+ pSuffix = L"*.*";
+ nSuffLen = 3;
+ }
- _tcscpy( szFileMask, lpszPath );
- nLen = _tcslen( szFileMask );
+ TCHAR* szFileMask = reinterpret_cast< TCHAR* >( rtl_allocateMemory( sizeof( TCHAR ) * ( nLen + nSuffLen + 1 ) ) );
- if (nLen && szFileMask[nLen-1] != '\\')
- _tcscat(szFileMask, TEXT("\\*.*"));
- else
- _tcscat(szFileMask, TEXT("*.*"));
+ _tcscpy( szFileMask, reinterpret_cast<LPCTSTR>( rtl_uString_getStr( pPath ) ) );
+ _tcscat( szFileMask, pSuffix );
- pDirectory->hFind = FindFirstFile(szFileMask, &pDirectory->aFirstData);
+ pDirectory = (LPDIRECTORY)HeapAlloc(GetProcessHeap(), 0, sizeof(DIRECTORY));
+ pDirectory->hFind = FindFirstFile(szFileMask, &pDirectory->aFirstData);
- if (!IsValidHandle(pDirectory->hFind))
- {
- if ( GetLastError() != ERROR_NO_MORE_FILES )
+ if (!IsValidHandle(pDirectory->hFind))
{
- HeapFree(GetProcessHeap(), 0, pDirectory);
- pDirectory = NULL;
+ if ( GetLastError() != ERROR_NO_MORE_FILES )
+ {
+ HeapFree(GetProcessHeap(), 0, pDirectory);
+ pDirectory = NULL;
+ }
}
}
}
+
return (HANDLE)pDirectory;
}
@@ -499,15 +514,26 @@ static oslFileError osl_openLocalRoot(
Directory_Impl *pDirImpl;
pDirImpl = reinterpret_cast<Directory_Impl*>(rtl_allocateMemory( sizeof(Directory_Impl)));
- _tcscpy( pDirImpl->szDirectoryPath, reinterpret_cast<LPCTSTR>(rtl_uString_getStr(strSysPath)) );
+ ZeroMemory( pDirImpl, sizeof(Directory_Impl) );
+ rtl_uString_newFromString( &pDirImpl->m_pDirectoryPath, strSysPath );
/* Append backslash if neccessary */
/* @@@ToDo
use function ensure backslash
*/
- if ( pDirImpl->szDirectoryPath[_tcslen(pDirImpl->szDirectoryPath) - 1] != L'\\' )
- _tcscat( pDirImpl->szDirectoryPath, L"\\" );
+ sal_uInt32 nLen = rtl_uString_getLength( pDirImpl->m_pDirectoryPath );
+ if ( nLen && pDirImpl->m_pDirectoryPath->buffer[nLen - 1] != L'\\' )
+ {
+ rtl_uString* pCurDir = 0;
+ rtl_uString* pBackSlash = 0;
+
+ rtl_uString_assign( &pCurDir, pDirImpl->m_pDirectoryPath );
+ rtl_uString_newFromAscii( &pBackSlash, "\\" );
+ rtl_uString_newConcat( &pDirImpl->m_pDirectoryPath, pCurDir, pBackSlash );
+ rtl_uString_release( pBackSlash );
+ rtl_uString_release( pCurDir );
+ }
pDirImpl->uType = DIRECTORYTYPE_LOCALROOT;
pDirImpl->hEnumDrives = OpenLogicalDrivesEnum();
@@ -523,7 +549,16 @@ static oslFileError osl_openLocalRoot(
else
{
if ( pDirImpl )
+ {
+ if ( pDirImpl->m_pDirectoryPath )
+ {
+ rtl_uString_release( pDirImpl->m_pDirectoryPath );
+ pDirImpl->m_pDirectoryPath = 0;
+ }
+
rtl_freeMemory(pDirImpl);
+ pDirImpl = 0;
+ }
error = oslTranslateFileError( GetLastError() );
}
@@ -544,23 +579,41 @@ static oslFileError SAL_CALL osl_openFileDirectory(
*pDirectory = NULL;
Directory_Impl *pDirImpl = reinterpret_cast<Directory_Impl*>(rtl_allocateMemory(sizeof(Directory_Impl)));
- _tcscpy( pDirImpl->szDirectoryPath, reinterpret_cast<LPCTSTR>(rtl_uString_getStr(strDirectoryPath)) );
+ ZeroMemory( pDirImpl, sizeof(Directory_Impl) );
+ rtl_uString_newFromString( &pDirImpl->m_pDirectoryPath, strDirectoryPath );
/* Append backslash if neccessary */
/* @@@ToDo
use function ensure backslash
*/
- if ( pDirImpl->szDirectoryPath[_tcslen(pDirImpl->szDirectoryPath) - 1] != L'\\' )
- _tcscat( pDirImpl->szDirectoryPath, L"\\" );
+ sal_uInt32 nLen = rtl_uString_getLength( pDirImpl->m_pDirectoryPath );
+ if ( nLen && pDirImpl->m_pDirectoryPath->buffer[nLen - 1] != L'\\' )
+ {
+ rtl_uString* pCurDir = 0;
+ rtl_uString* pBackSlash = 0;
+
+ rtl_uString_assign( &pCurDir, pDirImpl->m_pDirectoryPath );
+ rtl_uString_newFromAscii( &pBackSlash, "\\" );
+ rtl_uString_newConcat( &pDirImpl->m_pDirectoryPath, pCurDir, pBackSlash );
+ rtl_uString_release( pBackSlash );
+ rtl_uString_release( pCurDir );
+ }
+
pDirImpl->uType = DIRECTORYTYPE_FILESYSTEM;
- pDirImpl->hDirectory = OpenDirectory( pDirImpl->szDirectoryPath );
+ pDirImpl->hDirectory = OpenDirectory( pDirImpl->m_pDirectoryPath );
if ( !pDirImpl->hDirectory )
{
error = oslTranslateFileError( GetLastError() );
+ if ( pDirImpl->m_pDirectoryPath )
+ {
+ rtl_uString_release( pDirImpl->m_pDirectoryPath );
+ pDirImpl->m_pDirectoryPath = 0;
+ }
+
rtl_freeMemory(pDirImpl), pDirImpl = 0;
}
@@ -592,6 +645,7 @@ static oslFileError SAL_CALL osl_openNetworkServer(
Directory_Impl *pDirImpl;
pDirImpl = reinterpret_cast<Directory_Impl*>(rtl_allocateMemory(sizeof(Directory_Impl)));
+ ZeroMemory( pDirImpl, sizeof(Directory_Impl) );
pDirImpl->uType = DIRECTORYTYPE_NETROOT;
pDirImpl->hDirectory = hEnum;
*pDirectory = (oslDirectory)pDirImpl;
@@ -609,7 +663,11 @@ static DWORD create_dir_with_callback(
// user specified callback function. On success
// the function returns ERROR_SUCCESS else a Win32 error code.
- if (CreateDirectory(reinterpret_cast<LPCTSTR>(dir_path->buffer), NULL))
+ BOOL bCreated = FALSE;
+
+ bCreated = CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( dir_path )), NULL );
+
+ if ( bCreated )
{
if (aDirectoryCreationCallbackFunc)
{
@@ -705,15 +763,18 @@ oslFileError SAL_CALL osl_createDirectory(rtl_uString* strPath)
if ( osl_File_E_None == error )
{
- if ( CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strSysPath )), NULL ) )
- error = osl_File_E_None;
-/*@@@ToDo
- The else case is a hack because the ucb or the webtop had some
- problems with the error code that CreateDirectory returns in
- case the path is only a logical drive, should be removed!
-*/
- else
+ BOOL bCreated = FALSE;
+
+ bCreated = CreateDirectoryW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strSysPath )), NULL );
+
+ if ( !bCreated )
{
+ /*@@@ToDo
+ The following case is a hack because the ucb or the webtop had some
+ problems with the error code that CreateDirectory returns in
+ case the path is only a logical drive, should be removed!
+ */
+
const sal_Unicode *pBuffer = rtl_uString_getStr( strSysPath );
sal_Int32 nLen = rtl_uString_getLength( strSysPath );
@@ -862,6 +923,12 @@ static oslFileError SAL_CALL osl_getNextDrive(
}
else
{
+ if ( pItemImpl->m_pFullPath )
+ {
+ rtl_uString_release( pItemImpl->m_pFullPath );
+ pItemImpl->m_pFullPath = 0;
+ }
+
rtl_freeMemory( pItemImpl );
return oslTranslateFileError( GetLastError() );
}
@@ -895,14 +962,24 @@ static oslFileError SAL_CALL osl_getNextFileItem(
{
pItemImpl->uType = DIRECTORYITEM_FILE;
pItemImpl->nRefCount = 1;
- _tcscpy( pItemImpl->szFullPath, pDirImpl->szDirectoryPath );
- _tcscat( pItemImpl->szFullPath, pItemImpl->FindData.cFileName );
+
+ rtl_uString* pTmpFileName = 0;
+ rtl_uString_newFromStr( &pTmpFileName, reinterpret_cast<const sal_Unicode *>(pItemImpl->FindData.cFileName) );
+ rtl_uString_newConcat( &pItemImpl->m_pFullPath, pDirImpl->m_pDirectoryPath, pTmpFileName );
+ rtl_uString_release( pTmpFileName );
+
pItemImpl->bFullPathNormalized = FALSE;
*pItem = (oslDirectoryItem)pItemImpl;
return osl_File_E_None;
}
else
{
+ if ( pItemImpl->m_pFullPath )
+ {
+ rtl_uString_release( pItemImpl->m_pFullPath );
+ pItemImpl->m_pFullPath = 0;
+ }
+
rtl_freeMemory( pItemImpl );
return oslTranslateFileError( GetLastError() );
}
@@ -963,6 +1040,12 @@ oslFileError SAL_CALL osl_closeDirectory(oslDirectory Directory)
break;
}
+ if ( pDirImpl->m_pDirectoryPath )
+ {
+ rtl_uString_release( pDirImpl->m_pDirectoryPath );
+ pDirImpl->m_pDirectoryPath = 0;
+ }
+
rtl_freeMemory(pDirImpl);
}
return eError;
@@ -1024,8 +1107,7 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString *strFilePath, oslDirector
pItemImpl->uType = DIRECTORYITEM_SERVER;
osl_acquireDirectoryItem( (oslDirectoryItem)pItemImpl );
-
- _tcscpy( pItemImpl->szFullPath, reinterpret_cast<LPCTSTR>(strSysFilePath->buffer) );
+ rtl_uString_newFromString( &pItemImpl->m_pFullPath, strSysFilePath );
// Assign a title anyway
{
@@ -1088,7 +1170,7 @@ oslFileError SAL_CALL osl_getDirectoryItem(rtl_uString *strFilePath, oslDirector
osl_acquireDirectoryItem( (oslDirectoryItem)pItemImpl );
CopyMemory( &pItemImpl->FindData, &aFindData, sizeof(WIN32_FIND_DATA) );
- _tcscpy( pItemImpl->szFullPath, reinterpret_cast<LPCTSTR>(rtl_uString_getStr(strSysFilePath)) );
+ rtl_uString_newFromString( &pItemImpl->m_pFullPath, strSysFilePath );
// MT: This costs 600ms startup time on fast v60x!
// GetCaseCorrectPathName( pItemImpl->szFullPath, pItemImpl->szFullPath, sizeof(pItemImpl->szFullPath) );
@@ -1130,7 +1212,16 @@ oslFileError SAL_CALL osl_releaseDirectoryItem( oslDirectoryItem Item )
return osl_File_E_INVAL;
if ( ! --pItemImpl->nRefCount )
+ {
+ if ( pItemImpl->m_pFullPath )
+ {
+ rtl_uString_release( pItemImpl->m_pFullPath );
+ pItemImpl->m_pFullPath = 0;
+ }
+
rtl_freeMemory( pItemImpl );
+ }
+
return osl_File_E_None;
}
@@ -1344,18 +1435,22 @@ static oslFileError get_filesystem_attributes(
}
if (is_filesystem_attributes_request(field_mask))
{
- WCHAR vn[MAX_PATH];
- WCHAR fsn[MAX_PATH];
+ /* the following two parameters can not be longer than MAX_PATH+1 */
+ WCHAR vn[MAX_PATH+1];
+ WCHAR fsn[MAX_PATH+1];
+
DWORD serial;
DWORD mcl;
DWORD flags;
LPCTSTR pszPath = reinterpret_cast<LPCTSTR>(path.getStr());
- if (GetVolumeInformation(pszPath, vn, MAX_PATH, &serial, &mcl, &flags, fsn, MAX_PATH))
+ if (GetVolumeInformation(pszPath, vn, MAX_PATH+1, &serial, &mcl, &flags, fsn, MAX_PATH+1))
{
+ // Currently sal does not use this value, instead MAX_PATH is used
pInfo->uValidFields |= osl_VolumeInfo_Mask_MaxNameLength;
pInfo->uMaxNameLength = mcl;
+ // Should the uMaxPathLength be set to 32767, "\\?\" prefix allowes it
pInfo->uValidFields |= osl_VolumeInfo_Mask_MaxPathLength;
pInfo->uMaxPathLength = MAX_PATH;
@@ -1558,11 +1653,7 @@ static oslFileError SAL_CALL osl_getServerInfo(
if ( uFieldMask & osl_FileStatus_Mask_FileURL )
{
- rtl_uString *ustrSystemPath = NULL;
-
- rtl_uString_newFromStr( &ustrSystemPath, reinterpret_cast<const sal_Unicode*>(pItemImpl->szFullPath) );
- osl_getFileURLFromSystemPath( ustrSystemPath, &pStatus->ustrFileURL );
- rtl_uString_release( ustrSystemPath );
+ osl_getFileURLFromSystemPath( pItemImpl->m_pFullPath, &pStatus->ustrFileURL );
pStatus->uValidFields |= osl_FileStatus_Mask_FileURL;
}
return osl_File_E_None;
@@ -1591,7 +1682,7 @@ oslFileError SAL_CALL osl_getFileStatus(
if ( uFieldMask & osl_FileStatus_Mask_Validate )
{
- HANDLE hFind = FindFirstFile( pItemImpl->szFullPath, &pItemImpl->FindData );
+ HANDLE hFind = FindFirstFile( reinterpret_cast<LPCTSTR>( rtl_uString_getStr( pItemImpl->m_pFullPath ) ), &pItemImpl->FindData );
if ( hFind != INVALID_HANDLE_VALUE )
FindClose( hFind );
@@ -1651,28 +1742,30 @@ oslFileError SAL_CALL osl_getFileStatus(
if ( uFieldMask & osl_FileStatus_Mask_LinkTargetURL )
{
- rtl_uString *ustrFullPath = NULL;
-
- rtl_uString_newFromStr( &ustrFullPath, reinterpret_cast<const sal_Unicode*>(pItemImpl->szFullPath) );
- osl_getFileURLFromSystemPath( ustrFullPath, &pStatus->ustrLinkTargetURL );
- rtl_uString_release( ustrFullPath );
+ osl_getFileURLFromSystemPath( pItemImpl->m_pFullPath, &pStatus->ustrLinkTargetURL );
pStatus->uValidFields |= osl_FileStatus_Mask_LinkTargetURL;
}
if ( uFieldMask & osl_FileStatus_Mask_FileURL )
{
- rtl_uString *ustrFullPath = NULL;
-
-
if ( !pItemImpl->bFullPathNormalized )
{
- GetCaseCorrectPathName( pItemImpl->szFullPath, pItemImpl->szFullPath, sizeof(pItemImpl->szFullPath) );
- pItemImpl->bFullPathNormalized = TRUE;
+ sal_uInt32 nLen = rtl_uString_getLength( pItemImpl->m_pFullPath );
+ ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
+ sal_uInt32 nNewLen = GetCaseCorrectPathName( reinterpret_cast<LPCTSTR>( rtl_uString_getStr( pItemImpl->m_pFullPath ) ),
+ ::osl::mingw_reinterpret_cast<LPTSTR>( aBuffer ),
+ aBuffer.getBufSizeInSymbols(),
+ sal_True );
+
+ if ( nNewLen )
+ {
+ rtl_uString_newFromStr( &pItemImpl->m_pFullPath, aBuffer );
+ pItemImpl->bFullPathNormalized = TRUE;
+ }
}
- rtl_uString_newFromStr( &ustrFullPath, reinterpret_cast<const sal_Unicode*>(pItemImpl->szFullPath) );
- osl_getFileURLFromSystemPath( ustrFullPath, &pStatus->ustrFileURL );
- rtl_uString_release( ustrFullPath );
+
+ osl_getFileURLFromSystemPath( pItemImpl->m_pFullPath, &pStatus->ustrFileURL );
pStatus->uValidFields |= osl_FileStatus_Mask_FileURL;
}
diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx
index f87f02b093d6..90140cda97c6 100644
--- a/sal/osl/w32/file_url.cxx
+++ b/sal/osl/w32/file_url.cxx
@@ -38,6 +38,8 @@
#include "osl/file.h"
#include "osl/mutex.h"
+#include "path_helper.hxx"
+
#include <stdio.h>
#include <tchar.h>
@@ -49,6 +51,11 @@
#define ELEMENTS_OF_ARRAY(arr) (sizeof(arr)/(sizeof((arr)[0])))
+#define WSTR_SYSTEM_ROOT_PATH L"\\\\.\\"
+#define WSTR_LONG_PATH_PREFIX L"\\\\?\\"
+#define WSTR_LONG_PATH_PREFIX_UNC L"\\\\?\\UNC\\"
+
+
//##################################################################
// FileURL functions
//##################################################################
@@ -65,7 +72,7 @@ static BOOL IsValidFilePathComponent(
BOOL fValid = TRUE; /* Assume success */
TCHAR cLast = 0;
- /* Path component length must not exceed MAX_PATH */
+ /* Path component length must not exceed MAX_PATH even if long path with "\\?\" prefix is used */
while ( !lpComponentEnd && lpCurrent && lpCurrent - lpComponent < MAX_PATH )
{
@@ -232,31 +239,56 @@ static BOOL IsValidFilePathComponent(
DWORD IsValidFilePath(rtl_uString *path, LPCTSTR *lppError, DWORD dwFlags, rtl_uString **corrected)
{
LPCTSTR lpszPath = reinterpret_cast< LPCTSTR >(path->buffer);
- LPCTSTR lpComponent;
+ LPCTSTR lpComponent = lpszPath;
BOOL fValid = TRUE;
DWORD dwPathType = PATHTYPE_ERROR;
+ sal_Int32 nLength = rtl_uString_getLength( path );
if ( dwFlags & VALIDATEPATH_ALLOW_RELATIVE )
dwFlags |= VALIDATEPATH_ALLOW_ELLIPSE;
if ( !lpszPath )
- {
fValid = FALSE;
- lpComponent = lpszPath;
- }
- /* Test for UNC path notation */
- if ( 2 == _tcsspn( lpszPath, CHARSET_SEPARATOR ) )
+ DWORD dwCandidatPathType = PATHTYPE_ERROR;
+
+ if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( path->buffer, nLength, reinterpret_cast<const sal_Unicode *>(WSTR_LONG_PATH_PREFIX_UNC), ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX_UNC) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX_UNC) - 1 ) )
+ {
+ /* This is long path in UNC notation */
+ lpComponent = lpszPath + ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX_UNC) - 1;
+ dwCandidatPathType = PATHTYPE_ABSOLUTE_UNC | PATHTYPE_IS_LONGPATH;
+ }
+ else if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( path->buffer, nLength, reinterpret_cast<const sal_Unicode *>(WSTR_LONG_PATH_PREFIX), ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1 ) )
{
- /* Place the pointer behind the leading to backslashes */
+ /* This is long path */
+ lpComponent = lpszPath + ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1;
+ if ( _istalpha( lpComponent[0] ) && ':' == lpComponent[1] )
+ {
+ lpComponent += 2;
+ dwCandidatPathType = PATHTYPE_ABSOLUTE_LOCAL | PATHTYPE_IS_LONGPATH;
+ }
+ }
+ else if ( 2 == _tcsspn( lpszPath, CHARSET_SEPARATOR ) )
+ {
+ /* The UNC path notation */
lpComponent = lpszPath + 2;
+ dwCandidatPathType = PATHTYPE_ABSOLUTE_UNC;
+ }
+ else if ( _istalpha( lpszPath[0] ) && ':' == lpszPath[1] )
+ {
+ /* Local path verification. Must start with <drive>: */
+ lpComponent = lpszPath + 2;
+ dwCandidatPathType = PATHTYPE_ABSOLUTE_LOCAL;
+ }
+ if ( ( dwCandidatPathType & PATHTYPE_MASK_TYPE ) == PATHTYPE_ABSOLUTE_UNC )
+ {
fValid = IsValidFilePathComponent( lpComponent, &lpComponent, VALIDATEPATH_ALLOW_ELLIPSE );
/* So far we have a valid servername. Now let's see if we also have a network resource */
- dwPathType = PATHTYPE_ABSOLUTE_UNC;
+ dwPathType = dwCandidatPathType;
if ( fValid )
{
@@ -291,20 +323,14 @@ DWORD IsValidFilePath(rtl_uString *path, LPCTSTR *lppError, DWORD dwFlags, rtl_u
}
}
}
-
- /* Local path verification. Must start with <drive>: */
- else if ( _istalpha( lpszPath[0] ) && ':' == lpszPath[1] )
+ else if ( ( dwCandidatPathType & PATHTYPE_MASK_TYPE ) == PATHTYPE_ABSOLUTE_LOCAL )
{
- /* Place pointer behind correct drive specification */
-
- lpComponent = lpszPath + 2;
-
if ( 1 == _tcsspn( lpComponent, CHARSET_SEPARATOR ) )
lpComponent++;
else if ( *lpComponent )
fValid = FALSE;
- dwPathType = PATHTYPE_ABSOLUTE_LOCAL;
+ dwPathType = dwCandidatPathType;
/* Now we are behind the backslash or it was a simple drive without backslash */
@@ -314,10 +340,9 @@ DWORD IsValidFilePath(rtl_uString *path, LPCTSTR *lppError, DWORD dwFlags, rtl_u
dwPathType |= PATHTYPE_IS_VOLUME;
}
}
-
- /* Can be a relative path */
else if ( dwFlags & VALIDATEPATH_ALLOW_RELATIVE )
{
+ /* Can be a relative path */
lpComponent = lpszPath;
/* Relative path can start with a backslash */
@@ -331,10 +356,9 @@ DWORD IsValidFilePath(rtl_uString *path, LPCTSTR *lppError, DWORD dwFlags, rtl_u
dwPathType = PATHTYPE_RELATIVE;
}
-
- /* Anything else is an error */
else
{
+ /* Anything else is an error */
fValid = FALSE;
lpComponent = lpszPath;
}
@@ -364,7 +388,8 @@ DWORD IsValidFilePath(rtl_uString *path, LPCTSTR *lppError, DWORD dwFlags, rtl_u
}
}
- if ( fValid && _tcslen( lpszPath ) >= MAX_PATH )
+ /* The path can be longer than MAX_PATH only in case it has the longpath prefix */
+ if ( fValid && !( dwPathType & PATHTYPE_IS_LONGPATH ) && _tcslen( lpszPath ) >= MAX_PATH )
{
fValid = FALSE;
lpComponent = lpszPath + MAX_PATH;
@@ -376,38 +401,45 @@ DWORD IsValidFilePath(rtl_uString *path, LPCTSTR *lppError, DWORD dwFlags, rtl_u
return fValid ? dwPathType : PATHTYPE_ERROR;
}
-//#############################################
//#####################################################
-//Undocumented in SHELL32.DLL ordinal 35
-static BOOL PathRemoveFileSpec(LPTSTR lpPath)
+static sal_Int32 PathRemoveFileSpec(LPTSTR lpPath, LPTSTR lpFileName, sal_Int32 nFileBufLen )
{
- BOOL fSuccess = FALSE; // Assume failure
- LPTSTR lpLastBkSlash = _tcsrchr( lpPath, '\\' );
- LPTSTR lpLastSlash = _tcsrchr( lpPath, '/' );
- LPTSTR lpLastDelimiter = lpLastSlash > lpLastBkSlash ? lpLastSlash : lpLastBkSlash;
+ sal_Int32 nRemoved = 0;
- if ( lpLastDelimiter )
+ if ( nFileBufLen )
{
- if ( 0 == *(lpLastDelimiter + 1) )
- {
- if ( lpLastDelimiter > lpPath && *(lpLastDelimiter - 1) != ':' )
+ lpFileName[0] = 0;
+ LPTSTR lpLastBkSlash = _tcsrchr( lpPath, '\\' );
+ LPTSTR lpLastSlash = _tcsrchr( lpPath, '/' );
+ LPTSTR lpLastDelimiter = lpLastSlash > lpLastBkSlash ? lpLastSlash : lpLastBkSlash;
+
+ if ( lpLastDelimiter )
+ {
+ sal_Int32 nDelLen = _tcslen( lpLastDelimiter );
+ if ( 1 == nDelLen )
{
- *lpLastDelimiter = 0;
- fSuccess = TRUE;
+ if ( lpLastDelimiter > lpPath && *(lpLastDelimiter - 1) != ':' )
+ {
+ *lpLastDelimiter = 0;
+ *lpFileName = 0;
+ nRemoved = nDelLen;
+ }
}
- }
- else
- {
- *(++lpLastDelimiter) = 0;
- fSuccess = TRUE;
- }
+ else if ( nDelLen && nDelLen - 1 < nFileBufLen )
+ {
+ _tcscpy( lpFileName, lpLastDelimiter + 1 );
+ *(++lpLastDelimiter) = 0;
+ nRemoved = nDelLen - 1;
+ }
+ }
}
- return fSuccess;
+
+ return nRemoved;
}
//#####################################################
// Undocumented in SHELL32.DLL ordinal 32
-static LPTSTR PathAddBackslash(LPTSTR lpPath)
+static LPTSTR PathAddBackslash(LPTSTR lpPath, sal_Int32 nBufLen)
{
LPTSTR lpEndPath = NULL;
@@ -415,7 +447,7 @@ static LPTSTR PathAddBackslash(LPTSTR lpPath)
{
int nLen = _tcslen(lpPath);
- if ( !nLen || lpPath[nLen-1] != '\\' && lpPath[nLen-1] != '/' && nLen < MAX_PATH - 1 )
+ if ( !nLen || lpPath[nLen-1] != '\\' && lpPath[nLen-1] != '/' && nLen < nBufLen - 1 )
{
lpEndPath = lpPath + nLen;
*lpEndPath++ = '\\';
@@ -428,37 +460,31 @@ static LPTSTR PathAddBackslash(LPTSTR lpPath)
//#####################################################
// Same as GetLongPathName but also 95/NT4
static DWORD GetCaseCorrectPathNameEx(
- LPCTSTR lpszShortPath, // file name
- LPTSTR lpszLongPath, // path buffer
+ LPTSTR lpszPath, // path buffer to convert
DWORD cchBuffer, // size of path buffer
- DWORD nSkipLevels
-)
+ DWORD nSkipLevels,
+ BOOL bCheckExistence )
{
- TCHAR szPath[MAX_PATH];
- BOOL fSuccess;
-
- cchBuffer = cchBuffer; /* avoid warnings */
-
- _tcscpy( szPath, lpszShortPath );
-
- fSuccess = PathRemoveFileSpec( szPath );
+ ::osl::LongPathBuffer< WCHAR > szFile( MAX_PATH + 1 );
+ sal_Int32 nRemoved = PathRemoveFileSpec( lpszPath, szFile, MAX_PATH + 1 );
+ sal_Int32 nLastStepRemoved = nRemoved;
+ while ( nLastStepRemoved && szFile[0] == 0 )
+ {
+ // remove separators
+ nLastStepRemoved = PathRemoveFileSpec( lpszPath, szFile, MAX_PATH + 1 );
+ nRemoved += nLastStepRemoved;
+ }
- if ( fSuccess )
+ if ( nRemoved )
{
- int nLen = _tcslen( szPath );
- LPCTSTR lpszFileSpec = lpszShortPath + nLen;
- BOOL bSkipThis;
+ BOOL bSkipThis = FALSE;
- if ( 0 == _tcscmp( lpszFileSpec, TEXT("..") ) )
+ if ( 0 == _tcscmp( szFile, TEXT("..") ) )
{
bSkipThis = TRUE;
nSkipLevels += 1;
}
- else if (
- 0 == _tcscmp( lpszFileSpec, TEXT(".") ) ||
- 0 == _tcscmp( lpszFileSpec, TEXT("\\") ) ||
- 0 == _tcscmp( lpszFileSpec, TEXT("/") )
- )
+ else if ( 0 == _tcscmp( szFile, TEXT(".") ) )
{
bSkipThis = TRUE;
}
@@ -470,24 +496,36 @@ static DWORD GetCaseCorrectPathNameEx(
else
bSkipThis = FALSE;
- GetCaseCorrectPathNameEx( szPath, szPath, MAX_PATH, nSkipLevels );
+ GetCaseCorrectPathNameEx( lpszPath, cchBuffer, nSkipLevels, bCheckExistence );
- PathAddBackslash( szPath );
+ PathAddBackslash( lpszPath, cchBuffer );
/* Analyze parent if not only a trailing backslash was cutted but a real file spec */
if ( !bSkipThis )
{
- WIN32_FIND_DATA aFindFileData;
- HANDLE hFind = FindFirstFile( lpszShortPath, &aFindFileData );
-
- if ( IsValidHandle(hFind) )
+ if ( bCheckExistence )
{
- _tcscat( szPath, aFindFileData.cFileName[0] ? aFindFileData.cFileName : aFindFileData.cAlternateFileName );
+ ::osl::LongPathBuffer< WCHAR > aShortPath( MAX_LONG_PATH );
+ _tcscpy( aShortPath, lpszPath );
+ _tcscat( aShortPath, szFile );
- FindClose( hFind );
+ WIN32_FIND_DATA aFindFileData;
+ HANDLE hFind = FindFirstFile( aShortPath, &aFindFileData );
+
+ if ( IsValidHandle(hFind) )
+ {
+ _tcscat( lpszPath, aFindFileData.cFileName[0] ? aFindFileData.cFileName : aFindFileData.cAlternateFileName );
+
+ FindClose( hFind );
+ }
+ else
+ lpszPath[0] = 0;
}
else
- return 0;
+ {
+ /* add the segment name back */
+ _tcscat( lpszPath, szFile );
+ }
}
}
else
@@ -496,14 +534,12 @@ static DWORD GetCaseCorrectPathNameEx(
or a network share. If still levels to skip are left, the path specification
tries to travel below the file system root */
if ( nSkipLevels )
- return 0;
-
- _tcsupr( szPath );
+ lpszPath[0] = 0;
+ else
+ _tcsupr( lpszPath );
}
- _tcscpy( lpszLongPath, szPath );
-
- return _tcslen( lpszLongPath );
+ return _tcslen( lpszPath );
}
//#####################################################
@@ -512,7 +548,8 @@ static DWORD GetCaseCorrectPathNameEx(
DWORD GetCaseCorrectPathName(
LPCTSTR lpszShortPath, // file name
LPTSTR lpszLongPath, // path buffer
- DWORD cchBuffer // size of path buffer
+ DWORD cchBuffer, // size of path buffer
+ BOOL bCheckExistence
)
{
/* Special handling for "\\.\" as system root */
@@ -528,12 +565,19 @@ DWORD GetCaseCorrectPathName(
return ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1;
}
}
- else
+ else if ( lpszShortPath )
{
- return GetCaseCorrectPathNameEx( lpszShortPath, lpszLongPath, cchBuffer, 0 );
+ if ( _tcslen( lpszShortPath ) <= cchBuffer )
+ {
+ _tcscpy( lpszLongPath, lpszShortPath );
+ return GetCaseCorrectPathNameEx( lpszLongPath, cchBuffer, 0, bCheckExistence );
+ }
}
+
+ return 0;
}
+
//#############################################
static sal_Bool _osl_decodeURL( rtl_String* strUTF8, rtl_uString** pstrDecodedURL )
{
@@ -667,7 +711,6 @@ static void _osl_encodeURL( rtl_uString *strURL, rtl_String **pstrEncodedURL )
}
//#############################################
-#define WSTR_SYSTEM_ROOT_PATH L"\\\\.\\"
oslFileError _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uString **pustrPath, sal_Bool bAllowRelative )
{
@@ -725,13 +768,60 @@ oslFileError _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uString **p
if ( nDecodedLen == nSkip )
rtl_uString_newFromStr_WithLength( &strTempPath, reinterpret_cast<const sal_Unicode*>(WSTR_SYSTEM_ROOT_PATH), ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1 );
else
- rtl_uString_newFromStr_WithLength( &strTempPath, pDecodedURL + nSkip, nDecodedLen - nSkip );
+ {
+ /* do not separate the directory and file case, so the maximal path lengs without prefix is MAX_PATH-12 */
+ if ( nDecodedLen - nSkip <= MAX_PATH - 12 )
+ {
+ rtl_uString_newFromStr_WithLength( &strTempPath, pDecodedURL + nSkip, nDecodedLen - nSkip );
+ }
+ else
+ {
+ ::osl::LongPathBuffer< sal_Unicode > aBuf( MAX_LONG_PATH );
+ sal_uInt32 nNewLen = GetCaseCorrectPathName( reinterpret_cast<LPCTSTR>(pDecodedURL + nSkip),
+ ::osl::mingw_reinterpret_cast<LPTSTR>(aBuf),
+ aBuf.getBufSizeInSymbols(),
+ sal_False );
+
+ if ( nNewLen <= MAX_PATH - 12
+ || 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, reinterpret_cast<const sal_Unicode*>(WSTR_SYSTEM_ROOT_PATH), ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1, ELEMENTS_OF_ARRAY(WSTR_SYSTEM_ROOT_PATH) - 1 )
+ || 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( pDecodedURL + nSkip, nDecodedLen - nSkip, reinterpret_cast<const sal_Unicode*>(WSTR_LONG_PATH_PREFIX), ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1 ) )
+ {
+ rtl_uString_newFromStr_WithLength( &strTempPath, aBuf, nNewLen );
+ }
+ else if ( pDecodedURL[nSkip] == (sal_Unicode)'\\' && pDecodedURL[nSkip+1] == (sal_Unicode)'\\' )
+ {
+ /* it should be an UNC path, use the according prefix */
+ rtl_uString *strSuffix = NULL;
+ rtl_uString *strPrefix = NULL;
+ rtl_uString_newFromStr_WithLength( &strPrefix, reinterpret_cast<const sal_Unicode*>(WSTR_LONG_PATH_PREFIX_UNC), ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX_UNC ) - 1 );
+ rtl_uString_newFromStr_WithLength( &strSuffix, aBuf + 2, nNewLen - 2 );
+
+ rtl_uString_newConcat( &strTempPath, strPrefix, strSuffix );
+
+ rtl_uString_release( strPrefix );
+ rtl_uString_release( strSuffix );
+ }
+ else
+ {
+ rtl_uString *strSuffix = NULL;
+ rtl_uString *strPrefix = NULL;
+ rtl_uString_newFromStr_WithLength( &strPrefix, reinterpret_cast<const sal_Unicode*>(WSTR_LONG_PATH_PREFIX), ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX ) - 1 );
+ rtl_uString_newFromStr_WithLength( &strSuffix, aBuf, nNewLen );
+
+ rtl_uString_newConcat( &strTempPath, strPrefix, strSuffix );
+
+ rtl_uString_release( strPrefix );
+ rtl_uString_release( strSuffix );
+ }
+ }
+ }
if ( IsValidFilePath( strTempPath, NULL, VALIDATEPATH_ALLOW_ELLIPSE, &strTempPath ) )
nError = osl_File_E_None;
}
else if ( bAllowRelative ) /* This maybe a relative file URL */
{
+ /* In future the relative path could be converted to absolute if it is too long */
rtl_uString_assign( &strTempPath, strDecodedURL );
if ( IsValidFilePath( strTempPath, NULL, VALIDATEPATH_ALLOW_RELATIVE | VALIDATEPATH_ALLOW_ELLIPSE, &strTempPath ) )
@@ -774,8 +864,51 @@ oslFileError _osl_getFileURLFromSystemPath( rtl_uString* strPath, rtl_uString**
{
rtl_uString *strTempPath = NULL;
- /* Replace backslashes */
- rtl_uString_newReplace( &strTempPath, strPath, '\\', '/' );
+ if ( dwPathType & PATHTYPE_IS_LONGPATH )
+ {
+ rtl_uString *strBuffer = NULL;
+ sal_uInt32 nIgnore = 0;
+ sal_uInt32 nLength = 0;
+
+ /* the path has the longpath prefix, lets remove it */
+ switch ( dwPathType & PATHTYPE_MASK_TYPE )
+ {
+ case PATHTYPE_ABSOLUTE_UNC:
+ nIgnore = ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX_UNC ) - 1;
+ OSL_ENSURE( nIgnore == 8, "Unexpected long path UNC prefix!" );
+
+ /* generate the normal UNC path */
+ nLength = rtl_uString_getLength( strPath );
+ rtl_uString_newFromStr_WithLength( &strBuffer, strPath->buffer + nIgnore - 2, nLength - nIgnore + 2 );
+ strBuffer->buffer[0] = '\\';
+
+ rtl_uString_newReplace( &strTempPath, strBuffer, '\\', '/' );
+ rtl_uString_release( strBuffer );
+ break;
+
+ case PATHTYPE_ABSOLUTE_LOCAL:
+ nIgnore = ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX ) - 1;
+ OSL_ENSURE( nIgnore == 4, "Unexpected long path prefix!" );
+
+ /* generate the normal path */
+ nLength = rtl_uString_getLength( strPath );
+ rtl_uString_newFromStr_WithLength( &strBuffer, strPath->buffer + nIgnore, nLength - nIgnore );
+
+ rtl_uString_newReplace( &strTempPath, strBuffer, '\\', '/' );
+ rtl_uString_release( strBuffer );
+ break;
+
+ default:
+ OSL_ASSERT( "Unexpected long path format!" );
+ rtl_uString_newReplace( &strTempPath, strPath, '\\', '/' );
+ break;
+ }
+ }
+ else
+ {
+ /* Replace backslashes */
+ rtl_uString_newReplace( &strTempPath, strPath, '\\', '/' );
+ }
switch ( dwPathType & PATHTYPE_MASK_TYPE )
{
@@ -944,8 +1077,8 @@ oslFileError SAL_CALL osl_getAbsoluteFileURL( rtl_uString* ustrBaseURL, rtl_uStr
if ( !eError )
{
- TCHAR szBuffer[MAX_PATH];
- TCHAR szCurrentDir[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
+ ::osl::LongPathBuffer< sal_Unicode > aCurrentDir( MAX_LONG_PATH );
LPTSTR lpFilePart = NULL;
DWORD dwResult;
@@ -960,28 +1093,28 @@ oslFileError SAL_CALL osl_getAbsoluteFileURL( rtl_uString* ustrBaseURL, rtl_uStr
{
osl_acquireMutex( g_CurrentDirectoryMutex );
- GetCurrentDirectory( MAX_PATH, szCurrentDir );
- SetCurrentDirectory( reinterpret_cast<LPCTSTR>(ustrBaseSysPath->buffer) );
+ GetCurrentDirectoryW( aCurrentDir.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aCurrentDir) );
+ SetCurrentDirectoryW( reinterpret_cast<LPCWSTR>(ustrBaseSysPath->buffer) );
}
- dwResult = GetFullPathName( reinterpret_cast<LPCTSTR>(ustrRelSysPath->buffer), MAX_PATH, szBuffer, &lpFilePart );
+ dwResult = GetFullPathNameW( reinterpret_cast<LPCWSTR>(ustrRelSysPath->buffer), aBuffer.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), &lpFilePart );
if ( ustrBaseSysPath )
{
- SetCurrentDirectory( szCurrentDir );
+ SetCurrentDirectoryW( ::osl::mingw_reinterpret_cast<LPCWSTR>(aCurrentDir) );
osl_releaseMutex( g_CurrentDirectoryMutex );
}
if ( dwResult )
{
- if ( dwResult >= MAX_PATH )
+ if ( dwResult >= aBuffer.getBufSizeInSymbols() )
eError = osl_File_E_INVAL;
else
{
rtl_uString *ustrAbsSysPath = NULL;
- rtl_uString_newFromStr( &ustrAbsSysPath, reinterpret_cast<const sal_Unicode*>(szBuffer) );
+ rtl_uString_newFromStr( &ustrAbsSysPath, aBuffer );
eError = osl_getFileURLFromSystemPath( ustrAbsSysPath, pustrAbsoluteURL );
diff --git a/sal/osl/w32/file_url.h b/sal/osl/w32/file_url.h
index 55b7145ec5cf..d9137c8c2fcc 100644
--- a/sal/osl/w32/file_url.h
+++ b/sal/osl/w32/file_url.h
@@ -54,6 +54,7 @@ extern "C" {
#define PATHTYPE_MASK_TYPE 0xFF
#define PATHTYPE_IS_VOLUME 0x0100
#define PATHTYPE_IS_SERVER 0x0200
+#define PATHTYPE_IS_LONGPATH 0x0400
#define VALIDATEPATH_NORMAL 0x0000
#define VALIDATEPATH_ALLOW_WILDCARDS 0x0001
@@ -61,6 +62,8 @@ extern "C" {
#define VALIDATEPATH_ALLOW_RELATIVE 0x0004
#define VALIDATEPATH_ALLOW_UNC 0x0008
+#define MAX_LONG_PATH 32767
+
DWORD IsValidFilePath (
rtl_uString * path,
LPCTSTR * lppError,
@@ -71,7 +74,8 @@ DWORD IsValidFilePath (
DWORD GetCaseCorrectPathName (
LPCTSTR lpszShortPath, // file name
LPTSTR lpszLongPath, // path buffer
- DWORD cchBuffer // size of path buffer
+ DWORD cchBuffer, // size of path buffer
+ BOOL bCheckExistence
);
oslFileError _osl_getSystemPathFromFileURL (
diff --git a/sal/osl/w32/module.c b/sal/osl/w32/module.cxx
index 902bab0726b0..b730bd3347df 100644
--- a/sal/osl/w32/module.c
+++ b/sal/osl/w32/module.cxx
@@ -1,39 +1,42 @@
/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
#include "system.h"
#include <tlhelp32.h>
+#include "file_url.h"
+#include "path_helper.hxx"
+
#include <osl/module.h>
#include <osl/diagnose.h>
#include <osl/thread.h>
#include <osl/file.h>
#include <rtl/logfile.h>
+
/*
under WIN32, we use the void* oslModule
as a WIN32 HANDLE (which is also a 32-bit value)
@@ -61,9 +64,9 @@ oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 nRtldMod
if ( osl_File_E_None != nError )
rtl_uString_assign(&Module, strModuleName);
- hInstance = LoadLibraryW(Module->buffer);
+ hInstance = LoadLibraryW(reinterpret_cast<LPCWSTR>(Module->buffer));
if (hInstance == NULL)
- hInstance = LoadLibraryExW(Module->buffer, NULL,
+ hInstance = LoadLibraryExW(reinterpret_cast<LPCWSTR>(Module->buffer), NULL,
LOAD_WITH_ALTERED_SEARCH_PATH);
if (hInstance <= (HINSTANCE)HINSTANCE_ERROR)
@@ -85,7 +88,7 @@ oslModule SAL_CALL osl_loadModule(rtl_uString *strModuleName, sal_Int32 nRtldMod
sal_Bool SAL_CALL
osl_getModuleHandle(rtl_uString *pModuleName, oslModule *pResult)
{
- HINSTANCE hInstance = GetModuleHandleW(pModuleName->buffer);
+ HINSTANCE hInstance = GetModuleHandleW(reinterpret_cast<LPCWSTR>(pModuleName->buffer));
if( hInstance )
{
*pResult = (oslModule) hInstance;
@@ -309,22 +312,22 @@ static sal_Bool SAL_CALL _osl_addressGetModuleURL_NT4( void *pv, rtl_uString **p
if ( lpfnSymInitialize && lpfnSymCleanup && lpfnSymGetModuleInfo )
{
IMAGEHLP_MODULE ModuleInfo;
- CHAR szModuleFileName[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aModuleFileName( MAX_LONG_PATH );
LPSTR lpSearchPath = NULL;
- if ( GetModuleFileNameA( NULL, szModuleFileName, sizeof(szModuleFileName) ) )
+ if ( GetModuleFileNameA( NULL, aModuleFileName, aModuleFileName.getBufSizeInSymbols() ) )
{
- char *pLastBkSlash = strrchr( szModuleFileName, '\\' );
+ char *pLastBkSlash = strrchr( aModuleFileName, '\\' );
if (
pLastBkSlash &&
- pLastBkSlash > szModuleFileName
+ pLastBkSlash > (sal_Char*)aModuleFileName
&& *(pLastBkSlash - 1) != ':'
&& *(pLastBkSlash - 1) != '\\'
)
{
*pLastBkSlash = 0;
- lpSearchPath = szModuleFileName;
+ lpSearchPath = aModuleFileName;
}
}
@@ -423,12 +426,12 @@ static sal_Bool SAL_CALL _osl_addressGetModuleURL_NT( void *pv, rtl_uString **pu
if ( (BYTE *)pv >= (BYTE *)modinfo.lpBaseOfDll && (BYTE *)pv < (BYTE *)modinfo.lpBaseOfDll + modinfo.SizeOfImage )
{
- WCHAR szBuffer[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
rtl_uString *ustrSysPath = NULL;
- GetModuleFileNameW( lpModules[iModule], szBuffer, bufsizeof(szBuffer) );
+ GetModuleFileNameW( lpModules[iModule], ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), aBuffer.getBufSizeInSymbols() );
- rtl_uString_newFromStr( &ustrSysPath, szBuffer );
+ rtl_uString_newFromStr( &ustrSysPath, aBuffer );
osl_getFileURLFromSystemPath( ustrSysPath, pustrURL );
rtl_uString_release( ustrSysPath );
diff --git a/sal/osl/w32/path_helper.hxx b/sal/osl/w32/path_helper.hxx
index 106f2a76f043..d157b42aa428 100644
--- a/sal/osl/w32/path_helper.hxx
+++ b/sal/osl/w32/path_helper.hxx
@@ -34,6 +34,7 @@
#include "path_helper.h"
#include <rtl/ustring.hxx>
+#include <rtl/allocator.hxx>
namespace osl
{
@@ -70,6 +71,48 @@ inline bool systemPathIsLogicalDrivePattern(/*in*/ const rtl::OUString& path)
return osl_systemPathIsLogicalDrivePattern(path.pData);
}
+/*******************************************************************
+ LongPathBuffer
+ ******************************************************************/
+template< class T >
+class LongPathBuffer
+{
+ T* m_pBuffer;
+ sal_uInt32 m_nCharNum;
+
+ LongPathBuffer();
+ LongPathBuffer( const LongPathBuffer& );
+ LongPathBuffer& operator=( const LongPathBuffer& );
+
+public:
+ LongPathBuffer( sal_uInt32 nCharNum )
+ : m_pBuffer( reinterpret_cast<T*>( rtl_allocateMemory( nCharNum * sizeof( T ) ) ) )
+ , m_nCharNum( nCharNum )
+ {
+ OSL_ENSURE( m_pBuffer, "Can not allocate the buffer!" );
+ }
+
+ ~LongPathBuffer()
+ {
+ if ( m_pBuffer )
+ rtl_freeMemory( m_pBuffer );
+ m_pBuffer = 0;
+ }
+
+ sal_uInt32 getBufSizeInSymbols()
+ {
+ return m_nCharNum;
+ }
+
+ operator T* ()
+ {
+ return m_pBuffer;
+ }
+
+};
+
+ template< class U, class T > U mingw_reinterpret_cast(LongPathBuffer<T>& a) { return reinterpret_cast<U>(static_cast<T*>(a)); }
+
} // end namespace osl
#endif
diff --git a/sal/osl/w32/process.c b/sal/osl/w32/process.cxx
index 334ae7aef726..b8b2d3893345 100644
--- a/sal/osl/w32/process.c
+++ b/sal/osl/w32/process.cxx
@@ -1,29 +1,29 @@
/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
#define UNICODE
#include "system.h"
@@ -43,6 +43,8 @@
#include "procimpl.h"
#include "sockimpl.h"
+#include "file_url.h"
+#include "path_helper.hxx"
#include <rtl/ustrbuf.h>
#include <rtl/alloc.h>
@@ -72,7 +74,7 @@ oslProcess SAL_CALL osl_getProcess(oslProcessIdentifier Ident)
if (hProcess)
{
- pProcImpl = rtl_allocateMemory(sizeof(oslProcessImpl));
+ pProcImpl = reinterpret_cast< oslProcessImpl*>( rtl_allocateMemory(sizeof(oslProcessImpl)) );
pProcImpl->m_hProcess = hProcess;
pProcImpl->m_IdProcess = Ident;
}
@@ -216,19 +218,19 @@ oslProcessError SAL_CALL osl_joinProcessWithTimeout(oslProcess Process, const Ti
*
***************************************************************************/
-oslProcessError SAL_CALL osl_bootstrap_getExecutableFile_Impl (
+extern "C" oslProcessError SAL_CALL osl_bootstrap_getExecutableFile_Impl (
rtl_uString ** ppFileURL
) SAL_THROW_EXTERN_C()
{
oslProcessError result = osl_Process_E_NotFound;
- TCHAR buffer[MAX_PATH];
- DWORD buflen;
+ ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
+ DWORD buflen = 0;
- if ((buflen = GetModuleFileNameW (0, buffer, MAX_PATH)) > 0)
+ if ((buflen = GetModuleFileNameW (0, ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), aBuffer.getBufSizeInSymbols())) > 0)
{
rtl_uString * pAbsPath = 0;
- rtl_uString_newFromStr_WithLength (&(pAbsPath), buffer, buflen);
+ rtl_uString_newFromStr_WithLength (&(pAbsPath), aBuffer, buflen);
if (pAbsPath)
{
/* Convert from path to url. */
@@ -277,21 +279,21 @@ static rtl_uString ** osl_createCommandArgs_Impl (int argc, char ** argv)
for (i = 0; i < nArgs; i++)
{
/* Convert to unicode */
- rtl_uString_newFromStr( &(ppArgs[i]), wargv[i] );
+ rtl_uString_newFromStr( &(ppArgs[i]), reinterpret_cast<const sal_Unicode*>(wargv[i]) );
}
if (ppArgs[0] != 0)
{
/* Ensure absolute path */
- DWORD dwResult;
- TCHAR szBuffer[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
+ DWORD dwResult = 0;
dwResult = SearchPath (
- 0, ppArgs[0]->buffer, L".exe", MAX_PATH, szBuffer, 0);
- if ((0 < dwResult) && (dwResult < MAX_PATH))
+ 0, reinterpret_cast<LPCWSTR>(ppArgs[0]->buffer), L".exe", aBuffer.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), 0);
+ if ((0 < dwResult) && (dwResult < aBuffer.getBufSizeInSymbols()))
{
/* Replace argv[0] with it's absolute path */
rtl_uString_newFromStr_WithLength(
- &(ppArgs[0]), szBuffer, dwResult);
+ &(ppArgs[0]), aBuffer, dwResult);
}
}
if (ppArgs[0] != 0)
@@ -399,9 +401,9 @@ oslProcessError SAL_CALL osl_getEnvironment(rtl_uString *ustrVar, rtl_uString **
{
WCHAR buff[ENV_BUFFER_SIZE];
- if (GetEnvironmentVariableW(ustrVar->buffer, buff, ENV_BUFFER_SIZE) > 0)
+ if (GetEnvironmentVariableW(reinterpret_cast<LPCWSTR>(ustrVar->buffer), buff, ENV_BUFFER_SIZE) > 0)
{
- rtl_uString_newFromStr(ustrValue, buff);
+ rtl_uString_newFromStr(ustrValue, reinterpret_cast<const sal_Unicode*>(buff));
return osl_Process_E_None;
}
return osl_Process_E_Unknown;
@@ -411,24 +413,24 @@ oslProcessError SAL_CALL osl_getEnvironment(rtl_uString *ustrVar, rtl_uString **
* Current Working Directory.
***************************************************************************/
-extern oslMutex g_CurrentDirectoryMutex;
+extern "C" oslMutex g_CurrentDirectoryMutex;
oslProcessError SAL_CALL osl_getProcessWorkingDir( rtl_uString **pustrWorkingDir )
{
- TCHAR szBuffer[MAX_PATH];
- DWORD dwLen;
+ ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
+ DWORD dwLen = 0;
osl_acquireMutex( g_CurrentDirectoryMutex );
- dwLen = GetCurrentDirectory( sizeof(szBuffer) / sizeof(TCHAR), szBuffer );
+ dwLen = GetCurrentDirectory( aBuffer.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer) );
osl_releaseMutex( g_CurrentDirectoryMutex );
- if ( dwLen )
+ if ( dwLen && dwLen < aBuffer.getBufSizeInSymbols() )
{
oslFileError eError;
rtl_uString *ustrTemp = NULL;;
- rtl_uString_newFromStr_WithLength( &ustrTemp, szBuffer, dwLen );
+ rtl_uString_newFromStr_WithLength( &ustrTemp, aBuffer, dwLen );
eError = osl_getFileURLFromSystemPath( ustrTemp, pustrWorkingDir );
rtl_uString_release( ustrTemp );
@@ -446,7 +448,7 @@ oslProcessError SAL_CALL osl_getProcessWorkingDir( rtl_uString **pustrWorkingDir
* Process Locale.
***************************************************************************/
-extern void _imp_getProcessLocale( rtl_Locale ** ppLocale );
+extern "C" void _imp_getProcessLocale( rtl_Locale ** ppLocale );
static rtl_Locale * g_theProcessLocale = NULL;
diff --git a/sal/osl/w32/profile.c b/sal/osl/w32/profile.cxx
index 5a709cddc3f5..9f4ea5630e1f 100644
--- a/sal/osl/w32/profile.c
+++ b/sal/osl/w32/profile.cxx
@@ -1,39 +1,44 @@
/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
#include "system.h"
+#include "file_url.h"
+#include "path_helper.hxx"
+
#include <osl/diagnose.h>
#include <osl/profile.h>
#include <osl/process.h>
#include <osl/file.h>
#include <osl/util.h>
#include <rtl/alloc.h>
+#include <algorithm>
+using std::min;
+static inline void copy_ustr_n( void *dest, const void *source, size_t length ) { rtl_copyMemory(dest, source, length*sizeof(sal_Unicode)); }
#define LINES_INI 32
#define LINES_ADD 10
@@ -499,10 +504,10 @@ sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile,
}
else
{
- CHAR szFileName[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, szFileName, MAX_PATH, NULL, NULL);
- GetPrivateProfileString(pszSection, pszEntry, pszDefault, pszString, MaxLen, szFileName);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
+ GetPrivateProfileString(pszSection, pszEntry, pszDefault, pszString, MaxLen, aFileName);
}
releaseProfile(pProfile);
@@ -680,10 +685,10 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile,
}
else
{
- CHAR szFileName[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, szFileName, MAX_PATH, NULL, NULL);
- WritePrivateProfileString(pszSection, pszEntry, pszString, szFileName);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
+ WritePrivateProfileString(pszSection, pszEntry, pszString, aFileName);
}
bRet = releaseProfile(pProfile);
@@ -791,10 +796,10 @@ sal_Bool SAL_CALL osl_removeProfileEntry(oslProfile Profile,
}
else
{
- CHAR szFileName[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, szFileName, MAX_PATH, NULL, NULL);
- WritePrivateProfileString(pszSection, pszEntry, NULL, szFileName);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
+ WritePrivateProfileString(pszSection, pszEntry, NULL, aFileName);
}
bRet = releaseProfile(pProfile);
@@ -865,10 +870,10 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, const sal_C
}
else
{
- CHAR szFileName[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, szFileName, MAX_PATH, NULL, NULL);
- n = GetPrivateProfileString(pszSection, NULL, NULL, pszBuffer, MaxLen, szFileName);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
+ n = GetPrivateProfileString(pszSection, NULL, NULL, pszBuffer, MaxLen, aFileName);
}
releaseProfile(pProfile);
@@ -884,9 +889,9 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, const sal_C
sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName, rtl_uString** strProfileName)
{
sal_Bool bFailed;
- sal_Unicode wcsFile[MAX_PATH];
- sal_Unicode wcsPath[MAX_PATH];
- sal_uInt32 nFileLen;
+ ::osl::LongPathBuffer< sal_Unicode > aFile( MAX_LONG_PATH );
+ ::osl::LongPathBuffer< sal_Unicode > aPath( MAX_LONG_PATH );
+ sal_uInt32 nFileLen = 0;
sal_uInt32 nPathLen = 0;
rtl_uString * strTmp = NULL;
@@ -895,19 +900,19 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
/* build file name */
if (strName && strName->length)
{
- if(strName->length >= MAX_PATH)
+ if( ::sal::static_int_cast< sal_uInt32 >( strName->length ) >= aFile.getBufSizeInSymbols() )
return sal_False;
- wcscpy(wcsFile, strName->buffer);
+ copy_ustr_n( aFile, strName->buffer, strName->length+1);
nFileLen = strName->length;
- if (rtl_ustr_indexOfChar( wcsFile, L'.' ) == -1)
+ if (rtl_ustr_indexOfChar( aFile, L'.' ) == -1)
{
- if (nFileLen + wcslen(STR_INI_EXTENSION) >= MAX_PATH)
+ if (nFileLen + wcslen(STR_INI_EXTENSION) >= aFile.getBufSizeInSymbols())
return sal_False;
/* add default extension */
- wcscpy(wcsFile + nFileLen, STR_INI_EXTENSION);
+ copy_ustr_n( aFile + nFileLen, STR_INI_EXTENSION, wcslen(STR_INI_EXTENSION)+1 );
nFileLen += wcslen(STR_INI_EXTENSION);
}
}
@@ -934,22 +939,22 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
if ((nPos = rtl_ustr_lastIndexOfChar( pProgName, L'.' )) != -1 )
nLen -= 4;
- if ((nFileLen = nLen - nOffset) >= MAX_PATH)
+ if ((nFileLen = nLen - nOffset) >= aFile.getBufSizeInSymbols())
return sal_False;
- wcsncpy(wcsFile, pProgName + nOffset, nFileLen);
+ copy_ustr_n(aFile, pProgName + nOffset, nFileLen);
- if (nFileLen + wcslen(STR_INI_EXTENSION) >= MAX_PATH)
+ if (nFileLen + wcslen(STR_INI_EXTENSION) >= aFile.getBufSizeInSymbols())
return sal_False;
/* add default extension */
- wcscpy(wcsFile + nFileLen, STR_INI_EXTENSION);
+ copy_ustr_n(aFile + nFileLen, STR_INI_EXTENSION, wcslen(STR_INI_EXTENSION)+1);
nFileLen += wcslen(STR_INI_EXTENSION);
rtl_uString_release( strProgName );
}
- if (wcsFile[0] == 0)
+ if (aFile[0] == 0)
return sal_False;
/* build directory path */
@@ -969,10 +974,10 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
if (bFailed) return (sal_False);
- if (strHome->length >= MAX_PATH)
+ if ( ::sal::static_int_cast< sal_uInt32 >( strHome->length ) >= aPath.getBufSizeInSymbols())
return sal_False;
- wcscpy( wcsPath, strHome->buffer);
+ copy_ustr_n( aPath, strHome->buffer, strHome->length+1);
nPathLen = strHome->length;
if (nLen > RTL_CONSTASCII_LENGTH(STR_INI_METAHOME))
@@ -980,10 +985,10 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
pPath += RTL_CONSTASCII_LENGTH(STR_INI_METAHOME);
nLen -= RTL_CONSTASCII_LENGTH(STR_INI_METAHOME);
- if (nLen + nPathLen >= MAX_PATH)
+ if (nLen + nPathLen >= aPath.getBufSizeInSymbols())
return sal_False;
- wcscpy(wcsPath + nPathLen, pPath);
+ copy_ustr_n(aPath + nPathLen, pPath, nLen+1);
nPathLen += nLen;
}
@@ -1001,10 +1006,10 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
if (bFailed) return (sal_False);
- if (strConfig->length >= MAX_PATH)
+ if ( ::sal::static_int_cast< sal_uInt32 >( strConfig->length ) >= aPath.getBufSizeInSymbols())
return sal_False;
- wcscpy( wcsPath, strConfig->buffer);
+ copy_ustr_n( aPath, strConfig->buffer, strConfig->length+1 );
nPathLen = strConfig->length;
if (nLen > RTL_CONSTASCII_LENGTH(STR_INI_METACFG))
@@ -1012,10 +1017,10 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
pPath += RTL_CONSTASCII_LENGTH(STR_INI_METACFG);
nLen -= RTL_CONSTASCII_LENGTH(STR_INI_METACFG);
- if (nLen + nPathLen >= MAX_PATH)
+ if (nLen + nPathLen >= aPath.getBufSizeInSymbols())
return sal_False;
- wcscpy(wcsPath + nPathLen, pPath);
+ copy_ustr_n(aPath + nPathLen, pPath, nLen+1);
nPathLen += nLen;
}
@@ -1025,7 +1030,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
else if ((rtl_ustr_ascii_compare_WithLength(pPath, RTL_CONSTASCII_LENGTH(STR_INI_METASYS), STR_INI_METASYS) == 0) &&
((nLen == RTL_CONSTASCII_LENGTH(STR_INI_METASYS)) || (pPath[RTL_CONSTASCII_LENGTH(STR_INI_METASYS)] == '/')))
{
- if (((nPathLen = GetWindowsDirectoryW(wcsPath, MAX_PATH)) == 0) || (nPathLen >= MAX_PATH))
+ if (((nPathLen = GetWindowsDirectoryW(::osl::mingw_reinterpret_cast<LPWSTR>(aPath), aPath.getBufSizeInSymbols())) == 0) || (nPathLen >= aPath.getBufSizeInSymbols()))
return (sal_False);
if (nLen > RTL_CONSTASCII_LENGTH(STR_INI_METASYS))
@@ -1033,10 +1038,10 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
pPath += RTL_CONSTASCII_LENGTH(STR_INI_METASYS);
nLen -= RTL_CONSTASCII_LENGTH(STR_INI_METASYS);
- if (nLen + nPathLen >= MAX_PATH)
+ if (nLen + nPathLen >= aPath.getBufSizeInSymbols())
return sal_False;
- wcscpy(wcsPath + nPathLen, pPath);
+ copy_ustr_n(aPath + nPathLen, pPath, nLen+1);
nPathLen += nLen;
}
}
@@ -1045,16 +1050,16 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
((nLen == RTL_CONSTASCII_LENGTH(STR_INI_METAINS)) || (pPath[RTL_CONSTASCII_LENGTH(STR_INI_METAINS)] == '/') ||
(pPath[RTL_CONSTASCII_LENGTH(STR_INI_METAINS)] == '"') ) )
{
- if (! lookupProfile(pPath + RTL_CONSTASCII_LENGTH(STR_INI_METAINS), wcsFile, wcsPath))
+ if (! lookupProfile(pPath + RTL_CONSTASCII_LENGTH(STR_INI_METAINS), aFile, aPath))
return (sal_False);
- nPathLen = wcslen(wcsPath);
+ nPathLen = rtl_ustr_getLength(aPath);
}
- else if(nLen < MAX_PATH)
+ else if( ::sal::static_int_cast< sal_uInt32 >( nLen ) < aPath.getBufSizeInSymbols())
{
- wcscpy(wcsPath, pPath);
- nPathLen = wcslen(wcsPath);
+ copy_ustr_n(aPath, pPath, nLen+1);
+ nPathLen = rtl_ustr_getLength(aPath);
}
else
return sal_False;
@@ -1068,28 +1073,28 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
osl_freeSecurityHandle(security);
if (bFailed) return (sal_False);
- if (strConfigDir->length >= MAX_PATH)
+ if ( ::sal::static_int_cast< sal_uInt32 >( strConfigDir->length ) >= aPath.getBufSizeInSymbols() )
return sal_False;
- wcscpy(wcsPath, strConfigDir->buffer);
+ copy_ustr_n(aPath, strConfigDir->buffer, strConfigDir->length+1);
nPathLen = strConfigDir->length;
}
- if (nPathLen && (wcsPath[nPathLen - 1] != L'/') && (wcsPath[nPathLen - 1] != L'\\'))
+ if (nPathLen && (aPath[nPathLen - 1] != L'/') && (aPath[nPathLen - 1] != L'\\'))
{
- wcsPath[nPathLen++] = L'\\';
- wcsPath[nPathLen] = 0;
+ aPath[nPathLen++] = L'\\';
+ aPath[nPathLen] = 0;
}
- if (nPathLen + nFileLen >= MAX_PATH)
+ if (nPathLen + nFileLen >= aPath.getBufSizeInSymbols())
return sal_False;
/* append file name */
- wcscpy(wcsPath + nPathLen, wcsFile);
+ copy_ustr_n(aPath + nPathLen, aFile, nFileLen+1);
nPathLen += nFileLen;
/* copy filename */
- rtl_uString_newFromStr_WithLength(&strTmp, wcsPath, nPathLen);
+ rtl_uString_newFromStr_WithLength(&strTmp, aPath, nPathLen);
nError = osl_getFileURLFromSystemPath(strTmp, strProfileName);
rtl_uString_release(strTmp);
@@ -1137,10 +1142,10 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuff
}
else
{
- CHAR szFileName[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, szFileName, MAX_PATH, NULL, NULL);
- n = GetPrivateProfileSectionNames(pszBuffer, MaxLen, szFileName);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
+ n = GetPrivateProfileSectionNames(pszBuffer, MaxLen, aFileName);
}
releaseProfile(pProfile);
@@ -1151,35 +1156,6 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuff
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
/*****************************************************************************/
/* Static Module Functions */
/*****************************************************************************/
@@ -1284,7 +1260,7 @@ static sal_Bool lockFile(const osl_TFile* pFile, osl_TLockMode eMode)
static osl_TFile* openFileImpl(rtl_uString * strFileName, oslProfileOption ProfileFlags )
{
- osl_TFile* pFile = calloc(1, sizeof(osl_TFile));
+ osl_TFile* pFile = reinterpret_cast< osl_TFile*>( calloc( 1, sizeof(osl_TFile) ) );
sal_Bool bWriteable = sal_False;
/* if ( ProfileFlags & ( osl_Profile_WRITELOCK | osl_Profile_FLUSHWRITE | osl_Profile_READWRITE ) )*/
@@ -1303,7 +1279,7 @@ static osl_TFile* openFileImpl(rtl_uString * strFileName, oslProfileOption Profi
OSL_TRACE("opening '%s' read only\n",pszFilename);
#endif
- pFile->m_Handle = CreateFileW( rtl_uString_getStr( strFileName ), GENERIC_READ,
+ pFile->m_Handle = CreateFileW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strFileName )), GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -1316,7 +1292,7 @@ static osl_TFile* openFileImpl(rtl_uString * strFileName, oslProfileOption Profi
OSL_TRACE("opening '%s' read/write\n",pszFilename);
#endif
- if ((pFile->m_Handle = CreateFileW( rtl_uString_getStr( strFileName ), GENERIC_READ | GENERIC_WRITE,
+ if ((pFile->m_Handle = CreateFileW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( strFileName )), GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL))
== INVALID_HANDLE_VALUE)
@@ -2160,13 +2136,13 @@ static sal_Bool osl_ProfileSwapProfileNames(osl_TProfileImpl* pProfile)
/* unlink bak */
- DeleteFileW( rtl_uString_getStr( ustrBakFile ) );
+ DeleteFileW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrBakFile )) );
/* rename ini bak */
- MoveFileExW( rtl_uString_getStr( ustrIniFile ), rtl_uString_getStr( ustrBakFile ), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH );
+ MoveFileExW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrIniFile )), reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrBakFile )), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH );
/* rename tmp ini */
- MoveFileExW( rtl_uString_getStr( ustrTmpFile ), rtl_uString_getStr( ustrIniFile ), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH );
+ MoveFileExW( reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrTmpFile )), reinterpret_cast<LPCWSTR>(rtl_uString_getStr( ustrIniFile )), MOVEFILE_COPY_ALLOWED | MOVEFILE_WRITE_THROUGH );
return bRet;
}
@@ -2223,7 +2199,7 @@ static osl_TProfileImpl* acquireProfile(oslProfile Profile, sal_Bool bWriteable)
- if ((pProfile = osl_openProfile(NULL, PFlags)) != NULL )
+ if ( ( pProfile = (osl_TProfileImpl*)osl_openProfile( NULL, PFlags ) ) != NULL )
{
pProfile->m_Flags |= FLG_AUTOOPEN;
}
@@ -2330,7 +2306,8 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
sal_Char Buffer[4096] = "";
sal_Char Product[132] = "";
- WCHAR wcsPath[MAX_PATH] = L"";
+ ::osl::LongPathBuffer< sal_Unicode > aPath( MAX_LONG_PATH );
+ aPath[0] = 0;
DWORD dwPathLen = 0;
if (*strPath == L'"')
@@ -2342,7 +2319,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
while ((strPath[i] != L'"') && (strPath[i] != L'\0'))
i++;
- WideCharToMultiByte(CP_ACP,0, strPath, i, Product, sizeof(Product), NULL, NULL);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(strPath), i, Product, sizeof(Product), NULL, NULL);
Product[i] = '\0';
strPath += i;
@@ -2364,7 +2341,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
rtl_uString * strSVFallback = NULL;
rtl_uString * strSVLocation = NULL;
rtl_uString * strSVName = NULL;
- sal_Char Dir[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aDir( MAX_LONG_PATH );
oslProfile hProfile;
rtl_uString_newFromAscii(&strSVFallback, SVERSION_FALLBACK);
@@ -2390,11 +2367,11 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
&& (stricmp(Product, pChr) < 0))
{
osl_readProfileString(
- hProfile, SVERSION_SECTION, pChr, Dir,
- sizeof(Dir), "");
+ hProfile, SVERSION_SECTION, pChr, aDir,
+ aDir.getBufSizeInSymbols(), "");
/* check for existence of path */
- if (access(Dir, 0) >= 0)
+ if (access(aDir, 0) >= 0)
strcpy(Product, pChr);
}
}
@@ -2425,11 +2402,11 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
&& (stricmp(Product, pChr) < 0))
{
osl_readProfileString(
- hProfile, SVERSION_SECTION, pChr, Dir,
- sizeof(Dir), "");
+ hProfile, SVERSION_SECTION, pChr, aDir,
+ aDir.getBufSizeInSymbols(), "");
/* check for existence of path */
- if (access(Dir, 0) >= 0)
+ if (access(aDir, 0) >= 0)
strcpy(Product, pChr);
}
}
@@ -2469,31 +2446,31 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
((nEnd = rtl_ustr_indexOfChar(pCommandArg + nStart + 1, L']')) != -1))
{
dwPathLen = nEnd;
- wcsncpy(wcsPath, pCommandArg + nStart + 1, dwPathLen );
- wcsPath[dwPathLen] = 0;
+ copy_ustr_n(aPath, pCommandArg + nStart + 1, dwPathLen);
+ aPath[dwPathLen] = 0;
/* build full path */
- if ((wcsPath[dwPathLen - 1] != L'/') && (wcsPath[dwPathLen - 1] != L'\\'))
+ if ((aPath[dwPathLen - 1] != L'/') && (aPath[dwPathLen - 1] != L'\\'))
{
- wcscpy(wcsPath + dwPathLen++, L"/");
+ copy_ustr_n(aPath + dwPathLen++, L"/", 2);
}
if (*strPath)
{
- wcscpy(wcsPath + dwPathLen, strPath);
- dwPathLen += wcslen(strPath);
+ copy_ustr_n(aPath + dwPathLen, strPath, rtl_ustr_getLength(strPath)+1);
+ dwPathLen += rtl_ustr_getLength(strPath);
}
else
{
- CHAR szPath[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH );
int n;
- if ((n = WideCharToMultiByte(CP_ACP,0, wcsPath, -1, szPath, MAX_PATH, NULL, NULL)) > 0)
+ if ((n = WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL)) > 0)
{
- strcpy(szPath + n, SVERSION_USER);
- if (access(szPath, 0) >= 0)
+ strcpy(aTmpPath + n, SVERSION_USER);
+ if (access(aTmpPath, 0) >= 0)
{
- dwPathLen += MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, wcsPath + dwPathLen, MAX_PATH - dwPathLen );
+ dwPathLen += MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, reinterpret_cast<LPWSTR>(aPath + dwPathLen), aPath.getBufSizeInSymbols() - dwPathLen );
}
}
}
@@ -2533,22 +2510,22 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
}
else
{
- wcsncpy(wcsPath, strExecutable->buffer, nPos );
- wcsPath[nPos] = 0;
+ copy_ustr_n(aPath, strExecutable->buffer, nPos);
+ aPath[nPos] = 0;
dwPathLen = nPos;
}
}
else
{
- wcsncpy(wcsPath, strExecutable->buffer, nPos );
+ copy_ustr_n(aPath, strExecutable->buffer, nPos);
dwPathLen = nPos;
- wcsPath[dwPathLen] = 0;
+ aPath[dwPathLen] = 0;
}
/* if we have no product identification use the executable file name */
if (*Product == 0)
{
- WideCharToMultiByte(CP_ACP,0, strExecutable->buffer + nPos + 1, -1, Product, sizeof(Product), NULL, NULL);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(strExecutable->buffer + nPos + 1), -1, Product, sizeof(Product), NULL, NULL);
/* remove extension */
if ((pChr = strrchr(Product, '.')) != NULL)
@@ -2558,30 +2535,30 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
rtl_uString_release(strExecutable);
/* remember last subdir */
- nPos = rtl_ustr_lastIndexOfChar(wcsPath, L'\\');
+ nPos = rtl_ustr_lastIndexOfChar(aPath, L'\\');
- wcscpy(wcsPath + dwPathLen++, L"\\");
+ copy_ustr_n(aPath + dwPathLen++, L"\\", 2);
if (*strPath)
{
- wcscpy(wcsPath + dwPathLen, strPath);
- dwPathLen += wcslen(strPath);
+ copy_ustr_n(aPath + dwPathLen, strPath, rtl_ustr_getLength(strPath)+1);
+ dwPathLen += rtl_ustr_getLength(strPath);
}
{
- CHAR szPath[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, wcsPath, -1, szPath, MAX_PATH, NULL, NULL);
+ WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL);
/* if file not exists, remove any specified subdirectories
like "bin" or "program" */
- if (((access(szPath, 0) < 0) && (nPos != -1)) || (*strPath == 0))
+ if (((access(aTmpPath, 0) < 0) && (nPos != -1)) || (*strPath == 0))
{
static sal_Char *SubDirs[] = SVERSION_DIRS;
int i = 0;
- pStr = szPath + nPos;
+ pStr = aTmpPath + nPos;
for (i = 0; i < (sizeof(SubDirs) / sizeof(SubDirs[0])); i++)
if (strnicmp(pStr + 1, SubDirs[i], strlen(SubDirs[i])) == 0)
@@ -2589,19 +2566,19 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
if ( *strPath == 0)
{
strcpy(pStr + 1,SVERSION_USER);
- if ( access(szPath, 0) < 0 )
+ if ( access(aTmpPath, 0) < 0 )
{
*(pStr+1)='\0';
}
else
{
- dwPathLen = nPos + MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, wcsPath + nPos + 1, MAX_PATH - (nPos + 1) );
+ dwPathLen = nPos + MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, reinterpret_cast<LPWSTR>(aPath + nPos + 1), aPath.getBufSizeInSymbols() - (nPos + 1) );
}
}
else
{
- wcscpy(wcsPath + nPos + 1, strPath);
- dwPathLen = nPos + 1 + wcslen(strPath);
+ copy_ustr_n(aPath + nPos + 1, strPath, rtl_ustr_getLength(strPath)+1);
+ dwPathLen = nPos + 1 + rtl_ustr_getLength(strPath);
}
break;
@@ -2609,20 +2586,20 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
}
}
- if ((wcsPath[dwPathLen - 1] != L'/') && (wcsPath[dwPathLen - 1] != L'\\'))
+ if ((aPath[dwPathLen - 1] != L'/') && (aPath[dwPathLen - 1] != L'\\'))
{
- wcsPath[dwPathLen++] = L'\\';
- wcsPath[dwPathLen] = 0;
+ aPath[dwPathLen++] = L'\\';
+ aPath[dwPathLen] = 0;
}
- wcscpy(wcsPath + dwPathLen, strFile);
+ copy_ustr_n(aPath + dwPathLen, strFile, rtl_ustr_getLength(strFile)+1);
{
- CHAR szPath[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, wcsPath, -1, szPath, MAX_PATH, NULL, NULL);
+ WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL);
- if ((access(szPath, 0) < 0) && (strlen(Product) > 0))
+ if ((access(aTmpPath, 0) < 0) && (strlen(Product) > 0))
{
rtl_uString * strSVFallback = NULL;
rtl_uString * strSVProfile = NULL;
@@ -2671,38 +2648,38 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
if (strlen(Buffer) > 0)
{
dwPathLen = MultiByteToWideChar(
- CP_ACP, 0, Buffer, -1, wcsPath, MAX_PATH );
+ CP_ACP, 0, Buffer, -1, ::osl::mingw_reinterpret_cast<LPWSTR>(aPath), aPath.getBufSizeInSymbols() );
dwPathLen -=1;
/* build full path */
- if ((wcsPath[dwPathLen - 1] != L'/')
- && (wcsPath[dwPathLen - 1] != L'\\'))
+ if ((aPath[dwPathLen - 1] != L'/')
+ && (aPath[dwPathLen - 1] != L'\\'))
{
- wcscpy(wcsPath + dwPathLen++, L"\\");
+ copy_ustr_n(aPath + dwPathLen++, L"\\", 2);
}
if (*strPath)
{
- wcscpy(wcsPath + dwPathLen, strPath);
- dwPathLen += wcslen(strPath);
+ copy_ustr_n(aPath + dwPathLen, strPath, rtl_ustr_getLength(strPath)+1);
+ dwPathLen += rtl_ustr_getLength(strPath);
}
else
{
- CHAR szPath[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH );
int n;
if ((n = WideCharToMultiByte(
- CP_ACP,0, wcsPath, -1, szPath,
- MAX_PATH, NULL, NULL))
+ CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath,
+ aTmpPath.getBufSizeInSymbols(), NULL, NULL))
> 0)
{
- strcpy(szPath + n, SVERSION_USER);
- if (access(szPath, 0) >= 0)
+ strcpy(aTmpPath + n, SVERSION_USER);
+ if (access(aTmpPath, 0) >= 0)
{
dwPathLen += MultiByteToWideChar(
CP_ACP, 0, SVERSION_USER, -1,
- wcsPath + dwPathLen,
- MAX_PATH - dwPathLen );
+ reinterpret_cast<LPWSTR>(aPath + dwPathLen),
+ aPath.getBufSizeInSymbols() - dwPathLen );
}
}
}
@@ -2718,11 +2695,11 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
}
}
- wcsPath[dwPathLen] = 0;
+ aPath[dwPathLen] = 0;
}
/* copy filename */
- wcscpy(strProfile, wcsPath);
+ copy_ustr_n(strProfile, aPath, dwPathLen+1);
return sal_True;
}
diff --git a/sal/osl/w32/signal.c b/sal/osl/w32/signal.cxx
index 3e1f6d8105b7..f893f7520d40 100644
--- a/sal/osl/w32/signal.c
+++ b/sal/osl/w32/signal.cxx
@@ -1,34 +1,37 @@
/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
+*
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* Copyright 2000, 2010 Oracle and/or its affiliates.
+*
+* OpenOffice.org - a multi-platform office productivity suite
+*
+* 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
+* <http://www.openoffice.org/license.html>
+* for a copy of the LGPLv3 License.
+*
+************************************************************************/
/* system headers */
#include "system.h"
#include <tchar.h>
+#include "file_url.h"
+#include "path_helper.hxx"
+
#include <osl/diagnose.h>
#include <osl/mutex.h>
#include <osl/signal.h>
@@ -112,7 +115,7 @@ static BOOL ReportCrash( LPEXCEPTION_POINTERS lpEP )
BOOL fSuccess = FALSE;
BOOL fAutoReport = FALSE;
TCHAR szBuffer[1024];
- TCHAR szPath[MAX_PATH];
+ ::osl::LongPathBuffer< sal_Char > aPath( MAX_LONG_PATH );
LPTSTR lpFilePart;
PROCESS_INFORMATION ProcessInfo;
STARTUPINFO StartupInfo;
@@ -164,11 +167,11 @@ static BOOL ReportCrash( LPEXCEPTION_POINTERS lpEP )
value_len = quote - value;
}
- lpVariable = _alloca( variable_len + 1 );
+ lpVariable = reinterpret_cast< CHAR* >( _alloca( variable_len + 1 ) );
memcpy( lpVariable, variable, variable_len );
lpVariable[variable_len] = 0;
- lpValue = _alloca( value_len + 1);
+ lpValue = reinterpret_cast< CHAR* >( _alloca( value_len + 1) );
memcpy( lpValue, value, value_len );
lpValue[value_len] = 0;
@@ -177,7 +180,7 @@ static BOOL ReportCrash( LPEXCEPTION_POINTERS lpEP )
}
}
- if ( SearchPath( NULL, TEXT("crashrep.exe"), NULL, MAX_PATH, szPath, &lpFilePart ) )
+ if ( SearchPath( NULL, TEXT( "crashrep.exe" ), NULL, aPath.getBufSizeInSymbols(), aPath, &lpFilePart ) )
{
ZeroMemory( &StartupInfo, sizeof(StartupInfo) );
StartupInfo.cb = sizeof(StartupInfo.cb);
@@ -185,7 +188,7 @@ static BOOL ReportCrash( LPEXCEPTION_POINTERS lpEP )
sntprintf( szBuffer, elementsof(szBuffer),
_T("%s -p %u -excp 0x%p -t %u%s"),
- szPath,
+ aPath,
GetCurrentProcessId(),
lpEP,
GetCurrentThreadId(),
@@ -314,6 +317,8 @@ static long WINAPI SignalHandlerFunction(LPEXCEPTION_POINTERS lpEP)
SetErrorMode(SEM_NOGPFAULTERRORBOX);
exit(255);
break;
+ default:
+ break;
}
return (EXCEPTION_CONTINUE_EXECUTION);
@@ -331,7 +336,7 @@ oslSignalHandler SAL_CALL osl_addSignalHandler(oslSignalHandlerFunction Handler,
if (! bInitSignal)
bInitSignal = InitSignal();
- pHandler = calloc(1, sizeof(oslSignalHandlerImpl));
+ pHandler = reinterpret_cast< oslSignalHandlerImpl* >( calloc( 1, sizeof(oslSignalHandlerImpl) ) );
if (pHandler != NULL)
{
diff --git a/sal/osl/w32/system.h b/sal/osl/w32/system.h
index cc3ebd47d574..1bd86994e6ce 100644
--- a/sal/osl/w32/system.h
+++ b/sal/osl/w32/system.h
@@ -105,10 +105,22 @@
#endif // #ifdef GCC
#ifdef _DLL_
+
+#ifdef __cplusplus
+ extern "C" DWORD g_dwPlatformId;
+#else
extern DWORD g_dwPlatformId;
+#endif // #ifdef __cplusplus
+
#define IS_NT (g_dwPlatformId == VER_PLATFORM_WIN32_NT)
#else
+
+#ifdef __cplusplus
+ extern "C" DWORD GetPlatformId(void);
+#else
extern DWORD GetPlatformId(void);
+#endif // #ifdef __cplusplus
+
#define IS_NT (GetPlatformId() == VER_PLATFORM_WIN32_NT)
#endif // #ifdef _DLL_
diff --git a/sal/osl/w32/tempfile.cxx b/sal/osl/w32/tempfile.cxx
index f5b7f32fea8f..6a3d2549004a 100644
--- a/sal/osl/w32/tempfile.cxx
+++ b/sal/osl/w32/tempfile.cxx
@@ -34,6 +34,7 @@
#include "file_error.h"
#include "file_url.h"
+#include "path_helper.hxx"
#include "osl/diagnose.h"
@@ -212,7 +213,7 @@ oslFileError SAL_CALL osl_createTempFile(
if (osl_File_E_None != osl_error)
return osl_error;
- /* allocate enough space on the stack */
+ /* allocate enough space on the stack, the file name can not be longer than MAX_PATH */
STACK_ALLOC(tmp_name, WCHAR, (rtl_uString_getLength(base_directory) + MAX_PATH));
if (tmp_name)
@@ -238,25 +239,21 @@ oslFileError SAL_CALL osl_createTempFile(
//#############################################
oslFileError SAL_CALL osl_getTempDirURL(rtl_uString** pustrTempDir)
{
- WCHAR szBuffer[MAX_PATH];
- LPWSTR lpBuffer = szBuffer;
- DWORD nBufferLength = ELEMENTS_OF_ARRAY(szBuffer) - 1;
+ ::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
+ LPWSTR lpBuffer = ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer);
+ DWORD nBufferLength = aBuffer.getBufSizeInSymbols() - 1;
DWORD nLength;
oslFileError error;
- do
+ nLength = GetTempPathW( aBuffer.getBufSizeInSymbols(), lpBuffer );
+
+ if ( nLength > nBufferLength )
{
- nLength = GetTempPathW( ELEMENTS_OF_ARRAY(szBuffer), lpBuffer );
- if ( nLength > nBufferLength )
- {
- nLength++;
- lpBuffer = reinterpret_cast<WCHAR*>(alloca( sizeof(WCHAR) * nLength ));
- nBufferLength = nLength - 1;
- }
- } while ( nLength > nBufferLength );
-
- if ( nLength )
+ // the provided path has invalid length
+ error = osl_File_E_NOENT;
+ }
+ else if ( nLength )
{
rtl_uString *ustrTempPath = NULL;
@@ -274,3 +271,4 @@ oslFileError SAL_CALL osl_getTempDirURL(rtl_uString** pustrTempDir)
return error;
}
+
diff --git a/sal/rtl/source/hash.cxx b/sal/rtl/source/hash.cxx
index ec5229002c4b..7caa2341ca11 100644
--- a/sal/rtl/source/hash.cxx
+++ b/sal/rtl/source/hash.cxx
@@ -36,52 +36,51 @@
#include <hash_set>
namespace {
- struct UStringHash
- {
- size_t operator()(rtl_uString * const &rString) const
- { return (size_t)rtl_ustr_hashCode_WithLength( rString->buffer, rString->length ); }
- };
- struct UStringEqual
- {
- sal_Bool operator() ( rtl_uString * const &pStringA,
- rtl_uString * const &pStringB) const
- {
- if (pStringA == pStringB)
- return true;
- if (pStringA->length != pStringB->length)
- return false;
- return !rtl_ustr_compare_WithLength( pStringA->buffer, pStringA->length,
- pStringB->buffer, pStringB->length);
- }
- };
-}
-typedef std::hash_set< rtl_uString *, UStringHash, UStringEqual,
- rtl::Allocator<rtl_uString *> > UniqueHash;
+struct UStringHash
+{
+ size_t operator()(rtl_uString * const &rString) const
+ { return (size_t)rtl_ustr_hashCode_WithLength( rString->buffer, rString->length ); }
+};
-struct StringHashTableImpl : public UniqueHash
+struct UStringEqual
{
- StringHashTableImpl(sal_uInt32 nSize) : UniqueHash( nSize ) {}
+ sal_Bool operator() ( rtl_uString * const &pStringA,
+ rtl_uString * const &pStringB) const
+ {
+ if (pStringA == pStringB)
+ return true;
+ if (pStringA->length != pStringB->length)
+ return false;
+ return !rtl_ustr_compare_WithLength( pStringA->buffer, pStringA->length,
+ pStringB->buffer, pStringB->length);
+ }
};
+typedef std::hash_set< rtl_uString *, UStringHash, UStringEqual,
+ rtl::Allocator<rtl_uString *> > StringHashTable;
+
StringHashTable *
-rtl_str_hash_new (sal_uInt32 nSize)
+getHashTable ()
{
- return new StringHashTableImpl (nSize);
+ static StringHashTable *pInternPool = NULL;
+ if (pInternPool == NULL) {
+ static StringHashTable aImpl(1024);
+ pInternPool = &aImpl;
+ }
+ return pInternPool;
}
-void
-rtl_str_hash_free (StringHashTable *pHash)
-{
- delete pHash;
}
+extern "C" {
+
rtl_uString *
-rtl_str_hash_intern (StringHashTable *pHash,
- rtl_uString *pString,
+rtl_str_hash_intern (rtl_uString *pString,
int can_return)
{
- UniqueHash::iterator aIter;
+ StringHashTable *pHash = getHashTable();
+ StringHashTable::iterator aIter;
aIter = pHash->find(pString);
if (aIter != pHash->end())
{
@@ -106,8 +105,9 @@ rtl_str_hash_intern (StringHashTable *pHash,
}
void
-rtl_str_hash_remove (StringHashTable *pHash,
- rtl_uString *pString)
+rtl_str_hash_remove (rtl_uString *pString)
{
- pHash->erase(pString);
+ getHashTable()->erase(pString);
+}
+
}
diff --git a/sal/rtl/source/hash.h b/sal/rtl/source/hash.h
index 63f3e99c8495..2aadfb33efcd 100644
--- a/sal/rtl/source/hash.h
+++ b/sal/rtl/source/hash.h
@@ -8,15 +8,11 @@
extern "C" {
#endif /* __cplusplus */
-typedef struct StringHashTableImpl StringHashTable;
+/* These functions are not multi-thread safe: */
-StringHashTable *rtl_str_hash_new (sal_uInt32 nSize);
-void rtl_str_hash_free (StringHashTable *pHash);
-rtl_uString *rtl_str_hash_intern (StringHashTable *pHash,
- rtl_uString *pString,
+rtl_uString *rtl_str_hash_intern (rtl_uString *pString,
int can_return);
-void rtl_str_hash_remove (StringHashTable *pHash,
- rtl_uString *pString);
+void rtl_str_hash_remove (rtl_uString *pString);
#if defined __cplusplus
}
diff --git a/sal/rtl/source/ustring.c b/sal/rtl/source/ustring.c
index e4bf28408af1..b0bdd2d98e73 100644
--- a/sal/rtl/source/ustring.c
+++ b/sal/rtl/source/ustring.c
@@ -555,7 +555,12 @@ static void rtl_string2UString_status( rtl_uString** ppThis,
"rtl_string2UString_status() - Wrong TextEncoding" );
if ( !nLen )
+ {
rtl_uString_new( ppThis );
+ if (pInfo != NULL) {
+ *pInfo = 0;
+ }
+ }
else
{
if ( *ppThis )
@@ -586,6 +591,9 @@ static void rtl_string2UString_status( rtl_uString** ppThis,
nLen--;
}
while ( nLen );
+ if (pInfo != NULL) {
+ *pInfo = 0;
+ }
}
else
{
@@ -753,8 +761,6 @@ getInternMutex()
return pPoolGuard;
}
-static StringHashTable *pInternPool = NULL;
-
/* returns true if we found a dup in the pool */
static void rtl_ustring_intern_internal( rtl_uString ** newStr,
rtl_uString * str,
@@ -766,9 +772,7 @@ static void rtl_ustring_intern_internal( rtl_uString ** newStr,
osl_acquireMutex( pPoolMutex );
- if (!pInternPool)
- pInternPool = rtl_str_hash_new (1024);
- *newStr = rtl_str_hash_intern (pInternPool, str, can_return);
+ *newStr = rtl_str_hash_intern (str, can_return);
osl_releaseMutex( pPoolMutex );
@@ -856,7 +860,7 @@ internRelease (rtl_uString *pThis)
pPoolMutex = getInternMutex();
osl_acquireMutex( pPoolMutex );
- rtl_str_hash_remove (pInternPool, pThis);
+ rtl_str_hash_remove (pThis);
/* May have been separately acquired */
if ( SAL_STRING_REFCOUNT(
diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx
index a2d8c6063881..2fda1819f891 100644
--- a/stoc/source/invocation_adapterfactory/iafactory.cxx
+++ b/stoc/source/invocation_adapterfactory/iafactory.cxx
@@ -766,27 +766,28 @@ FactoryImpl::FactoryImpl( Reference< XComponentContext > const & xContext )
::getCppuType( (const Sequence< sal_Int16 > *)0 );
rShortSeqType.getDescription( &m_pShortSeqTD );
// script.XInvocation
- typelib_InterfaceTypeDescription * pTD = 0;
+ typelib_TypeDescription * pTD = 0;
const Type & rInvType = ::getCppuType(
(const Reference< script::XInvocation > *)0 );
- TYPELIB_DANGER_GET(
- (typelib_TypeDescription **)&pTD, rInvType.getTypeLibType() );
- if( ! pTD->aBase.bComplete )
- typelib_typedescription_complete( (typelib_TypeDescription **)&pTD );
+ TYPELIB_DANGER_GET( &pTD, rInvType.getTypeLibType() );
+ typelib_InterfaceTypeDescription * pITD;
+ pITD = reinterpret_cast<typelib_InterfaceTypeDescription*>(pTD);
+ if( ! pITD->aBase.bComplete )
+ typelib_typedescription_complete( &pTD );
::typelib_typedescriptionreference_getDescription(
- &m_pInvokMethodTD, pTD->ppMembers[ 1 ] ); // invoke()
+ &m_pInvokMethodTD, pITD->ppMembers[ 1 ] ); // invoke()
::typelib_typedescriptionreference_getDescription(
- &m_pSetValueTD, pTD->ppMembers[ 2 ] ); // setValue()
+ &m_pSetValueTD, pITD->ppMembers[ 2 ] ); // setValue()
::typelib_typedescriptionreference_getDescription(
- &m_pGetValueTD, pTD->ppMembers[ 3 ] ); // getValue()
+ &m_pGetValueTD, pITD->ppMembers[ 3 ] ); // getValue()
// script.XTypeConverter
const Type & rTCType =
::getCppuType( (const Reference< script::XTypeConverter > *)0 );
- TYPELIB_DANGER_GET(
- (typelib_TypeDescription **)&pTD, rTCType.getTypeLibType() );
+ TYPELIB_DANGER_GET( &pTD, rTCType.getTypeLibType() );
+ pITD = reinterpret_cast<typelib_InterfaceTypeDescription*>(pTD);
::typelib_typedescriptionreference_getDescription(
- &m_pConvertToTD, pTD->ppMembers[ 0 ] ); // convertTo()
- TYPELIB_DANGER_RELEASE( (typelib_TypeDescription *)pTD );
+ &m_pConvertToTD, pITD->ppMembers[ 0 ] ); // convertTo()
+ TYPELIB_DANGER_RELEASE( pTD );
if (!m_pInvokMethodTD || !m_pSetValueTD || !m_pGetValueTD ||
!m_pConvertToTD ||
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index 9e23685bd264..ad72a64a811c 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -354,6 +354,23 @@ void getINetPropsFromConfig(stoc_javavm::JVM * pjvm,
}
}
+ // read https proxy name
+ css::uno::Reference<css::registry::XRegistryKey> httpsProxy_name = xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Settings/ooInetHTTPSProxyName")));
+ if(httpsProxy_name.is() && httpsProxy_name->getStringValue().getLength()) {
+ rtl::OUString httpsHost = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("https.proxyHost="));
+ httpsHost += httpsProxy_name->getStringValue();
+
+ // read https proxy port
+ css::uno::Reference<css::registry::XRegistryKey> httpsProxy_port = xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Settings/ooInetHTTPSProxyPort")));
+ if(httpsProxy_port.is() && httpsProxy_port->getLongValue()) {
+ rtl::OUString httpsPort = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("https.proxyPort="));
+ httpsPort += rtl::OUString::valueOf(httpsProxy_port->getLongValue());
+
+ pjvm->pushProp(httpsHost);
+ pjvm->pushProp(httpsPort);
+ }
+ }
+
// read nonProxyHosts
css::uno::Reference<css::registry::XRegistryKey> nonProxies_name = xRegistryRootKey->openKey(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Settings/ooInetNoProxy")));
if(nonProxies_name.is() && nonProxies_name->getStringValue().getLength()) {
@@ -1170,6 +1187,22 @@ void SAL_CALL JavaVirtualMachine::elementReplaced(
aPropertyValue = rtl::OUString::valueOf(n);
}
else if (aAccessor.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(
+ "ooInetHTTPSProxyName")))
+ {
+ aPropertyName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "https.proxyHost"));
+ rEvent.Element >>= aPropertyValue;
+ }
+ else if (aAccessor.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(
+ "ooInetHTTPSProxyPort")))
+ {
+ aPropertyName
+ = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("https.proxyPort"));
+ sal_Int32 n = 0;
+ rEvent.Element >>= n;
+ aPropertyValue = rtl::OUString::valueOf(n);
+ }
+ else if (aAccessor.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(
"ooInetFTPProxyName")))
{
aPropertyName = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
diff --git a/store/inc/store/store.hxx b/store/inc/store/store.hxx
index 67fa5e3d824b..8e90de321345 100644
--- a/store/inc/store/store.hxx
+++ b/store/inc/store/store.hxx
@@ -26,11 +26,11 @@
************************************************************************/
#ifndef _STORE_STORE_HXX_
-#define _STORE_STORE_HXX_ "$Revision: 1.5 $"
+#define _STORE_STORE_HXX_
-#include <sal/types.h>
-#include <rtl/ustring.hxx>
-#include <store/store.h>
+#include "sal/types.h"
+#include "rtl/ustring.hxx"
+#include "store/store.h"
namespace store
{
@@ -45,86 +45,154 @@ class OStoreStream
public:
/** Construction.
*/
- inline OStoreStream (void) SAL_THROW(());
+ inline OStoreStream (void) SAL_THROW(())
+ : m_hImpl (0)
+ {}
/** Destruction.
*/
- inline ~OStoreStream (void) SAL_THROW(());
+ inline ~OStoreStream (void) SAL_THROW(())
+ {
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ }
/** Copy construction.
*/
- inline OStoreStream (
- const OStoreStream& rOther) SAL_THROW(());
+ inline OStoreStream (OStoreStream const & rhs) SAL_THROW(())
+ : m_hImpl (rhs.m_hImpl)
+ {
+ if (m_hImpl)
+ (void) store_acquireHandle (m_hImpl);
+ }
/** Assignment.
*/
- inline OStoreStream& operator= (
- const OStoreStream& rOther) SAL_THROW(());
-
+ inline OStoreStream & operator= (OStoreStream const & rhs) SAL_THROW(())
+ {
+ if (rhs.m_hImpl)
+ (void) store_acquireHandle (rhs.m_hImpl);
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = rhs.m_hImpl;
+ return *this;
+ }
/** Construction from Stream Handle.
*/
- inline OStoreStream (storeStreamHandle Handle) SAL_THROW(());
+ inline explicit OStoreStream (storeStreamHandle Handle) SAL_THROW(())
+ : m_hImpl (Handle)
+ {
+ if (m_hImpl)
+ (void) store_acquireHandle (m_hImpl);
+ }
/** Conversion into Stream Handle.
*/
- inline operator storeStreamHandle (void) const SAL_THROW(());
+ inline operator storeStreamHandle (void) const SAL_THROW(())
+ {
+ return m_hImpl;
+ }
/** Check for a valid Stream Handle.
@return sal_True if valid, sal_False otherwise.
*/
- inline sal_Bool isValid (void) const SAL_THROW(());
-
+ inline bool isValid (void) const SAL_THROW(())
+ {
+ return (m_hImpl != 0);
+ }
/** Open the stream.
@see store_openStream()
*/
inline storeError create (
- storeFileHandle hFile,
- const rtl::OUString &rPath,
- const rtl::OUString &rName,
- storeAccessMode eMode
- ) SAL_THROW(());
+ storeFileHandle hFile,
+ rtl::OUString const & rPath,
+ rtl::OUString const & rName,
+ storeAccessMode eMode) SAL_THROW(())
+ {
+ if (m_hImpl)
+ {
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = 0;
+ }
+ return store_openStream (hFile, rPath.pData, rName.pData, eMode, &m_hImpl);
+ }
/** Close the stream.
@see store_closeStream()
*/
- inline void close (void) SAL_THROW(());
+ inline void close (void) SAL_THROW(())
+ {
+ if (m_hImpl)
+ {
+ (void) store_closeStream (m_hImpl);
+ m_hImpl = 0;
+ }
+ }
/** Read from the stream.
@see store_readStream()
*/
inline storeError readAt (
- sal_uInt32 nOffset,
- void *pBuffer,
- sal_uInt32 nBytes,
- sal_uInt32 &rnDone
- ) SAL_THROW(());
+ sal_uInt32 nOffset,
+ void * pBuffer,
+ sal_uInt32 nBytes,
+ sal_uInt32 & rnDone) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_readStream (m_hImpl, nOffset, pBuffer, nBytes, &rnDone);
+ }
/** Write to the stream.
@see store_writeStream()
*/
inline storeError writeAt (
- sal_uInt32 nOffset,
- const void *pBuffer,
- sal_uInt32 nBytes,
- sal_uInt32 &rnDone
- ) SAL_THROW(());
+ sal_uInt32 nOffset,
+ void const * pBuffer,
+ sal_uInt32 nBytes,
+ sal_uInt32 & rnDone) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_writeStream (m_hImpl, nOffset, pBuffer, nBytes, &rnDone);
+ }
/** Flush the stream.
@see store_flushStream()
*/
- inline storeError flush (void) const SAL_THROW(());
+ inline storeError flush (void) const SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_flushStream (m_hImpl);
+ }
/** Get the stream size.
@see store_getStreamSize()
*/
- inline storeError getSize (sal_uInt32 &rnSize) const SAL_THROW(());
+ inline storeError getSize (sal_uInt32 & rnSize) const SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_getStreamSize (m_hImpl, &rnSize);
+ }
/** Set the stream size.
@see store_setStreamSize()
*/
- inline storeError setSize (sal_uInt32 nSize) SAL_THROW(());
+ inline storeError setSize (sal_uInt32 nSize) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_setStreamSize (m_hImpl, nSize);
+ }
private:
/** Representation.
@@ -142,52 +210,91 @@ class OStoreDirectory
public:
/** Construction.
*/
- inline OStoreDirectory (void) SAL_THROW(());
+ inline OStoreDirectory (void) SAL_THROW(())
+ : m_hImpl (0)
+ {}
/** Destruction.
*/
- inline ~OStoreDirectory (void) SAL_THROW(());
+ inline ~OStoreDirectory (void) SAL_THROW(())
+ {
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ }
/** Copy construction.
*/
- inline OStoreDirectory (
- const OStoreDirectory& rOther) SAL_THROW(());
+ inline OStoreDirectory (OStoreDirectory const & rhs) SAL_THROW(())
+ : m_hImpl (rhs.m_hImpl)
+ {
+ if (m_hImpl)
+ (void) store_acquireHandle (m_hImpl);
+ }
/** Assignment.
*/
- inline OStoreDirectory& operator= (
- const OStoreDirectory& rOther) SAL_THROW(());
-
+ inline OStoreDirectory & operator= (OStoreDirectory const & rhs) SAL_THROW(())
+ {
+ if (rhs.m_hImpl)
+ (void) store_acquireHandle (rhs.m_hImpl);
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = rhs.m_hImpl;
+ return *this;
+ }
/** Construction from Directory Handle.
*/
- inline OStoreDirectory (storeDirectoryHandle Handle) SAL_THROW(());
+ inline explicit OStoreDirectory (storeDirectoryHandle Handle) SAL_THROW(())
+ : m_hImpl (Handle)
+ {
+ if (m_hImpl)
+ (void) store_acquireHandle (m_hImpl);
+ }
/** Conversion into Directory Handle.
*/
- inline operator storeDirectoryHandle (void) const SAL_THROW(());
+ inline operator storeDirectoryHandle(void) const SAL_THROW(())
+ {
+ return m_hImpl;
+ }
/** Check for a valid Directory Handle.
@return sal_True if valid, sal_False otherwise.
*/
- inline sal_Bool isValid (void) const SAL_THROW(());
-
+ inline bool isValid (void) const SAL_THROW(())
+ {
+ return (m_hImpl != 0);
+ }
/** Open the directory.
@see store_openDirectory()
*/
inline storeError create (
- storeFileHandle hFile,
- const rtl::OUString &rPath,
- const rtl::OUString &rName,
- storeAccessMode eMode
- ) SAL_THROW(());
+ storeFileHandle hFile,
+ rtl::OUString const & rPath,
+ rtl::OUString const & rName,
+ storeAccessMode eMode) SAL_THROW(())
+ {
+ if (m_hImpl)
+ {
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = 0;
+ }
+ return store_openDirectory (hFile, rPath.pData, rName.pData, eMode, &m_hImpl);
+ }
/** Close the directory.
@see store_closeDirectory()
*/
- inline void close (void) SAL_THROW(());
-
+ inline void close (void) SAL_THROW(())
+ {
+ if (m_hImpl)
+ {
+ (void) store_closeDirectory (m_hImpl);
+ m_hImpl = 0;
+ }
+ }
/** Directory iterator type.
@see first()
@@ -198,12 +305,24 @@ public:
/** Find first directory entry.
@see store_findFirst()
*/
- inline storeError first (iterator& it) SAL_THROW(());
+ inline storeError first (iterator& it) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_findFirst (m_hImpl, &it);
+ }
/** Find next directory entry.
@see store_findNext()
*/
- inline storeError next (iterator& it) SAL_THROW(());
+ inline storeError next (iterator& it) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_findNext (m_hImpl, &it);
+ }
/** Directory traversal helper.
@see travel()
@@ -225,7 +344,18 @@ public:
@param rTraveller [in] the traversal callback.
@return store_E_NoMoreFiles upon end of iteration.
*/
- inline storeError travel (traveller& rTraveller) const;
+ inline storeError travel (traveller & rTraveller) const
+ {
+ storeError eErrCode = store_E_InvalidHandle;
+ if (m_hImpl)
+ {
+ iterator it;
+ eErrCode = store_findFirst (m_hImpl, &it);
+ while ((eErrCode == store_E_None) && rTraveller.visit(it))
+ eErrCode = store_findNext (m_hImpl, &it);
+ }
+ return eErrCode;
+ }
private:
/** Representation.
@@ -243,126 +373,220 @@ class OStoreFile
public:
/** Construction.
*/
- inline OStoreFile (void) SAL_THROW(());
+ inline OStoreFile (void) SAL_THROW(())
+ : m_hImpl (0)
+ {}
/** Destruction.
*/
- inline ~OStoreFile (void) SAL_THROW(());
+ inline ~OStoreFile (void) SAL_THROW(())
+ {
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ }
/** Copy construction.
*/
- inline OStoreFile (const OStoreFile& rOther) SAL_THROW(());
+ inline OStoreFile (OStoreFile const & rhs) SAL_THROW(())
+ : m_hImpl (rhs.m_hImpl)
+ {
+ if (m_hImpl)
+ (void) store_acquireHandle (m_hImpl);
+ }
/** Assignment.
*/
- inline OStoreFile& operator= (const OStoreFile& rOther) SAL_THROW(());
-
+ inline OStoreFile & operator= (OStoreFile const & rhs) SAL_THROW(())
+ {
+ if (rhs.m_hImpl)
+ (void) store_acquireHandle (rhs.m_hImpl);
+ if (m_hImpl)
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = rhs.m_hImpl;
+ return *this;
+ }
/** Construction from File Handle.
*/
- inline OStoreFile (storeFileHandle Handle) SAL_THROW(());
+ inline explicit OStoreFile (storeFileHandle Handle) SAL_THROW(())
+ : m_hImpl (Handle)
+ {
+ if (m_hImpl)
+ (void) store_acquireHandle (m_hImpl);
+ }
/** Conversion into File Handle.
*/
- inline operator storeFileHandle (void) const SAL_THROW(());
+ inline operator storeFileHandle (void) const SAL_THROW(())
+ {
+ return m_hImpl;
+ }
/** Check for a valid File Handle.
@return sal_True if valid, sal_False otherwise.
*/
- inline sal_Bool isValid (void) const SAL_THROW(());
-
+ inline bool isValid (void) const SAL_THROW(())
+ {
+ return (m_hImpl != 0);
+ }
/** Open the file.
@see store_openFile()
*/
inline storeError create (
- const rtl::OUString &rFilename,
- storeAccessMode eAccessMode,
- sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE
- ) SAL_THROW(());
+ rtl::OUString const & rFilename,
+ storeAccessMode eAccessMode,
+ sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE) SAL_THROW(())
+ {
+ if (m_hImpl)
+ {
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = 0;
+ }
+ return store_openFile (rFilename.pData, eAccessMode, nPageSize, &m_hImpl);
+ }
/** Open the temporary file in memory.
@see store_createMemoryFile()
*/
inline storeError createInMemory (
- sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE
- ) SAL_THROW(());
+ sal_uInt16 nPageSize = STORE_DEFAULT_PAGESIZE) SAL_THROW(())
+ {
+ if (m_hImpl)
+ {
+ (void) store_releaseHandle (m_hImpl);
+ m_hImpl = 0;
+ }
+ return store_createMemoryFile (nPageSize, &m_hImpl);
+ }
/** Close the file.
@see store_closeFile()
*/
- inline void close (void) SAL_THROW(());
+ inline void close (void) SAL_THROW(())
+ {
+ if (m_hImpl)
+ {
+ (void) store_closeFile (m_hImpl);
+ m_hImpl = 0;
+ }
+ }
/** Flush the file.
@see store_flushFile()
*/
- inline storeError flush (void) const SAL_THROW(());
+ inline storeError flush (void) const SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_flushFile (m_hImpl);
+ }
/** Get the number of referers to the file.
@see store_getFileRefererCount()
*/
- inline storeError getRefererCount (
- sal_uInt32 &rnRefCount) const SAL_THROW(());
+ inline storeError getRefererCount (sal_uInt32 & rnRefCount) const SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_getFileRefererCount (m_hImpl, &rnRefCount);
+ }
/** Get the file size.
@see store_getFileSize()
*/
- inline storeError getSize (
- sal_uInt32 &rnSize) const SAL_THROW(());
+ inline storeError getSize (sal_uInt32 & rnSize) const SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+ return store_getFileSize (m_hImpl, &rnSize);
+ }
/** Set attributes of a file entry.
@see store_attrib()
*/
inline storeError attrib (
- const rtl::OUString &rPath,
- const rtl::OUString &rName,
- sal_uInt32 nMask1,
- sal_uInt32 nMask2,
- sal_uInt32 &rnAttrib
- ) SAL_THROW(());
+ rtl::OUString const & rPath,
+ rtl::OUString const & rName,
+ sal_uInt32 nMask1,
+ sal_uInt32 nMask2,
+ sal_uInt32 & rnAttrib) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_attrib (m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, &rnAttrib);
+ }
/** Set attributes of a file entry.
@see store_attrib()
*/
inline storeError attrib (
- const rtl::OUString &rPath,
- const rtl::OUString &rName,
- sal_uInt32 nMask1,
- sal_uInt32 nMask2
- ) SAL_THROW(());
+ rtl::OUString const & rPath,
+ rtl::OUString const & rName,
+ sal_uInt32 nMask1,
+ sal_uInt32 nMask2) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_attrib (m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, NULL);
+ }
/** Insert a file entry as 'hard link' to another file entry.
@see store_link()
*/
inline storeError link (
- const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName,
- const rtl::OUString &rDstPath, const rtl::OUString &rDstName
- ) SAL_THROW(());
+ rtl::OUString const & rSrcPath, rtl::OUString const & rSrcName,
+ rtl::OUString const & rDstPath, rtl::OUString const & rDstName) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_link (
+ m_hImpl, rSrcPath.pData, rSrcName.pData, rDstPath.pData, rDstName.pData);
+ }
/** Insert a file entry as 'symbolic link' to another file entry.
@see store_symlink()
*/
inline storeError symlink (
- const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName,
- const rtl::OUString &rDstPath, const rtl::OUString &rDstName
- ) SAL_THROW(());
+ rtl::OUString const & rSrcPath, rtl::OUString const & rSrcName,
+ rtl::OUString const & rDstPath, rtl::OUString const & rDstName) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_symlink (m_hImpl, rSrcPath.pData, rSrcName.pData, rDstPath.pData, rDstName.pData);
+ }
/** Rename a file entry.
@see store_rename()
*/
inline storeError rename (
- const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName,
- const rtl::OUString &rDstPath, const rtl::OUString &rDstName
- ) SAL_THROW(());
+ rtl::OUString const & rSrcPath, rtl::OUString const & rSrcName,
+ rtl::OUString const & rDstPath, rtl::OUString const & rDstName) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_rename (m_hImpl, rSrcPath.pData, rSrcName.pData, rDstPath.pData, rDstName.pData);
+ }
/** Remove a file entry.
@see store_remove()
*/
inline storeError remove (
- const rtl::OUString &rPath,
- const rtl::OUString &rName
- ) SAL_THROW(());
+ rtl::OUString const & rPath, rtl::OUString const & rName) SAL_THROW(())
+ {
+ if (!m_hImpl)
+ return store_E_InvalidHandle;
+
+ return store_remove (m_hImpl, rPath.pData, rName.pData);
+ }
private:
/** Representation.
@@ -376,8 +600,6 @@ private:
*
*======================================================================*/
-#include <store/store.inl>
-
} // namespace store
#endif /* !_STORE_STORE_HXX_ */
diff --git a/store/inc/store/store.inl b/store/inc/store/store.inl
deleted file mode 100644
index 91866c7311da..000000000000
--- a/store/inc/store/store.inl
+++ /dev/null
@@ -1,451 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#define _STORE_STORE_INL_ "$Revision: 1.4 $"
-
-/*========================================================================
- *
- * OStoreStream implementation.
- *
- *======================================================================*/
-inline OStoreStream::OStoreStream (void) SAL_THROW(())
- : m_hImpl (0)
-{
-}
-
-inline OStoreStream::~OStoreStream (void) SAL_THROW(())
-{
- if (m_hImpl)
- store_releaseHandle (m_hImpl);
-}
-
-inline OStoreStream::OStoreStream (
- const OStoreStream& rOther) SAL_THROW(())
- : m_hImpl (rOther.m_hImpl)
-{
- if (m_hImpl)
- store_acquireHandle (m_hImpl);
-}
-
-inline OStoreStream& OStoreStream::operator= (
- const OStoreStream& rOther) SAL_THROW(())
-{
- if (m_hImpl)
- store_releaseHandle (m_hImpl);
- m_hImpl = rOther.m_hImpl;
- if (m_hImpl)
- store_acquireHandle (m_hImpl);
- return *this;
-}
-
-inline OStoreStream::OStoreStream (
- storeStreamHandle Handle) SAL_THROW(())
- : m_hImpl (Handle)
-{
- if (m_hImpl)
- store_acquireHandle (m_hImpl);
-}
-
-inline OStoreStream::operator storeStreamHandle (void) const SAL_THROW(())
-{
- return m_hImpl;
-}
-
-inline sal_Bool OStoreStream::isValid (void) const SAL_THROW(())
-{
- return (!!m_hImpl);
-}
-
-inline storeError OStoreStream::create (
- storeFileHandle hFile,
- const rtl::OUString &rPath,
- const rtl::OUString &rName,
- storeAccessMode eMode) SAL_THROW(())
-{
- if (m_hImpl)
- {
- store_releaseHandle (m_hImpl);
- m_hImpl = 0;
- }
- return store_openStream (
- hFile, rPath.pData, rName.pData, eMode, &m_hImpl);
-}
-
-inline void OStoreStream::close (void) SAL_THROW(())
-{
- if (m_hImpl)
- {
- store_closeStream (m_hImpl);
- m_hImpl = 0;
- }
-}
-
-inline storeError OStoreStream::readAt (
- sal_uInt32 nOffset,
- void *pBuffer,
- sal_uInt32 nBytes,
- sal_uInt32 &rnDone) SAL_THROW(())
-{
- if (!m_hImpl)
- return store_E_InvalidHandle;
-
- return store_readStream (
- m_hImpl, nOffset, pBuffer, nBytes, &rnDone);
-}
-
-inline storeError OStoreStream::writeAt (
- sal_uInt32 nOffset,
- const void *pBuffer,
- sal_uInt32 nBytes,
- sal_uInt32 &rnDone) SAL_THROW(())
-{
- if (!m_hImpl)
- return store_E_InvalidHandle;
-
- return store_writeStream (
- m_hImpl, nOffset, pBuffer, nBytes, &rnDone);
-}
-
-inline storeError OStoreStream::flush (void) const SAL_THROW(())
-{
- if (!m_hImpl)
- return store_E_InvalidHandle;
-
- return store_flushStream (m_hImpl);
-}
-
-inline storeError OStoreStream::getSize (
- sal_uInt32 &rnSize) const SAL_THROW(())
-{
- if (!m_hImpl)
- return store_E_InvalidHandle;
-
- return store_getStreamSize (m_hImpl, &rnSize);
-}
-
-inline storeError OStoreStream::setSize (
- sal_uInt32 nSize) SAL_THROW(())
-{
- if (!m_hImpl)
- return store_E_InvalidHandle;
-
- return store_setStreamSize (m_hImpl, nSize);
-}
-
-/*========================================================================
- *
- * OStoreDirectory implementation.
- *
- *======================================================================*/
-inline OStoreDirectory::OStoreDirectory (void) SAL_THROW(())
- : m_hImpl (0)
-{
-}
-
-inline OStoreDirectory::~OStoreDirectory (void) SAL_THROW(())
-{
- if (m_hImpl)
- store_releaseHandle (m_hImpl);
-}
-
-inline OStoreDirectory::OStoreDirectory (
- const OStoreDirectory& rOther) SAL_THROW(())
- : m_hImpl (rOther.m_hImpl)
-{
- if (m_hImpl)
- store_acquireHandle (m_hImpl);
-}
-
-inline OStoreDirectory& OStoreDirectory::operator= (
- const OStoreDirectory& rOther) SAL_THROW(())
-{
- if (m_hImpl)
- store_releaseHandle (m_hImpl);
- m_hImpl = rOther.m_hImpl;
- if (m_hImpl)
- store_acquireHandle (m_hImpl);
- return *this;
-}
-
-inline OStoreDirectory::OStoreDirectory (
- storeDirectoryHandle Handle) SAL_THROW(())
- : m_hImpl (Handle)
-{
- if (m_hImpl)
- store_acquireHandle (m_hImpl);
-}
-
-inline OStoreDirectory::operator storeDirectoryHandle(void) const SAL_THROW(())
-{
- return m_hImpl;
-}
-
-inline sal_Bool OStoreDirectory::isValid (void) const SAL_THROW(())
-{
- return (!!m_hImpl);
-}
-
-inline storeError OStoreDirectory::create (
- storeFileHandle hFile,
- const rtl::OUString &rPath,
- const rtl::OUString &rName,
- storeAccessMode eMode) SAL_THROW(())
-{
- if (m_hImpl)
- {
- store_releaseHandle (m_hImpl);
- m_hImpl = 0;
- }
- return store_openDirectory (
- hFile, rPath.pData, rName.pData, eMode, &m_hImpl);
-}
-
-inline void OStoreDirectory::close (void) SAL_THROW(())
-{
- if (m_hImpl)
- {
- store_closeDirectory (m_hImpl);
- m_hImpl = 0;
- }
-}
-
-inline storeError OStoreDirectory::first (iterator& it) SAL_THROW(())
-{
- if (!m_hImpl)
- return store_E_InvalidHandle;
-
- return store_findFirst (m_hImpl, &it);
-}
-
-inline storeError OStoreDirectory::next (iterator& it) SAL_THROW(())
-{
- if (!m_hImpl)
- return store_E_InvalidHandle;
-
- return store_findNext (m_hImpl, &it);
-}
-
-inline storeError OStoreDirectory::travel (traveller& rTraveller) const
-{
- storeError eErrCode = store_E_InvalidHandle;
- if (m_hImpl)
- {
- iterator it;
- eErrCode = store_findFirst (m_hImpl, &it);
- while ((eErrCode == store_E_None) && rTraveller.visit(it))
- eErrCode = store_findNext (m_hImpl, &it);
- }
- return eErrCode;
-}
-
-/*========================================================================
- *
- * OStoreFile implementation.
- *
- *======================================================================*/
-inline OStoreFile::OStoreFile (void) SAL_THROW(())
- : m_hImpl (0)
-{
-}
-
-inline OStoreFile::~OStoreFile (void) SAL_THROW(())
-{
- if (m_hImpl)
- store_releaseHandle (m_hImpl);
-}
-
-inline OStoreFile::OStoreFile (
- const OStoreFile& rOther) SAL_THROW(())
- : m_hImpl (rOther.m_hImpl)
-{
- if (m_hImpl)
- store_acquireHandle (m_hImpl);
-}
-
-inline OStoreFile& OStoreFile::operator= (
- const OStoreFile& rOther) SAL_THROW(())
-{
- if (m_hImpl)
- store_releaseHandle (m_hImpl);
- m_hImpl = rOther.m_hImpl;
- if (m_hImpl)
- store_acquireHandle (m_hImpl);
- return *this;
-}
-
-inline OStoreFile::OStoreFile (
- storeFileHandle Handle) SAL_THROW(())
- : m_hImpl (Handle)
-{
- if (m_hImpl)
- store_acquireHandle (m_hImpl);
-}
-
-inline OStoreFile::operator storeFileHandle (void) const SAL_THROW(())
-{
- return m_hImpl;
-}
-
-inline sal_Bool OStoreFile::isValid (void) const SAL_THROW(())
-{
- return (!!m_hImpl);
-}
-
-inline storeError OStoreFile::create (
- const rtl::OUString &rFilename,
- storeAccessMode eAccessMode,
- sal_uInt16 nPageSize) SAL_THROW(())
-{
- if (m_hImpl)
- {
- store_releaseHandle (m_hImpl);
- m_hImpl = 0;
- }
- return store_openFile (rFilename.pData, eAccessMode, nPageSize, &m_hImpl);
-}
-
-inline storeError OStoreFile::createInMemory (
- sal_uInt16 nPageSize) SAL_THROW(())
-{
- if (m_hImpl)
- {
- store_releaseHandle (m_hImpl);
- m_hImpl = 0;
- }
- return store_createMemoryFile (nPageSize, &m_hImpl);
-}
-
-inline void OStoreFile::close (void) SAL_THROW(())
-{
- if (m_hImpl)
- {
- store_closeFile (m_hImpl);
- m_hImpl = 0;
- }
-}
-
-inline storeError OStoreFile::flush (void) const SAL_THROW(())
-{
- if (!m_hImpl)
- return store_E_InvalidHandle;
-
- return store_flushFile (m_hImpl);
-}
-
-inline storeError OStoreFile::getRefererCount (
- sal_uInt32 &rnRefCount) const SAL_THROW(())
-{
- if (!m_hImpl)
- return store_E_InvalidHandle;
-
- return store_getFileRefererCount (m_hImpl, &rnRefCount);
-}
-
-inline storeError OStoreFile::getSize (
- sal_uInt32 &rnSize) const SAL_THROW(())
-{
- if (!m_hImpl)
- return store_E_InvalidHandle;
-
- return store_getFileSize (m_hImpl, &rnSize);
-}
-
-inline storeError OStoreFile::attrib (
- const rtl::OUString &rPath,
- const rtl::OUString &rName,
- sal_uInt32 nMask1,
- sal_uInt32 nMask2,
- sal_uInt32 &rnAttrib) SAL_THROW(())
-{
- if (!m_hImpl)
- return store_E_InvalidHandle;
-
- return store_attrib (
- m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, &rnAttrib);
-}
-
-inline storeError OStoreFile::attrib (
- const rtl::OUString &rPath,
- const rtl::OUString &rName,
- sal_uInt32 nMask1,
- sal_uInt32 nMask2) SAL_THROW(())
-{
- if (!m_hImpl)
- return store_E_InvalidHandle;
-
- return store_attrib (
- m_hImpl, rPath.pData, rName.pData, nMask1, nMask2, NULL);
-}
-
-inline storeError OStoreFile::link (
- const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName,
- const rtl::OUString &rDstPath, const rtl::OUString &rDstName) SAL_THROW(())
-{
- if (!m_hImpl)
- return store_E_InvalidHandle;
-
- return store_link (
- m_hImpl,
- rSrcPath.pData, rSrcName.pData,
- rDstPath.pData, rDstName.pData);
-}
-
-inline storeError OStoreFile::symlink (
- const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName,
- const rtl::OUString &rDstPath, const rtl::OUString &rDstName) SAL_THROW(())
-{
- if (!m_hImpl)
- return store_E_InvalidHandle;
-
- return store_symlink (
- m_hImpl,
- rSrcPath.pData, rSrcName.pData,
- rDstPath.pData, rDstName.pData);
-}
-
-inline storeError OStoreFile::rename (
- const rtl::OUString &rSrcPath, const rtl::OUString &rSrcName,
- const rtl::OUString &rDstPath, const rtl::OUString &rDstName) SAL_THROW(())
-{
- if (!m_hImpl)
- return store_E_InvalidHandle;
-
- return store_rename (
- m_hImpl,
- rSrcPath.pData, rSrcName.pData,
- rDstPath.pData, rDstName.pData);
-}
-
-inline storeError OStoreFile::remove (
- const rtl::OUString &rPath, const rtl::OUString &rName) SAL_THROW(())
-{
- if (!m_hImpl)
- return store_E_InvalidHandle;
-
- return store_remove (m_hImpl, rPath.pData, rName.pData);
-}
-
diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx
index 795b720e0632..f1145a029c29 100644
--- a/store/source/lockbyte.cxx
+++ b/store/source/lockbyte.cxx
@@ -148,40 +148,6 @@ storeError ILockBytes::flush()
return flush_Impl();
}
-storeError ILockBytes::lockRange (sal_uInt32 nOffset, sal_uInt32 nBytes)
-{
- OSL_PRECOND(!(nOffset == STORE_PAGE_NULL), "store::ILockBytes::lockRange(): invalid Offset");
- if (nOffset == STORE_PAGE_NULL)
- return store_E_CantSeek;
-
- sal_uInt64 size = nOffset + nBytes;
- if (size > SAL_MAX_UINT32)
- return store_E_CantSeek;
-
-#ifdef STORE_FEATURE_LOCKING
- return lockRange_Impl (nOffset, nBytes);
-#else
- return store_E_None; // E_Unsupported
-#endif /* STORE_FEATURE_LOCKING */
-}
-
-storeError ILockBytes::unlockRange (sal_uInt32 nOffset, sal_uInt32 nBytes)
-{
- OSL_PRECOND(!(nOffset == STORE_PAGE_NULL), "store::ILockBytes::unlockRange(): invalid Offset");
- if (nOffset == STORE_PAGE_NULL)
- return store_E_CantSeek;
-
- sal_uInt64 size = nOffset + nBytes;
- if (size > SAL_MAX_UINT32)
- return store_E_CantSeek;
-
-#ifdef STORE_FEATURE_LOCKING
- return unlockRange_Impl (nOffset, nBytes);
-#else
- return store_E_None; // E_Unsupported
-#endif /* STORE_FEATURE_LOCKING */
-}
-
/*========================================================================
*
* FileLockBytes implementation.
diff --git a/store/source/lockbyte.hxx b/store/source/lockbyte.hxx
index bbaf92c4ae99..ef34b8708f26 100644
--- a/store/source/lockbyte.hxx
+++ b/store/source/lockbyte.hxx
@@ -120,26 +120,6 @@ public:
*/
storeError flush();
- /**
- @param nOffset [in]
- @param nBytes [in]
- @return store_E_None upon success
- store_E_LockingViolation
- */
- storeError lockRange (
- sal_uInt32 nOffset,
- sal_uInt32 nBytes);
-
- /**
- @param nOffset [in]
- @param nBytes [in]
- @return store_E_None upon success
- store_E_LockingViolation
- */
- storeError unlockRange (
- sal_uInt32 nOffset,
- sal_uInt32 nBytes);
-
private:
/** Implementation (abstract).
*/
@@ -172,16 +152,6 @@ private:
sal_uInt32 nSize) = 0;
virtual storeError flush_Impl() = 0;
-
-#ifdef STORE_FEATURE_LOCKING
- virtual storeError lockRange_Impl (
- sal_uInt32 nOffset,
- sal_uInt32 nBytes) = 0;
-
- virtual storeError unlockRange_Impl (
- sal_uInt32 nOffset,
- sal_uInt32 nBytes) = 0;
-#endif /* STORE_FEATURE_LOCKING */
};
/*========================================================================
diff --git a/store/source/storbase.hxx b/store/source/storbase.hxx
index 0a489c1ee29f..9c1e4ea985bf 100644
--- a/store/source/storbase.hxx
+++ b/store/source/storbase.hxx
@@ -553,13 +553,6 @@ struct PageData
/** guard (external representation).
*/
- void guard()
- {
- sal_uInt32 nCRC32 = 0;
- nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
- nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, theSize - sizeof(G));
- m_aGuard.m_nCRC32 = store::htonl(nCRC32);
- }
void guard (sal_uInt32 nAddr)
{
sal_uInt32 nCRC32 = 0;
@@ -571,16 +564,6 @@ struct PageData
/** verify (external representation).
*/
- storeError verify() const
- {
- sal_uInt32 nCRC32 = 0;
- nCRC32 = rtl_crc32 (nCRC32, &m_aGuard.m_nMagic, sizeof(sal_uInt32));
- nCRC32 = rtl_crc32 (nCRC32, &m_aDescr, theSize - sizeof(G));
- if (m_aGuard.m_nCRC32 != store::htonl(nCRC32))
- return store_E_InvalidChecksum;
- else
- return store_E_None;
- }
storeError verify (sal_uInt32 nAddr) const
{
sal_uInt32 nCRC32 = 0;
diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx
index 6f1a5cde0340..d2612d60b3db 100644
--- a/store/source/storbios.cxx
+++ b/store/source/storbios.cxx
@@ -83,36 +83,36 @@ struct OStoreSuperBlock
m_aUnused (0)
{}
- OStoreSuperBlock (const OStoreSuperBlock& rOther)
- : m_aGuard (rOther.m_aGuard),
- m_aDescr (rOther.m_aDescr),
- m_nMarked (rOther.m_nMarked),
- m_aMarked (rOther.m_aMarked),
- m_nUnused (rOther.m_nUnused),
- m_aUnused (rOther.m_aUnused)
+ OStoreSuperBlock (const OStoreSuperBlock & rhs)
+ : m_aGuard (rhs.m_aGuard),
+ m_aDescr (rhs.m_aDescr),
+ m_nMarked (rhs.m_nMarked),
+ m_aMarked (rhs.m_aMarked),
+ m_nUnused (rhs.m_nUnused),
+ m_aUnused (rhs.m_aUnused)
{}
- OStoreSuperBlock& operator= (const OStoreSuperBlock& rOther)
+ OStoreSuperBlock& operator= (const OStoreSuperBlock & rhs)
{
- m_aGuard = rOther.m_aGuard;
- m_aDescr = rOther.m_aDescr;
- m_nMarked = rOther.m_nMarked;
- m_aMarked = rOther.m_aMarked;
- m_nUnused = rOther.m_nUnused;
- m_aUnused = rOther.m_aUnused;
+ m_aGuard = rhs.m_aGuard;
+ m_aDescr = rhs.m_aDescr;
+ m_nMarked = rhs.m_nMarked;
+ m_aMarked = rhs.m_aMarked;
+ m_nUnused = rhs.m_nUnused;
+ m_aUnused = rhs.m_aUnused;
return *this;
}
/** Comparison.
*/
- sal_Bool operator== (const OStoreSuperBlock& rOther) const
+ sal_Bool operator== (const OStoreSuperBlock & rhs) const
{
- return ((m_aGuard == rOther.m_aGuard ) &&
- (m_aDescr == rOther.m_aDescr ) &&
- (m_nMarked == rOther.m_nMarked) &&
- (m_aMarked == rOther.m_aMarked) &&
- (m_nUnused == rOther.m_nUnused) &&
- (m_aUnused == rOther.m_aUnused) );
+ return ((m_aGuard == rhs.m_aGuard ) &&
+ (m_aDescr == rhs.m_aDescr ) &&
+ (m_nMarked == rhs.m_nMarked) &&
+ (m_aMarked == rhs.m_aMarked) &&
+ (m_nUnused == rhs.m_nUnused) &&
+ (m_aUnused == rhs.m_aUnused) );
}
/** unused(Count|Head|Insert|Remove|Reset).
@@ -173,94 +173,24 @@ struct OStoreSuperBlock
/*========================================================================
*
- * OStoreStateBlock.
- *
- *======================================================================*/
-struct OStoreStateBlock
-{
- enum StateBits
- {
- STATE_CLEAN = 0,
- STATE_CLOSE_WAIT = 1,
- STATE_FLUSH_WAIT = 2
- };
-
- /** Representation.
- */
- sal_uInt32 m_nState;
-
- /** theSize.
- */
- static const size_t theSize = sizeof(sal_uInt32);
-
- /** Construction.
- */
- OStoreStateBlock()
- : m_nState (store::htonl(STATE_CLEAN))
- {}
-
- /** Operation.
- */
- bool closePending (void) const
- {
- sal_uInt32 nState = store::ntohl(m_nState);
- return ((nState & STATE_CLOSE_WAIT) == STATE_CLOSE_WAIT);
- }
- void closed (void)
- {
- sal_uInt32 nState = store::ntohl(m_nState);
- nState &= ~STATE_CLOSE_WAIT;
- m_nState = store::htonl(nState);
- }
-
- bool flushPending (void) const
- {
- sal_uInt32 nState = store::ntohl(m_nState);
- return ((nState & STATE_FLUSH_WAIT) == STATE_FLUSH_WAIT);
- }
- void flushed (void)
- {
- sal_uInt32 nState = store::ntohl(m_nState);
- nState &= ~STATE_FLUSH_WAIT;
- m_nState = store::htonl(nState);
- }
-
- void modified (void)
- {
- sal_uInt32 nState = store::ntohl(m_nState);
- nState |= (STATE_CLOSE_WAIT | STATE_FLUSH_WAIT);
- m_nState = store::htonl(nState);
- }
- void clean (void)
- {
- sal_uInt32 nState = store::ntohl(m_nState);
- nState &= ~(STATE_CLOSE_WAIT | STATE_FLUSH_WAIT);
- m_nState = store::htonl(nState);
- }
-};
-
-/*========================================================================
- *
- * OStoreSuperBlockPage interface.
+ * SuperBlockPage interface.
*
*======================================================================*/
namespace store
{
-struct OStoreSuperBlockPage
+struct SuperBlockPage
{
typedef OStoreSuperBlock SuperBlock;
- typedef OStoreStateBlock StateBlock;
/** Representation.
*/
SuperBlock m_aSuperOne;
SuperBlock m_aSuperTwo;
- StateBlock m_aState;
/** theSize.
*/
- static const size_t theSize = 2 * SuperBlock::theSize + StateBlock::theSize;
+ static const size_t theSize = 2 * SuperBlock::theSize;
static const sal_uInt16 thePageSize = theSize;
STORE_STATIC_ASSERT(STORE_MINIMUM_PAGESIZE >= thePageSize);
@@ -286,147 +216,138 @@ struct OStoreSuperBlockPage
/** Construction.
*/
- explicit OStoreSuperBlockPage (sal_uInt16 nPageSize = thePageSize)
+ explicit SuperBlockPage (sal_uInt16 nPageSize = thePageSize)
: m_aSuperOne(nPageSize),
- m_aSuperTwo(nPageSize),
- m_aState()
+ m_aSuperTwo(nPageSize)
{}
- /** guard (external representation).
- */
- void guard()
- {
- m_aSuperOne.guard();
- m_aSuperTwo.guard();
- }
-
/** save.
*/
- storeError save (OStorePageBIOS &rBIOS)
+ storeError save (OStorePageBIOS & rBIOS, sal_uInt32 nSize = theSize)
{
- // Guard.
- guard();
-
- // Write.
- return rBIOS.write (0, this, theSize);
+ m_aSuperOne.guard();
+ m_aSuperTwo = m_aSuperOne;
+ return rBIOS.write (0, this, nSize);
}
- /** close.
+ /** Page allocation.
*/
- storeError close (
- OStorePageBIOS &rBIOS);
+ storeError unusedHead (
+ OStorePageBIOS & rBIOS,
+ PageData & rPageHead);
- /** flush.
- */
- storeError flush (
- OStorePageBIOS &rBIOS);
+ storeError unusedPop (
+ OStorePageBIOS & rBIOS,
+ PageData const & rPageHead);
- /** modified.
- */
- storeError modified (
- OStorePageBIOS &rBIOS);
+ storeError unusedPush (
+ OStorePageBIOS & rBIOS,
+ sal_uInt32 nAddr);
/** verify (with repair).
*/
- storeError verify (
- OStorePageBIOS &rBIOS);
+ storeError verify (OStorePageBIOS & rBIOS);
};
} // namespace store
/*========================================================================
*
- * OStoreSuperBlockPage implementation.
+ * SuperBlockPage implementation.
*
*======================================================================*/
/*
- * close.
+ * unusedHead(): get freelist head (alloc page, step 1).
*/
-storeError OStoreSuperBlockPage::close (OStorePageBIOS &rBIOS)
+storeError SuperBlockPage::unusedHead (OStorePageBIOS & rBIOS, PageData & rPageHead)
{
- storeError eErrCode = store_E_None;
- if (m_aState.closePending())
+ storeError eErrCode = verify (rBIOS);
+ if (eErrCode != store_E_None)
+ return eErrCode;
+
+ // Check freelist head.
+ OStorePageLink const aListHead (m_aSuperOne.unusedHead());
+ if (aListHead.location() == 0)
{
- // Mark as modified.
- m_aState.modified();
+ // Freelist empty, see SuperBlock::ctor().
+ rPageHead.location (STORE_PAGE_NULL);
+ return store_E_None;
+ }
- // Check access mode.
- if (rBIOS.isWriteable())
- {
- // Save StateBlock.
- StateBlock aState (m_aState);
+ // Load PageHead.
+ eErrCode = rBIOS.read (aListHead.location(), &rPageHead, PageData::theSize);
+ if (eErrCode != store_E_None)
+ return eErrCode;
- // Mark as clean.
- aState.clean();
+ eErrCode = rPageHead.verify (aListHead.location());
+ if (eErrCode != store_E_None)
+ return eErrCode;
- // Write behind SuperBlock.
- sal_uInt32 nAddr = 2 * SuperBlock::theSize;
- eErrCode = rBIOS.write (nAddr, &aState, StateBlock::theSize);
- }
+ // Verify page is unused.
+ sal_uInt32 const nAddr = rPageHead.m_aUnused.location();
+ OSL_POSTCOND(nAddr != STORE_PAGE_NULL, "store::SuperBlock::unusedHead(): page not free");
+ if (nAddr == STORE_PAGE_NULL)
+ {
+ // Page in use.
+ rPageHead.location (STORE_PAGE_NULL);
- // Mark as clean.
- m_aState.clean();
+ // Recovery: Reset freelist to empty.
+ m_aSuperOne.unusedReset();
+ eErrCode = save (rBIOS);
}
return eErrCode;
}
/*
- * flush.
+ * unusedPop(): pop freelist head (alloc page, step 2).
*/
-storeError OStoreSuperBlockPage::flush (OStorePageBIOS &rBIOS)
+storeError SuperBlockPage::unusedPop (OStorePageBIOS & rBIOS, PageData const & rPageHead)
{
- storeError eErrCode = store_E_None;
- if (m_aState.flushPending())
- {
- // Check access mode.
- if (rBIOS.isWriteable())
- {
- // Save StateBlock.
- StateBlock aState (m_aState);
-
- // Mark as flushed.
- aState.flushed();
-
- // Write behind SuperBlock.
- sal_uInt32 nAddr = 2 * SuperBlock::theSize;
- eErrCode = rBIOS.write (nAddr, &aState, StateBlock::theSize);
- }
-
- // Mark as flushed.
- m_aState.flushed();
- }
- return eErrCode;
+ sal_uInt32 const nAddr = rPageHead.m_aUnused.location();
+ OSL_PRECOND(nAddr != STORE_PAGE_NULL, "store::SuperBlock::unusedPop(): page not free");
+ if (nAddr == STORE_PAGE_NULL)
+ return store_E_CantSeek;
+
+ // Pop from FreeList.
+ OStorePageLink const aListHead (nAddr);
+ m_aSuperOne.unusedRemove (aListHead);
+ return save (rBIOS);
}
/*
- * modified.
+ * unusedPush(): push new freelist head.
*/
-storeError OStoreSuperBlockPage::modified (OStorePageBIOS &rBIOS)
+storeError SuperBlockPage::unusedPush (OStorePageBIOS & rBIOS, sal_uInt32 nAddr)
{
- storeError eErrCode = store_E_None;
- if (!m_aState.flushPending())
- {
- // Mark as modified.
- m_aState.modified();
+ storeError eErrCode = verify (rBIOS);
+ if (eErrCode != store_E_None)
+ return eErrCode;
- // Check access mode.
- if (rBIOS.isWriteable())
- {
- // Save StateBlock.
- StateBlock aState (m_aState);
+ PageData aPageHead;
+ eErrCode = rBIOS.read (nAddr, &aPageHead, PageData::theSize);
+ if (eErrCode != store_E_None)
+ return eErrCode;
- // Write behind SuperBlock.
- sal_uInt32 nAddr = 2 * SuperBlock::theSize;
- eErrCode = rBIOS.write (nAddr, &aState, StateBlock::theSize);
- }
- }
- return eErrCode;
+ eErrCode = aPageHead.verify (nAddr);
+ if (eErrCode != store_E_None)
+ return eErrCode;
+
+ aPageHead.m_aUnused = m_aSuperOne.unusedHead();
+ aPageHead.guard (nAddr);
+
+ eErrCode = rBIOS.write (nAddr, &aPageHead, PageData::theSize);
+ if (eErrCode != store_E_None)
+ return eErrCode;
+
+ OStorePageLink const aListHead (nAddr);
+ m_aSuperOne.unusedInsert(aListHead);
+ return save (rBIOS);
}
/*
* verify (with repair).
*/
-storeError OStoreSuperBlockPage::verify (OStorePageBIOS &rBIOS)
+storeError SuperBlockPage::verify (OStorePageBIOS & rBIOS)
{
// Verify 1st copy.
storeError eErrCode = m_aSuperOne.verify();
@@ -636,8 +557,7 @@ OStorePageBIOS::AceCache::destroy (OStorePageBIOS::Ace * ace)
OStorePageBIOS::OStorePageBIOS (void)
: m_xLockBytes (NULL),
m_pSuper (NULL),
- m_bModified (sal_False),
- m_bWriteable (sal_False)
+ m_bWriteable (false)
{
}
@@ -646,158 +566,63 @@ OStorePageBIOS::OStorePageBIOS (void)
*/
OStorePageBIOS::~OStorePageBIOS (void)
{
- OStorePageBIOS::close();
-}
-
-/*
- * verify (SuperBlock with repair).
- * Internal: Precond: initialized, exclusive access.
- */
-storeError OStorePageBIOS::verify (SuperPage *&rpSuper)
-{
- // Check SuperBlock page allocation.
- if (rpSuper == 0)
- {
- // Allocate.
- if ((rpSuper = new SuperPage()) == 0)
- return store_E_OutOfMemory;
-
- // Load (w/o verification).
- storeError eErrCode = read (0, rpSuper, SuperPage::theSize);
- if (eErrCode != store_E_None)
- {
- // Cleanup and fail.
- delete rpSuper, rpSuper = 0;
- return eErrCode;
- }
-
- // Check SuperBlock state.
- if (rpSuper->m_aState.closePending())
- OSL_TRACE("OStorePageBIOS::verify(): close pending.\n");
-
- if (rpSuper->m_aState.flushPending())
- OSL_TRACE("OStorePageBIOS::verify(): flush pending.\n");
- }
-
- // Verify SuperBlock page (with repair).
- return rpSuper->verify (*this);
-}
-
-/*
- * repair (SuperBlock).
- * Internal: Precond: initialized, exclusive access.
- */
-storeError OStorePageBIOS::repair (SuperPage *&rpSuper)
-{
- // Acquire Lock.
- storeError eErrCode = acquireLock (0, SuperPage::theSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // Verify SuperBlock page (with repair).
- eErrCode = verify (rpSuper);
- if (eErrCode != store_E_None)
- {
- // Failure.
- releaseLock (0, SuperPage::theSize);
- return eErrCode;
- }
-
- // ReleaseLock.
- return releaseLock (0, SuperPage::theSize);
+ cleanup_Impl();
}
/*
- * create (SuperBlock).
- * Internal: Precond: initialized, exclusive access.
+ * initialize.
+ * Precond: none.
*/
-storeError OStorePageBIOS::create (sal_uInt16 nPageSize)
+storeError OStorePageBIOS::initialize (
+ ILockBytes * pLockBytes,
+ storeAccessMode eAccessMode,
+ sal_uInt16 & rnPageSize)
{
- // Check (internal) precond.
- OSL_PRECOND(m_xLockBytes.is(), "store::PageBIOS::create(): contract violation");
-
- // Check PageSize.
- if ((STORE_MINIMUM_PAGESIZE > nPageSize) || (nPageSize > STORE_MAXIMUM_PAGESIZE))
- return store_E_InvalidParameter;
- nPageSize = ((nPageSize + STORE_MINIMUM_PAGESIZE - 1) & ~(STORE_MINIMUM_PAGESIZE - 1));
-
- // Acquire Lock.
- storeError eErrCode = acquireLock (0, nPageSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // Allocate SuperBlock page.
- delete m_pSuper, m_pSuper = 0;
- if ((m_pSuper = new(nPageSize) SuperPage(nPageSize)) == 0)
- {
- // Cleanup and fail.
- releaseLock (0, nPageSize);
- return store_E_OutOfMemory;
- }
- m_pSuper->guard();
+ // Acquire exclusive access.
+ osl::MutexGuard aGuard (m_aMutex);
- // Create initial page (w/ SuperBlock).
- eErrCode = m_xLockBytes->writeAt (0, m_pSuper, nPageSize);
+ // Initialize.
+ storeError eErrCode = initialize_Impl (pLockBytes, eAccessMode, rnPageSize);
if (eErrCode != store_E_None)
{
- // Cleanup and fail.
- releaseLock (0, nPageSize);
- return eErrCode;
+ // Cleanup.
+ cleanup_Impl();
}
-
-#ifdef STORE_FEATURE_COMMIT
- // Commit.
- eErrCode = m_xLockBytes->flush();
- OSL_POSTCOND(
- eErrCode == store_E_None,
- "OStorePageBIOS::create(): flush failed");
-#endif /* STORE_FEATURE_COMMIT */
-
- // Adjust modified state.
- m_bModified = (eErrCode != store_E_None);
-
- // Release Lock and finish.
- return releaseLock (0, nPageSize);
+ return eErrCode;
}
/*
- * initialize.
- * Precond: none.
+ * initialize_Impl.
+ * Internal: Precond: exclusive access.
*/
-storeError OStorePageBIOS::initialize (
+storeError OStorePageBIOS::initialize_Impl (
ILockBytes * pLockBytes,
storeAccessMode eAccessMode,
sal_uInt16 & rnPageSize)
{
- // Acquire exclusive access.
- osl::MutexGuard aGuard (m_aMutex);
-
- // Check arguments.
- storeError eErrCode = store_E_InvalidParameter;
- if (!pLockBytes)
- return eErrCode;
-
// Cleanup.
-#if 0 /* OLD */
- __STORE_DELETEZ (m_pAcl); /* @@@ */
-#endif /* OLD */
- delete m_pSuper, m_pSuper = 0;
+ cleanup_Impl();
// Initialize.
m_xLockBytes = pLockBytes;
- m_bModified = sal_False;
- m_bWriteable = (!(eAccessMode == store_AccessReadOnly));
+ if (!m_xLockBytes.is())
+ return store_E_InvalidParameter;
+ m_bWriteable = (eAccessMode != store_AccessReadOnly);
// Check access mode.
- if (eAccessMode == store_AccessReadOnly)
- {
- // Verify SuperBlock page.
- eErrCode = verify (m_pSuper);
- }
- else if (eAccessMode != store_AccessCreate)
+ storeError eErrCode = store_E_None;
+ if (eAccessMode != store_AccessCreate)
{
- // Verify (w/ repair) SuperBlock page.
- eErrCode = repair (m_pSuper);
+ // Load SuperBlock page.
+ if ((m_pSuper = new SuperBlockPage()) == 0)
+ return store_E_OutOfMemory;
+
+ eErrCode = read (0, m_pSuper, SuperBlockPage::theSize);
+ if (eErrCode == store_E_None)
+ {
+ // Verify SuperBlock page (with repair).
+ eErrCode = m_pSuper->verify (*this);
+ }
}
else
{
@@ -806,13 +631,6 @@ storeError OStorePageBIOS::initialize (
if (eErrCode != store_E_None)
return eErrCode;
-#ifdef STORE_FEATURE_COMMIT
- // Commit.
- eErrCode = m_xLockBytes->flush();
- if (eErrCode != store_E_None)
- return eErrCode;
-#endif /* STORE_FEATURE_COMMIT */
-
// Mark as not existing.
eErrCode = store_E_NotExists;
}
@@ -829,14 +647,18 @@ storeError OStorePageBIOS::initialize (
if (eAccessMode == store_AccessReadWrite)
return store_E_NotExists;
- // Create SuperBlock page.
- eErrCode = create (rnPageSize);
+ // Check PageSize.
+ if ((STORE_MINIMUM_PAGESIZE > rnPageSize) || (rnPageSize > STORE_MAXIMUM_PAGESIZE))
+ return store_E_InvalidParameter;
+ rnPageSize = ((rnPageSize + STORE_MINIMUM_PAGESIZE - 1) & ~(STORE_MINIMUM_PAGESIZE - 1));
+
+ // Create initial page (w/ SuperBlock).
+ if ((m_pSuper = new(rnPageSize) SuperBlockPage(rnPageSize)) == 0)
+ return store_E_OutOfMemory;
+ eErrCode = m_pSuper->save (*this, rnPageSize);
}
if (eErrCode == store_E_None)
{
- // Obtain modified state.
- m_bModified = m_pSuper->m_aState.flushPending();
-
// Obtain page size.
rnPageSize = store::ntohs(m_pSuper->m_aSuperOne.m_aDescr.m_nSize);
@@ -852,33 +674,35 @@ storeError OStorePageBIOS::initialize (
}
/*
- * acquireLock.
- * Low Level: Precond: initialized, exclusive access.
+ * cleanup_Impl.
+ * Internal: Precond: exclusive access.
*/
-storeError OStorePageBIOS::acquireLock (
- sal_uInt32 nAddr, sal_uInt32 nSize)
+void OStorePageBIOS::cleanup_Impl()
{
- // Check precond.
- if (!m_xLockBytes.is())
- return store_E_InvalidAccess;
+ // Check referer count.
+ if (m_ace_head.m_used > 0)
+ {
+ // Report remaining referer count.
+ OSL_TRACE("store::PageBIOS::cleanup_Impl(): referer count: %d\n", m_ace_head.m_used);
+ for (Ace * ace = m_ace_head.m_next; ace != &m_ace_head; ace = m_ace_head.m_next)
+ {
+ m_ace_head.m_used -= ace->m_used;
+ AceCache::get().destroy (ace);
+ }
+ OSL_ENSURE(m_ace_head.m_used == 0, "store::PageBIOS::cleanup_Impl(): logic error");
+ }
- // Acquire Lock.
- return m_xLockBytes->lockRange (nAddr, nSize);
-}
+ // Release SuperBlock page.
+ delete m_pSuper, m_pSuper = 0;
-/*
- * releaseLock.
- * Low Level: Precond: initialized, exclusive access.
- */
-storeError OStorePageBIOS::releaseLock (
- sal_uInt32 nAddr, sal_uInt32 nSize)
-{
- // Check precond.
- if (!m_xLockBytes.is())
- return store_E_InvalidAccess;
+ // Release PageCache.
+ m_xCache.clear();
+
+ // Release PageAllocator.
+ m_xAllocator.clear();
- // Release Lock.
- return m_xLockBytes->unlockRange (nAddr, nSize);
+ // Release LockBytes.
+ m_xLockBytes.clear();
}
/*
@@ -892,7 +716,7 @@ storeError OStorePageBIOS::read (
if (!m_xLockBytes.is())
return store_E_InvalidAccess;
- // Read Page.
+ // Read Data.
return m_xLockBytes->readAt (nAddr, pData, nSize);
}
@@ -909,18 +733,6 @@ storeError OStorePageBIOS::write (
if (!m_bWriteable)
return store_E_AccessViolation;
- // Check modified state.
- if (!m_bModified)
- {
- // Mark as modified.
- m_bModified = sal_True;
-
- // Mark SuperBlock modified.
- storeError eErrCode = m_pSuper->modified (*this);
- if (eErrCode != store_E_None)
- return eErrCode;
- }
-
// Write Data.
return m_xLockBytes->writeAt (nAddr, pData, nSize);
}
@@ -1026,160 +838,44 @@ storeError OStorePageBIOS::allocate (
if (!m_bWriteable)
return store_E_AccessViolation;
- // Acquire SuperBlock Lock.
- storeError eErrCode = acquireLock (0, SuperPage::theSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // Load SuperBlock and require good health.
- eErrCode = verify (m_pSuper);
- if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
- return eErrCode;
- }
-
- // Check allocation.
+ // Check allocation type.
+ storeError eErrCode = store_E_None;
if (eAlloc != ALLOCATE_EOF)
{
- // Check FreeList.
- OStorePageLink aListHead (m_pSuper->m_aSuperTwo.unusedHead());
- if (aListHead.location())
- {
- // Allocate from FreeList.
- OStorePageData aPageHead (OStorePageData::theSize);
- aPageHead.location (aListHead.location());
-
- // Load PageHead.
- eErrCode = peek (aPageHead);
- if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
- return eErrCode;
- }
-
- // Verify FreeList head.
- OSL_PRECOND(
- aPageHead.m_aUnused.m_nAddr != STORE_PAGE_NULL,
- "OStorePageBIOS::allocate(): page not free");
- if (aPageHead.m_aUnused.location() == STORE_PAGE_NULL)
- {
- // Recovery: Reset FreeList.
- m_pSuper->m_aSuperTwo.unusedReset();
- m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo;
-
- // Save SuperBlock page.
- eErrCode = m_pSuper->save (*this);
-
- // Release SuperBlock Lock.
- releaseLock (0, SuperPage::theSize);
-
- // Recovery: Allocate from EOF.
- if (eErrCode == store_E_None)
- return allocate (rPage, ALLOCATE_EOF);
- else
- return store_E_Unknown;
- }
-
- // Pop from FreeList.
- aListHead = aPageHead.m_aUnused.location();
- rPage.get()->m_aUnused = STORE_PAGE_NULL;
-
- // Save page at PageHead location.
- eErrCode = saveObjectAt_Impl (rPage, aPageHead.location());
- if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
- return eErrCode;
- }
-
- // Save SuperBlock page.
- m_pSuper->m_aSuperTwo.unusedRemove (aListHead);
- m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo;
-
- eErrCode = m_pSuper->save (*this);
- OSL_POSTCOND(
- eErrCode == store_E_None,
- "OStorePageBIOS::allocate(): SuperBlock save failed");
-
- // Release SuperBlock Lock and finish.
- return releaseLock (0, SuperPage::theSize);
- }
- }
-
- // Allocate from logical EOF. Determine physical EOF.
- sal_uInt32 nPhysLen = STORE_PAGE_NULL;
- eErrCode = m_xLockBytes->getSize (nPhysLen);
- if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
- return eErrCode;
- }
-
- // Obtain logical EOF.
- OStorePageDescriptor aDescr (m_pSuper->m_aSuperTwo.m_aDescr);
- sal_uInt32 nLogLen = store::ntohl(aDescr.m_nAddr);
- if (nLogLen == 0)
- nLogLen = nPhysLen; /* backward compatibility */
+ // Try freelist head.
+ PageData aPageHead;
+ eErrCode = m_pSuper->unusedHead (*this, aPageHead);
+ if (eErrCode != store_E_None)
+ return eErrCode;
- if (!(nLogLen < nPhysLen))
- {
- // Check modified state.
- if (!m_bModified)
+ sal_uInt32 const nAddr = aPageHead.location();
+ if (nAddr != STORE_PAGE_NULL)
{
- // Mark modified.
- m_bModified = sal_True;
-
- // Mark SuperBlock modified.
- eErrCode = m_pSuper->modified (*this);
+ // Save page.
+ eErrCode = saveObjectAt_Impl (rPage, nAddr);
if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
return eErrCode;
- }
- }
-
- // Resize.
- sal_uInt32 nAlign = SAL_MIN (nPhysLen, STORE_MAXIMUM_PAGESIZE);
- nPhysLen = ((nPhysLen + nAlign) / nAlign) * nAlign;
- eErrCode = m_xLockBytes->setSize (nPhysLen);
- if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
- return eErrCode;
+ // Pop freelist head and finish.
+ return m_pSuper->unusedPop (*this, aPageHead);
}
}
- // Save page at logical EOF.
- eErrCode = saveObjectAt_Impl (rPage, nLogLen);
+ // Allocate from EOF. Determine current size.
+ sal_uInt32 nSize = STORE_PAGE_NULL;
+ eErrCode = m_xLockBytes->getSize (nSize);
if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
return eErrCode;
- }
-
- // Save SuperBlock page.
- nLogLen += store::ntohs(aDescr.m_nSize);
- aDescr.m_nAddr = store::htonl(nLogLen);
-
- m_pSuper->m_aSuperTwo.m_aDescr = aDescr;
- m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo;
- eErrCode = m_pSuper->save (*this);
- OSL_POSTCOND(
- eErrCode == store_E_None,
- "OStorePageBIOS::allocate(): SuperBlock save failed");
-
- // Release SuperBlock Lock and finish.
- return releaseLock (0, SuperPage::theSize);
+ // Save page at current EOF.
+ return saveObjectAt_Impl (rPage, nSize);
}
/*
* free.
* Precond: initialized, writeable.
*/
-storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr)
+storeError OStorePageBIOS::free (sal_uInt32 nAddr)
{
// Acquire exclusive access.
osl::MutexGuard aGuard (m_aMutex);
@@ -1190,58 +886,11 @@ storeError OStorePageBIOS::free (OStorePageData & /* rData */, sal_uInt32 nAddr)
if (!m_bWriteable)
return store_E_AccessViolation;
- // Acquire SuperBlock Lock.
- storeError eErrCode = acquireLock (0, SuperPage::theSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // Load SuperBlock and require good health.
- eErrCode = verify (m_pSuper);
- if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
- return eErrCode;
- }
-
- // Load PageHead.
- OStorePageData aPageHead(OStorePageData::theSize);
- aPageHead.location (nAddr);
-
- eErrCode = peek (aPageHead);
- if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
- return eErrCode;
- }
-
// Invalidate cache.
(void) m_xCache->removePageAt (nAddr);
- // Push onto FreeList.
- OStorePageLink aListHead (m_pSuper->m_aSuperTwo.unusedHead());
-
- aPageHead.m_aUnused.m_nAddr = aListHead.m_nAddr;
- aListHead.m_nAddr = aPageHead.m_aDescr.m_nAddr;
-
- // Save PageHead.
- eErrCode = poke (aPageHead);
- if (eErrCode != store_E_None)
- {
- releaseLock (0, SuperPage::theSize);
- return eErrCode;
- }
-
- // Save SuperBlock page.
- m_pSuper->m_aSuperTwo.unusedInsert (aListHead);
- m_pSuper->m_aSuperOne = m_pSuper->m_aSuperTwo;
-
- eErrCode = m_pSuper->save (*this);
- OSL_POSTCOND(
- eErrCode == store_E_None,
- "OStorePageBIOS::free(): SuperBlock save failed");
-
- // Release SuperBlock Lock and finish.
- return releaseLock (0, SuperPage::theSize);
+ // Push onto freelist.
+ return m_pSuper->unusedPush (*this, nAddr);
}
/*
@@ -1333,57 +982,16 @@ storeError OStorePageBIOS::saveObjectAt_Impl (OStorePageObject & rPage, sal_uInt
* close.
* Precond: none.
*/
-storeError OStorePageBIOS::close (void)
+storeError OStorePageBIOS::close()
{
// Acquire exclusive access.
osl::MutexGuard aGuard (m_aMutex);
- // Check referer count.
- if (m_ace_head.m_used > 0)
- {
- // Report remaining referer count.
- OSL_TRACE("store::PageBIOS::close(): referer count: %d\n", m_ace_head.m_used);
-#if 1 /* NEW */
- for (Ace * ace = m_ace_head.m_next; ace != &m_ace_head; ace = m_ace_head.m_next)
- {
- m_ace_head.m_used -= ace->m_used;
- AceCache::get().destroy (ace);
- }
- OSL_ENSURE(m_ace_head.m_used == 0, "store::PageBIOS::close(): logic error");
-#endif /* NEW */
- }
-
- // Check SuperBlock page.
- storeError eErrCode = store_E_None;
- if (m_pSuper)
- {
- // Release SuperBlock page.
- eErrCode = m_pSuper->close (*this);
- delete m_pSuper, m_pSuper = 0;
- }
-
- // Release PageCache.
- m_xCache.clear();
-
- // Check LockBytes.
- if (m_xLockBytes.is())
- {
-#ifdef STORE_FEATURE_COMMIT
- // Commit.
- storeError result = m_xLockBytes->flush();
- if (eErrCode == store_E_None)
- {
- // Previous result(s) okay. Propagate next result.
- eErrCode = result;
- }
-#endif /* STORE_FEATURE_COMMIT */
-
- // Release LockBytes.
- m_xLockBytes.clear();
- }
+ // Cleanup.
+ cleanup_Impl();
// Done.
- return eErrCode;
+ return store_E_None;
}
/*
@@ -1399,27 +1007,8 @@ storeError OStorePageBIOS::flush (void)
if (!m_xLockBytes.is())
return store_E_InvalidAccess;
- // Check mode and state.
- storeError eErrCode = store_E_None;
- if (!(m_bWriteable && m_bModified))
- return eErrCode;
-
- // Flush SuperBlock page.
- eErrCode = m_pSuper->flush (*this);
-
- // Flush LockBytes.
- storeError result = m_xLockBytes->flush();
- if (eErrCode == store_E_None)
- {
- // Previous result(s) okay. Propagate next result.
- eErrCode = result;
- }
-
- // Adjust modified state.
- m_bModified = (eErrCode != store_E_None);
-
- // Done.
- return eErrCode;
+ // Flush LockBytes and finish.
+ return m_xLockBytes->flush();
}
/*
@@ -1462,7 +1051,7 @@ storeError OStorePageBIOS::scanBegin (
return store_E_InvalidAccess;
// Check SuperBlock page.
- storeError eErrCode = verify (m_pSuper);
+ storeError eErrCode = m_pSuper->verify (*this);
if (eErrCode != store_E_None)
{
// Damaged. Determine page size (NYI).
@@ -1472,7 +1061,8 @@ storeError OStorePageBIOS::scanBegin (
// Setup Context descriptor.
rCtx.m_aDescr = m_pSuper->m_aSuperOne.m_aDescr;
- rCtx.m_aDescr.m_nAddr = rCtx.m_aDescr.m_nSize; // @@@ ntoh @@@
+ rCtx.m_aDescr.m_nSize = store::ntohs(rCtx.m_aDescr.m_nSize);
+ rCtx.m_aDescr.m_nAddr = rCtx.m_aDescr.m_nSize;
// Setup Context size.
eErrCode = size (rCtx.m_nSize);
@@ -1498,17 +1088,22 @@ storeError OStorePageBIOS::scanNext (
return store_E_InvalidAccess;
// Setup PageHead.
- OStorePageData aPageHead (OStorePageData::theSize);
+ PageData aPageHead;
// Check context.
while (rCtx.isValid())
{
// Assign next location.
- aPageHead.location (rCtx.m_aDescr.m_nAddr);
+ sal_uInt32 nAddr = rCtx.m_aDescr.m_nAddr;
rCtx.m_aDescr.m_nAddr += rCtx.m_aDescr.m_nSize;
- // Load PageHead.
- storeError eErrCode = peek (aPageHead);
+ // Read PageHead.
+ storeError eErrCode = read (nAddr, &aPageHead, PageData::theSize);
+ if (eErrCode != store_E_None)
+ continue;
+
+ // Verify PageHead.
+ eErrCode = aPageHead.verify (nAddr);
if (eErrCode != store_E_None)
continue;
@@ -1521,7 +1116,7 @@ storeError OStorePageBIOS::scanNext (
continue;
// Load page.
- eErrCode = loadObjectAt_Impl (rPage, aPageHead.location());
+ eErrCode = loadObjectAt_Impl (rPage, nAddr);
if (eErrCode != store_E_None)
continue;
@@ -1532,31 +1127,3 @@ storeError OStorePageBIOS::scanNext (
// Done.
return store_E_CantSeek;
}
-
-/*
- * peek (PageHead).
- * Internal: Precond: initialized, readable, exclusive access.
- */
-storeError OStorePageBIOS::peek (OStorePageData &rData)
-{
- // Read PageHead.
- storeError eErrCode = read (rData.location(), &rData, OStorePageData::theSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // Verify PageHead.
- return rData.verify();
-}
-
-/*
- * poke (PageHead).
- * Internal: Precond: initialized, writeable, exclusive access.
- */
-storeError OStorePageBIOS::poke (OStorePageData &rData)
-{
- // Guard PageHead.
- rData.guard();
-
- // Write PageHead.
- return write (rData.location(), &rData, OStorePageData::theSize);
-}
diff --git a/store/source/storbios.hxx b/store/source/storbios.hxx
index ad84b40b05e7..439089d41bd6 100644
--- a/store/source/storbios.hxx
+++ b/store/source/storbios.hxx
@@ -26,7 +26,7 @@
************************************************************************/
#ifndef _STORE_STORBIOS_HXX_
-#define _STORE_STORBIOS_HXX_ "$Revision: 1.1.2.3 $"
+#define _STORE_STORBIOS_HXX_
#include "sal/types.h"
#include "rtl/ref.hxx"
@@ -46,7 +46,7 @@
namespace store
{
-struct OStoreSuperBlockPage;
+struct SuperBlockPage;
class OStorePageBIOS : public store::OStoreObject
{
@@ -75,16 +75,6 @@ public:
return m_xAllocator;
}
- /** acquireLock.
- */
- storeError acquireLock (
- sal_uInt32 nAddr, sal_uInt32 nSize);
-
- /** releaseLock.
- */
- storeError releaseLock (
- sal_uInt32 nAddr, sal_uInt32 nSize);
-
/** read.
*/
storeError read (
@@ -95,10 +85,6 @@ public:
storeError write (
sal_uInt32 nAddr, const void *pData, sal_uInt32 nSize);
- /** isModified.
- */
- inline bool isModified (void) const;
-
/** isWriteable.
*/
inline bool isWriteable (void) const;
@@ -129,8 +115,7 @@ public:
storeError allocate (
OStorePageObject& rPage, Allocation eAllocation = ALLOCATE_FIRST);
- storeError free (
- OStorePageData & /* rData */, sal_uInt32 nAddr);
+ storeError free (sal_uInt32 nAddr);
/** Page I/O.
*/
@@ -196,10 +181,8 @@ private:
rtl::Reference<ILockBytes> m_xLockBytes;
osl::Mutex m_aMutex;
- typedef OStoreSuperBlockPage SuperPage;
- SuperPage *m_pSuper;
+ SuperBlockPage * m_pSuper;
- bool m_bModified;
bool m_bWriteable;
rtl::Reference< PageData::Allocator > m_xAllocator;
@@ -230,22 +213,16 @@ private:
class AceCache;
- /** create (SuperBlock).
- */
- storeError create (sal_uInt16 nPageSize);
-
- /** SuperBlock verification and repair.
+ /** Initialization.
*/
- storeError verify (SuperPage *&rpSuper);
- storeError repair (SuperPage *&rpSuper);
+ storeError initialize_Impl (
+ ILockBytes * pLockBytes,
+ storeAccessMode eAccessMode,
+ sal_uInt16 & rnPageSize);
+ void cleanup_Impl();
/** Page Maintenance.
*/
- storeError peek (
- OStorePageData &rData);
- storeError poke (
- OStorePageData &rData);
-
storeError loadObjectAt_Impl (
OStorePageObject & rPage, sal_uInt32 nAddr);
storeError saveObjectAt_Impl (
@@ -261,10 +238,6 @@ inline OStorePageBIOS::operator osl::Mutex& (void) const
{
return (osl::Mutex&)m_aMutex;
}
-inline bool OStorePageBIOS::isModified (void) const
-{
- return m_bModified;
-}
inline bool OStorePageBIOS::isWriteable (void) const
{
return m_bWriteable;
diff --git a/store/source/stordata.cxx b/store/source/stordata.cxx
index 97bcc87fcb6c..901da15c8040 100644
--- a/store/source/stordata.cxx
+++ b/store/source/stordata.cxx
@@ -95,8 +95,7 @@ static storeError store_truncate_Impl (
if (nSingle == 0)
{
// Free single indirect page.
- OStorePageData aPageHead;
- eErrCode = rBIOS.free (aPageHead, nAddr);
+ eErrCode = rBIOS.free (nAddr);
if (eErrCode != store_E_None)
return eErrCode;
}
@@ -135,8 +134,7 @@ static storeError store_truncate_Impl (
if ((nDouble + nSingle) == 0)
{
// Free double indirect page.
- OStorePageData aPageHead;
- eErrCode = rBIOS.free (aPageHead, nAddr);
+ eErrCode = rBIOS.free (nAddr);
if (eErrCode != store_E_None)
return eErrCode;
}
@@ -171,8 +169,7 @@ static storeError store_truncate_Impl (
if ((nTriple + nDouble + nSingle) == 0)
{
// Free triple indirect page.
- OStorePageData aPageHead;
- eErrCode = rBIOS.free (aPageHead, nAddr);
+ eErrCode = rBIOS.free (nAddr);
if (eErrCode != store_E_None)
return eErrCode;
}
@@ -433,17 +430,8 @@ storeError OStoreIndirectionPageObject::truncate (
if (!(nSingle < nLimit))
return store_E_InvalidAccess;
- // Save PageDescriptor.
- OStorePageDescriptor aDescr (rPage.m_aDescr);
- aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr);
- aDescr.m_nSize = store::ntohs(aDescr.m_nSize);
-
- // Acquire Lock.
- storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
// Truncate.
+ storeError eErrCode = store_E_None;
for (sal_uInt16 i = nLimit; i > nSingle; i--)
{
// Obtain data page location.
@@ -451,13 +439,9 @@ storeError OStoreIndirectionPageObject::truncate (
if (nAddr != STORE_PAGE_NULL)
{
// Free data page.
- OStorePageData aPageHead;
- eErrCode = rBIOS.free (aPageHead, nAddr);
+ eErrCode = rBIOS.free (nAddr);
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Clear pointer to data page.
rPage.m_pData[i - 1] = STORE_PAGE_NULL;
@@ -470,19 +454,10 @@ storeError OStoreIndirectionPageObject::truncate (
{
// Save this page.
eErrCode = rBIOS.saveObjectAt (*this, location());
- if (eErrCode != store_E_None)
- {
- // Must not happen.
- OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed");
-
- // Release Lock and Leave.
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
- return eErrCode;
- }
}
- // Release Lock and Leave.
- return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
+ // Done.
+ return eErrCode;
}
/*
@@ -501,26 +476,14 @@ storeError OStoreIndirectionPageObject::truncate (
if (!((nDouble < nLimit) && (nSingle < nLimit)))
return store_E_InvalidAccess;
- // Save PageDescriptor.
- OStorePageDescriptor aDescr (rPage.m_aDescr);
- aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr);
- aDescr.m_nSize = store::ntohs(aDescr.m_nSize);
-
- // Acquire Lock.
- storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
// Truncate.
+ storeError eErrCode = store_E_None;
for (sal_uInt16 i = nLimit; i > nDouble + 1; i--)
{
// Truncate single indirect page to zero direct pages.
eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[i - 1]), 0, rBIOS);
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Clear pointer to single indirect page.
rPage.m_pData[i - 1] = STORE_PAGE_NULL;
@@ -530,10 +493,7 @@ storeError OStoreIndirectionPageObject::truncate (
// Truncate last single indirect page to 'nSingle' direct pages.
eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[nDouble]), nSingle, rBIOS);
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Check for complete truncation.
if (nSingle == 0)
@@ -548,19 +508,10 @@ storeError OStoreIndirectionPageObject::truncate (
{
// Save this page.
eErrCode = rBIOS.saveObjectAt (*this, location());
- if (eErrCode != store_E_None)
- {
- // Must not happen.
- OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed");
-
- // Release Lock and Leave.
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
- return eErrCode;
- }
}
- // Release Lock and Leave.
- return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
+ // Done.
+ return eErrCode;
}
/*
@@ -580,26 +531,14 @@ storeError OStoreIndirectionPageObject::truncate (
if (!((nTriple < nLimit) && (nDouble < nLimit) && (nSingle < nLimit)))
return store_E_InvalidAccess;
- // Save PageDescriptor.
- OStorePageDescriptor aDescr (rPage.m_aDescr);
- aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr);
- aDescr.m_nSize = store::ntohs(aDescr.m_nSize);
-
- // Acquire Lock.
- storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
// Truncate.
+ storeError eErrCode = store_E_None;
for (sal_uInt16 i = nLimit; i > nTriple + 1; i--)
{
// Truncate double indirect page to zero single indirect pages.
eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[i - 1]), 0, 0, rBIOS);
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Clear pointer to double indirect page.
rPage.m_pData[i - 1] = STORE_PAGE_NULL;
@@ -609,10 +548,7 @@ storeError OStoreIndirectionPageObject::truncate (
// Truncate last double indirect page to 'nDouble', 'nSingle' pages.
eErrCode = store_truncate_Impl (store::ntohl(rPage.m_pData[nTriple]), nDouble, nSingle, rBIOS);
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Check for complete truncation.
if ((nDouble + nSingle) == 0)
@@ -627,19 +563,10 @@ storeError OStoreIndirectionPageObject::truncate (
{
// Save this page.
eErrCode = rBIOS.saveObjectAt (*this, location());
- if (eErrCode != store_E_None)
- {
- // Must not happen.
- OSL_TRACE("OStoreIndirectionPageObject::truncate(): save failed");
-
- // Release Lock and Leave.
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
- return eErrCode;
- }
}
- // Release Lock and Leave.
- return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
+ // Done.
+ return eErrCode;
}
/*========================================================================
@@ -1129,8 +1056,7 @@ storeError OStoreDirectoryPageObject::truncate (
if (nAddr == STORE_PAGE_NULL) continue;
// Free data page.
- OStoreDataPageData aData;
- eErrCode = rBIOS.free (aData, nAddr);
+ eErrCode = rBIOS.free (nAddr);
if (eErrCode != store_E_None)
break;
diff --git a/store/source/stordata.hxx b/store/source/stordata.hxx
index 6b062f7127f8..01ea2c0f86ec 100644
--- a/store/source/stordata.hxx
+++ b/store/source/stordata.hxx
@@ -26,7 +26,7 @@
************************************************************************/
#ifndef _STORE_STORDATA_HXX_
-#define _STORE_STORDATA_HXX_ "$Revision: 1.6.8.2 $"
+#define _STORE_STORDATA_HXX_
#include "sal/types.h"
#include "sal/macros.h"
diff --git a/store/source/storpage.cxx b/store/source/storpage.cxx
index 770e46ee84b6..a49e850061b6 100644
--- a/store/source/storpage.cxx
+++ b/store/source/storpage.cxx
@@ -117,11 +117,6 @@ storeError OStorePageManager::initialize (
// Save RootNode.
eErrCode = base::saveObjectAt (m_aRoot, rnPageSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // Flush for robustness.
- (void) base::flush();
}
// Done.
@@ -857,8 +852,7 @@ storeError OStorePageManager::remove (const OStorePageKey &rKey)
eErrCode = base::releasePage (aDescr, store_AccessReadWrite);
// Release and free directory page.
- OStorePageData aPageHead;
- eErrCode = base::free (aPageHead, aPage.location());
+ eErrCode = base::free (aPage.location());
}
// Remove entry.
diff --git a/store/source/stortree.cxx b/store/source/stortree.cxx
index 9636cc2f4f8c..23d7ca778961 100644
--- a/store/source/stortree.cxx
+++ b/store/source/stortree.cxx
@@ -202,25 +202,10 @@ storeError OStoreBTreeNodeObject::split (
if (!rxPageL->querySplit())
return store_E_None;
- // Save PageDescriptor.
- OStorePageDescriptor aDescr (xPage->m_aDescr);
- aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr);
- aDescr.m_nSize = store::ntohs(aDescr.m_nSize);
-
- // Acquire Lock.
- storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
- // [Begin PageL Lock (NYI)]
-
// Construct right page.
PageHolderObject< page > xPageR;
if (!xPageR.construct (rBIOS.allocator()))
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return store_E_OutOfMemory;
- }
// Split right page off left page.
xPageR->split (*rxPageL);
@@ -228,12 +213,9 @@ storeError OStoreBTreeNodeObject::split (
// Allocate right page.
self aNodeR (xPageR.get());
- eErrCode = rBIOS.allocate (aNodeR);
+ storeError eErrCode = rBIOS.allocate (aNodeR);
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Truncate left page.
rxPageL->truncate (rxPageL->capacityCount() / 2);
@@ -242,35 +224,14 @@ storeError OStoreBTreeNodeObject::split (
self aNodeL (rxPageL.get());
eErrCode = rBIOS.saveObjectAt (aNodeL, aNodeL.location());
if (eErrCode != store_E_None)
- {
- // Must not happen.
- OSL_TRACE("OStoreBTreeNodeObject::split(): save() failed");
-
- // Release Lock and Leave.
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
-
- // [End PageL Lock (NYI)]
// Insert right page.
OStorePageLink aLink (xPageR->location());
xPage->insert (nIndexL + 1, T(xPageR->m_pData[0].m_aKey, aLink));
- // Save this page.
- eErrCode = rBIOS.saveObjectAt (*this, location());
- if (eErrCode != store_E_None)
- {
- // Must not happen.
- OSL_TRACE("OStoreBTreeNodeObject::split(): save() failed");
-
- // Release Lock and Leave.
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
- return eErrCode;
- }
-
- // Release Lock and Leave.
- return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
+ // Save this page and leave.
+ return rBIOS.saveObjectAt (*this, location());
}
/*
@@ -284,56 +245,34 @@ storeError OStoreBTreeNodeObject::remove (
PageHolderObject< page > xImpl (m_xPage);
page & rPage = (*xImpl);
- // Save PageDescriptor.
- OStorePageDescriptor aDescr (rPage.m_aDescr);
- aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr);
- aDescr.m_nSize = store::ntohs(aDescr.m_nSize);
-
- // Acquire Lock.
- storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
// Check depth.
+ storeError eErrCode = store_E_None;
if (rPage.depth())
{
// Check link entry.
T const aEntryL (rPage.m_pData[nIndexL]);
if (!(rEntryL.compare (aEntryL) == T::COMPARE_EQUAL))
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return store_E_InvalidAccess;
- }
// Load link node.
self aNodeL;
eErrCode = rBIOS.loadObjectAt (aNodeL, aEntryL.m_aLink.location());
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Recurse: remove from link node.
eErrCode = aNodeL.remove (0, rEntryL, rBIOS);
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Check resulting link node usage.
PageHolderObject< page > xPageL (aNodeL.get());
if (xPageL->usageCount() == 0)
{
// Free empty link node.
- OStorePageData aPageHead;
- eErrCode = rBIOS.free (aPageHead, xPageL->location());
+ eErrCode = rBIOS.free (xPageL->location());
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return eErrCode;
- }
// Remove index.
rPage.remove (nIndexL);
@@ -355,7 +294,7 @@ storeError OStoreBTreeNodeObject::remove (
{
rPageL.merge (rPageR);
- eErrCode = rBIOS.free (aPageHead, rPageR.location());
+ eErrCode = rBIOS.free (rPageR.location());
}
}
}
@@ -370,10 +309,7 @@ storeError OStoreBTreeNodeObject::remove (
{
// Check leaf entry.
if (!(rEntryL.compare (rPage.m_pData[nIndexL]) == T::COMPARE_EQUAL))
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return store_E_NotExists;
- }
// Save leaf entry.
rEntryL = rPage.m_pData[nIndexL];
@@ -388,19 +324,10 @@ storeError OStoreBTreeNodeObject::remove (
{
// Save this page.
eErrCode = rBIOS.saveObjectAt (*this, location());
- if (eErrCode != store_E_None)
- {
- // Must not happen.
- OSL_TRACE("OStoreBTreeNodeObject::remove(): save() failed");
-
- // Release Lock and Leave.
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
- return eErrCode;
- }
}
- // Release Lock and Leave.
- return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
+ // Done.
+ return eErrCode;
}
/*========================================================================
@@ -454,33 +381,17 @@ storeError OStoreBTreeRootObject::change (
PageHolderObject< page > xPage (m_xPage);
(void) testInvariant("OStoreBTreeRootObject::change(): enter");
- // Save PageDescriptor.
- OStorePageDescriptor aDescr (xPage->m_aDescr);
- aDescr.m_nAddr = store::ntohl(aDescr.m_nAddr);
- aDescr.m_nSize = store::ntohs(aDescr.m_nSize);
-
// Save root location.
sal_uInt32 const nRootAddr = xPage->location();
- // Acquire Lock.
- storeError eErrCode = rBIOS.acquireLock (aDescr.m_nAddr, aDescr.m_nSize);
- if (eErrCode != store_E_None)
- return eErrCode;
-
// Construct new root.
if (!rxPageL.construct (rBIOS.allocator()))
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return store_E_OutOfMemory;
- }
// Save this as prev root.
- eErrCode = rBIOS.allocate (*this);
+ storeError eErrCode = rBIOS.allocate (*this);
if (eErrCode != store_E_None)
- {
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
return store_E_OutOfMemory;
- }
// Setup new root.
rxPageL->depth (xPage->depth() + 1);
@@ -495,24 +406,10 @@ storeError OStoreBTreeRootObject::change (
tmp.swap (m_xPage);
}
- // Save this as new root.
+ // Save this as new root and finish.
eErrCode = rBIOS.saveObjectAt (*this, nRootAddr);
- if (eErrCode != store_E_None)
- {
- // Must not happen.
- OSL_TRACE("OStoreBTreeRootObject::change(): save() failed");
-
- // Release Lock and Leave.
- rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
- return eErrCode;
- }
-
- // Flush for robustness.
- (void) rBIOS.flush();
-
- // Done. Release Lock and Leave.
(void) testInvariant("OStoreBTreeRootObject::change(): leave");
- return rBIOS.releaseLock (aDescr.m_nAddr, aDescr.m_nSize);
+ return eErrCode;
}
/*
diff --git a/store/workben/makefile.mk b/store/workben/makefile.mk
index 07b558d06bc6..8893f4c7d646 100644
--- a/store/workben/makefile.mk
+++ b/store/workben/makefile.mk
@@ -76,6 +76,7 @@ APP1OBJS= $(OBJ)$/t_file.obj
APP1STDLIBS= $(STOREDBGLIB)
APP1STDLIBS+= $(SALLIB)
APP1DEPN= $(STOREDBGLIB)
+APP1RPATH= UREBIN
APP2TARGET= t_page
APP2OBJS= $(OBJ)$/t_page.obj
@@ -88,6 +89,7 @@ APP3OBJS= $(OBJ)$/t_base.obj
APP3STDLIBS= $(STOREDBGLIB)
APP3STDLIBS+= $(SALLIB)
APP3DEPN= $(STOREDBGLIB)
+APP3RPATH= UREBIN
APP4TARGET= t_store
APP4OBJS= $(OBJ)$/t_store.obj
diff --git a/store/workben/t_base.cxx b/store/workben/t_base.cxx
index 49176c3dcfad..7f99c287a210 100644
--- a/store/workben/t_base.cxx
+++ b/store/workben/t_base.cxx
@@ -362,19 +362,8 @@ int SAL_CALL main (int argc, char **argv)
rtl_zeroMemory (pBuffer, sizeof (pBuffer));
rtl_copyMemory (pBuffer, argv[0], rtl_str_getLength(argv[0]) + 1);
- eErrCode = xBIOS->acquireLock (TEST_PAGESIZE, sizeof(pBuffer));
- if (eErrCode != store_E_None)
- return eErrCode;
-
eErrCode = xBIOS->write (TEST_PAGESIZE, pBuffer, sizeof (pBuffer));
if (eErrCode != store_E_None)
- {
- xBIOS->releaseLock (TEST_PAGESIZE, sizeof(pBuffer));
- return eErrCode;
- }
-
- eErrCode = xBIOS->releaseLock (TEST_PAGESIZE, sizeof(pBuffer));
- if (eErrCode != store_E_None)
return eErrCode;
xBIOS.clear();
diff --git a/udkapi/com/sun/star/reflection/XInterfaceAttributeTypeDescription2.idl b/udkapi/com/sun/star/reflection/XInterfaceAttributeTypeDescription2.idl
index bd37f64cf714..96b8957683ff 100644
--- a/udkapi/com/sun/star/reflection/XInterfaceAttributeTypeDescription2.idl
+++ b/udkapi/com/sun/star/reflection/XInterfaceAttributeTypeDescription2.idl
@@ -35,7 +35,8 @@ module com { module sun { module star { module reflection {
interface XCompoundTypeDescription;
/**
- Reflects a singleton, supporting interface-based singletons.
+ Reflects an interface attribute, supporting extended attributes that are
+ bound or raise exceptions.
<p>This type supersedes <type>XInterfaceAttributeTypeDescription</type>,
which does not support extended attributes.</p>
diff --git a/unoil/climaker/version.txt b/unoil/climaker/version.txt
index 360bb20069d4..f3c80f838ad3 100644
--- a/unoil/climaker/version.txt
+++ b/unoil/climaker/version.txt
@@ -25,8 +25,8 @@
#
#*************************************************************************
-CLI_OOOTYPES_NEW_VERSION=1.0.4.0
-CLI_OOOTYPES_OLD_VERSION=1.0.0.0-1.0.3.0
-CLI_OOOTYPES_POLICY_VERSION=4.0.0.0
+CLI_OOOTYPES_NEW_VERSION=1.0.6.0
+CLI_OOOTYPES_OLD_VERSION=1.0.0.0-1.0.5.0
+CLI_OOOTYPES_POLICY_VERSION=6.0.0.0
CLI_OOOTYPES_POLICY_ASSEMBLY=policy.1.0.cli_oootypes