diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2011-09-27 20:21:15 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2011-09-27 20:22:03 +0200 |
commit | 6671fa81db0ecea4ada005bb79f55f08fb440ad4 (patch) | |
tree | 85ad806ece8d60736b6b01310b04b053dc2f8179 /sax | |
parent | b6d8251eee90b7e24ebb3f8452eff36a507e6d91 (diff) |
Removed uses of rtl::O[U]String[Buffer]::operator sal_{char|Unicode} const *().
Diffstat (limited to 'sax')
-rw-r--r-- | sax/qa/cppunit/test_converter.cxx | 8 | ||||
-rw-r--r-- | sax/source/tools/converter.cxx | 34 | ||||
-rw-r--r-- | sax/test/saxdemo.cxx | 2 |
3 files changed, 21 insertions, 23 deletions
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx index e03dead832dd..923c7eb2413e 100644 --- a/sax/qa/cppunit/test_converter.cxx +++ b/sax/qa/cppunit/test_converter.cxx @@ -97,8 +97,8 @@ static void doTest(util::Duration const & rid, char const*const pis, CPPUNIT_ASSERT(eqDuration(rid, od)); ::rtl::OUStringBuffer buf; Converter::convertDuration(buf, od); - OSL_TRACE( - ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8)); + OSL_TRACE("%s", + ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8).getStr()); CPPUNIT_ASSERT(buf.makeStringAndClear().equalsAscii(pos)); } @@ -168,8 +168,8 @@ static void doTest(util::DateTime const & rdt, char const*const pis, CPPUNIT_ASSERT(eqDateTime(rdt, odt)); ::rtl::OUStringBuffer buf; Converter::convertDateTime(buf, odt, true); - OSL_TRACE( - ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8)); + OSL_TRACE("%s", + ::rtl::OUStringToOString(buf.getStr(), RTL_TEXTENCODING_UTF8).getStr()); CPPUNIT_ASSERT(buf.makeStringAndClear().equalsAscii(pos)); } diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index efa9f1687d7f..7ce607ea47c3 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -450,7 +450,7 @@ void Converter::convertDouble( OUStringBuffer& rBuffer, fNumber *= fFactor; ::rtl::math::doubleToUStringBuffer( rBuffer, fNumber, rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, '.', true); if(bWriteUnits) - rBuffer.append(sUnit); + rBuffer.append(sUnit.makeStringAndClear()); } } @@ -1478,7 +1478,6 @@ void ThreeByteToFourByte (const sal_Int8* pBuffer, const sal_Int32 nStart, const nLen = 3; if (nLen == 0) { - sBuffer.setLength(0); return; } @@ -1505,23 +1504,24 @@ void ThreeByteToFourByte (const sal_Int8* pBuffer, const sal_Int32 nStart, const break; } - sBuffer.appendAscii("===="); + sal_Unicode buf[] = { '=', '=', '=', '=' }; sal_uInt8 nIndex (static_cast<sal_uInt8>((nBinaer & 0xFC0000) >> 18)); - sBuffer.setCharAt(0, aBase64EncodeTable [nIndex]); + buf[0] = aBase64EncodeTable [nIndex]; nIndex = static_cast<sal_uInt8>((nBinaer & 0x3F000) >> 12); - sBuffer.setCharAt(1, aBase64EncodeTable [nIndex]); - if (nLen == 1) - return; - - nIndex = static_cast<sal_uInt8>((nBinaer & 0xFC0) >> 6); - sBuffer.setCharAt(2, aBase64EncodeTable [nIndex]); - if (nLen == 2) - return; - - nIndex = static_cast<sal_uInt8>((nBinaer & 0x3F)); - sBuffer.setCharAt(3, aBase64EncodeTable [nIndex]); + buf[1] = aBase64EncodeTable [nIndex]; + if (nLen > 1) + { + nIndex = static_cast<sal_uInt8>((nBinaer & 0xFC0) >> 6); + buf[2] = aBase64EncodeTable [nIndex]; + if (nLen > 2) + { + nIndex = static_cast<sal_uInt8>((nBinaer & 0x3F)); + buf[3] = aBase64EncodeTable [nIndex]; + } + } + sBuffer.append(buf, SAL_N_ELEMENTS(buf)); } void Converter::encodeBase64(rtl::OUStringBuffer& aStrBuffer, const uno::Sequence<sal_Int8>& aPass) @@ -1531,9 +1531,7 @@ void Converter::encodeBase64(rtl::OUStringBuffer& aStrBuffer, const uno::Sequenc const sal_Int8* pBuffer = aPass.getConstArray(); while (i < nBufferLength) { - rtl::OUStringBuffer sBuffer; - ThreeByteToFourByte (pBuffer, i, nBufferLength, sBuffer); - aStrBuffer.append(sBuffer); + ThreeByteToFourByte (pBuffer, i, nBufferLength, aStrBuffer); i += 3; } } diff --git a/sax/test/saxdemo.cxx b/sax/test/saxdemo.cxx index 5e1051297d8c..f8ac35c491a8 100644 --- a/sax/test/saxdemo.cxx +++ b/sax/test/saxdemo.cxx @@ -226,7 +226,7 @@ public: // ExtendedDocumentHandler source.sPublicId = sPublicId; source.aInputStream = createStreamFromFile( - OUStringToOString( sSystemId , RTL_TEXTENCODING_ASCII_US) ); + OUStringToOString( sSystemId, RTL_TEXTENCODING_ASCII_US).getStr() ); return source; } |