diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-09-18 23:11:53 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-19 09:59:23 +0100 |
commit | 5bc9435b02b0f3993624a5110b8b47c82da00b1e (patch) | |
tree | c453c3e4199b0e91b95649b92ee289bb45313e88 | |
parent | 74b9af497aff9d6cdb3bfee1575a7932f26b2a78 (diff) |
ByteString->rtl::OString[Buffer]
-rw-r--r-- | l10ntools/source/export.cxx | 71 | ||||
-rw-r--r-- | l10ntools/source/helpmerge.cxx | 2 |
2 files changed, 44 insertions, 29 deletions
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++ ) |