pcf: Handle the string length by size_t variables.

This commit is contained in:
suzuki toshiya 2009-07-03 18:01:31 +09:00
parent daebaaa815
commit 8ffff68644
5 changed files with 30 additions and 12 deletions

View File

@ -1,3 +1,21 @@
2009-07-03 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
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-03 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
pcf: Fix some data types mismatching with their sources.

View File

@ -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 );

View File

@ -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++ )

View File

@ -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;

View File

@ -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