summaryrefslogtreecommitdiff
path: root/svtools/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-01-31 15:21:47 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-01-31 16:29:38 +0000
commit94644aa76acd22ac4f9cdd5374c1e1262f382c03 (patch)
treea154902f8555d53b273be4d8125acc37254aa134 /svtools/source
parent6fca59d9c2d3ee3833da6a71d390a2a5b6b73299 (diff)
make svtools ByteString free
Diffstat (limited to 'svtools/source')
-rw-r--r--svtools/source/filter/sgvtext.cxx24
-rw-r--r--svtools/source/filter/wmf/wmfwr.cxx24
-rw-r--r--svtools/source/filter/wmf/wmfwr.hxx4
-rw-r--r--svtools/source/inc/sgvmain.hxx2
-rw-r--r--svtools/source/misc/transfer.cxx12
5 files changed, 29 insertions, 37 deletions
diff --git a/svtools/source/filter/sgvtext.cxx b/svtools/source/filter/sgvtext.cxx
index 28f950b235c3..7a79edd472c9 100644
--- a/svtools/source/filter/sgvtext.cxx
+++ b/svtools/source/filter/sgvtext.cxx
@@ -1160,28 +1160,26 @@ SgfFontOne::SgfFontOne()
SVWidth=40;
}
-void SgfFontOne::ReadOne( const rtl::OString& rID, ByteString& Dsc )
+void SgfFontOne::ReadOne( const rtl::OString& rID, rtl::OString& Dsc )
{
- sal_uInt16 i,j;
-
- if ( Dsc.Len() < 4 || ( Dsc.GetChar( 0 ) != '(' ) )
+ if ( Dsc.getLength() < 4 || ( Dsc[0] != '(' ) )
return;
- i=1; // Erster Buchstabe des IF-Fontnamen. Davor ist eine '('
- while ( i < Dsc.Len() && ( Dsc.GetChar( i ) !=')' ) )
+ sal_Int32 i=1; // Erster Buchstabe des IF-Fontnamen. Davor ist eine '('
+ while ( i < Dsc.getLength() && ( Dsc[i] !=')' ) )
i++;
- Dsc.Erase(0,i+1); // IF-Fontname loeschen inkl. ()
+ Dsc = Dsc.copy(i+1); // IF-Fontname loeschen inkl. ()
- if ( Dsc.Len() < 2 || ( Dsc.GetChar( Dsc.Len() - 1 ) !=')' ) )
+ if ( Dsc.getLength() < 2 || ( Dsc[Dsc.getLength() - 1] !=')' ) )
return;
- i=Dsc.Len()-2; // hier ist die ')' des SV-Fontnames
- j=0;
- while ( i > 0 && ( Dsc.GetChar( i ) != '(' ) )
+ i=Dsc.getLength()-2; // hier ist die ')' des SV-Fontnames
+ sal_Int32 j=0;
+ while ( i > 0 && ( Dsc[i] != '(' ) )
{
i--;
j++;
}
SVFName=String(Dsc,i+1,j); // SV-Fontname rausholen
- Dsc.Erase(i,j);
+ Dsc = rtl::OStringBuffer(Dsc).remove(i,j).makeStringAndClear();
IFID = (sal_uInt32)rID.toInt32();
sal_Int32 nTokenCount = comphelper::string::getTokenCount(Dsc, ' ');
@@ -1261,7 +1259,7 @@ void SgfFontLst::ReadList()
sal_uInt16 Anz=aCfg.GetKeyCount();
sal_uInt16 i;
rtl::OString FID;
- ByteString Dsc;
+ rtl::OString Dsc;
for (i=0;i<Anz;i++)
{
diff --git a/svtools/source/filter/wmf/wmfwr.cxx b/svtools/source/filter/wmf/wmfwr.cxx
index 7d25f708db5f..2079154be05c 100644
--- a/svtools/source/filter/wmf/wmfwr.cxx
+++ b/svtools/source/filter/wmf/wmfwr.cxx
@@ -660,16 +660,13 @@ void WMFWriter::WMFRecord_ExtTextOut( const Point & rPoint,
}
void WMFWriter::TrueExtTextOut( const Point & rPoint, const String & rString,
- const ByteString & rByteString, const sal_Int32 * pDXAry )
+ const rtl::OString& rByteString, const sal_Int32 * pDXAry )
{
WriteRecordHeader( 0, W_META_EXTTEXTOUT );
WritePointYX( rPoint );
- sal_uInt16 nNewTextLen = rByteString.Len();
+ sal_uInt16 nNewTextLen = static_cast<sal_uInt16>(rByteString.getLength());
*pWMF << nNewTextLen << (sal_uInt16)0;
-
- sal_uInt16 i;
- for ( i = 0; i < nNewTextLen; i++ )
- *pWMF << (sal_uInt8)rByteString.GetChar( i );
+ write_uInt8s_FromOString(*pWMF, rByteString, nNewTextLen);
if ( nNewTextLen & 1 )
*pWMF << (sal_uInt8)0;
@@ -677,11 +674,11 @@ void WMFWriter::TrueExtTextOut( const Point & rPoint, const String & rString,
sal_Int16* pConvertedDXAry = new sal_Int16[ nOriginalTextLen ];
sal_Int32 j = 0;
pConvertedDXAry[ j++ ] = (sal_Int16)ScaleWidth( pDXAry[ 0 ] );
- for ( i = 1; i < ( nOriginalTextLen - 1 ); i++ )
+ for (sal_uInt16 i = 1; i < ( nOriginalTextLen - 1 ); ++i)
pConvertedDXAry[ j++ ] = (sal_Int16)ScaleWidth( pDXAry[ i ] - pDXAry[ i - 1 ] );
pConvertedDXAry[ j ] = (sal_Int16)ScaleWidth( pDXAry[ nOriginalTextLen - 2 ] / ( nOriginalTextLen - 1 ) );
- for ( i = 0; i < nOriginalTextLen; i++ )
+ for (sal_uInt16 i = 0; i < nOriginalTextLen; ++i)
{
sal_Int16 nDx = pConvertedDXAry[ i ];
*pWMF << nDx;
@@ -949,15 +946,12 @@ void WMFWriter::WMFRecord_TextOut(const Point & rPoint, const String & rStr)
TrueTextOut(rPoint, aString);
}
-void WMFWriter::TrueTextOut(const Point & rPoint, const ByteString& rString)
+void WMFWriter::TrueTextOut(const Point & rPoint, const rtl::OString& rString)
{
- sal_uInt16 nLen,i;
-
WriteRecordHeader(0,W_META_TEXTOUT);
- nLen=rString.Len();
- *pWMF << nLen;
- for ( i = 0; i < nLen; i++ )
- *pWMF << (sal_uInt8)rString.GetChar( i );
+
+ write_lenPrefixed_uInt8s_FromOString<sal_uInt16>(*pWMF, rString);
+ sal_Int32 nLen = rString.getLength();
if ((nLen&1)!=0) *pWMF << (sal_uInt8)0;
WritePointYX(rPoint);
UpdateRecordHeader();
diff --git a/svtools/source/filter/wmf/wmfwr.hxx b/svtools/source/filter/wmf/wmfwr.hxx
index 499918dcc7b1..4c4e2d441c71 100644
--- a/svtools/source/filter/wmf/wmfwr.hxx
+++ b/svtools/source/filter/wmf/wmfwr.hxx
@@ -167,8 +167,8 @@ private:
void WMFRecord_ExtTextOut(const Point & rPoint, const String & rString, const sal_Int32 * pDXAry);
void TrueExtTextOut(const Point & rPoint, const String & rString,
- const ByteString & rByteString, const sal_Int32 * pDXAry);
- void TrueTextOut(const Point & rPoint, const ByteString& rString);
+ const rtl::OString& rByteString, const sal_Int32 * pDXAry);
+ void TrueTextOut(const Point & rPoint, const rtl::OString& rString);
void WMFRecord_LineTo(const Point & rPoint);
void WMFRecord_MoveTo(const Point & rPoint);
void WMFRecord_Pie(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt);
diff --git a/svtools/source/inc/sgvmain.hxx b/svtools/source/inc/sgvmain.hxx
index 749cc42cbe49..9d023d55fa8e 100644
--- a/svtools/source/inc/sgvmain.hxx
+++ b/svtools/source/inc/sgvmain.hxx
@@ -330,7 +330,7 @@ public:
String SVFName; // z.B. "Times New Roman" = 15 Chars
sal_uInt16 SVWidth; // Durchschnittliche Zeichenbreite in %
SgfFontOne();
- void ReadOne(const rtl::OString& rID, ByteString& Dsc);
+ void ReadOne(const rtl::OString& rID, rtl::OString& rDsc);
};
class SgfFontLst {
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 87b31647a3f4..519dcc785f21 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -2005,10 +2005,10 @@ sal_Bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatr
if( pFDesc->cItems )
{
- ByteString aDesc( pFDesc->fgd[ 0 ].cFileName );
+ rtl::OString aDesc( pFDesc->fgd[ 0 ].cFileName );
rtl_TextEncoding eTextEncoding = osl_getThreadTextEncoding();
- if( ( aDesc.Len() > 4 ) && aDesc.Copy( aDesc.Len() - 4 ).EqualsIgnoreCaseAscii( ".URL" ) )
+ if( ( aDesc.getLength() > 4 ) && aDesc.copy(aDesc.Len() - 4).equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM(".URL")) )
{
SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( INetURLObject( String( aDesc, eTextEncoding ) ).GetMainURL( INetURLObject::NO_DECODE ),
STREAM_STD_READ );
@@ -2031,16 +2031,16 @@ sal_Bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatr
if( pStream )
{
- ByteString aLine;
+ rtl::OString aLine;
sal_Bool bSttFnd = sal_False;
while( pStream->ReadLine( aLine ) )
{
- if( aLine.EqualsIgnoreCaseAscii( "[InternetShortcut]" ) )
+ if (aLine.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("[InternetShortcut]")))
bSttFnd = sal_True;
- else if( bSttFnd && aLine.Copy( 0, 4 ).EqualsIgnoreCaseAscii( "URL=" ) )
+ else if (bSttFnd && aLine.copy(0, 4).equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("URL=")))
{
- rBmk = INetBookmark( String( aLine.Erase( 0, 4 ), eTextEncoding ),
+ rBmk = INetBookmark( String( aLine.copy(4), eTextEncoding ),
String( aDesc.Erase( aDesc.Len() - 4 ), eTextEncoding ) );
bRet = sal_True;
break;