diff --git a/ChangeLog b/ChangeLog index 2ef631b72..dc9b6856c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-12-18 Werner Lemberg + + * src/*/*: Only use `ft_' and `FT_' variants of stdc library stuff. + 2017-12-18 Werner Lemberg * src/truetype/ttgxvar.c (tt_face_vary_cvt): Add size guard (#52688). diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c index 242246bfd..560b41e95 100644 --- a/src/base/ftdbgmem.c +++ b/src/base/ftdbgmem.c @@ -826,7 +826,7 @@ FT_Int result = 0; - if ( getenv( "FT2_DEBUG_MEMORY" ) ) + if ( ft_getenv( "FT2_DEBUG_MEMORY" ) ) { table = ft_mem_table_new( memory ); if ( table ) @@ -839,7 +839,7 @@ memory->realloc = ft_mem_debug_realloc; memory->free = ft_mem_debug_free; - p = getenv( "FT2_ALLOC_TOTAL_MAX" ); + p = ft_getenv( "FT2_ALLOC_TOTAL_MAX" ); if ( p ) { FT_Long total_max = ft_strtol( p, NULL, 10 ); @@ -852,7 +852,7 @@ } } - p = getenv( "FT2_ALLOC_COUNT_MAX" ); + p = ft_getenv( "FT2_ALLOC_COUNT_MAX" ); if ( p ) { FT_Long total_count = ft_strtol( p, NULL, 10 ); @@ -865,7 +865,7 @@ } } - p = getenv( "FT2_KEEP_ALIVE" ); + p = ft_getenv( "FT2_KEEP_ALIVE" ); if ( p ) { FT_Long keep_alive = ft_strtol( p, NULL, 10 ); diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c index 20c617089..dbcf585c2 100644 --- a/src/base/ftdebug.c +++ b/src/base/ftdebug.c @@ -161,7 +161,7 @@ FT_BASE_DEF( void ) ft_debug_init( void ) { - const char* ft2_debug = getenv( "FT2_DEBUG" ); + const char* ft2_debug = ft_getenv( "FT2_DEBUG" ); if ( ft2_debug ) diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index fb7781000..ca937f89c 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -813,7 +813,7 @@ THE SOFTWARE. bitmap->rows = glyph.bbx.height; bitmap->width = glyph.bbx.width; - if ( glyph.bpr > INT_MAX ) + if ( glyph.bpr > FT_INT_MAX ) FT_TRACE1(( "BDF_Glyph_Load: too large pitch %d is truncated\n", glyph.bpr )); bitmap->pitch = (int)glyph.bpr; /* same as FT_Bitmap.pitch */ diff --git a/src/bdf/bdflib.c b/src/bdf/bdflib.c index bf10887fd..2f5c99d54 100644 --- a/src/bdf/bdflib.c +++ b/src/bdf/bdflib.c @@ -705,11 +705,11 @@ for ( v = 0; sbitset( ddigits, *s ); s++ ) { - if ( v < ( ULONG_MAX - 9 ) / 10 ) + if ( v < ( FT_ULONG_MAX - 9 ) / 10 ) v = v * 10 + a2i[(int)*s]; else { - v = ULONG_MAX; + v = FT_ULONG_MAX; break; } } @@ -738,11 +738,11 @@ for ( v = 0; sbitset( ddigits, *s ); s++ ) { - if ( v < ( LONG_MAX - 9 ) / 10 ) + if ( v < ( FT_LONG_MAX - 9 ) / 10 ) v = v * 10 + a2i[(int)*s]; else { - v = LONG_MAX; + v = FT_LONG_MAX; break; } } @@ -763,11 +763,11 @@ for ( v = 0; sbitset( ddigits, *s ); s++ ) { - if ( v < ( USHRT_MAX - 9 ) / 10 ) + if ( v < ( FT_USHORT_MAX - 9 ) / 10 ) v = (unsigned short)( v * 10 + a2i[(int)*s] ); else { - v = USHRT_MAX; + v = FT_USHORT_MAX; break; } } diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 975f67bee..937438e3d 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1556,13 +1556,13 @@ FT_UInt lenNDV, FT_Fixed* NDV ) { - if ( !blend->builtBV || - blend->lastVsindex != vsindex || - blend->lenNDV != lenNDV || - ( lenNDV && - memcmp( NDV, - blend->lastNDV, - lenNDV * sizeof ( *NDV ) ) != 0 ) ) + if ( !blend->builtBV || + blend->lastVsindex != vsindex || + blend->lenNDV != lenNDV || + ( lenNDV && + ft_memcmp( NDV, + blend->lastNDV, + lenNDV * sizeof ( *NDV ) ) != 0 ) ) { /* need to build blend vector */ return TRUE; diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index d4b6e5941..b70e3b5cc 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -413,7 +413,7 @@ remove_subset_prefix( FT_String* name ) { FT_Int32 idx = 0; - FT_Int32 length = (FT_Int32)strlen( name ) + 1; + FT_Int32 length = (FT_Int32)ft_strlen( name ) + 1; FT_Bool continue_search = 1; @@ -450,8 +450,8 @@ FT_Int32 family_name_length, style_name_length; - family_name_length = (FT_Int32)strlen( family_name ); - style_name_length = (FT_Int32)strlen( style_name ); + family_name_length = (FT_Int32)ft_strlen( family_name ); + style_name_length = (FT_Int32)ft_strlen( style_name ); if ( family_name_length > style_name_length ) { diff --git a/src/sfnt/pngshim.c b/src/sfnt/pngshim.c index 4c0d00705..fdc6b2aa4 100644 --- a/src/sfnt/pngshim.c +++ b/src/sfnt/pngshim.c @@ -103,7 +103,7 @@ v82 m0 = { 1, 0, 3, 2, 5, 4, 7, 6 }; - memcpy( &s, base, 16 ); /* RGBA RGBA RGBA RGBA */ + ft_memcpy( &s, base, 16 ); /* RGBA RGBA RGBA RGBA */ s0 = s & n0xFF; /* R B R B R B R B */ s1 = s >> n8; /* G A G A G A G A */ @@ -119,7 +119,7 @@ s1 = ( s1 + ( s1 >> n8 ) ) >> n8; s = s0 | ( s1 << n8 ); - memcpy( base, &s, 16 ); + ft_memcpy( base, &s, 16 ); } } #endif /* use `vector_size' */ @@ -237,7 +237,7 @@ return; } - memcpy( data, stream->cursor, length ); + ft_memcpy( data, stream->cursor, length ); FT_FRAME_EXIT(); } diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c index 01f2f26fe..f960ce600 100644 --- a/src/truetype/ttgload.c +++ b/src/truetype/ttgload.c @@ -1774,7 +1774,7 @@ /* clear the nodes filled by sibling chains */ node = ft_list_get_node_at( &loader->composites, recurse_count ); for ( node2 = node; node2; node2 = node2->next ) - node2->data = (void*)ULONG_MAX; + node2->data = (void*)FT_ULONG_MAX; /* check whether we already have a composite glyph with this index */ if ( FT_List_Find( &loader->composites, diff --git a/src/truetype/ttsubpix.c b/src/truetype/ttsubpix.c index 02058751a..3f473f850 100644 --- a/src/truetype/ttsubpix.c +++ b/src/truetype/ttsubpix.c @@ -753,24 +753,24 @@ /* Does font name match rule family? */ - if ( strcmp( detected_font_name, rule_font_name ) == 0 ) + if ( ft_strcmp( detected_font_name, rule_font_name ) == 0 ) return TRUE; /* Is font name a wildcard ""? */ - if ( strcmp( rule_font_name, "" ) == 0 ) + if ( ft_strcmp( rule_font_name, "" ) == 0 ) return TRUE; /* Is font name contained in a class list? */ for ( i = 0; i < FAMILY_CLASS_RULES_SIZE; i++ ) { - if ( strcmp( FAMILY_CLASS_Rules[i].name, rule_font_name ) == 0 ) + if ( ft_strcmp( FAMILY_CLASS_Rules[i].name, rule_font_name ) == 0 ) { for ( j = 0; j < SPH_MAX_CLASS_MEMBERS; j++ ) { - if ( strcmp( FAMILY_CLASS_Rules[i].member[j], "" ) == 0 ) + if ( ft_strcmp( FAMILY_CLASS_Rules[i].member[j], "" ) == 0 ) continue; - if ( strcmp( FAMILY_CLASS_Rules[i].member[j], - detected_font_name ) == 0 ) + if ( ft_strcmp( FAMILY_CLASS_Rules[i].member[j], + detected_font_name ) == 0 ) return TRUE; } } @@ -788,24 +788,24 @@ /* Does font style match rule style? */ - if ( strcmp( detected_font_style, rule_font_style ) == 0 ) + if ( ft_strcmp( detected_font_style, rule_font_style ) == 0 ) return TRUE; /* Is font style a wildcard ""? */ - if ( strcmp( rule_font_style, "" ) == 0 ) + if ( ft_strcmp( rule_font_style, "" ) == 0 ) return TRUE; /* Is font style contained in a class list? */ for ( i = 0; i < STYLE_CLASS_RULES_SIZE; i++ ) { - if ( strcmp( STYLE_CLASS_Rules[i].name, rule_font_style ) == 0 ) + if ( ft_strcmp( STYLE_CLASS_Rules[i].name, rule_font_style ) == 0 ) { for ( j = 0; j < SPH_MAX_CLASS_MEMBERS; j++ ) { - if ( strcmp( STYLE_CLASS_Rules[i].member[j], "" ) == 0 ) + if ( ft_strcmp( STYLE_CLASS_Rules[i].member[j], "" ) == 0 ) continue; - if ( strcmp( STYLE_CLASS_Rules[i].member[j], - detected_font_style ) == 0 ) + if ( ft_strcmp( STYLE_CLASS_Rules[i].member[j], + detected_font_style ) == 0 ) return TRUE; } }