diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-09-17 00:15:49 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-17 23:20:46 +0100 |
commit | 32b2e810ad2a6084d8a0e027aea414b65e2e8c4f (patch) | |
tree | f9fcc29ec5ed348e0af61a835a1772f0eb6473b7 /basic | |
parent | add a pad and truncate (diff) | |
download | core-32b2e810ad2a6084d8a0e027aea414b65e2e8c4f.tar.gz core-32b2e810ad2a6084d8a0e027aea414b65e2e8c4f.zip |
use read_uInt8s_AsOString and comphelper::string::padToLength
which allows us to simplify the read in DTable.cxx quite a bit
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(); |