* include/freetype/internal/ftmemory.h: s/new/newsz/ (for C++). (FT_ALLOC): Remove redundant redefinition. * builds/compiler/gcc-dev.mk (CFLAGS) [g++]: Don't use `-Wstrict-prototypes'. * src/base/ftstream.c (FT_Stream_EnterFrame): Add cast. Formatting, copyright years.
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 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652
diff --git a/ChangeLog b/ChangeLog
index 32a7f18..8a2fbe2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,53 +1,91 @@
-2006-05-02 David Turner <david@freetype.org>
-
- * include/freetype/ftstream.h, src/base/ftstream.c: modifying
- various frame-related functions to report the place where the
- frames were entered/extracted/exited/released in the memory debugger.
-
- * include/freetype/internal/ftmemory.h, src/base/ftbitmap.c,
- src/base/ftmac.c, src/base/ftrfork.c, src/lzw/ftzopen.c,
- src/raster/ftrend1.c, src/sfnt/ttpost.c, src/truetype/ttgxvar.c,
- src/type42/t42parse.c, src/winfonts/winfnt.c: hardening the code
- against out-of-bounds conditions when allocating arrays. This is
- for the cases where FT_NEW_ARRAY and FT_RENEW_ARRAY are not used
- already. Introducing the new FT_ALLOC_MULT and FT_REALLOC_MULT
- macros.
+2006-05-02 Werner Lemberg <wl@gnu.org>
+ * include/freetype/internal/ftmemory.h: s/new/newsz/ (for C++).
+ (FT_ALLOC): Remove redundant redefinition.
- * include/freetype/fterrdef.h, include/freetype/config/ftconfig.h,
- include/freetype/internal/ftmemory.h, src/base/ftdbgmem.c,
- src/base/ftutil.c: udpating the memory management functions and
- macros to safely deal with array size buffer overflows, this
- corresponds to attemps to allocate arrays that are too large. For
- an example, consider the following code:
+ * builds/compiler/gcc-dev.mk (CFLAGS) [g++]: Don't use
+ `-Wstrict-prototypes'.
- count = read_uint32_from_file();
- array = malloc( sizeof(Item) * count );
- for ( nn = 0; nn < count; nn++ )
- array[nn] = read_item_from_file();
+ * src/base/ftstream.c (FT_Stream_EnterFrame): Add cast.
- if 'count' is larger than FT_UINT_MAX/sizeof(Item), the multiplication
- will overflow and the array allocated will be smaller than the data
- read from the file. In this case, the heap will be trashed, and this
- can be used as a denial-of-service, or make the engine crash later.
+2006-05-02 David Turner <david@freetype.org>
- the FT_ARRAY_NEW and FT_ARRAY_RENEW macro now check that the new
- count is no more than FT_INT_MAX/item_size, otherwise, a new error,
- named 'FT_Err_Array_Too_Large' will be returned.
+ * include/freetype/ftstream.h (FT_FRAME_ENTER, FT_FRAME_EXIT,
+ FT_FRAME_EXTRACT, FT_FRAME_RELEASE: Use FT_DEBUG_INNER to report the
+ place where the frames were entered, extracted, exited or released
+ in the memory debugger.
+
+ * src/base/ftstream.c (FT_Stream_ReleaseFrame) [FT_DEBUG_MEMORY]:
+ Call ft_mem_free.
+ (FT_Stream_EnterFrame) [FT_DEBUG_MEMORY]: Use ft_mem_qalloc.
+ (FT_Stream_ExitFrame) [FT_DEBUG_MEMORY]: Use ft_mem_free.
+
+
+ Update the memory management functions and macros to safely deal
+ with array size buffer overflows. This corresponds to attemps to
+ allocate arrays that are too large. For an example, consider the
+ following code:
+
+ count = read_uint32_from_file(); array = malloc( sizeof ( Item ) *
+ count ); for ( nn = 0; nn < count; nn++ )
+ array[nn] = read_item_from_file();
+
+ If `count' is larger than `FT_UINT_MAX/sizeof(Item)', the
+ multiplication overflows, and the array allocated os smaller than
+ the data read from the file. In this case, the heap will be
+ trashed, and this can be used as a denial-of-service attack, or make
+ the engine crash later.
+
+ The FT_ARRAY_NEW and FT_ARRAY_RENEW macros now ensure that the new
+ count is no larger than `FT_INT_MAX/item_size', otherwise a new
+ error code `FT_Err_Array_Too_Large' will be returned.
+
+ Note that the memory debugger now works again when FT_DEBUG_MEMORY
+ is defined. FT_STRICT_ALIASING has disappeared; the corresponding
+ code is now the default.
+
+
+ * include/freetype/config/ftconfig.h (FT_BASE_DEF) [!__cplusplus]:
+ Don't use `extern'.
+
+ * include/freetype/fterrdef.h (FT_Err_Array_Too_Large): New error
+ code.
+
+ * include/freetype/internal/ftmemory.h (FT_DEBUG_INNER)
+ [FT_DEBUG_MEMORY]: New macro.
+ (ft_mem_realloc, ft_mem_qrealloc): Pass new object size count also.
+ (ft_mem_alloc_debug, ft_mem_qalloc_debug, ft_mem_realloc_debug,
+ ft_mem_qrealloc_debug, ft_mem_free_debug): Removed.
+ (FT_MEM_ALLOC, FT_MEM_REALLOC, FT_MEM_QALLOC, FT_MEM_QREALLOC,
+ FT_MEM_FREE): Redefine.
+ (FT_MEM_NEW_ARRAY, FT_MEM_RENEW_ARRAY, FT_MEM_QNEW_ARRAY,
+ FT_MEM_QRENEW_ARRAY): Redefine.
+ (FT_ALLOC_MULT, FT_REALLOC_MULT, FT_MEM_QALLOC_MULT,
+ FT_MEM_QREALLOC_MULT): New macros. Update callers where
+ appropriate.
+ (FT_MEM_SET_ERROR): Slightly redefine.
- note that the memory debugger now works again when FT_DEBUG_MEMORY
- is defined, and FT_STRICT_ALIASING has disappeared, the corresponding
- code being now the default.
+ * src/base/ftdbgmem.c (_ft_debug_file, _ft_debug_lineno)
+ [FT_DEBUG_MEMORY]: New global variables, replacing...
+ (FT_MemTable_Rec) [FT_DEBUG_MEMORY]: Remove `filename' and
+ `line_no'. Update all callers.
+ (ft_mem_debug_alloc) [FT_DEBUG_MEMORY]: Avoid possible integer
+ overflow.
+ (ft_mem_alloc_debug, ft_mem_realloc_debug, ft_mem_qalloc_debug,
+ ft_mem_qrealloc_debug, ft_mem_free_debug): Removed.
-2006-04-30 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+ * src/base/ftmac.c (read_lwfn): Catch integer overflow.
+ * src/base/ftrfork.c (raccess_guess_darwin_hfsplus): Ditto.
+ * src/base/ftutil.c: Remove special code for FT_STRICT_ALIASING.
+ (ft_mem_alloc. ft_mem_realloc, ft_mem_qrealloc): Rewrite.
- Fix bug in Mac_Read_POST_Resource() to parse PFB font with MacOS
- resource fork (bug since 2003-09-11). Patch is provided by
- Huib-Jan Imbens <ft@imbens.nl>.
+2006-04-30 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
- * src/base/ftobjs.c: fix pfb_pos initialization, remove extra cast
- to copy to pfb_lenpos.
+ * src/base/ftobjs.c (Mac_Read_POST_Resource): Correct pfb_pos
+ initialization, remove extra cast to copy to pfb_lenpos. This fixes
+ parsing of PFB fonts with MacOS resource fork (bug introduced
+ 2003-09-11). Patch provided by Huib-Jan Imbens <ft@imbens.nl>.
2006-04-29 Werner Lemberg <wl@gnu.org>
@@ -82,7 +120,7 @@
* Version 2.2 released.
- =======================
+ =======================
Tag sources with `VER-2-2-0'.
@@ -185,7 +223,7 @@
2006-03-23 David Turner <david@freetype.org>
Add FT_Get_SubGlyph_Info API to retrieve subglyph data. Note that
- we do not expose the FT_SubGlyphRec structure.
+ we do not expose the FT_SubGlyphRec structure.
* include/freetype/internal/ftgloadr.h (FT_SUBGLYPH_FLAGS_*): Moved
to...
@@ -196,7 +234,7 @@
* src/autofit/afloader.c (af_loader_load_g): Compute lsb_delta and
- rsb_delta correctly in edge cases.
+ rsb_delta correctly in edge cases.
2006-03-22 Werner Lemberg <wl@gnu.org>
@@ -363,7 +401,7 @@
order so that type42 module is removed before truetype module. This
avoids double free in some occasions.
-2006-02-28 David Turner <david@freetype.org>
+2006-02-28 David Turner <david@freetype.org>
* Release candidate VER-2-2-0-RC4.
----------------------------------
diff --git a/builds/compiler/gcc-dev.mk b/builds/compiler/gcc-dev.mk
index 7e96c3e..c63e126 100644
--- a/builds/compiler/gcc-dev.mk
+++ b/builds/compiler/gcc-dev.mk
@@ -64,7 +64,8 @@ T := -o$(space)
#
ifndef CFLAGS
ifeq ($(findstring g++,$(CC)),)
- nested_externs := -Wnested-externs
+ nested_externs := -Wnested-externs
+ strict_prototypes := -Wstrict-prototypes
endif
CFLAGS := -c -g -O0 \
@@ -74,10 +75,10 @@ ifndef CFLAGS
-Wshadow \
-Wpointer-arith \
-Wwrite-strings \
- -Wstrict-prototypes \
-Wredundant-decls \
-Wno-long-long \
- $(nested_externs)
+ $(nested_externs) \
+ $(strict_prototypes)
endif
# ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant.
diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h
index f07fad8..ef50a0e 100644
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -265,7 +265,7 @@ FT_BEGIN_HEADER
#ifndef FT_BASE_DEF
#ifdef __cplusplus
-#define FT_BASE_DEF( x ) extern "C" x
+#define FT_BASE_DEF( x ) x
#else
#define FT_BASE_DEF( x ) x
#endif
diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h
index 9ef5427..de8278e 100644
--- a/include/freetype/internal/ftmemory.h
+++ b/include/freetype/internal/ftmemory.h
@@ -59,16 +59,19 @@ FT_BEGIN_HEADER
#ifdef FT_DEBUG_MEMORY
-FT_BASE( const char* ) _ft_debug_file;
-FT_BASE( long ) _ft_debug_lineno;
+ FT_BASE( const char* ) _ft_debug_file;
+ FT_BASE( long ) _ft_debug_lineno;
-# define FT_DEBUG_INNER(exp) ( _ft_debug_file = __FILE__, _ft_debug_lineno = __LINE__, (exp) )
+#define FT_DEBUG_INNER( exp ) ( _ft_debug_file = __FILE__, \
+ _ft_debug_lineno = __LINE__, \
+ (exp) )
#else /* !FT_DEBUG_MEMORY */
-# define FT_DEBUG_INNER(exp) (exp)
+#define FT_DEBUG_INNER( exp ) (exp)
+
+#endif /* !FT_DEBUG_MEMORY */
-#endif
/*
* The allocation functions return a pointer, and the error code
@@ -107,51 +110,61 @@ FT_BASE( long ) _ft_debug_lineno;
const void* P );
-#define FT_MEM_ALLOC(ptr,size) \
- FT_DEBUG_INNER( (ptr) = ft_mem_alloc( memory, (size), &error ) )
-
-#define FT_MEM_FREE(ptr) \
- FT_BEGIN_STMNT \
- ft_mem_free( memory, (ptr) ); \
- (ptr) = NULL; \
- FT_END_STMNT
-
-#define FT_MEM_NEW(ptr) \
- FT_MEM_ALLOC( ptr, sizeof(*(ptr)) )
+#define FT_MEM_ALLOC( ptr, size ) \
+ FT_DEBUG_INNER( (ptr) = ft_mem_alloc( memory, (size), &error ) )
-#define FT_MEM_REALLOC( ptr, cur, new ) \
- FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, 1, (cur), (new), (ptr), &error ) )
+#define FT_MEM_FREE( ptr ) \
+ FT_BEGIN_STMNT \
+ ft_mem_free( memory, (ptr) ); \
+ (ptr) = NULL; \
+ FT_END_STMNT
-#define FT_MEM_QALLOC(ptr,size) \
- FT_DEBUG_INNER( (ptr) = ft_mem_qalloc( memory, (size), &error ) )
+#define FT_MEM_NEW( ptr ) \
+ FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) )
-#define FT_MEM_QNEW(ptr) \
- FT_MEM_QALLOC( ptr, sizeof(*(ptr)) )
+#define FT_MEM_REALLOC( ptr, cursz, newsz ) \
+ FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, 1, \
+ (cursz), (newsz), \
+ (ptr), &error ) )
-#define FT_MEM_QREALLOC( ptr, cur, new ) \
- FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, 1, (cur), (new), (ptr), &error ) )
+#define FT_MEM_QALLOC( ptr, size ) \
+ FT_DEBUG_INNER( (ptr) = ft_mem_qalloc( memory, (size), &error ) )
-#define FT_MEM_QRENEW_ARRAY(ptr,cur,new) \
- FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, sizeof(*(ptr)), (cur), (new), (ptr), &error ) )
+#define FT_MEM_QNEW( ptr ) \
+ FT_MEM_QALLOC( ptr, sizeof ( *(ptr) ) )
-#define FT_MEM_ALLOC_MULT(ptr,count,item_size) \
- FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, (item_size), 0, (count), NULL, &error ) )
+#define FT_MEM_QREALLOC( ptr, cursz, newsz ) \
+ FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, 1, \
+ (cursz), (newsz), \
+ (ptr), &error ) )
-#define FT_MEM_REALLOC_MULT(ptr,oldcnt,newcnt,itmsz) \
- FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, (itmsz), (oldcnt), (newcnt), (ptr), &error ) )
+#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \
+ FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \
+ (cursz), (newsz), \
+ (ptr), &error ) )
-#define FT_MEM_QALLOC_MULT(ptr,count,item_size) \
- FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, (item_size), 0, (count), NULL, &error ) )
+#define FT_MEM_ALLOC_MULT( ptr, count, item_size ) \
+ FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, (item_size), \
+ 0, (count), \
+ NULL, &error ) )
-#define FT_MEM_QREALLOC_MULT(ptr,oldcnt,newcnt,itmsz) \
- FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, (itmsz), (oldcnt), (newcnt), (ptr), &error ) )
+#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
+ FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, (itmsz), \
+ (oldcnt), (newcnt), \
+ (ptr), &error ) )
+#define FT_MEM_QALLOC_MULT( ptr, count, item_size ) \
+ FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, (item_size), \
+ 0, (count), \
+ NULL, &error ) )
-#define FT_MEM_SET_ERROR( cond ) ( (cond), error != 0 )
+#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \
+ FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, (itmsz), \
+ (oldcnt), (newcnt), \
+ (ptr), &error ) )
-#define FT_ALLOC(ptr,size) FT_MEM_SET_ERROR( FT_MEM_ALLOC(ptr,size) )
-
+#define FT_MEM_SET_ERROR( cond ) ( (cond), error != 0 )
#define FT_MEM_SET( dest, byte, count ) ft_memset( dest, byte, count )
@@ -192,63 +205,71 @@ FT_BASE( long ) _ft_debug_lineno;
/* _typed_ in order to automatically compute array element sizes. */
/* */
-#define FT_MEM_NEW_ARRAY(ptr,count) \
- FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, sizeof(*(ptr)), 0, (count), NULL, &error ) )
-
-#define FT_MEM_RENEW_ARRAY(ptr,cur,new) \
- FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, sizeof(*(ptr)), (cur), (new), (ptr), &error ) )
+#define FT_MEM_NEW_ARRAY( ptr, count ) \
+ FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, sizeof ( *(ptr) ), \
+ 0, (count), \
+ NULL, &error ) )
-#define FT_MEM_QNEW_ARRAY(ptr,count) \
- FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, sizeof(*(ptr)), 0, (count), NULL, &error ) )
+#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz ) \
+ FT_DEBUG_INNER( (ptr) = ft_mem_realloc( memory, sizeof ( *(ptr) ), \
+ (cursz), (newsz), \
+ (ptr), &error ) )
-#define FT_MEM_QRENEW_ARRAY(ptr,cur,new) \
- FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, sizeof(*(ptr)), (cur), (new), (ptr), &error ) )
+#define FT_MEM_QNEW_ARRAY( ptr, count ) \
+ FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \
+ 0, (count), \
+ NULL, &error ) )
+#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \
+ FT_DEBUG_INNER( (ptr) = ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \
+ (cursz), (newsz), \
+ (ptr), &error ) )
-#define FT_ALLOC(ptr,size) \
- FT_MEM_SET_ERROR( FT_MEM_ALLOC(ptr,size) )
-#define FT_REALLOC(ptr,cursz,newsz) \
- FT_MEM_SET_ERROR( FT_MEM_REALLOC(ptr,cursz,newsz) )
+#define FT_ALLOC( ptr, size ) \
+ FT_MEM_SET_ERROR( FT_MEM_ALLOC( ptr, size ) )
-#define FT_ALLOC_MULT(ptr,count,item_size) \
- FT_MEM_SET_ERROR( FT_MEM_ALLOC_MULT(ptr,count,item_size) )
+#define FT_REALLOC( ptr, cursz, newsz ) \
+ FT_MEM_SET_ERROR( FT_MEM_REALLOC( ptr, cursz, newsz ) )
-#define FT_REALLOC_MULT(ptr,oldcnt,newcnt,itmsz) \
- FT_MEM_SET_ERROR( FT_MEM_REALLOC_MULT(ptr,oldcnt,newcnt,itmsz) )
+#define FT_ALLOC_MULT( ptr, count, item_size ) \
+ FT_MEM_SET_ERROR( FT_MEM_ALLOC_MULT( ptr, count, item_size ) )
-#define FT_QALLOC(ptr,size) \
- FT_MEM_SET_ERROR( FT_MEM_QALLOC(ptr,size) )
+#define FT_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
+ FT_MEM_SET_ERROR( FT_MEM_REALLOC_MULT( ptr, oldcnt, \
+ newcnt, itmsz ) )
-#define FT_QREALLOC(ptr,cursz,newsz) \
- FT_MEM_SET_ERROR( FT_MEM_QREALLOC(ptr,cursz,newsz) )
+#define FT_QALLOC( ptr, size ) \
+ FT_MEM_SET_ERROR( FT_MEM_QALLOC( ptr, size ) )
-#define FT_QALLOC_MULT(ptr,count,item_size) \
- FT_MEM_SET_ERROR( FT_MEM_QALLOC_MULT(ptr,count,item_size) )
+#define FT_QREALLOC( ptr, cursz, newsz ) \
+ FT_MEM_SET_ERROR( FT_MEM_QREALLOC( ptr, cursz, newsz ) )
-#define FT_QREALLOC_MULT(ptr,oldcnt,newcnt,itmsz) \
- FT_MEM_SET_ERROR( FT_MEM_QREALLOC_MULT(ptr,oldcnt,newcnt,itmsz) )
+#define FT_QALLOC_MULT( ptr, count, item_size ) \
+ FT_MEM_SET_ERROR( FT_MEM_QALLOC_MULT( ptr, count, item_size ) )
-#define FT_FREE(ptr) FT_MEM_FREE( ptr )
+#define FT_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
+ FT_MEM_SET_ERROR( FT_MEM_QREALLOC_MULT( ptr, oldcnt, \
+ newcnt, itmsz ) )
-#define FT_NEW(ptr) \
- FT_MEM_SET_ERROR( FT_MEM_NEW(ptr) )
+#define FT_FREE( ptr ) FT_MEM_FREE( ptr )
-#define FT_NEW_ARRAY(ptr,count) \
- FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY(ptr,count) )
+#define FT_NEW( ptr ) FT_MEM_SET_ERROR( FT_MEM_NEW( ptr ) )
-#define FT_RENEW_ARRAY(ptr,curcnt,newcnt) \
- FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY(ptr,curcnt,newcnt) )
+#define FT_NEW_ARRAY( ptr, count ) \
+ FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )
-#define FT_QNEW(ptr) \
- FT_MEM_SET_ERROR( FT_MEM_QNEW(ptr) )
+#define FT_RENEW_ARRAY( ptr, curcnt, newcnt ) \
+ FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )
-#define FT_QNEW_ARRAY(ptr,count) \
- FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY(ptr,count) )
+#define FT_QNEW( ptr ) \
+ FT_MEM_SET_ERROR( FT_MEM_QNEW( ptr ) )
-#define FT_QRENEW_ARRAY(ptr,curcnt,newcnt) \
- FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY(ptr,curcnt,newcnt) )
+#define FT_QNEW_ARRAY( ptr, count ) \
+ FT_MEM_SET_ERROR( FT_MEM_NEW_ARRAY( ptr, count ) )
+#define FT_QRENEW_ARRAY( ptr, curcnt, newcnt ) \
+ FT_MEM_SET_ERROR( FT_MEM_RENEW_ARRAY( ptr, curcnt, newcnt ) )
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
@@ -274,6 +295,7 @@ FT_BASE( long ) _ft_debug_lineno;
FT_Long current,
FT_Long size,
void* *p );
+
FT_BASE( void )
FT_Free( FT_Memory memory,
void* *P );
diff --git a/include/freetype/internal/ftstream.h b/include/freetype/internal/ftstream.h
index 960cf6f..c49d8fc 100644
--- a/include/freetype/internal/ftstream.h
+++ b/include/freetype/internal/ftstream.h
@@ -4,7 +4,7 @@
/* */
/* Stream handling (specification). */
/* */
-/* Copyright 1996-2001, 2002, 2004, 2005 by */
+/* Copyright 1996-2001, 2002, 2004, 2005, 2006 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -514,19 +514,21 @@ FT_BEGIN_HEADER
FT_SET_ERROR( FT_Stream_ReadFields( stream, fields, object ) )
-#define FT_FRAME_ENTER( size ) \
- FT_SET_ERROR( FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, size ) ) )
+#define FT_FRAME_ENTER( size ) \
+ FT_SET_ERROR( \
+ FT_DEBUG_INNER( FT_Stream_EnterFrame( stream, size ) ) )
#define FT_FRAME_EXIT() \
FT_DEBUG_INNER( FT_Stream_ExitFrame( stream ) )
-#define FT_FRAME_EXTRACT( size, bytes ) \
- FT_SET_ERROR( \
- FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, size, \
- (FT_Byte**)&(bytes) ) ) )
+#define FT_FRAME_EXTRACT( size, bytes ) \
+ FT_SET_ERROR( \
+ FT_DEBUG_INNER( FT_Stream_ExtractFrame( stream, size, \
+ (FT_Byte**)&(bytes) ) ) )
-#define FT_FRAME_RELEASE( bytes ) \
- FT_DEBUG_INNER( FT_Stream_ReleaseFrame( stream, (FT_Byte**)&(bytes) ) )
+#define FT_FRAME_RELEASE( bytes ) \
+ FT_DEBUG_INNER( FT_Stream_ReleaseFrame( stream, \
+ (FT_Byte**)&(bytes) ) )
FT_END_HEADER
diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c
index 94996d7..7ebb141 100644
--- a/src/base/ftdbgmem.c
+++ b/src/base/ftdbgmem.c
@@ -50,10 +50,11 @@
#define FT_MEM_VAL( addr ) ((FT_ULong)(FT_Pointer)( addr ))
- /* this structure holds statistics for a single allocation/release
- * site. This is useful to know where memory operations happen the
- * most.
- */
+ /*
+ * This structure holds statistics for a single allocation/release
+ * site. This is useful to know where memory operations happen the
+ * most.
+ */
typedef struct FT_MemSourceRec_
{
const char* file_name;
@@ -81,12 +82,13 @@
*/
#define FT_MEM_SOURCE_BUCKETS 128
- /* this structure holds information related to a single allocated
- * memory block. if KEEPALIVE is defined, blocks that are freed by
- * FreeType are never released to the system. Instead, their 'size'
- * field is set to -size. This is mainly useful to detect double frees,
- * at the price of large memory footprint during execution !!
- */
+ /*
+ * This structure holds information related to a single allocated
+ * memory block. If KEEPALIVE is defined, blocks that are freed by
+ * FreeType are never released to the system. Instead, their `size'
+ * field is set to -size. This is mainly useful to detect double frees,
+ * at the price of large memory footprint during execution.
+ */
typedef struct FT_MemNodeRec_
{
FT_Byte* address;
@@ -104,9 +106,10 @@
} FT_MemNodeRec;
- /* the global structure, containing compound statistics and all hash
- * tables
- */
+ /*
+ * The global structure, containing compound statistics and all hash
+ * tables.
+ */
typedef struct FT_MemTableRec_
{
FT_ULong size;
diff --git a/src/base/ftstream.c b/src/base/ftstream.c
index ac62ee1..a067a1f 100644
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -4,7 +4,7 @@
/* */
/* I/O stream support (body). */
/* */
-/* Copyright 2000-2001, 2002, 2004, 2005 by */
+/* Copyright 2000-2001, 2002, 2004, 2005, 2006 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -241,7 +241,7 @@
#ifdef FT_DEBUG_MEMORY
/* assume _ft_debug_file and _ft_debug_lineno are already set */
- stream->base = ft_mem_qalloc( memory, count, &error );
+ stream->base = (unsigned char*)ft_mem_qalloc( memory, count, &error );
if ( error )
goto Exit;
#else
diff --git a/src/base/ftutil.c b/src/base/ftutil.c
index 381fa81..7ad780d 100644
--- a/src/base/ftutil.c
+++ b/src/base/ftutil.c
@@ -98,10 +98,11 @@
{
FT_Error error = FT_Err_Ok;
- block = ft_mem_qrealloc( memory, item_size, cur_count, new_count, block, &error );
+ block = ft_mem_qrealloc( memory, item_size,
+ cur_count, new_count, block, &error );
if ( !error && new_count > cur_count )
- FT_MEM_ZERO( (char*)block + cur_count*item_size,
- (new_count-cur_count)*item_size );
+ FT_MEM_ZERO( (char*)block + cur_count * item_size,
+ ( new_count - cur_count ) * item_size );
*p_error = error;
return block;
diff --git a/src/lzw/ftzopen.c b/src/lzw/ftzopen.c
index 1d29fd8..a9d25c5 100644
--- a/src/lzw/ftzopen.c
+++ b/src/lzw/ftzopen.c
@@ -8,7 +8,7 @@
/* be used to parse compressed PCF fonts, as found with many X11 server */
/* distributions. */
/* */
-/* Copyright 2005 by David Turner. */
+/* Copyright 2005, 2006 by David Turner. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */
@@ -128,7 +128,7 @@
*
*/
if ( FT_REALLOC_MULT( state->prefix, old_size, new_size,
- sizeof(FT_UShort)+sizeof(FT_Byte) ) )
+ sizeof ( FT_UShort ) + sizeof ( FT_Byte ) ) )
return -1;
/* now adjust `suffix' and move the data accordingly */
diff --git a/src/raster/ftrend1.c b/src/raster/ftrend1.c
index 4e8d10f..3cc8d07 100644
--- a/src/raster/ftrend1.c
+++ b/src/raster/ftrend1.c
@@ -4,7 +4,7 @@
/* */
/* The FreeType glyph rasterizer interface (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2005 by */
+/* Copyright 1996-2001, 2002, 2003, 2005, 2006 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 0e72435..c3ae970 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -4,7 +4,7 @@
/* */
/* TrueType GX Font Variation loader */
/* */
-/* Copyright 2004, 2005 by */
+/* Copyright 2004, 2005, 2006 by */
/* David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. */
/* */
/* This file is part of the FreeType project, and may only be used, */
diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c
index b589f19..6e1a683 100644
--- a/src/type42/t42parse.c
+++ b/src/type42/t42parse.c
@@ -4,7 +4,7 @@
/* */
/* Type 42 font parser (body). */
/* */
-/* Copyright 2002, 2003, 2004, 2005 by Roberto Alameda. */
+/* Copyright 2002, 2003, 2004, 2005, 2006 by Roberto Alameda. */
/* */
/* This file is part of the FreeType project, and may only be used, */
/* modified, and distributed under the terms of the FreeType project */