diff options
-rw-r--r-- | l10ntools/source/export2.cxx | 60 | ||||
-rw-r--r-- | l10ntools/source/xmlparse.cxx | 21 |
2 files changed, 44 insertions, 37 deletions
diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx index 64379d463752..1150d3ee56b6 100644 --- a/l10ntools/source/export2.cxx +++ b/l10ntools/source/export2.cxx @@ -145,52 +145,52 @@ std::vector<ByteString> Export::aForcedLanguages = std::vector<ByteString>(); void Export::QuotHTML( ByteString &rString ) /*****************************************************************************/ { - ByteString sReturn; + rtl::OStringBuffer sReturn; for ( sal_uInt16 i = 0; i < rString.Len(); i++ ) { ByteString sTemp = rString.Copy( i ); if ( sTemp.Search( "<Arg n=" ) == 0 ) { while ( i < rString.Len() && rString.GetChar( i ) != '>' ) { - sReturn += rString.GetChar( i ); + sReturn.append(rString.GetChar(i)); i++; } if ( rString.GetChar( i ) == '>' ) { - sReturn += ">"; + sReturn.append('>'); i++; } } if ( i < rString.Len()) { switch ( rString.GetChar( i )) { case '<': - sReturn += "<"; + sReturn.append("<"); break; case '>': - sReturn += ">"; + sReturn.append(">"); break; case '\"': - sReturn += """; + sReturn.append("""); break; case '\'': - sReturn += "'"; + sReturn.append("'"); break; case '&': if ((( i + 4 ) < rString.Len()) && ( rString.Copy( i, 5 ) == "&" )) - sReturn += rString.GetChar( i ); + sReturn.append(rString.GetChar(i)); else - sReturn += "&"; + sReturn.append("&"); break; default: - sReturn += rString.GetChar( i ); + sReturn.append(rString.GetChar(i)); break; } } } - rString = sReturn; + rString = sReturn.makeStringAndClear(); } void Export::RemoveUTF8ByteOrderMarker( ByteString &rString ){ @@ -298,34 +298,42 @@ bool Export::CopyFile( const ByteString& source , const ByteString& dest ) void Export::UnquotHTML( ByteString &rString ) /*****************************************************************************/ { - ByteString sReturn; - while ( rString.Len()) { - if ( rString.Copy( 0, 5 ) == "&" ) { - sReturn += "&"; + rtl::OStringBuffer sReturn; + + while ( rString.Len()) + { + if ( rString.Copy( 0, 5 ) == "&" ) + { + sReturn.append('&'); rString.Erase( 0, 5 ); } - else if ( rString.Copy( 0, 4 ) == "<" ) { - sReturn += "<"; + else if ( rString.Copy( 0, 4 ) == "<" ) + { + sReturn.append('<'); rString.Erase( 0, 4 ); } - else if ( rString.Copy( 0, 4 ) == ">" ) { - sReturn += ">"; + else if ( rString.Copy( 0, 4 ) == ">" ) + { + sReturn.append('>'); rString.Erase( 0, 4 ); } - else if ( rString.Copy( 0, 6 ) == """ ) { - sReturn += "\""; + else if ( rString.Copy( 0, 6 ) == """ ) + { + sReturn.append('\"');; rString.Erase( 0, 6 ); } - else if ( rString.Copy( 0, 6 ) == "'" ) { - sReturn += "\'"; + else if ( rString.Copy( 0, 6 ) == "'" ) + { + sReturn.append('\''); rString.Erase( 0, 6 ); } - else { - sReturn += rString.GetChar( 0 ); + else + { + sReturn.append(rString.GetChar(0)); rString.Erase( 0, 1 ); } } - rString = sReturn; + rString = sReturn.makeStringAndClear(); } bool Export::isSourceLanguage( const ByteString &sLanguage ) { diff --git a/l10ntools/source/xmlparse.cxx b/l10ntools/source/xmlparse.cxx index 7b0b11817687..f7d8018ae9de 100644 --- a/l10ntools/source/xmlparse.cxx +++ b/l10ntools/source/xmlparse.cxx @@ -38,6 +38,7 @@ #include <iostream> #include <osl/mutex.hxx> #include <osl/thread.hxx> +#include <rtl/strbuf.hxx> using namespace std; using namespace osl; @@ -1377,41 +1378,39 @@ void XMLUtil::UnQuotHTML( String &rString ){ } void XMLUtil::UnQuotData( String &rString_in ){ - ByteString sReturn; + rtl::OStringBuffer sReturn; ByteString sString( rString_in , RTL_TEXTENCODING_UTF8 ); while ( sString.Len()) { if ( sString.Copy( 0, 1 ) == "\\" ) { - sReturn += "\\\\"; + sReturn.append("\\\\"); sString.Erase( 0, 1 ); } else if ( sString.Copy( 0, 5 ) == "&" ) { - sReturn += "&"; + sReturn.append('&'); sString.Erase( 0, 5 ); } else if ( sString.Copy( 0, 4 ) == "<" ) { - sReturn += "<"; + sReturn.append('<'); sString.Erase( 0, 4 ); } else if ( sString.Copy( 0, 4 ) == ">" ) { - sReturn += ">"; + sReturn.append('>'); sString.Erase( 0, 4 ); } else if ( sString.Copy( 0, 6 ) == """ ) { - sReturn += "\""; + sReturn.append('\"'); sString.Erase( 0, 6 ); } else if ( sString.Copy( 0, 6 ) == "'" ) { - sReturn += "\'"; + sReturn.append('\''); sString.Erase( 0, 6 ); } else { - sReturn += sString.GetChar( 0 ); + sReturn.append(sString.GetChar(0)); sString.Erase( 0, 1 ); } } - rString_in = String(sReturn , RTL_TEXTENCODING_UTF8 ); - - + rString_in = rtl::OStringToOUString(sReturn.makeStringAndClear(), RTL_TEXTENCODING_UTF8); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |