summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-11-25 09:20:04 +0000
committerCaolán McNamara <caolanm@redhat.com>2011-11-25 09:56:38 +0000
commit6312367fb80f0cce15c576981b342ed57baf2b95 (patch)
treeeaf20acadf05a2de055d0e933cb21d33c0687772 /tools
parent360043b30ebe21a6a02b5eeeecdfe0b4bd12ab22 (diff)
ByteString->rtl::OString
Diffstat (limited to 'tools')
-rw-r--r--tools/bootstrp/prj.cxx28
-rw-r--r--tools/inc/bootstrp/prj.hxx2
-rw-r--r--tools/source/fsys/wldcrd.cxx12
-rw-r--r--tools/source/inet/inetmime.cxx106
4 files changed, 63 insertions, 85 deletions
diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx
index a3caf2328080..ef362a0af8b3 100644
--- a/tools/bootstrp/prj.cxx
+++ b/tools/bootstrp/prj.cxx
@@ -28,21 +28,8 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_tools.hxx"
-#include <stdlib.h>
-#include <stdio.h>
-#include <osl/mutex.hxx>
-
-#include <tools/stream.hxx>
-#include <comphelper/string.hxx>
#include "bootstrp/prj.hxx"
-
-#if defined(WNT)
-#define LIST_DELIMETER ';'
-#define PATH_DELIMETER '\\'
-#elif defined UNX
-#define LIST_DELIMETER ':'
-#define PATH_DELIMETER '/'
-#endif
+#include <comphelper/string.hxx>
SimpleConfig::SimpleConfig(const String &rSimpleConfigFileName)
{
@@ -56,21 +43,14 @@ SimpleConfig::~SimpleConfig()
rtl::OString SimpleConfig::getNext()
{
- if (aStringBuffer == "")
+ if (aStringBuffer.isEmpty())
while ((aStringBuffer = GetNextLine()) == "\t") ; //solange bis != "\t"
- if ( aStringBuffer == "" )
+ if (aStringBuffer.isEmpty())
return rtl::OString();
rtl::OString aString = comphelper::string::getToken(aStringBuffer, 0, '\t');
-#ifdef _MSC_VER
-#pragma warning (push)
-#pragma warning (disable:4244)
-#endif
- aStringBuffer.Erase(0, aString.getLength()+1);
-#ifdef _MSC_VER
-#pragma warning (pop)
-#endif
+ aStringBuffer = aStringBuffer.copy(aString.getLength()+1);
aStringBuffer = comphelper::string::stripStart(aStringBuffer, '\t');
diff --git a/tools/inc/bootstrp/prj.hxx b/tools/inc/bootstrp/prj.hxx
index 62d97272c2c5..f41605323996 100644
--- a/tools/inc/bootstrp/prj.hxx
+++ b/tools/inc/bootstrp/prj.hxx
@@ -43,7 +43,7 @@
class SimpleConfig
{
SvFileStream aFileStream;
- ByteString aStringBuffer;
+ rtl::OString aStringBuffer;
rtl::OString GetNextLine();
public:
diff --git a/tools/source/fsys/wldcrd.cxx b/tools/source/fsys/wldcrd.cxx
index 9071924d1316..c1acd613a7bf 100644
--- a/tools/source/fsys/wldcrd.cxx
+++ b/tools/source/fsys/wldcrd.cxx
@@ -112,24 +112,24 @@ sal_uInt16 WildCard::ImpMatch( const char *pWild, const char *pStr ) const
sal_Bool WildCard::Matches( const String& rString ) const
{
- ByteString aTmpWild = aWildString;
+ rtl::OString aTmpWild = aWildString;
rtl::OString aString(rtl::OUStringToOString(rString, osl_getThreadTextEncoding()));
- sal_uInt16 nSepPos;
+ sal_Int32 nSepPos;
if ( cSepSymbol != '\0' )
{
- while ( (nSepPos = aTmpWild.Search( cSepSymbol )) != STRING_NOTFOUND )
+ while ( (nSepPos = aTmpWild.indexOf(cSepSymbol)) != -1 )
{
// alle getrennten WildCard's pruefen
- if ( ImpMatch( aTmpWild.Copy( 0, nSepPos ).GetBuffer(), aString.getStr() ) )
+ if ( ImpMatch( aTmpWild.copy( 0, nSepPos ).getStr(), aString.getStr() ) )
return sal_True;
- aTmpWild.Erase( 0, nSepPos + 1 ); // Trennsymbol entfernen
+ aTmpWild = aTmpWild.copy(nSepPos + 1); // Trennsymbol entfernen
}
// und noch den hinter dem letzen Trennsymbol bzw. den einzigen
}
- if ( ImpMatch( aTmpWild.GetBuffer(), aString.getStr() ) )
+ if ( ImpMatch( aTmpWild.getStr(), aString.getStr() ) )
return sal_True;
else
return sal_False;
diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx
index e6b8db1836bd..6034f3b16f0f 100644
--- a/tools/source/inet/inetmime.cxx
+++ b/tools/source/inet/inetmime.cxx
@@ -117,25 +117,25 @@ namespace unnamed_tools_inetmime {
struct Parameter
{
Parameter * m_pNext;
- ByteString m_aAttribute;
- ByteString m_aCharset;
- ByteString m_aLanguage;
- ByteString m_aValue;
+ rtl::OString m_aAttribute;
+ rtl::OString m_aCharset;
+ rtl::OString m_aLanguage;
+ rtl::OString m_aValue;
sal_uInt32 m_nSection;
bool m_bExtended;
- inline Parameter(Parameter * pTheNext, ByteString const & rTheAttribute,
- ByteString const & rTheCharset,
- ByteString const & rTheLanguage,
- ByteString const & rTheValue, sal_uInt32 nTheSection,
+ inline Parameter(Parameter * pTheNext, const rtl::OString& rTheAttribute,
+ const rtl::OString& rTheCharset,
+ const rtl::OString& rTheLanguage,
+ const rtl::OString& rTheValue, sal_uInt32 nTheSection,
bool bTheExtended);
};
inline Parameter::Parameter(Parameter * pTheNext,
- ByteString const & rTheAttribute,
- ByteString const & rTheCharset,
- ByteString const & rTheLanguage,
- ByteString const & rTheValue,
+ const rtl::OString& rTheAttribute,
+ const rtl::OString& rTheCharset,
+ const rtl::OString& rTheLanguage,
+ const rtl::OString& rTheValue,
sal_uInt32 nTheSection, bool bTheExtended):
m_pNext(pTheNext),
m_aAttribute(rTheAttribute),
@@ -155,7 +155,7 @@ struct ParameterList
inline ~ParameterList();
- Parameter ** find(ByteString const & rAttribute, sal_uInt32 nSection,
+ Parameter ** find(const rtl::OString& rAttribute, sal_uInt32 nSection,
bool & rPresent);
};
@@ -261,16 +261,16 @@ void INetMIMECharsetList_Impl::reset()
//
//============================================================================
-Parameter ** ParameterList::find(ByteString const & rAttribute,
+Parameter ** ParameterList::find(const rtl::OString& rAttribute,
sal_uInt32 nSection, bool & rPresent)
{
Parameter ** p = &m_pList;
for (; *p; p = &(*p)->m_pNext)
{
- StringCompare eCompare = rAttribute.CompareTo((*p)->m_aAttribute);
- if (eCompare == COMPARE_GREATER)
+ sal_Int32 nCompare = rAttribute.compareTo((*p)->m_aAttribute);
+ if (nCompare > 0)
break;
- else if (eCompare == COMPARE_EQUAL)
+ else if (nCompare == 0)
{
if (nSection > (*p)->m_nSection)
break;
@@ -313,15 +313,15 @@ bool parseParameters(ParameterList const & rInput,
if (pOutput)
for (Parameter * p = rInput.m_pList; p;)
{
- bool bCharset = p->m_aCharset.Len() != 0;
+ bool bCharset = p->m_aCharset.getLength() != 0;
rtl_TextEncoding eEncoding = RTL_TEXTENCODING_DONTKNOW;
if (bCharset)
eEncoding
- = INetMIME::getCharsetEncoding(p->m_aCharset.GetBuffer(),
- p->m_aCharset.GetBuffer()
+ = INetMIME::getCharsetEncoding(p->m_aCharset.getStr(),
+ p->m_aCharset.getStr()
+ rInput.m_pList->
m_aCharset.
- Len());
+ getLength());
UniString aValue;
bool bBadEncoding = false;
Parameter * pNext = p;
@@ -329,18 +329,18 @@ bool parseParameters(ParameterList const & rInput,
{
sal_Size nSize;
sal_Unicode * pUnicode
- = INetMIME::convertToUnicode(pNext->m_aValue.GetBuffer(),
- pNext->m_aValue.GetBuffer()
- + pNext->m_aValue.Len(),
+ = INetMIME::convertToUnicode(pNext->m_aValue.getStr(),
+ pNext->m_aValue.getStr()
+ + pNext->m_aValue.getLength(),
bCharset && p->m_bExtended ?
eEncoding :
RTL_TEXTENCODING_UTF8,
nSize);
if (!pUnicode && !(bCharset && p->m_bExtended))
pUnicode = INetMIME::convertToUnicode(
- pNext->m_aValue.GetBuffer(),
- pNext->m_aValue.GetBuffer()
- + pNext->m_aValue.Len(),
+ pNext->m_aValue.getStr(),
+ pNext->m_aValue.getStr()
+ + pNext->m_aValue.getLength(),
RTL_TEXTENCODING_ISO_8859_1, nSize);
if (!pUnicode)
{
@@ -358,17 +358,18 @@ bool parseParameters(ParameterList const & rInput,
for (pNext = p;;)
{
if (pNext->m_bExtended)
- for (xub_StrLen i = 0; i < pNext->m_aValue.Len(); ++i)
+ {
+ for (sal_Int32 i = 0; i < pNext->m_aValue.getLength(); ++i)
aValue += sal_Unicode(
sal_Unicode(
- sal_uChar(pNext->m_aValue.GetChar(i)))
+ sal_uChar(pNext->m_aValue[i]))
| 0xF800);
+ }
else
- for (xub_StrLen i = 0; i < pNext->m_aValue.Len(); ++i)
- aValue
- += sal_Unicode(sal_uChar
- (pNext->
- m_aValue.GetChar(i)));
+ {
+ for (sal_Int32 i = 0; i < pNext->m_aValue.getLength(); ++i)
+ aValue += sal_Unicode(sal_uChar(pNext->m_aValue[i]));
+ }
pNext = pNext->m_pNext;
if (!pNext || pNext->m_nSection == 0)
break;
@@ -913,10 +914,9 @@ sal_Char const * INetMIME::scanParameters(sal_Char const * pBegin,
}
if (p == pAttributeBegin)
break;
- ByteString aAttribute(
- pAttributeBegin, static_cast< xub_StrLen >(p - pAttributeBegin));
+ rtl::OString aAttribute(pAttributeBegin, (p - pAttributeBegin));
if (bDowncaseAttribute)
- aAttribute.ToLowerAscii();
+ aAttribute = aAttribute.toAsciiLowerCase();
sal_uInt32 nSection = 0;
if (p != pEnd && *p == '*')
@@ -944,8 +944,8 @@ sal_Char const * INetMIME::scanParameters(sal_Char const * pBegin,
p = skipLinearWhiteSpaceComment(p + 1, pEnd);
- ByteString aCharset;
- ByteString aLanguage;
+ rtl::OString aCharset;
+ rtl::OString aLanguage;
rtl::OStringBuffer aValue;
if (bExtended)
{
@@ -962,11 +962,10 @@ sal_Char const * INetMIME::scanParameters(sal_Char const * pBegin,
break;
if (pParameters)
{
- aCharset = ByteString(
- pCharsetBegin,
- static_cast< xub_StrLen >(p - pCharsetBegin));
+ aCharset = rtl::OString(
+ pCharsetBegin, p - pCharsetBegin);
if (bDowncaseCharset)
- aCharset.ToLowerAscii();
+ aCharset = aCharset.toAsciiLowerCase();
}
if (p == pEnd || *p != '\'')
@@ -996,11 +995,10 @@ sal_Char const * INetMIME::scanParameters(sal_Char const * pBegin,
break;
if (pParameters)
{
- aLanguage = ByteString(
- pLanguageBegin,
- static_cast< xub_StrLen >(p - pLanguageBegin));
+ aLanguage = rtl::OString(
+ pLanguageBegin, p - pLanguageBegin);
if (bDowncaseLanguage)
- aLanguage.ToLowerAscii();
+ aLanguage = aLanguage.toAsciiLowerCase();
}
if (p == pEnd || *p != '\'')
@@ -1122,11 +1120,11 @@ sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
}
if (p == pAttributeBegin)
break;
- ByteString aAttribute = rtl::OString(
+ rtl::OString aAttribute = rtl::OString(
pAttributeBegin, p - pAttributeBegin,
RTL_TEXTENCODING_ASCII_US);
if (bDowncaseAttribute)
- aAttribute.ToLowerAscii();
+ aAttribute = aAttribute.toAsciiLowerCase();
sal_uInt32 nSection = 0;
if (p != pEnd && *p == '*')
@@ -1156,9 +1154,9 @@ sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
p = skipLinearWhiteSpaceComment(p + 1, pEnd);
- ByteString aCharset;
- ByteString aLanguage;
- ByteString aValue;
+ rtl::OString aCharset;
+ rtl::OString aLanguage;
+ rtl::OString aValue;
if (bExtended)
{
if (nSection == 0)
@@ -1179,7 +1177,7 @@ sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
p - pCharsetBegin,
RTL_TEXTENCODING_ASCII_US);
if (bDowncaseCharset)
- aCharset.ToLowerAscii();
+ aCharset = aCharset.toAsciiLowerCase();
}
if (p == pEnd || *p != '\'')
@@ -1214,7 +1212,7 @@ sal_Unicode const * INetMIME::scanParameters(sal_Unicode const * pBegin,
p - pLanguageBegin,
RTL_TEXTENCODING_ASCII_US);
if (bDowncaseLanguage)
- aLanguage.ToLowerAscii();
+ aLanguage = aLanguage.toAsciiLowerCase();
}
if (p == pEnd || *p != '\'')