another massive changes in order to completely avoid compiler warnings with GCC + "-ansi -pedantic -Wall -W" and LCC. Also fixed the compilation of "type1z" with Win32-LCC (its pre-processor is broken !!) Updated the BUILD document too
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 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014
diff --git a/BUILD b/BUILD
index f0761bd..ccaa15b 100644
--- a/BUILD
+++ b/BUILD
@@ -151,7 +151,7 @@ II. COMMAND-LINE COMPILATION:
if you encounter this problem.
Note that the release version will use Autoconf to detect everything
- on UNix, so this will not be necessary !!
+ on Unix, so this will not be necessary !!
II. DETAILED COMPILATION PROCEDURE:
@@ -160,46 +160,31 @@ II. DETAILED COMPILATION PROCEDURE:
If you don't want to compile FreeType 2 from the command-line (for example
from a graphical IDE on a Mac or Windows), you'll need to understand how the
FreeType files are organized.
-
- First of all, all configuration files are located in "freetype2/config",
- with system-specific overrides in "freetype2/config/<system>". You should
- always place "config/<system>" and "config" in your compilation include
- path, **in this order**
-
- Also, place the directory "include" in the compilation include path, as
- well as "src/base" and "src/shared"
-
- Now, FreeType 2 is a very modular design, made of several distinct components.
- Each component can be compiler either as a stand-alone object file, or as a
- list of independent objects.
-
- For example, the "base layer" is made of the following independent source
- files:
-
- freetype2/
- src/
- base/
- ftcalc.c
- ftdebug.c
- ftextend.c
- ftlist.c
- ftobjs.c
- ftstream.c
- ftraster.c
- ftoutln.c
- ftsystem.c
-
- You can compile each of these files separately.
-
- Another method is to compile the file "src/base/ftbase.c" which performs
- a simple include on all these individual files. This will compile the whole
- base layer as a single object file.
-
- Note that through careful macro definitions, compiling a module as a single
- component avoids the generation of many externals (that really correspond
- to intra-module dependencies) and provides greater optimisations
- opportunities.
-
+
+ FreeType 2 has a very module design, and it is made of several components.
+ Each component must be compiled as a stand-alone object file, even when it
+ is really made of several C source files. For example, the "base layer"
+ component is made of the following C files:
+
+ src/
+ base/
+ ftcalc.c - computations
+ ftobjs.c - object management
+ ftstream.c - stream input
+ ftlist.c - simple list management
+ ftoutln.c - simple outline processing
+ ftextend.c - extensions support
+
+ However, you can create a single object file by compiling the file
+ "src/base/ftbase.c", whose content is:
+
+ #include <ftcalc.c>
+ #include <ftobjs.c>
+ #include <ftstream.c>
+ #include <ftlist.c>
+ #include <ftoutln.c>
+ #include <ftextend.c>
+
Similarly, each component has a single "englobing" C file to compile it
as a stand-alone object, i.e. :
@@ -209,9 +194,39 @@ II. DETAILED COMPILATION PROCEDURE:
src/truetype/truetype.c - the TrueType font driver
src/type1/type1.c - the Type 1 font driver
- Now, you can decide how to compile each module, and add the corresponding
- object files to your library..
+
+ To compile one component, do the following:
+
+ - add the top-level "include" directory to your compilation include path
+
+ - add the component's path to your compilation include path too. Being
+ in the component's directory isn't enough !!
+
+ - compile the component "source" file (see list below).
+
+ For example, the following line can be used to compile the truetype driver
+ on Unix:
+
+ cd freetype2/
+ cc -c -Iinclude -Isrc/truetype src/truetype/truetype.c
+
+ Alternatively:
+
+ cd freetype2/src/truetype
+ cc -c -I../../include -I. src/truetype/truetype.c
+
+ The complete list of files to compile for a feature-complete build of
+ FreeType 2 is:
- The directory "freetype2/include" contains all public header files that
- may be included by client applications..
+ src/base/ftsystem.c - system-specific memory and i/o support
+ src/base/ftinit.c - initialisation layer
+ src/base/ftdebug.c - debugging component (empty in release build)
+ src/base/ftbase.c - the "base layer" component
+ src/base/ftraster.c - the standard raster (scan-converter)
+ src/base/ftgrays.c - the smooth raster (anti-aliased only)
+ src/base/ftglyph.c - optional convenience functions
+ src/sfnt/sfnt.c - the "sfnt" module
+ src/psnames/psnames.c - the "psnames" module
+ src/truetype/truetype.c - the TrueType font driver
+ src/type1/type1.c - the Type 1 font driver
diff --git a/CHANGES b/CHANGES
index 7a471a2..4a568bd 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,29 @@
LATEST CHANGES -
+ - light update/cleaning of the build system + changes to the sources in
+ order to get rid of _all_ compiler warnings with three compilers, i.e:
+
+ gcc with "-ansi -pedantic -Wall -W", Visual C++ with "/W3 /WX"
+ and LCC
+
+ IMPORTANT NOTE FOR WIN32-LCC USERS:
+ |
+ | It seems the C pre-processor that comes with LCC is broken, it
+ | doesn't recognize the ANSI standard directives # and ## correctly
+ | when one of the argument is a macro. Also, something like:
+ |
+ | #define F(x) print##x
+ |
+ | F(("hello"))
+ |
+ | will get incorrectly translated to:
+ |
+ | print "hello")
+ |
+ | by its pre-processor. For this reason, you simply cannot build
+ | FreeType 2 in debug mode with this compiler..
+
+
- yet another massive grunt work. I've changed the definition of the
EXPORT_DEF, EXPORT_FUNC, BASE_DEF & BASE_FUNC macros. These now take
an argument, which is the function's return value type.
@@ -27,6 +51,7 @@ LATEST CHANGES -
a different signature).
- updated the tutorial (not finished though).
+ - updated the top-level BUILD document
- added the declaration of FT_New_Memory_Face in <freetype/freetype.h>, as
it was missing from the public header (the implementation was already
diff --git a/config/detect.mk b/config/detect.mk
index 6303ee2..74914e4 100644
--- a/config/detect.mk
+++ b/config/detect.mk
@@ -17,16 +17,16 @@
# the following variables:
#
# BUILD The configuration and system-specific directory. Usually
-# `freetype/config/$(PLATFORM)' but can be different if a
-# specific compiler has been requested on the command line.
+# `freetype/config/$(PLATFORM)' but can be different for
+# custom builds of the library.
#
# The following variables must be defined in system specific `detect.mk'
# files:
#
# PLATFORM The detected platform. This will default to `ansi' if
# auto-detection fails.
-# CONFIG_FILE The Makefile to use. This usually depends on the compiler
-# defined in the `CC' environment variable.
+# CONFIG_FILE The configuration sub-makefile to use. This usually depends
+# on the compiler defined in the `CC' environment variable.
# DELETE The shell command used to remove a given file.
# COPY The shell command used to copy one file.
# SEP The platform-specific directory separator.
@@ -44,7 +44,7 @@ TOP := .
endif
# Set auto-detection default to `ansi'.
-# Note that we delay the evaluation of $(CONFIG_), $(BUILD), and
+# Note that we delay the evaluation of $(BUILD_CONFIG_), $(BUILD), and
# $(CONFIG_RULES).
#
PLATFORM := ansi
@@ -52,9 +52,9 @@ DELETE := $(RM)
COPY := cp
SEP := /
-CONFIG_ = $(TOP)$(SEP)config$(SEP)
-BUILD = $(CONFIG_)$(PLATFORM)
-CONFIG_RULES = $(BUILD)$(SEP)$(CONFIG_FILE)
+BUILD_CONFIG_ = $(TOP)$(SEP)config$(SEP)
+BUILD = $(BUILD_CONFIG_)$(PLATFORM)
+CONFIG_RULES = $(BUILD)$(SEP)$(CONFIG_FILE)
# We define the BACKSLASH variable to hold a single back-slash character.
# This is needed because a line like
@@ -74,7 +74,7 @@ BACKSLASH := $(strip \ )
# directories. Note that the calling order of the various `detect.mk' files
# isn't predictable.
#
-include $(wildcard $(CONFIG_)*/detect.mk)
+include $(wildcard $(BUILD_CONFIG_)*/detect.mk)
# In case no detection rule file was successful, use the default.
#
@@ -86,7 +86,7 @@ endif
# The following targets are equivalent, with the exception that they use
# slightly different syntaxes for the `echo' command.
#
-# std_setup: defined for most platforms
+# std_setup: defined for most (i.e. Unix-like) platforms
# dos_setup: defined for Dos-ish platforms like Dos, Windows & OS/2
#
.PHONY: std_setup dos_setup
diff --git a/config/dos/detect.mk b/config/dos/detect.mk
index 3269438..e491e9e 100644
--- a/config/dos/detect.mk
+++ b/config/dos/detect.mk
@@ -13,11 +13,6 @@
# fully.
-# This configuration file to be used depends on the value of the CC
-# environment variable which is set below according to the compiler name
-# given as a parameter to make.
-
-
# We test for the COMSPEC environment variable, then run the `ver'
# command-line program to see if its output contains the word `Dos'.
#
diff --git a/config/os2/detect.mk b/config/os2/detect.mk
index f16c801..24d8ec8 100644
--- a/config/os2/detect.mk
+++ b/config/os2/detect.mk
@@ -13,11 +13,6 @@
# fully.
-# This configuration file to be used depends on the value of the CC
-# environment variable which is set below according to the compiler name
-# given as a parameter to make.
-
-
ifeq ($(PLATFORM),ansi)
ifdef OS2_SHELL
diff --git a/config/unix/detect.mk b/config/unix/detect.mk
index 2ce47e5..28a5f34 100644
--- a/config/unix/detect.mk
+++ b/config/unix/detect.mk
@@ -13,7 +13,7 @@
# fully.
-# This will probably change a lost in the future if we are going to use
+# This will probably change a lot in the future if we are going to use
# Automake/Autoconf...
diff --git a/config/win32/detect.mk b/config/win32/detect.mk
index ea9583c..cd777fb 100644
--- a/config/win32/detect.mk
+++ b/config/win32/detect.mk
@@ -13,11 +13,6 @@
# fully.
-# This configuration file to be used depends on the value of the CC
-# environment variable which is set below according to the compiler name
-# given as a parameter to make.
-
-
ifeq ($(PLATFORM),ansi)
# Detecting Windows NT is easy, as the OS variable must be defined and
diff --git a/config/win32/w32-lcc.mk b/config/win32/w32-lcc.mk
index 69c395f..828d457 100644
--- a/config/win32/w32-lcc.mk
+++ b/config/win32/w32-lcc.mk
@@ -128,7 +128,7 @@ distclean_freetype: distclean_freetype_dos
DIR_OBJ := $(subst /,\\,$(OBJ_DIR))
$(FT_LIBRARY): $(OBJECTS_LIST)
- lcclnk -o $(subst /,\\,$@) $(subst /,\\,$<)
+ lcclnk -o $(subst /,\\,$@) $(subst /,\\,$(OBJECTS_LIST))
endif
diff --git a/demos/Makefile b/demos/Makefile
index 9c090ac..d6ca827 100644
--- a/demos/Makefile
+++ b/demos/Makefile
@@ -84,6 +84,7 @@ else
LINK = $(CC) $T$@ $< $(FTLIB) $(EFENCE) $(LDFLAGS)
COMMON_LINK = $(LINK) $(COMMON_OBJ)
GRAPH_LINK = $(COMMON_LINK) $(GRAPH_LIB)
+ GRAPH_LINK2 = $(GRAPH_LINK) $(EXTRA_GRAPH_OBJS)
.PHONY: exes clean distclean
@@ -187,6 +188,8 @@ else
$(OBJ_)ftgrays2.$O: $(SRC_DIR_)ftgrays2.c
$(COMPILE) $T$@ $<
+ EXTRA_GRAPH_OBJS := $(OBJ_)ftrast.$O $(OBJ_)ftrast2.$O
+
$(OBJ_)ftrast.$O: $(SRC_DIR_)ftrast.c
$(COMPILE) $T$@ $<
@@ -268,7 +271,7 @@ else
$(BIN_)ftview$E: $(OBJ_)ftview.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ) $(OBJ_)ftrast2.$O $(OBJ_)ftrast.$O
- $(GRAPH_LINK) $(OBJ_)ftrast2.$O $(OBJ_)ftrast.$O
+ $(GRAPH_LINK2)
$(BIN_)ftstring$E: $(OBJ_)ftstring.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ)
$(GRAPH_LINK)
diff --git a/demos/graph/win32/rules.mk b/demos/graph/win32/rules.mk
index 0bccf83..d02ceeb 100644
--- a/demos/graph/win32/rules.mk
+++ b/demos/graph/win32/rules.mk
@@ -46,6 +46,7 @@ LINK_ROOT = lcclnk -o $(subst /,\\,$@) $(subst /,\\,$<)
LINK = $(LINK_ROOT) $(subst /,\\,$(FTLIB))
COMMON_LINK = $(LINK_ROOT) $(subst /,\\,$(COMMON_OBJ)) $(subst /,\\,$(FTLIB))
GRAPH_LINK = $(LINK_ROOT) $(subst /,\\,$(COMMON_OBJ)) $(subst /,\\,$(GRAPH_LIB)) $(subst /,\\,$(FTLIB))
+GRAPH_LINK2 = $(GRAPH_LINK) $(subst /,\\,$(EXTRA_GRAPH_OBJS))
endif
endif
diff --git a/demos/src/ftrast.c b/demos/src/ftrast.c
index 267261d..99ce1d7 100644
--- a/demos/src/ftrast.c
+++ b/demos/src/ftrast.c
@@ -257,14 +257,6 @@
(( sizeof(TProfile)+sizeof(long)-1 ) / sizeof(long))
- /* Left fill bitmask */
- static const Byte LMask[8] =
- { 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01 };
-
- /* Right fill bitmask */
- static const Byte RMask[8] =
- { 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF };
-
#ifdef TT_STATIC_RASTER
@@ -1815,7 +1807,7 @@
{
Long pitch = ras.target.pitch;
- (void)max;
+ UNUSED(max);
ras.traceIncr = (Short)- pitch;
ras.traceOfs = - *min * pitch;
@@ -1838,9 +1830,9 @@
Byte f1, f2;
Byte* target;
- (void)y;
- (void)left;
- (void)right;
+ UNUSED(y);
+ UNUSED(left);
+ UNUSED(right);
/* Drop-out control */
@@ -2015,9 +2007,9 @@
static void Horizontal_Sweep_Init( RAS_ARGS Short* min, Short* max )
{
/* nothing, really */
- (void)raster;
- (void)min;
- (void)max;
+ UNUSED(raster);
+ UNUSED(min);
+ UNUSED(max);
}
@@ -2031,8 +2023,8 @@
PByte bits;
Byte f1;
- (void)left;
- (void)right;
+ UNUSED(left);
+ UNUSED(right);
if ( x2-x1 < ras.precision )
{
@@ -2173,7 +2165,7 @@
static void Horizontal_Sweep_Step( RAS_ARG )
{
/* Nothing, really */
- (void)raster;
+ UNUSED(raster);
}
@@ -2285,12 +2277,12 @@
PProfile right )
{
/* nothing, really */
- (void)raster;
- (void)y;
- (void)x1;
- (void)x2;
- (void)left;
- (void)right;
+ UNUSED(raster);
+ UNUSED(y);
+ UNUSED(x1);
+ UNUSED(x2);
+ UNUSED(left);
+ UNUSED(right);
}
static void Horizontal_Gray_Sweep_Drop( RAS_ARGS Short y,
diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h
index 55c2e90..600337e 100644
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -95,6 +95,13 @@
#define FT_ALIGNMENT 8
+/* UNUSED is a macro used to indicate that a given parameter is not used */
+/* this is only used to get rid of unpleasant compiler warnings.. */
+#ifndef UNUSED
+#define UNUSED( arg ) ( (arg)=(arg) )
+#endif
+
+
/*************************************************************************/
/* */
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index ef715ff..3a75330 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -170,7 +170,7 @@
/* Don't define any of these macros to compile in `release' mode. */
/* */
#undef FT_DEBUG_LEVEL_ERROR
-#define FT_DEBUG_LEVEL_TRACE
+#undef FT_DEBUG_LEVEL_TRACE
/*************************************************************************/
diff --git a/include/freetype/internal/ftdebug.h b/include/freetype/internal/ftdebug.h
index 97bdfd6..6e09273 100644
--- a/include/freetype/internal/ftdebug.h
+++ b/include/freetype/internal/ftdebug.h
@@ -51,6 +51,11 @@
#endif
+/* A very stupid pre-processor trick. See K&R version 2 */
+/* section A12.3 for details.. */
+#define FT_CAT(x,y) x ## y
+#define FT_XCAT(x,y) FT_CAT(x,y)
+
#ifdef FT_DEBUG_LEVEL_TRACE
@@ -78,15 +83,6 @@
trace_ttextend,
trace_ttdriver,
-#if 0
- /* define an enum for each TrueDoc driver component */
- trace_tdobjs,
- trace_tdload,
- trace_tdgload,
- trace_tdhint,
- trace_tddriver,
-#endif
-
/* define an enum for each Type1 driver component */
trace_t1objs,
trace_t1load,
@@ -120,7 +116,7 @@
do \
{ \
if ( ft_trace_levels[FT_COMPONENT] >= level ) \
- FT_Message##varformat; \
+ FT_XCAT( FT_Message, varformat ); \
} while ( 0 )
@@ -174,7 +170,7 @@
/* print a message and exit */
EXPORT_DEF(void) FT_Panic ( const char* fmt, ... );
-#define FT_ERROR( varformat ) FT_Message##varformat
+#define FT_ERROR(varformat) do { FT_XCAT( FT_Message, varformat ) } while(0)
#endif /* FT_DEBUG_LEVEL_TRACE || FT_DEBUG_LEVEL_ERROR */
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index b0fb802..f3f78ed 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -46,7 +46,7 @@
#endif
#ifndef UNUSED
-#define UNUSED( arg ) ( (void)(arg) )
+#define UNUSED( arg ) ( (void)(arg)=(arg) )
#endif
diff --git a/src/base/ftgrays.c b/src/base/ftgrays.c
index 9228fde..261b72b 100644
--- a/src/base/ftgrays.c
+++ b/src/base/ftgrays.c
@@ -1151,7 +1151,7 @@ int check_sort( PCell cells, int count )
TScan x, y, cover, area;
PCell start, cur, limit;
- (void)target;
+ target=target;
cur = ras.cells;
limit = cur + ras.num_cells;
diff --git a/src/base/ftinit.c b/src/base/ftinit.c
index 04c173c..226a03d 100644
--- a/src/base/ftinit.c
+++ b/src/base/ftinit.c
@@ -88,8 +88,10 @@ const FT_DriverInterface* ft_default_drivers[] =
error = FT_Add_Driver( library, *cur );
/* notify errors, but don't stop */
if ( error )
+ {
FT_ERROR(( "FT.Default_Drivers: Cannot install `%s', error = %x\n",
(*cur)->driver_name, error ));
+ }
cur++;
}
}
diff --git a/src/base/ftraster.c b/src/base/ftraster.c
index c0c444a..d68edfc 100644
--- a/src/base/ftraster.c
+++ b/src/base/ftraster.c
@@ -66,8 +66,8 @@
#include <freetype/internal/ftdebug.h>
#endif
-#ifndef EXPORT_FUNC
-#define EXPORT_FUNC /* nothing */
+#ifndef UNUSED
+#define UNUSED( arg ) ( (arg)=(arg) )
#endif
#undef FT_COMPONENT
@@ -279,7 +279,7 @@
/* `->' */
#define ras (*raster)
-#define UNUSED_RASTER (void)raster;
+#define UNUSED_RASTER (raster=raster);
/*************************************************************************/
/* */
diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c
index faf1360..e9dae85 100644
--- a/src/base/ftsystem.c
+++ b/src/base/ftsystem.c
@@ -66,7 +66,7 @@
void* ft_alloc( FT_Memory memory,
long size )
{
- (void)memory;
+ UNUSED(memory);
return malloc(size);
}
@@ -110,8 +110,8 @@
long new_size,
void* block )
{
- (void)memory;
- (void)cur_size;
+ UNUSED(memory);
+ UNUSED(cur_size);
return realloc( block, new_size );
}
@@ -140,7 +140,7 @@
void ft_free( FT_Memory memory,
void* block )
{
- (void)memory;
+ UNUSED(memory);
free( block );
}
diff --git a/src/psnames/psdriver.c b/src/psnames/psdriver.c
index d2dc154..78283b7 100644
--- a/src/psnames/psdriver.c
+++ b/src/psnames/psdriver.c
@@ -233,7 +233,11 @@
100, /* driver version */
200, /* driver requires FreeType 2 or above */
- (void*)&psnames_interface
+ (void*)&psnames_interface,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0,
};
#else
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index 74d5fd2..8fe6609 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -66,6 +66,10 @@
1, /* driver version */
2, /* driver requires FreeType 2 or above */
- (void*)&sfnt_interface
+ (void*)&sfnt_interface,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0,
};
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index a40486b..b2a678c 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -267,6 +267,7 @@
TT_Table *entry, *limit;
+ UNUSED(faceIndex);
FT_TRACE2(( "TT_Load_Directory( %08lx, %ld )\n",
(TT_Long)face, faceIndex ));
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index 1e63db2..f94716d 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -467,6 +467,7 @@
/* this table is optional */
error = face->goto_table( face, TTAG_EBLC, stream, 0 );
+ if (error)
{
error = 0;
goto Exit;
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index 5e21638..091a370 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -475,8 +475,8 @@
TT_UInt pixel_width,
TT_UInt pixel_height )
{
- (void) pixel_width;
- (void) pixel_height;
+ UNUSED(pixel_width);
+ UNUSED(pixel_height);
/* many things were pre-computed by the base layer */
@@ -640,7 +640,7 @@
static
FTDriver_Interface tt_get_interface( TT_Driver driver, const char* interface )
{
- (void)driver;
+ UNUSED(driver);
if (strcmp(interface,"get_sfnt")==0)
return (FTDriver_Interface)tt_get_sfnt_table;
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index af3982e..1ef9dc4 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -117,7 +117,7 @@
/* This macro is used whenever `exec' is unused in a function, to avoid */
/* stupid warnings from pedantic compilers. */
/* */
-#define UNUSED_EXEC (void)CUR
+#define UNUSED_EXEC UNUSED(CUR)
/*************************************************************************/
@@ -125,7 +125,7 @@
/* This macro is used whenever `args' is unused in a function, to avoid */
/* stupid warnings from pedantic compilers. */
/* */
-#define UNUSED_ARG UNUSED_EXEC; (void)args;
+#define UNUSED_ARG UNUSED_EXEC; UNUSED(args);
/*************************************************************************/
@@ -719,7 +719,7 @@
exec->callTop = 0;
#if 1
- (void)debug;
+ UNUSED(debug);
return exec->face->interpreter( exec );
#else
if ( !debug )
diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c
index fa23c7f..e32cae1 100644
--- a/src/truetype/ttobjs.c
+++ b/src/truetype/ttobjs.c
@@ -165,8 +165,8 @@
PSNames_Interface* psnames;
/* for now, parameters are unused */
- (void)num_params;
- (void)params;
+ UNUSED(num_params);
+ UNUSED(params);
sfnt = (SFNT_Interface*)face->sfnt;
if (!sfnt)
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index f505057..19df387 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -399,9 +399,9 @@
}
- (void)threshold;
- (void)end_x;
- (void)end_y;
+ UNUSED(threshold);
+ UNUSED(end_x);
+ UNUSED(end_y);
flex = decoder->flex_vectors;
@@ -1052,9 +1052,9 @@
if (wx > decoder->builder.advance.x)
decoder->builder.advance.x = wx;
- (void)sbx;
- (void)sby;
- (void)wy;
+ UNUSED(sbx);
+ UNUSED(sby);
+ UNUSED(wy);
return -1; /* return an error code to exit the Type 1 parser */
/* immediately. */
}
@@ -1127,7 +1127,6 @@
type1->subrs,
type1->subrs_len );
/* ignore the error if one occured - skip to next glyph */
- (void)error;
}
*max_advance = decoder.builder.advance.x;
diff --git a/src/type1/t1load.c b/src/type1/t1load.c
index e4802da..f59f226 100644
--- a/src/type1/t1load.c
+++ b/src/type1/t1load.c
@@ -554,7 +554,7 @@
static
T1_Error Do_Def_Ignore( T1_Parser* parser )
{
- (void)parser;
+ UNUSED(parser);
return T1_Err_Ok;
}
diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c
index 07b2180..2546896 100644
--- a/src/type1/t1objs.c
+++ b/src/type1/t1objs.c
@@ -230,10 +230,10 @@
T1_Error error;
PSNames_Interface* psnames;
- (void)num_params;
- (void)params;
- (void)face_index;
- (void)face;
+ UNUSED(num_params);
+ UNUSED(params);
+ UNUSED(face_index);
+ UNUSED(face);
face->root.num_faces = 1;
@@ -506,7 +506,7 @@
LOCAL_FUNC
T1_Error T1_Init_Driver( T1_Driver driver )
{
- (void)driver;
+ UNUSED(driver);
return T1_Err_Ok;
}
@@ -527,7 +527,7 @@
LOCAL_DEF
void T1_Done_Driver( T1_Driver driver )
{
- (void)driver;
+ UNUSED(driver);
}
diff --git a/src/type1/t1tokens.c b/src/type1/t1tokens.c
index 15654cb..6f2f58e 100644
--- a/src/type1/t1tokens.c
+++ b/src/type1/t1tokens.c
@@ -170,8 +170,6 @@
FT_TRACE2(( "Growing tokenizer buffer by %d bytes\n", left_bytes ));
- (void)stream; /* unused in non reentrant mode */
-
if ( !REALLOC( tokzer->base, tokzer->limit,
tokzer->limit + left_bytes ) &&
!FILE_Read( tokzer->base + tokzer->limit, left_bytes ) )
diff --git a/src/type1z/t1gload.c b/src/type1z/t1gload.c
index 5dd2ac1..51d3f44 100644
--- a/src/type1z/t1gload.c
+++ b/src/type1z/t1gload.c
@@ -1217,7 +1217,6 @@
type1->subrs,
type1->subrs_len );
/* ignore the error if one occured - skip to next glyph */
- (void)error;
}
*max_advance = decoder.builder.advance.x;
@@ -1271,7 +1270,7 @@
T1_Init_Decoder( &decoder );
T1_Init_Builder( &decoder.builder, face, size, glyph );
- decoder.builder.no_recurse = !!(load_flags & FT_LOAD_NO_RECURSE);
+ decoder.builder.no_recurse = (FT_Bool)!!(load_flags & FT_LOAD_NO_RECURSE);
/* now load the unscaled outline */
error = T1_Parse_CharStrings( &decoder,
diff --git a/src/type1z/t1load.c b/src/type1z/t1load.c
index 2566419..b2589c2 100644
--- a/src/type1z/t1load.c
+++ b/src/type1z/t1load.c
@@ -83,62 +83,64 @@
/* each callback is in charge of loading a value and storing it in a */
/* given field of the Type 1 face.. */
-#define PARSE_(x) static void parse_##x ( T1_Face face, T1_Loader* loader )
+#define PARSE_(x) static void FT_XCAT(parse_,x) ( T1_Face face, T1_Loader* loader )
+
+#define FIELD FACE.x
#define PARSE_STRING(s,x) PARSE_(x) \
{ \
- FACE.##x = T1_ToString(&loader->parser); \
- FT_TRACE2(( "type1.parse_##x##: \"%s\"\n", FACE.##x )); \
+ FACE.x = T1_ToString(&loader->parser); \
+ FT_TRACE2(( "type1.parse_%s: \"%s\"\n", #x, FACE.x )); \
}
#define PARSE_NUM(s,x,t) PARSE_(x) \
{ \
- FACE.##x = (t)T1_ToInt(&loader->parser); \
- FT_TRACE2(( "type1.parse_##x##: \"%d\"\n", FACE.##x )); \
+ FACE.x = (t)T1_ToInt(&loader->parser); \
+ FT_TRACE2(( "type1.parse_%s: \"%d\"\n", #x, FACE.x )); \
}
#define PARSE_INT(s,x) PARSE_(x) \
{ \
- FACE.##x = T1_ToInt(&loader->parser); \
- FT_TRACE2(( "type1.parse_##x##: \"%d\"\n", FACE.##x )); \
+ FACE.x = T1_ToInt(&loader->parser); \
+ FT_TRACE2(( "type1.parse_%s: \"%d\"\n", #x, FACE.x )); \
}
#define PARSE_BOOL(s,x) PARSE_(x) \
{ \
- FACE.##x = T1_ToBool(&loader->parser); \
- FT_TRACE2(( "type1.parse_##x##: \"%s\"\n", \
- FACE.##x ? "true" : "false" )); \
+ FACE.x = T1_ToBool(&loader->parser); \
+ FT_TRACE2(( "type1.parse_%s : \"%s\"\n", \
+ #x, FACE.x ? "true" : "false" )); \
}
#define PARSE_FIXED(s,x) PARSE_(x) \
{ \
- FACE.##x = T1_ToFixed(&loader->parser,3); \
- FT_TRACE2(( "type1.parse_##x##: \"%f\"\n", FACE.##x/65536.0 )); \
+ FACE.x = T1_ToFixed(&loader->parser,3); \
+ FT_TRACE2(( "type1.parse_%s: \"%f\"\n", #x, FACE.x/65536.0 )); \
}
#define PARSE_COORDS(s,c,m,x) PARSE_(x) \
{ \
- FACE.##c = T1_ToCoordArray(&loader->parser, m, (T1_Short*)FACE.##x ); \
- FT_TRACE2(( "type1.parse_##x##\n" )); \
+ FACE.c = T1_ToCoordArray(&loader->parser, m, (T1_Short*)FACE.x ); \
+ FT_TRACE2(( "type1.parse_%s\n", #x )); \
}
#define PARSE_FIXEDS(s,c,m,x) PARSE_(x) \
{ \
- FACE.##c = T1_ToFixedArray(&loader->parser, m, (T1_Fixed*)FACE.##x, 3 ); \
- FT_TRACE2(( "type1.parse_##x##\n" )); \
+ FACE.c = T1_ToFixedArray(&loader->parser, m, (T1_Fixed*)FACE.x, 3 ); \
+ FT_TRACE2(( "type1.parse_%s\n", #x )); \
}
#define PARSE_COORDS2(s,m,x) PARSE_(x) \
{ \
- (void)T1_ToCoordArray( &loader->parser, m, (T1_Short*)&FACE.##x ); \
- FT_TRACE2(( "type1.parse_##x##\n" )); \
+ (void)T1_ToCoordArray( &loader->parser, m, (T1_Short*)&FACE.x ); \
+ FT_TRACE2(( "type1.parse_%s\n", #x )); \
}
#define PARSE_FIXEDS2(s,m,x) PARSE_(x) \
{ \
- (void)T1_ToFixedArray(&loader->parser, m, (T1_Fixed*)&FACE.##x, 3 ); \
- FT_TRACE2(( "type1.parse_##x##\n" )); \
+ (void)T1_ToFixedArray(&loader->parser, m, (T1_Fixed*)&FACE.x, 3 ); \
+ FT_TRACE2(( "type1.parse_%s\n", #x )); \
}
diff --git a/src/type1z/t1objs.c b/src/type1z/t1objs.c
index 38928c7..2d25408 100644
--- a/src/type1z/t1objs.c
+++ b/src/type1z/t1objs.c
@@ -53,7 +53,7 @@
LOCAL_FUNC
void T1_Done_Size( T1_Size size )
{
- (void)size;
+ UNUSED(size);
}
@@ -76,11 +76,7 @@
LOCAL_DEF
T1_Error T1_Init_Size( T1_Size size )
{
- T1_Error error;
-
size->valid = 0;
-
- (void)error;
return T1_Err_Ok;
}
@@ -105,7 +101,7 @@
LOCAL_FUNC
T1_Error T1_Reset_Size( T1_Size size )
{
- (void)size;
+ UNUSED(size);
return 0;
}
@@ -461,7 +457,7 @@
LOCAL_FUNC
T1_Error T1_Init_Driver( T1_Driver driver )
{
- (void)driver;
+ UNUSED(driver);
return T1_Err_Ok;
}
@@ -482,7 +478,7 @@
LOCAL_DEF
void T1_Done_Driver( T1_Driver driver )
{
- (void)driver;
+ UNUSED(driver);
}