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

Chris Sherlock chris.sherlock79 at gmail.com
Fri Jan 17 03:44:46 PST 2014


 vcl/source/gdi/impfont.cxx |   21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 683764db4c435f27a83a2fdcf532be245c7fe4c9
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Tue Jan 14 00:04:46 2014 +1100

    Additional warnings when processing cmap tables
    
    Small enhancements to the code:
    * Removed unused code that clips unicode characters to the baseplane
    * Add a SAL_WARNING if the maximum character is greater than the
      minimum character.
    
    Change-Id: I783fba75435e7f98a65afab2e091b737efc9ddc6
    Reviewed-on: https://gerrit.libreoffice.org/7404
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/gdi/impfont.cxx b/vcl/source/gdi/impfont.cxx
index bfe99dc..9b27e3a 100644
--- a/vcl/source/gdi/impfont.cxx
+++ b/vcl/source/gdi/impfont.cxx
@@ -419,10 +419,14 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
             const sal_UCS4 cMaxChar = Getsal_uInt16( pLimitBase + 2*i );
             const int nGlyphDelta  = GetSShort( pDeltaBase + 2*i );
             const int nRangeOffset = Getsal_uInt16( pOffsetBase + 2*i );
-            if( cMinChar > cMaxChar )   // no sane font should trigger this
+            if( cMinChar > cMaxChar ) {  // no sane font should trigger this
+                SAL_WARN("vcl.gdi", "Min char should never be more than the max char!");
                 break;
-            if( cMaxChar == 0xFFFF )
+            }
+            if( cMaxChar == 0xFFFF ) {
+                SAL_WARN("vcl.gdi", "Format 4 char should not be 0xFFFF");
                 break;
+            }
             *(pCP++) = cMinChar;
             *(pCP++) = cMaxChar + 1;
             if( !nRangeOffset ) {
@@ -454,15 +458,12 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult )
             sal_UCS4 cMaxChar = GetUInt( pGroup + 4 );
             int nGlyphId = GetUInt( pGroup + 8 );
             pGroup += 12;
-#if 0       // TODO: remove unicode baseplane clipping for UCS-4 support
-            if( cMinChar > 0xFFFF )
-                continue;
-            if( cMaxChar > 0xFFFF )
-                cMaxChar = 0xFFFF;
-#else
-            if( cMinChar > cMaxChar )   // no sane font should trigger this
+
+            if( cMinChar > cMaxChar ) {   // no sane font should trigger this
+                SAL_WARN("vcl.gdi", "Min char should never be more than the max char!");
                 break;
-#endif
+            }
+
             *(pCP++) = cMinChar;
             *(pCP++) = cMaxChar + 1;
             pStartGlyphs[i] = nGlyphId;


More information about the Libreoffice-commits mailing list