[Libreoffice-commits] .: 8 commits - l10ntools/inc l10ntools/source rsc/inc rsc/source sot/source svl/source svtools/source unotools/inc unotools/source vcl/source vcl/unx
Caolán McNamara
caolan at kemper.freedesktop.org
Sun Jul 3 04:36:56 PDT 2011
l10ntools/inc/cfgmerge.hxx | 3
l10ntools/inc/export.hxx | 13
l10ntools/source/cfglex.l | 6
l10ntools/source/cfgmerge.cxx | 44 +--
l10ntools/source/export.cxx | 351 +++++++++++++------------
l10ntools/source/export2.cxx | 29 +-
l10ntools/source/gsicheck.cxx | 27 +
l10ntools/source/lngmerge.cxx | 9
l10ntools/source/tagtest.cxx | 14
l10ntools/source/xrmlex.l | 6
l10ntools/source/xrmmerge.cxx | 16 -
rsc/inc/rscpar.hxx | 1
rsc/inc/rsctools.hxx | 1
rsc/source/parser/rsclex.cxx | 34 --
rsc/source/tools/rsctools.cxx | 23 -
sot/source/sdstor/stgstrms.cxx | 2
svl/source/items/style.cxx | 4
svl/source/items/whassert.hxx | 10
svl/source/numbers/zforlist.cxx | 104 +------
svtools/source/misc/transfer.cxx | 20 -
unotools/inc/unotools/localedatawrapper.hxx | 2
unotools/source/i18n/localedatawrapper.cxx | 42 +-
vcl/source/gdi/cvtsvm.cxx | 10
vcl/unx/generic/printer/jobdata.cxx | 69 ++--
vcl/unx/generic/printer/printerinfomanager.cxx | 41 +-
vcl/unx/generic/printergfx/common_gfx.cxx | 2
vcl/unx/generic/printergfx/printerjob.cxx | 11
27 files changed, 427 insertions(+), 467 deletions(-)
New commits:
commit 2d89edabf117e0a8b47abfbf32c5f60b0fb1bcd6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jul 3 12:30:00 2011 +0100
Related: #i46388# busted ole2 wrapper
diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx
index 495748a..79590bf 100644
--- a/sot/source/sdstor/stgstrms.cxx
+++ b/sot/source/sdstor/stgstrms.cxx
@@ -798,7 +798,7 @@ void* StgDataStrm::GetPtr( sal_Int32 Pos, sal_Bool bForce, sal_Bool bDirty )
if( Pos2Page( Pos ) )
{
StgPage* pPg = rIo.Get( nPage, bForce );
- if( pPg )
+ if (pPg && nOffset < pPg->GetSize())
{
pPg->SetOwner( pEntry );
if( bDirty )
commit 15293a4461d1b73765656fb1a69e12944ee1d8ea
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jul 3 01:12:01 2011 +0100
callcatcher: unused InputFile
diff --git a/rsc/inc/rsctools.hxx b/rsc/inc/rsctools.hxx
index f40a42e..d9676b0 100644
--- a/rsc/inc/rsctools.hxx
+++ b/rsc/inc/rsctools.hxx
@@ -51,7 +51,6 @@ enum RSCBYTEORDER_TYPE { RSC_BIGENDIAN, RSC_LITTLEENDIAN, RSC_SYSTEMENDIAN };
ByteString GetTmpFileName();
sal_Bool Append( ByteString aDestFile, ByteString aSourceFile );
sal_Bool Append( FILE * fDest, ByteString aSourceFile );
-ByteString InputFile ( const char * pInput, const char * pExt );
ByteString OutputFile( ByteString aInput, const char * ext );
char * ResponseFile( RscPtrPtr * ppCmd, char ** ppArgv,
sal_uInt32 nArgc );
diff --git a/rsc/source/tools/rsctools.cxx b/rsc/source/tools/rsctools.cxx
index 9184fd2..6573302 100644
--- a/rsc/source/tools/rsctools.cxx
+++ b/rsc/source/tools/rsctools.cxx
@@ -177,29 +177,6 @@ sal_Bool Append( ByteString aOutputSrs, ByteString aTmpFile )
/*************************************************************************
|*
-|* InputFile
-|*
-|* Beschreibung Haengt Extension an, wenn keine da ist
-|* Parameter: pInput, der Input-Dateiname.
-|* pExt, die Extension des Ausgabenamens
-|*
-*************************************************************************/
-ByteString InputFile ( const char * pInput, const char * pExt )
-{
- UniString aUniInput( pInput, RTL_TEXTENCODING_ASCII_US );
- DirEntry aFileName( aUniInput );
-
- if ( 0 == aFileName.GetExtension().Len() )
- {
- UniString aExt( pExt, RTL_TEXTENCODING_ASCII_US );
- aFileName.SetExtension( aExt );
- }
-
- return ByteString( aFileName.GetFull(), RTL_TEXTENCODING_ASCII_US );
-}
-
-/*************************************************************************
-|*
|* OutputFile
|*
|* Beschreibung Ersetzt Extension durch eine andere
commit f6bacecff845418be231de11fbf30195c6c0cd9e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Jul 3 01:07:08 2011 +0100
callcatcher: unused MacroParser
diff --git a/rsc/inc/rscpar.hxx b/rsc/inc/rscpar.hxx
index d1a3fad..d619c26 100644
--- a/rsc/inc/rscpar.hxx
+++ b/rsc/inc/rscpar.hxx
@@ -88,7 +88,6 @@ public:
/******************* F u n c t i o n *************************************/
void IncludeParser( RscFileInst * pFileInst );
ERRTYPE parser( RscFileInst * pFileInst );
-RscExpression * MacroParser( RscFileInst & rFileInst );
#endif // _RSCPAR_HXX
diff --git a/rsc/source/parser/rsclex.cxx b/rsc/source/parser/rsclex.cxx
index b7b7f08..b21f428 100644
--- a/rsc/source/parser/rsclex.cxx
+++ b/rsc/source/parser/rsclex.cxx
@@ -413,38 +413,4 @@ ERRTYPE parser( RscFileInst * pFileInst )
return( aError );
}
-RscExpression * MacroParser( RscFileInst & rFileInst )
-{
- ERRTYPE aError;
- RscExpression * pExpression;
-
- InitParser( &rFileInst );
-
- //Ziel auf macro_expression setzen
- aKeyVal[ 0 ].nKeyWord = MACROTARGET;
- bTargetDefined = sal_True;
- aError = yyparse();
-
- pExpression = pExp;
- //EndParser() wuerde pExp loeschen
- if( pExp )
- pExp = NULL;
-
- EndParser();
-
- // yyparser gibt 0 zurueck, wenn erfolgreich
- if( 0 == aError )
- aError.Clear();
- if( rFileInst.pTypCont->pEH->nErrors )
- aError = ERR_ERROR;
- rFileInst.SetError( aError );
-
- //im Fehlerfall pExpression loeschen
- if( aError.IsError() && pExpression ){
- delete pExpression;
- pExpression = NULL;
- };
- return( pExpression );
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 08731ab24c62b7b77a4368551c97f13cf1512869
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jul 2 23:17:56 2011 +0100
ByteString::CreateFromInt32->rtl::OString::valueOf
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 84d103f..4cd42d0 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -65,6 +65,7 @@
#include <svtools/wmf.hxx>
#include <svtools/imap.hxx>
#include <svtools/transfer.hxx>
+#include <rtl/strbuf.hxx>
#include <cstdio>
// --------------
@@ -879,15 +880,16 @@ sal_Bool TransferableHelper::SetINetBookmark( const INetBookmark& rBmk,
{
case( SOT_FORMATSTR_ID_SOLK ):
{
- ByteString sURL( rBmk.GetURL(), eSysCSet ),
- sDesc( rBmk.GetDescription(), eSysCSet );
- ByteString sOut( ByteString::CreateFromInt32( sURL.Len() ));
- ( sOut += '@' ) += sURL;
- sOut += ByteString::CreateFromInt32( sDesc.Len() );
- ( sOut += '@' ) += sDesc;
-
- Sequence< sal_Int8 > aSeq( sOut.Len() );
- memcpy( aSeq.getArray(), sOut.GetBuffer(), sOut.Len() );
+ rtl::OString sURL(rtl::OUStringToOString(rBmk.GetURL(), eSysCSet));
+ rtl::OString sDesc(rtl::OUStringToOString(rBmk.GetDescription(), eSysCSet));
+ rtl::OStringBuffer sOut;
+ sOut.append(sURL.getLength());
+ sOut.append('@').append(sURL);
+ sOut.append(sDesc.getLength());
+ sOut.append('@').append(sDesc);
+
+ Sequence< sal_Int8 > aSeq(sOut.getLength());
+ memcpy(aSeq.getArray(), sOut.getStr(), sOut.getLength());
maAny <<= aSeq;
}
break;
commit 3553e7da5815754fe1a3ce268145b1933c7876e9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sat Jul 2 23:05:34 2011 +0100
ByteString::CreateFromInt32->rtl::OString::valueOf
diff --git a/vcl/source/gdi/cvtsvm.cxx b/vcl/source/gdi/cvtsvm.cxx
index cc5e891..84d6bc9 100644
--- a/vcl/source/gdi/cvtsvm.cxx
+++ b/vcl/source/gdi/cvtsvm.cxx
@@ -41,6 +41,7 @@
#include <vcl/lineinfo.hxx>
#include <vcl/salbtype.hxx>
#include <vcl/cvtsvm.hxx>
+#include <rtl/strbuf.hxx>
// -----------
// - Defines -
@@ -2431,10 +2432,11 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
#ifdef DBG_UTIL
default:
{
- ByteString aStr( "Missing implementation for Action#: " );
- aStr += ByteString::CreateFromInt32( pAction->GetType() );
- aStr += '!';
- OSL_FAIL( aStr.GetBuffer() );
+ rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM(
+ "Missing implementation for Action#: "));
+ aStr.append(static_cast<sal_Int32>(pAction->GetType()));
+ aStr.append('!');
+ OSL_FAIL(aStr.getStr());
}
break;
#endif
diff --git a/vcl/unx/generic/printer/jobdata.cxx b/vcl/unx/generic/printer/jobdata.cxx
index 4b12627..c8966c3 100644
--- a/vcl/unx/generic/printer/jobdata.cxx
+++ b/vcl/unx/generic/printer/jobdata.cxx
@@ -34,7 +34,8 @@
#include "tools/stream.hxx"
-#include "sal/alloca.h"
+#include <sal/alloca.h>
+#include <rtl/strbuf.hxx>
using namespace psp;
@@ -122,48 +123,52 @@ bool JobData::getStreamBuffer( void*& pData, int& bytes )
return false;
SvMemoryStream aStream;
- ByteString aLine;
// write header job data
aStream.WriteLine( "JobData 1" );
- aLine = "printer=";
- aLine += ByteString( String( m_aPrinterName ), RTL_TEXTENCODING_UTF8 );
- aStream.WriteLine( aLine );
+ rtl::OStringBuffer aLine;
+
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("printer="));
+ aLine.append(rtl::OUStringToOString(m_aPrinterName, RTL_TEXTENCODING_UTF8));
+ aStream.WriteLine(aLine.makeStringAndClear());
- aLine = "orientation=";
- aLine += m_eOrientation == orientation::Landscape ? "Landscape" : "Portrait";
- aStream.WriteLine( aLine );
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("orientation="));
+ if (m_eOrientation == orientation::Landscape)
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("Landscape"));
+ else
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("Portrait"));
+ aStream.WriteLine(aLine.makeStringAndClear());
- aLine = "copies=";
- aLine += ByteString::CreateFromInt32( m_nCopies );
- aStream.WriteLine( aLine );
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("copies="));
+ aLine.append(static_cast<sal_Int32>(m_nCopies));
+ aStream.WriteLine(aLine.makeStringAndClear());
- aLine = "margindajustment=";
- aLine += ByteString::CreateFromInt32( m_nLeftMarginAdjust );
- aLine += ',';
- aLine += ByteString::CreateFromInt32( m_nRightMarginAdjust );
- aLine += ',';
- aLine += ByteString::CreateFromInt32( m_nTopMarginAdjust );
- aLine += ',';
- aLine += ByteString::CreateFromInt32( m_nBottomMarginAdjust );
- aStream.WriteLine( aLine );
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("margindajustment="));
+ aLine.append(static_cast<sal_Int32>(m_nLeftMarginAdjust));
+ aLine.append(',');
+ aLine.append(static_cast<sal_Int32>(m_nRightMarginAdjust));
+ aLine.append(',');
+ aLine.append(static_cast<sal_Int32>(m_nTopMarginAdjust));
+ aLine.append(',');
+ aLine.append(static_cast<sal_Int32>(m_nBottomMarginAdjust));
+ aStream.WriteLine(aLine.makeStringAndClear());
- aLine = "colordepth=";
- aLine += ByteString::CreateFromInt32( m_nColorDepth );
- aStream.WriteLine( aLine );
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("colordepth="));
+ aLine.append(static_cast<sal_Int32>(m_nColorDepth));
+ aStream.WriteLine(aLine.makeStringAndClear());
- aLine = "pslevel=";
- aLine += ByteString::CreateFromInt32( m_nPSLevel );
- aStream.WriteLine( aLine );
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("pslevel="));
+ aLine.append(static_cast<sal_Int32>(m_nPSLevel));
+ aStream.WriteLine(aLine.makeStringAndClear());
- aLine = "pdfdevice=";
- aLine += ByteString::CreateFromInt32( m_nPDFDevice );
- aStream.WriteLine( aLine );
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("pdfdevice="));
+ aLine.append(static_cast<sal_Int32>(m_nPDFDevice));
+ aStream.WriteLine(aLine.makeStringAndClear());
- aLine = "colordevice=";
- aLine += ByteString::CreateFromInt32( m_nColorDevice );
- aStream.WriteLine( aLine );
+ aLine.append(RTL_CONSTASCII_STRINGPARAM("colordevice="));
+ aLine.append(static_cast<sal_Int32>(m_nColorDevice));
+ aStream.WriteLine(aLine.makeStringAndClear());
// now append the PPDContext stream buffer
aStream.WriteLine( "PPDContexData" );
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx
index e29855c..1448211 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -772,30 +772,30 @@ bool PrinterInfoManager::writePrinterConfig()
pConfig->DeleteGroup( it->second.m_aGroup ); // else some old keys may remain
pConfig->SetGroup( it->second.m_aGroup );
- ByteString aValue( String( it->second.m_aInfo.m_aDriverName ), RTL_TEXTENCODING_UTF8 );
- aValue += '/';
- aValue += ByteString( String( it->first ), RTL_TEXTENCODING_UTF8 );
- pConfig->WriteKey( "Printer", aValue );
+ rtl::OStringBuffer aValue(rtl::OUStringToOString(it->second.m_aInfo.m_aDriverName, RTL_TEXTENCODING_UTF8));
+ aValue.append('/');
+ aValue.append(rtl::OUStringToOString(it->first, RTL_TEXTENCODING_UTF8));
+ pConfig->WriteKey("Printer", aValue.makeStringAndClear());
pConfig->WriteKey( "DefaultPrinter", it->first == m_aDefaultPrinter ? "1" : "0" );
pConfig->WriteKey( "Location", ByteString( String( it->second.m_aInfo.m_aLocation ), RTL_TEXTENCODING_UTF8 ) );
pConfig->WriteKey( "Comment", ByteString( String( it->second.m_aInfo.m_aComment ), RTL_TEXTENCODING_UTF8 ) );
pConfig->WriteKey( "Command", ByteString( String( it->second.m_aInfo.m_aCommand ), RTL_TEXTENCODING_UTF8 ) );
pConfig->WriteKey( "QuickCommand", ByteString( String( it->second.m_aInfo.m_aQuickCommand ), RTL_TEXTENCODING_UTF8 ) );
pConfig->WriteKey( "Features", ByteString( String( it->second.m_aInfo.m_aFeatures ), RTL_TEXTENCODING_UTF8 ) );
- pConfig->WriteKey( "Copies", ByteString::CreateFromInt32( it->second.m_aInfo.m_nCopies ) );
+ pConfig->WriteKey("Copies", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nCopies)));
pConfig->WriteKey( "Orientation", it->second.m_aInfo.m_eOrientation == orientation::Landscape ? "Landscape" : "Portrait" );
- pConfig->WriteKey( "PSLevel", ByteString::CreateFromInt32( it->second.m_aInfo.m_nPSLevel ) );
- pConfig->WriteKey( "PDFDevice", ByteString::CreateFromInt32( it->second.m_aInfo.m_nPDFDevice ) );
- pConfig->WriteKey( "ColorDevice", ByteString::CreateFromInt32( it->second.m_aInfo.m_nColorDevice ) );
- pConfig->WriteKey( "ColorDepth", ByteString::CreateFromInt32( it->second.m_aInfo.m_nColorDepth ) );
- aValue = ByteString::CreateFromInt32( it->second.m_aInfo.m_nLeftMarginAdjust );
- aValue += ',';
- aValue += ByteString::CreateFromInt32( it->second.m_aInfo.m_nRightMarginAdjust );
- aValue += ',';
- aValue += ByteString::CreateFromInt32( it->second.m_aInfo.m_nTopMarginAdjust );
- aValue += ',';
- aValue += ByteString::CreateFromInt32( it->second.m_aInfo.m_nBottomMarginAdjust );
- pConfig->WriteKey( "MarginAdjust", aValue );
+ pConfig->WriteKey("PSLevel", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nPSLevel)));
+ pConfig->WriteKey("PDFDevice", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nPDFDevice)));
+ pConfig->WriteKey("ColorDevice", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nColorDevice)));
+ pConfig->WriteKey("ColorDepth", rtl::OString::valueOf(static_cast<sal_Int32>(it->second.m_aInfo.m_nColorDepth)));
+ aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nLeftMarginAdjust));
+ aValue.append(',');
+ aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nRightMarginAdjust));
+ aValue.append(',');
+ aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nTopMarginAdjust));
+ aValue.append(',');
+ aValue.append(static_cast<sal_Int32>(it->second.m_aInfo.m_nBottomMarginAdjust));
+ pConfig->WriteKey("MarginAdjust", aValue.makeStringAndClear());
if( it->second.m_aInfo.m_aDriverName.compareToAscii( "CUPS:", 5 ) != 0 )
{
@@ -807,8 +807,11 @@ bool PrinterInfoManager::writePrinterConfig()
aKey += ByteString( pKey->getKey(), RTL_TEXTENCODING_ISO_8859_1 );
const PPDValue* pValue = it->second.m_aInfo.m_aContext.getValue( pKey );
- aValue = pValue ? ByteString( pValue->m_aOption, RTL_TEXTENCODING_ISO_8859_1 ) : ByteString( "*nil" );
- pConfig->WriteKey( aKey, aValue );
+ if (pValue)
+ aValue.append(rtl::OUStringToOString(pValue->m_aOption, RTL_TEXTENCODING_ISO_8859_1));
+ else
+ aValue.append(RTL_CONSTASCII_STRINGPARAM("*nil"));
+ pConfig->WriteKey(aKey, aValue.makeStringAndClear());
}
}
diff --git a/vcl/unx/generic/printergfx/common_gfx.cxx b/vcl/unx/generic/printergfx/common_gfx.cxx
index 2c44712..49eb633 100644
--- a/vcl/unx/generic/printergfx/common_gfx.cxx
+++ b/vcl/unx/generic/printergfx/common_gfx.cxx
@@ -1230,7 +1230,7 @@ PrinterGfx::DrawEPS( const Rectangle& rBoundingBox, void* pPtr, sal_uInt32 nSize
static sal_uInt16 nEps = 0;
if( ! aDocTitle.Len() )
- aDocTitle = ByteString::CreateFromInt32( (sal_Int32)(nEps++) );
+ aDocTitle = rtl::OString::valueOf(static_cast<sal_Int32>(nEps++));
if( fLeft != fRight && fTop != fBottom )
{
diff --git a/vcl/unx/generic/printergfx/printerjob.cxx b/vcl/unx/generic/printergfx/printerjob.cxx
index 5c43ba3..c6a2261 100644
--- a/vcl/unx/generic/printergfx/printerjob.cxx
+++ b/vcl/unx/generic/printergfx/printerjob.cxx
@@ -1191,12 +1191,13 @@ bool PrinterJob::writeSetup( osl::File* pFile, const JobData& rJob )
if( ! bExternalDialog && rJob.m_nCopies > 1 )
{
// setup code
- ByteString aLine( "/#copies " );
- aLine += ByteString::CreateFromInt32( rJob.m_nCopies );
- aLine += " def\n";
+ rtl::OStringBuffer aLine(RTL_CONSTASCII_STRINGPARAM("/#copies "));
+ aLine.append(static_cast<sal_Int32>(rJob.m_nCopies));
+ aLine.append(RTL_CONSTASCII_STRINGPARAM(" def\n"));
sal_uInt64 nWritten = 0;
- bSuccess = pFile->write( aLine.GetBuffer(), aLine.Len(), nWritten )
- || nWritten != aLine.Len() ? false : true;
+ bSuccess = pFile->write(aLine.getStr(), aLine.getLength(), nWritten)
+ || nWritten != static_cast<sal_uInt64>(aLine.getLength()) ?
+ false : true;
if( bSuccess && GetPostscriptLevel( &rJob ) >= 2 )
WritePS (pFile, "<< /NumCopies null /Policies << /NumCopies 1 >> >> setpagedevice\n" );
commit 531fd565f2a6bb43ba34ed88f5265ba4ace7e3d4
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jul 1 23:05:38 2011 +0100
tweak appendLocaleInfo to return a new string
diff --git a/unotools/inc/unotools/localedatawrapper.hxx b/unotools/inc/unotools/localedatawrapper.hxx
index 4f38111..5e0a790 100644
--- a/unotools/inc/unotools/localedatawrapper.hxx
+++ b/unotools/inc/unotools/localedatawrapper.hxx
@@ -346,7 +346,7 @@ public:
/** Append locale info to string, used with locale data checking.
A string similar to "de_DE requested\n en_US loaded" is appended. */
- String& appendLocaleInfo( String& rDebugMsg ) const;
+ rtl::OUString appendLocaleInfo(const rtl::OUString& rDebugMsg) const;
/** Ouput a message during locale data checking. The (UTF-8) string is
written to stderr and in a non-product build or if DBG_UTIL is enabled
diff --git a/unotools/source/i18n/localedatawrapper.cxx b/unotools/source/i18n/localedatawrapper.cxx
index 01da755..c6367bf 100644
--- a/unotools/source/i18n/localedatawrapper.cxx
+++ b/unotools/source/i18n/localedatawrapper.cxx
@@ -51,6 +51,7 @@
#include <com/sun/star/i18n/NumberFormatIndex.hdl>
#include <rtl/instance.hxx>
+#include <rtl/ustrbuf.hxx>
#include <sal/macros.h>
#define LOCALEDATA_LIBRARYNAME "i18npool"
@@ -770,7 +771,7 @@ void LocaleDataWrapper::getCurrSymbolsImpl()
{
if (areChecksEnabled())
{
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
+ rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM(
"LocaleDataWrapper::getCurrSymbolsImpl: no default currency"));
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
@@ -882,7 +883,7 @@ void LocaleDataWrapper::getCurrFormatsImpl()
{ // bad luck
if (areChecksEnabled())
{
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
+ rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM(
"LocaleDataWrapper::getCurrFormatsImpl: no currency formats"));
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
@@ -931,7 +932,7 @@ void LocaleDataWrapper::getCurrFormatsImpl()
scanCurrFormatImpl( pFormatArr[nElem].Code, 0, nSign, nPar, nNum, nBlank, nSym );
if (areChecksEnabled() && (nNum == STRING_NOTFOUND || nSym == STRING_NOTFOUND))
{
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
+ rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM(
"LocaleDataWrapper::getCurrFormatsImpl: CurrPositiveFormat?"));
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
@@ -962,7 +963,7 @@ void LocaleDataWrapper::getCurrFormatsImpl()
nSym == STRING_NOTFOUND || (nPar == STRING_NOTFOUND &&
nSign == STRING_NOTFOUND)))
{
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
+ rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM(
"LocaleDataWrapper::getCurrFormatsImpl: CurrNegativeFormat?"));
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
@@ -1098,7 +1099,7 @@ DateFormat LocaleDataWrapper::scanDateFormatImpl( const String& rCode )
{
if (areChecksEnabled())
{
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
+ rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM(
"LocaleDataWrapper::scanDateFormat: not all DMY present"));
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
@@ -1121,7 +1122,7 @@ DateFormat LocaleDataWrapper::scanDateFormatImpl( const String& rCode )
{
if (areChecksEnabled())
{
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
+ rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM(
"LocaleDataWrapper::scanDateFormat: no magic applyable"));
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
@@ -1140,7 +1141,7 @@ void LocaleDataWrapper::getDateFormatsImpl()
{ // bad luck
if (areChecksEnabled())
{
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
+ rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM(
"LocaleDataWrapper::getDateFormatsImpl: no date formats"));
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
@@ -1185,7 +1186,7 @@ void LocaleDataWrapper::getDateFormatsImpl()
{
if (areChecksEnabled())
{
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
+ rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM(
"LocaleDataWrapper::getDateFormatsImpl: no edit"));
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
@@ -1193,7 +1194,7 @@ void LocaleDataWrapper::getDateFormatsImpl()
{
if (areChecksEnabled())
{
- String aMsg( RTL_CONSTASCII_USTRINGPARAM(
+ rtl::OUString aMsg( RTL_CONSTASCII_USTRINGPARAM(
"LocaleDataWrapper::getDateFormatsImpl: no default"));
outputCheckMessage( appendLocaleInfo( aMsg ) );
}
@@ -1930,20 +1931,21 @@ String LocaleDataWrapper::getCurr( sal_Int64 nNumber, sal_uInt16 nDecimals,
}
-String& LocaleDataWrapper::appendLocaleInfo( String& rDebugMsg ) const
+rtl::OUString LocaleDataWrapper::appendLocaleInfo(const rtl::OUString& rDebugMsg) const
{
::utl::ReadWriteGuard aGuard( aMutex, ::utl::ReadWriteGuardMode::nBlockCritical );
- rDebugMsg += '\n';
- rDebugMsg += String( aLocale.Language);
- rDebugMsg += '_';
- rDebugMsg += String( aLocale.Country);
- rDebugMsg.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " requested\n" ) );
+ rtl::OUStringBuffer aDebugMsg(rDebugMsg);
+ aDebugMsg.append(static_cast<sal_Unicode>('\n'));
+ aDebugMsg.append(aLocale.Language);
+ aDebugMsg.append(static_cast<sal_Unicode>('_'));
+ aDebugMsg.append(aLocale.Country);
+ aDebugMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM(" requested\n"));
lang::Locale aLoaded = getLoadedLocale();
- rDebugMsg += String( aLoaded.Language);
- rDebugMsg += '_';
- rDebugMsg += String( aLoaded.Country);
- rDebugMsg.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " loaded" ) );
- return rDebugMsg;
+ aDebugMsg.append(aLoaded.Language);
+ aDebugMsg.append(static_cast<sal_Unicode>('_'));
+ aDebugMsg.append(aLoaded.Country);
+ aDebugMsg.appendAscii(RTL_CONSTASCII_STRINGPARAM(" loaded"));
+ return aDebugMsg.makeStringAndClear();
}
commit aec5b067f01355a99161831549b7646a96f58513
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jul 1 23:01:39 2011 +0100
ByteString::CreateFromInt32 -> OString::valueOf
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index d078897..c6e78a7 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -1153,8 +1153,8 @@ sal_Bool SfxStyleSheetBasePool::Store( SvStream& rStream, sal_Bool bUsed )
sal_uInt16 nInsPos, nAdd = aSortConvNames.Count();
while( !aSortConvNames.Insert( pConvName, nInsPos ) )
- (pConvName->Append( '_' )).Append(
- ByteString::CreateFromInt32( nAdd++ ));
+ (pConvName->Append( '_' )).Append(ByteString(
+ rtl::OString::valueOf(static_cast<sal_Int32>(nAdd++))));
aOrigNames.Insert( pName, nInsPos );
}
}
diff --git a/svl/source/items/whassert.hxx b/svl/source/items/whassert.hxx
index 56ba79d..e0f6efc 100644
--- a/svl/source/items/whassert.hxx
+++ b/svl/source/items/whassert.hxx
@@ -29,7 +29,7 @@
#define _SFX_WHASSERT_HXX
#include <tools/debug.hxx>
-#include <tools/string.hxx>
+#include <rtl/strbuf.hxx>
//------------------------------------------------------------------------
@@ -40,10 +40,10 @@
{ \
if ( !(bCondition) ) \
{ \
- ByteString aMsg( sMessage ); \
- aMsg.Append(RTL_CONSTASCII_STRINGPARAM("\nwith Id/Pos: ")); \
- aMsg += ByteString::CreateFromInt32( nId ); \
- DbgError( aMsg.GetBuffer(), __FILE__, __LINE__); \
+ rtl::OStringBuffer aMsg(sMessage); \
+ aMsg.append(RTL_CONSTASCII_STRINGPARAM("\nwith Id/Pos: ")); \
+ aMsg.append(static_cast<sal_Int32>(nId)); \
+ DbgError(aMsg.getStr(), __FILE__, __LINE__); \
} \
} \
}
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index ed24381..2f28380 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -57,6 +57,7 @@
#include <unotools/digitgroupingiterator.hxx>
#include <rtl/logfile.hxx>
#include <rtl/instance.hxx>
+#include <rtl/strbuf.hxx>
#include <math.h>
#include <limits>
@@ -2091,8 +2092,9 @@ sal_Int32 SvNumberFormatter::ImpAdjustFormatCodeDefault(
if ( !nCnt )
return -1;
if (bCheckCorrectness && LocaleDataWrapper::areChecksEnabled())
- { // check the locale data for correctness
- ByteString aMsg;
+ {
+ // check the locale data for correctness
+ rtl::OStringBuffer aMsg;
sal_Int32 nElem, nShort, nMedium, nLong, nShortDef, nMediumDef, nLongDef;
nShort = nMedium = nLong = nShortDef = nMediumDef = nLongDef = -1;
for ( nElem = 0; nElem < nCnt; nElem++ )
@@ -2109,7 +2111,7 @@ sal_Int32 SvNumberFormatter::ImpAdjustFormatCodeDefault(
nLong = nElem;
break;
default:
- aMsg = "unknown type";
+ aMsg.append(RTL_CONSTASCII_STRINGPARAM("unknown type"));
}
if ( pFormatArr[nElem].Default )
{
@@ -2117,47 +2119,44 @@ sal_Int32 SvNumberFormatter::ImpAdjustFormatCodeDefault(
{
case i18n::KNumberFormatType::SHORT :
if ( nShortDef != -1 )
- aMsg = "dupe short type default";
+ aMsg.append(RTL_CONSTASCII_STRINGPARAM("dupe short type default"));
nShortDef = nElem;
break;
case i18n::KNumberFormatType::MEDIUM :
if ( nMediumDef != -1 )
- aMsg = "dupe medium type default";
+ aMsg.append(RTL_CONSTASCII_STRINGPARAM("dupe medium type default"));
nMediumDef = nElem;
break;
case i18n::KNumberFormatType::LONG :
if ( nLongDef != -1 )
- aMsg = "dupe long type default";
+ aMsg.append(RTL_CONSTASCII_STRINGPARAM("dupe long type default"));
nLongDef = nElem;
break;
}
}
- if ( aMsg.Len() )
+ if (aMsg.getLength())
{
- aMsg.Insert( "SvNumberFormatter::ImpAdjustFormatCodeDefault: ", 0 );
- aMsg += "\nXML locale data FormatElement formatindex: ";
- aMsg += ByteString::CreateFromInt32( pFormatArr[nElem].Index );
- String aUMsg( aMsg, RTL_TEXTENCODING_ASCII_US);
- LocaleDataWrapper::outputCheckMessage(
- xLocaleData->appendLocaleInfo( aUMsg));
- aMsg.Erase();
+ aMsg.insert(0, RTL_CONSTASCII_STRINGPARAM("SvNumberFormatter::ImpAdjustFormatCodeDefault: "));
+ aMsg.append(RTL_CONSTASCII_STRINGPARAM("\nXML locale data FormatElement formatindex: "));
+ aMsg.append(static_cast<sal_Int32>(pFormatArr[nElem].Index));
+ rtl::OUString aUMsg(rtl::OStringToOUString(aMsg.makeStringAndClear(),
+ RTL_TEXTENCODING_ASCII_US));
+ LocaleDataWrapper::outputCheckMessage(xLocaleData->appendLocaleInfo(aUMsg));
}
}
if ( nShort != -1 && nShortDef == -1 )
- aMsg += "no short type default ";
+ aMsg.append(RTL_CONSTASCII_STRINGPARAM("no short type default "));
if ( nMedium != -1 && nMediumDef == -1 )
- aMsg += "no medium type default ";
+ aMsg.append(RTL_CONSTASCII_STRINGPARAM("no medium type default "));
if ( nLong != -1 && nLongDef == -1 )
- aMsg += "no long type default ";
- if ( aMsg.Len() )
+ aMsg.append(RTL_CONSTASCII_STRINGPARAM("no long type default "));
+ if (aMsg.getLength())
{
- aMsg.Insert( "SvNumberFormatter::ImpAdjustFormatCodeDefault: ", 0 );
- aMsg += "\nXML locale data FormatElement group of: ";
- String aUMsg( aMsg, RTL_TEXTENCODING_ASCII_US);
- aUMsg += String( pFormatArr[0].NameID );
+ aMsg.insert(0, RTL_CONSTASCII_STRINGPARAM("SvNumberFormatter::ImpAdjustFormatCodeDefault: "));
+ aMsg.append(RTL_CONSTASCII_STRINGPARAM("\nXML locale data FormatElement group of: "));
+ rtl::OUString aUMsg(rtl::OStringToOUString(aMsg.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US));
LocaleDataWrapper::outputCheckMessage(
- xLocaleData->appendLocaleInfo( aUMsg));
- aMsg.Erase();
+ xLocaleData->appendLocaleInfo(aUMsg + pFormatArr[0].NameID));
}
}
// find the default (medium preferred, then long) and reset all other defaults
@@ -3533,21 +3532,12 @@ void SvNumberFormatter::GetCompatibilityCurrency( String& rSymbol, String& rAbbr
void lcl_CheckCurrencySymbolPosition( const NfCurrencyEntry& rCurr )
{
- short nPos = -1; // -1:=unknown, 0:=vorne, 1:=hinten
- short nNeg = -1;
switch ( rCurr.GetPositiveFormat() )
{
case 0: // $1
- nPos = 0;
- break;
case 1: // 1$
- nPos = 1;
- break;
case 2: // $ 1
- nPos = 0;
- break;
case 3: // 1 $
- nPos = 1;
break;
default:
LocaleDataWrapper::outputCheckMessage(
@@ -3557,75 +3547,27 @@ void lcl_CheckCurrencySymbolPosition( const NfCurrencyEntry& rCurr )
switch ( rCurr.GetNegativeFormat() )
{
case 0: // ($1)
- nNeg = 0;
- break;
case 1: // -$1
- nNeg = 0;
- break;
case 2: // $-1
- nNeg = 0;
- break;
case 3: // $1-
- nNeg = 0;
- break;
case 4: // (1$)
- nNeg = 1;
- break;
case 5: // -1$
- nNeg = 1;
- break;
case 6: // 1-$
- nNeg = 1;
- break;
case 7: // 1$-
- nNeg = 1;
- break;
case 8: // -1 $
- nNeg = 1;
- break;
case 9: // -$ 1
- nNeg = 0;
- break;
case 10: // 1 $-
- nNeg = 1;
- break;
case 11: // $ -1
- nNeg = 0;
- break;
case 12 : // $ 1-
- nNeg = 0;
- break;
case 13 : // 1- $
- nNeg = 1;
- break;
case 14 : // ($ 1)
- nNeg = 0;
- break;
case 15 : // (1 $)
- nNeg = 1;
break;
default:
LocaleDataWrapper::outputCheckMessage(
"lcl_CheckCurrencySymbolPosition: unknown NegativeFormat");
break;
}
- if ( nPos >= 0 && nNeg >= 0 && nPos != nNeg )
- {
- ByteString aStr( "positions of currency symbols differ\nLanguage: " );
- aStr += ByteString::CreateFromInt32( rCurr.GetLanguage() );
- aStr += " <";
- aStr += ByteString( rCurr.GetSymbol(), RTL_TEXTENCODING_UTF8 );
- aStr += "> positive: ";
- aStr += ByteString::CreateFromInt32( rCurr.GetPositiveFormat() );
- aStr += ( nPos ? " (postfix)" : " (prefix)" );
- aStr += ", negative: ";
- aStr += ByteString::CreateFromInt32( rCurr.GetNegativeFormat() );
- aStr += ( nNeg ? " (postfix)" : " (prefix)" );
-#if 0
-// seems that there really are some currencies which differ, e.g. YugoDinar
- DBG_ERRORFILE( aStr.GetBuffer() );
-#endif
- }
}
commit 6a6a34beee6791113fc11a26a4cf7a42ee20213b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Jul 1 22:27:20 2011 +0100
ByteString::CreateFromInt32 -> OString::valueOf
diff --git a/l10ntools/inc/cfgmerge.hxx b/l10ntools/inc/cfgmerge.hxx
index 9308d0c..c8f3d99 100644
--- a/l10ntools/inc/cfgmerge.hxx
+++ b/l10ntools/inc/cfgmerge.hxx
@@ -33,8 +33,7 @@
#include <boost/unordered_map.hpp>
#include <vector>
-typedef boost::unordered_map<ByteString , ByteString , hashByteString,equalByteString>
- ByteStringHashMap;
+typedef boost::unordered_map<rtl::OString, rtl::OString, rtl::OStringHash> ByteStringHashMap;
//
diff --git a/l10ntools/inc/export.hxx b/l10ntools/inc/export.hxx
index 7be7aaa..d8a70af 100644
--- a/l10ntools/inc/export.hxx
+++ b/l10ntools/inc/export.hxx
@@ -84,8 +84,7 @@ class PFormEntrys;
class MergeData;
typedef std::set<ByteString , lessByteString > ByteStringSet;
-typedef boost::unordered_map<ByteString , ByteString , hashByteString,equalByteString>
- ByteStringHashMap;
+typedef boost::unordered_map<rtl::OString, rtl::OString, rtl::OStringHash> ByteStringHashMap;
typedef boost::unordered_map<ByteString , bool , hashByteString,equalByteString>
ByteStringBoolHashMap;
@@ -197,8 +196,8 @@ public:
void addFallbackData( ByteString& sId , const ByteString& sText );
bool getFallbackData( ByteString& sId , ByteString& sText);
- void addMergedLanguage( ByteString& sLang );
- bool isMerged( ByteString& sLang );
+ void addMergedLanguage(rtl::OString& rLang);
+ bool isMerged(rtl::OString& rLang);
ResData( const ByteString &rPF, const ByteString &rGId )
:
nWidth( 0 ),
@@ -307,7 +306,7 @@ private:
sal_Bool bNextMustBeDefineEOL; // define but no \ at lineend
sal_uLong nLevel; // res. recursiv? how deep?
sal_uInt16 nList; // cur. res. is String- or FilterList
- ByteString nListLang;
+ rtl::OString m_sListLang;
sal_uLong nListIndex;
sal_uLong nListLevel;
bool bSkipFile;
@@ -389,8 +388,8 @@ private:
void CleanValue( ByteString &rValue );
ByteString GetText( const ByteString &rSource, int nToken );
- sal_Bool PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp,
- ByteString &nLangIndex, ResData *pResData );
+ sal_Bool PrepareTextToMerge(ByteString &rText, sal_uInt16 nTyp,
+ rtl::OString &rLangIndex, ResData *pResData);
void MergeRest( ResData *pResData, sal_uInt16 nMode = MERGE_MODE_NORMAL );
void ConvertMergeContent( ByteString &rText );
diff --git a/l10ntools/source/cfglex.l b/l10ntools/source/cfglex.l
index a6f6b36..feb2882 100644
--- a/l10ntools/source/cfglex.l
+++ b/l10ntools/source/cfglex.l
@@ -137,7 +137,7 @@ int yywrap(void)
}
/*****************************************************************************/
-void YYWarning( char *s )
+void YYWarning( const char *s )
/*****************************************************************************/
{
/* write warning to stderr */
@@ -147,9 +147,9 @@ void YYWarning( char *s )
/*****************************************************************************/
#ifdef GCC
-void yyerror ( char *s, ... )
+void yyerror ( const char *s, ... )
#else
-void yyerror ( char *s )
+void yyerror ( const char *s )
#endif
/*****************************************************************************/
{
diff --git a/l10ntools/source/cfgmerge.cxx b/l10ntools/source/cfgmerge.cxx
index f2a713c..55aed2c 100644
--- a/l10ntools/source/cfgmerge.cxx
+++ b/l10ntools/source/cfgmerge.cxx
@@ -644,13 +644,13 @@ void CfgExport::WorkOnRessourceEnd()
/*****************************************************************************/
{
if ( pOutputStream && bLocalize ) {
- if (( pStackData->sText[ ByteString("en-US") ].Len()
+ if (( pStackData->sText[rtl::OString(RTL_CONSTASCII_STRINGPARAM("en-US"))].getLength()
) ||
( bForce &&
- ( pStackData->sText[ ByteString("de") ].Len() ||
- pStackData->sText[ ByteString("en-US") ].Len() )))
+ ( pStackData->sText[rtl::OString(RTL_CONSTASCII_STRINGPARAM("de"))].getLength() ||
+ pStackData->sText[rtl::OString(RTL_CONSTASCII_STRINGPARAM("en-US"))].getLength() )))
{
- ByteString sFallback = pStackData->sText[ ByteString("en-US") ];
+ ByteString sFallback = pStackData->sText[rtl::OString(RTL_CONSTASCII_STRINGPARAM("en-US"))];
ByteString sLocalId = pStackData->sIdentifier;
ByteString sGroupId;
if ( aStack.size() == 1 ) {
@@ -663,29 +663,29 @@ void CfgExport::WorkOnRessourceEnd()
ByteString sTimeStamp( Export::GetTimeStamp());
- ByteString sCur;
- for( unsigned int n = 0; n < aLanguages.size(); n++ ){
- sCur = aLanguages[ n ];
+ for (size_t n = 0; n < aLanguages.size(); n++)
+ {
+ ByteString sCur = aLanguages[ n ];
- ByteString sText = pStackData->sText[ sCur ];
- if ( !sText.Len())
- sText = sFallback;
+ ByteString sText = pStackData->sText[ sCur ];
+ if ( !sText.Len())
+ sText = sFallback;
- Export::UnquotHTML( sText );
+ Export::UnquotHTML( sText );
- ByteString sOutput( sPrj ); sOutput += "\t";
- sOutput += sPath;
- sOutput += "\t0\t";
- sOutput += pStackData->sResTyp; sOutput += "\t";
- sOutput += sGroupId; sOutput += "\t";
- sOutput += sLocalId; sOutput += "\t\t\t0\t";
- sOutput += sCur;
- sOutput += "\t";
+ ByteString sOutput( sPrj ); sOutput += "\t";
+ sOutput += sPath;
+ sOutput += "\t0\t";
+ sOutput += pStackData->sResTyp; sOutput += "\t";
+ sOutput += sGroupId; sOutput += "\t";
+ sOutput += sLocalId; sOutput += "\t\t\t0\t";
+ sOutput += sCur;
+ sOutput += "\t";
- sOutput += sText; sOutput += "\t\t\t\t";
- sOutput += sTimeStamp;
+ sOutput += sText; sOutput += "\t\t\t\t";
+ sOutput += sTimeStamp;
- pOutputStream->WriteLine( sOutput );
+ pOutputStream->WriteLine( sOutput );
}
}
}
diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index 9633705..46bbc76 100644
--- a/l10ntools/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -35,9 +35,10 @@
#include "tokens.h"
#include <iostream>
#include <vector>
+#include <rtl/strbuf.hxx>
-extern "C" { int yyerror( char * ); }
-extern "C" { int YYWarning( char * ); }
+extern "C" { int yyerror( const char * ); }
+extern "C" { int YYWarning( const char * ); }
Export *pExport = 0L;
@@ -363,11 +364,14 @@ bool ResData::getFallbackData( ByteString& sId_in , ByteString& sText_inout ){
return sText_inout.Len() > 0;
}
-void ResData::addMergedLanguage( ByteString& sLang ){
- aMergedLanguages[ sLang ]=ByteString("1");
+void ResData::addMergedLanguage(rtl::OString& rLang)
+{
+ aMergedLanguages[rLang] = rtl::OString(RTL_CONSTASCII_STRINGPARAM("1"));
}
-bool ResData::isMerged( ByteString& sLang ){
- return aMergedLanguages[ sLang ].Equals("1");
+
+bool ResData::isMerged(rtl::OString& rLang)
+{
+ return aMergedLanguages[rLang].equalsL(RTL_CONSTASCII_STRINGPARAM("1"));
}
/*****************************************************************************/
@@ -379,10 +383,10 @@ sal_Bool ResData::SetId( const ByteString &rId, sal_uInt16 nLevel )
nIdLevel = nLevel;
sId = rId;
- if ( bChild && bChildWithText ) {
- ByteString sError( "ResId after child definition" );
- yyerror( sError.GetBufferAccess());
- sError.ReleaseBufferAccess();
+ if ( bChild && bChildWithText )
+ {
+ rtl::OString sError(RTL_CONSTASCII_STRINGPARAM("ResId after child definition"));
+ yyerror(sError.getStr());
SetError();
}
@@ -500,7 +504,7 @@ void Export::Init()
bNextMustBeDefineEOL = sal_False;
nLevel = 0;
nList = LIST_NON;
- nListLang = ByteString( String::CreateFromAscii(""),RTL_TEXTENCODING_ASCII_US );
+ m_sListLang = ByteString( String::CreateFromAscii(""),RTL_TEXTENCODING_ASCII_US );
nListIndex = 0;
for ( size_t i = 0, n = aResStack.size(); i < n; ++i )
delete aResStack[ i ];
@@ -789,21 +793,21 @@ int Export::Execute( int nToken, const char * pToken )
else if ( sKey == "STRINGLIST" ) {
pResData->bList = sal_True;
nList = LIST_STRING;
- nListLang = SOURCE_LANGUAGE;
+ m_sListLang = SOURCE_LANGUAGE;
nListIndex = 0;
nListLevel = 0;
}
else if ( sKey == "FILTERLIST" ) {
pResData->bList = sal_True;
nList = LIST_FILTER;
- nListLang = SOURCE_LANGUAGE;
+ m_sListLang = SOURCE_LANGUAGE;
nListIndex = 0;
nListLevel = 0;
}
else if ( sKey == "UIENTRIES" ) {
pResData->bList = sal_True;
nList = LIST_UIENTRIES;
- nListLang = SOURCE_LANGUAGE;
+ m_sListLang = SOURCE_LANGUAGE;
nListIndex = 0;
nListLevel = 0;
}
@@ -830,14 +834,14 @@ int Export::Execute( int nToken, const char * pToken )
if ( sKey.ToUpperAscii() == "STRINGLIST" ) {
pResData->bList = sal_True;
nList = LIST_STRING;
- nListLang = SOURCE_LANGUAGE;
+ m_sListLang = SOURCE_LANGUAGE;
nListIndex = 0;
nListLevel = 0;
}
else if ( sKey == "FILTERLIST" ) {
pResData->bList = sal_True;
nList = LIST_FILTER;
- nListLang = SOURCE_LANGUAGE;
+ m_sListLang = SOURCE_LANGUAGE;
nListIndex = 0;
nListLevel = 0;
}
@@ -845,7 +849,7 @@ int Export::Execute( int nToken, const char * pToken )
else if ( sKey == "PAIREDLIST" ) {
pResData->bList = sal_True;
nList = LIST_PAIRED;
- nListLang = SOURCE_LANGUAGE;
+ m_sListLang = SOURCE_LANGUAGE;
nListIndex = 0;
nListLevel = 0;
}
@@ -853,14 +857,14 @@ int Export::Execute( int nToken, const char * pToken )
else if ( sKey == "ITEMLIST" ) {
pResData->bList = sal_True;
nList = LIST_ITEM;
- nListLang = SOURCE_LANGUAGE;
+ m_sListLang = SOURCE_LANGUAGE;
nListIndex = 0;
nListLevel = 0;
}
else if ( sKey == "UIENTRIES" ) {
pResData->bList = sal_True;
nList = LIST_UIENTRIES;
- nListLang = SOURCE_LANGUAGE;
+ m_sListLang = SOURCE_LANGUAGE;
nListIndex = 0;
nListLevel = 0;
}
@@ -883,7 +887,7 @@ int Export::Execute( int nToken, const char * pToken )
if ( nList ) {
ByteString sLang=sToken.GetToken( 1, '[' ).GetToken( 0, ']' );
CleanValue( sLang );
- nListLang = sLang;
+ m_sListLang = sLang;
nListIndex = 0;
nListLevel = 0;
}
@@ -902,8 +906,9 @@ int Export::Execute( int nToken, const char * pToken )
if ( sEntry == "\\\"" )
sEntry = "\"";
InsertListEntry( sEntry, sOrig );
- if ( bMergeMode && ( sEntry != "\"" )) {
- PrepareTextToMerge( sOrig, nList, nListLang, pResData );
+ if ( bMergeMode && ( sEntry != "\"" ))
+ {
+ PrepareTextToMerge( sOrig, nList, m_sListLang, pResData );
}
}
}
@@ -926,7 +931,7 @@ int Export::Execute( int nToken, const char * pToken )
sLang = sToken.GetToken( 0, '=' ).GetToken( 1, '[' ).GetToken( 0, ']' );
CleanValue( sLang );
}
- ByteString nLangIndex = sLang;
+ rtl::OString sLangIndex = sLang;
ByteString sOrigKey = sKey;
if ( sText.Len() && sLang.Len() ) {
if (( sKey.ToUpperAscii() == "TEXT" ) ||
@@ -936,69 +941,82 @@ int Export::Execute( int nToken, const char * pToken )
( sKey == "UINAME" ))
{
SetChildWithText();
- if ( Export::isSourceLanguage( nLangIndex ) )
+ if ( Export::isSourceLanguage( sLangIndex ) )
pResData->SetId( sText, ID_LEVEL_TEXT );
pResData->bText = sal_True;
pResData->sTextTyp = sOrigKey;
if ( bMergeMode ) {
- PrepareTextToMerge( sOrig, STRING_TYP_TEXT, nLangIndex, pResData );
+ PrepareTextToMerge( sOrig, STRING_TYP_TEXT, sLangIndex, pResData );
}
- else {
- if ( pResData->sText[ nLangIndex ].Len()) {
- ByteString sError( "Language " );
- sError += nLangIndex;
- sError += " defined twice";
+ else
+ {
+ if (pResData->sText[ sLangIndex ].getLength())
+ {
+ rtl::OStringBuffer sError(RTL_CONSTASCII_STRINGPARAM("Language "));
+ sError.append(sLangIndex);
+ sError.append(RTL_CONSTASCII_STRINGPARAM("defined twice"));
+ yyerror(sError.getStr());
}
- pResData->sText[ nLangIndex ] = sText;
+ pResData->sText[ sLangIndex ] = sText;
}
}
else if ( sKey == "HELPTEXT" ) {
SetChildWithText();
pResData->bHelpText = sal_True;
- if ( bBreakWhenHelpText ) {
- ByteString sError( "\"HelpText\" found in source\n" );
- YYWarning( sError.GetBufferAccess());
- sError.ReleaseBufferAccess();
+ if ( bBreakWhenHelpText )
+ {
+ rtl::OString sError(
+ RTL_CONSTASCII_STRINGPARAM("\"HelpText\" found in source\n"));
+ YYWarning(sError.getStr());
SetError();
}
if ( bMergeMode )
- PrepareTextToMerge( sOrig, STRING_TYP_HELPTEXT, nLangIndex, pResData );
- else {
- if ( pResData->sHelpText[ nLangIndex ].Len()) {
- ByteString sError( "Language " );
- sError += nLangIndex;
- sError += " defined twice";
+ PrepareTextToMerge( sOrig, STRING_TYP_HELPTEXT, sLangIndex, pResData );
+ else
+ {
+ if (pResData->sHelpText[ sLangIndex ].getLength())
+ {
+ rtl::OStringBuffer sError(RTL_CONSTASCII_STRINGPARAM("Language "));
+ sError.append(sLangIndex);
+ sError.append(" defined twice");
+ YYWarning(sError.getStr());
}
- pResData->sHelpText[ nLangIndex ] = sText;
+ pResData->sHelpText[ sLangIndex ] = sText;
}
}
else if ( sKey == "QUICKHELPTEXT" ) {
SetChildWithText();
pResData->bQuickHelpText = sal_True;
if ( bMergeMode )
- PrepareTextToMerge( sOrig, STRING_TYP_QUICKHELPTEXT, nLangIndex, pResData );
- else {
- if ( pResData->sQuickHelpText[ nLangIndex ].Len()) {
- ByteString sError( "Language " );
- sError += nLangIndex;
- sError += " defined twice";
+ PrepareTextToMerge( sOrig, STRING_TYP_QUICKHELPTEXT, sLangIndex, pResData );
+ else
+ {
+ if (pResData->sQuickHelpText[ sLangIndex ].getLength())
+ {
+ rtl::OStringBuffer sError(RTL_CONSTASCII_STRINGPARAM("Language "));
+ sError.append(sLangIndex);
+ sError.append(RTL_CONSTASCII_STRINGPARAM(" defined twice"));
+ YYWarning(sError.getStr());
}
- pResData->sQuickHelpText[ nLangIndex ] = sText;
+ pResData->sQuickHelpText[ sLangIndex ] = sText;
}
}
else if ( sKey == "TITLE" ) {
SetChildWithText();
pResData->bTitle = sal_True;
if ( bMergeMode )
- PrepareTextToMerge( sOrig, STRING_TYP_TITLE, nLangIndex, pResData );
- else {
- if ( pResData->sTitle[ nLangIndex ].Len()) {
- ByteString sError( "Language " );
- sError += nLangIndex;
- sError += " defined twice";
+ PrepareTextToMerge( sOrig, STRING_TYP_TITLE, sLangIndex, pResData );
+ else
+ {
+ if ( pResData->sTitle[ sLangIndex ].getLength())
+ {
+ rtl::OStringBuffer sError(RTL_CONSTASCII_STRINGPARAM("Language "));
+ sError.append(sLangIndex);
+ sError.append(RTL_CONSTASCII_STRINGPARAM(" defined twice"));
+ YYWarning(sError.getStr());
}
- pResData->sTitle[ nLangIndex ] = sText;
+ pResData->sTitle[ sLangIndex ] = sText;
}
}
else if ( sKey == "ACCESSPATH" ) {
@@ -1169,13 +1187,13 @@ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew )
// mandatory to export: en-US
- if (( pResData->sText[ SOURCE_LANGUAGE ].Len())
+ if (( pResData->sText[ SOURCE_LANGUAGE ].getLength())
||
- ( pResData->sHelpText[ SOURCE_LANGUAGE ].Len())
+ ( pResData->sHelpText[ SOURCE_LANGUAGE ].getLength())
||
- ( pResData->sQuickHelpText[ SOURCE_LANGUAGE ].Len())
+ ( pResData->sQuickHelpText[ SOURCE_LANGUAGE ].getLength())
||
- ( pResData->sTitle[ SOURCE_LANGUAGE ].Len()))
+ ( pResData->sTitle[ SOURCE_LANGUAGE ].getLength()))
{
FillInFallbacks( pResData );
@@ -1198,35 +1216,35 @@ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew )
for( unsigned int n = 0; n < aLanguages.size(); n++ ){
sCur = aLanguages[ n ];
if ( !sCur.EqualsIgnoreCaseAscii("x-comment") ){
- if ( pResData->sText[ sCur ].Len())
+ if (pResData->sText[ sCur ].getLength())
sXText = pResData->sText[ sCur ];
else {
sXText = pResData->sText[ SOURCE_LANGUAGE ];
}
- if ( pResData->sHelpText[ sCur ].Len())
+ if (pResData->sHelpText[ sCur ].getLength())
sXHText = pResData->sHelpText[ sCur ];
else {
sXHText = pResData->sHelpText[ SOURCE_LANGUAGE ];
}
- if ( pResData->sQuickHelpText[ sCur ].Len())
+ if (pResData->sQuickHelpText[ sCur ].getLength())
sXQHText = pResData->sQuickHelpText[ sCur ];
else {
sXQHText = pResData->sQuickHelpText[ SOURCE_LANGUAGE ];
}
- if ( pResData->sTitle[ sCur ].Len())
+ if (pResData->sTitle[ sCur ].getLength())
sXTitle = pResData->sTitle[ sCur ];
- else {
+ else
sXTitle = pResData->sTitle[ SOURCE_LANGUAGE ];
- }
if ( !sXText.Len())
sXText = "-";
- if ( !sXHText.Len()) {
- if ( pResData->sHelpText[ SOURCE_LANGUAGE ].Len())
+ if ( !sXHText.Len())
+ {
+ if (pResData->sHelpText[ SOURCE_LANGUAGE ].getLength())
sXHText = pResData->sHelpText[ SOURCE_LANGUAGE ];
}
}
@@ -1345,44 +1363,47 @@ sal_Bool Export::WriteExportList( ResData *pResData, ExportList *pExportList,
// Export::DumpMap( a, *pEntry );
ByteString sLID(rtl::OString::valueOf(static_cast<sal_Int64>(i + 1)));
- for( unsigned int n = 0; n < aLanguages.size(); n++ ){
+ for (unsigned int n = 0; n < aLanguages.size(); ++n)
+ {
sCur = aLanguages[ n ];
- if ( (*pEntry)[ SOURCE_LANGUAGE ].Len() )
+ if ((*pEntry)[ SOURCE_LANGUAGE ].getLength())
+ {
+ if ( bEnableExport )
{
- if ( bEnableExport )
+ ByteString sText((*pEntry)[ SOURCE_LANGUAGE ] );
+
+ // Strip PairList Line String
+ if( rTyp.EqualsIgnoreCaseAscii("pairedlist") )
{
- ByteString sText((*pEntry)[ SOURCE_LANGUAGE ] );
-
- // Strip PairList Line String
- if( rTyp.EqualsIgnoreCaseAscii("pairedlist") ){
- sLID = GetPairedListID( sText );
- if ((*pEntry)[ sCur ].Len())
- sText = (*pEntry)[ sCur ];
- sText = GetPairedListString( sText );
- }
- else{
- sText = StripList( (*pEntry)[ sCur ] );
- if( sText == "\\\"" )
- sText = "\"";
- }
+ sLID = GetPairedListID( sText );
+ if ((*pEntry)[ sCur ].getLength())
+ sText = (*pEntry)[ sCur ];
+ sText = GetPairedListString( sText );
+ }
+ else
+ {
+ sText = StripList( (*pEntry)[ sCur ] );
+ if( sText == "\\\"" )
+ sText = "\"";
+ }
- ByteString sOutput( sProject ); sOutput += "\t";
- if ( sRoot.Len())
- sOutput += sActFileName;
- sOutput += "\t0\t";
- sOutput += rTyp; sOutput += "\t";
- sOutput += sGID; sOutput += "\t";
- sOutput += sLID; sOutput += "\t\t";
- sOutput += pResData->sPForm; sOutput += "\t0\t";
- sOutput += sCur; sOutput += "\t";
+ ByteString sOutput( sProject ); sOutput += "\t";
+ if ( sRoot.Len())
+ sOutput += sActFileName;
+ sOutput += "\t0\t";
+ sOutput += rTyp; sOutput += "\t";
+ sOutput += sGID; sOutput += "\t";
+ sOutput += sLID; sOutput += "\t\t";
+ sOutput += pResData->sPForm; sOutput += "\t0\t";
+ sOutput += sCur; sOutput += "\t";
- sOutput += sText; sOutput += "\t\t\t\t";
- sOutput += sTimeStamp;
+ sOutput += sText; sOutput += "\t\t\t\t";
+ sOutput += sTimeStamp;
- aOutput.WriteLine( sOutput );
+ aOutput.WriteLine( sOutput );
- }
}
+ }
}
if ( bCreateNew )
delete [] pEntry;
@@ -1408,11 +1429,11 @@ ByteString Export::FullId()
}
}
}
- if ( sFull.Len() > 255 ) {
- ByteString sError( "GroupId > 255 chars" );
- printf("GroupID = %s\n",sFull.GetBuffer());
- yyerror( sError.GetBufferAccess());
- sError.ReleaseBufferAccess();
+ if ( sFull.Len() > 255 )
+ {
+ rtl::OString sError(RTL_CONSTASCII_STRINGPARAM("GroupId > 255 chars"));
+ printf("GroupID = %s\n", sFull.GetBuffer());
+ yyerror(sError.getStr());
}
return sFull;
@@ -1468,21 +1489,22 @@ void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine )
else
return;
- if ( nListIndex + 1 > pList->size()) {
+ if ( nListIndex + 1 > pList->size())
+ {
ExportListEntry *pNew = new ExportListEntry();
- (*pNew)[ LIST_REFID ] = ByteString::CreateFromInt32( REFID_NONE );
- pList->push_back( pNew );
+ (*pNew)[LIST_REFID] = rtl::OString::valueOf(static_cast<sal_Int32>(REFID_NONE));
+ pList->push_back(pNew);
}
ExportListEntry *pCurEntry = (*pList)[ nListIndex ];
// For paired list use the line to set proper lid
if( nList == LIST_PAIRED ){
- (*pCurEntry)[ nListLang ] = rLine;
+ (*pCurEntry)[ m_sListLang ] = rLine;
}else
- (*pCurEntry)[ nListLang ] = rText;
+ (*pCurEntry)[ m_sListLang ] = rText;
// Remember en-US fallback string, so each list has the same amount of elements
- if ( Export::isSourceLanguage( nListLang ) ) {
+ if ( Export::isSourceLanguage( m_sListLang ) ) {
if( nList == LIST_PAIRED ){
const ByteString sPlist("pairedlist");
ByteString sKey = MergeDataFile::CreateKey( sPlist , pResData->sId , GetPairedListID( rLine ) , sFilename );
@@ -1502,7 +1524,7 @@ void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine )
// new fallback
}
- if ( Export::isSourceLanguage( nListLang ) ) {
+ if ( Export::isSourceLanguage( m_sListLang ) ) {
if( nList == LIST_PAIRED ){
(*pCurEntry)[ SOURCE_LANGUAGE ] = rLine;
}
@@ -1512,7 +1534,7 @@ void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine )
pList->NewSourceLanguageListEntry();
}
- //printf("Export::InsertListEntry ResData.id = %s ResData.ListData = %s\n",pResData->sId.GetBuffer() ,(*pCurEntry)[ nListLang ].GetBuffer());
+ //printf("Export::InsertListEntry ResData.id = %s ResData.ListData = %s\n",pResData->sId.GetBuffer() ,(*pCurEntry)[ m_sListLang ].GetBuffer());
nListIndex++;
}
@@ -1727,10 +1749,8 @@ void Export::ConvertMergeContent( ByteString &rText )
rText += "\"";
}
-/*****************************************************************************/
-sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp,
- ByteString &nLangIndex, ResData *pResData )
-/*****************************************************************************/
+sal_Bool Export::PrepareTextToMerge(ByteString &rText, sal_uInt16 nTyp,
+ rtl::OString &rLangIndex, ResData *pResData)
{
// position to merge in:
sal_uInt16 nStart = 0;
@@ -1780,13 +1800,14 @@ sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp,
break;
}
- if ( pList ) {
+ if (pList)
+ {
ExportListEntry *pCurEntry = (*pList)[ nListIndex - 1 ];
- if ( pCurEntry ) {
+ if ( pCurEntry )
+ {
rText = (*pCurEntry)[ SOURCE_LANGUAGE ];
- if( nTyp == LIST_PAIRED ){
- pResData->addMergedLanguage( nLangIndex );
- }
+ if( nTyp == LIST_PAIRED )
+ pResData->addMergedLanguage(rLangIndex);
}
}
@@ -1818,7 +1839,7 @@ sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp,
if ( pResData->sResTyp.EqualsIgnoreCaseAscii( "pairedlist" ) ){
pResData->sId = GetPairedListID( sLastListLine );
}
- else pResData->sId = ByteString::CreateFromInt32( nListIndex );
+ else pResData->sId = rtl::OString::valueOf(static_cast<sal_Int32>(nListIndex));
if ( pResData->sGId.Len())
pResData->sGId += ".";
@@ -1893,15 +1914,15 @@ sal_Bool Export::PrepareTextToMerge( ByteString &rText, sal_uInt16 nTyp,
}
ByteString sContent;
- pEntrys->GetTransex3Text( sContent, nTyp, nLangIndex );
- if ( !sContent.Len() && ( ! Export::isSourceLanguage( nLangIndex ) )) {
+ pEntrys->GetTransex3Text(sContent, nTyp, rLangIndex);
+ if (!sContent.Len() && (!Export::isSourceLanguage(rLangIndex)))
+ {
rText = sOrigText;
return sal_False; // no data found
}
- if ( Export::isSourceLanguage( nLangIndex ) ) {
+ if (Export::isSourceLanguage(rLangIndex))
return sal_False;
- }
ByteString sPostFix( rText.Copy( ++nEnd ));
rText.Erase( nStart );
@@ -2103,8 +2124,9 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
case LIST_ITEM : pResData->sResTyp = "itemlist"; pList = pResData->pItemList; bPairedList = false; break;
case LIST_PAIRED : pResData->sResTyp = "pairedlist"; pList = pResData->pPairedList; bPairedList = true; break;
}
- ByteString sCur;
- for( unsigned int n = 0; n < aLanguages.size(); n++ ){
+ rtl::OString sCur;
+ for( unsigned int n = 0; n < aLanguages.size(); n++ )
+ {
sCur = aLanguages[ n ];
sal_uInt16 nIdx = 1;
@@ -2130,46 +2152,65 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
bText = pEntrys->GetTransex3Text( sText , STRING_TYP_TEXT, SOURCE_LANGUAGE , sal_False );
// Use fallback, if data is missing in sdf file
- if( !bText && bPairedList ){
- if( pResData->isMerged( sCur ) ) break;
+ if( !bText && bPairedList )
+ {
+ if( pResData->isMerged( sCur ) )
+ break;
const ByteString sPlist("pairedlist");
ByteString sKey = MergeDataFile::CreateKey( sPlist , pResData->sGId , pResData->sId , sFilename );
bText = pResData->getFallbackData( sKey , sText );
- }else if ( !bText ){// new fallback
+ }
+ else if ( !bText ) // new fallback
+ {
if( pResData->isMerged( sCur ) ) break;
const ByteString sPlist("list");
ByteString sKey = MergeDataFile::CreateKey( sPlist , pResData->sGId , pResData->sId , sFilename );
bText = pResData->getFallbackData( sKey , sText );
} // new fallback
- if ( bText && sText.Len()) {
- if ( nIdx == 1 ) {
- ByteString sHead;
+ if ( bText && sText.Len())
+ {
+ if ( nIdx == 1 )
+ {
+ rtl::OStringBuffer sHead;
if ( bNextMustBeDefineEOL )
- sHead = "\\\n\t";
- sHead += sSpace;
- switch ( nT ) {
- case LIST_STRING : sHead += "StringList "; break;
- case LIST_FILTER : sHead += "FilterList "; break;
- case LIST_ITEM : sHead += "ItemList "; break;
- case LIST_PAIRED : sHead += "PairedList "; break;
- case LIST_UIENTRIES : sHead += "UIEntries "; break;
+ sHead.append(RTL_CONSTASCII_STRINGPARAM("\\\n\t"));
+ sHead.append(sSpace);
+ switch ( nT )
+ {
+ case LIST_STRING:
+ sHead.append(RTL_CONSTASCII_STRINGPARAM("StringList "));
+ break;
+ case LIST_FILTER:
+ sHead.append(RTL_CONSTASCII_STRINGPARAM("FilterList "));
+ break;
+ case LIST_ITEM:
+ sHead.append(RTL_CONSTASCII_STRINGPARAM("ItemList "));
+ break;
+ case LIST_PAIRED:
+ sHead.append(RTL_CONSTASCII_STRINGPARAM("PairedList "));
+ break;
+ case LIST_UIENTRIES:
+ sHead.append(RTL_CONSTASCII_STRINGPARAM("UIEntries "));
+ break;
}
- sHead += "[ ";
- sHead += sCur;
- sHead += " ] ";
+ sHead.append(RTL_CONSTASCII_STRINGPARAM("[ "));
+ sHead.append(sCur);
+ sHead.append(RTL_CONSTASCII_STRINGPARAM(" ] "));
//}
- if ( bDefine || bNextMustBeDefineEOL ) {
- sHead += "= \\\n";
- sHead += sSpace;
- sHead += "\t{\\\n\t";
+ if ( bDefine || bNextMustBeDefineEOL )
+ {
+ sHead.append(RTL_CONSTASCII_STRINGPARAM("= \\\n"));
+ sHead.append(sSpace);
+ sHead.append(RTL_CONSTASCII_STRINGPARAM("\t{\\\n\t"));
}
- else {
- sHead += "= \n";
- sHead += sSpace;
- sHead += "\t{\n\t";
+ else
+ {
+ sHead.append(RTL_CONSTASCII_STRINGPARAM("= \n"));
+ sHead.append(sSpace);
+ sHead.append(RTL_CONSTASCII_STRINGPARAM("\t{\n\t"));
}
- WriteToMerged( sHead , true);
+ WriteToMerged(sHead.makeStringAndClear() , true);
}
ByteString sLine;
if ( pList && (*pList)[ nLIndex ] )
@@ -2229,7 +2270,7 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
}
}
else
- pResData->sId = ByteString::CreateFromInt32( ++nIdx );
+ pResData->sId = rtl::OString::valueOf(static_cast<sal_Int32>(++nIdx));
}
else
break;
@@ -2291,7 +2332,7 @@ void Export::MergeRest( ResData *pResData, sal_uInt16 nMode )
}
}
- while( PrepareTextToMerge( sLine, nList, nListLang, pResData ) && ( nListIndex <= nMaxIndex )) {
+ while( PrepareTextToMerge( sLine, nList, m_sListLang, pResData ) && ( nListIndex <= nMaxIndex )) {
ByteString sText( "\t" );
sText += sLine;
sText += " ;";
diff --git a/l10ntools/source/export2.cxx b/l10ntools/source/export2.cxx
index a56516b..08f4406 100644
--- a/l10ntools/source/export2.cxx
+++ b/l10ntools/source/export2.cxx
@@ -381,25 +381,27 @@ ByteString Export::GetFallbackLanguage( const ByteString nLanguage )
void Export::FillInFallbacks( ResData *pResData )
/*****************************************************************************/
{
- ByteString sCur;
- for( unsigned int n = 0; n < aLanguages.size(); n++ ){
- sCur = aLanguages[ n ];
- if( isAllowed( sCur ) ){
+ for (size_t n = 0; n < aLanguages.size(); ++n)
+ {
+ ByteString sCur = aLanguages[ n ];
+ if (isAllowed(sCur))
+ {
ByteString nFallbackIndex = GetFallbackLanguage( sCur );
- if( nFallbackIndex.Len() ){
- if ( !pResData->sText[ sCur ].Len())
+ if( nFallbackIndex.Len() )
+ {
+ if (pResData->sText[ sCur ].isEmpty())
pResData->sText[ sCur ] =
pResData->sText[ nFallbackIndex ];
- if ( !pResData->sHelpText[ sCur ].Len())
+ if (pResData->sHelpText[ sCur ].isEmpty())
pResData->sHelpText[ sCur ] =
pResData->sHelpText[ nFallbackIndex ];
- if ( !pResData->sQuickHelpText[ sCur ].Len())
+ if (pResData->sQuickHelpText[ sCur ].isEmpty())
pResData->sQuickHelpText[ sCur ] =
pResData->sQuickHelpText[ nFallbackIndex ];
- if ( !pResData->sTitle[ sCur ].Len())
+ if (!pResData->sTitle[ sCur ].isEmpty())
pResData->sTitle[ sCur ] =
pResData->sTitle[ nFallbackIndex ];
@@ -432,11 +434,12 @@ void Export::FillInListFallbacks(
ExportList *pList, const ByteString &nSource, const ByteString &nFallback )
/*****************************************************************************/
{
-
- for ( size_t i = 0; i < pList->size(); i++ ) {
+ for (size_t i = 0; i < pList->size(); ++i)
+ {
ExportListEntry *pEntry = (*pList)[ i ];
- if ( !( *pEntry )[ nSource ].Len()){
- ( *pEntry )[ nSource ] = ( *pEntry )[ nFallback ];
+ if ( (*pEntry )[nSource].isEmpty() )
+ {
+ ( *pEntry )[ nSource ] = ( *pEntry )[ nFallback ];
ByteString x = ( *pEntry )[ nSource ];
ByteString y = ( *pEntry )[ nFallback ];
}
diff --git a/l10ntools/source/gsicheck.cxx b/l10ntools/source/gsicheck.cxx
index 7bb9916..4a0eca3 100644
--- a/l10ntools/source/gsicheck.cxx
+++ b/l10ntools/source/gsicheck.cxx
@@ -32,7 +32,8 @@
#include <tools/fsys.hxx>
#include <tools/stream.hxx>
-// local includes
+#include <rtl/strbuf.hxx>
+
#include "tagtest.hxx"
#include "gsicheck.hxx"
@@ -165,7 +166,10 @@ GSILine::GSILine( const ByteString &rLine, sal_uLong nLine )
// limit GID and LID to MAX_GID_LID_LEN chars each for database conformity, see #137575#
if ( rLine.GetToken( 4, '\t' ).Len() > MAX_GID_LID_LEN || rLine.GetToken( 5, '\t' ).Len() > MAX_GID_LID_LEN )
{
- PrintError( ByteString("GID and LID may only be ").Append( ByteString::CreateFromInt32(MAX_GID_LID_LEN) ).Append( " chars long each!" ), "Line format", aLangId, sal_True, GetLineNumber(), GetUniqId() );
+ PrintError(rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("GID and LID may only be "))
+ .append(static_cast<sal_Int32>(MAX_GID_LID_LEN))
+ .append(RTL_CONSTASCII_STRINGPARAM(" chars long each!" )).getStr(),
+ "Line format", aLangId, sal_True, GetLineNumber(), GetUniqId());
NotOK();
}
}
@@ -521,7 +525,9 @@ sal_Bool GSIBlock::TestUTF8( GSILine* pTestee, sal_Bool bFixTags )
if ( !IsUTF8( pTestee->GetText(), bFixTags, nErrorPos, aErrorMsg, bHasBeenFixed, aFixed ) )
{
ByteString aContext( pTestee->GetText().Copy( nErrorPos, 20 ) );
- PrintError( aErrorMsg.Append(" in Text at Position " ).Append( ByteString::CreateFromInt32( nErrorPos ) ), "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId() );
+ PrintError(rtl::OStringBuffer(aErrorMsg).append(RTL_CONSTASCII_STRINGPARAM(" in Text at Position "))
+ .append(static_cast<sal_Int32>(nErrorPos)).getStr(),
+ "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId());
bError = sal_True;
if ( bHasBeenFixed )
{
@@ -532,7 +538,9 @@ sal_Bool GSIBlock::TestUTF8( GSILine* pTestee, sal_Bool bFixTags )
if ( !IsUTF8( pTestee->GetQuickHelpText(), bFixTags, nErrorPos, aErrorMsg, bHasBeenFixed, aFixed ) )
{
ByteString aContext( pTestee->GetQuickHelpText().Copy( nErrorPos, 20 ) );
- PrintError( aErrorMsg.Append(" in QuickHelpText at Position " ).Append( ByteString::CreateFromInt32( nErrorPos ) ), "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId() );
+ PrintError(rtl::OStringBuffer(aErrorMsg).append(RTL_CONSTASCII_STRINGPARAM(" in QuickHelpText at Position "))
+ .append(static_cast<sal_Int32>(nErrorPos)).getStr(),
+ "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId());
bError = sal_True;
if ( bHasBeenFixed )
{
@@ -543,7 +551,9 @@ sal_Bool GSIBlock::TestUTF8( GSILine* pTestee, sal_Bool bFixTags )
if ( !IsUTF8( pTestee->GetTitle(), bFixTags, nErrorPos, aErrorMsg, bHasBeenFixed, aFixed ) )
{
ByteString aContext( pTestee->GetTitle().Copy( nErrorPos, 20 ) );
- PrintError( aErrorMsg.Append(" in Title at Position " ).Append( ByteString::CreateFromInt32( nErrorPos ) ), "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId() );
+ PrintError(rtl::OStringBuffer(aErrorMsg).append(RTL_CONSTASCII_STRINGPARAM(" in Title at Position "))
+ .append(static_cast<sal_Int32>(nErrorPos)).getStr(),
+ "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId());
bError = sal_True;
if ( bHasBeenFixed )
{
@@ -568,7 +578,9 @@ sal_Bool GSIBlock::HasSuspiciousChars( GSILine* pTestee, GSILine* pSource )
String aUTF8Tester = String( pTestee->GetText(), 0, nPos, RTL_TEXTENCODING_UTF8 );
sal_uInt16 nErrorPos = aUTF8Tester.Len();
ByteString aContext( pTestee->GetText().Copy( nPos, 20 ) );
- PrintError( ByteString("Found double questionmark in translation only. Looks like an encoding problem at Position " ).Append( ByteString::CreateFromInt32( nErrorPos ) ), "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId() );
+ PrintError(rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("Found double questionmark in translation only. Looks like an encoding problem at Position "))
+ .append(static_cast<sal_Int32>(nErrorPos)).getStr(),
+ "Text format", aContext, pTestee->GetLineNumber(), pTestee->GetUniqId());
pTestee->NotOK();
return sal_True;
}
@@ -747,7 +759,8 @@ void Help()
fprintf( stdout, "gsicheck checks the syntax of tags in GSI-Files and SDF-Files\n" );
fprintf( stdout, " checks for inconsistencies and malicious UTF8 encoding\n" );
fprintf( stdout, " checks tags in Online Help\n" );
- fprintf( stdout, " checks for *new* KeyIDs and relax GID/LID length to %s\n", ByteString::CreateFromInt32(MAX_GID_LID_LEN).GetBuffer() );
+ fprintf( stdout, " checks for *new* KeyIDs and relax GID/LID length to %s\n",
+ rtl::OString::valueOf(static_cast<sal_Int32>(MAX_GID_LID_LEN)).getStr() );
fprintf( stdout, "\n" );
fprintf( stdout, "Syntax: gsicheck [ -c ] [-f] [ -we ] [ -wef ErrorFilename ] [ -wc ]\n" );
fprintf( stdout, " [ -wcf CorrectFilename ] [ -s | -t ] [ -l LanguageID ]\n" );
diff --git a/l10ntools/source/lngmerge.cxx b/l10ntools/source/lngmerge.cxx
index e896400..7af3293 100644
--- a/l10ntools/source/lngmerge.cxx
+++ b/l10ntools/source/lngmerge.cxx
@@ -316,10 +316,13 @@ sal_Bool LngParser::Merge(
nPos++;
}
ByteString sCur;
- if ( nLastLangPos ) {
- for( unsigned int n = 0; n < aLanguages.size(); n++ ){
+ if ( nLastLangPos )
+ {
+ for(size_t n = 0; n < aLanguages.size(); ++n)
+ {
sCur = aLanguages[ n ];
- if( !sCur.EqualsIgnoreCaseAscii("en-US") && !Text[ sCur ].Len() && pEntrys ) {
+ if( !sCur.EqualsIgnoreCaseAscii("en-US") && Text[sCur].isEmpty() && pEntrys )
+ {
ByteString sNewText;
pEntrys->GetText( sNewText, STRING_TYP_TEXT, sCur, sal_True );
diff --git a/l10ntools/source/tagtest.cxx b/l10ntools/source/tagtest.cxx
index f508380..f6d3d9c 100644
--- a/l10ntools/source/tagtest.cxx
+++ b/l10ntools/source/tagtest.cxx
@@ -29,6 +29,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_l10ntools.hxx"
#include <tools/string.hxx>
+#include <rtl/strbuf.hxx>
#include "tagtest.hxx"
#if OSL_DEBUG_LEVEL > 1
@@ -1342,20 +1343,21 @@ void TokenParser::ParseError( sal_uInt16 nErrNr, ByteString aErrMsg, const Token
ParserMessage::ParserMessage( sal_uInt16 PnErrorNr, ByteString PaErrorText, const TokenInfo &rTag )
: nErrorNr( PnErrorNr )
- , aErrorText( PaErrorText )
, nTagBegin( 0 )
, nTagLength( 0 )
{
String aLexem( SimpleParser::GetLexem( rTag ) );
- aErrorText.Append(": ");
- aErrorText += ByteString( aLexem, RTL_TEXTENCODING_UTF8 );
+ rtl::OStringBuffer aErrorBuffer(PaErrorText);
+ aErrorBuffer.append(RTL_CONSTASCII_STRINGPARAM(": "));
+ aErrorBuffer.append(rtl::OUStringToOString(aLexem, RTL_TEXTENCODING_UTF8));
if ( rTag.nId == TAG_NOMORETAGS )
- aErrorText.Append(" at end of line ");
+ aErrorBuffer.append(RTL_CONSTASCII_STRINGPARAM(" at end of line "));
else if ( rTag.nPos != TOK_INVALIDPOS )
{
- aErrorText.Append(" at Position ");
- aErrorText.Append( ByteString::CreateFromInt32( rTag.nPos ) );
+ aErrorBuffer.append(RTL_CONSTASCII_STRINGPARAM(" at Position "));
+ aErrorBuffer.append(static_cast<sal_Int32>(rTag.nPos));
}
+ aErrorText = aErrorBuffer.makeStringAndClear();
nTagBegin = rTag.nPos;
nTagLength = aLexem.Len();
}
diff --git a/l10ntools/source/xrmlex.l b/l10ntools/source/xrmlex.l
index 6229525..034812c 100644
--- a/l10ntools/source/xrmlex.l
+++ b/l10ntools/source/xrmlex.l
@@ -144,7 +144,7 @@ int yywrap(void)
}
/*****************************************************************************/
-void YYWarning( char *s )
+void YYWarning( const char *s )
/*****************************************************************************/
{
/* write warning to stderr */
@@ -154,9 +154,9 @@ void YYWarning( char *s )
/*****************************************************************************/
#ifdef GCC
-void yyerror ( char *s, ... )
+void yyerror ( const char *s, ... )
#else
-void yyerror ( char *s )
+void yyerror ( const char *s )
#endif
/*****************************************************************************/
{
diff --git a/l10ntools/source/xrmmerge.cxx b/l10ntools/source/xrmmerge.cxx
index 667772d..916636f 100644
--- a/l10ntools/source/xrmmerge.cxx
+++ b/l10ntools/source/xrmmerge.cxx
@@ -526,14 +526,16 @@ void XRMResExport::WorkOnText(
{
ByteString sLang( GetAttribute( rOpenTag, "xml:lang" ));
- if ( !pResData ) {
- ByteString sPlatform( "" );
- pResData = new ResData( sPlatform, GetGID() );
- pResData->sId = GetLID();
- }
+ if ( !pResData )
+ {
+ ByteString sPlatform( "" );
+ pResData = new ResData( sPlatform, GetGID() );
+ pResData->sId = GetLID();
+ }
- pResData->sText[ sLang ] = rText;
- ConvertStringToDBFormat( pResData->sText[ sLang ] );
+ ByteString sText(rText);
+ ConvertStringToDBFormat(sText);
+ pResData->sText[sLang] = sText;
}
/*****************************************************************************/
More information about the Libreoffice-commits
mailing list