[Libreoffice-commits] core.git: 3 commits - connectivity/source package/source
Stephan Bergmann
sbergman at redhat.com
Tue Feb 23 16:05:44 UTC 2016
connectivity/source/drivers/hsqldb/HStorageMap.cxx | 62 ++++++++++-----
connectivity/source/drivers/hsqldb/StorageFileAccess.cxx | 23 +++--
connectivity/source/inc/hsqldb/HStorageMap.hxx | 15 ++-
package/source/xstor/xstorage.cxx | 29 +++----
package/source/xstor/xstorage.hxx | 1
5 files changed, 80 insertions(+), 50 deletions(-)
New commits:
commit 03a271901c39d60e4519e67e258d565ad5e1e085
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Feb 23 16:39:48 2016 +0100
Guard against globally shared UNO ref accessed from wrong UNO env
connectivity/source/drivers/jdbc/jdbc.component has
environment="@CPPU_ENV@:affine"
to place the com.sun.star.comp.sdbc.JDBCDriver implementation into an affine UNOenvironment.
The com.sun.star.sdbcx.comp.hsqldb.Driver implementation (in the normal C++ UNO
environment), in ODriverDelegator::connect
(connectivity/source/drivers/hsqldb/HDriver.cxx), calls
StorageContainer::registerStorage to store an XStorage in a global map, then
calls the JDBCDriver (i.e., thread enters the affine environment), which calls
via (non-UNO) JNI into hsqldb.jar code, which in turn calls via (non-UNO) JNI
into Java_com_sun_star_sdbcx_comp_hsqldb_StorageFileAccess_isStreamElement
(connectivity/source/drivers/hsqldb/StorageFileAccess.cxx), which uses
StorageContainer::getRegisteredStorage to obtain the XStorage and use it.
But that XStorage is the original C++ object, not a proxy that witnesses the
mapping between the normal C++ and the affine UNO environment. (And the thread
is still in the affine environment, after having passed through the Java stack
frames via non-UNO JNI.)
That does not necessarily cause any problems immediately (so apparently went
unnoticed for quite a while), but when the XStorage-implementation in turn wants
to obtain the SimpleLogRing singleton, it would now trigger the
std::abort();//TODO
in cppuhelper/source/servicemanager.cxx (where the invocation-by-constructor
case hasn't yet been implemented for differing environments), when that
singleton is changed to use the constructor feature in
<https://gerrit.libreoffice.org/#/c/22020/> "tdf#74608: Constructor function for
SimpleLogRing singleton."
So just do any necessary mapping every time an XStorage stored in the static
StorageContainer is accessed.
Change-Id: I91a62fd7e1cec29026f70a2c3acdfe051885c0fa
diff --git a/connectivity/source/drivers/hsqldb/HStorageMap.cxx b/connectivity/source/drivers/hsqldb/HStorageMap.cxx
index afd97ed..334ff2b 100644
--- a/connectivity/source/drivers/hsqldb/HStorageMap.cxx
+++ b/connectivity/source/drivers/hsqldb/HStorageMap.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <osl/diagnose.h>
#include <osl/thread.h>
+#include <uno/mapping.hxx>
#include <algorithm>
namespace connectivity
@@ -99,6 +100,28 @@ namespace connectivity
return m_xSeek;
}
+ css::uno::Reference<css::embed::XStorage> StorageData::mapStorage()
+ const
+ {
+ css::uno::Environment env(css::uno::Environment::getCurrent());
+ if (!(env.is() && storageEnvironment.is())) {
+ throw css::uno::RuntimeException("cannot get environments");
+ }
+ if (env.get() == storageEnvironment.get()) {
+ return storage;
+ } else {
+ css::uno::Mapping map(storageEnvironment, env);
+ if (!map.is()) {
+ throw css::uno::RuntimeException("cannot get mapping");
+ }
+ css::uno::Reference<css::embed::XStorage> mapped;
+ map.mapInterface(
+ reinterpret_cast<void **>(&mapped), storage.get(),
+ cppu::UnoType<css::embed::XStorage>::get());
+ return mapped;
+ }
+ }
+
TStorages& lcl_getStorageMap()
{
static TStorages s_aMap;
@@ -170,12 +193,12 @@ namespace connectivity
// check if the storage is already in our map
TStorages::iterator aFind = ::std::find_if(rMap.begin(),rMap.end(),
[&_xStorage] (const TStorages::value_type& storage) {
- return storage.second.storage == _xStorage;
+ return storage.second.mapStorage() == _xStorage;
});
if ( aFind == rMap.end() )
{
- aFind = rMap.insert(TStorages::value_type(lcl_getNextCount(), {_xStorage, _sURL, TStreamMap()})).first;
+ aFind = rMap.insert(TStorages::value_type(lcl_getNextCount(), {_xStorage, css::uno::Environment::getCurrent(), _sURL, TStreamMap()})).first;
}
return aFind->first;
@@ -201,7 +224,7 @@ namespace connectivity
// check if the storage is already in our map
TStorages::iterator aFind = ::std::find_if(rMap.begin(),rMap.end(),
[&_xStorage] (const TStorages::value_type& storage) {
- return storage.second.storage == _xStorage;
+ return storage.second.mapStorage() == _xStorage;
});
if ( aFind != rMap.end() )
@@ -219,10 +242,10 @@ namespace connectivity
{
if ( _xListener.is() )
{
- Reference<XTransactionBroadcaster> xBroad(aFind->second.storage,UNO_QUERY);
+ Reference<XTransactionBroadcaster> xBroad(aFind->second.mapStorage(),UNO_QUERY);
if ( xBroad.is() )
xBroad->removeTransactionListener(_xListener);
- Reference<XTransactedObject> xTrans(aFind->second.storage,UNO_QUERY);
+ Reference<XTransactedObject> xTrans(aFind->second.mapStorage(),UNO_QUERY);
if ( xTrans.is() )
xTrans->commit();
}
@@ -244,8 +267,9 @@ namespace connectivity
if ( aFind != rMap.end() )
{
TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(sKey);
- OSL_ENSURE(aStoragePair.storage.is(),"No Storage available!");
- if ( aStoragePair.storage.is() )
+ auto storage = aStoragePair.mapStorage();
+ OSL_ENSURE(storage.is(),"No Storage available!");
+ if ( storage.is() )
{
OUString sOrgName = StorageContainer::jstring2ustring(env,name);
OUString sName = removeURLPrefix(sOrgName,aStoragePair.url);
@@ -261,7 +285,7 @@ namespace connectivity
{
try
{
- pHelper.reset(new StreamHelper(aStoragePair.storage->openStreamElement(sName,_nMode)));
+ pHelper.reset(new StreamHelper(storage->openStreamElement(sName,_nMode)));
}
catch(const Exception&)
{
@@ -272,7 +296,7 @@ namespace connectivity
bool bIsStream = true;
try
{
- bIsStream = aStoragePair.storage->isStreamElement(sStrippedName);
+ bIsStream = storage->isStreamElement(sStrippedName);
}
catch(const Exception&)
{
@@ -281,7 +305,7 @@ namespace connectivity
if ( !bIsStream )
return pHelper; // readonly file without data stream
}
- pHelper.reset( new StreamHelper(aStoragePair.storage->openStreamElement( sStrippedName, _nMode ) ) );
+ pHelper.reset( new StreamHelper(storage->openStreamElement( sStrippedName, _nMode ) ) );
}
aFind->second.streams.insert(TStreamMap::value_type(sName,pHelper));
}
diff --git a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx b/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
index 8937898..69b676e 100644
--- a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
+++ b/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
@@ -43,7 +43,8 @@ extern "C" SAL_JNI_EXPORT jboolean JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_S
(JNIEnv * env, jobject /*obj_this*/,jstring key, jstring name)
{
TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(env,key));
- if ( aStoragePair.storage.is() )
+ auto storage = aStoragePair.mapStorage();
+ if ( storage.is() )
{
try
{
@@ -51,11 +52,11 @@ extern "C" SAL_JNI_EXPORT jboolean JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_S
try
{
OUString sOldName = StorageContainer::removeOldURLPrefix(sName);
- if ( aStoragePair.storage->isStreamElement(sOldName) )
+ if ( storage->isStreamElement(sOldName) )
{
try
{
- aStoragePair.storage->renameElement(sOldName,StorageContainer::removeURLPrefix(sName,aStoragePair.url));
+ storage->renameElement(sOldName,StorageContainer::removeURLPrefix(sName,aStoragePair.url));
}
catch(const Exception&)
{
@@ -68,7 +69,7 @@ extern "C" SAL_JNI_EXPORT jboolean JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_S
catch(const IllegalArgumentException&)
{
}
- return aStoragePair.storage->isStreamElement(StorageContainer::removeURLPrefix(sName,aStoragePair.url));
+ return storage->isStreamElement(StorageContainer::removeURLPrefix(sName,aStoragePair.url));
}
catch(const NoSuchElementException&)
{
@@ -101,11 +102,12 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stora
}
#endif
TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(env,key));
- if ( aStoragePair.storage.is() )
+ auto storage = aStoragePair.mapStorage();
+ if ( storage.is() )
{
try
{
- aStoragePair.storage->removeElement(StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,name),aStoragePair.url));
+ storage->removeElement(StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,name),aStoragePair.url));
}
catch(const NoSuchElementException&)
{
@@ -137,11 +139,12 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stora
}
#endif
TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(env,key));
- if ( aStoragePair.storage.is() )
+ auto storage = aStoragePair.mapStorage();
+ if ( storage.is() )
{
try
{
- aStoragePair.storage->renameElement(
+ storage->renameElement(
StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,oldname),aStoragePair.url),
StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,newname),aStoragePair.url)
);
diff --git a/connectivity/source/inc/hsqldb/HStorageMap.hxx b/connectivity/source/inc/hsqldb/HStorageMap.hxx
index 1150be4..d3bba8e 100644
--- a/connectivity/source/inc/hsqldb/HStorageMap.hxx
+++ b/connectivity/source/inc/hsqldb/HStorageMap.hxx
@@ -31,6 +31,7 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <jni.h>
+#include <uno/environment.hxx>
namespace connectivity
{
@@ -54,11 +55,16 @@ namespace connectivity
typedef std::map< OUString, std::shared_ptr<StreamHelper> > TStreamMap;
+
struct StorageData {
css::uno::Reference<css::embed::XStorage> storage;
+ css::uno::Environment storageEnvironment;
OUString url;
TStreamMap streams;
+
+ css::uno::Reference<css::embed::XStorage> mapStorage() const;
};
+
typedef std::map<OUString, StorageData> TStorages;
/** contains all storages so far accessed.
*/
commit 9610a5aebd3ffdf76bcb734c633b5f88b78ad4dd
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Feb 23 15:50:40 2016 +0100
Use passed-in context instead of comphelper::getProcessComponentContext()
(and the passed-in context is required to always be non-null)
Change-Id: I1197a2bafba8cb645e15df4310c1c5767b648670
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index ccfa1bb..a268c0cc 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <sal/config.h>
+
+#include <cassert>
+
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/UseBackupException.hpp>
@@ -44,7 +48,6 @@
#include <cppuhelper/exc_hlp.hxx>
#include <rtl/instance.hxx>
-#include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/ofopxmlhelper.hxx>
@@ -207,6 +210,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XInputStream > xInputStream,
{
// all the checks done below by assertion statements must be done by factory
SAL_WARN_IF( !xInputStream.is(), "package.xstor", "No input stream is provided!" );
+ assert(xContext.is());
m_pSwitchStream = new SwitchablePersistenceStream(xContext, xInputStream);
m_xInputStream = m_pSwitchStream->getInputStream();
@@ -247,6 +251,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XStream > xStream,
{
// all the checks done below by assertion statements must be done by factory
SAL_WARN_IF( !xStream.is(), "package.xstor", "No stream is provided!" );
+ assert(xContext.is());
if ( m_nStorageMode & embed::ElementModes::WRITE )
{
@@ -289,6 +294,7 @@ OStorage_Impl::OStorage_Impl( OStorage_Impl* pParent,
, m_nRelInfoStatus( RELINFO_NO_INIT )
{
SAL_WARN_IF( !xPackageFolder.is(), "package.xstor", "No package folder!" );
+ assert(xContext.is());
}
OStorage_Impl::~OStorage_Impl()
@@ -388,8 +394,7 @@ void OStorage_Impl::AddLog( const OUString& aMessage )
{
try
{
- uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
- m_xLogRing = logging::DocumentIOLogRing::get(xContext);
+ m_xLogRing = logging::DocumentIOLogRing::get(m_xContext);
}
catch( const uno::Exception& )
{
@@ -495,8 +500,8 @@ void OStorage_Impl::OpenOwnPackage()
aArguments[nArgNum-1] <<= aNamedValue;
}
- m_xPackage.set( GetComponentContext()->getServiceManager()->createInstanceWithArgumentsAndContext(
- "com.sun.star.packages.comp.ZipPackage", aArguments, GetComponentContext()),
+ m_xPackage.set( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext(
+ "com.sun.star.packages.comp.ZipPackage", aArguments, m_xContext),
uno::UNO_QUERY );
}
@@ -515,14 +520,6 @@ void OStorage_Impl::OpenOwnPackage()
throw embed::InvalidStorageException( THROW_WHERE );
}
-uno::Reference< uno::XComponentContext > OStorage_Impl::GetComponentContext()
-{
- if ( m_xContext.is() )
- return m_xContext;
-
- return ::comphelper::getProcessComponentContext();
-}
-
SotElementList_Impl& OStorage_Impl::GetChildrenList()
{
::osl::MutexGuard aGuard( m_rMutexRef->GetMutex() );
@@ -1421,7 +1418,7 @@ void OStorage_Impl::InsertRawStream( const OUString& aName, const uno::Reference
uno::Reference< io::XSeekable > xSeek( xInStream, uno::UNO_QUERY );
uno::Reference< io::XInputStream > xInStrToInsert = xSeek.is() ? xInStream :
- GetSeekableTempCopy( xInStream, GetComponentContext() );
+ GetSeekableTempCopy( xInStream, m_xContext );
uno::Sequence< uno::Any > aSeq( 1 );
aSeq[0] <<= sal_False;
@@ -3650,7 +3647,7 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getPlainRawStreamElement(
if ( !xRawInStream.is() )
throw io::IOException( THROW_WHERE );
- uno::Reference < io::XTempFile > xTempFile = io::TempFile::create( m_pImpl->GetComponentContext() );
+ uno::Reference < io::XTempFile > xTempFile = io::TempFile::create( m_pImpl->m_xContext );
uno::Reference < io::XOutputStream > xTempOut = xTempFile->getOutputStream();
xTempIn = xTempFile->getInputStream();
uno::Reference < io::XSeekable > xSeek( xTempOut, uno::UNO_QUERY );
@@ -3758,7 +3755,7 @@ uno::Reference< io::XInputStream > SAL_CALL OStorage::getRawEncrStreamElement(
if ( !xRawInStream.is() )
throw io::IOException( THROW_WHERE );
- uno::Reference < io::XTempFile > xTempFile = io::TempFile::create(m_pImpl->GetComponentContext());
+ uno::Reference < io::XTempFile > xTempFile = io::TempFile::create(m_pImpl->m_xContext);
uno::Reference < io::XOutputStream > xTempOut = xTempFile->getOutputStream();
xTempIn = xTempFile->getInputStream();
uno::Reference < io::XSeekable > xSeek( xTempOut, uno::UNO_QUERY );
diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx
index c0e7e48..712afd3 100644
--- a/package/source/xstor/xstorage.hxx
+++ b/package/source/xstor/xstorage.hxx
@@ -208,7 +208,6 @@ struct OStorage_Impl
void ReadContents();
void ReadRelInfoIfNecessary();
- css::uno::Reference< css::uno::XComponentContext > GetComponentContext();
SotElementList_Impl& GetChildrenList();
void GetStorageProperties();
commit c322882fb6f850c771de14f047d6bb820359db2c
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Tue Feb 23 15:07:09 2016 +0100
Replace nested pairs with struct
Change-Id: I95513accce789110fa987b9bf9ca94762fbeb646
diff --git a/connectivity/source/drivers/hsqldb/HStorageMap.cxx b/connectivity/source/drivers/hsqldb/HStorageMap.cxx
index cf6ad3f..afd97ed 100644
--- a/connectivity/source/drivers/hsqldb/HStorageMap.cxx
+++ b/connectivity/source/drivers/hsqldb/HStorageMap.cxx
@@ -170,13 +170,12 @@ namespace connectivity
// check if the storage is already in our map
TStorages::iterator aFind = ::std::find_if(rMap.begin(),rMap.end(),
[&_xStorage] (const TStorages::value_type& storage) {
- // TStoragePair (second) -> TStorageURLPair (first) -> uno::Reference<XStorage> (first)
- return storage.second.first.first == _xStorage;
+ return storage.second.storage == _xStorage;
});
if ( aFind == rMap.end() )
{
- aFind = rMap.insert(TStorages::value_type(lcl_getNextCount(),TStorages::mapped_type(TStorageURLPair(_xStorage,_sURL),TStreamMap()))).first;
+ aFind = rMap.insert(TStorages::value_type(lcl_getNextCount(), {_xStorage, _sURL, TStreamMap()})).first;
}
return aFind->first;
@@ -202,8 +201,7 @@ namespace connectivity
// check if the storage is already in our map
TStorages::iterator aFind = ::std::find_if(rMap.begin(),rMap.end(),
[&_xStorage] (const TStorages::value_type& storage) {
- // TStoragePair (second) -> TStorageURLPair (first) -> uno::Reference<XStorage> (first)
- return storage.second.first.first == _xStorage;
+ return storage.second.storage == _xStorage;
});
if ( aFind != rMap.end() )
@@ -221,10 +219,10 @@ namespace connectivity
{
if ( _xListener.is() )
{
- Reference<XTransactionBroadcaster> xBroad(aFind->second.first.first,UNO_QUERY);
+ Reference<XTransactionBroadcaster> xBroad(aFind->second.storage,UNO_QUERY);
if ( xBroad.is() )
xBroad->removeTransactionListener(_xListener);
- Reference<XTransactedObject> xTrans(aFind->second.first.first,UNO_QUERY);
+ Reference<XTransactedObject> xTrans(aFind->second.storage,UNO_QUERY);
if ( xTrans.is() )
xTrans->commit();
}
@@ -246,14 +244,14 @@ namespace connectivity
if ( aFind != rMap.end() )
{
TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(sKey);
- OSL_ENSURE(aStoragePair.first.first.is(),"No Storage available!");
- if ( aStoragePair.first.first.is() )
+ OSL_ENSURE(aStoragePair.storage.is(),"No Storage available!");
+ if ( aStoragePair.storage.is() )
{
OUString sOrgName = StorageContainer::jstring2ustring(env,name);
- OUString sName = removeURLPrefix(sOrgName,aStoragePair.first.second);
- TStreamMap::iterator aStreamFind = aFind->second.second.find(sName);
- OSL_ENSURE( aStreamFind == aFind->second.second.end(),"A Stream was already registered for this object!");
- if ( aStreamFind != aFind->second.second.end() )
+ OUString sName = removeURLPrefix(sOrgName,aStoragePair.url);
+ TStreamMap::iterator aStreamFind = aFind->second.streams.find(sName);
+ OSL_ENSURE( aStreamFind == aFind->second.streams.end(),"A Stream was already registered for this object!");
+ if ( aStreamFind != aFind->second.streams.end() )
{
pHelper = aStreamFind->second;
}
@@ -263,7 +261,7 @@ namespace connectivity
{
try
{
- pHelper.reset(new StreamHelper(aStoragePair.first.first->openStreamElement(sName,_nMode)));
+ pHelper.reset(new StreamHelper(aStoragePair.storage->openStreamElement(sName,_nMode)));
}
catch(const Exception&)
{
@@ -274,7 +272,7 @@ namespace connectivity
bool bIsStream = true;
try
{
- bIsStream = aStoragePair.first.first->isStreamElement(sStrippedName);
+ bIsStream = aStoragePair.storage->isStreamElement(sStrippedName);
}
catch(const Exception&)
{
@@ -283,9 +281,9 @@ namespace connectivity
if ( !bIsStream )
return pHelper; // readonly file without data stream
}
- pHelper.reset( new StreamHelper(aStoragePair.first.first->openStreamElement( sStrippedName, _nMode ) ) );
+ pHelper.reset( new StreamHelper(aStoragePair.storage->openStreamElement( sStrippedName, _nMode ) ) );
}
- aFind->second.second.insert(TStreamMap::value_type(sName,pHelper));
+ aFind->second.streams.insert(TStreamMap::value_type(sName,pHelper));
}
catch(const Exception& e)
{
@@ -313,7 +311,7 @@ namespace connectivity
TStorages::iterator aFind = rMap.find(jstring2ustring(env,key));
OSL_ENSURE(aFind != rMap.end(),"Storage could not be found in list!");
if ( aFind != rMap.end() )
- aFind->second.second.erase(removeURLPrefix(jstring2ustring(env,name),aFind->second.first.second));
+ aFind->second.streams.erase(removeURLPrefix(jstring2ustring(env,name),aFind->second.url));
}
TStreamMap::mapped_type StorageContainer::getRegisteredStream( JNIEnv * env,jstring name, jstring key)
@@ -324,8 +322,8 @@ namespace connectivity
OSL_ENSURE(aFind != rMap.end(),"Storage could not be found in list!");
if ( aFind != rMap.end() )
{
- TStreamMap::iterator aStreamFind = aFind->second.second.find(removeURLPrefix(jstring2ustring(env,name),aFind->second.first.second));
- if ( aStreamFind != aFind->second.second.end() )
+ TStreamMap::iterator aStreamFind = aFind->second.streams.find(removeURLPrefix(jstring2ustring(env,name),aFind->second.url));
+ if ( aStreamFind != aFind->second.streams.end() )
pRet = aStreamFind->second;
}
diff --git a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx b/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
index 498b399..8937898 100644
--- a/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
+++ b/connectivity/source/drivers/hsqldb/StorageFileAccess.cxx
@@ -43,7 +43,7 @@ extern "C" SAL_JNI_EXPORT jboolean JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_S
(JNIEnv * env, jobject /*obj_this*/,jstring key, jstring name)
{
TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(env,key));
- if ( aStoragePair.first.first.is() )
+ if ( aStoragePair.storage.is() )
{
try
{
@@ -51,11 +51,11 @@ extern "C" SAL_JNI_EXPORT jboolean JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_S
try
{
OUString sOldName = StorageContainer::removeOldURLPrefix(sName);
- if ( aStoragePair.first.first->isStreamElement(sOldName) )
+ if ( aStoragePair.storage->isStreamElement(sOldName) )
{
try
{
- aStoragePair.first.first->renameElement(sOldName,StorageContainer::removeURLPrefix(sName,aStoragePair.first.second));
+ aStoragePair.storage->renameElement(sOldName,StorageContainer::removeURLPrefix(sName,aStoragePair.url));
}
catch(const Exception&)
{
@@ -68,7 +68,7 @@ extern "C" SAL_JNI_EXPORT jboolean JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_S
catch(const IllegalArgumentException&)
{
}
- return aStoragePair.first.first->isStreamElement(StorageContainer::removeURLPrefix(sName,aStoragePair.first.second));
+ return aStoragePair.storage->isStreamElement(StorageContainer::removeURLPrefix(sName,aStoragePair.url));
}
catch(const NoSuchElementException&)
{
@@ -101,11 +101,11 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stora
}
#endif
TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(env,key));
- if ( aStoragePair.first.first.is() )
+ if ( aStoragePair.storage.is() )
{
try
{
- aStoragePair.first.first->removeElement(StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,name),aStoragePair.first.second));
+ aStoragePair.storage->removeElement(StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,name),aStoragePair.url));
}
catch(const NoSuchElementException&)
{
@@ -137,13 +137,13 @@ extern "C" SAL_JNI_EXPORT void JNICALL Java_com_sun_star_sdbcx_comp_hsqldb_Stora
}
#endif
TStorages::mapped_type aStoragePair = StorageContainer::getRegisteredStorage(StorageContainer::jstring2ustring(env,key));
- if ( aStoragePair.first.first.is() )
+ if ( aStoragePair.storage.is() )
{
try
{
- aStoragePair.first.first->renameElement(
- StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,oldname),aStoragePair.first.second),
- StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,newname),aStoragePair.first.second)
+ aStoragePair.storage->renameElement(
+ StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,oldname),aStoragePair.url),
+ StorageContainer::removeURLPrefix(StorageContainer::jstring2ustring(env,newname),aStoragePair.url)
);
#ifdef HSQLDB_DBG
{
diff --git a/connectivity/source/inc/hsqldb/HStorageMap.hxx b/connectivity/source/inc/hsqldb/HStorageMap.hxx
index 01975b6..1150be4 100644
--- a/connectivity/source/inc/hsqldb/HStorageMap.hxx
+++ b/connectivity/source/inc/hsqldb/HStorageMap.hxx
@@ -54,9 +54,12 @@ namespace connectivity
typedef std::map< OUString, std::shared_ptr<StreamHelper> > TStreamMap;
- typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >, OUString > TStorageURLPair;
- typedef ::std::pair< TStorageURLPair, TStreamMap> TStoragePair;
- typedef std::map<OUString, TStoragePair> TStorages;
+ struct StorageData {
+ css::uno::Reference<css::embed::XStorage> storage;
+ OUString url;
+ TStreamMap streams;
+ };
+ typedef std::map<OUString, StorageData> TStorages;
/** contains all storages so far accessed.
*/
class StorageContainer
More information about the Libreoffice-commits
mailing list