Werner Lemberg
b24e8ba28a
[Savannah bug #43682 ] Add/remove `void' casts to some functions.
...
We use a cast to indicate that we intentionally ignore a function's
return value. However, this doesn't apply to API functions where
errors can only happen for trivially invalid input.
* src/base/ftstroke.c (FT_Glyph_Stroke, FT_Glyph_StrokeBorder),
src/base/ftsynth.c (FT_GlyphSlot_Embolden), src/cff/cffgload.c
(cff_slot_load), src/pfr/pfrdrivr.c (pfr_get_kerning),
src/type1/t1load.c (parse_encoding), src/type42/t42parse.c
(t42_parse_encoding): Do it.
10 years ago
Jarkko Pöyry
96341dc378
[cff, pfr, psaux, winfonts] Fix Savannah bug #43676 .
...
Don't cast cmap init function pointers to an incompatible type.
Without this patch, the number of parameters between declaration and
the real signature differs. Calling such a function results in
undefined behavior.
ISO/IEC 9899:TC3 (Committee Draft September 7, 2007)
6.5.2.2 Function calls
9 If the function is defined with a type that is not
compatible with the type (of the expression) pointed to by
the expression that denotes the called function, the
behavior is undefined.
On certain platforms (c -> js with emscripten) this causes
termination of execution or invalid calls because in the emscripten
implementation, function pointers of different types are stored in
different pointer arrays. Incorrect pointer type here results in
indexing of an incorrect array.
* src/cff/cffcmap.c (cff_cmap_encoding_init, cff_cmap_unicode_init),
src/pfr/pfrcmap.c (pfr_cmap_init), src/psaux/t1cmap.c
t1_cmap_standard_init, t1_cmap_expert_init, t1_cmap_custom_init,
t1_cmap_unicode_init), src/winfonts/winfnt.c (fnt_cmap_init): Fix
signature.
10 years ago
Werner Lemberg
23c093fc38
Minor.
10 years ago
Werner Lemberg
4e75413334
Fix Savannah bug #42788 .
...
* src/pfr/pfrobjs.c: Include `ftcalc.h'.
11 years ago
Alexei Podtelezhnikov
c0a6f20a4b
Replace `ft_highpow2' function.
...
* src/pfr/pfrobjs.c (pfr_face_get_kerning): Use `FT_MSB' instead of
`ft_highpow2'.
* src/base/ftutil.c, include/internal/ftobjs.h (ft_highpow2): Remove
it.
11 years ago
Sean McBride
87628724a9
Fix clang warnings.
...
* src/autofit/aflatin.c (af_latin_metrics_init_blues): Initialize
some variables.
* src/base/ftcalc.c (FT_MulFix): Only use code if
`FT_MULFIX_INLINED' is not defined.
* src/bdf/bdfdrivr.c (bdf_cmap_class), src/cache/ftcbasic.c
(ftc_basic_image_family_class, ftc_basic_image_cache_class,
ftc_basic_sbit_family_class, ftc_basic_sbit_cache_class),
src/cache/ftccmap.c (ftc_cmap_cache_class), src/cache/ftcmanag.c
(ftc_size_list_class, ftc_face_list_class), src/pcf/pcfdrivr.c
(pcf_cmap_class), src/pfr/pfrdrivr.c (pfr_metrics_service_rec): Make
function static.
* src/type1/t1driver.c (t1_ps_get_font_value): Remove redundant
code.
11 years ago
Sean McBride
7be2a94a50
Fix clang static analyzer and compiler warnings.
...
* src/autofit/afhints.c (af_glyph_hints_align_weak_points),
src/autofit/afloader (af_loader_load_g) <FT_GLYPH_FORMAT_COMPOSITE>,
src/base/ftcalc.c (FT_MSB), src/base/ftoutln.c
(FT_Outline_Decompose), src/bdf/bdfdrivr.c (bdf_interpret_style),
src/cff/cffparse.c (cff_parse_integer), src/cid/cidparse.c
(cid_parser_new), src/pfr/pfrload.c (pfr_phy_font_load),
src/raster/ftraster.c (Decompose_Curve), src/sfnt/sfdriver.c
(sfnt_get_ps_name), src/sfnt/ttcmap.c (tt_cmap12_next,
tt_cmap13_next), src/smooth/ftgrays.c (gray_hline): Remove dead
code.
* src/autofit/afmodule.c (af_property_get_face_globals,
af_property_set, af_property_get), src/base/ftbitmap.c
(ft_gray_for_premultiplied_srgb_bgra): Make functions static.
* src/base/ftobjs.c (ft_remove_renderer): Protect against
library == NULL.
(ft_property_do): Make function static.
* src/base/ftrfork.c: Include `ftbase.h'.
* src/sfnt/ttsbit.c (tt_face_load_sbix_image)
[!FT_CONFIG_OPTION_USE_PNG], src/type1/t1gload.c
(T1_Compute_Max_Advance): Avoid compiler warning.
* src/truetype/ttinterp.c (TT_New_Context): Reduce scope of
variable.
11 years ago
Werner Lemberg
5f577462bd
Fix Savannah bug #40997 .
...
* src/bdf/bdfdrivr.c (BDF_Face_Init): Only use OR operator to
adjust face flags since FT_FACE_FLAG_EXTERNAL_STREAM might already
be set.
* src/cff/cffobjs.c (cff_face_init): Ditto.
* src/cid/cidobjs.c (cid_face_init): Ditto.
* src/pcf/pcfread.c (pcf_load_font): Ditto.
* src/pfr/pfrobjs.c (pfr_face_init): Ditto.
* src/type1/t1objs.c (T1_Face_Init): Ditto.
* src/type42/t42objs.c (T42_Face_Init): Ditto.
* src/winfonts/winfnt.c (FNT_Face_Init): Ditto.
11 years ago
Werner Lemberg
ffee64afb8
Better tracing of loaded glyphs.
...
Previously, the loading of a glyph was traced at level 4, if at all.
With this change, all font loading routines emit a tracing message
at level 1, making it easier to select tracing output (for example
using F2_DEBUG="any:1 afhints:7 aflatin:7").
* src/bdf/bdfdrivr.c (BDF_Glyph_Load): Add tracing message.
* src/cff/cffdrivr.c (cff_glyph_load): Ditto.
* src/cff/cffgload.c (cff_decoder_prepare): Improve tracing
messages.
* src/cid/cidgload.c (cid_load_glyph): Use level 1 for tracing
message.
* src/pcf/pcfdrivr.c (PCF_Glyph_Load): Ditto.
* src/pfr/pfrobjs.c (pfr_slot_load): Add tracing message.
* src/truetype/ttgload.c (TT_Load_Glyph): Ditto.
* src/type1/t1gload.c (T1_Load_Glyph): Ditto.
* src/type42/t42objs.c (T42_GlyphSlot_Load): Ditto.
* src/winfonts/winfnt.c (FNT_Load_Glyph): Ditto.
12 years ago
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.
12 years ago
Werner Lemberg
f6aa089f12
*/* [FT_CONFIG_OPTION_OLD_INTERNALS]: Remove macro and guarded code.
12 years ago
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.
12 years ago
Werner Lemberg
e3c9301581
*/*: Use FT_Err_Ok only.
...
This is a purely mechanical conversion.
12 years ago
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.
12 years ago
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.
13 years ago
suzuki toshiya
1749d8bc6a
Remove trailing spaces.
13 years ago
Werner Lemberg
d5260597b2
Cosmetics.
13 years ago
Werner Lemberg
c52f44d4fd
Whitespace.
13 years ago
Werner Lemberg
70cf8c5e6d
Improve tracing.
...
* src/bdf/bdfdrivr.c (BDF_Face_Done), src/pcf/pcfdrivr.c
(PCF_Face_Done): Remove tracing message.
* src/bdf/bdfdrivr.c (BDF_Face_Init), src/cff/cffobjs.c
(cff_face_init), src/cid/cidobjs.c (cid_face_init),
src/pfr/pfrobjs.c (pfr_face_init), src/sfnt/sfobjs.c
(sfnt_init_face), src/truetype/ttobjs.c (tt_face_init),
src/type1/t1objs.c (T1_Face_Init), src/type42/t42objs.c
(T42_Face_Init), src/winfonts/winfnt.c (FNT_Face_Init): Add
`greeting' message.
* src/sfnt/sfobjs.c (sfnt_open_font), src/type42/t42objs.c
(T42_Open_Face): Improve tracing.
13 years ago
suzuki toshiya
e62c876bb0
Fix g++4.6 compiler warnings in module drivers.
...
The background is same with previous commit.
* src/truetype/ttgxvar.c (ft_var_readpackedpoints):
Init `points'. (TT_Vary_Get_Glyph_Deltas): Init
`delta_xy'. (TT_Get_MM_Var): Init `mmvar'.
* src/type1/t1load.c (T1_Get_MM_Var): Ditto.
* src/cff/cffdrivr.c (cff_ps_get_font_info): Init
`font_info'.
* src/cff/cffload.c (cff_index_get_pointers): Init `t'.
(cff_font_load): Init `sub'.
* src/cff/cffobjs.c (cff_size_init): Init `internal'.
(cff_face_init): Init `cff'.
* src/pfr/pfrload.c (pfr_extra_item_load_stem_snaps):
Init `snaps'.
* src/pcf/pcfread.c (pcf_get_properties): Init `properties'.
(pcf_get_bitmaps): Init `offsets'. (pcf_get_encodings):
Init `tmpEncoding'.
* src/sfnt/ttload.c (tt_face_load_gasp): Init `gaspranges'.
* src/sfnt/ttsbit.c (Load_SBit_Image): Init `components'.
* src/cache/ftcmru.c (FTC_MruList_New): Init `node'.
* src/gzip/ftgzip.c (FT_Stream_OpenGzip): Init `zip' and
`zip_buff'.
* src/lzw/ftlzw.c (FT_Stream_OpenLZW): Init `zip'.
* src/bzip2/ftbzip2.c (FT_Stream_OpenBzip2): Init `zip'.
14 years ago
Werner Lemberg
c8f5b98be2
Remove C++ warnings.
...
*/*: Initialize pointers where necessary to make g++ happy.
15 years ago
suzuki toshiya
840f208df4
Use defined macros to set {platform,encoding}_id.
...
* src/bdf/bdfdrivr.c: Include ttnameid.h and use macros to
set charmap.{platfom,encoding}_id.
* src/pcf/pcfdrivr.c: Ditto.
* src/winfonts/winfnt.c: Ditto.
* src/type1/t1objs.c: Ditto.
* src/type42/t42objs.c: Ditto.
* src/cff/cffobjs.c: Ditto.
* src/pfr/pfrobjs.c: Ditto.
15 years ago
suzuki toshiya
a874c7ecca
Check error value by `FT_CMap_New'.
...
* src/cff/cffobjs.c (cff_face_init): Check error value by
`FT_CMap_New'.
* src/pfr/pfrobjs.c (pfr_face_init): Ditto.
* src/type1/t1jobjs.c (T1_Face_Init): Ditto.
* src/type42/t42jobjs.c (T42_Face_Init): Ditto.
15 years ago
Werner Lemberg
1c70fcbc0a
Fix PFR change 2010-06-24.
...
* src/pfr/pfrgload.c (pfr_glyph_load_simple): Really protect against
invalid indices.
15 years ago
Werner Lemberg
91ea0bf80d
Improve PFR tracing messages.
...
* src/pfr/pfrgload.c (pfr_glyph_load_rec): Emit tracing messages for
simple and compound glyph offsets.
15 years ago
Werner Lemberg
82ad8ab242
Fix last PFR change.
...
* src/pfr/pfrobjs.c (pfr_face_init): Fix rejection logic.
15 years ago
Werner Lemberg
ea5babaa67
Fix Savannah bug #30261 .
...
* src/pfr/pfrobjs.c (pfr_face_init): Reject fonts which contain
neither outline nor bitmap glyphs.
15 years ago
Werner Lemberg
f765e4403c
*/*: Use module specific error names where appropriate.
15 years ago
Werner Lemberg
3cf87f4d27
Fix Savannah bug #30235 .
...
* src/pfr/pfrgload.c (pfr_glyph_load_simple): Protect against
invalid indices if there aren't any coordinates for indexing.
15 years ago
Werner Lemberg
ddc4b136d6
Fix Savannah bug #30168 .
...
* src/pfr/pfrgload.c (pfr_glyph_load_compound): Limit the number of
subglyphs to avoid endless recursion.
15 years ago
Werner Lemberg
9045f5bdf2
Fix compiler warnings.
...
* src/truetype/ttgload.c (tt_get_metrics): Put `Exit' label into the
proper preprocessor conditional.
* src/pfr/pfrobjs.c (pfr_slot_load): Pacify gcc.
15 years ago
suzuki toshiya
3783dac000
pfr: Extend `num_aux' to take 32-bit value.
16 years ago
suzuki toshiya
737634e5e4
pfr: Fix a data type mismatching with its source.
16 years ago
suzuki toshiya
b12b8c3ce4
pfr: Fix a data type mismatching with its source.
16 years ago
suzuki toshiya
c4420d97f4
pfr: Fix a data type mismatching with its source.
16 years ago
suzuki toshiya
3f0f2e462b
XXX_cmap_encoding_char_next() return FT_UInt32 values.
16 years ago
suzuki toshiya
e866cf3f55
Improve bitmap size or pixel variables for 16-bit systems.
16 years ago
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.
16 years ago
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
16 years ago
Werner Lemberg
86e041b5a8
Remove redundant header inclusions.
...
This covers many Ghostscript Coverity issues.
* src/*: Do it.
16 years ago
Werner Lemberg
3c5ad95166
* src/pfr/pfrdrivr.c, src/winfonts/winfnt.c, src/cache/ftcmanag.c,
...
16 years ago
Werner Lemberg
ce33a312da
FT_USE_MODULE declares things as:
...
16 years ago
Werner Lemberg
d03d856d95
* src/truetype/ttobjs.c (tt_face_done), src/cff/cffobjs.c
...
17 years ago
Werner Lemberg
50997cd742
* src/pfr/pfrdrivr.c (pfr_get_advance): Fix off-by-one error.
...
17 years ago
Werner Lemberg
c0da523270
* src/pfr/pfrgload.c (pfr_glyph_load_compound): Remove compiler
...
17 years ago
Werner Lemberg
9a966b7d1b
Add support for cmap type 14.
...
17 years ago
Werner Lemberg
1e1b6dff54
* src/pfr/pfrcmap.c: Include pfrerror.h.
...
18 years ago
Werner Lemberg
88ab638e0f
* src/sfnt/ttsbit0.c (tt_sbit_decoder_init,
...
18 years ago
Werner Lemberg
a8d65494cb
* src/pfr/pfrcmap.c (pfr_cmap_init): Convert assertion into normal
...
18 years ago
Werner Lemberg
9a0332cd3f
* src/pfr/pfrgload.c (pfr_glyph_curve_to, pfr_glyph_line_to): Convert
...
18 years ago