diff options
author | Werner Lemberg <wl@gnu.org> | 2013-03-14 10:27:35 +0100 |
---|---|---|
committer | Werner Lemberg <wl@gnu.org> | 2013-03-14 10:27:35 +0100 |
commit | 059bc335ce42220b222763379e89d0cbf2b949eb (patch) | |
tree | 664afa6d13d54d6bd82e431d2b114a31e0b91a5b /src/bdf | |
parent | c58ce3beee198cff82269a482cd3f6d4c7d43511 (diff) | |
download | freetype2-059bc335ce42220b222763379e89d0cbf2b949eb.tar.gz |
*/*: 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.
Diffstat (limited to 'src/bdf')
-rw-r--r-- | src/bdf/bdfdrivr.c | 10 | ||||
-rw-r--r-- | src/bdf/bdflib.c | 73 |
2 files changed, 42 insertions, 41 deletions
diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index 0edcc77b6..5baf36ac3 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -2,7 +2,7 @@ FreeType font driver for bdf files - Copyright (C) 2001-2008, 2011 by + Copyright (C) 2001-2008, 2011, 2013 by Francesco Zappa Nardelli Permission is hereby granted, free of charge, to any person obtaining a copy @@ -591,7 +591,7 @@ THE SOFTWARE. Fail: BDF_Face_Done( bdfface ); - return BDF_Err_Unknown_File_Format; + return FT_THROW( Unknown_File_Format ); } @@ -640,7 +640,7 @@ THE SOFTWARE. break; default: - error = BDF_Err_Unimplemented_Feature; + error = FT_THROW( Unimplemented_Feature ); break; } @@ -670,7 +670,7 @@ THE SOFTWARE. if ( !face || glyph_index >= (FT_UInt)face->num_glyphs ) { - error = BDF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -786,7 +786,7 @@ THE SOFTWARE. } Fail: - return BDF_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); } diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c index 7208d99c9..5d35b416b 100644 --- a/src/bdf/bdflib.c +++ b/src/bdf/bdflib.c @@ -1,6 +1,6 @@ /* * Copyright 2000 Computing Research Labs, New Mexico State University - * Copyright 2001-2012 + * Copyright 2001-2013 * Francesco Zappa Nardelli * * Permission is hereby granted, free of charge, to any person obtaining a @@ -282,7 +282,7 @@ hash_init( hashtable* ht, FT_Memory memory ) { - int sz = INITIAL_HT_SIZE; + int sz = INITIAL_HT_SIZE; FT_Error error = BDF_Err_Ok; @@ -322,8 +322,9 @@ hashtable* ht, FT_Memory memory ) { - hashnode nn, *bp = hash_bucket( key, ht ); - FT_Error error = BDF_Err_Ok; + hashnode nn; + hashnode* bp = hash_bucket( key, ht ); + FT_Error error = BDF_Err_Ok; nn = *bp; @@ -469,7 +470,7 @@ if ( oldsize == bigsize ) { - error = BDF_Err_Out_Of_Memory; + error = FT_THROW( Out_Of_Memory ); goto Exit; } else if ( newsize < oldsize || newsize > bigsize ) @@ -581,7 +582,7 @@ /* this, so an error is signaled. */ if ( separators == 0 || *separators == 0 ) { - error = BDF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -667,14 +668,14 @@ unsigned long lineno, buf_size; int refill, hold, to_skip; ptrdiff_t bytes, start, end, cursor, avail; - char* buf = 0; + char* buf = 0; FT_Memory memory = stream->memory; - FT_Error error = BDF_Err_Ok; + FT_Error error = BDF_Err_Ok; if ( callback == 0 ) { - error = BDF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -738,7 +739,7 @@ if ( buf_size >= 65536UL ) /* limit ourselves to 64KByte */ { FT_ERROR(( "_bdf_readstream: " ERRMSG6, lineno )); - error = BDF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -1028,7 +1029,7 @@ size_t n; bdf_property_t* p; FT_Memory memory = font->memory; - FT_Error error = BDF_Err_Ok; + FT_Error error = BDF_Err_Ok; /* First check whether the property has */ @@ -1047,7 +1048,7 @@ n = ft_strlen( name ) + 1; if ( n > FT_ULONG_MAX ) - return BDF_Err_Invalid_Argument; + return FT_THROW( Invalid_Argument ); if ( FT_NEW_ARRAY( p->name, n ) ) goto Exit; @@ -1134,7 +1135,7 @@ { char* cp; FT_Memory memory = font->memory; - FT_Error error = BDF_Err_Ok; + FT_Error error = BDF_Err_Ok; if ( FT_RENEW_ARRAY( font->comments, @@ -1170,7 +1171,7 @@ if ( font == 0 || font->name == 0 || font->name[0] == 0 ) { - error = BDF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -1185,7 +1186,7 @@ if ( len >= 256 ) { FT_ERROR(( "_bdf_set_default_spacing: " ERRMSG7, lineno )); - error = BDF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -1298,7 +1299,7 @@ hashnode hn; bdf_property_t *prop, *fp; FT_Memory memory = font->memory; - FT_Error error = BDF_Err_Ok; + FT_Error error = BDF_Err_Ok; /* First, check whether the property already exists in the font. */ @@ -1431,7 +1432,7 @@ if ( !fp->value.atom ) { FT_ERROR(( "_bdf_add_property: " ERRMSG8, lineno, "SPACING" )); - error = BDF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1504,7 +1505,7 @@ if ( ft_memcmp( line, "CHARS", 5 ) != 0 ) { FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "CHARS" )); - error = BDF_Err_Missing_Chars_Field; + error = FT_THROW( Missing_Chars_Field ); goto Exit; } @@ -1522,7 +1523,7 @@ if ( p->cnt >= 0x110000UL ) { FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG5, lineno, "CHARS" )); - error = BDF_Err_Invalid_Argument; + error = FT_THROW( Invalid_Argument ); goto Exit; } @@ -1582,7 +1583,7 @@ if ( !s ) { FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG8, lineno, "STARTCHAR" )); - error = BDF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1605,7 +1606,7 @@ { /* Missing STARTCHAR field. */ FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "STARTCHAR" )); - error = BDF_Err_Missing_Startchar_Field; + error = FT_THROW( Missing_Startchar_Field ); goto Exit; } @@ -1636,7 +1637,7 @@ sizeof ( unsigned long ) * 32 ) { FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG5, lineno, "ENCODING" )); - error = BDF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -1906,7 +1907,7 @@ { /* Missing BBX field. */ FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "BBX" )); - error = BDF_Err_Missing_Bbx_Field; + error = FT_THROW( Missing_Bbx_Field ); goto Exit; } @@ -1917,7 +1918,7 @@ if ( glyph->bpr > 0xFFFFU || bitmap_size > 0xFFFFU ) { FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG4, lineno )); - error = BDF_Err_Bbx_Too_Big; + error = FT_THROW( Bbx_Too_Big ); goto Exit; } else @@ -1933,13 +1934,13 @@ } FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG9, lineno )); - error = BDF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; Missing_Encoding: /* Missing ENCODING field. */ FT_ERROR(( "_bdf_parse_glyphs: " ERRMSG1, lineno, "ENCODING" )); - error = BDF_Err_Missing_Encoding_Field; + error = FT_THROW( Missing_Encoding_Field ); Exit: if ( error && ( p->flags & _BDF_GLYPH ) ) @@ -2112,7 +2113,7 @@ { /* we don't emit an error message since this code gets */ /* explicitly caught one level higher */ - error = BDF_Err_Missing_Startfont_Field; + error = FT_THROW( Missing_Startfont_Field ); goto Exit; } @@ -2162,7 +2163,7 @@ { /* Missing the FONTBOUNDINGBOX field. */ FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONTBOUNDINGBOX" )); - error = BDF_Err_Missing_Fontboundingbox_Field; + error = FT_THROW( Missing_Fontboundingbox_Field ); goto Exit; } @@ -2191,7 +2192,7 @@ { /* Missing the SIZE field. */ FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "SIZE" )); - error = BDF_Err_Missing_Size_Field; + error = FT_THROW( Missing_Size_Field ); goto Exit; } @@ -2228,7 +2229,7 @@ if ( !s ) { FT_ERROR(( "_bdf_parse_start: " ERRMSG8, lineno, "FONT" )); - error = BDF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); goto Exit; } @@ -2257,7 +2258,7 @@ { /* Missing the FONT field. */ FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONT" )); - error = BDF_Err_Missing_Font_Field; + error = FT_THROW( Missing_Font_Field ); goto Exit; } @@ -2314,7 +2315,7 @@ { /* Missing the FONTBOUNDINGBOX field. */ FT_ERROR(( "_bdf_parse_start: " ERRMSG1, lineno, "FONTBOUNDINGBOX" )); - error = BDF_Err_Missing_Fontboundingbox_Field; + error = FT_THROW( Missing_Fontboundingbox_Field ); goto Exit; } @@ -2346,7 +2347,7 @@ } FT_ERROR(( "_bdf_parse_start: " ERRMSG9, lineno )); - error = BDF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); Exit: return error; @@ -2463,14 +2464,14 @@ { /* Error happened while parsing header. */ FT_ERROR(( "bdf_load_font: " ERRMSG2, lineno )); - error = BDF_Err_Corrupted_Font_Header; + error = FT_THROW( Corrupted_Font_Header ); goto Exit; } else { /* Error happened when parsing glyphs. */ FT_ERROR(( "bdf_load_font: " ERRMSG3, lineno )); - error = BDF_Err_Corrupted_Font_Glyphs; + error = FT_THROW( Corrupted_Font_Glyphs ); goto Exit; } } @@ -2491,7 +2492,7 @@ } } else if ( error == BDF_Err_Ok ) - error = BDF_Err_Invalid_File_Format; + error = FT_THROW( Invalid_File_Format ); *font = p->font; |