Commit Graph

115 Commits

Author SHA1 Message Date
Werner Lemberg 0098d5502d Uppercase all hex digits for orthogonality. 2014-12-07 11:03:57 +01:00
Werner Lemberg 9870d6dacf */*: Decorate hex constants with `U' and `L' where appropriate. 2014-12-07 09:40:47 +01:00
Werner Lemberg e8ed2d621e Another round of cppcheck nitpicks.
The call was (from the top-level of the FreeType tree):

  cppcheck --force \
           --enable=all \
           -I /usr/include \
           -I /usr/local/include \
           -I /usr/lib/gcc/i586-suse-linux/4.7/include \
           -I include \
           -I include/freetype \
           -I include/freetype/config \
           -I include/freetype/internal \
           -DFT2_BUILD_LIBRARY \
           . &> cppcheck.log

using cppcheck git commit f7e93f99.

Note that cppcheck still can't handle `#include FOO' (with `FOO' a
macro).

*/* Improve variable scopes.
*/* Remove redundant initializations which get overwritten.

* src/gxvalid/*: Comment out redundant code or guard it with
FT_DEBUG_LEVEL_TRACE.
2013-08-01 12:20:20 +02:00
Werner Lemberg dc624ca4dc Apply fixes for cppcheck nitpicks.
http://cppcheck.sourceforge.net/

Note that the current version heavily chokes on FreeType, delivering
even wrong results.  I will report those issues to the cppcheck team
so that a newer version gives improved results hopefully.

*/* Improve variable scopes.
*/* Remove redundant initializations which get overwritten.

* src/base/ftmac.c ,builds/mac/ftmac.c (count_faces_scalable):
Remove unused variable.

* src/base/ftdbgmem.c (ft_mem_table_destroy): `table' can't be zero.

* src/gxvalid/gxvkern.c (gxv_kern_subtable_fmt1_entry_validate):
Remove functionless code.

* src/tools/ftrandom.c (main): Fix memory leak.
2013-06-04 10:30:48 +02:00
Werner Lemberg 89f5064765 */*: Use FT_ERR_EQ, FT_ERR_NEQ, and FT_ERR where appropriate.
FT_Err_XXX and friends are no longer directly used in the source
code.
2013-03-14 17:50:49 +01:00
Werner Lemberg e3c9301581 */*: Use FT_Err_Ok only.
This is a purely mechanical conversion.
2013-03-14 11:21:17 +01:00
Werner Lemberg 059bc335ce */*: Use `FT_THROW'.
This is essentially a mechanical conversion, adding inclusion of
`FT_INTERNAL_DEBUG_H' where necessary, and providing the macros for
stand-alone compiling modes of the rasterizer modules.

To convert the remaining occurrences of FT_Err_XXX and friends it is
necessary to rewrite the code.  Note, however, that it doesn't harm
if some cases are not handled since FT_THROW is a no-op.
2013-03-14 10:27:35 +01:00
Werner Lemberg dbc6e3f192 Remove `FT_KEEP_ERR_PREFIX'.
The idea is to always have FT_ERR_PREFIX available internally.

* include/freetype/fterrors.h: Use FT2_BUILD_LIBRARY to guard
undefinition of FT_ERR_PREFIX

* src/gxvalid/gxverror.h, src/otvalid/otverror.h,
src/sfnt/sferrors.h: Updated.
2013-03-12 11:42:20 +01:00
Werner Lemberg c879f24562 [gxvalid] Fix module error.
* src/gxvalid/gxverror.h (FT_ERR_BASE): Define as
FT_Mod_Err_GXvalid.
* include/freetype/ftmoderr.h: Add module error for `GXvalid'.
2013-03-11 10:11:57 +01:00
Vinnie Falco 26dfeb6d63 Prepare source code for amalgamation.
* src\autofit\aferrors.h, src\bdf\bdferror.h, src\bzip2\ftbzip2.c,
src\cache\ftcerror.h, src\cff\cfferrs.h, src\cid\ciderrs.h,
src\gxvalid\gxverror.h, src\gzip\ftgzip.c, src\lzw\ftlzw.c,
src\otvalid\otverror.h, src\pcf\pcferror.h, src\pfr\pfrerror.h,
src\psaux\psauxerr.h, src\pshinter\pshnterr.h,
src\psnames\psnamerr.h, src\raster\rasterrs.h, src\sfnt\sferrors.h,
src\smooth\ftsmerrs.h, src\truetype\tterrors.h,
src\type1\t1errors.h, src\type42\t42error.h, src\winfonts\fnterrs.h:
Add #undef FT_ERR_PREFIX before #define FT_ERR_PREFIX.
2012-03-08 06:04:03 +01:00
Alexei Podtelezhnikov b25265c5e4 Avoid modulo operators against a power-of-two denominator.
* src/afcjk.c (af_hint_normal_stem), src/base/ftoutln.c
(ft_contour_has), src/cff/cffgload.c (cff_decoder_parse_charstrings)
<cff_op_vvcurveto, cff_op_hhcurveto, cff_op_hvcurveto>,
src/gxvalid/gxvcommn.c (GXV_32BIT_ALIGNMENT_VALIDATE),
src/gxvalid/gxvfeat.c (gxv_feat_setting_validate): Replace `%' with
`&' operator.
2012-02-29 13:45:24 +01:00
Werner Lemberg 22fff25385 Whitespace. 2012-02-26 08:47:20 +01:00
suzuki toshiya 7b02b70443 [gxvalid] Fix Savannah bug #35286.
Patch submitted by anonymous reporter.

* src/gxvalid/gxvcommn.c (gxv_XStateTable_subtable_setup):
gxv_set_length_by_ulong_offset() must be called with 3, not 4,
the number of the subtables in the state tables; classTable,
stateArray, entryTable.
2012-01-17 16:20:02 +09:00
suzuki toshiya 1749d8bc6a Remove trailing spaces. 2012-01-17 02:00:24 +09:00
Werner Lemberg c52f44d4fd Whitespace. 2011-11-30 10:46:53 +01:00
suzuki toshiya faddba4474 [gxvalid] Fix a bug to detect too large offset in morx table.
* src/gxvalid/gxvmorx2.c
(gxv_morx_subtable_type2_ligActionIndex_validate): Fix a bug
that too large positive offset cannot be detected.
2011-10-08 01:30:49 +09:00
suzuki toshiya c7e8028f3f [gxvalid] make the `prop' validation tracing verbose.
* src/gxvalid/gxvprop.c: Add tracing messages for errors.
2011-06-19 23:00:11 +09:00
suzuki toshiya 75b91a49aa [gxvalid] Cleanup.
Some invalid, overrunning, unrecommended non-zero values
are cared in paranoid validation mode only.  There are
many lines looking like:

  if ( valid->root->level >= FT_VALIDATE_PARANOID )
    FT_INVALID_xxx;

To simplify them, GXV_SET_ERR_IF_PARANOID( err ) is
introduced for more paranoid validation in future.

* src/gxvalid/gxvcommn.h (IS_PARANOID_VALIDATION):
New macro to assure valid->root->level is more or
equal to FT_VALIDATE_PARANOID.  (GXV_SET_ERR_IF_PARANOID):
New macro to raise an error if in paranoid validation.
* src/gxvalid/gxvcommn.c: Use GXV_SET_ERR_IF_PARANOID().
* src/gxvalid/gxvfeat.c: Ditto.
* src/gxvalid/gxvjust.c: Ditto.
* src/gxvalid/gxvkern.c: Ditto.
* src/gxvalid/gxvmort.c: Ditto.
* src/gxvalid/gxvmort0.c: Ditto.
* src/gxvalid/gxvmort1.c: Ditto.
* src/gxvalid/gxvmort2.c: Ditto.
* src/gxvalid/gxvmorx1.c: Ditto.
* src/gxvalid/gxvmorx2.c: Ditto.
2011-06-15 01:12:04 +09:00
suzuki toshiya f6f9b66781 [gxvalid] Fix gcc4.6 compiler warnings in gxvtrak.c.
* src/gxvalid/gxvtrak.c (gxv_trak_trackTable_validate):
Check different entries pointing same traking value.
(gxv_trak_validate): Remove unused variable `table_size'.
2011-06-14 23:55:57 +09:00
suzuki toshiya 05fc72c5c7 [gxvalid] Fix gcc4.6 compiler warnings in gxvmorx*.c.
* src/gxvalid/gxvmorx.c (gxv_morx_subtables_validate):
Conditionalize unvalidated variable `subFeatureFlags'.
(gxv_morx_chain_validate): Conditionalize unvalidated
variable `defaultFlags'.

* src/gxvalid/gxmorx0.c
(gxv_morx_subtable_type0_entry_validate):
Conditionalize unvalidated variables; `markFirst',
`dontAdvance', `markLast', `verb'.

* src/gxvalid/gxmorx1.c
(gxv_morx_subtable_type1_entry_validate): Conditionalize
unvalidated variables; `setMark', `dontAdvance'.

* src/gxvalid/gxvmorx2.c
(gxv_morx_subtable_type2_ligActionOffset_validate):
Conditionalize unvalidated variables; `last', `store'.
Checking for overrunning offset is added.
(gxv_morx_subtable_type2_entry_validate):
Conditionalize unvalidated variables; `setComponent',
`dontAdvance', `performAction'.
(gxv_morx_subtable_type2_ligatureTable_validate):
Check if the GID for ligature does not exceed the
max GID in `maxp' table.

* src/gxvalid/gxvmort5.c
(gxv_morx_subtable_type5_InsertList_validate):
Conditionalize unvalidated loading of `insert_glyphID'
array.  (gxv_morx_subtable_type5_entry_validate):
Conditionalize unvalidated variables; `setMark',
`dontAdvance', `currentIsKashidaLike',
`markedIsKashidaLike', `currentInsertBefore',
`markedInsertBefore'.
2011-06-14 23:54:10 +09:00
suzuki toshiya 56be3ac9b1 [gxvalid] Fix gcc4.6 compiler warnings in gxvmort*.c.
* src/gxvalid/gxvmort.c (gxv_mort_subtables_validate):
Conditionalize unvalidated variable `subFeatureFlags'.
(gxv_mort_chain_validate): Conditionalize unvalidated
variable `defaultFlags'.

* src/gxvalid/gxmort0.c
(gxv_mort_subtable_type0_entry_validate): Check the
conflict of the marks for the glyphs.

* src/gxvalid/gxmort1.c
(gxv_mort_subtable_type1_offset_to_subst_validate):
Local variables `min_gid', `max_gid' are replaced by
variables in the validator.
(gxv_mort_subtable_type1_entry_validate): Conditionalize
unvalidated variables; `setMark', `dontAdvance'.
(gxv_mort_subtable_type1_substTable_validate):
Validate the GID by the min/max GIDs in the validator.

* src/gxvalid/gxvmort2.c
(gxv_mort_subtable_type2_ligActionOffset_validate):
Conditionalize unvalidated variables; `last', `store'.
Checking for overrunning offset is added.
(gxv_mort_subtable_type2_entry_validate):
Conditionalize unvalidated variables; `setComponent',
`dontAdvance'.
(gxv_mort_subtable_type2_ligatureTable_validate):
Check if the GID for ligature does not exceed the
max GID in `maxp' table.

* src/gxvalid/gxvmort5.c
(gxv_mort_subtable_type5_InsertList_validate):
Conditionalize unvalidated loading of `insert_glyphID'
array.  (gxv_mort_subtable_type5_entry_validate):
Conditionalize unvalidated variables; `setMark',
`dontAdvance', `currentIsKashidaLike',
`markedIsKashidaLike', `currentInsertBefore',
`markedInsertBefore'.
2011-06-14 23:53:12 +09:00
suzuki toshiya 20c126c1ac [gxvalid] Fix gcc4.6 compiler warnings in gxvkern.c.
* src/gxvalid/gxvkern.c
(gxv_kern_subtable_fmt0_pairs_validate): Conditionalize
unvalidated variable `kernValue'.
(gxv_kern_subtable_fmt1_entry_validate): Conditionalize
unvalidated variables; `push', `dontAdvance', `kernAction',
`kernValue'.
(gxv_kern_coverage_new_apple_validate): Conditionalize
trace-only variables; `kernVertical', `kernCrossStream',
`kernVariation'.
(gxv_kern_coverage_classic_apple_validate): Conditionalize
trace-only variables; `horizontal', `cross_stream'.
(gxv_kern_coverage_classic_microsoft_validate):
Conditionalize trace-only variables; `horizontal',
`minimum', `cross_stream', `override'.
(gxv_kern_subtable_validate): Conditionalize trace-only
variables; `version', `tupleIndex'.
2011-06-14 23:50:39 +09:00
suzuki toshiya ce015ec8da [gxvalid] Fix gcc4.6 compiler warnings in gxvjust.c.
* src/gxvalid/gxvjust.c (gxv_just_check_max_gid):
New function to unify the checks of too large GID.
(gxv_just_wdp_entry_validate): Conditionalize unvalidated
variables; `beforeGrowLimit', `beforeShrinkGrowLimit',
`afterGrowLimit', `afterShrinkGrowLimit', `growFlags',
`shrinkFlags'.  Additional check for non-zero values in
unused storage `justClass' is added.
(gxv_just_actSubrecord_type0_validate): Conditionalize
unvalidated variable `order'.  GID is checked by
gxv_just_check_max_gid().  Additional check for upside-down
relationship between `lowerLimit' and `upperLimit' is added.
(gxv_just_actSubrecord_type1_validate): GID is checked by
gxv_just_check_max_gid().
(gxv_just_actSubrecord_type2_validate): Conditionalize
unvalidated variable `substThreshhold'.  GID is checked by
gxv_just_check_max_gid().
(gxv_just_actSubrecord_type5_validate): GID is checked by
gxv_just_check_max_gid().
(gxv_just_classTable_entry_validate): Conditionalize
unvalidated variables; `setMark', `dontAdvance',
`markClass', `currentClass'.
2011-06-14 23:49:34 +09:00
suzuki toshiya 248aa63973 [gxvalid] Preparation to fix gcc4.6 compiler warnings.
* src/gxvalid/gxvcommn.h (GXV_LOAD_TRACE_VARS): New macro to
conditionalize the variable which is only used for trace messages.
Automatically set by FT_DEBUG_LEVEL_TRACE.
(GXV_LOAD_UNUSED_VARS): New macro to conditionalize the loading of
unvalidated variables.  Undefined by default to calm gcc4.6 warning.
(GXV_ValidatorRec.{min_gid,max_gid}): New variables to hold defined
GID ranges, for the comparison of GID ranges in different subtables.
2011-06-14 23:47:21 +09:00
Werner Lemberg f765e4403c */*: Use module specific error names where appropriate. 2010-06-24 10:34:29 +02:00
suzuki toshiya 8eb551f1b3 gxvalid: Extend a few local variables to reduce the casts. 2009-08-01 00:37:55 +09:00
suzuki toshiya d365997759 gxvalid: Extend `settingTable' to take 32-bit offset. 2009-08-01 00:37:55 +09:00
suzuki toshiya eceaffef3e gxvalid: Guarantee `nFeatureFlags' size up to 32-bit. 2009-08-01 00:32:23 +09:00
suzuki toshiya 2f07c57f5a gxvalid: Guarantee `just' table size upto 32-bit. 2009-08-01 00:32:22 +09:00
suzuki toshiya 205a2a0cce gxvalid: Guarantee `trak' table size upto 32-bit. 2009-08-01 00:32:22 +09:00
suzuki toshiya 62aa9ec647 gxvalid: Pass the union by the pointer instead of the value. 2009-08-01 00:29:29 +09:00
Werner Lemberg 858abbedc0 For warning messages, replace FT_ERROR with FT_TRACE0.
FT_ERROR is now used only if a function produces a non-zero `error'
value.

Formatting, improving and harmonizing debug strings.
2009-06-26 06:15:41 +02:00
Oran Agra 1dcd0f2399 Add #error to modules and files that do not support PIC yet.
When FT_CONFIG_OPTION_PIC is defined the following files will
create #error:
* src/bdf/bdfdrivr.h
* src/cache/ftcmanag.c
* src/cid/cidriver.h
* src/gxvalid/gxvmod.h
* src/gzip/ftgzip.c
* src/lzw/ftlzw.c
* src/otvalid/otvmod.h
* src/pcf/pcfdrivr.h
* src/pfr/pfrdrivr.h
* src/psaux/psauxmod.h
* src/type1/t1driver.h
* src/type42/t42drivr.h
* src/winfonts/winfnt.h
2009-04-05 18:25:14 +03:00
Werner Lemberg f47acf2b5f Avoid compiler warnings.
* */*: s/do ; while ( 0 )/do { } while ( 0 )/.
Reported by Sean McBride <sean@rogue-research.com>.
2009-01-12 20:11:14 +00:00
Suzuki, Toshiya (鈴木俊哉) 68e16e0105 * src/gxvalid/gxvmort.c (gxv_mort_feature_validate): Fix wrong length check, Savannah patch #6682. 2009-01-09 08:01:15 +00:00
Werner Lemberg ce33a312da FT_USE_MODULE declares things as:
extern const FT_Module_Class

(or similar for C++).  However, the actual types of the variables
being declared are often different, e.g., FT_Driver_ClassRec or
FT_Renderer_Class.  (Some are, indeed, FT_Module_Class.)

This works with most C compilers (since those structs begin with an
FT_Module_Class struct), but technically it's undefined behavior.

To quote the ISO/IEC 9899:TC2 final committee draft, section 6.2.7
paragraph 2:

  All declarations that refer to the same object or function shall
  have compatible type; otherwise, the behavior is undefined.

(And they are not compatible types.)

Most C compilers don't reject (or even detect!) code which has this
issue, but the GCC LTO development branch compiler does.  (It
outputs the types of the objects while generating .o files, along
with a bunch of other information, then compares them when doing the
final link-time code generation pass.)

Patch from Savannah bug #25133.

* src/base/ftinit.c (FT_USE_MODULE): Include variable type.

* builds/amiga/include/freetype/config/ftmodule.h,
include/freetype/config/ftmodule.h, */module.mk: Updated to declare
pass correct types to FT_USE_MODULE.
2008-12-21 10:29:30 +00:00
Werner Lemberg 1a5d561dce * src/autofit/afcjk.c, src/base/ftoutln.c, src/base/ftrfork.c,
src/bdf/bdfdrivr.c, src/gxvalid/gxvmorx.c, src/otvalid/otvmath.c,
src/pcf/pcfdrivr.c, src/psnames/pstables.h, src/smooth/ftgrays.c,
src/tools/glnames.py, src/truetype/ttinterp.c, src/type1/t1load.c,
src/type42/t42objs.c, src/winfonts/winfnt.c: Fix compiler warnings
(Atari PureC).
2008-11-29 22:50:24 +00:00
Werner Lemberg a4cb0d95d9 * src/type/t1afm.c (compare_kern_pairs), src/pxaux/afmparse.c
(afm_compare_kern_pairs): Fix comparison.  This fixes Savannah bug
#24119.
2008-08-23 19:54:06 +00:00
Werner Lemberg 2b0b4221ab Cosmetic code changes. 2008-05-28 22:17:28 +00:00
Werner Lemberg 3033f4366b * src/truetype/ttgload.c (load_truetype_glyph): Always allow a
recursion depth of 1.  This was the maximum value in TrueType 1.0,
and some older fonts don't set this field correctly.

* src/gxvalid/gxvmort1.c
(gxv_mort_subtable_type1_substTable_validate): Fix tracing message.
2007-07-04 14:12:19 +00:00
Werner Lemberg 936346413f Remove tabs from source files. 2007-06-01 06:56:17 +00:00
Werner Lemberg 4b2e83d5b5 A new set of spelling fixes from Alexei.
Add some copyright messages.
2007-02-01 07:58:02 +00:00
Werner Lemberg 9b774e2822 Remove trailing whitespace. From Alexei. 2007-01-16 06:11:27 +00:00
Werner Lemberg 8c4120d0a3 Fix various compiler warnings.
* src/truetype/ttdriver.c (tt_size_select), src/cff/cffobjs.h,
src/cff/cffobjs.c (cff_size_request), src/type42/t42objs.h:
s/index/strike_index/.
* src/base/ftobjs.c (FT_Match_Size): s/index/size_index/.

* src/gxvalid/gxvmorx5.c
(gxv_morx_subtable_type5_InsertList_validate): s/index/table_index/.

* src/truetype/ttinterp.c (Compute_Point_Displacement),
src/pcf/pcfread.c (pcf_seek_to_table_type): Avoid possibly
uninitialized variables.
2007-01-15 06:42:40 +00:00
Werner Lemberg 6b87e6f0ff * src/gxvalid/gxvkern.c (gxv_kern_subtable_fmt0_pairs_validate):
Remove compiler warning.

Formatting.
2007-01-02 19:20:08 +00:00
Yamato, Masatake (大和正武) 55d5a1cbe9 (gxv_kern_subtable_fmt0_pairs_validate): Show the trace message after validating gids. 2006-12-30 20:24:30 +00:00
Yamato, Masatake (大和正武) d5d3e41dac (gxv_kern_subtable_fmt0_pairs_validate): New function. Checks uniqueness of the gid pairs.
(gxv_kern_subtable_fmt0_validate): Move some code to `gxv_kern_subtable_fmt0_pairs_validate'.
2006-12-30 20:17:30 +00:00
Jens Claudius a787f45580 2006-08-27 Jens Claudius <jens.claudius@yahoo.com>
Fix miscellaneous compiler warnings.

	* freetype2/include/freetype/internal/ftobjs.h: close
	comment with `*/' to avoid `/* in comment' compiler warning.

	* freetype2/src/base/ftdbgmem.c (ft_mem_table_get_source): Turn
	cast `(FT_UInt32)(void*)' into `(FT_UInt32)(FT_PtrDist)(void*)'
	since on 64-bit platforms void* is larger than FT_UInt32.

	* freetype2/src/base/ftobjs.c (t_validator_error): cast
	away volatileness of argument to ft_longjmp. Spotted by
	Werner `Putzfrau' Lemberg.

	* freetype2/src/bdf/bdflib.c (bdf_load_font): initialize
	local variable `lineno'.

	* freetype2/src/gxvalid/gxvmod.c (classic_kern_validate):
	mark local variable `error' volatile.
2006-08-27 11:26:18 +00:00
Jens Claudius 088e44e877 2006-08-22 Jens Claudius <jens.claudius@yahoo.com>
Fix for previous commit, which caused many compiler warnings/errors
	about addresses of volatile objects passed as function arguments
	as non-volatile pointers.


	* freetype2/include/freetype/internal/ftvalid.h: Make
	FT_Validator typedef a pointer to a volatile object.

	* freetype2/src/gxvalid/gxvmod.c (gxv_load_table): Make function
	argument `table' a pointer to a volatile object.

	* freetype2/src/otvalid/otvmod.c (otv_load_table): Make function
	argument `table' a pointer to a volatile object.
2006-08-22 14:24:30 +00:00
Werner Lemberg 1234299620 formatting 2006-08-19 11:18:09 +00:00
Jens Claudius 2652bd5412 2006-08-18 Jens Claudius <jens.claudius@yahoo.com>
* freetype2/src/gxvalid/gxvmod.c (GXV_TABLE_DECL): Mark local
	variable `_sfnt' as volatile since it must keep its value across
	a call to ft_setjmp.
	(gxv_validate): Same for local variables `memory' and `valid'.
	(classic_kern_validate): Same for local variables `memory',
	`ckern', and `valid'.

	* freetype2/src/otvalid/otvmod.c (otv_validate): Same for function
	parameter `face' and local variables `base', `gdef', `gpos', `gsub',
	`jstf', and 'valid'.

	* freetype2/src/sfnt/ttcmap.c (tt_face_build_cmaps): Same for
	local variable `cmap'.
2006-08-18 17:20:37 +00:00
Suzuki, Toshiya (鈴木俊哉) e261f426d6 * src/otvalid/otvmod.c, src/gxvalid/gxvmod.c: replace ft_validator_run by ft_setjmp 2006-08-15 17:00:43 +00:00
Werner Lemberg 8fe6539026 Further C library abstraction. Based on a patch from
msn2@bidyut.com.

* include/freetype/config/ftstdlib.h (FT_CHAR_BIT, FT_FILE,
ft_fopen, ft_fclose, ft_fseek, ft_ftell, ft_fread, ft_smalloc,
ft_scalloc, ft_srealloc, ft_sfree, ft_labs): New wrapper macros for
C library functions.  Update all users accordingly (and catch some
other places where the C library function was used instead of the
wrapper functions).

* src/base/ftsystem.c: Don't include stdio.h and stdlib.h.
* src/gzip/zutil.h [MSDOS && !(__TURBOC__ || __BORLANDC__)]: Don't
include malloc.h.
2006-04-29 07:31:16 +00:00
Werner Lemberg 38beff0083 * src/otvalid/module.mk: s/otvalid_module_class/otv_module_class/.
* src/gxvalid/module.mk: s/gxvalid_module_class/gxv_module_class/.
2006-02-01 05:14:25 +00:00
Werner Lemberg 59939244ad Implement new, simplified module selection. With GNU make it is now
sufficient to modify a single file, `modules.cfg', to control the
inclusion of modules and base extension files.

This change also fixes the creation of ftmodule.h; it now depends on
`modules.cfg' and thus is rebuilt only if necessary.

Finally, a version of `ftoption.h' in OBJ_DIR is preferred over the
default location.

* modules.cfg: New file.

* builds/freetype.mk: Don't include `modules.mk'.
Include all `rules.mk' files as specified in `modules.cfg'.
(FTOPTION_FLAG, FTOPTION_H): New variables.
(FT_CFLAGS): Add macro definition for FT_CONFIG_MODULES_H.
Add FTOPTION_FLAG.
($(FT_INIT_OBJ)): Don't use FT_MODULE_LIST.
(CONFIG_H): Add FTMODULE_H and FTOPTION_H.
(INCLUDES): Add DEVEL_DIR.
(INCLUDE_FLAGS, FTSYS_SRC, FTSYS_OBJ, FTDEBUG_SRC, FTDEBUG_OBJ,
OBJ_M, OBJ_S): Use `:=', not `='.
(remove_ftmodule_h): New phony target to delete `ftmodule.h'.
(distclean): Add remove_ftmodule_h.

* builds/modules.mk: (MODULE_LIST): Removed.
(make_module_list, clean_module_list): Replace targets
with...
(FTMODULE_H_INIT, FTMODULE_H_CREATE, FTMODULE_H_DONE): New
variables.  Reason for the change is that it is not possible to have
a phony prerequisite which is run only if the target file must be
rebuilt (phony prerequisites act like subroutines and are *always*
executed).  We only want to rebuild `ftmodule.h' if `module.cfg' is
changed.
Update all callers.
($FTMODULE_H)): Rule to create `ftmodule.h', depending on
`modules.cfg'.

* builds/toplevel.mk: Rewrite and simplify module handling.
(MODULES_CFG, FTMODULE_H): New variables.
Include MODULES_CFG.
(MODULES): New variable to include all `module.mk' and `rules.mk'
files.  We no longer use make's `wildcard' function for this.

* Makefile (USE_MODULES): Remove.  Update all users.
(OBJ_DIR): Define it here.

* src/*/module.mk: Change

    make_module_list: foo
    foo: ...

to

    FTMODULE_H_COMMANDS += FOO
    define FOO
    ...
    endef

in all files.  `FTMODULE_H_COMMANDS' is used in `FTMODULE_H_CREATE'.

* src/base/rules.mk (BASE_EXT_SRC): Use BASE_EXTENSIONS.

* builds/unix/detect.mk (setup): Always execute `configure' script.
(have_mk): Rename to...
(have_Makefile): This.
Don't use `strip' function.

* builds/unix/unix.mk: Include `install.mk' only if BUILD_PROJECT is
defined.
(have_mk): Don't use `strip' function.
Test for unix-def.mk in OBJ_DIR, not BUILD_DIR (and invert the test
accordingly).

* builds/unix/install.mk (install, uninstall): Handle `ftmodule.h'.

* builds/os2/os2-dev.mk, builds/unix/unix-dev.mk,
builds/win32/w32-bccd.mk, builds/win32/w32-dev.mk: Don't define
BUILD_DIR but DEVEL_DIR for development header files.

* builds/ansi/ansi-def.mk (TOP_DIR, OBJ_DIR),
builds/beos/beos-def.mk (TOP_DIR, OBJ_DIR), builds/unix/unix-def.in
(TOP_DIR, OBJ_DIR): Removed.  Defined elsewhere.

* builds/dos/dos-def.mk (OBJ_DIR), builds/os2/os2-def.mk (OBJ_DIR),
builds/win32/win32-def.mk (OBJ_DIR): Removed.  Defined elsewhere.

* builds/unix/unixddef.mk: Don't define BUILD_DIR but DEVEL_DIR for
development header files.
Don't define PLATFORM.

* configure: Copy `modules.cfg' to builddir if builddir != srcdir.
Update snippet taken from autoconf's m4sh.m4 to current CVS version.
Be more verbose.

* include/freetype/config/ftmodule.h: Add comments -- this file is
no longer used if FreeType is built with GNU make.

* docs/CHANGES, docs/CUSTOMIZE, docs/INSTALL, docs/INSTALL.ANY,
docs/INSTALL.GNU, docs/INSTALL.UNX: Document new build mechanism.
Other minor updates.

* modules.txt: Removed.  Contents included in `modules.cfg'.


* include/freetype/internal/ftmemory.h (FT_QAlloc_Debug,
FT_Free_Debug) [FT_STRICT_ALIASING]: Fix typos.

* src/base/ftdbgmem.c (FT_Alloc_Debug, FT_Realloc_Debug,
FT_QAlloc_Debug, FT_QRealloc_Debug, FT_Free_Debug)
[FT_STRICT_ALIASING]: Implement.
2006-01-31 20:17:42 +00:00
Werner Lemberg 7596fd3a46 * src/*/module.mk (.PHONY): Add. 2006-01-28 16:29:29 +00:00
David Turner 92f30c812c * src/base/ftobjs.c (FT_Open_Face): don't call FT_New_GlyphSlot and
FT_New_Size if we're opening a face with face_index < 0 (which is only
  used for testing the format).

  * src/gxvalid/gxvmort0.c: removed compiler warning
2005-10-17 21:17:20 +00:00
Werner Lemberg 7c25946f08 Formatting. 2005-09-28 07:34:45 +00:00
David Turner 18e44430ae * src/base/Jamfile: adding src/base/ftgxval.c
* src/gxvalid/gxvbsln.c, src/gxvalid/gxvcommn.c, src/gxvalid/gxvfeat.c,
        src/gxvalid/gxvjust.c, src/gxvalid/gxvkern.c, src/gxvalid/gxvlcar.c,
        src/gxvalid/gxvmort.c, src/gxvalid/gxvmort0.c, src/gxvalid/gxvmort1.c,
        src/gxvalid/gxvmort2.c, src/gxvalid/gxvmort4.c, src/gxvalid/gxvmort5.c,
        src/gxvalid/gxvmorx.c, src/gxvalid/gxvmorx0.c, src/gxvalid/gxvmorx1.c,
        src/gxvalid/gxvmorx2.c, src/gxvalid/gxvmorx5.c, src/gxvalid/gxvopbd.c,
        src/gxvalid/gxvprop.c, src/sfnt/sfdriver.c, src/truetype/ttgload.c:
          removing _many_ compiler warnings when compiling with Visual C++
          at maximum level (/W4)
2005-09-23 13:22:10 +00:00
Werner Lemberg 99aa14c226 Fixes for `make multi' and using C++ compiler.
* gxvalid/gxvcommn.c (gxv_set_length_by_ushort_offset,
gxv_set_length_by_ulong_offset, gxv_array_getlimits_byte,
gxv_array_getlimits_ushort): Declare with FT_LOCAL_DEF.
(gxv_compare_ranges): Make it static.
(gxv_LookupTable_fmt0_validate, gxv_LookupTable_fmt2_validate,
gxv_LookupTable_fmt4_validate, gxv_LookupTable_fmt6_validate,
gxv_LookupTable_fmt8_validate, gxv_LookupTable_validate): Improve
trace messages.
(gxv_StateArray_validate, gxv_XStateArray_validate): s/class/clazz/.
(GXV_STATETABLE_HEADER_SIZE, GXV_STATEHEADER_SIZE,
GXV_XSTATETABLE_HEADER_SIZE, GXV_XSTATEHEADER_SIZE): Move to
gxvcommn.h.

* gxvalid/gxvcommn.h: Add prototypes for
gxv_StateTable_subtable_setup, gxv_XStateTable_subtable_setup,
gxv_XStateTable_validate, gxv_array_getlimits_byte,
gxv_array_getlimits_ushort, gxv_set_length_by_ushort_offset,
gxv_set_length_by_ulong_offset, gxv_odtect_add_range,
gxv_odtect_validate.
(GXV_STATETABLE_HEADER_SIZE, GXV_STATEHEADER_SIZE,
GXV_XSTATETABLE_HEADER_SIZE, GXV_XSTATEHEADER_SIZE): Moved from
gxvcommn.c.

* src/gxvalid/gxvbsln.c (gxv_bsln_LookupValue_validate,
gxv_bsln_parts_fmt1_validate): Improve trace messages.

* gxvalid/gxvfeat.c: Split off predefined registry stuff to...
* gxvalid/gxvfeat.h: New file.

* gxvalid/gxvjust.c (gxv_just_wdc_entry_validate): Improve trace
message.

* gxvalid/gxvkern.c (GXV_kern_Dialect): Add KERN_DIALECT_UNKNOWN.
(gxv_kern_subtable_fmt1_valueTable_load,
gxv_kern_subtable_fmt1_subtable_setup,
gxv_kern_subtable_fmt1_entry_validate): Fix C++ compiler errors.
(gxv_kern_coverage_validate): Use KERN_DIALECT_UNKWOWN.
Improve trace message.
(gxv_kern_validate_generic): Fix C++ compiler error.
Improve trace message.
(gxv_kern_validate_classic): Fix C++ compiler error.

* gxvalid/gxvmort0.c (gxv_mort_subtable_type0_validate): Declare
with FT_LOCAL_DEF.

* gxvalid/gxvmort1.c
(gxv_mort_subtable_type1_substitutionTable_load,
gxv_mort_subtable_type1_subtable_setup): Fix C++ compiler errors.
(gxv_mort_subtable_type1_substTable_validate): Improve trace
message.
(gxv_mort_subtable_type1_validate): Declare with FT_LOCAL_DEF.

* gxvalid/gxvmort2.c (gxv_mort_subtable_type2_opttable_load,
gxv_mort_subtable_type2_subtable_setup,
gxv_mort_subtable_type2_ligActionOffset_validate,
gxv_mort_subtable_type2_ligatureTable_validate): Fix C++ compiler
errors.
(gxv_mort_subtable_type2_validate): Declare with FT_LOCAL_DEF.

* gxvalid/gxvmort4.c (gxv_mort_subtable_type4_validate): Declare
with FT_LOCAL_DEF.

* gxvalid/gxvmort5.c (gxv_mort_subtable_type5_subtable_setup,
gxv_mort_subtable_type5_InsertList_validate): Fix C++ compiler
errors.
(gxv_mort_subtable_type5_validate): Declare with FT_LOCAL_DEF.

* gxvalid/gxvmort.c: Include gxvfeat.h.
(gxv_mort_featurearray_validate, gxv_mort_coverage_validate):
Declare with FT_LOCAL_DEF.
(gxv_mort_subtables_validate, gxv_mort_validate): Improve trace
messages.

* gxvalid/gxvmort.h (gxv_mort_feature_validate): Remove.

* gxvalid/gxvmorx0.c (gxv_morx_subtable_type0_validate): Declare
with FT_LOCAL_DEF.

* gxvalid/gxvmorx1.c
(gxv_morx_subtable_type1_substitutionTable_load,
gxv_morx_subtable_type1_subtable_setup,
gxv_morx_subtable_type1_entry_validate,
gxv_morx_subtable_type1_substitutionTable_validate): Fix C++
compiler errors.
(gxv_morx_subtable_type1_validate): Declare with FT_LOCAL_DEF.

* gxvalid/gxvmorx2.c (gxv_morx_subtable_type2_opttable_load,
gxv_morx_subtable_type2_subtable_setup,
gxv_morx_subtable_type2_ligActionIndex_validate,
gxv_morx_subtable_type2_ligatureTable_validate): Fix C++ compiler
errors.
(gxv_morx_subtable_type2_validate): Declare with FT_LOCAL_DEF.
Fix typo.

* gxvalid/gxvmorx4.c (gxv_morx_subtable_type4_validate): Declare
with FT_LOCAL_DEF.

* gxvalid/gxvmorx5.c (gxv_morx_subtable_type5_insertionGlyph_load,
gxv_morx_subtable_type5_subtable_setup): Fix C++ compiler error.
(gxv_morx_subtable_type5_validate): Declare with FT_LOCAL_DEF.

* gxvalid/gxvmorx.c (gxv_morx_subtables_validate,
gxv_morx_validate): Improve trace message.

* gxvalid/gxvopbd.c (gxv_opbd_LookupFmt4_transit): Fix compiler
warnings.
(gxv_opbd_validate): Improve trace message.

* gxvalid/gxvprop.c: Decorate constants with `U' and `L' where
appropriate.
(gxv_prop_zero_advance_validate, gxv_prop_validate): Improve trace
message.

* gxvalid/gxvtrak.c (gxv_trak_trackTable_validate): Remove unused
parameter.  Update all callers.
(gxv_trak_validate): Improve trace message.

* rules.mk (GXV_DRV_H): Add gxvfeat.h.
2005-09-05 19:31:27 +00:00
Werner Lemberg 4a7f0b1c7a * src/gxvalid/gxvbsln.c (GXV_BSLN_VALUE_EMPTY): Add `U'.
* src/gxvalid/gxmort1.c (GXV_MORT_SUBTABLE_TYPE1_HEADER_SIZE),
src/gxvalid/gxmort2.c (GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE): Fix
typo.

* src/gxvalid/gxvmorx0.c, src/gxvalid/gxvmorx1.c,
src/gxvalid/gxvmorx2.c, src/gxvalid/gxvmorx4.c,
src/gxvalid/gxvmorx5.c, src/gxvalid/gxvmort.c: Improve tracing
messages.
Decorate constants with `U' and `L' where appropriate.
Fix compiler warnings.

Formatting.
2005-09-01 07:33:03 +00:00
Werner Lemberg a4aa1c5bee * src/gxvalid/gxvbsln.c (gxv_bsln_validate): Fix tracing message.
* src/gxvalid/gxvcommn.c (gxv_odtect_add_range): Use `const'.

* src/gxvalid/gxvfeat.c, src/gxvalid/gxvjust.c,
src/gxvalid/gxvkern.c, src/gxvalid/gxvlcar.c, src/gxvalid/gxvmod.c,
src/gxvalid/gxvmort0.c, src/gxvalid/gxvmort1.c,
src/gxvalid/gxvmort2.c, src/gxvalid/gxvmort4.c,
src/gxvalid/gxvmort5.c, src/gxvalid/gxvmort.c: Improve tracing
messages.
Decorate constants with `U' and `L' where appropriate.
Fix compiler warnings.
2005-08-31 22:39:23 +00:00
Werner Lemberg 9b71edb0de * src/gxvalid/gxvbsln.c: Fix compiler warnings.
* src/gxvalid/gxvcommn.c: Fix compiler warnings.
(gxv_XEntryTable_validate, gxv_compare_ranges): Remove unused
parameter.  Update all callers.
Improve tracing messages.

Some formatting.
2005-08-31 16:29:51 +00:00
Werner Lemberg 4814030bf6 * src/gxvalid/README: Revised. 2005-08-31 07:13:27 +00:00
Suzuki, Toshiya (鈴木俊哉) a438621451 Add gxvalid module to validate TrueType GX/AAT tables.
Modifications on existing files:

	* Jamfile: Register gxvalid module.
	* src/base/Jamfile: Register ftgxval.c.
	* src/base/rule.mk: Register ftgxval.c.
	* docs/INSTALL.ANY: Register gxvalid/gxvalid.c.

	* include/freetype/config/ftheader.h: Add macro to include gxvalid
	header file, FT_GX_VALIDATE_H.
	* include/freetype/config/ftmodule.h: Register gxv_module_class.

	* include/freetype/ftchapters.h: Add comment about gx_validation.
	* include/freetype/ftotval.h: Change keyword FT_VALIDATE_XXX
	to FT_VALIDATE_OTXXX to co-exist gxvalid.
	* include/freetype/tttags.h: Add tag for TrueType GX/AAT tables.

	* include/freetype/internal/ftserv.h: Add macro to use gxvalid
	service, FT_SERVICE_GX_VALIDATE_H
	* include/freetype/internal/fttrace.h: Add trace facilities
	for gxvalid.

	New files on existing directories:

	* include/freetype/internal/services/svgxval.h: Registration of
	validation service for TrueType GX/AAT and classic kern table.
	* include/freetype/ftgxval.h: Public API definition to use gxvalid.
	* src/base/ftgxval.c: Public API of gxvalid.

	New files under src/gxvalid/:

	* src/gxvalid/Jamfile src/gxvalid/README src/gxvalid/module.mk
	src/gxvalid/rules.mk src/gxvalid/gxvalid.c src/gxvalid/gxvalid.h
	src/gxvalid/gxvbsln.c src/gxvalid/gxvcommn.c src/gxvalid/gxvcommn.h
	src/gxvalid/gxverror.h src/gxvalid/gxvfeat.c src/gxvalid/gxvfgen.c
	src/gxvalid/gxvjust.c src/gxvalid/gxvkern.c src/gxvalid/gxvlcar.c
	src/gxvalid/gxvmod.c src/gxvalid/gxvmod.h src/gxvalid/gxvmort.c
	src/gxvalid/gxvmort.h src/gxvalid/gxvmort0.c src/gxvalid/gxvmort1.c
	src/gxvalid/gxvmort2.c src/gxvalid/gxvmort4.c src/gxvalid/gxvmort5.c
	src/gxvalid/gxvmorx.c src/gxvalid/gxvmorx.h src/gxvalid/gxvmorx0.c
	src/gxvalid/gxvmorx1.c src/gxvalid/gxvmorx2.c src/gxvalid/gxvmorx4.c
	src/gxvalid/gxvmorx5.c src/gxvalid/gxvopbd.c src/gxvalid/gxvprop.c
	src/gxvalid/gxvtrak.c: New files, gxvalid body.
2005-08-24 04:31:31 +00:00