* builds/amiga/makefile.os4 (WARNINGS), builds/compiler/gcc-dev.mk (CFLAGS), builds/compiler/gcc.mk (CFLAGS): Remove -fno-strict-aliasing. Say you have `(Foo*)x' and want to assign, pass, or return it as `(Bar*)'. If you simply say `x' or `(Bar*)x', then the C compiler would warn you that type casting incompatible pointer types breaks strict-aliasing. The solution is to cast to `(void*)' instead which is the generic pointer type, so the compiler knows that it should make no strict-aliasing assumption on `x'. But the problem with `(void*)x' is that seems like in C++, unlike C, `void*' is not a generic pointer type and assigning `void*' to `Bar*' without a cast causes an error. The solution is to cast to `Bar*' too, with `(Bar*)(void*)x' as the result -- this is what the patch does. * include/freetype/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP), include/freetype/cache/ftcmru.h (FTC_MRULIST_LOOKUP_CMP): Remove cast on lvalue, use a temporary pointer instead. Cast temporarily to (void*) to not break strict aliasing. * include/freetype/internal/ftmemory.h (FT_MEM_ALLOC, FT_MEM_REALLOC, FT_MEM_QALLOC, FT_MEM_QREALLOC, FT_MEM_FREE), src/base/ftglyph.c (FT_Glyph_To_Bitmap): Cast temporarily to (void*) to not break strict aliasing. * src/base/ftinit.c (FT_USE_MODULE): Fix wrong type information. * builds/unix/configure.ac (XX_CFLAGS): Remove -fno-strict-aliasing. * src/sfnt/rules.mk (SFNT_DRV_SRC): Don't include ttsbit0.c -- it is currently loaded from ttsbit.c. Other formatting.
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 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626
diff --git a/ChangeLog b/ChangeLog
index bfd27da..3b403da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,49 @@
+2005-05-23 Werner Lemberg <wl@gnu.org>
+
+ * builds/amiga/makefile.os4 (WARNINGS), builds/compiler/gcc-dev.mk
+ (CFLAGS), builds/compiler/gcc.mk (CFLAGS): Remove
+ -fno-strict-aliasing.
+
+2005-05-23 Behdad Esfahbod <behdad@cs.toronto.edu>
+
+ Say you have `(Foo*)x' and want to assign, pass, or return it as
+ `(Bar*)'. If you simply say `x' or `(Bar*)x', then the C compiler
+ would warn you that type casting incompatible pointer types breaks
+ strict-aliasing. The solution is to cast to `(void*)' instead which
+ is the generic pointer type, so the compiler knows that it should
+ make no strict-aliasing assumption on `x'. But the problem with
+ `(void*)x' is that seems like in C++, unlike C, `void*' is not a
+ generic pointer type and assigning `void*' to `Bar*' without a cast
+ causes an error. The solution is to cast to `Bar*' too, with
+ `(Bar*)(void*)x' as the result -- this is what the patch does.
+
+ * include/freetype/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP),
+ include/freetype/cache/ftcmru.h (FTC_MRULIST_LOOKUP_CMP): Remove
+ cast on lvalue, use a temporary pointer instead.
+ Cast temporarily to (void*) to not break strict aliasing.
+
+ * include/freetype/internal/ftmemory.h (FT_MEM_ALLOC,
+ FT_MEM_REALLOC, FT_MEM_QALLOC, FT_MEM_QREALLOC, FT_MEM_FREE),
+ src/base/ftglyph.c (FT_Glyph_To_Bitmap): Cast temporarily to (void*)
+ to not break strict aliasing.
+
+ * src/base/ftinit.c (FT_USE_MODULE): Fix wrong type information.
+
+ * builds/unix/configure.ac (XX_CFLAGS): Remove -fno-strict-aliasing.
+
+ * src/sfnt/rules.mk (SFNT_DRV_SRC): Don't include ttsbit0.c --
+ it is currently loaded from ttsbit.c.
+
2005-05-23 David Turner <dturner@freetype.org>
- * include/freetype/cache/ftcache.h, src/cache/ftccache.c,
- src/cache/ftcsbits.c: fixing bug #12213 (incorrect behaviour
- of the cache sub-system in low-memory conditions).
+ Fix Savannah bug #12213 (incorrect behaviour of the cache sub-system
+ in low-memory conditions).
+
+ * include/freetype/cache/ftccache.h (FTC_CACHE_TRYLOOP,
+ FTC_CACHE_TRYLOOP_END): New macros.
+
+ * src/cache/ftccache.c (FTC_Cache_NewNode), src/cache/ftcsbits.c
+ (ftc_snode_compare): Use FT_CACHE_TRYLOOP and FTC_CACE_TRYLOOP_END.
2005-05-23 Werner Lemberg <wl@gnu.org>
diff --git a/builds/amiga/makefile.os4 b/builds/amiga/makefile.os4
index 508e961..a3e6f82 100644
--- a/builds/amiga/makefile.os4
+++ b/builds/amiga/makefile.os4
@@ -41,7 +41,7 @@ RANLIB = ppc-amigaos-ranlib
DIRFLAGS = -Iinclude -I/FT/src -I/FT/include -I/SDK/include
WARNINGS = -Wall -W -Wundef -Wpointer-arith -Wbad-function-cast \
- -Waggregate-return -Wshadow -fno-strict-aliasing
+ -Waggregate-return -Wshadow
CPU = -mcpu=604e
diff --git a/builds/compiler/gcc-dev.mk b/builds/compiler/gcc-dev.mk
index 9cad7e9..c70f117 100644
--- a/builds/compiler/gcc-dev.mk
+++ b/builds/compiler/gcc-dev.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2000, 2003, 2004 by
+# Copyright 1996-2000, 2003, 2004, 2005 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -68,7 +68,6 @@ ifndef CFLAGS
endif
CFLAGS := -c -g -O0 \
- -fno-strict-aliasing \
-Wall \
-W \
-Wundef \
diff --git a/builds/compiler/gcc.mk b/builds/compiler/gcc.mk
index d51f642..f4c5f96 100644
--- a/builds/compiler/gcc.mk
+++ b/builds/compiler/gcc.mk
@@ -3,7 +3,7 @@
#
-# Copyright 1996-2000, 2003 by
+# Copyright 1996-2000, 2003, 2005 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
@@ -62,7 +62,7 @@ T := -o$(space)
# ANSI compliance.
#
ifndef CFLAGS
- CFLAGS := -c -g -O6 -Wall -fno-strict-aliasing
+ CFLAGS := -c -g -O6 -Wall
endif
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
diff --git a/builds/unix/configure.ac b/builds/unix/configure.ac
index 0f5bef1..feb4e50 100644
--- a/builds/unix/configure.ac
+++ b/builds/unix/configure.ac
@@ -28,7 +28,7 @@ AC_PROG_CPP
# get compiler flags right
if test "x$CC" = xgcc; then
- XX_CFLAGS="-Wall -fno-strict-aliasing"
+ XX_CFLAGS="-Wall"
XX_ANSIFLAGS="-pedantic -ansi"
else
case "$host" in
diff --git a/include/freetype/cache/ftccache.h b/include/freetype/cache/ftccache.h
index f441915..f2e1028 100644
--- a/include/freetype/cache/ftccache.h
+++ b/include/freetype/cache/ftccache.h
@@ -4,7 +4,7 @@
/* */
/* FreeType internal cache interface (specification). */
/* */
-/* Copyright 2000-2001, 2002, 2003, 2004 by */
+/* Copyright 2000-2001, 2002, 2003, 2004, 2005 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -248,7 +248,8 @@ FT_BEGIN_HEADER
error = FTC_Cache_NewNode( _cache, _hash, query, &_node ); \
\
_Ok: \
- *(FTC_Node*)&(node) = _node; \
+ _pnode = (FTC_Node*)(void*)&(node); \
+ *_pnode = _node; \
FT_END_STMNT
#else /* !FTC_INLINE */
@@ -262,47 +263,49 @@ FT_BEGIN_HEADER
#endif /* !FTC_INLINE */
-/* use this macro with FTC_CACHE_TRYLOOP_END() in order to define
- * a retry loop that will flush the cache repeatidely in case of
- * memory overflows.
- *
- * this is used when creating a new cache node, or within a lookup
- * that needs to allocate things (e.g. the sbit cache lookup)
- *
- * here's an example:
- *
- * {
- * FTC_CACHE_TRYLOOP(cache)
- * error = load_data( ... );
- * FTC_CACHE_TRYLOOP_END()
- * }
- *
- */
-#define FTC_CACHE_TRYLOOP(cache) \
- { \
- FTC_Manager _try_manager = FTC_CACHE(cache)->manager; \
- FT_UInt _try_count = 4; \
- \
- for (;;) \
- { \
+ /*
+ * This macro, together with FTC_CACHE_TRYLOOP_END, defines a retry
+ * loop to flush the cache repeatedly in case of memory overflows.
+ *
+ * It is used when creating a new cache node, or within a lookup
+ * that needs to allocate data (e.g., the sbit cache lookup).
+ *
+ * Example:
+ *
+ * {
+ * FTC_CACHE_TRYLOOP( cache )
+ * error = load_data( ... );
+ * FTC_CACHE_TRYLOOP_END()
+ * }
+ *
+ */
+#define FTC_CACHE_TRYLOOP( cache ) \
+ { \
+ FTC_Manager _try_manager = FTC_CACHE( cache )->manager; \
+ FT_UInt _try_count = 4; \
+ \
+ \
+ for (;;) \
+ { \
FT_UInt _try_done;
-#define FTC_CACHE_TRYLOOP_END() \
- if ( !error || error != FT_Err_Out_Of_Memory ) \
- break; \
- \
- _try_done = FTC_Manager_FlushN( _try_manager, _try_count ); \
- if ( _try_done == 0 ) \
- break; \
- \
- if ( _try_done == _try_count ) \
- { \
- _try_count *= 2; \
- if ( _try_count < _try_done || _try_count > _try_manager->num_nodes ) \
- _try_count = _try_manager->num_nodes; \
- } \
- } \
+#define FTC_CACHE_TRYLOOP_END() \
+ if ( !error || error != FT_Err_Out_Of_Memory ) \
+ break; \
+ \
+ _try_done = FTC_Manager_FlushN( _try_manager, _try_count ); \
+ if ( _try_done == 0 ) \
+ break; \
+ \
+ if ( _try_done == _try_count ) \
+ { \
+ _try_count *= 2; \
+ if ( _try_count < _try_done || \
+ _try_count > _try_manager->num_nodes ) \
+ _try_count = _try_manager->num_nodes; \
+ } \
+ } \
}
/* */
diff --git a/include/freetype/cache/ftcmru.h b/include/freetype/cache/ftcmru.h
index d70c5cc..ac1a1a9 100644
--- a/include/freetype/cache/ftcmru.h
+++ b/include/freetype/cache/ftcmru.h
@@ -4,7 +4,7 @@
/* */
/* Simple MRU list-cache (specification). */
/* */
-/* Copyright 2000-2001, 2003, 2004 by */
+/* Copyright 2000-2001, 2003, 2004, 2005 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -172,34 +172,35 @@ FT_BEGIN_HEADER
FT_BEGIN_STMNT \
FTC_MruNode* _pfirst = &(list)->nodes; \
FTC_MruNode_CompareFunc _compare = (FTC_MruNode_CompareFunc)(compare); \
- FTC_MruNode _first, _node; \
- \
- \
- error = 0; \
- _first = *(_pfirst); \
- _node = NULL; \
- \
- if ( _first ) \
- { \
- _node = _first; \
- do \
- { \
- if ( _compare( _node, (key) ) ) \
- { \
- if ( _node != _first ) \
- FTC_MruNode_Up( _pfirst, _node ); \
- \
- *(FTC_MruNode*)&(node) = _node; \
- goto _MruOk; \
- } \
- _node = _node->next; \
- \
- } while ( _node != _first) ; \
- } \
- \
- error = FTC_MruList_New( (list), (key), (FTC_MruNode*)&(node) ); \
- _MruOk: \
- ; \
+ FTC_MruNode _first, _node, *_pnode; \
+ \
+ \
+ error = 0; \
+ _first = *(_pfirst); \
+ _node = NULL; \
+ \
+ if ( _first ) \
+ { \
+ _node = _first; \
+ do \
+ { \
+ if ( _compare( _node, (key) ) ) \
+ { \
+ if ( _node != _first ) \
+ FTC_MruNode_Up( _pfirst, _node ); \
+ \
+ _pnode = (FTC_MruNode*)(void*)&(node); \
+ *_pnode = _node; \
+ goto _MruOk; \
+ } \
+ _node = _node->next; \
+ \
+ } while ( _node != _first) ; \
+ } \
+ \
+ error = FTC_MruList_New( (list), (key), (FTC_MruNode*)(void*)&(node) ); \
+ _MruOk: \
+ ; \
FT_END_STMNT
#define FTC_MRULIST_LOOKUP( list, key, node, error ) \
diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h
index e255379..cead50d 100644
--- a/include/freetype/internal/ftmemory.h
+++ b/include/freetype/internal/ftmemory.h
@@ -290,43 +290,53 @@ FT_BEGIN_HEADER
#ifdef FT_DEBUG_MEMORY
-#define FT_MEM_ALLOC( _pointer_, _size_ ) \
- FT_Alloc_Debug( memory, _size_, \
- (void**)&(_pointer_), __FILE__, __LINE__ )
+#define FT_MEM_ALLOC( _pointer_, _size_ ) \
+ FT_Alloc_Debug( memory, _size_, \
+ (void**)(void*)&(_pointer_), \
+ __FILE__, __LINE__ )
-#define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \
- FT_Realloc_Debug( memory, _current_, _size_, \
- (void**)&(_pointer_), __FILE__, __LINE__ )
+#define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \
+ FT_Realloc_Debug( memory, _current_, _size_, \
+ (void**)(void*)&(_pointer_), \
+ __FILE__, __LINE__ )
-#define FT_MEM_QALLOC( _pointer_, _size_ ) \
- FT_QAlloc_Debug( memory, _size_, \
- (void**)&(_pointer_), __FILE__, __LINE__ )
+#define FT_MEM_QALLOC( _pointer_, _size_ ) \
+ FT_QAlloc_Debug( memory, _size_, \
+ (void**)(void*)&(_pointer_), \
+ __FILE__, __LINE__ )
-#define FT_MEM_QREALLOC( _pointer_, _current_, _size_ ) \
- FT_QRealloc_Debug( memory, _current_, _size_, \
- (void**)&(_pointer_), __FILE__, __LINE__ )
+#define FT_MEM_QREALLOC( _pointer_, _current_, _size_ ) \
+ FT_QRealloc_Debug( memory, _current_, _size_, \
+ (void**)(void*)&(_pointer_), \
+ __FILE__, __LINE__ )
-#define FT_MEM_FREE( _pointer_ ) \
- FT_Free_Debug( memory, (void**)&(_pointer_), __FILE__, __LINE__ )
+#define FT_MEM_FREE( _pointer_ ) \
+ FT_Free_Debug( memory, (void**)(void*)&(_pointer_), \
+ __FILE__, __LINE__ )
#else /* !FT_DEBUG_MEMORY */
-#define FT_MEM_ALLOC( _pointer_, _size_ ) \
- FT_Alloc( memory, _size_, (void**)&(_pointer_) )
+#define FT_MEM_ALLOC( _pointer_, _size_ ) \
+ FT_Alloc( memory, _size_, \
+ (void**)(void*)&(_pointer_) )
-#define FT_MEM_FREE( _pointer_ ) \
- FT_Free( memory, (void**)&(_pointer_) )
+#define FT_MEM_FREE( _pointer_ ) \
+ FT_Free( memory, \
+ (void**)(void*)&(_pointer_) )
-#define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \
- FT_Realloc( memory, _current_, _size_, (void**)&(_pointer_) )
+#define FT_MEM_REALLOC( _pointer_, _current_, _size_ ) \
+ FT_Realloc( memory, _current_, _size_, \
+ (void**)(void*)&(_pointer_) )
-#define FT_MEM_QALLOC( _pointer_, _size_ ) \
- FT_QAlloc( memory, _size_, (void**)&(_pointer_) )
+#define FT_MEM_QALLOC( _pointer_, _size_ ) \
+ FT_QAlloc( memory, _size_, \
+ (void**)(void*)&(_pointer_) )
-#define FT_MEM_QREALLOC( _pointer_, _current_, _size_ ) \
- FT_QRealloc( memory, _current_, _size_, (void**)&(_pointer_) )
+#define FT_MEM_QREALLOC( _pointer_, _current_, _size_ ) \
+ FT_QRealloc( memory, _current_, _size_, \
+ (void**)(void*)&(_pointer_) )
#endif /* !FT_DEBUG_MEMORY */
@@ -337,7 +347,7 @@ FT_BEGIN_HEADER
/* _typed_ in order to automatically compute array element sizes. */
/* */
-#define FT_MEM_NEW( _pointer_ ) \
+#define FT_MEM_NEW( _pointer_ ) \
FT_MEM_ALLOC( _pointer_, sizeof ( *(_pointer_) ) )
#define FT_MEM_NEW_ARRAY( _pointer_, _count_ ) \
@@ -347,7 +357,7 @@ FT_BEGIN_HEADER
FT_MEM_REALLOC( _pointer_, (_old_) * sizeof ( *(_pointer_) ), \
(_new_) * sizeof ( *(_pointer_) ) )
-#define FT_MEM_QNEW( _pointer_ ) \
+#define FT_MEM_QNEW( _pointer_ ) \
FT_MEM_QALLOC( _pointer_, sizeof ( *(_pointer_) ) )
#define FT_MEM_QNEW_ARRAY( _pointer_, _count_ ) \
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index 8f85510..af0eadf 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -603,7 +603,7 @@
/* create result bitmap glyph */
error = ft_new_glyph( glyph->library, &ft_bitmap_glyph_class,
- (FT_Glyph*)&bitmap );
+ (FT_Glyph*)(void*)&bitmap );
if ( error )
goto Exit;
diff --git a/src/base/ftinit.c b/src/base/ftinit.c
index 79ba9f0..ac009b7 100644
--- a/src/base/ftinit.c
+++ b/src/base/ftinit.c
@@ -4,7 +4,7 @@
/* */
/* FreeType initialization layer (body). */
/* */
-/* Copyright 1996-2001, 2002 by */
+/* Copyright 1996-2001, 2002, 2005 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -55,9 +55,9 @@
#undef FT_USE_MODULE
#ifdef __cplusplus
-#define FT_USE_MODULE( x ) extern "C" const FT_Module_Class* x;
+#define FT_USE_MODULE( x ) extern "C" const FT_Module_Class x;
#else
-#define FT_USE_MODULE( x ) extern const FT_Module_Class* x;
+#define FT_USE_MODULE( x ) extern const FT_Module_Class x;
#endif
@@ -65,7 +65,7 @@
#undef FT_USE_MODULE
-#define FT_USE_MODULE( x ) (const FT_Module_Class*)&x,
+#define FT_USE_MODULE( x ) (const FT_Module_Class*)&(x),
static
const FT_Module_Class* const ft_default_modules[] =
diff --git a/src/cache/ftccache.c b/src/cache/ftccache.c
index 8c7758a..ad03680 100644
--- a/src/cache/ftccache.c
+++ b/src/cache/ftccache.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType internal cache interface (body). */
/* */
-/* Copyright 2000-2001, 2002, 2003, 2004 by */
+/* Copyright 2000-2001, 2002, 2003, 2004, 2005 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -424,12 +424,14 @@
FT_Error error;
FTC_Node node;
- /* we use the FTC_CACHE_TRYLOOP macros in order to
- * support out-of-memory error (OOM) correctly, i.e.
- * by flushing the cache progressively in order to
- * make more room
- */
- FTC_CACHE_TRYLOOP(cache)
+
+ /*
+ * We use the FTC_CACHE_TRYLOOP macros to support out-of-memory
+ * errors (OOM) correctly, i.e., by flushing the cache progressively
+ * in order to make more room.
+ */
+
+ FTC_CACHE_TRYLOOP( cache )
{
error = cache->clazz.node_new( &node, query, cache );
}
diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c
index 51ec34c..891c7ab 100644
--- a/src/cache/ftcsbits.c
+++ b/src/cache/ftcsbits.c
@@ -4,7 +4,7 @@
/* */
/* FreeType sbits manager (body). */
/* */
-/* Copyright 2000-2001, 2002, 2003, 2004 by */
+/* Copyright 2000-2001, 2002, 2003, 2004, 2005 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -85,15 +85,16 @@
}
- /* this function tries to load a small bitmap within a given FTC_SNode
- * note that it will return a non-zero error code _only_ in the case
- * of out-of-memory condition. For all other errors (e.g. corresponding
- * to a bad font file), this function will mark the sbit as "unavailable"
- * and return a value of 0.
- *
- * you should also read the comment within the @ftc_snode_compare function
- * below to see how out-of-memory is handled during a lookup
- */
+ /*
+ * This function tries to load a small bitmap within a given FTC_SNode.
+ * Note that it returns a non-zero error code _only_ in the case of
+ * out-of-memory condition. For all other errors (e.g., corresponding
+ * to a bad font file), this function will mark the sbit as `unavailable'
+ * and return a value of 0.
+ *
+ * You should also read the comment within the @ftc_snode_compare
+ * function below to see how out-of-memory is handled during a lookup.
+ */
static FT_Error
ftc_snode_load( FTC_SNode snode,
FTC_Manager manager,
@@ -324,43 +325,48 @@
FTC_SBit sbit = snode->sbits + ( gindex - gnode->gindex );
- /* the following code illustrates what to do when you want to
- * perform operations that may fail within a lookup function.
- *
- * here, we want to load a small bitmap on-demand, we thus
- * need to call the 'ftc_snode_load' function which may return
- * a non-zero error code only when we're out of memory
- *
- * the correct thing to do is to use @FTC_CACHE_TRYLOOP and
- * @FTC_CACHE_TRYLOOP_END in order to implement a retry loop
- * that is capable of flushing the cache incrementally when
- * OOM errors occur.
- *
- * however, we previously need to 'lock' the node to prevent it
- * from being flushed in the loop.
- *
- * when we exit the loop, we unlock the node then check the 'error'
- * variable. If it is non-zero, this means that the cache was
- * completely flushed and that no usable memory was found to load
- * the bitmap.
- *
- * we then prefer to return a value of 0 (i.e. NO MATCH). This
- * will ensure that the caller will try to allocate a new node.
- * this operation _will_ fail and the lookup function will return
- * the OOM error code appropriately.
- *
- * note that 'buffer == NULL && width == 255' is a hack used to
- * tag "unavailable" bitmaps in the array. We should never try
- * to load these.
- */
+ /*
+ * The following code illustrates what to do when you want to
+ * perform operations that may fail within a lookup function.
+ *
+ * Here, we want to load a small bitmap on-demand; we thus
+ * need to call the `ftc_snode_load' function which may return
+ * a non-zero error code only when we are out of memory (OOM).
+ *
+ * The correct thing to do is to use @FTC_CACHE_TRYLOOP and
+ * @FTC_CACHE_TRYLOOP_END in order to implement a retry loop
+ * that is capable of flushing the cache incrementally when
+ * an OOM errors occur.
+ *
+ * However, we need to `lock' the node before this operation to
+ * prevent it from being flushed within the loop.
+ *
+ * When we exit the loop, we unlock the node, then check the `error'
+ * variable. If it is non-zero, this means that the cache was
+ * completely flushed and that no usable memory was found to load
+ * the bitmap.
+ *
+ * We then prefer to return a value of 0 (i.e., NO MATCH). This
+ * ensures that the caller will try to allocate a new node.
+ * This operation consequently _fail_ and the lookup function
+ * returns the appropriate OOM error code.
+ *
+ * Note that `buffer == NULL && width == 255' is a hack used to
+ * tag `unavailable' bitmaps in the array. We should never try
+ * to load these.
+ *
+ */
+
if ( sbit->buffer == NULL && sbit->width != 255 )
{
FT_ULong size;
FT_Error error;
- ftcsnode->ref_count++; /* lock node, prevent flushing in retry loop */
- FTC_CACHE_TRYLOOP(cache)
+ ftcsnode->ref_count++; /* lock node to prevent flushing */
+ /* in retry loop */
+
+ FTC_CACHE_TRYLOOP( cache )
{
error = ftc_snode_load( snode, cache->manager, gindex, &size );
}
diff --git a/src/sfnt/rules.mk b/src/sfnt/rules.mk
index f2f1c4a..e15681b 100644
--- a/src/sfnt/rules.mk
+++ b/src/sfnt/rules.mk
@@ -28,7 +28,6 @@ SFNT_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SFNT_DIR))
SFNT_DRV_SRC := $(SFNT_DIR)/ttload.c \
$(SFNT_DIR)/ttcmap.c \
$(SFNT_DIR)/ttsbit.c \
- $(SFNT_DIR)/ttsbit0.c \
$(SFNT_DIR)/ttpost.c \
$(SFNT_DIR)/ttkern.c \
$(SFNT_DIR)/sfobjs.c \