* src/pcf/pcfread.c (pcf_get_bitmaps): Unsign `offsets' and `bitmapSizes'.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
diff --git a/ChangeLog b/ChangeLog
index dc090a0..b9576d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-06 Alexei Podtelezhnikov <apodtele@gmail.com>
+
+ * src/pcf/pcfread.c (pcf_get_bitmaps): Unsign `offsets' and
+ `bitmapSizes'.
+
2018-08-06 Werner Lemberg <wl@gnu.org>
* devel/ftoption.h: Synchronize with main `ftoption.h'.
diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
index 266588c..14cce67 100644
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -810,8 +810,8 @@ THE SOFTWARE.
{
FT_Error error;
FT_Memory memory = FT_FACE( face )->memory;
- FT_Long* offsets = NULL;
- FT_Long bitmapSizes[GLYPHPADOPTIONS];
+ FT_ULong* offsets = NULL;
+ FT_ULong bitmapSizes[GLYPHPADOPTIONS];
FT_ULong format, size;
FT_ULong nbitmaps, orig_nbitmaps, i, sizebitmaps = 0;
@@ -878,11 +878,11 @@ THE SOFTWARE.
for ( i = 0; i < nbitmaps; i++ )
{
if ( PCF_BYTE_ORDER( format ) == MSBFirst )
- (void)FT_READ_LONG( offsets[i] );
+ (void)FT_READ_ULONG( offsets[i] );
else
- (void)FT_READ_LONG_LE( offsets[i] );
+ (void)FT_READ_ULONG_LE( offsets[i] );
- FT_TRACE5(( " bitmap %ld: offset %ld (0x%lX)\n",
+ FT_TRACE5(( " bitmap %lu: offset %lu (0x%lX)\n",
i, offsets[i], offsets[i] ));
}
if ( error )
@@ -891,22 +891,22 @@ THE SOFTWARE.
for ( i = 0; i < GLYPHPADOPTIONS; i++ )
{
if ( PCF_BYTE_ORDER( format ) == MSBFirst )
- (void)FT_READ_LONG( bitmapSizes[i] );
+ (void)FT_READ_ULONG( bitmapSizes[i] );
else
- (void)FT_READ_LONG_LE( bitmapSizes[i] );
+ (void)FT_READ_ULONG_LE( bitmapSizes[i] );
if ( error )
goto Bail;
- sizebitmaps = (FT_ULong)bitmapSizes[PCF_GLYPH_PAD_INDEX( format )];
+ sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX( format )];
- FT_TRACE4(( " %ld-bit padding implies a size of %ld\n",
+ FT_TRACE4(( " %ld-bit padding implies a size of %lu\n",
8 << i, bitmapSizes[i] ));
}
- FT_TRACE4(( " %ld bitmaps, using %ld-bit padding\n",
+ FT_TRACE4(( " %lu bitmaps, using %ld-bit padding\n",
nbitmaps,
8 << PCF_GLYPH_PAD_INDEX( format ) ));
- FT_TRACE4(( " bitmap size: %ld\n", sizebitmaps ));
+ FT_TRACE4(( " bitmap size: %lu\n", sizebitmaps ));
FT_UNUSED( sizebitmaps ); /* only used for debugging */
@@ -915,14 +915,13 @@ THE SOFTWARE.
for ( i = 0; i < nbitmaps; i++ )
{
/* rough estimate */
- if ( ( offsets[i] < 0 ) ||
- ( (FT_ULong)offsets[i] > size ) )
+ if ( offsets[i] > size )
{
FT_TRACE0(( "pcf_get_bitmaps:"
- " invalid offset to bitmap data of glyph %ld\n", i ));
+ " invalid offset to bitmap data of glyph %lu\n", i ));
}
else
- face->metrics[i].bits = stream->pos + (FT_ULong)offsets[i];
+ face->metrics[i].bits = stream->pos + offsets[i];
}
face->bitmapsFormat = format;