tdf#145759 - basic: Replace buffer size magic number with constant

Replace magic number 1024 with DEFAULT_STREAM_BUFFER_SIZE in basmgr.cxx
to make the code more readable and maintainable. The constant clearly
indicates the purpose of this buffer size value.

Change-Id: Ic307c55e2eac563200951c373a0ca545db0a9e7b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193382
Reviewed-by: Hossein <hossein@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
kelvin
2026-01-24 00:03:04 +01:00
committed by Hossein
parent 05b30d84e0
commit add78db05f
+4 -3
View File
@@ -93,6 +93,7 @@ constexpr OUString szOldManagerStream = u"BasicManager"_ustr;
constexpr OUString szManagerStream = u"BasicManager2"_ustr;
constexpr OUString szImbedded = u"LIBIMBEDDED"_ustr;
constexpr OString szCryptingKey = "CryptedBasic"_ostr;
constexpr sal_Int32 DEFAULT_STREAM_BUFFER_SIZE = 1024;
const StreamMode eStreamReadMode = StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYALL;
@@ -651,7 +652,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, std::u16string_view r
}
}
xManagerStream->SetBufferSize( 1024 );
xManagerStream->SetBufferSize( DEFAULT_STREAM_BUFFER_SIZE );
xManagerStream->Seek( STREAM_SEEK_TO_BEGIN );
sal_uInt32 nEndPos;
@@ -729,7 +730,7 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
return;
}
xManagerStream->SetBufferSize( 1024 );
xManagerStream->SetBufferSize( DEFAULT_STREAM_BUFFER_SIZE );
xManagerStream->Seek( STREAM_SEEK_TO_BEGIN );
sal_uInt32 nBasicStartOff, nBasicEndOff;
xManagerStream->ReadUInt32( nBasicStartOff );
@@ -880,7 +881,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora
{
pLibInfo->SetLib( new StarBASIC( GetStdLib(), mbDocMgr ) );
}
xBasicStream->SetBufferSize( 1024 );
xBasicStream->SetBufferSize( DEFAULT_STREAM_BUFFER_SIZE );
xBasicStream->Seek( STREAM_SEEK_TO_BEGIN );
bLoaded = ImplLoadBasic( *xBasicStream, pLibInfo->GetLibRef() );
xBasicStream->SetBufferSize( 0 );