Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.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/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
index ca38ca7..b261515 100644
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -27,7 +27,6 @@
#include <ft2build.h>
-#include FT_ERRORS_H
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_STREAM_H
#include FT_INTERNAL_OBJECTS_H
@@ -35,6 +34,8 @@
#include "pcf.h"
#include "pcfdriver.h"
+#include "pcferror.h"
+
#include <string.h> /* strlen(), strcpy() */
/*************************************************************************/
@@ -98,13 +99,13 @@
if ( FILE_Seek ( 0 ) ||
READ_Fields ( pcf_toc_header, toc ) )
- return FT_Err_Cannot_Open_Resource;
+ return PCF_Err_Cannot_Open_Resource;
if ( toc->version != PCF_FILE_VERSION )
- return FT_Err_Invalid_File_Format;
+ return PCF_Err_Invalid_File_Format;
if ( ALLOC( face->toc.tables, toc->count * sizeof ( PCF_TableRec ) ) )
- return FT_Err_Out_Of_Memory;
+ return PCF_Err_Out_Of_Memory;
tables = face->toc.tables;
for ( i = 0; i < toc->count; i++ )
@@ -139,7 +140,7 @@
#endif
- return FT_Err_Ok;
+ return PCF_Err_Ok;
Exit:
FREE( face->toc.tables );
@@ -202,13 +203,13 @@
const FT_Frame_Field* header,
PCF_Metric metric )
{
- FT_Error error = FT_Err_Ok;
+ FT_Error error = PCF_Err_Ok;
if ( READ_Fields( header, metric ) )
return error;
- return FT_Err_Ok;
+ return PCF_Err_Ok;
}
@@ -217,7 +218,7 @@
PCF_Metric metric )
{
PCF_Compressed_MetricRec compr_metric;
- FT_Error error = FT_Err_Ok;
+ FT_Error error = PCF_Err_Ok;
if ( READ_Fields( pcf_compressed_metric_header, &compr_metric ) )
@@ -230,7 +231,7 @@
metric->descent = (FT_Short)compr_metric.descent - 0x80;
metric->attributes = 0;
- return FT_Err_Ok;
+ return PCF_Err_Ok;
}
@@ -239,7 +240,7 @@
FT_ULong format,
PCF_Metric metric )
{
- FT_Error error = FT_Err_Ok;
+ FT_Error error = PCF_Err_Ok;
if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
@@ -272,15 +273,15 @@
if ( tables[i].type == type )
{
if ( stream->pos > tables[i].offset )
- return FT_Err_Invalid_Stream_Skip;
+ return PCF_Err_Invalid_Stream_Skip;
if ( FILE_Skip( tables[i].offset - stream->pos ) )
- return FT_Err_Invalid_Stream_Skip;
+ return PCF_Err_Invalid_Stream_Skip;
*sizep = tables[i].size; /* unused - to be removed */
*formatp = tables[i].format;
- return FT_Err_Ok;
+ return PCF_Err_Ok;
}
- return FT_Err_Invalid_File_Format;
+ return PCF_Err_Invalid_File_Format;
}
@@ -466,7 +467,7 @@
FREE( props );
FREE( strings );
- return FT_Err_Ok;
+ return PCF_Err_Ok;
Bail:
FREE( props );
@@ -480,7 +481,7 @@
FT_Error pcf_get_metrics( FT_Stream stream,
PCF_Face face )
{
- FT_Error error = FT_Err_Ok;
+ FT_Error error = PCF_Err_Ok;
FT_Memory memory = FT_FACE(face)->memory;
FT_ULong format = 0;
FT_ULong size = 0;
@@ -502,7 +503,7 @@
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) &&
!PCF_FORMAT_MATCH( format, PCF_COMPRESSED_METRICS ) )
- return FT_Err_Invalid_File_Format;
+ return PCF_Err_Invalid_File_Format;
if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
{
@@ -519,12 +520,12 @@
(void)READ_UShortLE( nmetrics );
}
if ( error || nmetrics == -1 )
- return FT_Err_Invalid_File_Format;
+ return PCF_Err_Invalid_File_Format;
face->nmetrics = nmetrics;
if ( ALLOC( face->metrics, nmetrics * sizeof ( PCF_MetricRec ) ) )
- return FT_Err_Out_Of_Memory;
+ return PCF_Err_Out_Of_Memory;
metrics = face->metrics;
for ( i = 0; i < nmetrics; i++ )
@@ -557,7 +558,7 @@
FT_Error pcf_get_bitmaps( FT_Stream stream,
PCF_Face face )
{
- FT_Error error = FT_Err_Ok;
+ FT_Error error = PCF_Err_Ok;
FT_Memory memory = FT_FACE(face)->memory;
FT_Long* offsets;
FT_Long bitmapSizes[GLYPHPADOPTIONS];
@@ -580,7 +581,7 @@
return error;
format = GET_ULongLE();
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
- return FT_Err_Invalid_File_Format;
+ return PCF_Err_Invalid_File_Format;
if ( PCF_BYTE_ORDER( format ) == MSBFirst )
nbitmaps = GET_ULong();
@@ -588,7 +589,7 @@
nbitmaps = GET_ULongLE();
FT_Forget_Frame( stream );
if ( nbitmaps != face->nmetrics )
- return FT_Err_Invalid_File_Format;
+ return PCF_Err_Invalid_File_Format;
if ( ALLOC( offsets, nbitmaps * sizeof ( FT_ULong ) ) )
return error;
@@ -647,7 +648,7 @@
FT_Error pcf_get_encodings( FT_Stream stream,
PCF_Face face )
{
- FT_Error error = FT_Err_Ok;
+ FT_Error error = PCF_Err_Ok;
FT_Memory memory = FT_FACE(face)->memory;
FT_ULong format, size;
int firstCol, lastCol;
@@ -671,7 +672,7 @@
return error;
format = GET_ULongLE();
if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) )
- return FT_Err_Invalid_File_Format;
+ return PCF_Err_Invalid_File_Format;
if ( PCF_BYTE_ORDER( format ) == MSBFirst )
{
@@ -698,7 +699,7 @@
nencoding = ( lastCol - firstCol + 1 ) * ( lastRow - firstRow + 1 );
if ( ALLOC( tmpEncoding, nencoding * sizeof ( PCF_EncodingRec ) ) )
- return FT_Err_Out_Of_Memory;
+ return PCF_Err_Out_Of_Memory;
error = FT_Access_Frame( stream, 2 * nencoding );
if ( error )
@@ -799,7 +800,7 @@
FT_ULong type )
{
FT_ULong format, size;
- FT_Error error = FT_Err_Ok;
+ FT_Error error = PCF_Err_Ok;
PCF_Accel accel = &face->accel;
@@ -860,7 +861,7 @@
FT_Error pcf_load_font( FT_Stream stream,
PCF_Face face )
{
- FT_Error error = FT_Err_Ok;
+ FT_Error error = PCF_Err_Ok;
FT_Memory memory = FT_FACE(face)->memory;
FT_Bool hasBDFAccelerators;
@@ -1033,7 +1034,7 @@
face->charmap.face = root;
face->charmap_handle
- return FT_Err_Ok;
+ return PCF_Err_Ok;
}
#endif
}
@@ -1047,11 +1048,11 @@
face->charmap_handle = &face->charmap;
root->charmap = face->charmap_handle;
}
- return FT_Err_Ok;
+ return PCF_Err_Ok;
Bail:
PCF_Done_Face( face );
- return FT_Err_Invalid_File_Format;
+ return PCF_Err_Invalid_File_Format;
}