diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-10-30 00:00:51 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-10-30 00:05:59 +0000 |
commit | 4a11a47103fcbd7646234fc9565a409b8055507e (patch) | |
tree | 126503725e0272c5e2eba7556887576629035577 /basic/source/runtime | |
parent | ce26903f7037c44a723716dfb38766ab9611c224 (diff) |
trivial empty-init String::Fill -> comphelper::padToLength
Change-Id: I6c41b8f4d3ad739eff545063bd1f8fe8f4fba65e
Diffstat (limited to 'basic/source/runtime')
-rw-r--r-- | basic/source/runtime/methods.cxx | 24 | ||||
-rw-r--r-- | basic/source/runtime/step0.cxx | 28 | ||||
-rw-r--r-- | basic/source/runtime/step2.cxx | 8 |
3 files changed, 32 insertions, 28 deletions
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 054de265eb46..8c510e4eb1b0 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -1138,7 +1138,7 @@ RTLFUNC(LTrim) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - rtl::OUString aStr(comphelper::string::stripStart(rPar.Get(1)->GetString(), ' ')); + rtl::OUString aStr(string::stripStart(rPar.Get(1)->GetString(), ' ')); rPar.Get(0)->PutString(aStr); } } @@ -1387,7 +1387,7 @@ RTLFUNC(RTrim) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - rtl::OUString aStr(comphelper::string::stripEnd(rPar.Get(1)->GetString(), ' ')); + rtl::OUString aStr(string::stripEnd(rPar.Get(1)->GetString(), ' ')); rPar.Get(0)->PutString(aStr); } } @@ -1420,9 +1420,9 @@ RTLFUNC(Space) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - String aStr; - aStr.Fill( (sal_uInt16)(rPar.Get(1)->GetLong() )); - rPar.Get(0)->PutString( aStr ); + rtl::OUStringBuffer aBuf; + string::padToLength(aBuf, rPar.Get(1)->GetLong(), ' '); + rPar.Get(0)->PutString(aBuf.makeStringAndClear()); } } @@ -1435,9 +1435,9 @@ RTLFUNC(Spc) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - String aStr; - aStr.Fill( (sal_uInt16)(rPar.Get(1)->GetLong() )); - rPar.Get(0)->PutString( aStr ); + rtl::OUStringBuffer aBuf; + string::padToLength(aBuf, rPar.Get(1)->GetLong(), ' '); + rPar.Get(0)->PutString(aBuf.makeStringAndClear()); } } @@ -1578,7 +1578,6 @@ RTLFUNC(String) StarBASIC::Error( SbERR_BAD_ARGUMENT ); else { - String aStr; sal_Unicode aFiller; sal_Int32 lCount = rPar.Get(1)->GetLong(); if( lCount < 0 || lCount > 0xffff ) @@ -1591,8 +1590,9 @@ RTLFUNC(String) const String& rStr = rPar.Get(2)->GetString(); aFiller = rStr.GetBuffer()[0]; } - aStr.Fill( nCount, aFiller ); - rPar.Get(0)->PutString( aStr ); + rtl::OUStringBuffer aBuf; + string::padToLength(aBuf, nCount, aFiller); + rPar.Get(0)->PutString(aBuf.makeStringAndClear()); } } @@ -2372,7 +2372,7 @@ String implSetupWildcard( const String& rFileParam, SbiRTLData* pRTLData ) // Is there a pure file name left? Otherwise the path is // invalid anyway because it was not accepted by OSL before - if (comphelper::string::equals(aPureFileName, '*')) + if (string::equals(aPureFileName, '*')) { pRTLData->pWildCard = new WildCard( aPureFileName ); } diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx index 05a2759af4ef..0b361973f91d 100644 --- a/basic/source/runtime/step0.cxx +++ b/basic/source/runtime/step0.cxx @@ -721,19 +721,18 @@ void SbiRuntime::StepLSET() sal_uInt16 nVarStrLen = aRefVarString.Len(); sal_uInt16 nValStrLen = aRefValString.Len(); - String aNewStr; + rtl::OUStringBuffer aNewStr; if( nVarStrLen > nValStrLen ) { - aRefVarString.Fill(nVarStrLen,' '); - aNewStr = aRefValString.Copy( 0, nValStrLen ); - aNewStr += aRefVarString.Copy( nValStrLen, nVarStrLen - nValStrLen ); + aNewStr.append(aRefValString); + comphelper::string::padToLength(aNewStr, nVarStrLen, ' '); } else { - aNewStr = aRefValString.Copy( 0, nVarStrLen ); + aNewStr.append(aRefValString.Copy(0, nVarStrLen)); } - refVar->PutString( aNewStr ); + refVar->PutString(aNewStr.makeStringAndClear()); refVar->SetFlags( n ); } } @@ -753,16 +752,19 @@ void SbiRuntime::StepRSET() String aRefVarString = refVar->GetString(); String aRefValString = refVal->GetString(); - sal_uInt16 nPos = 0; sal_uInt16 nVarStrLen = aRefVarString.Len(); - if( nVarStrLen > aRefValString.Len() ) + sal_uInt16 nValStrLen = aRefValString.Len(); + rtl::OUStringBuffer aNewStr; + if (nVarStrLen > nValStrLen) + { + comphelper::string::padToLength(aNewStr, nVarStrLen - nValStrLen, ' '); + aNewStr.append(aRefValString); + } + else { - aRefVarString.Fill(nVarStrLen,' '); - nPos = nVarStrLen - aRefValString.Len(); + aNewStr.append(aRefValString.Copy(0, nVarStrLen)); } - aRefVarString = aRefVarString.Copy( 0, nPos ); - aRefVarString += aRefValString.Copy( 0, nVarStrLen - nPos ); - refVar->PutString(aRefVarString); + refVar->PutString(aNewStr.makeStringAndClear()); refVar->SetFlags( n ); } diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx index ad151a72b07d..5c70c6e2e3d0 100644 --- a/basic/source/runtime/step2.cxx +++ b/basic/source/runtime/step2.cxx @@ -30,6 +30,8 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/uno/Any.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> +#include <rtl/ustrbuf.hxx> using namespace com::sun::star::uno; using namespace com::sun::star::container; @@ -1090,9 +1092,9 @@ void SbiRuntime::implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, sal_uInt3 if( bFixedString ) { sal_uInt16 nCount = static_cast<sal_uInt16>( nOp2 >> 17 ); // len = all bits above 0x10000 - String aStr; - aStr.Fill( nCount, 0 ); - pVar->PutString( aStr ); + rtl::OUStringBuffer aBuf; + comphelper::string::padToLength(aBuf, nCount, 0); + pVar->PutString(aBuf.makeStringAndClear()); } bool bVarToDim = ((nOp2 & SBX_TYPE_VAR_TO_DIM_FLAG) != 0); |