[Libreoffice-commits] core.git: vcl/source

Julien Nabet serval2412 at yahoo.fr
Mon Oct 30 06:16:34 UTC 2017


 vcl/source/gdi/pdfwriter_impl.cxx |   18 +++++++++---------
 vcl/source/gdi/pdfwriter_impl.hxx |    2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 8d994f83568073eb79ab987069f740c3c940405e
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Sun Oct 29 22:25:15 2017 +0100

    Replace list by vector for m_aSubsets (vcl)
    
    + use for range loops for those related to m_aSubsets
    
    Change-Id: I2fa3e3c46394381f5d0bb042481c1884bfe52da9
    Reviewed-on: https://gerrit.libreoffice.org/44033
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    Tested-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 3e3525162845..16994f2f5866 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -3242,9 +3242,9 @@ bool PDFWriterImpl::emitFonts()
 
     OUString aTmpName;
     osl_createTempFile( nullptr, nullptr, &aTmpName.pData );
-    for( FontSubsetData::iterator it = m_aSubsets.begin(); it != m_aSubsets.end(); ++it )
+    for (auto & subset : m_aSubsets)
     {
-        for( std::list< FontEmit >::iterator lit = it->second.m_aSubsets.begin(); lit != it->second.m_aSubsets.end(); ++lit )
+        for (auto & s_subset :subset.second.m_aSubsets)
         {
             sal_GlyphId aGlyphIds[ 256 ];
             sal_Int32 pWidths[ 256 ];
@@ -3261,12 +3261,12 @@ bool PDFWriterImpl::emitFonts()
             memset( pEncoding, 0, sizeof( pEncoding ) );
             memset( pCodeUnitsPerGlyph, 0, sizeof( pCodeUnitsPerGlyph ) );
             memset( pEncToUnicodeIndex, 0, sizeof( pEncToUnicodeIndex ) );
-            for( FontEmitMapping::iterator fit = lit->m_aMapping.begin(); fit != lit->m_aMapping.end();++fit )
+            for( FontEmitMapping::iterator fit = s_subset.m_aMapping.begin(); fit != s_subset.m_aMapping.end();++fit )
             {
                 sal_uInt8 nEnc = fit->second.getGlyphId();
 
                 SAL_WARN_IF( aGlyphIds[nEnc] != 0 || pEncoding[nEnc] != 0, "vcl.pdfwriter", "duplicate glyph" );
-                SAL_WARN_IF( nEnc > lit->m_aMapping.size(), "vcl.pdfwriter", "invalid glyph encoding" );
+                SAL_WARN_IF( nEnc > s_subset.m_aMapping.size(), "vcl.pdfwriter", "invalid glyph encoding" );
 
                 aGlyphIds[ nEnc ] = fit->first;
                 pEncoding[ nEnc ] = nEnc;
@@ -3284,7 +3284,7 @@ bool PDFWriterImpl::emitFonts()
                 }
             }
             FontSubsetInfo aSubsetInfo;
-            if( pGraphics->CreateFontSubset( aTmpName, it->first, aGlyphIds, pEncoding, pWidths, nGlyphs, aSubsetInfo ) )
+            if( pGraphics->CreateFontSubset( aTmpName, subset.first, aGlyphIds, pEncoding, pWidths, nGlyphs, aSubsetInfo ) )
             {
                 // create font stream
                 osl::File aFontFile(aTmpName);
@@ -3402,7 +3402,7 @@ bool PDFWriterImpl::emitFonts()
                 if ( !writeBuffer( aLine.getStr(), aLine.getLength() ) ) return false;
 
                 // write font descriptor
-                sal_Int32 nFontDescriptor = emitFontDescriptor( it->first, aSubsetInfo, lit->m_nFontID, nFontStream );
+                sal_Int32 nFontDescriptor = emitFontDescriptor( subset.first, aSubsetInfo, s_subset.m_nFontID, nFontStream );
 
                 if( nToUnicodeStream )
                     nToUnicodeStream = createToUnicodeCMap( pEncoding, &aCodeUnits[0], pCodeUnitsPerGlyph, pEncToUnicodeIndex, nGlyphs );
@@ -3416,7 +3416,7 @@ bool PDFWriterImpl::emitFonts()
                 aLine.append( (aSubsetInfo.m_nFontType & FontType::ANY_TYPE1) ?
                              "<</Type/Font/Subtype/Type1/BaseFont/" :
                              "<</Type/Font/Subtype/TrueType/BaseFont/" );
-                appendSubsetName( lit->m_nFontID, aSubsetInfo.m_aPSName, aLine );
+                appendSubsetName( s_subset.m_nFontID, aSubsetInfo.m_aPSName, aLine );
                 aLine.append( "\n"
                              "/FirstChar 0\n"
                              "/LastChar " );
@@ -3442,11 +3442,11 @@ bool PDFWriterImpl::emitFonts()
                              "endobj\n\n" );
                 if ( !writeBuffer( aLine.getStr(), aLine.getLength() ) ) return false;
 
-                aFontIDToObject[ lit->m_nFontID ] = nFontObject;
+                aFontIDToObject[ s_subset.m_nFontID ] = nFontObject;
             }
             else
             {
-                const PhysicalFontFace* pFont = it->first;
+                const PhysicalFontFace* pFont = subset.first;
                 OStringBuffer aErrorComment( 256 );
                 aErrorComment.append( "CreateFontSubset failed for font \"" );
                 aErrorComment.append( OUStringToOString( pFont->GetFamilyName(), RTL_TEXTENCODING_UTF8 ) );
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index b5d44767a70f..0b754310fa7d 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -359,7 +359,7 @@ public:
     typedef std::map< sal_GlyphId, Glyph > FontMapping;
     struct FontSubset
     {
-        std::list< FontEmit >        m_aSubsets;
+        std::vector< FontEmit >        m_aSubsets;
         FontMapping         m_aMapping;
     };
     typedef std::map< const PhysicalFontFace*, FontSubset > FontSubsetData;


More information about the Libreoffice-commits mailing list