ref: c595c06c61527f1386aa0a16a2a66bfbad3f049f
parent: 78ba8a610c68e44baa7d59f6df03998afccc3070
author: suzuki toshiya <[email protected]>
date: Fri Jul 31 20:32:12 EDT 2009
pcf: Handle the string length by size_t variables.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
2009-07-31 suzuki toshiya <[email protected]>
+ 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 <[email protected]>
+
pcf: Fix some data types mismatching with their sources.
* src/pcf/pcfread.c (pcf_seek_to_table_type,
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -455,7 +455,7 @@
FT_Error error = PCF_Err_Ok;
FT_Bitmap* bitmap = &slot->bitmap;
PCF_Metric metric;
- int bytes;
+ FT_Offset bytes;
FT_UNUSED( load_flags );
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -992,9 +992,9 @@
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 @@
/* add_style_name and setwidth_name */
if ( nn == 0 || nn == 3 )
{
- int mm;
+ size_t mm;
for ( mm = 0; mm < len; mm++ )
--- a/src/pcf/pcfutil.c
+++ b/src/pcf/pcfutil.c
@@ -42,9 +42,9 @@
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 @@
FT_LOCAL_DEF( void )
TwoByteSwap( unsigned char* buf,
- int nbytes )
+ size_t nbytes )
{
unsigned char c;
@@ -83,7 +83,7 @@
FT_LOCAL_DEF( void )
FourByteSwap( unsigned char* buf,
- int nbytes )
+ size_t nbytes )
{
unsigned char c;
--- a/src/pcf/pcfutil.h
+++ b/src/pcf/pcfutil.h
@@ -37,15 +37,15 @@
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