ngompa / rpms / freetype

Forked from rpms/freetype 5 years ago
Clone
Blob Blame History Raw
--- a/src/bdf/bdflib.c	2012-03-28 13:24:22.000000000 +0200
+++ b/src/bdf/bdflib.c	2012-03-28 13:24:22.000000000 +0200
@@ -791,7 +791,7 @@
   };
 
 
-#define isdigok( m, d )  (m[(d) >> 3] & ( 1 << ( (d) & 7 ) ) )
+#define isdigok( m, d )  (m[(unsigned char)(d) >> 3] & ( 1 << ( (d) & 7 ) ) )
 
 
   /* Routine to convert an ASCII string into an unsigned long integer. */
@@ -1709,7 +1709,7 @@
       for ( i = 0; i < nibbles; i++ )
       {
         c = line[i];
-        if ( !c )
+        if ( !isdigok( hdigits, c ) )
           break;
         *bp = (FT_Byte)( ( *bp << 4 ) + a2i[c] );
         if ( i + 1 < nibbles && ( i & 1 ) )
@@ -1732,9 +1732,9 @@
         *bp &= nibble_mask[mask_index];
 
       /* If any line has extra columns, indicate they have been removed. */
-      if ( i == nibbles                                             &&
-           ( line[nibbles] == '0' || a2i[(int)line[nibbles]] != 0 ) &&
-           !( p->flags & _BDF_GLYPH_WIDTH_CHECK )                   )
+      if ( i == nibbles                           &&
+           isdigok( hdigits, line[nibbles] )      &&
+           !( p->flags & _BDF_GLYPH_WIDTH_CHECK ) )
       {
         FT_TRACE2(( "_bdf_parse_glyphs: " ACMSG14, glyph->encoding ));
         p->flags       |= _BDF_GLYPH_WIDTH_CHECK;