basic/source/basmgr/basmgr.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
New commits: commit add78db05fa3cca0c88bd61b87ae61e771dd86fd Author: kelvin <[email protected]> AuthorDate: Tue Nov 4 05:24:17 2025 +0100 Commit: Hossein <[email protected]> CommitDate: Sat Jan 24 00:03:04 2026 +0100 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 <[email protected]> Tested-by: Jenkins diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index f14da3658e01..532d7792676a 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -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 );
