diff --git a/ChangeLog b/ChangeLog index 7cb3dd053..7161ffa7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2009-07-31 suzuki toshiya + + pcf: Handle the string length by size_t variables. + + * src/pcf/pcfread.c (pcf_interpret_style): The types + of nn, len, lengths[4] are changed to size_t, because + they are loaded by (or compared with) ft_strlen(). + + * src/pcf/pcfutil.c (BitOrderInvert, TwoByteSwap, + FourByteSwap): The type of the 2nd argument `nbytes' + is changed to size_t, for similarity with ANSI C + string functions. + + * src/pcf/pcfdrivr.c (PCF_Glyph_Load): The type of + `bytes' is changed to FT_Offset, because it is passed + to FT_ALLOC(), via ft_glyphslot_alloc_bitmap(). At + least, using unsigned type is better. + 2009-07-31 suzuki toshiya pcf: Fix some data types mismatching with their sources. diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c index 799b498c0..b34e542ae 100644 --- a/src/pcf/pcfdrivr.c +++ b/src/pcf/pcfdrivr.c @@ -455,7 +455,7 @@ THE SOFTWARE. FT_Error error = PCF_Err_Ok; FT_Bitmap* bitmap = &slot->bitmap; PCF_Metric metric; - int bytes; + FT_Offset bytes; FT_UNUSED( load_flags ); diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c index 4ec4db895..cbbd10589 100644 --- a/src/pcf/pcfread.c +++ b/src/pcf/pcfread.c @@ -992,9 +992,9 @@ THE SOFTWARE. PCF_Property prop; - int nn, len; - char* strings[4] = { NULL, NULL, NULL, NULL }; - int lengths[4]; + size_t nn, len; + char* strings[4] = { NULL, NULL, NULL, NULL }; + size_t lengths[4]; face->style_flags = 0; @@ -1076,7 +1076,7 @@ THE SOFTWARE. /* add_style_name and setwidth_name */ if ( nn == 0 || nn == 3 ) { - int mm; + size_t mm; for ( mm = 0; mm < len; mm++ ) diff --git a/src/pcf/pcfutil.c b/src/pcf/pcfutil.c index 67ddbe889..b91274f93 100644 --- a/src/pcf/pcfutil.c +++ b/src/pcf/pcfutil.c @@ -42,9 +42,9 @@ in this Software without prior written authorization from The Open Group. FT_LOCAL_DEF( void ) BitOrderInvert( unsigned char* buf, - int nbytes ) + size_t nbytes ) { - for ( ; --nbytes >= 0; buf++ ) + for ( ; nbytes > 0; nbytes--, buf++ ) { unsigned int val = *buf; @@ -64,7 +64,7 @@ in this Software without prior written authorization from The Open Group. FT_LOCAL_DEF( void ) TwoByteSwap( unsigned char* buf, - int nbytes ) + size_t nbytes ) { unsigned char c; @@ -83,7 +83,7 @@ in this Software without prior written authorization from The Open Group. FT_LOCAL_DEF( void ) FourByteSwap( unsigned char* buf, - int nbytes ) + size_t nbytes ) { unsigned char c; diff --git a/src/pcf/pcfutil.h b/src/pcf/pcfutil.h index 1557be3e8..ce10fb541 100644 --- a/src/pcf/pcfutil.h +++ b/src/pcf/pcfutil.h @@ -37,15 +37,15 @@ FT_BEGIN_HEADER FT_LOCAL( void ) BitOrderInvert( unsigned char* buf, - int nbytes ); + size_t nbytes ); FT_LOCAL( void ) TwoByteSwap( unsigned char* buf, - int nbytes ); + size_t nbytes ); FT_LOCAL( void ) FourByteSwap( unsigned char* buf, - int nbytes ); + size_t nbytes ); FT_END_HEADER