summaryrefslogtreecommitdiff
path: root/basic/source
diff options
context:
space:
mode:
Diffstat (limited to 'basic/source')
-rw-r--r--basic/source/basmgr/basmgr.cxx13
-rw-r--r--basic/source/classes/image.cxx40
-rw-r--r--basic/source/classes/sbxmod.cxx4
-rw-r--r--basic/source/inc/filefmt.hxx1
-rw-r--r--basic/source/inc/image.hxx1
-rw-r--r--basic/source/uno/scriptcont.cxx2
6 files changed, 18 insertions, 43 deletions
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 206b917b7edd..f7a4fb2ae192 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1390,7 +1390,7 @@ void BasicManager::SetGlobalUNOConstant( const OUString& rName, const uno::Any&
pStandardLib->Insert( xUnoObj.get() );
}
-bool BasicManager::LegacyPsswdBinaryLimitExceeded( std::vector< OUString >& _out_rModuleNames )
+bool BasicManager::ImgVersion12PsswdBinaryLimitExceeded( std::vector< OUString >& _out_rModuleNames )
{
try
{
@@ -1409,19 +1409,16 @@ bool BasicManager::LegacyPsswdBinaryLimitExceeded( std::vector< OUString >& _out
uno::Reference< container::XNameAccess > xScriptLibrary( xScripts->getByName( scriptElementName ), uno::UNO_QUERY_THROW );
const uno::Sequence< OUString > aElementNames( xScriptLibrary->getElementNames() );
- sal_Int32 nLen = aElementNames.getLength();
-
- std::vector< OUString > aBigModules( nLen );
- sal_Int32 nBigModules = 0;
+ std::vector<OUString> aBigModules;
for ( auto const & libraryElementName : aElementNames )
{
SbModule* pMod = pBasicLib->FindModule( libraryElementName );
- if ( pMod && pMod->ExceedsLegacyModuleSize() )
- aBigModules[ nBigModules++ ] = libraryElementName;
+ if ( pMod && pMod->ExceedsImgVersion12ModuleSize() )
+ aBigModules.push_back(libraryElementName);
}
- if ( nBigModules )
+ if (!aBigModules.empty())
{
_out_rModuleNames.swap(aBigModules);
return true;
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index eab5fe9e0905..ee490947029e 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -373,31 +373,13 @@ done:
bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
{
- bool bLegacy = ( nVer < B_IMG_VERSION_12 );
-
- // detect if old code exceeds legacy limits
- // if so, then disallow save
- if ( bLegacy && ExceedsLegacyLimits() )
- {
- SbiImage aEmptyImg;
- aEmptyImg.aName = aName;
- aEmptyImg.Save( r, B_IMG_VERSION_11 );
- return true;
- }
// First of all the header
sal_uInt64 nStart = SbiOpenRecord( r, FileOffset::Module, 1 );
sal_uInt64 nPos;
eCharSet = GetSOStoreTextEncoding( eCharSet );
- if ( bLegacy )
- {
- r.WriteInt32( B_IMG_VERSION_11 );
- }
- else
- {
- r.WriteInt32( nVer );
- }
- r .WriteInt32( eCharSet )
+ r .WriteInt32( nVer )
+ .WriteInt32( eCharSet )
.WriteInt32( nDimBase )
.WriteInt16( static_cast<sal_uInt16>(nFlags) )
.WriteInt16( 0 )
@@ -429,17 +411,7 @@ bool SbiImage::Save( SvStream& r, sal_uInt32 nVer )
if (aCode.size() && r.good())
{
nPos = SbiOpenRecord( r, FileOffset::PCode, 1 );
- if ( bLegacy )
- {
- PCodeBuffConvertor<sal_uInt32, sal_uInt16> aNewToLegacy(aCode.data(), aCode.size());
- aNewToLegacy.convert();
- aLegacyPCode = aNewToLegacy.GetBuffer();
- r.WriteBytes(aLegacyPCode.data(), aLegacyPCode.size());
- }
- else
- {
- r.WriteBytes(aCode.data(), aCode.size());
- }
+ r.WriteBytes(aCode.data(), aCode.size());
SbiCloseRecord( r, nPos );
}
// String-Pool?
@@ -715,4 +687,10 @@ bool SbiImage::ExceedsLegacyLimits()
return (nStringSize > 0xFF00) || (CalcLegacyOffset(aCode.size()) > 0xFF00);
}
+bool SbiImage::ExceedsImgVersion12Limits()
+{
+ const sal_Int16 nMax = std::numeric_limits<sal_Int16>::max();
+ return nStringSize >= nMax || CalcLegacyOffset(aCode.size()) >= nMax;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 5b7ee24e1f9c..15e4719569ba 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1667,11 +1667,11 @@ std::pair<bool, sal_uInt32> SbModule::StoreData( SvStream& rStrm ) const
}
}
-bool SbModule::ExceedsLegacyModuleSize()
+bool SbModule::ExceedsImgVersion12ModuleSize()
{
if ( !IsCompiled() )
Compile();
- return pImage && pImage->ExceedsLegacyLimits();
+ return pImage && pImage->ExceedsImgVersion12Limits();
}
namespace {
diff --git a/basic/source/inc/filefmt.hxx b/basic/source/inc/filefmt.hxx
index b04b7abc6a9b..38dfa95754f3 100644
--- a/basic/source/inc/filefmt.hxx
+++ b/basic/source/inc/filefmt.hxx
@@ -45,7 +45,6 @@
// new integer type suffix 'b')
//
-#define B_IMG_VERSION_11 0x00000011
#define B_IMG_VERSION_12 0x00000012
#define B_IMG_VERSION_13 0x00000013
diff --git a/basic/source/inc/image.hxx b/basic/source/inc/image.hxx
index 2e442398a214..5a4522bd91bf 100644
--- a/basic/source/inc/image.hxx
+++ b/basic/source/inc/image.hxx
@@ -96,6 +96,7 @@ public:
sal_uInt32 CalcNewOffset( sal_Int16 nOffset );
void ReleaseLegacyBuffer();
bool ExceedsLegacyLimits();
+ bool ExceedsImgVersion12Limits();
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index 7c059ff66d7b..f534856dc11b 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -572,7 +572,7 @@ bool SfxScriptLibraryContainer::implStorePasswordLibrary( SfxLibrary* pLib, cons
// save/saveas etc are handled in sfxbasemodel::storeSelf &
// sfxbasemodel::impl_store
std::vector<OUString> aNames;
- if ( bExport && pBasicMgr->LegacyPsswdBinaryLimitExceeded(aNames) )
+ if ( bExport && pBasicMgr->ImgVersion12PsswdBinaryLimitExceeded(aNames) )
{
if ( xHandler.is() )
{