summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-04-07 13:14:23 +0200
committersb <sb@openoffice.org>2010-04-07 13:14:23 +0200
commit66597e72124ff5e2cc91395262498fc84906b769 (patch)
treea75df91ba8131012ab0ce1d975bf7a5a31b2617c
parent9d09cf39be3e28e14f28e88a01cc4bdb83eb449d (diff)
parent9734c73c9a61fc5ef4e263617add17914a9b5f15 (diff)
sb118: merged in re/DEV300_next towards DEV300_m76
-rw-r--r--cli_ure/version/version.txt24
-rw-r--r--idlc/source/astdump.cxx4
-rw-r--r--idlc/source/idlcproduce.cxx22
-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/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
-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--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/osl/w32/file_dirvol.cxx8
-rw-r--r--sal/osl/w32/file_url.cxx28
-rw-r--r--sal/osl/w32/module.cxx8
-rw-r--r--sal/osl/w32/path_helper.hxx3
-rw-r--r--sal/osl/w32/process.cxx12
-rw-r--r--sal/osl/w32/profile.cxx105
-rw-r--r--sal/osl/w32/tempfile.cxx2
-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--unoil/climaker/version.txt6
74 files changed, 2394 insertions, 2709 deletions
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/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/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/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/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/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/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx
index 734824d63e57..09bdec7988c3 100644
--- a/sal/osl/w32/file_dirvol.cxx
+++ b/sal/osl/w32/file_dirvol.cxx
@@ -529,7 +529,7 @@ static oslFileError osl_openLocalRoot(
rtl_uString* pBackSlash = 0;
rtl_uString_assign( &pCurDir, pDirImpl->m_pDirectoryPath );
- rtl_uString_newFromStr( &pBackSlash, L"\\" );
+ rtl_uString_newFromAscii( &pBackSlash, "\\" );
rtl_uString_newConcat( &pDirImpl->m_pDirectoryPath, pCurDir, pBackSlash );
rtl_uString_release( pBackSlash );
rtl_uString_release( pCurDir );
@@ -594,7 +594,7 @@ static oslFileError SAL_CALL osl_openFileDirectory(
rtl_uString* pBackSlash = 0;
rtl_uString_assign( &pCurDir, pDirImpl->m_pDirectoryPath );
- rtl_uString_newFromStr( &pBackSlash, L"\\" );
+ rtl_uString_newFromAscii( &pBackSlash, "\\" );
rtl_uString_newConcat( &pDirImpl->m_pDirectoryPath, pCurDir, pBackSlash );
rtl_uString_release( pBackSlash );
rtl_uString_release( pCurDir );
@@ -964,7 +964,7 @@ static oslFileError SAL_CALL osl_getNextFileItem(
pItemImpl->nRefCount = 1;
rtl_uString* pTmpFileName = 0;
- rtl_uString_newFromStr( &pTmpFileName, pItemImpl->FindData.cFileName );
+ 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 );
@@ -1754,7 +1754,7 @@ oslFileError SAL_CALL osl_getFileStatus(
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 ) ),
- aBuffer,
+ ::osl::mingw_reinterpret_cast<LPTSTR>( aBuffer ),
aBuffer.getBufSizeInSymbols(),
sal_True );
diff --git a/sal/osl/w32/file_url.cxx b/sal/osl/w32/file_url.cxx
index 8e11be1d6a5c..90140cda97c6 100644
--- a/sal/osl/w32/file_url.cxx
+++ b/sal/osl/w32/file_url.cxx
@@ -252,13 +252,13 @@ DWORD IsValidFilePath(rtl_uString *path, LPCTSTR *lppError, DWORD dwFlags, rtl_u
DWORD dwCandidatPathType = PATHTYPE_ERROR;
- if ( 0 == rtl_ustr_shortenedCompareIgnoreAsciiCase_WithLength( path->buffer, nLength, WSTR_LONG_PATH_PREFIX_UNC, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX_UNC) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX_UNC) - 1 ) )
+ 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, WSTR_LONG_PATH_PREFIX, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1 ) )
+ 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 ) )
{
/* This is long path */
lpComponent = lpszPath + ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1;
@@ -465,7 +465,7 @@ static DWORD GetCaseCorrectPathNameEx(
DWORD nSkipLevels,
BOOL bCheckExistence )
{
- ::osl::LongPathBuffer< sal_Unicode > szFile( MAX_PATH + 1 );
+ ::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 )
@@ -505,7 +505,7 @@ static DWORD GetCaseCorrectPathNameEx(
{
if ( bCheckExistence )
{
- ::osl::LongPathBuffer< sal_Unicode > aShortPath( MAX_LONG_PATH );
+ ::osl::LongPathBuffer< WCHAR > aShortPath( MAX_LONG_PATH );
_tcscpy( aShortPath, lpszPath );
_tcscat( aShortPath, szFile );
@@ -777,14 +777,14 @@ oslFileError _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uString **p
else
{
::osl::LongPathBuffer< sal_Unicode > aBuf( MAX_LONG_PATH );
- sal_uInt32 nNewLen = GetCaseCorrectPathName( pDecodedURL + nSkip,
- aBuf,
+ 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, 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, WSTR_LONG_PATH_PREFIX, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1, ELEMENTS_OF_ARRAY(WSTR_LONG_PATH_PREFIX) - 1 ) )
+ || 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 );
}
@@ -793,7 +793,7 @@ oslFileError _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uString **p
/* it should be an UNC path, use the according prefix */
rtl_uString *strSuffix = NULL;
rtl_uString *strPrefix = NULL;
- rtl_uString_newFromStr_WithLength( &strPrefix, WSTR_LONG_PATH_PREFIX_UNC, ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX_UNC ) - 1 );
+ 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 );
@@ -805,7 +805,7 @@ oslFileError _osl_getSystemPathFromFileURL( rtl_uString *strURL, rtl_uString **p
{
rtl_uString *strSuffix = NULL;
rtl_uString *strPrefix = NULL;
- rtl_uString_newFromStr_WithLength( &strPrefix, WSTR_LONG_PATH_PREFIX, ELEMENTS_OF_ARRAY( WSTR_LONG_PATH_PREFIX ) - 1 );
+ 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 );
@@ -1093,15 +1093,15 @@ oslFileError SAL_CALL osl_getAbsoluteFileURL( rtl_uString* ustrBaseURL, rtl_uStr
{
osl_acquireMutex( g_CurrentDirectoryMutex );
- GetCurrentDirectoryW( aCurrentDir.getBufSizeInSymbols(), aCurrentDir );
- SetCurrentDirectoryW( reinterpret_cast<LPCTSTR>(ustrBaseSysPath->buffer) );
+ GetCurrentDirectoryW( aCurrentDir.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aCurrentDir) );
+ SetCurrentDirectoryW( reinterpret_cast<LPCWSTR>(ustrBaseSysPath->buffer) );
}
- dwResult = GetFullPathNameW( reinterpret_cast<LPCTSTR>(ustrRelSysPath->buffer), aBuffer.getBufSizeInSymbols(), aBuffer, &lpFilePart );
+ dwResult = GetFullPathNameW( reinterpret_cast<LPCWSTR>(ustrRelSysPath->buffer), aBuffer.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), &lpFilePart );
if ( ustrBaseSysPath )
{
- SetCurrentDirectoryW( aCurrentDir );
+ SetCurrentDirectoryW( ::osl::mingw_reinterpret_cast<LPCWSTR>(aCurrentDir) );
osl_releaseMutex( g_CurrentDirectoryMutex );
}
diff --git a/sal/osl/w32/module.cxx b/sal/osl/w32/module.cxx
index 98ffd0bc09d4..b730bd3347df 100644
--- a/sal/osl/w32/module.cxx
+++ b/sal/osl/w32/module.cxx
@@ -64,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)
@@ -88,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;
@@ -429,7 +429,7 @@ static sal_Bool SAL_CALL _osl_addressGetModuleURL_NT( void *pv, rtl_uString **pu
::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
rtl_uString *ustrSysPath = NULL;
- GetModuleFileNameW( lpModules[iModule], aBuffer, aBuffer.getBufSizeInSymbols() );
+ GetModuleFileNameW( lpModules[iModule], ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), aBuffer.getBufSizeInSymbols() );
rtl_uString_newFromStr( &ustrSysPath, aBuffer );
osl_getFileURLFromSystemPath( ustrSysPath, pustrURL );
diff --git a/sal/osl/w32/path_helper.hxx b/sal/osl/w32/path_helper.hxx
index 64b0ac573da3..d157b42aa428 100644
--- a/sal/osl/w32/path_helper.hxx
+++ b/sal/osl/w32/path_helper.hxx
@@ -108,8 +108,11 @@ public:
{
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.cxx b/sal/osl/w32/process.cxx
index 26c1f01f671f..96187be7e203 100644
--- a/sal/osl/w32/process.cxx
+++ b/sal/osl/w32/process.cxx
@@ -227,7 +227,7 @@ extern "C" oslProcessError SAL_CALL osl_bootstrap_getExecutableFile_Impl (
::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
DWORD buflen = 0;
- if ((buflen = GetModuleFileNameW (0, aBuffer, aBuffer.getBufSizeInSymbols())) > 0)
+ if ((buflen = GetModuleFileNameW (0, ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer), aBuffer.getBufSizeInSymbols())) > 0)
{
rtl_uString * pAbsPath = 0;
rtl_uString_newFromStr_WithLength (&(pAbsPath), aBuffer, buflen);
@@ -279,7 +279,7 @@ 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)
{
@@ -288,7 +288,7 @@ static rtl_uString ** osl_createCommandArgs_Impl (int argc, char ** argv)
DWORD dwResult = 0;
dwResult = SearchPath (
- 0, ppArgs[0]->buffer, L".exe", aBuffer.getBufSizeInSymbols(), aBuffer, 0);
+ 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 */
@@ -405,9 +405,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;
@@ -426,7 +426,7 @@ oslProcessError SAL_CALL osl_getProcessWorkingDir( rtl_uString **pustrWorkingDir
osl_acquireMutex( g_CurrentDirectoryMutex );
- dwLen = GetCurrentDirectory( aBuffer.getBufSizeInSymbols(), aBuffer );
+ dwLen = GetCurrentDirectory( aBuffer.getBufSizeInSymbols(), ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer) );
osl_releaseMutex( g_CurrentDirectoryMutex );
if ( dwLen && dwLen < aBuffer.getBufSizeInSymbols() )
diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx
index f30ac7ce3348..9f4ea5630e1f 100644
--- a/sal/osl/w32/profile.cxx
+++ b/sal/osl/w32/profile.cxx
@@ -36,6 +36,9 @@
#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
@@ -503,7 +506,7 @@ sal_Bool SAL_CALL osl_readProfileString(oslProfile Profile,
{
::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
GetPrivateProfileString(pszSection, pszEntry, pszDefault, pszString, MaxLen, aFileName);
}
@@ -684,7 +687,7 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile,
{
::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
WritePrivateProfileString(pszSection, pszEntry, pszString, aFileName);
}
@@ -795,7 +798,7 @@ sal_Bool SAL_CALL osl_removeProfileEntry(oslProfile Profile,
{
::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
WritePrivateProfileString(pszSection, pszEntry, NULL, aFileName);
}
@@ -869,7 +872,7 @@ sal_uInt32 SAL_CALL osl_getProfileSectionEntries(oslProfile Profile, const sal_C
{
::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
+ 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);
}
@@ -900,7 +903,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
if( ::sal::static_int_cast< sal_uInt32 >( strName->length ) >= aFile.getBufSizeInSymbols() )
return sal_False;
- wcscpy( aFile, strName->buffer);
+ copy_ustr_n( aFile, strName->buffer, strName->length+1);
nFileLen = strName->length;
if (rtl_ustr_indexOfChar( aFile, L'.' ) == -1)
@@ -909,7 +912,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
return sal_False;
/* add default extension */
- wcscpy( aFile + nFileLen, STR_INI_EXTENSION);
+ copy_ustr_n( aFile + nFileLen, STR_INI_EXTENSION, wcslen(STR_INI_EXTENSION)+1 );
nFileLen += wcslen(STR_INI_EXTENSION);
}
}
@@ -939,13 +942,13 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
if ((nFileLen = nLen - nOffset) >= aFile.getBufSizeInSymbols())
return sal_False;
- wcsncpy(aFile, pProgName + nOffset, nFileLen);
+ copy_ustr_n(aFile, pProgName + nOffset, nFileLen);
if (nFileLen + wcslen(STR_INI_EXTENSION) >= aFile.getBufSizeInSymbols())
return sal_False;
/* add default extension */
- wcscpy(aFile + 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 );
@@ -974,7 +977,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
if ( ::sal::static_int_cast< sal_uInt32 >( strHome->length ) >= aPath.getBufSizeInSymbols())
return sal_False;
- wcscpy( aPath, strHome->buffer);
+ copy_ustr_n( aPath, strHome->buffer, strHome->length+1);
nPathLen = strHome->length;
if (nLen > RTL_CONSTASCII_LENGTH(STR_INI_METAHOME))
@@ -985,7 +988,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
if (nLen + nPathLen >= aPath.getBufSizeInSymbols())
return sal_False;
- wcscpy(aPath + nPathLen, pPath);
+ copy_ustr_n(aPath + nPathLen, pPath, nLen+1);
nPathLen += nLen;
}
@@ -1006,7 +1009,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
if ( ::sal::static_int_cast< sal_uInt32 >( strConfig->length ) >= aPath.getBufSizeInSymbols())
return sal_False;
- wcscpy( aPath, strConfig->buffer);
+ copy_ustr_n( aPath, strConfig->buffer, strConfig->length+1 );
nPathLen = strConfig->length;
if (nLen > RTL_CONSTASCII_LENGTH(STR_INI_METACFG))
@@ -1017,7 +1020,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
if (nLen + nPathLen >= aPath.getBufSizeInSymbols())
return sal_False;
- wcscpy(aPath + nPathLen, pPath);
+ copy_ustr_n(aPath + nPathLen, pPath, nLen+1);
nPathLen += nLen;
}
@@ -1027,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(aPath, aPath.getBufSizeInSymbols())) == 0) || (nPathLen >= aPath.getBufSizeInSymbols()))
+ 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))
@@ -1038,7 +1041,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
if (nLen + nPathLen >= aPath.getBufSizeInSymbols())
return sal_False;
- wcscpy(aPath + nPathLen, pPath);
+ copy_ustr_n(aPath + nPathLen, pPath, nLen+1);
nPathLen += nLen;
}
}
@@ -1050,13 +1053,13 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
if (! lookupProfile(pPath + RTL_CONSTASCII_LENGTH(STR_INI_METAINS), aFile, aPath))
return (sal_False);
- nPathLen = wcslen(aPath);
+ nPathLen = rtl_ustr_getLength(aPath);
}
else if( ::sal::static_int_cast< sal_uInt32 >( nLen ) < aPath.getBufSizeInSymbols())
{
- wcscpy(aPath, pPath);
- nPathLen = wcslen(aPath);
+ copy_ustr_n(aPath, pPath, nLen+1);
+ nPathLen = rtl_ustr_getLength(aPath);
}
else
return sal_False;
@@ -1073,7 +1076,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
if ( ::sal::static_int_cast< sal_uInt32 >( strConfigDir->length ) >= aPath.getBufSizeInSymbols() )
return sal_False;
- wcscpy(aPath, strConfigDir->buffer);
+ copy_ustr_n(aPath, strConfigDir->buffer, strConfigDir->length+1);
nPathLen = strConfigDir->length;
}
@@ -1087,7 +1090,7 @@ sal_Bool SAL_CALL osl_getProfileName(rtl_uString* strPath, rtl_uString* strName,
return sal_False;
/* append file name */
- wcscpy(aPath + nPathLen, aFile);
+ copy_ustr_n(aPath + nPathLen, aFile, nFileLen+1);
nPathLen += nFileLen;
/* copy filename */
@@ -1141,7 +1144,7 @@ sal_uInt32 SAL_CALL osl_getProfileSections(oslProfile Profile, sal_Char* pszBuff
{
::osl::LongPathBuffer< sal_Char > aFileName( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, pProfile->m_strFileName->buffer, -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
+ WideCharToMultiByte(CP_ACP,0, reinterpret_cast<LPCWSTR>(pProfile->m_strFileName->buffer), -1, aFileName, aFileName.getBufSizeInSymbols(), NULL, NULL);
n = GetPrivateProfileSectionNames(pszBuffer, MaxLen, aFileName);
}
@@ -1276,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);
@@ -1289,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)
@@ -2133,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;
}
@@ -2316,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;
@@ -2443,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(aPath, pCommandArg + nStart + 1, dwPathLen );
+ copy_ustr_n(aPath, pCommandArg + nStart + 1, dwPathLen);
aPath[dwPathLen] = 0;
/* build full path */
if ((aPath[dwPathLen - 1] != L'/') && (aPath[dwPathLen - 1] != L'\\'))
{
- wcscpy(aPath + dwPathLen++, L"/");
+ copy_ustr_n(aPath + dwPathLen++, L"/", 2);
}
if (*strPath)
{
- wcscpy(aPath + dwPathLen, strPath);
- dwPathLen += wcslen(strPath);
+ copy_ustr_n(aPath + dwPathLen, strPath, rtl_ustr_getLength(strPath)+1);
+ dwPathLen += rtl_ustr_getLength(strPath);
}
else
{
::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH );
int n;
- if ((n = WideCharToMultiByte(CP_ACP,0, aPath, -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL)) > 0)
+ if ((n = WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL)) > 0)
{
strcpy(aTmpPath + n, SVERSION_USER);
if (access(aTmpPath, 0) >= 0)
{
- dwPathLen += MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, aPath + dwPathLen, aPath.getBufSizeInSymbols() - dwPathLen );
+ dwPathLen += MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, reinterpret_cast<LPWSTR>(aPath + dwPathLen), aPath.getBufSizeInSymbols() - dwPathLen );
}
}
}
@@ -2507,14 +2510,14 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
}
else
{
- wcsncpy(aPath, strExecutable->buffer, nPos );
+ copy_ustr_n(aPath, strExecutable->buffer, nPos);
aPath[nPos] = 0;
dwPathLen = nPos;
}
}
else
{
- wcsncpy(aPath, strExecutable->buffer, nPos );
+ copy_ustr_n(aPath, strExecutable->buffer, nPos);
dwPathLen = nPos;
aPath[dwPathLen] = 0;
}
@@ -2522,7 +2525,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
/* 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)
@@ -2534,18 +2537,18 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
/* remember last subdir */
nPos = rtl_ustr_lastIndexOfChar(aPath, L'\\');
- wcscpy(aPath + dwPathLen++, L"\\");
+ copy_ustr_n(aPath + dwPathLen++, L"\\", 2);
if (*strPath)
{
- wcscpy(aPath + dwPathLen, strPath);
- dwPathLen += wcslen(strPath);
+ copy_ustr_n(aPath + dwPathLen, strPath, rtl_ustr_getLength(strPath)+1);
+ dwPathLen += rtl_ustr_getLength(strPath);
}
{
::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, aPath, -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), 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" */
@@ -2569,13 +2572,13 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
}
else
{
- dwPathLen = nPos + MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, aPath + nPos + 1, aPath.getBufSizeInSymbols() - (nPos + 1) );
+ dwPathLen = nPos + MultiByteToWideChar( CP_ACP, 0, SVERSION_USER, -1, reinterpret_cast<LPWSTR>(aPath + nPos + 1), aPath.getBufSizeInSymbols() - (nPos + 1) );
}
}
else
{
- wcscpy(aPath + 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;
@@ -2589,12 +2592,12 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
aPath[dwPathLen] = 0;
}
- wcscpy(aPath + dwPathLen, strFile);
+ copy_ustr_n(aPath + dwPathLen, strFile, rtl_ustr_getLength(strFile)+1);
{
::osl::LongPathBuffer< sal_Char > aTmpPath( MAX_LONG_PATH );
- WideCharToMultiByte(CP_ACP,0, aPath, -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL);
+ WideCharToMultiByte(CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath, aTmpPath.getBufSizeInSymbols(), NULL, NULL);
if ((access(aTmpPath, 0) < 0) && (strlen(Product) > 0))
{
@@ -2645,20 +2648,20 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
if (strlen(Buffer) > 0)
{
dwPathLen = MultiByteToWideChar(
- CP_ACP, 0, Buffer, -1, aPath, aPath.getBufSizeInSymbols() );
+ CP_ACP, 0, Buffer, -1, ::osl::mingw_reinterpret_cast<LPWSTR>(aPath), aPath.getBufSizeInSymbols() );
dwPathLen -=1;
/* build full path */
if ((aPath[dwPathLen - 1] != L'/')
&& (aPath[dwPathLen - 1] != L'\\'))
{
- wcscpy(aPath + dwPathLen++, L"\\");
+ copy_ustr_n(aPath + dwPathLen++, L"\\", 2);
}
if (*strPath)
{
- wcscpy(aPath + dwPathLen, strPath);
- dwPathLen += wcslen(strPath);
+ copy_ustr_n(aPath + dwPathLen, strPath, rtl_ustr_getLength(strPath)+1);
+ dwPathLen += rtl_ustr_getLength(strPath);
}
else
{
@@ -2666,7 +2669,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
int n;
if ((n = WideCharToMultiByte(
- CP_ACP,0, aPath, -1, aTmpPath,
+ CP_ACP,0, ::osl::mingw_reinterpret_cast<LPCWSTR>(aPath), -1, aTmpPath,
aTmpPath.getBufSizeInSymbols(), NULL, NULL))
> 0)
{
@@ -2675,7 +2678,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
{
dwPathLen += MultiByteToWideChar(
CP_ACP, 0, SVERSION_USER, -1,
- aPath + dwPathLen,
+ reinterpret_cast<LPWSTR>(aPath + dwPathLen),
aPath.getBufSizeInSymbols() - dwPathLen );
}
}
@@ -2696,7 +2699,7 @@ static sal_Bool lookupProfile(const sal_Unicode *strPath, const sal_Unicode *str
}
/* copy filename */
- wcscpy(strProfile, aPath);
+ copy_ustr_n(strProfile, aPath, dwPathLen+1);
return sal_True;
}
diff --git a/sal/osl/w32/tempfile.cxx b/sal/osl/w32/tempfile.cxx
index 4bf136b6b0e0..6a3d2549004a 100644
--- a/sal/osl/w32/tempfile.cxx
+++ b/sal/osl/w32/tempfile.cxx
@@ -240,7 +240,7 @@ oslFileError SAL_CALL osl_createTempFile(
oslFileError SAL_CALL osl_getTempDirURL(rtl_uString** pustrTempDir)
{
::osl::LongPathBuffer< sal_Unicode > aBuffer( MAX_LONG_PATH );
- LPWSTR lpBuffer = aBuffer;
+ LPWSTR lpBuffer = ::osl::mingw_reinterpret_cast<LPWSTR>(aBuffer);
DWORD nBufferLength = aBuffer.getBufSizeInSymbols() - 1;
DWORD nLength;
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/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