Fixing bugs reported by Nelson Beebe. * src/base/ftstroker.c (FT_Stroker_ParseOutline): Remove unused variable `in_path'. * src/base/ftobjs (ft_glyphslot_set_bitmap): Change type of second argument to `FT_Byte*'. * include/freetype/internal/ftobjs.h: Updated. * src/bdf/bdflib.c (_bdf_readstream): Remove unused variable `res'. (_bdf_parse_glyphs): Remove unused variable `next'. Mark `call_data' as unused. * src/cache/ftlru.c (FT_LruList_Lookup): Remove unused variable `plast'. * src/pcf/pcfread.c (pcf_seek_to_table_type): Slight recoding to actually use `error'. (pcf_load_font): Remove unused variable `avgw'. * src/pfr/pfrobjs.c (pfr_face_get_kerning): Change return type to `void'. Mark `error' as unused. * src/pfr/pfrobjs.h: Updated. * src/pfr/pfrdrivr.c (pfr_get_kerning): Updated. * src/sfnt/ttload.c (sfnt_dir_check): Remove unused variable `format_tag'. * src/sfnt/ttcmap0.c (tt_cmap6_validate, tt_cmap10_validate): Remove unused variable `start'. (tt_cmap10_char_next): Remove unused variable `result' * src/sfnt/sfobjs.c (tt_face_get_name): Mark `error' as unused. * src/sfnt/sfdriver.c (get_sfnt_postscript_name): Mark `error' as unused. * src/type1/t1objs.c (T1_Face_Init): Remove unused variable `pshinter'. * src/type1/t1gload.c (T1_Load_Glyph): Use `glyph_data_loaded' only for FT_CONFIG_OPTION_INCREMENTAL.
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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600
diff --git a/ChangeLog b/ChangeLog
index dd78eb3..61de2ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,49 @@
+2003-04-23 Werner Lemberg <wl@gnu.org>
+
+ Fixing bugs reported by Nelson Beebe.
+
+ * src/base/ftstroker.c (FT_Stroker_ParseOutline): Remove unused
+ variable `in_path'.
+
+ * src/base/ftobjs (ft_glyphslot_set_bitmap): Change type of
+ second argument to `FT_Byte*'.
+ * include/freetype/internal/ftobjs.h: Updated.
+
+ * src/bdf/bdflib.c (_bdf_readstream): Remove unused variable `res'.
+ (_bdf_parse_glyphs): Remove unused variable `next'.
+ Mark `call_data' as unused.
+
+ * src/cache/ftlru.c (FT_LruList_Lookup): Remove unused variable
+ `plast'.
+
+ * src/pcf/pcfread.c (pcf_seek_to_table_type): Slight recoding to
+ actually use `error'.
+ (pcf_load_font): Remove unused variable `avgw'.
+
+ * src/pfr/pfrobjs.c (pfr_face_get_kerning): Change return type
+ to `void'.
+ Mark `error' as unused.
+ * src/pfr/pfrobjs.h: Updated.
+ * src/pfr/pfrdrivr.c (pfr_get_kerning): Updated.
+
+ * src/sfnt/ttload.c (sfnt_dir_check): Remove unused variable
+ `format_tag'.
+
+ * src/sfnt/ttcmap0.c (tt_cmap6_validate, tt_cmap10_validate): Remove
+ unused variable `start'.
+ (tt_cmap10_char_next): Remove unused variable `result'
+
+ * src/sfnt/sfobjs.c (tt_face_get_name): Mark `error' as unused.
+
+ * src/sfnt/sfdriver.c (get_sfnt_postscript_name): Mark `error' as
+ unused.
+
+ * src/type1/t1objs.c (T1_Face_Init): Remove unused variable
+ `pshinter'.
+
+ * src/type1/t1gload.c (T1_Load_Glyph): Use `glyph_data_loaded'
+ only for FT_CONFIG_OPTION_INCREMENTAL.
+
2003-04-23 Akito Hirai <akito@kde.gr.jp>
* src/sfnt/ttcmap0.c (tt_cmap4_validate): Provide a weak variant
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 483e6ec..e60cb22 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -560,7 +560,7 @@ FT_BEGIN_HEADER
*/
FT_BASE( void )
ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
- FT_Pointer buffer );
+ FT_Byte* buffer );
/*************************************************************************/
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 08708d1..dd873cd 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -220,7 +220,7 @@
FT_BASE_DEF( void )
ft_glyphslot_set_bitmap( FT_GlyphSlot slot,
- FT_Pointer buffer )
+ FT_Byte* buffer )
{
ft_glyphslot_free_bitmap( slot );
@@ -429,11 +429,12 @@
/* documentation is in freetype.h */
FT_EXPORT_DEF( void )
- FT_Set_Hint_Flags( FT_Face face,
- FT_ULong flags )
+ FT_Set_Hint_Flags( FT_Face face,
+ FT_ULong flags )
{
FT_Face_Internal internal;
+
if ( !face )
return;
diff --git a/src/base/ftstroker.c b/src/base/ftstroker.c
index 66fe19a..9b19bc8 100644
--- a/src/base/ftstroker.c
+++ b/src/base/ftstroker.c
@@ -1489,7 +1489,6 @@
FT_Int n; /* index of contour in outline */
FT_UInt first; /* index of first point in contour */
FT_Int tag; /* current point's state */
- FT_Int in_path;
if ( !outline || !stroker )
@@ -1497,8 +1496,6 @@
first = 0;
- in_path = 0;
-
for ( n = 0; n < outline->n_contours; n++ )
{
FT_Int last; /* index of last point in contour */
@@ -1548,8 +1545,6 @@
if ( error )
goto Exit;
- in_path = 1;
-
while ( point < limit )
{
point++;
diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c
index 7496e60..06ce4dd 100644
--- a/src/bdf/bdflib.c
+++ b/src/bdf/bdflib.c
@@ -1,6 +1,6 @@
/*
* Copyright 2000 Computing Research Labs, New Mexico State University
- * Copyright 2001, 2002 Francesco Zappa Nardelli
+ * Copyright 2001, 2002, 2003 Francesco Zappa Nardelli
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -641,7 +641,7 @@
{
_bdf_line_func_t cb;
unsigned long lineno;
- int n, res, done, refill, bytes, hold;
+ int n, done, refill, bytes, hold;
char *ls, *le, *pp, *pe, *hp;
char *buf = 0;
FT_Memory memory = stream->memory;
@@ -661,7 +661,7 @@
lineno = 1;
buf[0] = 0;
- res = done = 0;
+ done = 0;
pp = ls = le = buf;
bytes = 65536L;
@@ -1443,7 +1443,6 @@
unsigned char* bp;
unsigned long i, slen, nibbles;
- _bdf_line_func_t* next;
_bdf_parse_t* p;
bdf_glyph_t* glyph;
bdf_font_t* font;
@@ -1451,11 +1450,11 @@
FT_Memory memory;
FT_Error error = BDF_Err_Ok;
+ FT_UNUSED( call_data );
FT_UNUSED( lineno ); /* only used in debug mode */
- next = (_bdf_line_func_t *)call_data;
- p = (_bdf_parse_t *) client_data;
+ p = (_bdf_parse_t *)client_data;
font = p->font;
memory = font->memory;
diff --git a/src/cache/ftlru.c b/src/cache/ftlru.c
index bd450be..eb2065a 100644
--- a/src/cache/ftlru.c
+++ b/src/cache/ftlru.c
@@ -130,7 +130,6 @@
FT_Error error = 0;
FT_LruNode node, *pnode;
FT_LruList_Class clazz;
- FT_LruNode* plast;
FT_LruNode result = NULL;
FT_Memory memory;
@@ -139,7 +138,6 @@
return FTC_Err_Invalid_Argument;
pnode = &list->nodes;
- plast = pnode;
node = NULL;
clazz = list->clazz;
memory = list->memory;
@@ -155,7 +153,6 @@
if ( clazz->node_compare( node, key, list->data ) )
break;
- plast = pnode;
pnode = &(*pnode)->next;
}
}
@@ -170,7 +167,6 @@
if ( node->key == key )
break;
- plast = pnode;
pnode = &(*pnode)->next;
}
}
diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
index e3bbf06..8e89ace 100644
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -2,7 +2,7 @@
FreeType font driver for pcf fonts
- Copyright 2000-2001, 2002 by
+ Copyright 2000, 2001, 2002, 2003 by
Francesco Zappa Nardelli
Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -250,18 +250,22 @@ THE SOFTWARE.
FT_ULong *aformat,
FT_ULong *asize )
{
- FT_Error error = 0;
+ FT_Error error = PCF_Err_Invalid_File_Format;
FT_Int i;
for ( i = 0; i < ntables; i++ )
if ( tables[i].type == type )
{
- if ( stream->pos > tables[i].offset )
- return PCF_Err_Invalid_Stream_Skip;
+ if ( stream->pos > tables[i].offset ) {
+ error = PCF_Err_Invalid_Stream_Skip;
+ goto Fail;
+ }
- if ( FT_STREAM_SKIP( tables[i].offset - stream->pos ) )
- return PCF_Err_Invalid_Stream_Skip;
+ if ( FT_STREAM_SKIP( tables[i].offset - stream->pos ) ) {
+ error = PCF_Err_Invalid_Stream_Skip;
+ goto Fail;
+ }
*asize = tables[i].size; /* unused - to be removed */
*aformat = tables[i].format;
@@ -269,7 +273,8 @@ THE SOFTWARE.
return PCF_Err_Ok;
}
- return PCF_Err_Invalid_File_Format;
+ Fail:
+ return error;
}
@@ -986,12 +991,11 @@ THE SOFTWARE.
prop = pcf_find_property( face, "POINT_SIZE" );
if ( prop != NULL )
{
- PCF_Property xres, yres, avgw;
+ PCF_Property xres, yres;
xres = pcf_find_property( face, "RESOLUTION_X" );
yres = pcf_find_property( face, "RESOLUTION_Y" );
- avgw = pcf_find_property( face, "AVERAGE_WIDTH" );
if ( ( yres != NULL ) && ( xres != NULL ) )
{
diff --git a/src/pfr/pfrdrivr.c b/src/pfr/pfrdrivr.c
index d75b3a3..9c11b1f 100644
--- a/src/pfr/pfrdrivr.c
+++ b/src/pfr/pfrdrivr.c
@@ -30,29 +30,24 @@
FT_UInt right,
FT_Vector *avector )
{
- FT_Error error;
+ PFR_PhyFont phys = &face->phy_font;
- error = pfr_face_get_kerning( face, left, right, avector );
- if ( !error )
- {
- PFR_PhyFont phys = &face->phy_font;
-
+ pfr_face_get_kerning( face, left, right, avector );
- /* convert from metrics to outline units when necessary */
- if ( phys->outline_resolution != phys->metrics_resolution )
- {
- if ( avector->x != 0 )
- avector->x = FT_MulDiv( avector->x, phys->outline_resolution,
- phys->metrics_resolution );
+ /* convert from metrics to outline units when necessary */
+ if ( phys->outline_resolution != phys->metrics_resolution )
+ {
+ if ( avector->x != 0 )
+ avector->x = FT_MulDiv( avector->x, phys->outline_resolution,
+ phys->metrics_resolution );
- if ( avector->y != 0 )
- avector->y = FT_MulDiv( avector->x, phys->outline_resolution,
- phys->metrics_resolution );
- }
+ if ( avector->y != 0 )
+ avector->y = FT_MulDiv( avector->x, phys->outline_resolution,
+ phys->metrics_resolution );
}
- return error;
+ return FT_Err_Ok;
}
diff --git a/src/pfr/pfrobjs.c b/src/pfr/pfrobjs.c
index 84f99ad..4673222 100644
--- a/src/pfr/pfrobjs.c
+++ b/src/pfr/pfrobjs.c
@@ -397,17 +397,19 @@
/*************************************************************************/
/*************************************************************************/
- FT_LOCAL_DEF( FT_Error )
+ FT_LOCAL_DEF( void )
pfr_face_get_kerning( PFR_Face face,
FT_UInt glyph1,
FT_UInt glyph2,
FT_Vector* kerning )
{
- FT_Error error;
+ FT_Error error = FT_Err_Ok;
PFR_PhyFont phy_font = &face->phy_font;
PFR_KernItem item = phy_font->kern_items;
FT_UInt32 idx = PFR_KERN_INDEX( glyph1, glyph2 );
+ FT_UNUSED( error ); /* just needed as syntactical sugar */
+
kerning->x = 0;
kerning->y = 0;
@@ -422,7 +424,7 @@
}
/* not found */
- goto Exit;
+ return;
Found_Item:
{
@@ -434,7 +436,7 @@
if ( FT_STREAM_SEEK( item->offset ) ||
FT_FRAME_ENTER( item->pair_count * item->pair_size ) )
- goto Exit;
+ return;
min = 0;
max = item->pair_count;
@@ -475,9 +477,7 @@
FT_FRAME_EXIT();
}
-
- Exit:
- return 0;
}
+
/* END */
diff --git a/src/pfr/pfrobjs.h b/src/pfr/pfrobjs.h
index b29b64c..efd7b7c 100644
--- a/src/pfr/pfrobjs.h
+++ b/src/pfr/pfrobjs.h
@@ -4,7 +4,7 @@
/* */
/* FreeType PFR object methods (specification). */
/* */
-/* Copyright 2002 by */
+/* Copyright 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -67,11 +67,11 @@ FT_BEGIN_HEADER
pfr_face_done( PFR_Face face );
- FT_LOCAL( FT_Error )
- pfr_face_get_kerning( PFR_Face face,
- FT_UInt glyph1,
- FT_UInt glyph2,
- FT_Vector* kerning );
+ FT_LOCAL( void )
+ pfr_face_get_kerning( PFR_Face face,
+ FT_UInt glyph1,
+ FT_UInt glyph2,
+ FT_Vector* kerning );
FT_LOCAL( FT_Error )
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index c4dd1b4..0e5f7e6 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -4,7 +4,7 @@
/* */
/* High-level SFNT driver interface (body). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -149,7 +149,9 @@
FT_Memory memory = face->root.memory;
TT_NameEntryRec* name = face->name_table.names + found_win;
FT_UInt len = name->stringLength / 2;
- FT_Error error;
+ FT_Error error = FT_Err_Ok;
+
+ FT_UNUSED( error );
if ( !FT_ALLOC( result, name->stringLength + 1 ) )
@@ -189,7 +191,9 @@
FT_Memory memory = face->root.memory;
TT_NameEntryRec* name = face->name_table.names + found_apple;
FT_UInt len = name->stringLength;
- FT_Error error;
+ FT_Error error = FT_Err_Ok;
+
+ FT_UNUSED( error );
if ( !FT_ALLOC( result, len + 1 ) )
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index adaca24..08c24be 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -4,7 +4,7 @@
/* */
/* SFNT object management (base). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -258,9 +258,11 @@
{
if ( rec->string == NULL )
{
- FT_Error error;
+ FT_Error error = FT_Err_Ok;
FT_Stream stream = face->name_table.stream;
+ FT_UNUSED( error );
+
if ( FT_NEW_ARRAY ( rec->string, rec->stringLength ) ||
FT_STREAM_SEEK( rec->stringOffset ) ||
diff --git a/src/sfnt/ttcmap0.c b/src/sfnt/ttcmap0.c
index 613a9f8..d87aed8 100644
--- a/src/sfnt/ttcmap0.c
+++ b/src/sfnt/ttcmap0.c
@@ -1018,7 +1018,7 @@
FT_Validator valid )
{
FT_Byte* p;
- FT_UInt length, start, count;
+ FT_UInt length, count;
if ( table + 10 > valid->limit )
@@ -1027,8 +1027,7 @@
p = table + 2;
length = TT_NEXT_USHORT( p );
- p = table + 6; /* skip language */
- start = TT_NEXT_USHORT( p );
+ p = table + 8; /* skip language and start index */
count = TT_NEXT_USHORT( p );
if ( table + length > valid->limit || length < 10 + count * 2 )
@@ -1399,15 +1398,14 @@
FT_Validator valid )
{
FT_Byte* p = table + 4;
- FT_ULong length, start, count;
+ FT_ULong length, count;
if ( table + 20 > valid->limit )
FT_INVALID_TOO_SHORT;
length = TT_NEXT_ULONG( p );
- p = table + 12;
- start = TT_NEXT_ULONG( p );
+ p = table + 16;
count = TT_NEXT_ULONG( p );
if ( table + length > valid->limit || length < 20 + count * 2 )
@@ -1455,7 +1453,6 @@
FT_UInt32 *pchar_code )
{
FT_Byte* table = cmap->data;
- FT_UInt32 result = 0;
FT_UInt32 char_code = *pchar_code + 1;
FT_UInt gindex = 0;
FT_Byte* p = table + 12;
@@ -1474,10 +1471,7 @@
{
gindex = TT_NEXT_USHORT( p );
if ( gindex != 0 )
- {
- result = char_code;
break;
- }
char_code++;
}
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index 78e402d..f056bcc 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -179,11 +179,8 @@
/* if 'num_tables' is 0, read the table count from the file */
if ( num_tables == 0 )
{
- FT_ULong format_tag;
-
-
if ( FT_STREAM_SEEK( offset ) ||
- FT_READ_ULONG ( format_tag ) ||
+ FT_STREAM_SKIP( 4 ) ||
FT_READ_USHORT( num_tables ) ||
FT_STREAM_SKIP( 6 ) )
goto Bad_Format;
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index 6a28ac6..1a98daf 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -226,7 +226,9 @@
FT_Matrix font_matrix;
FT_Vector font_offset;
FT_Data glyph_data;
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
FT_Bool glyph_data_loaded = 0;
+#endif
if ( load_flags & FT_LOAD_NO_RECURSE )
@@ -267,7 +269,9 @@
&glyph_data );
if ( error )
goto Exit;
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
glyph_data_loaded = 1;
+#endif
font_matrix = decoder.font_matrix;
font_offset = decoder.font_offset;
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 59e7cb6..5933adf 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -4,7 +4,7 @@
/* */
/* Type 1 objects manager (body). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2003 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -278,7 +278,6 @@
FT_Error error;
PSNames_Service psnames;
PSAux_Service psaux;
- PSHinter_Service pshinter;
FT_UNUSED( num_params );
FT_UNUSED( params );
@@ -298,7 +297,6 @@
face->pshinter = FT_Get_Module_Interface( FT_FACE_LIBRARY( face ),
"pshinter" );
- pshinter = (PSHinter_Service)face->pshinter;
/* open the tokenizer, this will also check the font format */
error = T1_Open_Face( face );