From 5bc9435b02b0f3993624a5110b8b47c82da00b1e Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 18 Sep 2011 23:11:53 +0100 Subject: ByteString->rtl::OString[Buffer] --- l10ntools/source/export.cxx | 71 +++++++++++++++++++++++++----------------- l10ntools/source/helpmerge.cxx | 2 +- 2 files changed, 44 insertions(+), 29 deletions(-) (limited to 'l10ntools') diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx index 60c683e66ac8..b1670e23a7db 100644 --- a/l10ntools/source/export.cxx +++ b/l10ntools/source/export.cxx @@ -1658,15 +1658,18 @@ void Export::WriteToMerged( const ByteString &rText , bool bSDFContent ) } } } - for ( sal_uInt16 i = 0; i < sText.Len(); i++ ) { - if ( sText.GetChar( i ) != '\n' ){ - aOutput.Write( ByteString( sText.GetChar( i )).GetBuffer(), 1 ); + for (sal_uInt16 i = 0; i < sText.Len(); ++i) + { + if ( sText.GetChar( i ) != '\n' ) + { + sal_Char cChar = sText.GetChar(i); + aOutput.Write(&cChar, 1); } - else{ + else + { aOutput.WriteLine( ByteString()); } - } } } @@ -1678,45 +1681,57 @@ void Export::ConvertMergeContent( ByteString &rText ) sal_Bool bNoOpen = ( rText.Search( "\\\"" ) != 0 ); ByteString sClose( rText.Copy( rText.Len() - 2 )); sal_Bool bNoClose = ( sClose != "\\\"" ); - ByteString sNew; - for ( sal_uInt16 i = 0; i < rText.Len(); i++ ) { - ByteString sChar( rText.GetChar( i )); - if ( sChar == "\\" ) { - if (( i + 1 ) < rText.Len()) { - ByteString sNext( rText.GetChar( i + 1 )); - if ( sNext == "\"" ) { - sChar = "\""; + rtl::OStringBuffer sNew; + for ( sal_uInt16 i = 0; i < rText.Len(); i++ ) + { + rtl::OString sChar( rText.GetChar( i )); + if (sChar.equalsL(RTL_CONSTASCII_STRINGPARAM("\\"))) + { + if (( i + 1 ) < rText.Len()) + { + sal_Char cNext = rText.GetChar(i + 1); + if ( cNext == '\"' ) + { + sChar = rtl::OString('\"'); i++; } - else if ( sNext == "n" ) { - sChar = "\\n"; + else if ( cNext == 'n' ) + { + sChar = rtl::OString(RTL_CONSTASCII_STRINGPARAM("\\n")); i++; } - else if ( sNext == "t" ) { - sChar = "\\t"; + else if ( cNext == 't' ) + { + sChar = rtl::OString(RTL_CONSTASCII_STRINGPARAM("\\t")); i++; } - else if ( sNext == "\'" ) { - sChar = "\\\'"; + else if ( cNext == '\'' ) + { + sChar = rtl::OString(RTL_CONSTASCII_STRINGPARAM("\\\'")); i++; } else - sChar = "\\\\"; + { + sChar = rtl::OString(RTL_CONSTASCII_STRINGPARAM("\\\\")); + } } - else { - sChar = "\\\\"; + else + { + sChar = rtl::OString(RTL_CONSTASCII_STRINGPARAM("\\\\")); } } - else if ( sChar == "\"" ) { - sChar = "\\\""; + else if (sChar.equalsL(RTL_CONSTASCII_STRINGPARAM("\""))) + { + sChar = rtl::OString(RTL_CONSTASCII_STRINGPARAM("\\\"")); } - else if ( sChar == "" ) { - sChar = "\\0x7F"; + else if (sChar.equalsL(RTL_CONSTASCII_STRINGPARAM(""))) + { + sChar = rtl::OString(RTL_CONSTASCII_STRINGPARAM("\\0x7F")); } - sNew += sChar; + sNew.append(sChar); } - rText = sNew; + rText = sNew.makeStringAndClear(); if ( bNoOpen ) { ByteString sTmp( rText ); diff --git a/l10ntools/source/helpmerge.cxx b/l10ntools/source/helpmerge.cxx index ba6cda8fb9fb..8fa37a3a2021 100644 --- a/l10ntools/source/helpmerge.cxx +++ b/l10ntools/source/helpmerge.cxx @@ -557,7 +557,7 @@ ByteString HelpParser::GetOutpath( const ByteString& rPathX , const ByteString& void HelpParser::MakeDir( const ByteString& sPath ){ ByteString sTPath( sPath ); ByteString sDelimiter( DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US ); - sTPath.SearchAndReplaceAll( sDelimiter , '/' ); + sTPath.SearchAndReplaceAll( sDelimiter , rtl::OString('/') ); sal_uInt16 cnt = sTPath.GetTokenCount( '/' ); rtl::OStringBuffer sCreateDir; for( sal_uInt16 i = 0 ; i < cnt ; i++ ) -- cgit