summaryrefslogtreecommitdiff
path: root/src/sfnt
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2013-03-14 10:27:35 +0100
committerWerner Lemberg <wl@gnu.org>2013-03-14 10:27:35 +0100
commit059bc335ce42220b222763379e89d0cbf2b949eb (patch)
tree664afa6d13d54d6bd82e431d2b114a31e0b91a5b /src/sfnt
parentc58ce3beee198cff82269a482cd3f6d4c7d43511 (diff)
downloadfreetype2-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/sfnt')
-rw-r--r--src/sfnt/sfdriver.c18
-rw-r--r--src/sfnt/sfobjs.c18
-rw-r--r--src/sfnt/ttbdf.c6
-rw-r--r--src/sfnt/ttcmap.c6
-rw-r--r--src/sfnt/ttkern.c2
-rw-r--r--src/sfnt/ttload.c20
-rw-r--r--src/sfnt/ttmtx.c6
-rw-r--r--src/sfnt/ttpost.c16
-rw-r--r--src/sfnt/ttsbit.c27
-rw-r--r--src/sfnt/ttsbit0.c32
10 files changed, 75 insertions, 76 deletions
diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c
index 2b7f80fc9..b2b27db5b 100644
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -4,7 +4,7 @@
/* */
/* High-level SFNT driver interface (body). */
/* */
-/* Copyright 1996-2007, 2009-2012 by */
+/* Copyright 1996-2007, 2009-2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -119,14 +119,14 @@
FT_ULong *length )
{
if ( !offset || !length )
- return SFNT_Err_Invalid_Argument;
+ return FT_THROW( Invalid_Argument );
if ( !tag )
*length = face->num_tables;
else
{
if ( idx >= face->num_tables )
- return SFNT_Err_Table_Missing;
+ return FT_THROW( Table_Missing );
*tag = face->dir_tables[idx].Tag;
*offset = face->dir_tables[idx].Offset;
@@ -371,7 +371,7 @@
*acharset_registry = registry.u.atom;
}
else
- error = SFNT_Err_Invalid_Argument;
+ error = FT_THROW( Invalid_Argument );
}
}
@@ -458,7 +458,7 @@
FT_UNUSED( face_index );
FT_UNUSED( header );
- return SFNT_Err_Unimplemented_Feature;
+ return FT_THROW( Unimplemented_Feature );
}
@@ -471,7 +471,7 @@
FT_UNUSED( stream );
FT_UNUSED( header );
- return SFNT_Err_Unimplemented_Feature;
+ return FT_THROW( Unimplemented_Feature );
}
@@ -482,7 +482,7 @@
FT_UNUSED( face );
FT_UNUSED( stream );
- return SFNT_Err_Unimplemented_Feature;
+ return FT_THROW( Unimplemented_Feature );
}
@@ -535,7 +535,7 @@
* is only there for some rogue clients which would want to call it
* directly (which doesn't make much sense).
*/
- return SFNT_Err_Unimplemented_Feature;
+ return FT_THROW( Unimplemented_Feature );
}
@@ -556,7 +556,7 @@
FT_UNUSED( cmap );
FT_UNUSED( input );
- return SFNT_Err_Unimplemented_Feature;
+ return FT_THROW( Unimplemented_Feature );
}
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index ef4784aeb..b25aa6cd0 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -4,7 +4,7 @@
/* */
/* SFNT object management (base). */
/* */
-/* Copyright 1996-2008, 2010-2012 by */
+/* Copyright 1996-2008, 2010-2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -386,7 +386,7 @@
tag != 0x00020000UL )
{
FT_TRACE2(( " not a font using the SFNT container format\n" ));
- return SFNT_Err_Unknown_File_Format;
+ return FT_THROW( Unknown_File_Format );
}
face->ttc_header.tag = TTAG_ttcf;
@@ -402,7 +402,7 @@
return error;
if ( face->ttc_header.count == 0 )
- return SFNT_Err_Invalid_Table;
+ return FT_THROW( Invalid_Table );
/* a rough size estimate: let's conservatively assume that there */
/* is just a single table info in each subfont header (12 + 16*1 = */
@@ -410,7 +410,7 @@
/* size of the TTC header plus `28*count' bytes for all subfont */
/* headers */
if ( (FT_ULong)face->ttc_header.count > stream->size / ( 28 + 4 ) )
- return SFNT_Err_Array_Too_Large;
+ return FT_THROW( Array_Too_Large );
/* now read the offsets of each font in the file */
if ( FT_NEW_ARRAY( face->ttc_header.offsets, face->ttc_header.count ) )
@@ -465,7 +465,7 @@
if ( !sfnt )
{
FT_ERROR(( "sfnt_init_face: cannot access `sfnt' module\n" ));
- return SFNT_Err_Missing_Module;
+ return FT_THROW( Missing_Module );
}
face->sfnt = sfnt;
@@ -486,7 +486,7 @@
face_index = 0;
if ( face_index >= face->ttc_header.count )
- return SFNT_Err_Invalid_Argument;
+ return FT_THROW( Invalid_Argument );
if ( FT_STREAM_SEEK( face->ttc_header.offsets[face_index] ) )
return error;
@@ -628,7 +628,7 @@
if ( face->header.Units_Per_EM == 0 )
{
- error = SFNT_Err_Invalid_Table;
+ error = FT_THROW( Invalid_Table );
goto Exit;
}
@@ -658,7 +658,7 @@
LOADM_( hmtx, 0 );
if ( error == SFNT_Err_Table_Missing )
{
- error = SFNT_Err_Hmtx_Table_Missing;
+ error = FT_THROW( Hmtx_Table_Missing );
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* If this is an incrementally loaded font and there are */
@@ -685,7 +685,7 @@
}
else
{
- error = SFNT_Err_Horiz_Header_Missing;
+ error = FT_THROW( Horiz_Header_Missing );
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* If this is an incrementally loaded font and there are */
diff --git a/src/sfnt/ttbdf.c b/src/sfnt/ttbdf.c
index 18845c39c..0618baf49 100644
--- a/src/sfnt/ttbdf.c
+++ b/src/sfnt/ttbdf.c
@@ -4,7 +4,7 @@
/* */
/* TrueType and OpenType embedded BDF properties (body). */
/* */
-/* Copyright 2005, 2006, 2010 by */
+/* Copyright 2005, 2006, 2010, 2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -74,7 +74,7 @@
length < 8 ||
FT_FRAME_EXTRACT( length, bdf->table ) )
{
- error = SFNT_Err_Invalid_Table;
+ error = FT_THROW( Invalid_Table );
goto Exit;
}
@@ -131,7 +131,7 @@
BadTable:
FT_FRAME_RELEASE( bdf->table );
FT_ZERO( bdf );
- error = SFNT_Err_Invalid_Table;
+ error = FT_THROW( Invalid_Table );
goto Exit;
}
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index f1504d621..767e28288 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -4,7 +4,7 @@
/* */
/* TrueType character mapping table (cmap) support (body). */
/* */
-/* Copyright 2002-2010, 2012 by */
+/* Copyright 2002-2010, 2012, 2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -3442,7 +3442,7 @@
if ( !p || p + 4 > limit )
- return SFNT_Err_Invalid_Table;
+ return FT_THROW( Invalid_Table );
/* only recognize format 0 */
if ( TT_NEXT_USHORT( p ) != 0 )
@@ -3451,7 +3451,7 @@
FT_ERROR(( "tt_face_build_cmaps:"
" unsupported `cmap' table format = %d\n",
TT_PEEK_USHORT( p ) ));
- return SFNT_Err_Invalid_Table;
+ return FT_THROW( Invalid_Table );
}
num_cmaps = TT_NEXT_USHORT( p );
diff --git a/src/sfnt/ttkern.c b/src/sfnt/ttkern.c
index 46888988e..60ee546d7 100644
--- a/src/sfnt/ttkern.c
+++ b/src/sfnt/ttkern.c
@@ -61,7 +61,7 @@
{
FT_ERROR(( "tt_face_load_kern:"
" kerning table is too small - ignored\n" ));
- error = SFNT_Err_Table_Missing;
+ error = FT_THROW( Table_Missing );
goto Exit;
}
diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c
index 7ffdbeeff..a7dde531e 100644
--- a/src/sfnt/ttload.c
+++ b/src/sfnt/ttload.c
@@ -5,7 +5,7 @@
/* Load the basic TrueType tables, i.e., tables that can be either in */
/* TTF or OTF fonts (body). */
/* */
-/* Copyright 1996-2010, 2012 by */
+/* Copyright 1996-2010, 2012, 2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -142,7 +142,7 @@
goto Exit;
}
else
- error = SFNT_Err_Table_Missing;
+ error = FT_THROW( Table_Missing );
Exit:
return error;
@@ -237,7 +237,7 @@
if ( table.Length < 0x36 )
{
FT_TRACE2(( "check_table_dir: `head' table too small\n" ));
- error = SFNT_Err_Table_Missing;
+ error = FT_THROW( Table_Missing );
goto Exit;
}
@@ -249,7 +249,7 @@
{
FT_TRACE2(( "check_table_dir:"
" no magic number found in `head' table\n"));
- error = SFNT_Err_Table_Missing;
+ error = FT_THROW( Table_Missing );
goto Exit;
}
@@ -267,7 +267,7 @@
if ( sfnt->num_tables == 0 )
{
FT_TRACE2(( "check_table_dir: no tables found\n" ));
- error = SFNT_Err_Unknown_File_Format;
+ error = FT_THROW( Unknown_File_Format );
goto Exit;
}
@@ -285,7 +285,7 @@
#else
FT_TRACE2(( " neither `head' nor `sing' table found\n" ));
#endif
- error = SFNT_Err_Table_Missing;
+ error = FT_THROW( Table_Missing );
}
Exit:
@@ -353,7 +353,7 @@
#if 0
if ( sfnt.search_range != 1 << ( sfnt.entry_selector + 4 ) ||
sfnt.search_range + sfnt.range_shift != sfnt.num_tables << 4 )
- return SFNT_Err_Unknown_File_Format;
+ return FT_THROW( Unknown_File_Format );
#endif
/* load the table directory */
@@ -482,7 +482,7 @@
table = tt_face_lookup_table( face, tag );
if ( !table )
{
- error = SFNT_Err_Table_Missing;
+ error = FT_THROW( Table_Missing );
goto Exit;
}
@@ -801,7 +801,7 @@
if ( storage_start > storage_limit )
{
FT_ERROR(( "tt_face_load_name: invalid `name' table\n" ));
- error = SFNT_Err_Name_Table_Missing;
+ error = FT_THROW( Name_Table_Missing );
goto Exit;
}
@@ -1235,7 +1235,7 @@
if ( face->gasp.version >= 2 )
{
face->gasp.numRanges = 0;
- error = SFNT_Err_Invalid_Table;
+ error = FT_THROW( Invalid_Table );
goto Exit;
}
diff --git a/src/sfnt/ttmtx.c b/src/sfnt/ttmtx.c
index 8f7b2a93b..f95b39b05 100644
--- a/src/sfnt/ttmtx.c
+++ b/src/sfnt/ttmtx.c
@@ -4,7 +4,7 @@
/* */
/* Load the metrics tables common to TTF and OTF fonts (body). */
/* */
-/* Copyright 2006-2009, 2011-2012 by */
+/* Copyright 2006-2009, 2011-2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -167,8 +167,8 @@
/* Adobe simply ignores this problem. So we shall do the same. */
#if 0
- error = vertical ? SFNT_Err_Invalid_Vert_Metrics
- : SFNT_Err_Invalid_Horiz_Metrics;
+ error = vertical ? FT_THROW( Invalid_Vert_Metrics )
+ : FT_THROW( Invalid_Horiz_Metrics );
goto Exit;
#else
num_shorts = 0;
diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c
index 6f4bb1d0d..69c3a0339 100644
--- a/src/sfnt/ttpost.c
+++ b/src/sfnt/ttpost.c
@@ -5,7 +5,7 @@
/* Postcript name table processing for TrueType and OpenType fonts */
/* (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2006, 2007, 2008, 2009, 2010 by */
+/* Copyright 1996-2003, 2006-2010, 2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -178,7 +178,7 @@
if ( num_glyphs > face->max_profile.numGlyphs )
{
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -325,7 +325,7 @@
/* check the number of glyphs */
if ( num_glyphs > face->max_profile.numGlyphs || num_glyphs > 258 )
{
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -345,7 +345,7 @@
if ( idx < 0 || idx > num_glyphs )
{
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
goto Fail;
}
}
@@ -402,7 +402,7 @@
else if ( format == 0x00028000L )
error = load_format_25( face, stream, post_limit );
else
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
face->postscript_names.loaded = 1;
@@ -488,15 +488,15 @@
if ( !face )
- return SFNT_Err_Invalid_Face_Handle;
+ return FT_THROW( Invalid_Face_Handle );
if ( idx >= (FT_UInt)face->max_profile.numGlyphs )
- return SFNT_Err_Invalid_Glyph_Index;
+ return FT_THROW( Invalid_Glyph_Index );
#ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES
psnames = (FT_Service_PsCMaps)face->psnames;
if ( !psnames )
- return SFNT_Err_Unimplemented_Feature;
+ return FT_THROW( Unimplemented_Feature );
#endif
names = &face->postscript_names;
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index 283ba7ef7..9434861bf 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -4,8 +4,7 @@
/* */
/* TrueType and OpenType embedded bitmap support (body). */
/* */
-/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, */
-/* 2010 by */
+/* Copyright 1996-2010, 2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -353,7 +352,7 @@
if ( range->last_glyph < range->first_glyph )
{
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -390,7 +389,7 @@
break;
default:
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
}
Exit:
@@ -496,7 +495,7 @@
num_strikes >= 0x10000L )
{
FT_ERROR(( "tt_face_load_sbit_strikes: invalid table version\n" ));
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -662,7 +661,7 @@
if ( strike_index >= face->num_sbit_strikes )
- return SFNT_Err_Invalid_Argument;
+ return FT_THROW( Invalid_Argument );
strike = face->sbit_strikes + strike_index;
@@ -782,7 +781,7 @@
*arange = 0;
*aglyph_offset = 0;
- return SFNT_Err_Invalid_Argument;
+ return FT_THROW( Invalid_Argument );
}
@@ -847,7 +846,7 @@
*astrike = 0;
*aglyph_offset = 0;
- return SFNT_Err_Invalid_Argument;
+ return FT_THROW( Invalid_Argument );
}
@@ -942,7 +941,7 @@
if ( range->index_format == 2 || range->index_format == 5 )
*metrics = range->metrics;
else
- return SFNT_Err_Invalid_File_Format;
+ return FT_THROW( Invalid_File_Format );
}
Exit:
@@ -1171,7 +1170,7 @@
if ( x_offset < 0 || x_offset + metrics->width > map->width ||
y_offset < 0 || y_offset + metrics->height > map->rows )
{
- error = SFNT_Err_Invalid_Argument;
+ error = FT_THROW( Invalid_Argument );
goto Exit;
}
@@ -1221,7 +1220,7 @@
break;
default: /* invalid format */
- return SFNT_Err_Invalid_File_Format;
+ return FT_THROW( Invalid_File_Format );
}
/* Now read data and draw glyph into target pixmap */
@@ -1301,7 +1300,7 @@
break;
default:
- return SFNT_Err_Invalid_File_Format;
+ return FT_THROW( Invalid_File_Format );
}
size = map->rows * map->pitch;
@@ -1328,7 +1327,7 @@
case 8: /* compound format */
if ( FT_STREAM_SKIP( 1L ) )
{
- error = SFNT_Err_Invalid_Stream_Skip;
+ error = FT_THROW( Invalid_Stream_Skip );
goto Exit;
}
/* fallthrough */
@@ -1337,7 +1336,7 @@
break;
default: /* invalid image format */
- return SFNT_Err_Invalid_File_Format;
+ return FT_THROW( Invalid_File_Format );
}
/* All right, we have a compound format. First of all, read */
diff --git a/src/sfnt/ttsbit0.c b/src/sfnt/ttsbit0.c
index 691bad704..396972b9d 100644
--- a/src/sfnt/ttsbit0.c
+++ b/src/sfnt/ttsbit0.c
@@ -63,7 +63,7 @@
if ( table_size < 8 )
{
FT_ERROR(( "tt_face_load_sbit_strikes: table too short\n" ));
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -81,7 +81,7 @@
if ( version != 0x00020000UL || num_strikes >= 0x10000UL )
{
FT_ERROR(( "tt_face_load_sbit_strikes: invalid table version\n" ));
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
goto Fail;
}
@@ -136,7 +136,7 @@
if ( strike_index >= (FT_ULong)face->sbit_num_strikes )
- return SFNT_Err_Invalid_Argument;
+ return FT_THROW( Invalid_Argument );
strike = face->sbit_table + 8 + strike_index * 48;
@@ -216,7 +216,7 @@
if ( 8 + 48 * strike_index + 3 * 4 + 34 + 1 > face->sbit_table_size )
{
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -231,7 +231,7 @@
if ( decoder->strike_index_array > face->sbit_table_size ||
decoder->strike_index_array + 8 * decoder->strike_index_count >
face->sbit_table_size )
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
}
Exit:
@@ -257,7 +257,7 @@
if ( !decoder->metrics_loaded )
{
- error = SFNT_Err_Invalid_Argument;
+ error = FT_THROW( Invalid_Argument );
goto Exit;
}
@@ -290,7 +290,7 @@
break;
default:
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -348,7 +348,7 @@
return SFNT_Err_Ok;
Fail:
- return SFNT_Err_Invalid_Argument;
+ return FT_THROW( Invalid_Argument );
}
@@ -401,13 +401,13 @@
if ( x_pos < 0 || x_pos + width > bit_width ||
y_pos < 0 || y_pos + height > bit_height )
{
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
goto Exit;
}
if ( p + ( ( line_bits + 7 ) >> 3 ) * height > limit )
{
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -542,13 +542,13 @@
if ( x_pos < 0 || x_pos + width > bit_width ||
y_pos < 0 || y_pos + height > bit_height )
{
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
goto Exit;
}
if ( p + ( ( line_bits * height + 7 ) >> 3 ) > limit )
{
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -690,7 +690,7 @@
return error;
Fail:
- error = SFNT_Err_Invalid_File_Format;
+ error = FT_THROW( Invalid_File_Format );
goto Exit;
}
@@ -713,7 +713,7 @@
/* seek into the EBDT table now */
if ( glyph_start + glyph_size > decoder->ebdt_size )
{
- error = SFNT_Err_Invalid_Argument;
+ error = FT_THROW( Invalid_Argument );
goto Exit;
}
@@ -972,10 +972,10 @@
y_pos );
Failure:
- return SFNT_Err_Invalid_Table;
+ return FT_THROW( Invalid_Table );
NoBitmap:
- return SFNT_Err_Invalid_Argument;
+ return FT_THROW( Invalid_Argument );
}