[Libreoffice-commits] .: 3 commits - svtools/bmpmaker svtools/source sw/source
Caolán McNamara
caolan at kemper.freedesktop.org
Tue Jan 31 08:53:43 PST 2012
svtools/bmpmaker/bmpsum.cxx | 33 +++++++++++++++++----------------
svtools/source/filter/sgvtext.cxx | 24 +++++++++++-------------
svtools/source/filter/wmf/wmfwr.cxx | 24 +++++++++---------------
svtools/source/filter/wmf/wmfwr.hxx | 4 ++--
svtools/source/inc/sgvmain.hxx | 2 +-
svtools/source/misc/transfer.cxx | 12 ++++++------
sw/source/filter/ww8/wrtww8.cxx | 2 +-
sw/source/filter/ww8/ww8scan.cxx | 6 +++---
8 files changed, 50 insertions(+), 57 deletions(-)
New commits:
commit 7b30516245c4c067e2fca8136cb3919538760169
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jan 31 16:52:56 2012 +0000
SWAPLONG->OSL_BIGENDIAN
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 083854f..edee204 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -1055,7 +1055,7 @@ bool WW8_WrFkp::Combine()
// werden
sal_uInt32* p;
for( i = 0, p = (sal_uInt32*)pFkp; i <= nIMax; i++, p++ )
- *p = SWAPLONG( *p );
+ *p = OSL_SWAPDWORD( *p );
#endif // ifdef OSL_BIGENDIAN
return true;
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index 593624b..aab03f5 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -1996,7 +1996,7 @@ WW8PLCFspecial::WW8PLCFspecial(SvStream* pSt, sal_uInt32 nFilePos,
nIMax = ( nPLCF - 4 ) / ( 4 + nStruct );
#ifdef OSL_BIGENDIAN
for( nIdx = 0; nIdx <= nIMax; nIdx++ )
- pPLCF_PosArray[nIdx] = SWAPLONG( pPLCF_PosArray[nIdx] );
+ pPLCF_PosArray[nIdx] = OSL_SWAPDWORD( pPLCF_PosArray[nIdx] );
nIdx = 0;
#endif // OSL_BIGENDIAN
if( nStruct ) // Pointer auf Inhalts-Array
@@ -2150,7 +2150,7 @@ void WW8PLCF::ReadPLCF(SvStream& rSt, WW8_FC nFilePos, sal_uInt32 nPLCF)
{
#ifdef OSL_BIGENDIAN
for( nIdx = 0; nIdx <= nIMax; nIdx++ )
- pPLCF_PosArray[nIdx] = SWAPLONG( pPLCF_PosArray[nIdx] );
+ pPLCF_PosArray[nIdx] = OSL_SWAPDWORD( pPLCF_PosArray[nIdx] );
nIdx = 0;
#endif // OSL_BIGENDIAN
// Pointer auf Inhalts-Array
@@ -2332,7 +2332,7 @@ WW8PLCFpcd::WW8PLCFpcd(SvStream* pSt, sal_uInt32 nFilePos,
nIMax = ( nPLCF - 4 ) / ( 4 + nStruct );
#ifdef OSL_BIGENDIAN
for( long nI = 0; nI <= nIMax; nI++ )
- pPLCF_PosArray[nI] = SWAPLONG( pPLCF_PosArray[nI] );
+ pPLCF_PosArray[nI] = OSL_SWAPDWORD( pPLCF_PosArray[nI] );
#endif // OSL_BIGENDIAN
// Pointer auf Inhalts-Array
commit edeb3af5d42475292fe890f1872bf3c456530033
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jan 31 15:29:36 2012 +0000
adapt bmpmaker
diff --git a/svtools/bmpmaker/bmpsum.cxx b/svtools/bmpmaker/bmpsum.cxx
index 223f76d..c572737 100644
--- a/svtools/bmpmaker/bmpsum.cxx
+++ b/svtools/bmpmaker/bmpsum.cxx
@@ -298,7 +298,7 @@ void BmpSum::ProcessFileList( const String& rInFileList,
if( aIStm.IsOpen() && aOStm.IsOpen() )
{
rtl::OString aReadLine;
- ::std::set< ByteString > aFileNameSet;
+ ::std::set<rtl::OString> aFileNameSet;
while( aIStm.ReadLine( aReadLine ) )
{
@@ -345,13 +345,13 @@ void BmpSum::ProcessFileList( const String& rInFileList,
aIStm.Close();
- ::std::set< ByteString >::iterator aIter( aFileNameSet.begin() );
- ::std::map< sal_uInt64, ::std::vector< ByteString > > aFileNameMap;
+ ::std::set< rtl::OString >::iterator aIter( aFileNameSet.begin() );
+ ::std::map< sal_uInt64, ::std::vector< rtl::OString > > aFileNameMap;
while( aIter != aFileNameSet.end() )
{
- ByteString aStr( *aIter++ );
- SvFileStream aBmpStm( String( aStr.GetBuffer(), RTL_TEXTENCODING_ASCII_US ), STREAM_READ );
+ rtl::OString aStr( *aIter++ );
+ SvFileStream aBmpStm(rtl::OStringToOUString(aStr, RTL_TEXTENCODING_ASCII_US), STREAM_READ);
sal_uInt64 nCRC = 0;
if( aBmpStm.IsOpen() )
@@ -375,7 +375,7 @@ void BmpSum::ProcessFileList( const String& rInFileList,
nCRC = GetCRC( aBmpEx );
else
- fprintf( stderr, "%s could not be opened\n", aStr.GetBuffer() );
+ fprintf( stderr, "%s could not be opened\n", aStr.getStr() );
}
aBmpStm.Close();
@@ -383,36 +383,36 @@ void BmpSum::ProcessFileList( const String& rInFileList,
if( nCRC )
{
- ::std::map< sal_uInt64, ::std::vector< ByteString > >::iterator aFound( aFileNameMap.find( nCRC ) );
+ ::std::map< sal_uInt64, ::std::vector< rtl::OString > >::iterator aFound( aFileNameMap.find( nCRC ) );
if( aFound != aFileNameMap.end() )
(*aFound).second.push_back( aStr );
else
{
- ::std::vector< ByteString > aVector( 1, aStr );
+ ::std::vector< rtl::OString > aVector( 1, aStr );
aFileNameMap[ nCRC ] = aVector;
}
}
else
{
- ::std::vector< ByteString > aVector( 1, aStr );
+ ::std::vector< rtl::OString > aVector( 1, aStr );
aFileNameMap[ nCRC ] = aVector;
}
}
- ::std::map< sal_uInt64, ::std::vector< ByteString > >::iterator aMapIter( aFileNameMap.begin() );
+ ::std::map< sal_uInt64, ::std::vector< rtl::OString > >::iterator aMapIter( aFileNameMap.begin() );
sal_uInt32 nFileCount = 0;
while( aMapIter != aFileNameMap.end() )
{
- ::std::pair< const sal_uInt64, ::std::vector< ByteString > > aPair( *aMapIter++ );
- ::std::vector< ByteString > aFileNameVector( aPair.second );
+ ::std::pair< const sal_uInt64, ::std::vector< rtl::OString > > aPair( *aMapIter++ );
+ ::std::vector< rtl::OString > aFileNameVector( aPair.second );
// write new entries
for( sal_uInt32 i = 0; i < aFileNameVector.size(); ++i )
{
- ByteString aFileName( aFileNameVector[ i ] );
+ rtl::OString aFileName( aFileNameVector[ i ] );
DirEntry aSrcFile( aFileName );
rtl::OStringBuffer aStr;
@@ -423,10 +423,11 @@ void BmpSum::ProcessFileList( const String& rInFileList,
// copy bitmap
if( rOutPath.Len() )
{
- if( aFileName.Search( ":\\" ) != STRING_NOTFOUND )
- aFileName.Erase( 0, aFileName.Search( ":\\" ) + 2 );
+ sal_Int32 nIndex = aFileName.indexOf(":\\");
+ if (nIndex != -1)
+ aFileName = aFileName.copy(nIndex + 2);
- aFileName.SearchAndReplaceAll( '\\', '/' );
+ aFileName = aFileName.replace('\\', '/');
sal_Int32 nTokenCount = comphelper::string::getTokenCount(aFileName, '/');
DirEntry aNewDir( aBaseDir );
commit 94644aa76acd22ac4f9cdd5374c1e1262f382c03
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jan 31 15:21:47 2012 +0000
make svtools ByteString free
diff --git a/svtools/source/filter/sgvtext.cxx b/svtools/source/filter/sgvtext.cxx
index 28f950b..7a79edd 100644
--- a/svtools/source/filter/sgvtext.cxx
+++ b/svtools/source/filter/sgvtext.cxx
@@ -1160,28 +1160,26 @@ SgfFontOne::SgfFontOne()
SVWidth=40;
}
-void SgfFontOne::ReadOne( const rtl::OString& rID, ByteString& Dsc )
+void SgfFontOne::ReadOne( const rtl::OString& rID, rtl::OString& Dsc )
{
- sal_uInt16 i,j;
-
- if ( Dsc.Len() < 4 || ( Dsc.GetChar( 0 ) != '(' ) )
+ if ( Dsc.getLength() < 4 || ( Dsc[0] != '(' ) )
return;
- i=1; // Erster Buchstabe des IF-Fontnamen. Davor ist eine '('
- while ( i < Dsc.Len() && ( Dsc.GetChar( i ) !=')' ) )
+ sal_Int32 i=1; // Erster Buchstabe des IF-Fontnamen. Davor ist eine '('
+ while ( i < Dsc.getLength() && ( Dsc[i] !=')' ) )
i++;
- Dsc.Erase(0,i+1); // IF-Fontname loeschen inkl. ()
+ Dsc = Dsc.copy(i+1); // IF-Fontname loeschen inkl. ()
- if ( Dsc.Len() < 2 || ( Dsc.GetChar( Dsc.Len() - 1 ) !=')' ) )
+ if ( Dsc.getLength() < 2 || ( Dsc[Dsc.getLength() - 1] !=')' ) )
return;
- i=Dsc.Len()-2; // hier ist die ')' des SV-Fontnames
- j=0;
- while ( i > 0 && ( Dsc.GetChar( i ) != '(' ) )
+ i=Dsc.getLength()-2; // hier ist die ')' des SV-Fontnames
+ sal_Int32 j=0;
+ while ( i > 0 && ( Dsc[i] != '(' ) )
{
i--;
j++;
}
SVFName=String(Dsc,i+1,j); // SV-Fontname rausholen
- Dsc.Erase(i,j);
+ Dsc = rtl::OStringBuffer(Dsc).remove(i,j).makeStringAndClear();
IFID = (sal_uInt32)rID.toInt32();
sal_Int32 nTokenCount = comphelper::string::getTokenCount(Dsc, ' ');
@@ -1261,7 +1259,7 @@ void SgfFontLst::ReadList()
sal_uInt16 Anz=aCfg.GetKeyCount();
sal_uInt16 i;
rtl::OString FID;
- ByteString Dsc;
+ rtl::OString Dsc;
for (i=0;i<Anz;i++)
{
diff --git a/svtools/source/filter/wmf/wmfwr.cxx b/svtools/source/filter/wmf/wmfwr.cxx
index 7d25f70..2079154 100644
--- a/svtools/source/filter/wmf/wmfwr.cxx
+++ b/svtools/source/filter/wmf/wmfwr.cxx
@@ -660,16 +660,13 @@ void WMFWriter::WMFRecord_ExtTextOut( const Point & rPoint,
}
void WMFWriter::TrueExtTextOut( const Point & rPoint, const String & rString,
- const ByteString & rByteString, const sal_Int32 * pDXAry )
+ const rtl::OString& rByteString, const sal_Int32 * pDXAry )
{
WriteRecordHeader( 0, W_META_EXTTEXTOUT );
WritePointYX( rPoint );
- sal_uInt16 nNewTextLen = rByteString.Len();
+ sal_uInt16 nNewTextLen = static_cast<sal_uInt16>(rByteString.getLength());
*pWMF << nNewTextLen << (sal_uInt16)0;
-
- sal_uInt16 i;
- for ( i = 0; i < nNewTextLen; i++ )
- *pWMF << (sal_uInt8)rByteString.GetChar( i );
+ write_uInt8s_FromOString(*pWMF, rByteString, nNewTextLen);
if ( nNewTextLen & 1 )
*pWMF << (sal_uInt8)0;
@@ -677,11 +674,11 @@ void WMFWriter::TrueExtTextOut( const Point & rPoint, const String & rString,
sal_Int16* pConvertedDXAry = new sal_Int16[ nOriginalTextLen ];
sal_Int32 j = 0;
pConvertedDXAry[ j++ ] = (sal_Int16)ScaleWidth( pDXAry[ 0 ] );
- for ( i = 1; i < ( nOriginalTextLen - 1 ); i++ )
+ for (sal_uInt16 i = 1; i < ( nOriginalTextLen - 1 ); ++i)
pConvertedDXAry[ j++ ] = (sal_Int16)ScaleWidth( pDXAry[ i ] - pDXAry[ i - 1 ] );
pConvertedDXAry[ j ] = (sal_Int16)ScaleWidth( pDXAry[ nOriginalTextLen - 2 ] / ( nOriginalTextLen - 1 ) );
- for ( i = 0; i < nOriginalTextLen; i++ )
+ for (sal_uInt16 i = 0; i < nOriginalTextLen; ++i)
{
sal_Int16 nDx = pConvertedDXAry[ i ];
*pWMF << nDx;
@@ -949,15 +946,12 @@ void WMFWriter::WMFRecord_TextOut(const Point & rPoint, const String & rStr)
TrueTextOut(rPoint, aString);
}
-void WMFWriter::TrueTextOut(const Point & rPoint, const ByteString& rString)
+void WMFWriter::TrueTextOut(const Point & rPoint, const rtl::OString& rString)
{
- sal_uInt16 nLen,i;
-
WriteRecordHeader(0,W_META_TEXTOUT);
- nLen=rString.Len();
- *pWMF << nLen;
- for ( i = 0; i < nLen; i++ )
- *pWMF << (sal_uInt8)rString.GetChar( i );
+
+ write_lenPrefixed_uInt8s_FromOString<sal_uInt16>(*pWMF, rString);
+ sal_Int32 nLen = rString.getLength();
if ((nLen&1)!=0) *pWMF << (sal_uInt8)0;
WritePointYX(rPoint);
UpdateRecordHeader();
diff --git a/svtools/source/filter/wmf/wmfwr.hxx b/svtools/source/filter/wmf/wmfwr.hxx
index 499918d..4c4e2d4 100644
--- a/svtools/source/filter/wmf/wmfwr.hxx
+++ b/svtools/source/filter/wmf/wmfwr.hxx
@@ -167,8 +167,8 @@ private:
void WMFRecord_ExtTextOut(const Point & rPoint, const String & rString, const sal_Int32 * pDXAry);
void TrueExtTextOut(const Point & rPoint, const String & rString,
- const ByteString & rByteString, const sal_Int32 * pDXAry);
- void TrueTextOut(const Point & rPoint, const ByteString& rString);
+ const rtl::OString& rByteString, const sal_Int32 * pDXAry);
+ void TrueTextOut(const Point & rPoint, const rtl::OString& rString);
void WMFRecord_LineTo(const Point & rPoint);
void WMFRecord_MoveTo(const Point & rPoint);
void WMFRecord_Pie(const Rectangle & rRect, const Point & rStartPt, const Point & rEndPt);
diff --git a/svtools/source/inc/sgvmain.hxx b/svtools/source/inc/sgvmain.hxx
index 749cc42..9d023d5 100644
--- a/svtools/source/inc/sgvmain.hxx
+++ b/svtools/source/inc/sgvmain.hxx
@@ -330,7 +330,7 @@ public:
String SVFName; // z.B. "Times New Roman" = 15 Chars
sal_uInt16 SVWidth; // Durchschnittliche Zeichenbreite in %
SgfFontOne();
- void ReadOne(const rtl::OString& rID, ByteString& Dsc);
+ void ReadOne(const rtl::OString& rID, rtl::OString& rDsc);
};
class SgfFontLst {
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 87b3164..519dcc7 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -2005,10 +2005,10 @@ sal_Bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatr
if( pFDesc->cItems )
{
- ByteString aDesc( pFDesc->fgd[ 0 ].cFileName );
+ rtl::OString aDesc( pFDesc->fgd[ 0 ].cFileName );
rtl_TextEncoding eTextEncoding = osl_getThreadTextEncoding();
- if( ( aDesc.Len() > 4 ) && aDesc.Copy( aDesc.Len() - 4 ).EqualsIgnoreCaseAscii( ".URL" ) )
+ if( ( aDesc.getLength() > 4 ) && aDesc.copy(aDesc.Len() - 4).equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM(".URL")) )
{
SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( INetURLObject( String( aDesc, eTextEncoding ) ).GetMainURL( INetURLObject::NO_DECODE ),
STREAM_STD_READ );
@@ -2031,16 +2031,16 @@ sal_Bool TransferableDataHelper::GetINetBookmark( const ::com::sun::star::datatr
if( pStream )
{
- ByteString aLine;
+ rtl::OString aLine;
sal_Bool bSttFnd = sal_False;
while( pStream->ReadLine( aLine ) )
{
- if( aLine.EqualsIgnoreCaseAscii( "[InternetShortcut]" ) )
+ if (aLine.equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("[InternetShortcut]")))
bSttFnd = sal_True;
- else if( bSttFnd && aLine.Copy( 0, 4 ).EqualsIgnoreCaseAscii( "URL=" ) )
+ else if (bSttFnd && aLine.copy(0, 4).equalsIgnoreAsciiCaseL(RTL_CONSTASCII_STRINGPARAM("URL=")))
{
- rBmk = INetBookmark( String( aLine.Erase( 0, 4 ), eTextEncoding ),
+ rBmk = INetBookmark( String( aLine.copy(4), eTextEncoding ),
String( aDesc.Erase( aDesc.Len() - 4 ), eTextEncoding ) );
bRet = sal_True;
break;
More information about the Libreoffice-commits
mailing list