From 0dd085f8f327b08cf5d69c3e1b93ff82016995fb Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 28 Oct 2012 20:31:11 +0000 Subject: UniString->rtl::OUStringBuffer Change-Id: I9938d7c4ab5594baeb10f405f0aa0964ef84d6c5 --- basic/source/runtime/step1.cxx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'basic/source/runtime') 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 +#include #include +#include #include #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( nOp1 ) ); - else - s.Expand( static_cast( 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) -- cgit