* include/freetype/internal/ftobjs.h, src/autohint/ahglyph.c,

src/base/ftobjs.c, src/objs/fttype1.c, src/sfnt/ttcmap0.c,
    src/smooth/ftgrays.c: changed uses of "setjmp" and "longjmp"
    to "ft_setjmp" and "ft_lonjmp". Removed direct references to
    <stdio.h> and <setjmp.h> when appropriate, to eventually replace
    them with a FT_CONFIG_STANDARD_LIBRARY_H. Useful for the XFree86
    Font Server backend based on FT2.
This commit is contained in:
David Turner 2002-06-10 23:03:35 +00:00
parent b1d8f73df6
commit 25a6e3a167
7 changed files with 61 additions and 46 deletions

View File

@ -1,3 +1,13 @@
2002-06-08 Juliusz Chroboczek <jch@pps.jussieu.fr>
* include/freetype/internal/ftobjs.h, src/autohint/ahglyph.c,
src/base/ftobjs.c, src/objs/fttype1.c, src/sfnt/ttcmap0.c,
src/smooth/ftgrays.c: changed uses of "setjmp" and "longjmp"
to "ft_setjmp" and "ft_lonjmp". Removed direct references to
<stdio.h> and <setjmp.h> when appropriate, to eventually replace
them with a FT_CONFIG_STANDARD_LIBRARY_H. Useful for the XFree86
Font Server backend based on FT2.
2002-06-08 David Turner <david@freetype.org> 2002-06-08 David Turner <david@freetype.org>
* src/pcf/pcfdriver.c (pcf_cmap_char_next): fixed a bug that caused * src/pcf/pcfdriver.c (pcf_cmap_char_next): fixed a bug that caused

View File

@ -26,8 +26,8 @@
#ifndef __FTOBJS_H__ #ifndef __FTOBJS_H__
#define __FTOBJS_H__ #define __FTOBJS_H__
#include <setjmp.h>
#include <ft2build.h> #include <ft2build.h>
#include FT_CONFIG_STANDARD_LIBRARY_H /* for ft_setjmp and ft_longjmp */
#include FT_RENDER_H #include FT_RENDER_H
#include FT_SIZES_H #include FT_SIZES_H
#include FT_INTERNAL_MEMORY_H #include FT_INTERNAL_MEMORY_H

View File

@ -26,11 +26,11 @@
#include "ahglobal.h" #include "ahglobal.h"
#include "aherrors.h" #include "aherrors.h"
#include <stdio.h>
#ifdef AH_DEBUG #ifdef AH_DEBUG
#include <stdio.h>
void void
ah_dump_edges( AH_Outline* outline ) ah_dump_edges( AH_Outline* outline )
{ {

View File

@ -37,15 +37,15 @@
valid->level = level; valid->level = level;
valid->error = 0; valid->error = 0;
} }
FT_BASE_DEF( FT_Int ) FT_BASE_DEF( FT_Int )
ft_validator_run( FT_Validator valid ) ft_validator_run( FT_Validator valid )
{ {
int result; int result;
result = setjmp( valid->jump_buffer );
result = ft_setjmp( valid->jump_buffer );
return result; return result;
} }
@ -55,8 +55,8 @@
FT_Error error ) FT_Error error )
{ {
valid->error = error; valid->error = error;
longjmp( valid->jump_buffer, 1 ); ft_longjmp( valid->jump_buffer, 1 );
} }
/*************************************************************************/ /*************************************************************************/
@ -619,18 +619,18 @@
/* discard charmaps */ /* discard charmaps */
{ {
FT_Int n; FT_Int n;
for ( n = 0; n < face->num_charmaps; n++ ) for ( n = 0; n < face->num_charmaps; n++ )
{ {
FT_CMap cmap = FT_CMAP( face->charmaps[n] ); FT_CMap cmap = FT_CMAP( face->charmaps[n] );
FT_CMap_Done( cmap ); FT_CMap_Done( cmap );
face->charmaps[n] = NULL; face->charmaps[n] = NULL;
} }
FT_FREE( face->charmaps ); FT_FREE( face->charmaps );
face->num_charmaps = 0; face->num_charmaps = 0;
} }
@ -1515,7 +1515,7 @@
if ( face && face->charmap ) if ( face && face->charmap )
{ {
FT_CMap cmap = FT_CMAP( face->charmap ); FT_CMap cmap = FT_CMAP( face->charmap );
result = cmap->clazz->char_index( cmap, charcode ); result = cmap->clazz->char_index( cmap, charcode );
} }
@ -2403,7 +2403,7 @@
/* documentation is in freetype.h */ /* documentation is in freetype.h */
FT_EXPORT_DEF( void ) FT_EXPORT_DEF( void )
FT_Library_Version( FT_Library library, FT_Library_Version( FT_Library library,
FT_Int *amajor, FT_Int *amajor,
@ -2414,23 +2414,23 @@
FT_Int minor = 0; FT_Int minor = 0;
FT_Int patch = 0; FT_Int patch = 0;
if ( library ) if ( library )
{ {
major = library->version_major; major = library->version_major;
minor = library->version_minor; minor = library->version_minor;
patch = library->version_patch; patch = library->version_patch;
} }
if ( *amajor ) if ( *amajor )
*amajor = major; *amajor = major;
if ( *aminor ) if ( *aminor )
*aminor = minor; *aminor = minor;
if ( *apatch ) if ( *apatch )
*apatch = patch; *apatch = patch;
} }
/* documentation is in ftmodule.h */ /* documentation is in ftmodule.h */

View File

@ -89,8 +89,8 @@
/* this will probably happen later... */ /* this will probably happen later... */
driver_name = face->driver->root.clazz->module_name; driver_name = face->driver->root.clazz->module_name;
result = ( ft_strcmp( driver_name, "type1" ) || result = ( ft_strcmp( driver_name, "type1" ) == 0 ||
ft_strcmp( driver_name, "cff" ) ); ft_strcmp( driver_name, "cff" ) == 0 );
} }
return result; return result;

View File

@ -742,42 +742,42 @@
FT_UInt min = 0; FT_UInt min = 0;
FT_UInt max = num_segs2 >> 1; FT_UInt max = num_segs2 >> 1;
FT_UInt mid, start, end, offset; FT_UInt mid, start, end, offset;
while ( min < max ) while ( min < max )
{ {
mid = ( min + max ) >> 1; mid = ( min + max ) >> 1;
p = table + 14 + mid * 2; p = table + 14 + mid * 2;
end = TT_NEXT_USHORT( p ); end = TT_NEXT_USHORT( p );
p += num_segs2; p += num_segs2;
start = TT_PEEK_USHORT( p); start = TT_PEEK_USHORT( p);
if ( code < start ) if ( code < start )
max = mid; max = mid;
else if ( code > end ) else if ( code > end )
min = mid + 1; min = mid + 1;
else else
{ {
/* we found the segment */ /* we found the segment */
idx = code; idx = code;
p += num_segs2; p += num_segs2;
delta = TT_PEEK_SHORT( p ); delta = TT_PEEK_SHORT( p );
p += num_segs2; p += num_segs2;
offset = TT_PEEK_USHORT( p ); offset = TT_PEEK_USHORT( p );
if ( offset != 0 ) if ( offset != 0 )
{ {
p += offset + 2 * ( idx - start ); p += offset + 2 * ( idx - start );
idx = TT_PEEK_USHORT( p ); idx = TT_PEEK_USHORT( p );
} }
if ( idx != 0 ) if ( idx != 0 )
result = (FT_UInt)( idx + delta ) & 0xFFFFU; result = (FT_UInt)( idx + delta ) & 0xFFFFU;
goto Exit; goto Exit;
} }
} }
@ -793,32 +793,32 @@
p = table + 14; /* ends table */ p = table + 14; /* ends table */
q = table + 16 + num_segs2; /* starts table */ q = table + 16 + num_segs2; /* starts table */
for ( n = 0; n < num_segs2; n += 2 ) for ( n = 0; n < num_segs2; n += 2 )
{ {
FT_UInt end = TT_NEXT_USHORT( p ); FT_UInt end = TT_NEXT_USHORT( p );
FT_UInt start = TT_NEXT_USHORT( q ); FT_UInt start = TT_NEXT_USHORT( q );
FT_UInt offset; FT_UInt offset;
if ( code < start ) if ( code < start )
break; break;
if ( code <= end ) if ( code <= end )
{ {
idx = code; idx = code;
p = q + num_segs2 - 2; p = q + num_segs2 - 2;
delta = TT_PEEK_SHORT( p ); delta = TT_PEEK_SHORT( p );
p += num_segs2; p += num_segs2;
offset = TT_PEEK_USHORT( p ); offset = TT_PEEK_USHORT( p );
if ( offset != 0 ) if ( offset != 0 )
{ {
p += offset + 2 * ( idx - start ); p += offset + 2 * ( idx - start );
idx = TT_PEEK_USHORT( p ); idx = TT_PEEK_USHORT( p );
} }
if ( idx != 0 ) if ( idx != 0 )
result = (FT_UInt)( idx + delta ) & 0xFFFFU; result = (FT_UInt)( idx + delta ) & 0xFFFFU;
} }
@ -828,7 +828,7 @@
#endif /* 0 */ #endif /* 0 */
} }
Exit: Exit:
return result; return result;
} }
@ -1032,7 +1032,7 @@
FT_UInt32 result = 0; FT_UInt32 result = 0;
FT_UInt32 char_code = *pchar_code + 1; FT_UInt32 char_code = *pchar_code + 1;
FT_UInt gindex = 0; FT_UInt gindex = 0;
FT_Byte* p = table + 6; FT_Byte* p = table + 6;
FT_UInt start = TT_NEXT_USHORT( p ); FT_UInt start = TT_NEXT_USHORT( p );
FT_UInt count = TT_NEXT_USHORT( p ); FT_UInt count = TT_NEXT_USHORT( p );
@ -1716,14 +1716,14 @@
if ( clazz->format == format ) if ( clazz->format == format )
{ {
volatile TT_ValidatorRec valid; volatile TT_ValidatorRec valid;
ft_validator_init( FT_VALIDATOR( &valid ), cmap, limit, ft_validator_init( FT_VALIDATOR( &valid ), cmap, limit,
FT_VALIDATE_DEFAULT ); FT_VALIDATE_DEFAULT );
valid.num_glyphs = face->root.num_glyphs; valid.num_glyphs = face->root.num_glyphs;
if ( setjmp( FT_VALIDATOR( &valid )->jump_buffer ) == 0 ) if ( ft_setjmp( FT_VALIDATOR( &valid )->jump_buffer ) == 0 )
{ {
/* validate this cmap sub-table */ /* validate this cmap sub-table */
clazz->validate( cmap, FT_VALIDATOR( &valid ) ); clazz->validate( cmap, FT_VALIDATOR( &valid ) );

View File

@ -106,6 +106,11 @@
#include <limits.h> #include <limits.h>
#define FT_UINT_MAX UINT_MAX #define FT_UINT_MAX UINT_MAX
#define ft_setjmp setjmp
#define ft_longjmp longjmp
#define ft_jmp_buf jmp_buf
#define ErrRaster_Invalid_Mode -2 #define ErrRaster_Invalid_Mode -2
#define ErrRaster_Invalid_Outline -1 #define ErrRaster_Invalid_Outline -1
@ -391,7 +396,7 @@
if ( !ras.invalid && ( ras.area | ras.cover ) ) if ( !ras.invalid && ( ras.area | ras.cover ) )
{ {
if ( ras.num_cells >= ras.max_cells ) if ( ras.num_cells >= ras.max_cells )
longjmp( ras.jump_buffer, 1 ); ft_longjmp( ras.jump_buffer, 1 );
cell = ras.cells + ras.num_cells++; cell = ras.cells + ras.num_cells++;
cell->x = ras.ex - ras.min_ex; cell->x = ras.ex - ras.min_ex;
@ -1355,7 +1360,7 @@
if ( ras.outline.flags & ft_outline_even_odd_fill ) if ( ras.outline.flags & ft_outline_even_odd_fill )
{ {
coverage &= 511; coverage &= 511;
if ( coverage > 256 ) if ( coverage > 256 )
coverage = 512 - coverage; coverage = 512 - coverage;
else if ( coverage == 256 ) else if ( coverage == 256 )
@ -1791,7 +1796,7 @@
volatile int error = 0; volatile int error = 0;
if ( setjmp( ras.jump_buffer ) == 0 ) if ( ft_setjmp( ras.jump_buffer ) == 0 )
{ {
error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras ); error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras );
gray_record_cell( RAS_VAR ); gray_record_cell( RAS_VAR );