From 4b8397c775849a93acb9cd0d7044d32b4fcc9dbb Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Sun, 29 Aug 2004 16:50:09 +0000 Subject: [PATCH] * src/otlayout/otlgpos.c (otl_gpos_subtable_validate): Add argument to pass number of lookups. Update all callers. Don't call otl_lookup_list_validate but otl_lookup_validate. (otl_gpos_validate): Call otl_lookup_list_validate instead of otl_gpos_subtable_validate. * src/otlayout/otlgpos.h: Updated. * src/otlayout/otljstf.c (otl_jstf_max_validate): Add argument to pass number of lookups. Update all callers. * src/cff/cffparse.c (cff_parse_real): s/exp/exponent/ to avoid compiler warning. * src/sfnt/ttcmap0.c, src/sfnt/ttcmap0.h: Renamed to... * src/sfnt/ttcmap.c, src/sfnt/ttcmap.h: This. * src/sfnt/Jamfile, src/sfnt/rules.mk, src/sfnt/sfdriver.c, src/sfnt/sfnt.c, src/sfnt/sfobjs.c: Updated. * builds/compiler/gcc-dev.mk (CFLAGS): Don't add `-Wnested-externs' if compiler is g++ (v3.3.3 emits a warning otherwise). --- ChangeLog | 29 +++++++++++++++++++++++++++++ builds/compiler/gcc-dev.mk | 10 +++++++--- src/cff/cffparse.c | 18 +++++++++--------- src/otlayout/otlgpos.c | 8 +++++--- src/otlayout/otlgpos.h | 1 + src/otlayout/otljstf.c | 11 +++++++---- src/sfnt/Jamfile | 2 +- src/sfnt/rules.mk | 4 ++-- src/sfnt/sfdriver.c | 2 +- src/sfnt/sfnt.c | 4 ++-- src/sfnt/sfobjs.c | 2 +- src/sfnt/{ttcmap0.c => ttcmap.c} | 8 ++++---- src/sfnt/{ttcmap0.h => ttcmap.h} | 12 ++++++------ 13 files changed, 75 insertions(+), 36 deletions(-) rename src/sfnt/{ttcmap0.c => ttcmap.c} (99%) rename src/sfnt/{ttcmap0.h => ttcmap.h} (88%) diff --git a/ChangeLog b/ChangeLog index bd7fc5a2d..3d8a4e447 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +2004-08-29 Werner Lemberg + + * src/otlayout/otlgpos.c (otl_gpos_subtable_validate): Add argument + to pass number of lookups. + Update all callers. + Don't call otl_lookup_list_validate but otl_lookup_validate. + (otl_gpos_validate): Call otl_lookup_list_validate instead of + otl_gpos_subtable_validate. + + * src/otlayout/otlgpos.h: Updated. + + * src/otlayout/otljstf.c (otl_jstf_max_validate): Add argument to + pass number of lookups. + Update all callers. + + + * src/cff/cffparse.c (cff_parse_real): s/exp/exponent/ to avoid + compiler warning. + + + * src/sfnt/ttcmap0.c, src/sfnt/ttcmap0.h: Renamed to... + * src/sfnt/ttcmap.c, src/sfnt/ttcmap.h: This. + * src/sfnt/Jamfile, src/sfnt/rules.mk, src/sfnt/sfdriver.c, + src/sfnt/sfnt.c, src/sfnt/sfobjs.c: Updated. + + + * builds/compiler/gcc-dev.mk (CFLAGS): Don't add `-Wnested-externs' + if compiler is g++ (v3.3.3 emits a warning otherwise). + 2004-08-28 Werner Lemberg * src/otlayout/otlgpos.c (otl_value_length): Return number of bytes, diff --git a/builds/compiler/gcc-dev.mk b/builds/compiler/gcc-dev.mk index 15879f85b..9cad7e99a 100644 --- a/builds/compiler/gcc-dev.mk +++ b/builds/compiler/gcc-dev.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2003 by +# Copyright 1996-2000, 2003, 2004 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -63,6 +63,10 @@ T := -o$(space) # ANSI compliance. # ifndef CFLAGS + ifeq ($(findstring g++,$(CC)),) + nested_externs := -Wnested-externs + endif + CFLAGS := -c -g -O0 \ -fno-strict-aliasing \ -Wall \ @@ -73,8 +77,8 @@ ifndef CFLAGS -Wwrite-strings \ -Wstrict-prototypes \ -Wredundant-decls \ - -Wnested-externs \ - -Wno-long-long + -Wno-long-long \ + $(nested_externs) endif # ANSIFLAGS: Put there the flags used to make your compiler ANSI-compliant. diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 8f1a98c55..fdf717334 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -143,8 +143,8 @@ FT_Int power_ten ) { FT_Byte* p = start; - FT_Long num, divider, result, exp; - FT_Int sign = 0, exp_sign = 0; + FT_Long num, divider, result, exponent; + FT_Int sign = 0, exponent_sign = 0; FT_UInt nib; FT_UInt phase; @@ -212,13 +212,13 @@ /* read exponent, if any */ if ( nib == 12 ) { - exp_sign = 1; - nib = 11; + exponent_sign = 1; + nib = 11; } if ( nib == 11 ) { - exp = 0; + exponent = 0; for (;;) { @@ -239,13 +239,13 @@ if ( nib >= 10 ) break; - exp = exp * 10 + nib; + exponent = exponent * 10 + nib; } - if ( exp_sign ) - exp = -exp; + if ( exponent_sign ) + exponent = -exponent; - power_ten += (FT_Int)exp; + power_ten += (FT_Int)exponent; } /* raise to power of ten if needed */ diff --git a/src/otlayout/otlgpos.c b/src/otlayout/otlgpos.c index 2c4ca4d75..29d8a245e 100644 --- a/src/otlayout/otlgpos.c +++ b/src/otlayout/otlgpos.c @@ -1057,11 +1057,12 @@ OTL_LOCALDEF( void ) otl_gpos_subtable_validate( OTL_Bytes table, + OTL_UInt lookup_count, OTL_UInt glyph_count, OTL_Validator valid ) { - otl_lookup_list_validate( table, 9, otl_gpos_validate_funcs, - glyph_count, valid ); + otl_lookup_validate( table, 9, otl_gpos_validate_funcs, + lookup_count, glyph_count, valid ); } @@ -1091,7 +1092,8 @@ features = OTL_NEXT_USHORT( p ); lookups = OTL_NEXT_USHORT( p ); - otl_gpos_subtable_validate( table + lookups, glyph_count, valid ); + otl_lookup_list_validate( table + lookups, 9, otl_gpos_validate_funcs, + glyph_count, valid ); otl_feature_list_validate( table + features, table + lookups, valid ); otl_script_list_validate( table + scripts, table + features, valid ); } diff --git a/src/otlayout/otlgpos.h b/src/otlayout/otlgpos.h index 42b88745e..3b6fc05e1 100644 --- a/src/otlayout/otlgpos.h +++ b/src/otlayout/otlgpos.h @@ -26,6 +26,7 @@ OTL_BEGIN_HEADER OTL_LOCAL( void ) otl_gpos_subtable_validate( OTL_Bytes table, + OTL_UInt lookup_count, OTL_UInt glyph_count, OTL_Validator valid ); diff --git a/src/otlayout/otljstf.c b/src/otlayout/otljstf.c index 3f07f7ff2..1583980bb 100644 --- a/src/otlayout/otljstf.c +++ b/src/otlayout/otljstf.c @@ -66,6 +66,7 @@ static void otl_jstf_max_validate( OTL_Bytes table, + OTL_UInt lookup_count, OTL_UInt glyph_count, OTL_Validator valid ) { @@ -80,8 +81,8 @@ /* scan subtable records */ for ( ; num_lookups > 0; num_lookups-- ) /* XXX: check lookup types? */ - otl_gpos_subtable_validate( table + OTL_NEXT_USHORT( p ), glyph_count, - valid ); + otl_gpos_subtable_validate( table + OTL_NEXT_USHORT( p ), + lookup_count, glyph_count, valid ); } @@ -123,7 +124,8 @@ /* shrinkage JSTF max */ val = OTL_NEXT_USHORT( p ); if ( val ) - otl_jstf_max_validate( table + val, glyph_count, valid ); + otl_jstf_max_validate( table + val, gpos_lookup_count, glyph_count, + valid ); /* extension GSUB enable/disable */ val = OTL_NEXT_USHORT( p ); @@ -150,7 +152,8 @@ /* extension JSTF max */ val = OTL_NEXT_USHORT( p ); if ( val ) - otl_jstf_max_validate( table + val, glyph_count, valid ); + otl_jstf_max_validate( table + val, gpos_lookup_count, glyph_count, + valid ); } diff --git a/src/sfnt/Jamfile b/src/sfnt/Jamfile index 257b3442c..ce61d0807 100644 --- a/src/sfnt/Jamfile +++ b/src/sfnt/Jamfile @@ -8,7 +8,7 @@ SubDir FT2_TOP $(FT2_SRC_DIR) sfnt ; if $(FT2_MULTI) { - _sources = sfobjs sfdriver ttcmap0 ttpost ttload ttsbit ; + _sources = sfobjs sfdriver ttcmap ttpost ttload ttsbit ; } else { diff --git a/src/sfnt/rules.mk b/src/sfnt/rules.mk index f13238549..fab5492ea 100644 --- a/src/sfnt/rules.mk +++ b/src/sfnt/rules.mk @@ -3,7 +3,7 @@ # -# Copyright 1996-2000, 2002, 2003 by +# Copyright 1996-2000, 2002, 2003, 2004 by # David Turner, Robert Wilhelm, and Werner Lemberg. # # This file is part of the FreeType project, and may only be used, modified, @@ -26,7 +26,7 @@ SFNT_COMPILE := $(FT_COMPILE) $I$(subst /,$(COMPILER_SEP),$(SFNT_DIR)) # SFNT driver sources (i.e., C files) # SFNT_DRV_SRC := $(SFNT_DIR)/ttload.c \ - $(SFNT_DIR)/ttcmap0.c \ + $(SFNT_DIR)/ttcmap.c \ $(SFNT_DIR)/ttsbit.c \ $(SFNT_DIR)/ttpost.c \ $(SFNT_DIR)/sfobjs.c \ diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 05f62995a..627899cd5 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -34,7 +34,7 @@ #include "ttpost.h" #endif -#include "ttcmap0.h" +#include "ttcmap.h" #include FT_SERVICE_GLYPH_DICT_H #include FT_SERVICE_POSTSCRIPT_NAME_H diff --git a/src/sfnt/sfnt.c b/src/sfnt/sfnt.c index 90c1bee91..ec6dc466e 100644 --- a/src/sfnt/sfnt.c +++ b/src/sfnt/sfnt.c @@ -4,7 +4,7 @@ /* */ /* Single object library component. */ /* */ -/* Copyright 1996-2001, 2002, 2003 by */ +/* Copyright 1996-2001, 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -20,7 +20,7 @@ #include #include "ttload.c" -#include "ttcmap0.c" +#include "ttcmap.c" #include "sfobjs.c" #include "sfdriver.c" diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 641c83f1e..98bc67785 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -19,7 +19,7 @@ #include #include "sfobjs.h" #include "ttload.h" -#include "ttcmap0.h" +#include "ttcmap.h" #include FT_INTERNAL_SFNT_H #include FT_TRUETYPE_IDS_H #include FT_TRUETYPE_TAGS_H diff --git a/src/sfnt/ttcmap0.c b/src/sfnt/ttcmap.c similarity index 99% rename from src/sfnt/ttcmap0.c rename to src/sfnt/ttcmap.c index dd1c76aaa..752c8ad8c 100644 --- a/src/sfnt/ttcmap0.c +++ b/src/sfnt/ttcmap.c @@ -1,10 +1,10 @@ /***************************************************************************/ /* */ -/* ttcmap0.c */ +/* ttcmap.c */ /* */ -/* TrueType new character mapping table (cmap) support (body). */ +/* TrueType character mapping table (cmap) support (body). */ /* */ -/* Copyright 2002, 2003 by */ +/* Copyright 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -21,7 +21,7 @@ #include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_STREAM_H #include "ttload.h" -#include "ttcmap0.h" +#include "ttcmap.h" #include "sferrors.h" diff --git a/src/sfnt/ttcmap0.h b/src/sfnt/ttcmap.h similarity index 88% rename from src/sfnt/ttcmap0.h rename to src/sfnt/ttcmap.h index 6ca9ca110..dd27f1e44 100644 --- a/src/sfnt/ttcmap0.h +++ b/src/sfnt/ttcmap.h @@ -1,10 +1,10 @@ /***************************************************************************/ /* */ -/* ttcmap0.h */ +/* ttcmap.h */ /* */ -/* TrueType new character mapping table (cmap) support (specification). */ +/* TrueType character mapping table (cmap) support (specification). */ /* */ -/* Copyright 2002, 2003 by */ +/* Copyright 2002, 2003, 2004 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -16,8 +16,8 @@ /***************************************************************************/ -#ifndef __TTCMAP0_H__ -#define __TTCMAP0_H__ +#ifndef __TTCMAP_H__ +#define __TTCMAP_H__ #include @@ -74,7 +74,7 @@ FT_BEGIN_HEADER FT_END_HEADER -#endif /* __TTCMAP0_H__ */ +#endif /* __TTCMAP_H__ */ /* END */