diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-09-20 15:26:19 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-09-20 16:54:55 +0100 |
commit | 53abf4dc1c065fba3ec9e691cacd55aceaf19fc7 (patch) | |
tree | 5bd8d55ed27a67acfb5e9114b704fa1362a6f609 /tools/source | |
parent | 0344e07dd7b6929e88141a384fd5c46b93c1c61b (diff) |
ByteString->rtl::OString[Buffer]
Diffstat (limited to 'tools/source')
-rw-r--r-- | tools/source/fsys/dirent.cxx | 22 | ||||
-rw-r--r-- | tools/source/inet/inetmime.cxx | 50 | ||||
-rw-r--r-- | tools/source/string/debugprint.cxx | 1 |
3 files changed, 38 insertions, 35 deletions
diff --git a/tools/source/fsys/dirent.cxx b/tools/source/fsys/dirent.cxx index 825b8d2140a3..c27de5f788cd 100644 --- a/tools/source/fsys/dirent.cxx +++ b/tools/source/fsys/dirent.cxx @@ -942,7 +942,7 @@ String DirEntry::GetFull( FSysPathStyle eStyle, sal_Bool bWithDelimiter, { DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - ByteString aRet; + rtl::OStringBuffer aBuf; eStyle = GetStyle( eStyle ); if ( pParent ) { @@ -950,31 +950,33 @@ String DirEntry::GetFull( FSysPathStyle eStyle, sal_Bool bWithDelimiter, pParent->eFlag == FSYS_FLAG_RELROOT || pParent->eFlag == FSYS_FLAG_VOLUME ) ) { - aRet = ByteString(pParent->GetName( eStyle ), osl_getThreadTextEncoding()); - aRet += ByteString(GetName( eStyle ), osl_getThreadTextEncoding()); + aBuf.append(rtl::OUStringToOString(pParent->GetName( eStyle ), osl_getThreadTextEncoding())); + aBuf.append(rtl::OUStringToOString(GetName( eStyle ), osl_getThreadTextEncoding())); } else { - aRet = ByteString(pParent->GetFull( eStyle ), osl_getThreadTextEncoding()); - aRet += ACCESSDELIM_C(eStyle); - aRet += ByteString(GetName( eStyle ), osl_getThreadTextEncoding()); + aBuf.append(rtl::OUStringToOString(pParent->GetFull( eStyle ), osl_getThreadTextEncoding())); + aBuf.append(ACCESSDELIM_C(eStyle)); + aBuf.append(rtl::OUStringToOString(GetName( eStyle ), osl_getThreadTextEncoding())); } } else { - aRet = rtl::OUStringToOString(GetName(eStyle), osl_getThreadTextEncoding()); + aBuf.append(rtl::OUStringToOString(GetName(eStyle), osl_getThreadTextEncoding())); } //! Hack if ( bWithDelimiter ) - if ( aRet.GetChar( aRet.Len()-1 ) != ACCESSDELIM_C(eStyle) ) - aRet += ACCESSDELIM_C(eStyle); + if ( aBuf[aBuf.getLength()-1] != ACCESSDELIM_C(eStyle) ) + aBuf.append(ACCESSDELIM_C(eStyle)); + + rtl::OString aRet = aBuf.makeStringAndClear(); //! noch ein Hack if ( nMaxChars < STRING_MAXLEN ) aRet = ImplCutPath( aRet, nMaxChars, ACCESSDELIM_C(eStyle) ); - return String(aRet, osl_getThreadTextEncoding()); + return rtl::OStringToOUString(aRet, osl_getThreadTextEncoding()); } /************************************************************************* diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx index d8531bfd9f69..f54952e9bde6 100644 --- a/tools/source/inet/inetmime.cxx +++ b/tools/source/inet/inetmime.cxx @@ -32,7 +32,8 @@ #include <cstddef> #include <limits> -#include "rtl/tencinfo.h" +#include <rtl/strbuf.hxx> +#include <rtl/tencinfo.h> #include <tools/datetime.hxx> #include <tools/inetmime.hxx> @@ -945,7 +946,7 @@ sal_Char const * INetMIME::scanParameters(sal_Char const * pBegin, ByteString aCharset; ByteString aLanguage; - ByteString aValue; + rtl::OStringBuffer aValue; if (bExtended) { if (nSection == 0) @@ -1007,6 +1008,7 @@ sal_Char const * INetMIME::scanParameters(sal_Char const * pBegin, ++p; } if (pParameters) + { while (p != pEnd && (isTokenChar(*p) || !isUSASCII(*p))) { if (*p == '%') @@ -1017,19 +1019,21 @@ sal_Char const * INetMIME::scanParameters(sal_Char const * pBegin, int nWeight2 = getHexWeight(p[2]); if (nWeight1 >= 0 && nWeight2 >= 0) { - aValue += sal_Char(nWeight1 << 4 | nWeight2); + aValue.append(sal_Char(nWeight1 << 4 | nWeight2)); p += 3; continue; } } } - aValue += *p++; + aValue.append(*p++); } + } else while (p != pEnd && (isTokenChar(*p) || !isUSASCII(*p))) ++p; } else if (p != pEnd && *p == '"') + { if (pParameters) { bool bInvalid = false; @@ -1060,7 +1064,7 @@ sal_Char const * INetMIME::scanParameters(sal_Char const * pBegin, bInvalid = true; break; } - aValue += *p++; + aValue.append(*p++); } if (bInvalid) break; @@ -1072,6 +1076,7 @@ sal_Char const * INetMIME::scanParameters(sal_Char const * pBegin, break; p = pStringEnd; } + } else { sal_Char const * pTokenBegin = p; @@ -1080,13 +1085,12 @@ sal_Char const * INetMIME::scanParameters(sal_Char const * pBegin, if (p == pTokenBegin) break; if (pParameters) - aValue = ByteString( - pTokenBegin, static_cast< xub_StrLen >(p - pTokenBegin)); + aValue.append(pTokenBegin, static_cast< sal_Int32 >(p - pTokenBegin)); } if (!bPresent) - *pPos = new Parameter(*pPos, aAttribute, aCharset, aLanguage, aValue, - nSection, bExtended); + *pPos = new Parameter(*pPos, aAttribute, aCharset, aLanguage, + aValue.makeStringAndClear(), nSection, bExtended); } return parseParameters(aList, pParameters) ? pParameterBegin : pBegin; } @@ -2888,7 +2892,7 @@ UniString INetMIME::decodeHeaderFieldBody(HeaderFieldType eType, bEncodedWord = bEncodedWord && q != pEnd && *q++ == '?'; - ByteString sText; + rtl::OStringBuffer sText; if (bEncodedWord) { if (bEncodingB) @@ -2933,10 +2937,8 @@ UniString INetMIME::decodeHeaderFieldBody(HeaderFieldType eType, } if (bEncodedWord) { - for (int nShift = 16; nCount-- > 0; - nShift -= 8) - sText += sal_Char(nValue >> nShift - & 0xFF); + for (int nShift = 16; nCount-- > 0; nShift -= 8) + sText.append(sal_Char(nValue >> nShift & 0xFF)); if (*q == '?') { ++q; @@ -2982,12 +2984,12 @@ UniString INetMIME::decodeHeaderFieldBody(HeaderFieldType eType, bDone = true; break; } - sText += rBody.Copy( + sText.append(rBody.Copy( static_cast< xub_StrLen >( pEncodedTextCopyBegin - pBegin), static_cast< xub_StrLen >( - q - 1 - pEncodedTextCopyBegin)); - sText += sal_Char(nDigit1 << 4 | nDigit2); + q - 1 - pEncodedTextCopyBegin))); + sText.append(sal_Char(nDigit1 << 4 | nDigit2)); q += 2; pEncodedTextCopyBegin = q; break; @@ -2995,23 +2997,23 @@ UniString INetMIME::decodeHeaderFieldBody(HeaderFieldType eType, case '?': if (q - pEncodedTextBegin > 1) - sText += rBody.Copy( + sText.append(rBody.Copy( static_cast< xub_StrLen >( pEncodedTextCopyBegin - pBegin), static_cast< xub_StrLen >( - q - 1 - pEncodedTextCopyBegin)); + q - 1 - pEncodedTextCopyBegin))); else bEncodedWord = false; bDone = true; break; case '_': - sText += rBody.Copy( + sText.append(rBody.Copy( static_cast< xub_StrLen >( pEncodedTextCopyBegin - pBegin), static_cast< xub_StrLen >( - q - 1 - pEncodedTextCopyBegin)); - sText += ' '; + q - 1 - pEncodedTextCopyBegin))); + sText.append(' '); pEncodedTextCopyBegin = q; break; @@ -3051,8 +3053,8 @@ UniString INetMIME::decodeHeaderFieldBody(HeaderFieldType eType, if (bEncodedWord) { pUnicodeBuffer - = convertToUnicode(sText.GetBuffer(), - sText.GetBuffer() + sText.Len(), + = convertToUnicode(sText.getStr(), + sText.getStr() + sText.getLength(), eCharsetEncoding, nUnicodeSize); if (pUnicodeBuffer == 0) bEncodedWord = false; diff --git a/tools/source/string/debugprint.cxx b/tools/source/string/debugprint.cxx index b95e8ce50c23..85133319f4e1 100644 --- a/tools/source/string/debugprint.cxx +++ b/tools/source/string/debugprint.cxx @@ -37,7 +37,6 @@ const sal_Char *dbg_dump(const ByteString &rStr) { static ByteString aStr; aStr = rStr; - aStr.Append(static_cast<char>(0)); return aStr.GetBuffer(); } |