summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-10-28 20:31:11 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-10-28 23:09:32 +0000
commit0dd085f8f327b08cf5d69c3e1b93ff82016995fb (patch)
tree0fec0966cd3a88b840621161de72ef5c462bb877 /basic
parent8865b7f013bcd9b4ce41dd98be28ba28aeb22e66 (diff)
UniString->rtl::OUStringBuffer
Change-Id: I9938d7c4ab5594baeb10f405f0aa0964ef84d6c5
Diffstat (limited to 'basic')
-rw-r--r--basic/source/runtime/step1.cxx16
1 files changed, 12 insertions, 4 deletions
diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx
index a9466faae69b..9ca79d019ac0 100644
--- a/basic/source/runtime/step1.cxx
+++ b/basic/source/runtime/step1.cxx
@@ -19,7 +19,9 @@
#include <stdlib.h>
+#include <comphelper/string.hxx>
#include <rtl/math.hxx>
+#include <rtl/ustrbuf.hxx>
#include <basic/sbuno.hxx>
#include "runtime.hxx"
#include "sbintern.hxx"
@@ -147,10 +149,16 @@ void SbiRuntime::StepPAD( sal_uInt32 nOp1 )
{
SbxVariable* p = GetTOS();
String& s = (String&)(const String&) *p;
- if( s.Len() > nOp1 )
- s.Erase( static_cast<xub_StrLen>( nOp1 ) );
- else
- s.Expand( static_cast<xub_StrLen>( nOp1 ), ' ' );
+ if (s.Len() != nOp1)
+ {
+ rtl::OUStringBuffer aBuf(s);
+ sal_Int32 nLen(nOp1);
+ if (aBuf.getLength() > nLen)
+ comphelper::string::truncateToLength(aBuf, nLen);
+ else
+ comphelper::string::padToLength(aBuf, nLen, ' ');
+ s = aBuf.makeStringAndClear();
+ }
}
// jump (+target)