diff options
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/runtime/iosys.cxx | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index 5b57527cb8ce..fe08f663f3cb 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -51,6 +51,7 @@ #include <rtl/ustrbuf.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -659,14 +660,8 @@ SbError SbiStream::Read( ByteString& rBuf, sal_uInt16 n, bool bForceReadingPerBy return nError = SbERR_BAD_RECORD_LENGTH; rtl::OStringBuffer aBuffer(read_uInt8s_AsOString(*pStrm, n)); //Pad it out with ' ' to the requested length on short read - sal_Int32 nRead = aBuffer.getLength(); sal_Int32 nRequested = sal::static_int_cast<sal_Int32>(n); - if (nRead < nRequested) - { - aBuffer.setLength(nRequested); - for (sal_Int32 i = nRead; i < nRequested; ++i) - aBuffer.setCharAt(i, ' '); - } + comphelper::string::padToLength(aBuffer, nRequested, ' '); rBuf = aBuffer.makeStringAndClear(); } MapError(); |