[Libreoffice-commits] .: 27 commits - basic/inc basic/source basic/StaticLibrary_app.mk connectivity/source idl/inc idl/source l10ntools/source RepositoryFixes.mk rsc/inc rsc/source sfx2/source svtools/source sw/source tools/bootstrp tools/inc tools/source unusedcode.easy vcl/source
Caolán McNamara
caolan at kemper.freedesktop.org
Mon Sep 19 01:59:56 PDT 2011
RepositoryFixes.mk | 1
basic/StaticLibrary_app.mk | 1
basic/inc/basic/sbxbase.hxx | 2
basic/source/app/app.cxx | 16 --
basic/source/app/app.hxx | 2
basic/source/app/basic.hrc | 2
basic/source/app/basic.src | 11 -
basic/source/app/printer.cxx | 114 -----------------
basic/source/app/printer.hxx | 55 --------
basic/source/runtime/methods.cxx | 11 -
basic/source/runtime/step1.cxx | 2
basic/source/sbx/sbxbase.cxx | 55 ++++----
basic/source/sbx/sbxscan.cxx | 22 +--
connectivity/source/drivers/dbase/dindexnode.cxx | 15 --
idl/inc/database.hxx | 2
idl/source/objects/object.cxx | 2
idl/source/objects/types.cxx | 2
idl/source/prj/database.cxx | 4
l10ntools/source/export.cxx | 95 +++++++-------
l10ntools/source/helpmerge.cxx | 2
l10ntools/source/xrmmerge.cxx | 6
rsc/inc/rscall.h | 12 -
rsc/source/prj/start.cxx | 7 -
rsc/source/res/rscall.cxx | 16 +-
rsc/source/rsc/rsc.cxx | 12 -
sfx2/source/bastyp/frmhtmlw.cxx | 19 +-
sfx2/source/bastyp/sfxhtml.cxx | 6
svtools/source/filter/igif/gifread.cxx | 11 -
svtools/source/filter/sgvtext.cxx | 3
svtools/source/graphic/grfcache.cxx | 17 +-
svtools/source/svhtml/htmlout.cxx | 110 ++++++++--------
sw/source/filter/html/htmlatr.cxx | 152 +++++++++++------------
sw/source/filter/html/htmlforw.cxx | 93 +++++++-------
sw/source/filter/html/htmltabw.cxx | 8 -
sw/source/filter/ww1/w1class.cxx | 11 -
tools/bootstrp/mkunroll/mkunroll.cxx | 9 -
tools/bootstrp/prj.cxx | 17 --
tools/inc/bootstrp/prj.hxx | 1
tools/inc/tools/shl.hxx | 2
tools/inc/tools/string.hxx | 6
tools/source/fsys/dirent.cxx | 76 ++++++-----
tools/source/stream/stream.cxx | 8 -
tools/source/string/strimp.cxx | 71 ----------
tools/source/string/tustring.cxx | 71 ++++++++++
unusedcode.easy | 3
vcl/source/gdi/cvtsvm.cxx | 35 +++--
46 files changed, 513 insertions(+), 685 deletions(-)
New commits:
commit 375fc2d5ec124a9c6e66877fdbb7ca9be8372323
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Sep 19 09:56:07 2011 +0100
windows berkleydb libname fixup
diff --git a/RepositoryFixes.mk b/RepositoryFixes.mk
index eb6a524..aa37877 100644
--- a/RepositoryFixes.mk
+++ b/RepositoryFixes.mk
@@ -92,6 +92,7 @@ gb_Library_FILENAMES := $(patsubst comphelper:icomphelper%,comphelper:icomphelp%
gb_Library_FILENAMES := $(patsubst cppunit:icppunit%,cppunit:icppunit_dll%,$(gb_Library_FILENAMES))
gb_Library_FILENAMES := $(patsubst crypto:icrypto%,crypto:libeay32%,$(gb_Library_FILENAMES))
gb_Library_FILENAMES := $(patsubst crypto:libcrypto%,crypto:libcrypto_static%,$(gb_Library_FILENAMES))
+gb_Library_FILENAMES := $(patsubst db47:idb47%,db47:libdb47%,$(gb_Library_FILENAMES))
gb_Library_FILENAMES := $(patsubst i18nisolang1:ii18nisolang1%,i18nisolang1:ii18nisolang%,$(gb_Library_FILENAMES))
gb_Library_FILENAMES := $(patsubst lpsolve55:ilpsolve55%,lpsolve55:lpsolve55%,$(gb_Library_FILENAMES))
gb_Library_FILENAMES := $(patsubst package2:ipackage2%,package2:ipackage%,$(gb_Library_FILENAMES))
commit c5a994a89dea96d06df07ee5ac292438655f7ec7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Sep 19 09:09:40 2011 +0100
oops not yet
diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx
index b2f9035..d976207 100644
--- a/tools/inc/tools/string.hxx
+++ b/tools/inc/tools/string.hxx
@@ -172,7 +172,6 @@ private:
sal_uInt32 nCvtFlags = UNISTRING_TO_BYTESTRING_CVTFLAGS ); //not implemented, to detect use of removed methods without compiler making somethiing to fit
void Assign(int); // not implemented; to detect misuses of
// Assign(sal_Char)
- ByteString& Assign( sal_Char c ); //not implemented
void operator =(int); // not implemented; to detect misuses
// of operator =(sal_Char)
void Append(int); // not implemented; to detect misuses of
@@ -201,6 +200,7 @@ public:
ByteString& Assign( const rtl::OString& rStr );
ByteString& Assign( const sal_Char* pCharStr );
ByteString& Assign( const sal_Char* pCharStr, xub_StrLen nLen );
+ ByteString& Assign( sal_Char c );
ByteString& operator =( const ByteString& rStr )
{ return Assign( rStr ); }
ByteString& operator =( const rtl::OString& rStr )
diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx
index 495b15a..da98a85 100644
--- a/tools/source/string/strimp.cxx
+++ b/tools/source/string/strimp.cxx
@@ -428,6 +428,20 @@ STRING& STRING::Assign( const STRCODE* pCharStr, xub_StrLen nLen )
// -----------------------------------------------------------------------
+STRING& STRING::Assign( STRCODE c )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_ASSERT( c, "String::Assign() - c is 0" );
+
+ // Verwaltungsdaten anlegen und initialisieren
+ STRING_RELEASE((STRING_TYPE *)mpData);
+ mpData = ImplAllocData( 1 );
+ mpData->maStr[0] = c;
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
STRING& STRING::Append( const STRING& rStr )
{
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx
index 82d5458..30a0fd5 100644
--- a/tools/source/string/tustring.cxx
+++ b/tools/source/string/tustring.cxx
@@ -576,18 +576,4 @@ STRING::STRING( STRCODE c )
mpData->maStr[0] = c;
}
-// -----------------------------------------------------------------------
-
-STRING& STRING::Assign( STRCODE c )
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- DBG_ASSERT( c, "String::Assign() - c is 0" );
-
- // Verwaltungsdaten anlegen und initialisieren
- STRING_RELEASE((STRING_TYPE *)mpData);
- mpData = ImplAllocData( 1 );
- mpData->maStr[0] = c;
- return *this;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 6b7675a1b7994200c4501bc086ac40ca803b2335
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Sep 19 09:00:40 2011 +0100
ByteString->rtl::OStringBuffer
diff --git a/tools/source/fsys/dirent.cxx b/tools/source/fsys/dirent.cxx
index 151d782..825b8d2 100644
--- a/tools/source/fsys/dirent.cxx
+++ b/tools/source/fsys/dirent.cxx
@@ -1052,41 +1052,43 @@ String DirEntry::GetName( FSysPathStyle eStyle ) const
{
DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
- ByteString aRet;
+ rtl::OStringBuffer aRet;
eStyle = GetStyle( eStyle );
switch( eFlag )
{
case FSYS_FLAG_PARENT:
- aRet = ACTPARENT(eStyle);
- break;
+ aRet.append(ACTPARENT(eStyle));
+ break;
case FSYS_FLAG_ABSROOT:
{
- aRet = aName;
- aRet += ACCESSDELIM_C(eStyle);
+ aRet.append(aName);
+ aRet.append(ACCESSDELIM_C(eStyle));
break;
}
case FSYS_FLAG_INVALID:
case FSYS_FLAG_VOLUME:
{
- aRet = aName;
+ aRet.append(aName);
break;
}
case FSYS_FLAG_RELROOT:
if ( !aName.Len() )
{
- aRet = ACTCURRENT(eStyle);
+ aRet.append(ACTCURRENT(eStyle));
break;
}
default:
- aRet = aName;
+ aRet.append(aName);
+ break;
}
- return String(aRet, osl_getThreadTextEncoding());
+ return rtl::OStringToOUString(aRet.makeStringAndClear(),
+ osl_getThreadTextEncoding());
}
/*************************************************************************
@@ -1342,25 +1344,32 @@ void DirEntry::SetExtension( const String& rExtension, char cSep )
return;
}
+ rtl::OStringBuffer aBuf(aName);
+
// cSep im Namen suchen
- const char *p0 = ( aName.GetBuffer() );
- const char *p1 = p0 + aName.Len() - 1;
+ const sal_Char *p0 = aBuf.getStr();
+ const sal_Char *p1 = p0 + aBuf.getLength() - 1;
while ( p1 >= p0 && *p1 != cSep )
p1--;
if ( p1 >= p0 )
{
// es wurde ein cSep an der Position p1 gefunden
- aName.Erase(
- static_cast< xub_StrLen >(
- p1 - p0 + 1 - ( rExtension.Len() ? 0 : 1 )) );
- aName += ByteString(rExtension, osl_getThreadTextEncoding());
+
+ sal_Int32 n = static_cast<sal_Int32>(
+ p1 - p0 + 1 - ( rExtension.Len() ? 0 : 1 ));
+
+ aBuf.remove(n, aBuf.getLength()-n);
}
else if ( rExtension.Len() )
{
// es wurde kein cSep gefunden
- aName += cSep;
- aName += ByteString(rExtension, osl_getThreadTextEncoding());
+ aBuf.append(cSep);
}
+
+ aBuf.append(rtl::OUStringToOString(rExtension,
+ osl_getThreadTextEncoding()));
+
+ aName = aBuf.makeStringAndClear();
}
/*************************************************************************
commit d953f02bc8e9cb3a569072da68a5c53d5fdefa51
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Sep 19 08:46:05 2011 +0100
remove ByteString::Assign(sal_Char)
diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx
index d976207..b2f9035 100644
--- a/tools/inc/tools/string.hxx
+++ b/tools/inc/tools/string.hxx
@@ -172,6 +172,7 @@ private:
sal_uInt32 nCvtFlags = UNISTRING_TO_BYTESTRING_CVTFLAGS ); //not implemented, to detect use of removed methods without compiler making somethiing to fit
void Assign(int); // not implemented; to detect misuses of
// Assign(sal_Char)
+ ByteString& Assign( sal_Char c ); //not implemented
void operator =(int); // not implemented; to detect misuses
// of operator =(sal_Char)
void Append(int); // not implemented; to detect misuses of
@@ -200,7 +201,6 @@ public:
ByteString& Assign( const rtl::OString& rStr );
ByteString& Assign( const sal_Char* pCharStr );
ByteString& Assign( const sal_Char* pCharStr, xub_StrLen nLen );
- ByteString& Assign( sal_Char c );
ByteString& operator =( const ByteString& rStr )
{ return Assign( rStr ); }
ByteString& operator =( const rtl::OString& rStr )
diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx
index da98a85..495b15a 100644
--- a/tools/source/string/strimp.cxx
+++ b/tools/source/string/strimp.cxx
@@ -428,20 +428,6 @@ STRING& STRING::Assign( const STRCODE* pCharStr, xub_StrLen nLen )
// -----------------------------------------------------------------------
-STRING& STRING::Assign( STRCODE c )
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- DBG_ASSERT( c, "String::Assign() - c is 0" );
-
- // Verwaltungsdaten anlegen und initialisieren
- STRING_RELEASE((STRING_TYPE *)mpData);
- mpData = ImplAllocData( 1 );
- mpData->maStr[0] = c;
- return *this;
-}
-
-// -----------------------------------------------------------------------
-
STRING& STRING::Append( const STRING& rStr )
{
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx
index 30a0fd5..82d5458 100644
--- a/tools/source/string/tustring.cxx
+++ b/tools/source/string/tustring.cxx
@@ -576,4 +576,18 @@ STRING::STRING( STRCODE c )
mpData->maStr[0] = c;
}
+// -----------------------------------------------------------------------
+
+STRING& STRING::Assign( STRCODE c )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_ASSERT( c, "String::Assign() - c is 0" );
+
+ // Verwaltungsdaten anlegen und initialisieren
+ STRING_RELEASE((STRING_TYPE *)mpData);
+ mpData = ImplAllocData( 1 );
+ mpData->maStr[0] = c;
+ return *this;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unusedcode.easy b/unusedcode.easy
index d1464a7..5114159 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -3,6 +3,7 @@
(anonymous namespace)::writeInfo(com::sun::star::uno::Reference<com::sun::star::registry::XRegistryKey> const&, rtl::OUString const&, rtl::OUString const&)
BitmapPalette::IsGreyPalette() const
BufferNode::childAt(int) const
+ByteString::Assign(char const*, unsigned short)
CAT::Inverse() const
CAT::makeChromaticAdaptationTag() const
CIccCmm::FromInternalEncoding(icColorSpaceSignature, unsigned char*, float const*)
@@ -448,7 +449,6 @@ SbiIoSystem::NextChannel()
SbiRuntime::GetParams()
SbiSymPool::Clear()
SbxAlias::SbxAlias(String const&, SbxVariable*)
-SbxAppData::~SbxAppData()
SbxBase::StaticEnableBroadcasting(unsigned char)
SbxDecimal::SbxDecimal()
SbxDecimal::getByte(unsigned char&)
commit a4968af0d141b60d65c0a2b0ebcdf91599f7fe3d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Sep 19 01:47:39 2011 +0100
ByteString->rtl::OString
diff --git a/tools/bootstrp/mkunroll/mkunroll.cxx b/tools/bootstrp/mkunroll/mkunroll.cxx
index c1b0252..2763603 100644
--- a/tools/bootstrp/mkunroll/mkunroll.cxx
+++ b/tools/bootstrp/mkunroll/mkunroll.cxx
@@ -88,7 +88,7 @@ typedef ::std::vector< MkLine* > ByteStringList;
class MkLine
{
public:
- ByteString aLine;
+ rtl::OString aLine;
ByteStringList* pPrivateTnrLst;
sal_Bool bOut;
sal_Bool bHier;
@@ -177,7 +177,8 @@ void MkFilter::Filter()
fprintf( stderr, ";\nunroll end\n" );
MkLine *p_MkLine = new MkLine();
p_MkLine->bHier = sal_True;
- p_MkLine->aLine = ByteString("# do not delete this line === mkfilter3i\n");
+ p_MkLine->aLine = rtl::OString(RTL_CONSTASCII_STRINGPARAM(
+ "# do not delete this line === mkfilter3i\n"));
p_MkLine->bOut = sal_False;
p_MkLine->pPrivateTnrLst = pTnrLst;
pTnrLst = new ByteStringList();
@@ -185,7 +186,7 @@ void MkFilter::Filter()
nState = 0;
bInTnrList = sal_False;
}
- pMkLine->aLine = ByteString( aLineBuf );
+ pMkLine->aLine = rtl::OString(aLineBuf);
pMkLine->bOut = sal_False;
if ( bInTnrList )
@@ -226,7 +227,7 @@ void MkFilter::Filter()
pLine->pPrivateTnrLst = NULL;
}
if ( pLine->bOut )
- fputs(pLine->aLine.GetBuffer(), pOut );
+ fputs(pLine->aLine.getStr(), pOut );
}
fprintf( stderr, "\n" );
}
commit c9894bda18af063c0c564ca7548e1084b7c84ac5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Sep 19 01:43:37 2011 +0100
ByteString->rtl::OStringBuffer
diff --git a/tools/source/fsys/dirent.cxx b/tools/source/fsys/dirent.cxx
index 1561150..151d782 100644
--- a/tools/source/fsys/dirent.cxx
+++ b/tools/source/fsys/dirent.cxx
@@ -1408,18 +1408,23 @@ sal_Bool DirEntry::Find( const String& rPfad, char cDelim )
sal_uInt16 nTokenCount = rPfad.GetTokenCount( cDelim );
sal_Int32 nIndex = 0;
- ByteString aThis = ACCESSDELIM(DEFSTYLE);
- aThis += ByteString(GetFull(), osl_getThreadTextEncoding());
+ rtl::OString aThis = rtl::OStringBuffer()
+ .append(ACCESSDELIM_C(DEFSTYLE))
+ .append(rtl::OUStringToOString(GetFull(),
+ osl_getThreadTextEncoding()))
+ .makeStringAndClear();
for ( sal_uInt16 nToken = 0; nToken < nTokenCount; ++nToken )
{
- ByteString aPath = rtl::OUStringToOString(rPfad, osl_getThreadTextEncoding()).getToken( 0, cDelim, nIndex );
+ rtl::OStringBuffer aPath(rtl::OUStringToOString(rPfad,
+ osl_getThreadTextEncoding()).getToken( 0, cDelim, nIndex ));
- if ( aPath.Len() )
+ if ( aPath.getLength() )
{
- if (aPath.GetChar(aPath.Len()-1)== ACCESSDELIM(DEFSTYLE)[0])
- aPath.Erase(aPath.Len()-1);
- aPath += aThis;
- DirEntry aEntry( String(aPath, osl_getThreadTextEncoding()));
+ if (aPath[aPath.getLength()-1] == ACCESSDELIM_C(DEFSTYLE))
+ aPath.remove(aPath.getLength()-1, 1);
+ aPath.append(aThis);
+ DirEntry aEntry(rtl::OStringToOUString(
+ aPath.makeStringAndClear(), osl_getThreadTextEncoding()));
if ( aEntry.ToAbs() &&
( ( !bWild && aEntry.Exists() ) || ( bWild && aEntry.First() ) ) )
{
commit 4eca665bd1f1dfe884729cc2ef073c1b07a6112e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Sep 19 00:50:11 2011 +0100
ditch SHL_SBX and don't leak
diff --git a/basic/inc/basic/sbxbase.hxx b/basic/inc/basic/sbxbase.hxx
index b136f1f..3dcbfd9 100644
--- a/basic/inc/basic/sbxbase.hxx
+++ b/basic/inc/basic/sbxbase.hxx
@@ -54,7 +54,7 @@ struct SbxAppData
~SbxAppData();
};
-BASIC_DLLPUBLIC SbxAppData* GetSbxData_Impl();
+BASIC_DLLPUBLIC SbxAppData& GetSbxData_Impl();
#endif
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index 0e116c9..79c593e 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -37,6 +37,7 @@
#include <basic/sbxfac.hxx>
#include <basic/sbxbase.hxx>
+#include <rtl/instance.hxx>
#include <rtl/strbuf.hxx>
// AppData-Structure for SBX:
@@ -46,16 +47,14 @@ SV_IMPL_PTRARR(SbxFacs,SbxFactory*);
TYPEINIT0(SbxBase)
-// Request SBX-Data or if necessary create them
-// we just create the area and waive the release!
+namespace
+{
+ class theSbxAppData : public rtl::Static<SbxAppData, theSbxAppData> {};
+}
-SbxAppData* GetSbxData_Impl()
+SbxAppData& GetSbxData_Impl()
{
- SbxAppData** ppData = (SbxAppData**) ::GetAppData( SHL_SBX );
- SbxAppData* p = *ppData;
- if( !p )
- p = *ppData = new SbxAppData;
- return p;
+ return theSbxAppData::get();
}
SbxAppData::~SbxAppData()
@@ -130,51 +129,51 @@ void SbxBase::SetModified( sal_Bool b )
SbxError SbxBase::GetError()
{
- return GetSbxData_Impl()->eSbxError;
+ return GetSbxData_Impl().eSbxError;
}
void SbxBase::SetError( SbxError e )
{
- SbxAppData* p = GetSbxData_Impl();
- if( e && p->eSbxError == SbxERR_OK )
- p->eSbxError = e;
+ SbxAppData& r = GetSbxData_Impl();
+ if( e && r.eSbxError == SbxERR_OK )
+ r.eSbxError = e;
}
sal_Bool SbxBase::IsError()
{
- return sal_Bool( GetSbxData_Impl()->eSbxError != SbxERR_OK );
+ return sal_Bool( GetSbxData_Impl().eSbxError != SbxERR_OK );
}
void SbxBase::ResetError()
{
- GetSbxData_Impl()->eSbxError = SbxERR_OK;
+ GetSbxData_Impl().eSbxError = SbxERR_OK;
}
void SbxBase::AddFactory( SbxFactory* pFac )
{
- SbxAppData* p = GetSbxData_Impl();
+ SbxAppData& r = GetSbxData_Impl();
const SbxFactory* pTemp = pFac;
// From 1996-03-06: take the HandleLast-Flag into account
- sal_uInt16 nPos = p->aFacs.Count(); // Insert position
+ sal_uInt16 nPos = r.aFacs.Count(); // Insert position
if( !pFac->IsHandleLast() ) // Only if not self HandleLast
{
// Rank new factory in front of factories with HandleLast
while( nPos > 0 &&
- (static_cast<SbxFactory*>(p->aFacs.GetObject( nPos-1 )))->IsHandleLast() )
+ (static_cast<SbxFactory*>(r.aFacs.GetObject( nPos-1 )))->IsHandleLast() )
nPos--;
}
- p->aFacs.Insert( pTemp, nPos );
+ r.aFacs.Insert( pTemp, nPos );
}
void SbxBase::RemoveFactory( SbxFactory* pFac )
{
- SbxAppData* p = GetSbxData_Impl();
- for( sal_uInt16 i = 0; i < p->aFacs.Count(); i++ )
+ SbxAppData& r = GetSbxData_Impl();
+ for( sal_uInt16 i = 0; i < r.aFacs.Count(); i++ )
{
- if( p->aFacs.GetObject( i ) == pFac )
+ if( r.aFacs.GetObject( i ) == pFac )
{
- p->aFacs.Remove( i, 1 ); break;
+ r.aFacs.Remove( i, 1 ); break;
}
}
}
@@ -204,11 +203,11 @@ SbxBase* SbxBase::Create( sal_uInt16 nSbxId, sal_uInt32 nCreator )
case SBXID_PROPERTY: return new SbxProperty( aEmptyStr, SbxEMPTY );
}
// Unknown type: go over the factories!
- SbxAppData* p = GetSbxData_Impl();
+ SbxAppData& r = GetSbxData_Impl();
SbxBase* pNew = NULL;
- for( sal_uInt16 i = 0; i < p->aFacs.Count(); i++ )
+ for( sal_uInt16 i = 0; i < r.aFacs.Count(); i++ )
{
- SbxFactory* pFac = p->aFacs.GetObject( i );
+ SbxFactory* pFac = r.aFacs.GetObject( i );
pNew = pFac->Create( nSbxId, nCreator );
if( pNew )
break;
@@ -227,11 +226,11 @@ SbxBase* SbxBase::Create( sal_uInt16 nSbxId, sal_uInt32 nCreator )
SbxObject* SbxBase::CreateObject( const XubString& rClass )
{
- SbxAppData* p = GetSbxData_Impl();
+ SbxAppData& r = GetSbxData_Impl();
SbxObject* pNew = NULL;
- for( sal_uInt16 i = 0; i < p->aFacs.Count(); i++ )
+ for( sal_uInt16 i = 0; i < r.aFacs.Count(); i++ )
{
- pNew = p->aFacs.GetObject( i )->CreateObject( rClass );
+ pNew = r.aFacs.GetObject( i )->CreateObject( rClass );
if( pNew )
break;
}
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 57cc69d..0a127f4 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -850,21 +850,21 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
cvt2:
if( pFmt )
{
- SbxAppData* pData = GetSbxData_Impl();
+ SbxAppData& rAppData = GetSbxData_Impl();
LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
- if( pData->pBasicFormater )
+ if( rAppData.pBasicFormater )
{
- if( pData->eBasicFormaterLangType != eLangType )
+ if( rAppData.eBasicFormaterLangType != eLangType )
{
- delete pData->pBasicFormater;
- pData->pBasicFormater = NULL;
+ delete rAppData.pBasicFormater;
+ rAppData.pBasicFormater = NULL;
}
}
- pData->eBasicFormaterLangType = eLangType;
+ rAppData.eBasicFormaterLangType = eLangType;
- if( !pData->pBasicFormater )
+ if( !rAppData.pBasicFormater )
{
SvtSysLocale aSysLocale;
const LocaleDataWrapper& rData = aSysLocale.GetLocaleData();
@@ -890,7 +890,7 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
String aCurrencyFormatStrg = String( SbxValueFormatResId(
STR_BASICKEY_FORMAT_CURRENCY) );
- pData->pBasicFormater
+ rAppData.pBasicFormater
= new SbxBasicFormater( cComma,c1000,aOnStrg,aOffStrg,
aYesStrg,aNoStrg,aTrueStrg,aFalseStrg,
aCurrencyStrg,aCurrencyFormatStrg );
@@ -904,14 +904,14 @@ void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const
// here are problems with ;;;Null because this method is only
// called, if SbxValue is a number!!!
- // in addition pData->pBasicFormater->BasicFormatNull( *pFmt ); could be called!
+ // in addition rAppData.pBasicFormater->BasicFormatNull( *pFmt ); could be called!
if( eType != SbxNULL )
{
- rRes = pData->pBasicFormater->BasicFormat( d ,*pFmt );
+ rRes = rAppData.pBasicFormater->BasicFormat( d ,*pFmt );
}
else
{
- rRes = pData->pBasicFormater->BasicFormatNull( *pFmt );
+ rRes = rAppData.pBasicFormater->BasicFormatNull( *pFmt );
}
}
diff --git a/tools/inc/tools/shl.hxx b/tools/inc/tools/shl.hxx
index aeda54d..9d24a15 100644
--- a/tools/inc/tools/shl.hxx
+++ b/tools/inc/tools/shl.hxx
@@ -63,7 +63,7 @@
//24 (SHL_HELP) removed
//25 (SHL_LNKCCH) removed
//26 (SHL_CHANNEL) removed
-#define SHL_SBX 27
+//27 (SHL_SBX) removed
#define SHL_SBC 28
//29 (SHL_SDB) removed
//30 (SHL_SBA) removed
commit 2b7fdc51dc418ac4d9719ece12d383a6661df1cd
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 23:57:36 2011 +0100
shrink ByteString api
diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx
index 54f4f88..d976207 100644
--- a/tools/inc/tools/string.hxx
+++ b/tools/inc/tools/string.hxx
@@ -163,6 +163,7 @@ private:
ByteString( const int* pDummy ); // not implemented: to prevent ByteString( NULL )
ByteString(int); // not implemented; to detect misuses
// of ByteString(sal_Char);
+ ByteString( sal_Char c ); //not implemented
ByteString( const UniString& rUniStr, xub_StrLen nPos, xub_StrLen nLen,
rtl_TextEncoding eTextEncoding,
sal_uInt32 nCvtFlags = UNISTRING_TO_BYTESTRING_CVTFLAGS ); //not implemented, to detect use of removed methods without compiler making something to fit
@@ -185,7 +186,6 @@ public:
ByteString( const rtl::OString& rStr );
ByteString( const sal_Char* pCharStr );
ByteString( const sal_Char* pCharStr, xub_StrLen nLen );
- ByteString( sal_Char c );
ByteString( const UniString& rUniStr,
rtl_TextEncoding eTextEncoding,
sal_uInt32 nCvtFlags = UNISTRING_TO_BYTESTRING_CVTFLAGS );
diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx
index b83b39c..da98a85 100644
--- a/tools/source/string/strimp.cxx
+++ b/tools/source/string/strimp.cxx
@@ -326,18 +326,6 @@ STRING::STRING( const STRCODE* pCharStr, xub_StrLen nLen )
// -----------------------------------------------------------------------
-STRING::STRING( STRCODE c )
-{
- DBG_CTOR( STRING, DBGCHECKSTRING );
- DBG_ASSERT( c, "String::String() - c is 0" );
-
- // Verwaltungsdaten anlegen und initialisieren
- mpData = ImplAllocData( 1 );
- mpData->maStr[0] = c;
-}
-
-// -----------------------------------------------------------------------
-
STRING::~STRING()
{
DBG_DTOR( STRING, DBGCHECKSTRING );
diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx
index 30c973e..30a0fd5 100644
--- a/tools/source/string/tustring.cxx
+++ b/tools/source/string/tustring.cxx
@@ -564,4 +564,16 @@ STRCODE* STRING::AllocBuffer( xub_StrLen nLen )
return mpData->maStr;
}
+// -----------------------------------------------------------------------
+
+STRING::STRING( STRCODE c )
+{
+ DBG_CTOR( STRING, DBGCHECKSTRING );
+ DBG_ASSERT( c, "String::String() - c is 0" );
+
+ // Verwaltungsdaten anlegen und initialisieren
+ mpData = ImplAllocData( 1 );
+ mpData->maStr[0] = c;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 4ca4cd66694b553717f7540b9c247e77c0e8fe56
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 23:54:34 2011 +0100
ByteString->rtl::OString[Buffer]
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index 547cd6f..01dcebf 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -945,9 +945,9 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt,
// The align=... attribute does behave strange in netscape
// if there are controls in a paragraph, because the control and
// all text behind the control does not recognize this attribute.
- ByteString sOut( '<' );
- sOut += OOO_STRING_SVTOOLS_HTML_division;
- rWrt.Strm() << sOut.GetBuffer();
+ rtl::OStringBuffer sOut;
+ sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_division);
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
rHWrt.bTxtAttr = sal_False;
rHWrt.bOutOpts = sal_True;
@@ -1024,31 +1024,28 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt,
rHWrt.bTxtAttr = sal_False;
rHWrt.bOutOpts = sal_True;
- ByteString sOut( '<' );
- sOut += aToken;
+ rtl::OStringBuffer sOut;
+ sOut.append('<').append(aToken);
if( eLang != LANGUAGE_DONTKNOW && eLang != rHWrt.eLang )
{
- rWrt.Strm() << sOut.GetBuffer();
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
rHWrt.OutLanguage( eLang );
- sOut.Erase();
}
if( nDir != rHWrt.nDirection )
{
- if( sOut.Len() )
- {
- rWrt.Strm() << sOut.GetBuffer();
- sOut.Erase();
- }
+ if( sOut.getLength() )
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
rHWrt.OutDirection( nDir );
}
if( rHWrt.bCfgOutStyles &&
(pFmtInfo->aClass.Len() || pFmtInfo->bScriptDependent) )
{
- ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_class) += "=\"";
- rWrt.Strm() << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_class)
+ .append("=\"");
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
String aClass( pFmtInfo->aClass );
if( pFmtInfo->bScriptDependent )
{
@@ -1069,9 +1066,9 @@ void OutHTML_SwFmt( Writer& rWrt, const SwFmt& rFmt,
}
HTMLOutFuncs::Out_String( rWrt.Strm(), aClass,
rHWrt.eDestEnc, &rHWrt.aNonConvertableCharacters );
- sOut = '\"';
+ sOut.append('\"');
}
- rWrt.Strm() << sOut.GetBuffer();
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
// ggf. Ausrichtung ausgeben.
if( !rHWrt.bNoAlign && pAdjItem )
@@ -2194,13 +2191,13 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode )
rHTMLWrt.bLFPossible = sal_True;
- ByteString sOut( '<' );
- sOut += OOO_STRING_SVTOOLS_HTML_horzrule;
+ rtl::OStringBuffer sOut;
+ sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_horzrule);
const SfxItemSet* pItemSet = pNd->GetpSwAttrSet();
if( !pItemSet )
{
- rWrt.Strm() << sOut.GetBuffer() << '>';
+ rWrt.Strm() << sOut.makeStringAndClear().getStr() << '>';
return rHTMLWrt;
}
const SfxPoolItem* pItem;
@@ -2231,20 +2228,22 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode )
nPageWidth = pBox->GetFrmFmt()->GetFrmSize().GetWidth();
}
- ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_width) += '=';
- rWrt.Strm() << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_width)
+ .append('=');
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
rWrt.OutULong( rHTMLWrt.ToPixel(nPageWidth-nLeft-nRight) );
- ((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_align) += '=';
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_align)
+ .append('=');
if( !nLeft )
- sOut += OOO_STRING_SVTOOLS_HTML_AL_left;
+ sOut.append(OOO_STRING_SVTOOLS_HTML_AL_left);
else if( !nRight )
- sOut += OOO_STRING_SVTOOLS_HTML_AL_right;
+ sOut.append(OOO_STRING_SVTOOLS_HTML_AL_right);
else
- sOut += OOO_STRING_SVTOOLS_HTML_AL_center;
+ sOut.append(OOO_STRING_SVTOOLS_HTML_AL_center);
}
}
- rWrt.Strm() << sOut.GetBuffer();
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
if( SFX_ITEM_SET == pItemSet->GetItemState( RES_BOX, sal_False, &pItem ))
{
const SvxBoxItem* pBoxItem = (const SvxBoxItem*)pItem;
@@ -2254,23 +2253,25 @@ Writer& OutHTML_SwTxtNode( Writer& rWrt, const SwCntntNode& rNode )
sal_uInt16 nWidth = pBorderLine->GetOutWidth() +
pBorderLine->GetInWidth() +
pBorderLine->GetDistance();
- ((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_size) += '=';
- rWrt.Strm() << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_size)
+ .append('=');
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
rWrt.OutULong( rHTMLWrt.ToPixel(nWidth) );
const Color& rBorderColor = pBorderLine->GetColor();
if( !rBorderColor.IsRGBEqual( Color(COL_GRAY) ) )
{
- ((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_color) += '=';
- rWrt.Strm() << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_color)
+ .append('=');
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
HTMLOutFuncs::Out_Color( rWrt.Strm(), rBorderColor,
rHTMLWrt.eDestEnc );
}
if( !pBorderLine->GetInWidth() )
{
- (sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_noshade;
- rWrt.Strm() << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_noshade);
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
}
}
}
@@ -2796,9 +2797,10 @@ static Writer& OutHTML_SvxColor( Writer& rWrt, const SfxPoolItem& rHt )
if( COL_AUTO == aColor.GetColor() )
aColor.SetColor( COL_BLACK );
- ByteString sOut( '<' );
- (((sOut += OOO_STRING_SVTOOLS_HTML_font) += ' ') += OOO_STRING_SVTOOLS_HTML_O_color) += '=';
- rWrt.Strm() << sOut.GetBuffer();
+ rtl::OStringBuffer sOut;
+ sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_font).append(' ')
+ .append(OOO_STRING_SVTOOLS_HTML_O_color).append('=');
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
HTMLOutFuncs::Out_Color( rWrt.Strm(), aColor, rHTMLWrt.eDestEnc ) << '>';
}
else
@@ -2839,9 +2841,10 @@ static Writer& OutHTML_SvxFont( Writer& rWrt, const SfxPoolItem& rHt )
String aNames;
SwHTMLWriter::PrepareFontList( ((const SvxFontItem&)rHt), aNames, 0,
rHTMLWrt.IsHTMLMode(HTMLMODE_FONT_GENERIC) );
- ByteString sOut( '<' );
- (((sOut += OOO_STRING_SVTOOLS_HTML_font) += ' ') += OOO_STRING_SVTOOLS_HTML_O_face) += "=\"";
- rWrt.Strm() << sOut.GetBuffer();
+ rtl::OStringBuffer sOut;
+ sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_font).append(' ')
+ .append(OOO_STRING_SVTOOLS_HTML_O_face).append("=\"");
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
HTMLOutFuncs::Out_String( rWrt.Strm(), aNames, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters )
<< "\">";
}
@@ -2897,9 +2900,9 @@ static Writer& OutHTML_SvxLanguage( Writer& rWrt, const SfxPoolItem& rHt )
if( rHTMLWrt.bTagOn )
{
- ByteString sOut( '<' );
- sOut += OOO_STRING_SVTOOLS_HTML_span;
- rWrt.Strm() << sOut.GetBuffer();
+ rtl::OStringBuffer sOut;
+ sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_span);
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
rHTMLWrt.OutLanguage( ((const SvxLanguageItem &)rHt).GetLanguage() );
rWrt.Strm() << '>';
}
@@ -3062,8 +3065,8 @@ Writer& OutHTML_INetFmt( Writer& rWrt, const SwFmtINetFmt& rINetFmt, sal_Bool bO
return rWrt;
}
- ByteString sOut( '<' );
- sOut += OOO_STRING_SVTOOLS_HTML_anchor;
+ rtl::OStringBuffer sOut;
+ sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_anchor);
sal_Bool bScriptDependent = sal_False;
{
@@ -3090,23 +3093,23 @@ Writer& OutHTML_INetFmt( Writer& rWrt, const SwFmtINetFmt& rINetFmt, sal_Bool bO
if( bScriptDependent )
{
- ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_class) += "=\"";
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_class).append("=\"");
switch( rHTMLWrt.nCSS1Script )
{
case CSS1_OUTMODE_WESTERN:
- sOut += "western";
+ sOut.append("western");
break;
case CSS1_OUTMODE_CJK:
- sOut += "cjk";
+ sOut.append("cjk");
break;
case CSS1_OUTMODE_CTL:
- sOut += "ctl";
+ sOut.append("ctl");
break;
}
- sOut += '\"';
+ sOut.append('\"');
}
- rWrt.Strm() << sOut.GetBuffer();
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
String sRel;
@@ -3122,37 +3125,35 @@ Writer& OutHTML_INetFmt( Writer& rWrt, const SwFmtINetFmt& rINetFmt, sal_Bool bO
}
aURL.EraseLeadingChars().EraseTrailingChars();
- ((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_href) += "=\"";
- rWrt.Strm() << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_href).append("=\"");
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
rHTMLWrt.OutHyperlinkHRefValue( aURL );
- sOut = '\"';
+ sOut.append('\"');
}
- else
- sOut.Erase();
if( rINetFmt.GetName().Len() )
{
- ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_name) += "=\"";
- rWrt.Strm() << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_name).append("=\"");
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
HTMLOutFuncs::Out_String( rWrt.Strm(), rINetFmt.GetName(),
rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters );
- sOut = '\"';
+ sOut.append('\"');
}
const String& rTarget = rINetFmt.GetTargetFrame();
if( rTarget.Len() )
{
- ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_target) += "=\"";
- rWrt.Strm() << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_target).append("=\"");
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
HTMLOutFuncs::Out_String( rWrt.Strm(), rTarget, rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters );
- sOut = '\"';
+ sOut.append('\"');
}
if( sRel.Len() )
- sOut += ByteString( sRel, RTL_TEXTENCODING_ASCII_US );
+ sOut.append(rtl::OUStringToOString(sRel, RTL_TEXTENCODING_ASCII_US));
- if( sOut.Len() )
- rWrt.Strm() << sOut.GetBuffer();
+ if( sOut.getLength() )
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
if( bEvents )
HTMLOutFuncs::Out_Events( rWrt.Strm(), *pMacTable, aAnchorEventTable,
@@ -3243,16 +3244,18 @@ static Writer& OutHTML_SwTxtCharFmt( Writer& rWrt, const SfxPoolItem& rHt )
if( rHTMLWrt.bTagOn )
{
- ByteString sOut( '<' );
+ rtl::OStringBuffer sOut;
+ sOut.append('<');
if( pFmtInfo->aToken.Len() > 0 )
- sOut += pFmtInfo->aToken;
+ sOut.append(pFmtInfo->aToken);
else
- sOut += OOO_STRING_SVTOOLS_HTML_span;
+ sOut.append(OOO_STRING_SVTOOLS_HTML_span);
if( rHTMLWrt.bCfgOutStyles &&
(pFmtInfo->aClass.Len() || pFmtInfo->bScriptDependent) )
{
- ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_class) += "=\"";
- rWrt.Strm() << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_class)
+ .append("=\"");
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
String aClass( pFmtInfo->aClass );
if( pFmtInfo->bScriptDependent )
{
@@ -3273,10 +3276,10 @@ static Writer& OutHTML_SwTxtCharFmt( Writer& rWrt, const SfxPoolItem& rHt )
}
HTMLOutFuncs::Out_String( rWrt.Strm(), aClass,
rHTMLWrt.eDestEnc, &rHTMLWrt.aNonConvertableCharacters );
- sOut = '\"';
+ sOut.append('\"');
}
- sOut += '>';
- rWrt.Strm() << sOut.GetBuffer();
+ sOut.append('>');
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
}
else
{
@@ -3308,9 +3311,10 @@ static Writer& OutHTML_SvxAdjust( Writer& rWrt, const SfxPoolItem& rHt )
}
if( pStr )
{
- ByteString sOut( ' ' );
- ((sOut += OOO_STRING_SVTOOLS_HTML_O_align) += '=') += pStr;
- rWrt.Strm() << sOut.GetBuffer();
+ rtl::OStringBuffer sOut;
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_align).append('=')
+ .append(pStr);
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
}
return rWrt;
diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index 81a4e64..b307704 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -203,26 +203,35 @@ void lcl_html_outEvents( SvStream& rStrm,
}
}
- ByteString sOut( ' ' );
+ rtl::OStringBuffer sOut;
+ sOut.append(' ');
if( pOpt && (EXTENDED_STYPE != eScriptType ||
!pDescs[i].AddListenerParam.getLength()) )
- sOut += pOpt;
+ sOut.append(pOpt);
else
- (((sOut += OOO_STRING_SVTOOLS_HTML_O_sdevent)
- += ByteString( sListener, RTL_TEXTENCODING_ASCII_US)) += '-')
- += ByteString( sMethod, RTL_TEXTENCODING_ASCII_US);
- sOut += "=\"";
- rStrm << sOut.GetBuffer();
+ {
+ sOut.append(OOO_STRING_SVTOOLS_HTML_O_sdevent)
+ .append(rtl::OUStringToOString(sListener,
+ RTL_TEXTENCODING_ASCII_US))
+ .append('-')
+ .append(rtl::OUStringToOString(sMethod,
+ RTL_TEXTENCODING_ASCII_US));
+ }
+ sOut.append("=\"");
+ rStrm << sOut.makeStringAndClear().getStr();
HTMLOutFuncs::Out_String( rStrm, pDescs[i].ScriptCode, eDestEnc, pNonConvertableChars );
rStrm << '\"';
if( EXTENDED_STYPE == eScriptType &&
pDescs[i].AddListenerParam.getLength() )
{
- (((((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_sdaddparam)
- += ByteString( sListener, RTL_TEXTENCODING_ASCII_US)) += '-')
- += ByteString( sMethod, RTL_TEXTENCODING_ASCII_US))
- += "=\"";
- rStrm << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_sdaddparam)
+ .append(rtl::OUStringToOString(sListener,
+ RTL_TEXTENCODING_ASCII_US))
+ .append('-')
+ .append(rtl::OUStringToOString(sMethod,
+ RTL_TEXTENCODING_ASCII_US))
+ .append("=\"");
+ rStrm << sOut.makeStringAndClear().getStr();
HTMLOutFuncs::Out_String( rStrm, pDescs[i].AddListenerParam,
eDestEnc, pNonConvertableChars );
rStrm << '\"';
@@ -499,8 +508,8 @@ void SwHTMLWriter::OutForm( sal_Bool bOn,
// die neue Form wird geoeffnet
if( bLFPossible )
OutNewLine();
- ByteString sOut( '<' );
- sOut += OOO_STRING_SVTOOLS_HTML_form;
+ rtl::OStringBuffer sOut;
+ sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_form);
uno::Reference< beans::XPropertySet > xFormPropSet( rFormComps, uno::UNO_QUERY );
@@ -509,11 +518,11 @@ void SwHTMLWriter::OutForm( sal_Bool bOn,
if( aTmp.getValueType() == ::getCppuType((const OUString*)0) &&
((OUString*)aTmp.getValue())->getLength() )
{
- ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_name) += "=\"";
- Strm() << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_name).append("=\"");
+ Strm() << sOut.makeStringAndClear().getStr();
HTMLOutFuncs::Out_String( Strm(), *(OUString*)aTmp.getValue(),
eDestEnc, &aNonConvertableCharacters );
- sOut = '\"';
+ sOut.append('\"');
}
aTmp = xFormPropSet->getPropertyValue(
@@ -521,12 +530,12 @@ void SwHTMLWriter::OutForm( sal_Bool bOn,
if( aTmp.getValueType() == ::getCppuType((const OUString*)0) &&
((OUString*)aTmp.getValue())->getLength() )
{
- ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_action) += "=\"";
- Strm() << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_action).append("=\"");
+ Strm() << sOut.makeStringAndClear().getStr();
String aURL( *(OUString*)aTmp.getValue() );
aURL = URIHelper::simpleNormalizedMakeRelative( GetBaseURL(), aURL);
HTMLOutFuncs::Out_String( Strm(), aURL, eDestEnc, &aNonConvertableCharacters );
- sOut = '\"';
+ sOut.append('\"');
}
aTmp = xFormPropSet->getPropertyValue(
@@ -537,9 +546,9 @@ void SwHTMLWriter::OutForm( sal_Bool bOn,
*( form::FormSubmitMethod*)aTmp.getValue();
if( form::FormSubmitMethod_POST==eMethod )
{
- ((((sOut += ' ')
- += OOO_STRING_SVTOOLS_HTML_O_method) += "=\"")
- += OOO_STRING_SVTOOLS_HTML_METHOD_post) += '\"';
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_method)
+ .append("=\"").append(OOO_STRING_SVTOOLS_HTML_METHOD_post)
+ .append('\"');
}
}
aTmp = xFormPropSet->getPropertyValue(
@@ -563,9 +572,8 @@ void SwHTMLWriter::OutForm( sal_Bool bOn,
if( pStr )
{
- ((((sOut += ' ')
- += OOO_STRING_SVTOOLS_HTML_O_enctype) += "=\"")
- += pStr) += '\"';
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_enctype)
+ .append("=\"").append(pStr).append('\"');
}
}
@@ -574,14 +582,14 @@ void SwHTMLWriter::OutForm( sal_Bool bOn,
if( aTmp.getValueType() == ::getCppuType((const OUString*)0)&&
((OUString*)aTmp.getValue())->getLength() )
{
- ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_target) += "=\"";
- Strm() << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_target).append("=\"");
+ Strm() << sOut.makeStringAndClear().getStr();
HTMLOutFuncs::Out_String( Strm(), *(OUString*)aTmp.getValue(),
eDestEnc, &aNonConvertableCharacters );
- sOut = '\"';
+ sOut.append('\"');
}
- Strm() << sOut.GetBuffer();
+ Strm() << sOut.makeStringAndClear().getStr();
uno::Reference< form::XFormComponent > xFormComp( rFormComps, uno::UNO_QUERY );
lcl_html_outEvents( Strm(), xFormComp, bCfgStarBasic, eDestEnc, &aNonConvertableCharacters );
Strm() << '>';
@@ -639,34 +647,37 @@ void SwHTMLWriter::OutHiddenControls(
{
if( bLFPossible )
OutNewLine( sal_True );
- ByteString sOut( '<' );
- ((((sOut += OOO_STRING_SVTOOLS_HTML_input) += ' ') +=
- OOO_STRING_SVTOOLS_HTML_O_type) += '=') += OOO_STRING_SVTOOLS_HTML_IT_hidden;
+ rtl::OStringBuffer sOut;
+ sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_input).append(' ')
+ .append(OOO_STRING_SVTOOLS_HTML_O_type).append('=')
+ .append(OOO_STRING_SVTOOLS_HTML_IT_hidden);
aTmp = xPropSet->getPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("Name")) );
if( aTmp.getValueType() == ::getCppuType((const OUString*)0) &&
((OUString*)aTmp.getValue())->getLength() )
{
- (( sOut += ' ' ) += OOO_STRING_SVTOOLS_HTML_O_name ) += "=\"";
- Strm() << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_name)
+ .append("=\"");
+ Strm() << sOut.makeStringAndClear().getStr();
HTMLOutFuncs::Out_String( Strm(), *(OUString*)aTmp.getValue(),
eDestEnc, &aNonConvertableCharacters );
- sOut = '\"';
+ sOut.append('\"');
}
aTmp = xPropSet->getPropertyValue(
OUString(RTL_CONSTASCII_USTRINGPARAM("HiddenValue")) );
if( aTmp.getValueType() == ::getCppuType((const OUString*)0) &&
((OUString*)aTmp.getValue())->getLength() )
{
- ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_value) += "=\"";
- Strm() << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_value)
+ .append("=\"");
+ Strm() << sOut.makeStringAndClear().getStr();
HTMLOutFuncs::Out_String( Strm(), *(OUString*)aTmp.getValue(),
eDestEnc, &aNonConvertableCharacters );
- sOut = '\"';
+ sOut.append('\"');
}
- sOut += '>';
- Strm() << sOut.GetBuffer();
+ sOut.append('>');
+ Strm() << sOut.makeStringAndClear().getStr();
nFormCntrlCnt++;
}
diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx
index 184f1f2..ecb6aee 100644
--- a/sw/source/filter/html/htmltabw.cxx
+++ b/sw/source/filter/html/htmltabw.cxx
@@ -561,10 +561,10 @@ void SwHTMLWrtTable::OutTableCells( SwHTMLWriter& rWrt,
if( text::VertOrientation::TOP==eRowVertOri || text::VertOrientation::BOTTOM==eRowVertOri )
{
- ByteString sOut( ' ' );
- ((sOut += OOO_STRING_SVTOOLS_HTML_O_valign) += '=')
- += (text::VertOrientation::TOP==eRowVertOri ? OOO_STRING_SVTOOLS_HTML_VA_top : OOO_STRING_SVTOOLS_HTML_VA_bottom);
- rWrt.Strm() << sOut.GetBuffer();
+ rtl::OStringBuffer sOut;
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_valign)
+ .append('=').append(text::VertOrientation::TOP==eRowVertOri ? OOO_STRING_SVTOOLS_HTML_VA_top : OOO_STRING_SVTOOLS_HTML_VA_bottom);
+ rWrt.Strm() << sOut.makeStringAndClear().getStr();
}
rWrt.Strm() << '>';
diff --git a/sw/source/filter/ww1/w1class.cxx b/sw/source/filter/ww1/w1class.cxx
index 2e826e3..6c38beb 100644
--- a/sw/source/filter/ww1/w1class.cxx
+++ b/sw/source/filter/ww1/w1class.cxx
@@ -29,10 +29,10 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_sw.hxx"
-
#include <string.h>
+#include <rtl/strbuf.hxx>
+#include <rtl/ustring.hxx>
#include <tools/stream.hxx>
-
#include <w1class.hxx>
@@ -1041,12 +1041,13 @@ Ww1Assoc::Ww1Assoc(Ww1Fib& _rFib)
String Ww1Assoc::GetStr(sal_uInt16 code)
{
- String sRet;
+ rtl::OStringBuffer sRet;
OSL_ENSURE(code<MaxFields, "out of range");
if (pStrTbl[code] != NULL)
for( sal_uInt16 i=0;i<pStrTbl[code][0];i++ )
- sRet += String( pStrTbl[code][i+1], RTL_TEXTENCODING_MS_1252 );
- return sRet;
+ sRet.append(pStrTbl[code][i+1]);
+ return rtl::OStringToOUString(sRet.makeStringAndClear(),
+ RTL_TEXTENCODING_MS_1252);
}
/////////////////////////////////////////////////////////////////// Pap
commit 8c4d2ee8cb2b1950be02aed6cf5d4a4d1c5d6e32
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 23:13:40 2011 +0100
ByteString->rtl::OString[Buffer]
diff --git a/tools/source/fsys/dirent.cxx b/tools/source/fsys/dirent.cxx
index 6666aa3..1561150 100644
--- a/tools/source/fsys/dirent.cxx
+++ b/tools/source/fsys/dirent.cxx
@@ -345,9 +345,9 @@ ByteString ImplCutPath( const ByteString& rStr, sal_uInt16 nMax, char cAccDel )
if ( bInsertPrefix )
{
- ByteString aIns( cAccDel );
- aIns += "...";
- aCutPath.Insert( aIns, nBegin );
+ rtl::OStringBuffer aIns;
+ aIns.append(cAccDel).append(RTL_CONSTASCII_STRINGPARAM("..."));
+ aCutPath.Insert(ByteString(aIns.makeStringAndClear()), nBegin);
}
return aCutPath;
@@ -1373,13 +1373,13 @@ void DirEntry::SetName( const String& rName, FSysPathStyle eFormatter )
{
DBG_CHKTHIS( DirEntry, ImpCheckDirEntry );
- if ( eFormatter == FSYS_STYLE_HOST || eFormatter == FSYS_STYLE_DETECT )
+ if ( eFormatter == FSYS_STYLE_HOST || eFormatter == FSYS_STYLE_DETECT )
eFormatter = DEFSTYLE;
- ByteString aAccDelim( ACCESSDELIM_C( eFormatter ) );
+ sal_Char cAccDelim(ACCESSDELIM_C(eFormatter));
if ( (eFlag != FSYS_FLAG_NORMAL) ||
(aName.Search( ':' ) != STRING_NOTFOUND) ||
- (aName.Search( aAccDelim ) != STRING_NOTFOUND) )
+ (aName.Search( cAccDelim ) != STRING_NOTFOUND) )
{
eFlag = FSYS_FLAG_INVALID;
}
commit 8004d2d6f516e4dfb1b0b37e257c90249b77f08d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 23:12:50 2011 +0100
ByteString->rtl::OString[Buffer]
diff --git a/rsc/inc/rscall.h b/rsc/inc/rscall.h
index fed155c..6d33911 100644
--- a/rsc/inc/rscall.h
+++ b/rsc/inc/rscall.h
@@ -45,12 +45,12 @@ class RscTypCont;
class RscIncList;
/******************* G l o b a l V a r i a b l e s *********************/
-extern ByteString* pStdParType;
-extern ByteString* pStdPar1;
-extern ByteString* pStdPar2;
-extern ByteString* pWinParType;
-extern ByteString* pWinPar1;
-extern ByteString* pWinPar2;
+extern rtl::OString* pStdParType;
+extern rtl::OString* pStdPar1;
+extern rtl::OString* pStdPar2;
+extern rtl::OString* pWinParType;
+extern rtl::OString* pWinPar1;
+extern rtl::OString* pWinPar2;
extern sal_uInt32 nRefDeep;
extern sal_uInt32 nRsc_XYMAPMODEId;
extern sal_uInt32 nRsc_WHMAPMODEId;
diff --git a/rsc/source/prj/start.cxx b/rsc/source/prj/start.cxx
index be08525..7891139 100644
--- a/rsc/source/prj/start.cxx
+++ b/rsc/source/prj/start.cxx
@@ -47,6 +47,7 @@
#include <rsctools.hxx>
#include <rscerror.h>
#include <sal/main.h>
+#include <rtl/strbuf.hxx>
#include <tools/fsys.hxx>
/*************** C O D E ************************************************/
@@ -119,9 +120,9 @@ static sal_Bool CallPrePro( const ByteString& rInput,
if( fRspFile )
{
aRespCmdL.Append( rsc_strdup( "rscpp" ) );
- ByteString aTmpStr( '@' );
- aTmpStr += aRspFileName;
- aRespCmdL.Append( rsc_strdup( aTmpStr.GetBuffer() ) );
+ rtl::OStringBuffer aTmpStr;
+ aTmpStr.append('@').append(aRspFileName);
+ aRespCmdL.Append( rsc_strdup( aTmpStr.getStr() ) );
aRespCmdL.Append( (void *)0 );
pCmdL = &aRespCmdL;
diff --git a/rsc/source/res/rscall.cxx b/rsc/source/res/rscall.cxx
index 26193d4..62ff125 100644
--- a/rsc/source/res/rscall.cxx
+++ b/rsc/source/res/rscall.cxx
@@ -50,13 +50,17 @@ Atom nRsc_EXTRADATA = InvalidAtom;
void InitRscCompiler()
{
- pStdParType = new ByteString( "( const ResId & rResId, sal_Bool" );
- pStdPar1 = new ByteString( '(' );
- pStdPar2 = new ByteString( '(' );
+ pStdParType = new rtl::OString(RTL_CONSTASCII_STRINGPARAM(
+ "( const ResId & rResId, sal_Bool"));
+ pStdPar1 = new rtl::OString('(');
+ pStdPar2 = new rtl::OString('(');
- pWinParType = new ByteString( "( Window * pParent, const ResId & rResId, sal_Bool" );
- pWinPar1 = new ByteString( "( pParent," );
- pWinPar2 = new ByteString( "( this," );
+ pWinParType = new rtl::OString(RTL_CONSTASCII_STRINGPARAM(
+ "( Window * pParent, const ResId & rResId, sal_Bool"));
+ pWinPar1 = new rtl::OString(RTL_CONSTASCII_STRINGPARAM(
+ "( pParent,"));
+ pWinPar2 = new rtl::OString(RTL_CONSTASCII_STRINGPARAM(
+ "( this,"));
nRefDeep = 10;
nRsc_XYMAPMODEId = InvalidAtom;
nRsc_WHMAPMODEId = InvalidAtom;
diff --git a/rsc/source/rsc/rsc.cxx b/rsc/source/rsc/rsc.cxx
index fc972c4..e026b04 100644
--- a/rsc/source/rsc/rsc.cxx
+++ b/rsc/source/rsc/rsc.cxx
@@ -79,12 +79,12 @@ using comphelper::string::getToken;
/*************** F o r w a r d s *****************************************/
/*************** G l o b a l e V a r i a b l e n **********************/
-ByteString* pStdParType = NULL;
-ByteString* pStdPar1 = NULL;
-ByteString* pStdPar2 = NULL;
-ByteString* pWinParType = NULL;
-ByteString* pWinPar1 = NULL;
-ByteString* pWinPar2 = NULL;
+rtl::OString* pStdParType = NULL;
+rtl::OString* pStdPar1 = NULL;
+rtl::OString* pStdPar2 = NULL;
+rtl::OString* pWinParType = NULL;
+rtl::OString* pWinPar1 = NULL;
+rtl::OString* pWinPar2 = NULL;
sal_uInt32 nRefDeep = 10;
AtomContainer* pHS = NULL;
commit 2d4db01597c2b2df64aaa7ccbe42ed587faba838
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 23:12:14 2011 +0100
ByteString->rtl::OString
diff --git a/idl/inc/database.hxx b/idl/inc/database.hxx
index c8ad5cf..80685e3 100644
--- a/idl/inc/database.hxx
+++ b/idl/inc/database.hxx
@@ -123,7 +123,7 @@ public:
const String & GetPath() const { return aPath; }
SvMetaObjectMemberStack & GetStack() { return aContextStack; }
- void Write( const ByteString & rText );
+ void Write(const rtl::OString& rText);
void WriteError( const ByteString & rErrWrn,
const ByteString & rFileName,
const rtl::OString& rErrorText,
diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx
index 8308d50..a393ee1 100644
--- a/idl/source/objects/object.cxx
+++ b/idl/source/objects/object.cxx
@@ -309,7 +309,7 @@ sal_Bool SvMetaClass::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
}
if( bOk )
{
- rBase.Write( '.' );
+ rBase.Write(rtl::OString('.'));
bOk = SvMetaName::ReadSvIdl( rBase, rInStm );
}
if( bOk )
diff --git a/idl/source/objects/types.cxx b/idl/source/objects/types.cxx
index d57d3cb..625b066 100644
--- a/idl/source/objects/types.cxx
+++ b/idl/source/objects/types.cxx
@@ -1125,7 +1125,7 @@ sal_Bool SvMetaType::ReadSvIdl( SvIdlDataBase & rBase,
{
if( ReadHeaderSvIdl( rBase, rInStm ) )
{
- rBase.Write( '.' );
+ rBase.Write(rtl::OString('.'));
return SvMetaExtern::ReadSvIdl( rBase, rInStm );
}
return sal_False;
diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx
index fa37d2d..5761a45 100644
--- a/idl/source/prj/database.cxx
+++ b/idl/source/prj/database.cxx
@@ -534,10 +534,10 @@ SvMetaClass * SvIdlDataBase::ReadKnownClass( SvTokenStream & rInStm )
return NULL;
}
-void SvIdlDataBase::Write( const ByteString & rText )
+void SvIdlDataBase::Write(const rtl::OString& rText)
{
if( nVerbosity != 0 )
- fprintf( stdout, "%s", rText.GetBuffer() );
+ fprintf( stdout, "%s", rText.getStr() );
}
void SvIdlDataBase::WriteError( const ByteString & rErrWrn,
commit 5bc9435b02b0f3993624a5110b8b47c82da00b1e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 23:11:53 2011 +0100
ByteString->rtl::OString[Buffer]
diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index 60c683e..b1670e2 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 ba6cda8..8fa37a3 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++ )
commit 74b9af497aff9d6cdb3bfee1575a7932f26b2a78
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 22:44:19 2011 +0100
ByteString->rtl::OStringBuffer
diff --git a/sfx2/source/bastyp/frmhtmlw.cxx b/sfx2/source/bastyp/frmhtmlw.cxx
index dcbefab..2451d10 100644
--- a/sfx2/source/bastyp/frmhtmlw.cxx
+++ b/sfx2/source/bastyp/frmhtmlw.cxx
@@ -85,15 +85,15 @@ void SfxFrameHTMLWriter::OutMeta( SvStream& rStrm,
if( pIndent )
rStrm << pIndent;
- ByteString sOut( '<' );
- (((sOut += OOO_STRING_SVTOOLS_HTML_meta) += ' ')
- += (bHTTPEquiv ? OOO_STRING_SVTOOLS_HTML_O_httpequiv : OOO_STRING_SVTOOLS_HTML_O_name)) += "=\"";
- rStrm << sOut.GetBuffer();
+ rtl::OStringBuffer sOut;
+ sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_meta).append(' ')
+ .append(bHTTPEquiv ? OOO_STRING_SVTOOLS_HTML_O_httpequiv : OOO_STRING_SVTOOLS_HTML_O_name).append("=\"");
+ rStrm << sOut.makeStringAndClear().getStr();
HTMLOutFuncs::Out_String( rStrm, rName, eDestEnc, pNonConvertableChars );
- ((sOut = "\" ") += OOO_STRING_SVTOOLS_HTML_O_content) += "=\"";
- rStrm << sOut.GetBuffer();
+ sOut.append("\" ").append(OOO_STRING_SVTOOLS_HTML_O_content).append("=\"");
+ rStrm << sOut.makeStringAndClear().getStr();
HTMLOutFuncs::Out_String( rStrm, rContent, eDestEnc, pNonConvertableChars ) << "\">";
}
@@ -138,9 +138,10 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const String& rBaseURL,
if( pIndent )
rStrm << pIndent;
- ByteString sOut( '<' );
- (((sOut += OOO_STRING_SVTOOLS_HTML_base) += ' ') += OOO_STRING_SVTOOLS_HTML_O_target) += "=\"";
- rStrm << sOut.GetBuffer();
+ rtl::OStringBuffer sOut;
+ sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_base).append(' ')
+ .append(OOO_STRING_SVTOOLS_HTML_O_target).append("=\"");
+ rStrm << sOut.makeStringAndClear().getStr();
HTMLOutFuncs::Out_String( rStrm, rTarget, eDestEnc, pNonConvertableChars )
<< "\">";
}
commit 7a142d8932990b253e51be29b1f0b861c9111d9f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 22:35:32 2011 +0100
drop intermediate ByteString
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 2f11030..2123d94 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -369,17 +369,16 @@ void implChr( SbxArray& rPar, bool bChrW )
{
SbxVariableRef pArg = rPar.Get( 1 );
- String aStr;
+ rtl::OUString aStr;
if( !bChrW && SbiRuntime::isVBAEnabled() )
{
- sal_Char c = (sal_Char)pArg->GetByte();
- ByteString s( c );
- aStr = String( s, gsl_getSystemTextEncoding() );
+ sal_Char c = static_cast<sal_Char>(pArg->GetByte());
+ aStr = rtl::OUString(&c, 1, gsl_getSystemTextEncoding());
}
else
{
- sal_Unicode aCh = (sal_Unicode)pArg->GetUShort();
- aStr = String( aCh );
+ sal_Unicode aCh = static_cast<sal_Unicode>(pArg->GetUShort());
+ aStr = rtl::OUString(aCh);
}
rPar.Get(0)->PutString( aStr );
}
diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx
index 7dbf23e..9fa4e9c 100644
--- a/basic/source/runtime/step1.cxx
+++ b/basic/source/runtime/step1.cxx
@@ -428,7 +428,7 @@ void SbiRuntime::StepCLOSE( sal_uInt32 nOp1 )
void SbiRuntime::StepPRCHAR( sal_uInt32 nOp1 )
{
- ByteString s( (char) nOp1 );
+ rtl::OString s(static_cast<sal_Char>(nOp1));
pIosys->Write( s );
Error( pIosys->GetError() );
}
commit 5184f5a4d3c757fd0c6a19ede7567441c170159f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 22:28:11 2011 +0100
ByteString->rtl::OStringBuffer
diff --git a/svtools/source/filter/sgvtext.cxx b/svtools/source/filter/sgvtext.cxx
index 820cdd9..aa28997 100644
--- a/svtools/source/filter/sgvtext.cxx
+++ b/svtools/source/filter/sgvtext.cxx
@@ -983,7 +983,8 @@ void DrawChar(OutputDevice& rOut, UCHAR c, ObjTextType T, PointType Pos, sal_uIn
{
SetTextContext(rOut,T,UpcasePossible(c),DrehWink,FitXMul,FitXDiv,FitYMul,FitYDiv);
if ((T.Schnitt & TextKaptBit)!=0 && UpcasePossible(c)) c=Upcase(c);
- String s( (char)c, RTL_TEXTENCODING_IBM_437 );
+ rtl::OUString s(reinterpret_cast<const sal_Char*>(&c), 1,
+ RTL_TEXTENCODING_IBM_437);
rOut.DrawText( Point( Pos.x, Pos.y ), s );
}
diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx
index fd669c9..89bc665 100644
--- a/svtools/source/svhtml/htmlout.cxx
+++ b/svtools/source/svhtml/htmlout.cxx
@@ -627,13 +627,13 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream,
if( !rOutName.Len() )
return rStream;
- ByteString sOut( '<' );
- sOut.Append( RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_map ) );
- sOut.Append( ' ' );
- sOut.Append( RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_O_name) );
- sOut.Append( RTL_CONSTASCII_STRINGPARAM("=\"") );
- rStream << sOut.GetBuffer();
- sOut.Erase();
+ rtl::OStringBuffer sOut;
+ sOut.append('<')
+ .append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_map))
+ .append(' ')
+ .append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_O_name))
+ .append(RTL_CONSTASCII_STRINGPARAM("=\""));
+ rStream << sOut.makeStringAndClear().getStr();
Out_String( rStream, rOutName, eDestEnc, pNonConvertableChars );
rStream << "\">";
@@ -721,18 +721,20 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream,
if( pIndentArea )
rStream << pIndentArea;
- ((((((((((sOut = '<') += OOO_STRING_SVTOOLS_HTML_area) += ' ')
- += OOO_STRING_SVTOOLS_HTML_O_shape) += '=') += pShape) += ' ')
- += OOO_STRING_SVTOOLS_HTML_O_coords) += "=\"") += aCoords) += "\" ";
- rStream << sOut.GetBuffer();
+ sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_area)
+ .append(' ').append(OOO_STRING_SVTOOLS_HTML_O_shape)
+ .append('=').append(pShape).append(' ')
+ .append(OOO_STRING_SVTOOLS_HTML_O_coords).append("=\"")
+ .append(aCoords).append("\" ");
+ rStream << sOut.makeStringAndClear().getStr();
String aURL( pObj->GetURL() );
if( aURL.Len() && pObj->IsActive() )
{
aURL = URIHelper::simpleNormalizedMakeRelative(
rBaseURL, aURL );
- (sOut = OOO_STRING_SVTOOLS_HTML_O_href) += "=\"";
- rStream << sOut.GetBuffer();
+ sOut.append(OOO_STRING_SVTOOLS_HTML_O_href).append("=\"");
+ rStream << sOut.makeStringAndClear().getStr();
Out_String( rStream, aURL, eDestEnc, pNonConvertableChars ) << '\"';
}
else
@@ -741,16 +743,18 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream,
const String& rObjName = pObj->GetName();
if( rObjName.Len() )
{
- ((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_name) += "=\"";
- rStream << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_name)
+ .append("=\"");
+ rStream << sOut.makeStringAndClear().getStr();
Out_String( rStream, rObjName, eDestEnc, pNonConvertableChars ) << '\"';
}
const String& rTarget = pObj->GetTarget();
if( rTarget.Len() && pObj->IsActive() )
{
- ((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_target) += "=\"";
- rStream << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_target)
+ .append("=\"");
+ rStream << sOut.makeStringAndClear().getStr();
Out_String( rStream, rTarget, eDestEnc, pNonConvertableChars ) << '\"';
}
@@ -760,8 +764,9 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream,
if( rDesc.Len() )
{
- ((sOut = ' ') += OOO_STRING_SVTOOLS_HTML_O_alt) += "=\"";
- rStream << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_alt)
+ .append("=\"");
+ rStream << sOut.makeStringAndClear().getStr();
Out_String( rStream, rDesc, eDestEnc, pNonConvertableChars ) << '\"';
}
@@ -800,46 +805,49 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm,
eDestEnc = osl_getThreadTextEncoding();
// Script wird komplett nicht eingerueckt!
- ByteString sOut( '<' );
- sOut.Append( RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_script) );
+ rtl::OStringBuffer sOut;
+ sOut.append('<')
+ .append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_script));
if( rLanguage.Len() )
{
- sOut.Append( ' ' );
- sOut.Append( RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_O_language) );
- sOut.Append( RTL_CONSTASCII_STRINGPARAM("=\"") );
- rStrm << sOut.GetBuffer();
+ sOut.append(' ')
+ .append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_O_language))
+ .append(RTL_CONSTASCII_STRINGPARAM("=\""));
+ rStrm << sOut.makeStringAndClear().getStr();
Out_String( rStrm, rLanguage, eDestEnc, pNonConvertableChars );
- sOut = '\"';
+ sOut.append('\"');
}
if( rSrc.Len() )
{
- ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_src) += "=\"";
- rStrm << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_src).append("=\"");
+ rStrm << sOut.makeStringAndClear().getStr();
Out_String( rStrm, URIHelper::simpleNormalizedMakeRelative(rBaseURL, rSrc), eDestEnc, pNonConvertableChars );
- sOut = '\"';
+ sOut.append('\"');
}
if( STARBASIC != eScriptType && pSBLibrary )
{
- ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_sdlibrary) += "=\"";
- rStrm << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_sdlibrary)
+ .append("=\"");
+ rStrm << sOut.makeStringAndClear().getStr();
Out_String( rStrm, *pSBLibrary, eDestEnc, pNonConvertableChars );
- sOut = '\"';
+ sOut.append('\"');
}
if( STARBASIC != eScriptType && pSBModule )
{
- ((sOut += ' ') += OOO_STRING_SVTOOLS_HTML_O_sdmodule) += "=\"";
- rStrm << sOut.GetBuffer();
+ sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_sdmodule)
+ .append("=\"");
+ rStrm << sOut.makeStringAndClear().getStr();
Out_String( rStrm, *pSBModule, eDestEnc, pNonConvertableChars );
- sOut = '\"';
+ sOut.append('\"');
}
- sOut += '>';
+ sOut.append('>');
- rStrm << sOut.GetBuffer();
+ rStrm << sOut.makeStringAndClear().getStr();
if( rSource.Len() || pSBLibrary || pSBModule )
{
@@ -855,22 +863,20 @@ SvStream& HTMLOutFuncs::OutScript( SvStream& rStrm,
{
if( pSBLibrary )
{
- sOut.Assign( RTL_CONSTASCII_STRINGPARAM("' ") );
- sOut.Append( RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_SB_library) );
- sOut.Append( ' ' );
- ByteString sTmp( *pSBLibrary, eDestEnc );
- sOut.Append( sTmp );
- rStrm << sOut.GetBuffer() << sNewLine;
+ sOut.append(RTL_CONSTASCII_STRINGPARAM("' "))
+ .append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_SB_library))
+ .append(' ')
+ .append(rtl::OUStringToOString(*pSBLibrary, eDestEnc));
+ rStrm << sOut.makeStringAndClear().getStr() << sNewLine;
}
if( pSBModule )
{
- sOut.Assign( RTL_CONSTASCII_STRINGPARAM("' ") );
- sOut.Append( RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_SB_module) );
- sOut.Append( ' ' );
- ByteString sTmp( *pSBModule, eDestEnc );
- sOut.Append( sTmp );
- rStrm << sOut.GetBuffer() << sNewLine;
+ sOut.append(RTL_CONSTASCII_STRINGPARAM("' "))
+ .append(RTL_CONSTASCII_STRINGPARAM(OOO_STRING_SVTOOLS_HTML_SB_module))
+ .append(' ')
+ .append(rtl::OUStringToOString(*pSBModule, eDestEnc));
+ rStrm << sOut.makeStringAndClear().getStr() << sNewLine;
}
}
@@ -922,9 +928,9 @@ SvStream& HTMLOutFuncs::Out_Events( SvStream& rStrm,
if( pStr )
{
- ByteString sOut( ' ' );
- (sOut += pStr) += "=\"";
- rStrm << sOut.GetBuffer();
+ rtl::OStringBuffer sOut;
+ sOut.append(' ').append(pStr).append("=\"");
+ rStrm << sOut.makeStringAndClear().getStr();
Out_String( rStrm, pMacro->GetMacName(), eDestEnc, pNonConvertableChars ) << '\"';
}
commit f3d0d0a608fa04aa34865eac9cdc987407f25c76
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 22:13:50 2011 +0100
can use SearchAndReplaceAll sal_Char variant here
diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx
index a2a701e..436c373 100644
--- a/l10ntools/source/xrmmerge.cxx
+++ b/l10ntools/source/xrmmerge.cxx
@@ -551,9 +551,6 @@ void XRMResExport::EndOfText(
if ( pResData && pOutputStream ) {
- char cSearch = 0x00;
- ByteString sSearch( cSearch );
-
Export::FillInFallbacks( pResData );
ByteString sTimeStamp( Export::GetTimeStamp());
@@ -580,7 +577,8 @@ void XRMResExport::EndOfText(
sOutput += sAct; sOutput += "\t\t\t\t";
sOutput += sTimeStamp;
- sOutput.SearchAndReplaceAll( sSearch, "_" );
+ sal_Char cSearch = 0x00;
+ sOutput.SearchAndReplaceAll( cSearch, '_' );
if( sAct.Len() > 1 )
pOutputStream->WriteLine( sOutput );
}
commit 53b8ba7aedc0e5d1110344284b154ccc1cb13195
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 22:09:04 2011 +0100
unused local static ByteStrings
diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index f11261a..60c683e 100644
--- a/l10ntools/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -1624,10 +1624,6 @@ ByteString Export::GetText( const ByteString &rSource, int nToken )
void Export::WriteToMerged( const ByteString &rText , bool bSDFContent )
/*****************************************************************************/
{
- static ByteString SLASH ('\\');
- static ByteString RETURN ('\n');
- //printf("%s\n",rText.GetBuffer() );
-
if ( !bDontWriteOutput || !bUnmerge ) {
ByteString sText( rText );
while ( sText.SearchAndReplace( " \n", "\n" ) != STRING_NOTFOUND ) {};
commit e3f289d980862bdfa4def521eef1a790b9e731b7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 21:41:14 2011 +0100
ByteString->rtl::OString
diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx
index d38cbd1..391f4a6 100644
--- a/tools/bootstrp/prj.cxx
+++ b/tools/bootstrp/prj.cxx
@@ -71,12 +71,11 @@ rtl::OString SimpleConfig::getNext()
rtl::OString SimpleConfig::GetNextLine()
{
- aFileStream.ReadLine ( aTmpStr );
- if ( aTmpStr.Search( "#" ) == 0 )
+ rtl::OString aTmpStr;
+ aFileStream.ReadLine(aTmpStr);
+ if (aTmpStr[0] == '#')
return rtl::OString('\t');
- aTmpStr.EraseLeadingAndTrailingChars();
- aTmpStr.SearchAndReplaceAll(' ', '\t');
- return aTmpStr;
+ return aTmpStr.trim().replace(' ', '\t');
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/inc/bootstrp/prj.hxx b/tools/inc/bootstrp/prj.hxx
index 3589606..62d9727 100644
--- a/tools/inc/bootstrp/prj.hxx
+++ b/tools/inc/bootstrp/prj.hxx
@@ -43,7 +43,6 @@
class SimpleConfig
{
SvFileStream aFileStream;
- ByteString aTmpStr;
ByteString aStringBuffer;
rtl::OString GetNextLine();
commit 33b9943304c509fb85b0827f88c024c4130f7c6c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 21:36:25 2011 +0100
why search and replace all spaces with tabs twice
diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx
index 215116a..d38cbd1 100644
--- a/tools/bootstrp/prj.cxx
+++ b/tools/bootstrp/prj.cxx
@@ -75,13 +75,7 @@ rtl::OString SimpleConfig::GetNextLine()
if ( aTmpStr.Search( "#" ) == 0 )
return rtl::OString('\t');
aTmpStr.EraseLeadingAndTrailingChars();
- while ( aTmpStr.SearchAndReplace(ByteString(' '),ByteString('\t') ) != STRING_NOTFOUND ) ;
- int nLength = aTmpStr.Len();
- for ( sal_uInt16 i = 0; i<= nLength; i++)
- {
- if ( aTmpStr.GetChar( i ) == 0x20 )
- aTmpStr.SetChar( i, 0x09 );
- }
+ aTmpStr.SearchAndReplaceAll(' ', '\t');
return aTmpStr;
}
commit 68c3a63d7e4cb5cd510b980cfccb3eaf8b35012e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 21:32:25 2011 +0100
make this simpler
replace EraseLeadingChars+EraseTrailingChars with single
EraseLeadingAndTrailingChars, and those change string they
operate on, so need for assign to self afterwards
diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx
index 41f8f79..215116a 100644
--- a/tools/bootstrp/prj.cxx
+++ b/tools/bootstrp/prj.cxx
@@ -74,8 +74,7 @@ rtl::OString SimpleConfig::GetNextLine()
aFileStream.ReadLine ( aTmpStr );
if ( aTmpStr.Search( "#" ) == 0 )
return rtl::OString('\t');
- aTmpStr = aTmpStr.EraseLeadingChars();
- aTmpStr = aTmpStr.EraseTrailingChars();
+ aTmpStr.EraseLeadingAndTrailingChars();
while ( aTmpStr.SearchAndReplace(ByteString(' '),ByteString('\t') ) != STRING_NOTFOUND ) ;
int nLength = aTmpStr.Len();
for ( sal_uInt16 i = 0; i<= nLength; i++)
commit fab20ec189df54f2e0df9c929210c2eaa5dd656d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 21:31:55 2011 +0100
bFound is always false, and never changed, simplify
diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx
index 4b98dac..41f8f79 100644
--- a/tools/bootstrp/prj.cxx
+++ b/tools/bootstrp/prj.cxx
@@ -78,10 +78,9 @@ rtl::OString SimpleConfig::GetNextLine()
aTmpStr = aTmpStr.EraseTrailingChars();
while ( aTmpStr.SearchAndReplace(ByteString(' '),ByteString('\t') ) != STRING_NOTFOUND ) ;
int nLength = aTmpStr.Len();
- sal_Bool bFound = sal_False;
for ( sal_uInt16 i = 0; i<= nLength; i++)
{
- if ( aTmpStr.GetChar( i ) == 0x20 && !bFound )
+ if ( aTmpStr.GetChar( i ) == 0x20 )
aTmpStr.SetChar( i, 0x09 );
}
return aTmpStr;
commit 24b1a63c613bd364bc1732d8a80635b8ee9acf13
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 13:38:02 2011 +0100
ditch ByteString::*Buffer*
diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx
index 66bb2f7..5738660 100644
--- a/svtools/source/graphic/grfcache.cxx
+++ b/svtools/source/graphic/grfcache.cxx
@@ -33,6 +33,7 @@
#include <tools/debug.hxx>
#include <vcl/outdev.hxx>
#include <tools/poly.hxx>
+#include <rtl/strbuf.hxx>
#include "grfcache.hxx"
#include <memory>
@@ -135,23 +136,23 @@ GraphicID::GraphicID( const GraphicObject& rObj )
ByteString GraphicID::GetIDString() const
{
- ByteString aHexStr;
- sal_Char* pStr = aHexStr.AllocBuffer( 32 );
- sal_Int32 nShift;
+ rtl::OStringBuffer aHexStr;
+ sal_Int32 nShift, nIndex = 0;
+ aHexStr.setLength(32);
for( nShift = 28; nShift >= 0; nShift -= 4 )
- *pStr++ = aHexData[ ( mnID1 >> (sal_uInt32) nShift ) & 0xf ];
+ aHexStr.setCharAt(nIndex++, aHexData[ ( mnID1 >> (sal_uInt32) nShift ) & 0xf ]);
for( nShift = 28; nShift >= 0; nShift -= 4 )
- *pStr++ = aHexData[ ( mnID2 >> (sal_uInt32) nShift ) & 0xf ];
+ aHexStr.setCharAt(nIndex++, aHexData[ ( mnID2 >> (sal_uInt32) nShift ) & 0xf ]);
for( nShift = 28; nShift >= 0; nShift -= 4 )
- *pStr++ = aHexData[ ( mnID3 >> (sal_uInt32) nShift ) & 0xf ];
+ aHexStr.setCharAt(nIndex++, aHexData[ ( mnID3 >> (sal_uInt32) nShift ) & 0xf ]);
for( nShift = 28; nShift >= 0; nShift -= 4 )
- *pStr++ = aHexData[ ( mnID4 >> (sal_uInt32) nShift ) & 0xf ];
+ aHexStr.setCharAt(nIndex++, aHexData[ ( mnID4 >> (sal_uInt32) nShift ) & 0xf ]);
- return aHexStr;
+ return aHexStr.makeStringAndClear();
}
// ---------------------
commit 94d8c0975852d7b12e4c8acf4ab1c7f1c1a73f61
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 13:36:11 2011 +0100
rework this in terms of read_uInt8s_AsOString
diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx
index b2fea12..1844e27 100644
--- a/connectivity/source/drivers/dbase/dindexnode.cxx
+++ b/connectivity/source/drivers/dbase/dindexnode.cxx
@@ -674,16 +674,13 @@ void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex)
}
else
{
- ByteString aBuf;
sal_uInt16 nLen = rIndex.getHeader().db_keylen;
- char* pStr = aBuf.AllocBuffer(nLen+1);
-
- rStream.Read(pStr,nLen);
- pStr[nLen] = 0;
- aBuf.ReleaseBufferAccess();
- aBuf.EraseTrailingChars();
-
- aKey = ONDXKey(::rtl::OUString(aBuf.GetBuffer(),aBuf.Len(),rIndex.m_pTable->getConnection()->getTextEncoding()) ,aKey.nRecord);
+ rtl::OString aBuf = read_uInt8s_AsOString(rStream, nLen);
+ //get length minus trailing whitespace
+ sal_Int32 nContentLen = aBuf.getLength();
+ while (nContentLen && aBuf[nContentLen-1] == ' ')
+ --nContentLen;
+ aKey = ONDXKey(::rtl::OUString(aBuf.getStr(), nContentLen, rIndex.m_pTable->getConnection()->getTextEncoding()) ,aKey.nRecord);
}
rStream >> aChild;
}
diff --git a/sfx2/source/bastyp/sfxhtml.cxx b/sfx2/source/bastyp/sfxhtml.cxx
index c575b7f..002e2ce 100644
--- a/sfx2/source/bastyp/sfxhtml.cxx
+++ b/sfx2/source/bastyp/sfxhtml.cxx
@@ -277,11 +277,9 @@ sal_Bool SfxHTMLParser::FinishFileDownload( String& rStr )
? (xub_StrLen)aStream.Tell()
: STRING_MAXLEN;
- ByteString sBuffer;
- sal_Char* pBuffer = sBuffer.AllocBuffer(nLen);
aStream.Seek( 0 );
- aStream.Read((void*)pBuffer, nLen);
- rStr = String( S2U(pBuffer) );
+ rtl::OString sBuffer = read_uInt8s_AsOString(aStream, nLen);
+ rStr = S2U(sBuffer);
}
delete pDLMedium;
diff --git a/svtools/source/filter/igif/gifread.cxx b/svtools/source/filter/igif/gifread.cxx
index 6765937..8e488e7 100644
--- a/svtools/source/filter/igif/gifread.cxx
+++ b/svtools/source/filter/igif/gifread.cxx
@@ -259,15 +259,12 @@ sal_Bool GIFReader::ReadExtension()
// Appl.-Extension hat Laenge 11
if ( cSize == 0x0b )
{
- ByteString aAppId;
- ByteString aAppCode;
-
- rIStm.Read( aAppId.AllocBuffer( 8 ), 8 );
- rIStm.Read( aAppCode.AllocBuffer( 3 ), 3 );
+ rtl::OString aAppId = read_uInt8s_AsOString(rIStm, 8);
+ rtl::OString aAppCode = read_uInt8s_AsOString(rIStm, 3);
rIStm >> cSize;
// NetScape-Extension
- if( aAppId == "NETSCAPE" && aAppCode == "2.0" && cSize == 3 )
+ if( aAppId.equalsL(RTL_CONSTASCII_STRINGPARAM("NETSCAPE")) && aAppCode.equalsL(RTL_CONSTASCII_STRINGPARAM("2.0")) && cSize == 3 )
{
rIStm >> cByte;
@@ -294,7 +291,7 @@ sal_Bool GIFReader::ReadExtension()
else
rIStm.SeekRel( -1 );
}
- else if ( aAppId == "STARDIV " && aAppCode == "5.0" && cSize == 9 )
+ else if ( aAppId.equalsL(RTL_CONSTASCII_STRINGPARAM("STARDIV ")) && aAppCode.equalsL(RTL_CONSTASCII_STRINGPARAM("5.0")) && cSize == 9 )
{
rIStm >> cByte;
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index 1190290..b09e9d4 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -882,33 +882,39 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
case( GDI_TEXT_ACTION ):
{
- ByteString aByteStr;
sal_Int32 nIndex, nLen;
rIStm >> aPt >> nIndex >> nLen >> nTmp;
if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_UINT16 - 1 ) ) )
- {
- rIStm.Read( aByteStr.AllocBuffer( (sal_uInt16)nTmp ), nTmp + 1 );
- UniString aStr( aByteStr, eActualCharSet );
+ {
+ rtl::OString aByteStr = read_uInt8s_AsOString(rIStm, nTmp);
+ sal_uInt8 nTerminator = 0;
+ rIStm >> nTerminator;
+ DBG_ASSERT( nTerminator == 0, "expected string to be NULL terminated" );
+
+ UniString aStr(rtl::OStringToOUString(aByteStr, eActualCharSet));
if ( nUnicodeCommentActionNumber == i )
ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
rMtf.AddAction( new MetaTextAction( aPt, aStr, (sal_uInt16) nIndex, (sal_uInt16) nLen ) );
}
- rIStm.Seek( nActBegin + nActionSize );
+ rIStm.Seek( nActBegin + nActionSize );
}
break;
case( GDI_TEXTARRAY_ACTION ):
{
- ByteString aByteStr;
sal_Int32* pDXAry = NULL;
sal_Int32 nIndex, nLen, nAryLen;
rIStm >> aPt >> nIndex >> nLen >> nTmp >> nAryLen;
if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_UINT16 - 1 ) ) )
{
- rIStm.Read( aByteStr.AllocBuffer( (sal_uInt16)nTmp ), nTmp + 1 );
- UniString aStr( aByteStr, eActualCharSet );
+ rtl::OString aByteStr = read_uInt8s_AsOString(rIStm, nTmp);
+ sal_uInt8 nTerminator = 0;
+ rIStm >> nTerminator;
+ DBG_ASSERT( nTerminator == 0, "expected string to be NULL terminated" );
+
+ UniString aStr(rtl::OStringToOUString(aByteStr, eActualCharSet));
if( nAryLen > 0L )
{
@@ -955,25 +961,28 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
if( pDXAry )
delete[] pDXAry;
}
- rIStm.Seek( nActBegin + nActionSize );
+ rIStm.Seek( nActBegin + nActionSize );
}
break;
case( GDI_STRETCHTEXT_ACTION ):
{
- ByteString aByteStr;
sal_Int32 nIndex, nLen, nWidth;
rIStm >> aPt >> nIndex >> nLen >> nTmp >> nWidth;
if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_INT16 - 1 ) ) )
{
- rIStm.Read( aByteStr.AllocBuffer( (sal_uInt16)nTmp ), nTmp + 1 );
- UniString aStr( aByteStr, eActualCharSet );
+ rtl::OString aByteStr = read_uInt8s_AsOString(rIStm, nTmp);
+ sal_uInt8 nTerminator = 0;
+ rIStm >> nTerminator;
+ DBG_ASSERT( nTerminator == 0, "expected string to be NULL terminated" );
+
+ UniString aStr(rtl::OStringToOUString(aByteStr, eActualCharSet));
if ( nUnicodeCommentActionNumber == i )
ImplReadUnicodeComment( nUnicodeCommentStreamPos, rIStm, aStr );
rMtf.AddAction( new MetaStretchTextAction( aPt, nWidth, aStr, (sal_uInt16) nIndex, (sal_uInt16) nLen ) );
}
- rIStm.Seek( nActBegin + nActionSize );
+ rIStm.Seek( nActBegin + nActionSize );
}
break;
commit 5d73752cc7d66edae26392f84e72e32a8cf598ca
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 13:34:14 2011 +0100
rework this in terms of read_uInt8s_AsOString
diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx
index b2bbfe7..54f4f88 100644
--- a/tools/inc/tools/string.hxx
+++ b/tools/inc/tools/string.hxx
@@ -177,6 +177,7 @@ private:
// Append(char)
void operator +=(int); // not implemented; to detect misuses
// of operator +=(sal_Char)
+
public:
ByteString();
ByteString( const ByteString& rStr );
@@ -282,9 +283,6 @@ public:
ByteString GetToken( xub_StrLen nToken, sal_Char cTok = ';' ) const;
const sal_Char* GetBuffer() const { return mpData->maStr; }
- sal_Char* GetBufferAccess();
- void ReleaseBufferAccess( xub_StrLen nLen = STRING_LEN );
- sal_Char* AllocBuffer( xub_StrLen nLen );
friend sal_Bool operator == ( const ByteString& rStr1, const ByteString& rStr2 )
{ return rStr1.Equals( rStr2 ); }
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx
index f5d8a9f..ca3d004 100644
--- a/tools/source/stream/stream.cxx
+++ b/tools/source/stream/stream.cxx
@@ -1544,13 +1544,7 @@ SvStream& SvStream::ReadByteString( ByteString& rStr )
{
sal_uInt16 nLen = 0;
operator>>( nLen );
- if( nLen )
- {
- char* pTmp = rStr.AllocBuffer( nLen );
- nLen = (sal_uInt16)Read( pTmp, nLen );
- }
- else
- rStr.Erase();
+ rStr = read_uInt8s_AsOString(*this, nLen);
return *this;
}
diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx
index d842875..b83b39c 100644
--- a/tools/source/string/strimp.cxx
+++ b/tools/source/string/strimp.cxx
@@ -1452,63 +1452,4 @@ STRING STRING::GetToken( xub_StrLen nToken, STRCODE cTok, xub_StrLen& rIndex ) c
}
}
-// -----------------------------------------------------------------------
-
-STRCODE* STRING::GetBufferAccess()
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-
- // Daten kopieren, wenn noetig
- if ( mpData->mnLen )
- ImplCopyData();
-
- // Pointer auf den String zurueckgeben
- return mpData->maStr;
-}
-
-// -----------------------------------------------------------------------
-
-void STRING::ReleaseBufferAccess( xub_StrLen nLen )
-{
- // Hier ohne Funktionstest, da String nicht konsistent
- DBG_CHKTHIS( STRING, NULL );
- DBG_ASSERT( mpData->mnRefCount == 1, "String::ReleaseCharStr() called for String with RefCount" );
-
- if ( nLen > mpData->mnLen )
- nLen = ImplStringLen( mpData->maStr );
- OSL_ASSERT(nLen <= mpData->mnLen);
- if ( !nLen )
- {
- STRING_NEW((STRING_TYPE **)&mpData);
- }
- // Bei mehr als 8 Zeichen unterschied, kuerzen wir den Buffer
- else if ( mpData->mnLen - nLen > 8 )
- {
- STRINGDATA* pNewData = ImplAllocData( nLen );
- memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
- STRING_RELEASE((STRING_TYPE *)mpData);
- mpData = pNewData;
- }
- else
- mpData->mnLen = nLen;
-}
-
-// -----------------------------------------------------------------------
-
-STRCODE* STRING::AllocBuffer( xub_StrLen nLen )
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-
- STRING_RELEASE((STRING_TYPE *)mpData);
- if ( nLen )
- mpData = ImplAllocData( nLen );
- else
- {
- mpData = NULL;
- STRING_NEW((STRING_TYPE **)&mpData);
- }
-
- return mpData->maStr;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx
index 0f98741..30c973e 100644
--- a/tools/source/string/tustring.cxx
+++ b/tools/source/string/tustring.cxx
@@ -505,4 +505,63 @@ STRING& STRING::Expand( xub_StrLen nCount, STRCODE cExpandChar )
return *this;
}
+// -----------------------------------------------------------------------
+
+STRCODE* STRING::GetBufferAccess()
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ // Daten kopieren, wenn noetig
+ if ( mpData->mnLen )
+ ImplCopyData();
+
+ // Pointer auf den String zurueckgeben
+ return mpData->maStr;
+}
+
+// -----------------------------------------------------------------------
+
+void STRING::ReleaseBufferAccess( xub_StrLen nLen )
+{
+ // Hier ohne Funktionstest, da String nicht konsistent
+ DBG_CHKTHIS( STRING, NULL );
+ DBG_ASSERT( mpData->mnRefCount == 1, "String::ReleaseCharStr() called for String with RefCount" );
+
+ if ( nLen > mpData->mnLen )
+ nLen = ImplStringLen( mpData->maStr );
+ OSL_ASSERT(nLen <= mpData->mnLen);
+ if ( !nLen )
+ {
+ STRING_NEW((STRING_TYPE **)&mpData);
+ }
+ // Bei mehr als 8 Zeichen unterschied, kuerzen wir den Buffer
+ else if ( mpData->mnLen - nLen > 8 )
+ {
+ STRINGDATA* pNewData = ImplAllocData( nLen );
+ memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
+ STRING_RELEASE((STRING_TYPE *)mpData);
+ mpData = pNewData;
+ }
+ else
+ mpData->mnLen = nLen;
+}
+
+// -----------------------------------------------------------------------
+
+STRCODE* STRING::AllocBuffer( xub_StrLen nLen )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ STRING_RELEASE((STRING_TYPE *)mpData);
+ if ( nLen )
+ mpData = ImplAllocData( nLen );
+ else
+ {
+ mpData = NULL;
+ STRING_NEW((STRING_TYPE **)&mpData);
+ }
+
+ return mpData->maStr;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 68c3fbf49dcdccad84a81fd191cd964e923ae072
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 18 13:32:07 2011 +0100
remove redundant intermediate ByteStrings
diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index 49d9a0f..f11261a 100644
--- a/l10ntools/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -393,10 +393,9 @@ sal_Bool ResData::SetId( const ByteString &rId, sal_uInt16 nLevel )
SetError();
}
- if ( sId.Len() > 255 ) {
- ByteString sWarning( "LocalId > 255 chars, truncating..." );
- YYWarning( sWarning.GetBufferAccess());
- sWarning.ReleaseBufferAccess();
+ if ( sId.Len() > 255 )
+ {
+ YYWarning( "LocalId > 255 chars, truncating..." );
sId.Erase( 255 );
sId.EraseTrailingChars( ' ' );
sId.EraseTrailingChars( '\t' );
@@ -694,12 +693,9 @@ int Export::Execute( int nToken, const char * pToken )
CleanValue( sId );
sId = sId.EraseAllChars( '\t' );
pResData->SetId( sId, ID_LEVEL_IDENTIFIER );
- if ( sCondition.Len()) {
- ByteString sEmpty( "" );
- Execute( CONDITION, sEmpty.GetBufferAccess()); // execute the
- // precomp.
- // condition
- sEmpty.ReleaseBufferAccess();
+ if ( sCondition.Len())
+ {
+ Execute( CONDITION, ""); // execute the precomp. condition
}
}
break;
@@ -966,9 +962,7 @@ int Export::Execute( int nToken, const char * pToken )
pResData->bHelpText = sal_True;
if ( bBreakWhenHelpText )
{
- rtl::OString sError(
- RTL_CONSTASCII_STRINGPARAM("\"HelpText\" found in source\n"));
- YYWarning(sError.getStr());
+ YYWarning("\"HelpText\" found in source");
SetError();
}
if ( bMergeMode )
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list