[Libreoffice-commits] .: 2 commits - l10ntools/source svtools/bmpmaker svtools/source tools/source vcl/aqua vcl/unx

Caolán McNamara caolan at kemper.freedesktop.org
Wed Jun 29 03:17:54 PDT 2011


 l10ntools/source/export.cxx               |    6 -
 svtools/bmpmaker/bmpsum.cxx               |    2 
 svtools/source/svhtml/htmlout.cxx         |    2 
 tools/source/ref/pstm.cxx                 |   12 +-
 tools/source/stream/strmunx.cxx           |   25 +++---
 vcl/aqua/source/a11y/aqua11yrolehelper.mm |    4 
 vcl/unx/generic/fontmanager/fontcache.cxx |  121 +++++++++++++++---------------
 7 files changed, 93 insertions(+), 79 deletions(-)

New commits:
commit 5efca1417e430a0f1ba169638955d3b5cf921dde
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 29 10:24:43 2011 +0100

    Related: fdo#38704 make simpleMapNativeRoleFrom::accessibleContext safer

diff --git a/vcl/aqua/source/a11y/aqua11yrolehelper.mm b/vcl/aqua/source/a11y/aqua11yrolehelper.mm
index cfc052e..9e6536d 100644
--- a/vcl/aqua/source/a11y/aqua11yrolehelper.mm
+++ b/vcl/aqua/source/a11y/aqua11yrolehelper.mm
@@ -42,6 +42,10 @@ using namespace ::com::sun::star::uno;
 
 +(id)simpleMapNativeRoleFrom: (XAccessibleContext *) accessibleContext {
     id nativeRole = nil;
+
+    if (accessibleContext == NULL)
+        return nativeRole;
+
     switch( accessibleContext -> getAccessibleRole() ) {
 #define MAP(a,b) \
         case a: nativeRole = b; break
commit ff0f592043b9724bc021ee6fad65d6fdfbb19208
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Jun 29 09:02:15 2011 +0100

    remove deprecated ByteString::CreateFromInt64

diff --git a/l10ntools/source/export.cxx b/l10ntools/source/export.cxx
index 804d2cd..92ec9dd 100644
--- a/l10ntools/source/export.cxx
+++ b/l10ntools/source/export.cxx
@@ -1268,7 +1268,7 @@ sal_Bool Export::WriteData( ResData *pResData, sal_Bool bCreateNew )
                     sOutput += sLID; sOutput += "\t";
                     sOutput += pResData->sHelpId; sOutput	+= "\t";
                     sOutput += pResData->sPForm; sOutput	+= "\t";
-                    sOutput += ByteString::CreateFromInt64( pResData->nWidth ); sOutput += "\t";
+                    sOutput += ByteString(rtl::OString::valueOf(static_cast<sal_Int64>(pResData->nWidth))); sOutput += "\t";
                     sOutput += sCur; sOutput += "\t";
 
 
@@ -1369,7 +1369,7 @@ sal_Bool Export::WriteExportList( ResData *pResData, ExportList *pExportList,
         // ByteString a("Export::WriteExportList::pEntry");
         // Export::DumpMap( a,  *pEntry );
 
-        ByteString sLID( ByteString::CreateFromInt64( i + 1 ));
+        ByteString sLID(rtl::OString::valueOf(static_cast<sal_Int64>(i + 1)));
         for( unsigned int n = 0; n < aLanguages.size(); n++ ){
             sCur = aLanguages[ n ];
             if ( (*pEntry)[ SOURCE_LANGUAGE ].Len() )
@@ -1520,7 +1520,7 @@ void Export::InsertListEntry( const ByteString &rText, const ByteString &rLine )
             a.Append( "." );
             a.Append( pResData->sId );
             sal_Int64 x = nListIndex+1;
-            ByteString b( ByteString::CreateFromInt64( x ) );
+            ByteString b(rtl::OString::valueOf(x));
             ByteString sKey = MergeDataFile::CreateKey( sPlist , a , b  , sFilename );
             pResData->addFallbackData( sKey , rText );
         }
diff --git a/svtools/bmpmaker/bmpsum.cxx b/svtools/bmpmaker/bmpsum.cxx
index 7f93fdf..95c0c55 100644
--- a/svtools/bmpmaker/bmpsum.cxx
+++ b/svtools/bmpmaker/bmpsum.cxx
@@ -411,7 +411,7 @@ void BmpSum::ProcessFileList( const String& rInFileList,
             // write new entries
             for( sal_uInt32 i = 0; i < aFileNameVector.size(); ++i )
             {
-                ByteString  aStr( ByteString::CreateFromInt64( aPair.first ) );
+                ByteString  aStr(rtl::OString::valueOf(static_cast<sal_Int64>(aPair.first)));
                 ByteString  aFileName( aFileNameVector[ i ] );
                 DirEntry    aSrcFile( aFileName );
 
diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx
index ad2359e..c3ac913 100644
--- a/svtools/source/svhtml/htmlout.cxx
+++ b/svtools/source/svhtml/htmlout.cxx
@@ -485,7 +485,7 @@ void lcl_ConvertCharToHTML( sal_Unicode c, ByteString& rDest,
                 rDest += *pBuffer++;
 
             (((rDest += '&') += '#') +=
-                    ByteString::CreateFromInt64( (sal_uInt32)c )) += ';';
+                    ByteString(rtl::OString::valueOf(static_cast<sal_Int64>(c)))) += ';';
             if( pNonConvertableChars &&
                 STRING_NOTFOUND == pNonConvertableChars->Search( c ) )
                 pNonConvertableChars->Append( c );
diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx
index f9fd31d..74a16a4 100644
--- a/tools/source/ref/pstm.cxx
+++ b/tools/source/ref/pstm.cxx
@@ -31,6 +31,7 @@
 
 #include <tools/debug.hxx>
 #include <tools/pstm.hxx>
+#include <rtl/strbuf.hxx>
 
 #define STOR_NO_OPTIMIZE
 
@@ -152,11 +153,12 @@ SvPersistStream& operator >> ( SvPersistStream & rStm,
 #ifdef DBG_UTIL
             if( nObjLen + nObjPos != rStm.Tell() )
             {
-                ByteString aStr( "false list len: read = " );
-                aStr += ByteString::CreateFromInt32( (long)(rStm.Tell() - nObjPos) );
-                aStr += ", should = ";
-                aStr += ByteString::CreateFromInt64(nObjLen);
-                OSL_FAIL( aStr.GetBuffer() );
+                rtl::OStringBuffer aStr(
+                    RTL_CONSTASCII_STRINGPARAM("false list len: read = "));
+                aStr.append(static_cast<sal_Int64>(rStm.Tell() - nObjPos));
+                aStr.append(RTL_CONSTASCII_STRINGPARAM(", should = "));
+                aStr.append(static_cast<sal_Int64>(nObjLen));
+                OSL_FAIL(aStr.getStr());
             }
 #else
             (void)nObjLen;
diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx
index 7c5130d..1a136aa 100644
--- a/tools/source/stream/strmunx.cxx
+++ b/tools/source/stream/strmunx.cxx
@@ -48,6 +48,7 @@
 // class FileBase
 #include <osl/file.hxx>
 #include <rtl/instance.hxx>
+#include <rtl/strbuf.hxx>
 
 using namespace osl;
 
@@ -355,11 +356,13 @@ sal_uInt16 SvFileStream::IsA() const
 sal_Size SvFileStream::GetData( void* pData, sal_Size nSize )
 {
 #ifdef DBG_UTIL
-    ByteString aTraceStr( "SvFileStream::GetData(): " );
-    aTraceStr += ByteString::CreateFromInt64(nSize);
-    aTraceStr += " Bytes from ";
-    aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding());
-    OSL_TRACE( "%s", aTraceStr.GetBuffer() );
+    rtl::OStringBuffer aTraceStr(
+        RTL_CONSTASCII_STRINGPARAM("SvFileStream::GetData(): "));
+    aTraceStr.append(static_cast<sal_Int64>(nSize));
+    aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" Bytes from "));
+    aTraceStr.append(rtl::OUStringToOString(aFilename,
+        osl_getThreadTextEncoding()));
+    OSL_TRACE("%s", aTraceStr.getStr());
 #endif
 
     int nRead = 0;
@@ -381,11 +384,13 @@ sal_Size SvFileStream::GetData( void* pData, sal_Size nSize )
 sal_Size SvFileStream::PutData( const void* pData, sal_Size nSize )
 {
 #ifdef DBG_UTIL
-    ByteString aTraceStr( "SvFileStrean::PutData: " );
-    aTraceStr += ByteString::CreateFromInt64(nSize);
-    aTraceStr += " Bytes to ";
-    aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding());
-    OSL_TRACE( "%s", aTraceStr.GetBuffer() );
+    rtl::OStringBuffer aTraceStr(
+        RTL_CONSTASCII_STRINGPARAM("SvFileStream::PutData(): "));
+    aTraceStr.append(static_cast<sal_Int64>(nSize));
+    aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" Bytes to "));
+    aTraceStr.append(rtl::OUStringToOString(aFilename,
+        osl_getThreadTextEncoding()));
+    OSL_TRACE("%s", aTraceStr.getStr());
 #endif
 
     int nWrite = 0;
diff --git a/vcl/unx/generic/fontmanager/fontcache.cxx b/vcl/unx/generic/fontmanager/fontcache.cxx
index 10b81ad..63e8286 100644
--- a/vcl/unx/generic/fontmanager/fontcache.cxx
+++ b/vcl/unx/generic/fontmanager/fontcache.cxx
@@ -40,6 +40,8 @@
 
 #include "tools/stream.hxx"
 
+#include <rtl/strbuf.hxx>
+
 #include <unistd.h>
 #include <sys/stat.h>
 
@@ -132,13 +134,14 @@ void FontCache::flush()
         const FontDirMap& rDir( dir_it->second.m_aEntries );
 
         ByteString aDirectory( rManager.getDirectory( dir_it->first ) );
-        ByteString aLine( "FontCacheDirectory:" );
-        aLine.Append( ByteString::CreateFromInt64( dir_it->second.m_nTimestamp ) );
-        aLine.Append( ':' );
-        aLine.Append( aDirectory );
+        rtl::OStringBuffer aLine(
+            RTL_CONSTASCII_STRINGPARAM("FontCacheDirectory:"));
+        aLine.append(dir_it->second.m_nTimestamp);
+        aLine.append(':');
+        aLine.append(aDirectory);
         if( rDir.empty() && dir_it->second.m_bNoFiles )
-            aLine.Insert( "Empty", 0 );
-        aStream.WriteLine( aLine );
+            aLine.insert(0, RTL_CONSTASCII_STRINGPARAM("Empty"));
+        aStream.WriteLine(ByteString(aLine.makeStringAndClear()));
 
         for( FontDirMap::const_iterator entry_it = rDir.begin(); entry_it != rDir.end(); ++entry_it )
         {
@@ -147,16 +150,16 @@ void FontCache::flush()
             if( rEntry.begin() == rEntry.end() )
                 continue;
 
-            aLine = "File:";
-            aLine.Append( ByteString( entry_it->first ) );
-            aStream.WriteLine( aLine );
+            aLine.append(RTL_CONSTASCII_STRINGPARAM("File:"));
+            aLine.append(entry_it->first);
+            aStream.WriteLine(ByteString(aLine.makeStringAndClear()));
 
             int nEntrySize = entry_it->second.m_aEntry.size();
             // write: type;nfonts
-            aLine = ByteString::CreateFromInt32( rEntry.front()->m_eType );
-            aLine.Append( ';' );
-            aLine.Append( ByteString::CreateFromInt32( nEntrySize ) );
-            aStream.WriteLine( aLine );
+            aLine.append(static_cast<sal_Int32>(rEntry.front()->m_eType));
+            aLine.append(';');
+            aLine.append(static_cast<sal_Int32>(nEntrySize));
+            aStream.WriteLine(ByteString(aLine.makeStringAndClear()));
 
             sal_Int32 nSubEntry = 0;
             for( FontCacheEntry::const_iterator it = rEntry.begin(); it != rEntry.end(); ++it, nSubEntry++ )
@@ -171,73 +174,73 @@ void FontCache::flush()
                 else
                     nSubEntry = -1;
 
-                aLine = OUStringToOString( pAtoms->getString( ATOM_FAMILYNAME, (*it)->m_nFamilyName ), RTL_TEXTENCODING_UTF8 );
+                aLine.append(OUStringToOString(pAtoms->getString( ATOM_FAMILYNAME, (*it)->m_nFamilyName), RTL_TEXTENCODING_UTF8));
                 for( ::std::list< int >::const_iterator name_it = (*it)->m_aAliases.begin(); name_it != (*it)->m_aAliases.end(); ++name_it )
                 {
                     const OUString& rAdd( pAtoms->getString( ATOM_FAMILYNAME, *name_it ) );
                     if( rAdd.getLength() )
                     {
-                        aLine.Append( ';' );
-                        aLine.Append( ByteString( String( rAdd ), RTL_TEXTENCODING_UTF8 ) );
+                        aLine.append(';');
+                        aLine.append(OUStringToOString(rAdd, RTL_TEXTENCODING_UTF8));
                     }
                 }
-                aStream.WriteLine( aLine );
+                aStream.WriteLine(ByteString(aLine.makeStringAndClear()));
 
                 const OUString& rPSName( pAtoms->getString( ATOM_PSNAME, (*it)->m_nPSName ) );
-                aLine = ByteString::CreateFromInt32( nSubEntry );
-                aLine.Append( ';' );
-                aLine.Append( ByteString( String( rPSName ), RTL_TEXTENCODING_UTF8 ) );
-                aLine.Append( ';' );
-                aLine.Append( ByteString::CreateFromInt32( (*it)->m_eItalic ) );
-                aLine.Append( ';' );
-                aLine.Append( ByteString::CreateFromInt32( (*it)->m_eWeight ) );
-                aLine.Append( ';' );
-                aLine.Append( ByteString::CreateFromInt32( (*it)->m_eWidth ) );
-                aLine.Append( ';' );
-                aLine.Append( ByteString::CreateFromInt32( (*it)->m_ePitch ) );
-                aLine.Append( ';' );
-                aLine.Append( ByteString::CreateFromInt32( (*it)->m_aEncoding ) );
-                aLine.Append( ';' );
-                aLine.Append( ByteString::CreateFromInt32( (*it)->m_nAscend ) );
-                aLine.Append( ';' );
-                aLine.Append( ByteString::CreateFromInt32( (*it)->m_nDescend ) );
-                aLine.Append( ';' );
-                aLine.Append( ByteString::CreateFromInt32( (*it)->m_nLeading ) );
-                aLine.Append( ';' );
-                aLine.Append( (*it)->m_bHaveVerticalSubstitutedGlyphs ? "1" : "0" );
-                aLine.Append( ';' );
-                aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricX.width ) );
-                aLine.Append( ';' );
-                aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricX.height ) );
-                aLine.Append( ';' );
-                aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricY.width ) );
-                aLine.Append( ';' );
-                aLine.Append( ByteString::CreateFromInt32( (*it)->m_aGlobalMetricY.height ) );
-                aLine.Append( ';' );
-                aLine.Append( (*it)->m_bUserOverride ? "1" : "0" );
-                aLine.Append( ';' );
-                aLine.Append( ByteString::CreateFromInt32( 0 ) );
-                aLine.Append( ';' );
-                aLine.Append( ByteString::CreateFromInt32( 0 ) );
+                aLine.append(nSubEntry);
+                aLine.append(';');
+                aLine.append(OUStringToOString(rPSName, RTL_TEXTENCODING_UTF8));
+                aLine.append(';');
+                aLine.append(static_cast<sal_Int32>((*it)->m_eItalic));
+                aLine.append(';');
+                aLine.append(static_cast<sal_Int32>((*it)->m_eWeight));
+                aLine.append(';');
+                aLine.append(static_cast<sal_Int32>((*it)->m_eWidth));
+                aLine.append(';');
+                aLine.append(static_cast<sal_Int32>((*it)->m_ePitch));
+                aLine.append(';');
+                aLine.append(static_cast<sal_Int32>((*it)->m_aEncoding));
+                aLine.append(';');
+                aLine.append(static_cast<sal_Int32>((*it)->m_nAscend));
+                aLine.append(';');
+                aLine.append(static_cast<sal_Int32>((*it)->m_nDescend));
+                aLine.append(';');
+                aLine.append(static_cast<sal_Int32>((*it)->m_nLeading));
+                aLine.append(';');
+                aLine.append((*it)->m_bHaveVerticalSubstitutedGlyphs ? '1' : '0');
+                aLine.append(';');
+                aLine.append(static_cast<sal_Int32>((*it)->m_aGlobalMetricX.width ));
+                aLine.append(';');
+                aLine.append(static_cast<sal_Int32>((*it)->m_aGlobalMetricX.height));
+                aLine.append(';');
+                aLine.append(static_cast<sal_Int32>((*it)->m_aGlobalMetricY.width ));
+                aLine.append(';');
+                aLine.append(static_cast<sal_Int32>((*it)->m_aGlobalMetricY.height));
+                aLine.append(';');
+                aLine.append((*it)->m_bUserOverride ? '1' : '0');
+                aLine.append(';');
+                aLine.append(static_cast<sal_Int32>(0));
+                aLine.append(';');
+                aLine.append(static_cast<sal_Int32>(0));
 
                 switch( (*it)->m_eType )
                 {
                     case fonttype::Type1:
-                        aLine.Append( ';' );
-                        aLine.Append( ByteString( static_cast<const PrintFontManager::Type1FontFile*>(*it)->m_aMetricFile ) );
+                        aLine.append(';');
+                        aLine.append(static_cast<const PrintFontManager::Type1FontFile*>(*it)->m_aMetricFile);
                         break;
                     case fonttype::TrueType:
-                        aLine.Append( ';' );
-                        aLine.Append( ByteString::CreateFromInt32( static_cast<const PrintFontManager::TrueTypeFontFile*>(*it)->m_nTypeFlags ) );
+                        aLine.append(';');
+                        aLine.append(static_cast<sal_Int32>(static_cast<const PrintFontManager::TrueTypeFontFile*>(*it)->m_nTypeFlags));
                         break;
                     default: break;
                 }
                 if( (*it)->m_aStyleName.getLength() )
                 {
-                    aLine.Append( ';' );
-                    aLine.Append( ByteString( String( (*it)->m_aStyleName ), RTL_TEXTENCODING_UTF8 ) );
+                    aLine.append(';');
+                    aLine.append(OUStringToOString((*it)->m_aStyleName, RTL_TEXTENCODING_UTF8));
                 }
-                aStream.WriteLine( aLine );
+                aStream.WriteLine(ByteString(aLine.makeStringAndClear()));
             }
             aStream.WriteLine( ByteString() );
         }


More information about the Libreoffice-commits mailing list