summaryrefslogtreecommitdiff
path: root/basic/source/classes
diff options
context:
space:
mode:
authorAndreas Heinisch <andreas.heinisch@yahoo.de>2023-03-29 12:01:07 +0200
committerAndreas Heinisch <andreas.heinisch@yahoo.de>2023-07-24 13:55:28 +0200
commit17154ceafe4b96b43fdc9994736e378d6a11f3e4 (patch)
treedee212ca1cd459f1e10dc06b87edc1c44f3a8d35 /basic/source/classes
parent5a82470f27898c8b453e63d3ee22d0b57f7836c8 (diff)
tdf#92620 - Adjust error message about exceeding legacy module size
Adjusted the error message about exceeding legacy module size and removed the code for saving image version 11. Modules using image version 11 still can be loaded. Saving modules always result in an image version higher than image version 11 depending on the size of the module. In addition, some minor performance issues (construction of the error message and the correct list of modules) were fixed. Change-Id: I3bde9fcc1596b63446193c836fa7b5cb06eb7d97 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149687 Tested-by: Jenkins Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Diffstat (limited to 'basic/source/classes')
-rw-r--r--basic/source/classes/image.cxx40
-rw-r--r--basic/source/classes/sbxmod.cxx4
2 files changed, 11 insertions, 33 deletions
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 {