Update more FT_Err_XXX macros using FT_ERR and FT_THROW;

* builds/amiga/src/base/ftsystem.c, builds/mac/ftmac.c,
builds/unix/ftsystem.c, builds/vms/ftsystem.c: Do it.
This commit is contained in:
Werner Lemberg 2013-05-17 17:40:27 +02:00
parent 2799133a6e
commit fd66469eba
5 changed files with 58 additions and 51 deletions

View File

@ -1,3 +1,10 @@
2013-05-17 Werner Lemberg <wl@gnu.org>
Update more FT_Err_XXX macros using FT_ERR and FT_THROW;
* builds/amiga/src/base/ftsystem.c, builds/mac/ftmac.c,
builds/unix/ftsystem.c, builds/vms/ftsystem.c: Do it.
2013-05-15 Werner Lemberg <wl@gnu.org>
[truetype] Add `interpreter-version' property.

View File

@ -4,7 +4,7 @@
/* */
/* Amiga-specific FreeType low-level system interface (body). */
/* */
/* Copyright 1996-2001, 2002, 2005, 2006, 2007, 2010 by */
/* Copyright 1996-2002, 2005-2007, 2010, 2013 by */
/* David Turner, Robert Wilhelm, Werner Lemberg and Detlef Würkner. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -386,7 +386,7 @@ Free_VecPooled( APTR poolHeader,
if ( !stream )
return FT_Err_Invalid_Stream_Handle;
return FT_THROW( Invalid_Stream_Handle );
#ifdef __amigaos4__
sysfile = AllocMem ( sizeof (struct SysFile ), MEMF_SHARED );
@ -398,7 +398,7 @@ Free_VecPooled( APTR poolHeader,
FT_ERROR(( "FT_Stream_Open:" ));
FT_ERROR(( " could not open `%s'\n", filepathname ));
return FT_Err_Cannot_Open_Resource;
return FT_THROW( Cannot_Open_Resource );
}
sysfile->file = Open( (STRPTR)filepathname, MODE_OLDFILE );
if ( !sysfile->file )
@ -407,7 +407,7 @@ Free_VecPooled( APTR poolHeader,
FT_ERROR(( "FT_Stream_Open:" ));
FT_ERROR(( " could not open `%s'\n", filepathname ));
return FT_Err_Cannot_Open_Resource;
return FT_THROW( Cannot_Open_Resource );
}
fib = AllocDosObject( DOS_FIB, NULL );
@ -418,7 +418,7 @@ Free_VecPooled( APTR poolHeader,
FT_ERROR(( "FT_Stream_Open:" ));
FT_ERROR(( " could not open `%s'\n", filepathname ));
return FT_Err_Cannot_Open_Resource;
return FT_THROW( Cannot_Open_Resource );
}
if ( !( ExamineFH( sysfile->file, fib ) ) )
{
@ -428,7 +428,7 @@ Free_VecPooled( APTR poolHeader,
FT_ERROR(( "FT_Stream_Open:" ));
FT_ERROR(( " could not open `%s'\n", filepathname ));
return FT_Err_Cannot_Open_Resource;
return FT_THROW( Cannot_Open_Resource );
}
stream->size = fib->fib_Size;
FreeDosObject( DOS_FIB, fib );
@ -447,7 +447,7 @@ Free_VecPooled( APTR poolHeader,
ft_amiga_stream_close( stream );
FT_ERROR(( "FT_Stream_Open:" ));
FT_ERROR(( " opened `%s' but zero-sized\n", filepathname ));
return FT_Err_Cannot_Open_Stream;;
return FT_THROW( Cannot_Open_Stream );
}
FT_TRACE1(( "FT_Stream_Open:" ));

View File

@ -5,7 +5,7 @@
/* Mac FOND support. Written by just@letterror.com. */
/* Heavily Fixed by mpsuzuki, George Williams and Sean McBride */
/* */
/* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */
/* Copyright 1996-2008, 2013 by */
/* Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -184,7 +184,7 @@ typedef short ResourceIndex;
FT_UNUSED( pathSpec );
FT_UNUSED( face_index );
return FT_Err_Unimplemented_Feature;
return FT_THROW( Unimplemented_Feature );
}
#else
@ -270,7 +270,7 @@ typedef short ResourceIndex;
return FT_Err_Ok;
}
else
return FT_Err_Unknown_File_Format;
return FT_THROW( Unknown_File_Format );
}
#endif /* HAVE_QUICKDRAW_CARBON */
@ -323,10 +323,10 @@ typedef short ResourceIndex;
CFRelease( cf_fontName );
if ( ats_font_id == 0 || ats_font_id == 0xFFFFFFFFUL )
return FT_Err_Unknown_File_Format;
return FT_THROW( Unknown_File_Format );
if ( noErr != FT_ATSFontGetFileReference( ats_font_id, ats_font_ref ) )
return FT_Err_Unknown_File_Format;
return FT_THROW( Unknown_File_Format );
/* face_index calculation by searching preceding fontIDs */
/* with same FSRef */
@ -365,7 +365,7 @@ typedef short ResourceIndex;
FT_UNUSED( maxPathSize );
FT_UNUSED( face_index );
return FT_Err_Unimplemented_Feature;
return FT_THROW( Unimplemented_Feature );
}
#else
@ -385,7 +385,7 @@ typedef short ResourceIndex;
return err;
if ( noErr != FSRefMakePath( &ref, path, maxPathSize ) )
return FT_Err_Unknown_File_Format;
return FT_THROW( Unknown_File_Format );
return FT_Err_Ok;
}
@ -404,7 +404,7 @@ typedef short ResourceIndex;
FT_UNUSED( pathSpec );
FT_UNUSED( face_index );
return FT_Err_Unimplemented_Feature;
return FT_THROW( Unimplemented_Feature );
}
#else
@ -425,7 +425,7 @@ typedef short ResourceIndex;
if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone, NULL, NULL,
pathSpec, NULL ) )
return FT_Err_Unknown_File_Format;
return FT_THROW( Unknown_File_Format );
return FT_Err_Ok;
}
@ -580,7 +580,7 @@ typedef short ResourceIndex;
if ( noErr != FSPathMakeRef( pathname, &ref, FALSE ) )
return FT_Err_Cannot_Open_Resource;
return FT_THROW( Cannot_Open_Resource );
/* at present, no support for dfont format */
err = FSOpenResourceFile( &ref, 0, NULL, fsRdPerm, res );
@ -598,7 +598,7 @@ typedef short ResourceIndex;
if ( noErr != FT_FSPathMakeSpec( pathname, &spec, FALSE ) )
return FT_Err_Cannot_Open_Resource;
return FT_THROW( Cannot_Open_Resource );
/* at present, no support for dfont format without FSRef */
/* (see above), try original resource-fork font */
@ -847,17 +847,17 @@ typedef short ResourceIndex;
/* We should not extract parent directory by string manipulation. */
if ( noErr != FSPathMakeRef( path_fond, &ref, FALSE ) )
return FT_Err_Invalid_Argument;
return FT_THROW( Invalid_Argument );
if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone,
NULL, NULL, NULL, &par_ref ) )
return FT_Err_Invalid_Argument;
return FT_THROW( Invalid_Argument );
if ( noErr != FSRefMakePath( &par_ref, path_lwfn, path_size ) )
return FT_Err_Invalid_Argument;
return FT_THROW( Invalid_Argument );
if ( ft_strlen( (char *)path_lwfn ) + 1 + base_lwfn[0] > path_size )
return FT_Err_Invalid_Argument;
return FT_THROW( Invalid_Argument );
/* now we have absolute dirname in path_lwfn */
if ( path_lwfn[0] == '/' )
@ -870,11 +870,11 @@ typedef short ResourceIndex;
path_lwfn[dirname_len + base_lwfn[0]] = '\0';
if ( noErr != FSPathMakeRef( path_lwfn, &ref, FALSE ) )
return FT_Err_Cannot_Open_Resource;
return FT_THROW( Cannot_Open_Resource );
if ( noErr != FSGetCatalogInfo( &ref, kFSCatInfoNone,
NULL, NULL, NULL, NULL ) )
return FT_Err_Cannot_Open_Resource;
return FT_THROW( Cannot_Open_Resource );
return FT_Err_Ok;
@ -886,7 +886,7 @@ typedef short ResourceIndex;
/* pathname for FSSpec is always HFS format */
if ( ft_strlen( (char *)path_fond ) > path_size )
return FT_Err_Invalid_Argument;
return FT_THROW( Invalid_Argument );
ft_strcpy( (char *)path_lwfn, (char *)path_fond );
@ -895,7 +895,7 @@ typedef short ResourceIndex;
i--;
if ( i + 1 + base_lwfn[0] > path_size )
return FT_Err_Invalid_Argument;
return FT_THROW( Invalid_Argument );
if ( ':' == path_lwfn[i] )
{
@ -909,7 +909,7 @@ typedef short ResourceIndex;
}
if ( noErr != FT_FSPathMakeSpec( path_lwfn, &spec, FALSE ) )
return FT_Err_Cannot_Open_Resource;
return FT_THROW( Cannot_Open_Resource );
return FT_Err_Ok;
@ -1003,7 +1003,7 @@ typedef short ResourceIndex;
/* detect integer overflows */
if ( total_size < old_total_size )
{
error = FT_Err_Array_Too_Large;
error = FT_ERR( Array_Too_Large );
goto Error;
}
@ -1088,7 +1088,7 @@ typedef short ResourceIndex;
if ( noErr != FT_FSPathMakeRes( pathname, &res ) )
return FT_Err_Cannot_Open_Resource;
return FT_THROW( Cannot_Open_Resource );
pfb_data = NULL;
pfb_size = 0;
@ -1123,7 +1123,7 @@ typedef short ResourceIndex;
sfnt = GetResource( TTAG_sfnt, sfnt_id );
if ( sfnt == NULL )
return FT_Err_Invalid_Handle;
return FT_THROW( Invalid_Handle );
sfnt_size = (FT_ULong)GetHandleSize( sfnt );
if ( FT_ALLOC( sfnt_data, (FT_Long)sfnt_size ) )
@ -1182,7 +1182,7 @@ typedef short ResourceIndex;
FT_Long face_index,
FT_Face* aface )
{
FT_Error error = FT_Err_Cannot_Open_Resource;
FT_Error error = FT_ERR( Cannot_Open_Resource );
ResFileRefNum res_ref;
ResourceIndex res_index;
Handle fond;
@ -1190,11 +1190,11 @@ typedef short ResourceIndex;
if ( noErr != FT_FSPathMakeRes( pathname, &res_ref ) )
return FT_Err_Cannot_Open_Resource;
return FT_THROW( Cannot_Open_Resource );
UseResFile( res_ref );
if ( ResError() )
return FT_Err_Cannot_Open_Resource;
return FT_THROW( Cannot_Open_Resource );
num_faces_in_res = 0;
for ( res_index = 1; ; ++res_index )
@ -1239,7 +1239,7 @@ typedef short ResourceIndex;
GetResInfo( fond, &fond_id, &fond_type, fond_name );
if ( ResError() != noErr || fond_type != TTAG_FOND )
return FT_Err_Invalid_File_Format;
return FT_THROW( Invalid_File_Format );
HLock( fond );
parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, face_index );
@ -1322,7 +1322,7 @@ typedef short ResourceIndex;
face_index,
aface );
else
error = FT_Err_Unknown_File_Format;
error = FT_ERR( Unknown_File_Format );
found_no_lwfn_file:
if ( have_sfnt && FT_Err_Ok != error )
@ -1389,7 +1389,7 @@ typedef short ResourceIndex;
/* test for valid `library' and `aface' delayed to FT_Open_Face() */
if ( !pathname )
return FT_Err_Invalid_Argument;
return FT_THROW( Invalid_Argument );
error = FT_Err_Ok;
*aface = NULL;
@ -1432,7 +1432,7 @@ typedef short ResourceIndex;
FT_UNUSED( face_index );
FT_UNUSED( aface );
return FT_Err_Unimplemented_Feature;
return FT_THROW( Unimplemented_Feature );
#else
@ -1443,11 +1443,11 @@ typedef short ResourceIndex;
if ( !ref )
return FT_Err_Invalid_Argument;
return FT_THROW( Invalid_Argument );
err = FSRefMakePath( ref, pathname, sizeof ( pathname ) );
if ( err )
error = FT_Err_Cannot_Open_Resource;
error = FT_ERR( Cannot_Open_Resource );
error = FT_New_Face_From_Resource( library, pathname, face_index, aface );
if ( error != 0 || *aface != NULL )
@ -1487,7 +1487,7 @@ typedef short ResourceIndex;
if ( !spec || FSpMakeFSRef( spec, &ref ) != noErr )
return FT_Err_Invalid_Argument;
return FT_THROW( Invalid_Argument );
else
return FT_New_Face_From_FSRef( library, &ref, face_index, aface );
@ -1500,11 +1500,11 @@ typedef short ResourceIndex;
if ( !spec )
return FT_Err_Invalid_Argument;
return FT_THROW( Invalid_Argument );
err = FT_FSpMakePath( spec, pathname, sizeof ( pathname ) );
if ( err )
error = FT_Err_Cannot_Open_Resource;
error = FT_ERR( Cannot_Open_Resource );
error = FT_New_Face_From_Resource( library, pathname, face_index, aface );
if ( error != 0 || *aface != NULL )
@ -1522,7 +1522,7 @@ typedef short ResourceIndex;
FT_UNUSED( face_index );
FT_UNUSED( aface );
return FT_Err_Unimplemented_Feature;
return FT_THROW( Unimplemented_Feature );
#endif /* HAVE_FSREF, HAVE_FSSPEC */

View File

@ -4,7 +4,7 @@
/* */
/* Unix-specific FreeType low-level system interface (body). */
/* */
/* Copyright 1996-2001, 2002, 2004, 2005, 2006, 2007, 2008 by */
/* Copyright 1996-2002, 2004-2008, 2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -235,7 +235,7 @@
if ( !stream )
return FT_Err_Invalid_Stream_Handle;
return FT_THROW( Invalid_Stream_Handle );
/* open the file */
file = open( filepathname, O_RDONLY );
@ -243,7 +243,7 @@
{
FT_ERROR(( "FT_Stream_Open:" ));
FT_ERROR(( " could not open `%s'\n", filepathname ));
return FT_Err_Cannot_Open_Resource;
return FT_THROW( Cannot_Open_Resource );
}
/* Here we ensure that a "fork" will _not_ duplicate */
@ -365,7 +365,7 @@
stream->size = 0;
stream->pos = 0;
return FT_Err_Cannot_Open_Stream;
return FT_THROW( Cannot_Open_Stream );
}

View File

@ -4,7 +4,7 @@
/* */
/* VMS-specific FreeType low-level system interface (body). */
/* */
/* Copyright 1996-2001, 2002, 2005, 2010 by */
/* Copyright 1996-2002, 2005, 2010, 2013 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@ -212,7 +212,7 @@
if ( !stream )
return FT_Err_Invalid_Stream_Handle;
return FT_THROW( Invalid_Stream_Handle );
/* open the file */
file = open( filepathname, O_RDONLY );
@ -220,7 +220,7 @@
{
FT_ERROR(( "FT_Stream_Open:" ));
FT_ERROR(( " could not open `%s'\n", filepathname ));
return FT_Err_Cannot_Open_Resource;
return FT_THROW( Cannot_Open_Resource );
}
if ( fstat( file, &stat_buf ) < 0 )
@ -274,7 +274,7 @@
stream->size = 0;
stream->pos = 0;
return FT_Err_Cannot_Open_Stream;
return FT_THROW( Cannot_Open_Stream );
}