Fix clang warnings.

* include/freetype/internal/autohint.h
(FT_DECLARE_AUTOHINTER_INTERFACE): New macro.
* src/autofit/afmodule.h: Use it to declare
`af_autofitter_interface'.

* include/freetype/internal/ftobjs.h (FT_DECLARE_GLYPH): New macro.
* src/base/ftbase.h: Use it to declare `ft_bitmap_glyph_class' and
`ft_outline_glyph_class'.

* src/base/ftglyph.c: Include `ftbase.h'.

* src/cff/cffparse.c (cff_parser_run): Fix type of `t2_size'.

* src/pcf/pcfdrivr.c (pcf_cmap_char_next): Fix type of `result'.

* src/psaux/psauxmod.c (psaux_module_class): Use `FT_DEFINE_MODULE'.
* src/psaux/psauxmod.h: Declare `afm_parser_funcs',
`t1_cmap_classes', `cff_decoder_funcs', and `psaux_module_class'.

* src/pshinter/pshmod.c: Include `pshmod.h'.

* src/sfnt/sfwoff2.c (ROUND4, WRITE_SHORT): Fix implicit sign
conversion.
(compute_ULong_sum): Fix return type.
Fix implicit sign conversion.
(store_points): Fix type of `last_flag', `repeat_count', and `flag'.
Use casts to avoid warnings.
(reconstruct_glyf): Fix implicit sign conversion.
Use cast to avoid warning.
(get_x_mins): Fix implicit sign conversion.
* src/sfnt/ttcmap.c: Undef `TTCMAPCITEM'.
* src/sfnt/ttcmap.h: Define `TTCMAPCITEM' and include `ttcmapc.h' to
declare cmap classes.

* src/smooth/ftsmooth.c (ft_smooth_overlap_spans): Use cast.

* src/truetype/ttinterp.c (Ins_MIAP): Fix typo.
This commit is contained in:
Werner Lemberg 2020-07-07 16:58:14 +02:00
parent 0f35b042e0
commit 96fb73efd5
18 changed files with 119 additions and 42 deletions

View File

@ -1,3 +1,45 @@
2020-07-07 Werner Lemberg <wl@gnu.org>
Fix clang warnings.
* include/freetype/internal/autohint.h
(FT_DECLARE_AUTOHINTER_INTERFACE): New macro.
* src/autofit/afmodule.h: Use it to declare
`af_autofitter_interface'.
* include/freetype/internal/ftobjs.h (FT_DECLARE_GLYPH): New macro.
* src/base/ftbase.h: Use it to declare `ft_bitmap_glyph_class' and
`ft_outline_glyph_class'.
* src/base/ftglyph.c: Include `ftbase.h'.
* src/cff/cffparse.c (cff_parser_run): Fix type of `t2_size'.
* src/pcf/pcfdrivr.c (pcf_cmap_char_next): Fix type of `result'.
* src/psaux/psauxmod.c (psaux_module_class): Use `FT_DEFINE_MODULE'.
* src/psaux/psauxmod.h: Declare `afm_parser_funcs',
`t1_cmap_classes', `cff_decoder_funcs', and `psaux_module_class'.
* src/pshinter/pshmod.c: Include `pshmod.h'.
* src/sfnt/sfwoff2.c (ROUND4, WRITE_SHORT): Fix implicit sign
conversion.
(compute_ULong_sum): Fix return type.
Fix implicit sign conversion.
(store_points): Fix type of `last_flag', `repeat_count', and `flag'.
Use casts to avoid warnings.
(reconstruct_glyf): Fix implicit sign conversion.
Use cast to avoid warning.
(get_x_mins): Fix implicit sign conversion.
* src/sfnt/ttcmap.c: Undef `TTCMAPCITEM'.
* src/sfnt/ttcmap.h: Define `TTCMAPCITEM' and include `ttcmapc.h' to
declare cmap classes.
* src/smooth/ftsmooth.c (ft_smooth_overlap_spans): Use cast.
* src/truetype/ttinterp.c (Ins_MIAP): Fix typo.
2020-07-07 David Turner <david@freetype.org>
[build] Really fix multi and C++ builds.

View File

@ -207,6 +207,9 @@ FT_BEGIN_HEADER
} FT_AutoHinter_InterfaceRec, *FT_AutoHinter_Interface;
#define FT_DECLARE_AUTOHINTER_INTERFACE( class_ ) \
FT_CALLBACK_TABLE const FT_AutoHinter_InterfaceRec class_;
#define FT_DEFINE_AUTOHINTER_INTERFACE( \
class_, \
reset_face_, \

View File

@ -226,8 +226,8 @@ FT_BEGIN_HEADER
} FT_CMap_ClassRec;
#define FT_DECLARE_CMAP_CLASS( class_ ) \
FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;
#define FT_DECLARE_CMAP_CLASS( class_ ) \
FT_CALLBACK_TABLE const FT_CMap_ClassRec class_;
#define FT_DEFINE_CMAP_CLASS( \
class_, \
@ -1057,6 +1057,9 @@ FT_BEGIN_HEADER
* The struct will be allocated in the global scope (or the scope where
* the macro is used).
*/
#define FT_DECLARE_GLYPH( class_ ) \
FT_CALLBACK_TABLE const FT_Glyph_Class class_;
#define FT_DEFINE_GLYPH( \
class_, \
size_, \

View File

@ -550,8 +550,8 @@
NULL, /* reset_face */
NULL, /* get_global_hints */
NULL, /* done_global_hints */
(FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph ) /* load_glyph */
(FT_AutoHinter_GlyphLoadFunc)af_autofitter_load_glyph /* load_glyph */
)
FT_DEFINE_MODULE(
autofit_module_class,

View File

@ -46,6 +46,7 @@ FT_BEGIN_HEADER
} AF_ModuleRec, *AF_Module;
FT_DECLARE_AUTOHINTER_INTERFACE( af_autofitter_interface )
FT_DECLARE_MODULE( autofit_module_class )

View File

@ -26,6 +26,10 @@
FT_BEGIN_HEADER
FT_DECLARE_GLYPH( ft_bitmap_glyph_class )
FT_DECLARE_GLYPH( ft_outline_glyph_class )
#ifdef FT_CONFIG_OPTION_MAC_FONTS
/* MacOS resource fork cannot exceed 16MB at least for Carbon code; */

View File

@ -35,6 +35,8 @@
#include <freetype/ftbitmap.h>
#include <freetype/internal/ftobjs.h>
#include "ftbase.h"
/**************************************************************************
*

View File

@ -43,7 +43,7 @@ FT_BEGIN_HEADER
} CFF_CMapStdRec;
FT_DECLARE_CMAP_CLASS(cff_cmap_encoding_class_rec)
FT_DECLARE_CMAP_CLASS( cff_cmap_encoding_class_rec )
/*************************************************************************/
@ -56,7 +56,7 @@ FT_BEGIN_HEADER
/* unicode (synthetic) cmaps */
FT_DECLARE_CMAP_CLASS(cff_cmap_unicode_class_rec)
FT_DECLARE_CMAP_CLASS( cff_cmap_unicode_class_rec )
FT_END_HEADER

View File

@ -1263,11 +1263,11 @@
FT_Byte* charstring_base;
FT_ULong charstring_len;
FT_Fixed* stack;
FT_ListNode node;
CFF_T2_String t2;
size_t t2_size;
FT_Byte* q;
FT_Fixed* stack;
FT_ListNode node;
CFF_T2_String t2;
FT_Fixed t2_size;
FT_Byte* q;
charstring_base = ++p;

View File

@ -136,7 +136,7 @@ THE SOFTWARE.
FT_UInt32 charcode = *acharcode;
FT_UShort charcodeRow;
FT_UShort charcodeCol;
FT_Int result = 0;
FT_UInt result = 0;
while ( charcode < (FT_UInt32)( enc->lastRow * 256 + enc->lastCol ) )

View File

@ -170,9 +170,9 @@
};
FT_CALLBACK_TABLE_DEF
const FT_Module_Class psaux_module_class =
{
FT_DEFINE_MODULE(
psaux_module_class,
0,
sizeof ( FT_ModuleRec ),
"psaux",
@ -184,7 +184,7 @@
(FT_Module_Constructor)NULL, /* module_init */
(FT_Module_Destructor) NULL, /* module_done */
(FT_Module_Requester) NULL /* get_interface */
};
)
/* END */

View File

@ -34,10 +34,24 @@ FT_BEGIN_HEADER
FT_CALLBACK_TABLE
const PS_Builder_FuncsRec ps_builder_funcs;
#ifndef T1_CONFIG_OPTION_NO_AFM
FT_CALLBACK_TABLE
const AFM_Parser_FuncsRec afm_parser_funcs;
#endif
FT_CALLBACK_TABLE
const T1_CMap_ClassesRec t1_cmap_classes;
FT_CALLBACK_TABLE
const CFF_Decoder_FuncsRec cff_decoder_funcs;
FT_EXPORT_VAR( const FT_Module_Class ) psaux_driver_class;
FT_DECLARE_MODULE( psaux_module_class )
FT_END_HEADER
#endif /* PSAUXMOD_H_ */

View File

@ -19,6 +19,7 @@
#include <freetype/internal/ftobjs.h>
#include "pshrec.h"
#include "pshalgo.h"
#include "pshmod.h"
/* the Postscript Hinter module structure */

View File

@ -43,7 +43,8 @@
#define READ_BASE128( var ) FT_SET_ERROR( ReadBase128( stream, &var ) )
#define ROUND4( var ) ( ( var + 3 ) & ~3 )
/* `var' should be FT_ULong */
#define ROUND4( var ) ( ( var + 3 ) & ~3UL )
#define WRITE_USHORT( p, v ) \
do \
@ -63,12 +64,12 @@
\
} while ( 0 )
#define WRITE_SHORT( p, v ) \
do \
{ \
*(p)++ = ( (v) >> 8 ); \
*(p)++ = ( (v) >> 0 ); \
\
#define WRITE_SHORT( p, v ) \
do \
{ \
*(p)++ = (FT_Byte)( (v) >> 8 ); \
*(p)++ = (FT_Byte)( (v) >> 0 ); \
\
} while ( 0 )
#define WRITE_SFNT_BUF( buf, s ) \
@ -280,12 +281,12 @@
/* Calculate table checksum of `buf'. */
static FT_Long
static FT_ULong
compute_ULong_sum( FT_Byte* buf,
FT_ULong size )
{
FT_ULong checksum = 0;
FT_ULong aligned_size = size & ~3;
FT_ULong aligned_size = size & ~3UL;
FT_ULong i;
FT_ULong v;
@ -536,12 +537,12 @@
FT_ULong* glyph_size )
{
FT_UInt flag_offset = 10 + ( 2 * n_contours ) + 2 + instruction_len;
FT_Int last_flag = -1;
FT_Int repeat_count = 0;
FT_Int last_x = 0;
FT_Int last_y = 0;
FT_UInt x_bytes = 0;
FT_UInt y_bytes = 0;
FT_Byte last_flag = 0xFFU;
FT_Byte repeat_count = 0;
FT_Int last_x = 0;
FT_Int last_y = 0;
FT_UInt x_bytes = 0;
FT_UInt y_bytes = 0;
FT_UInt xy_bytes;
FT_UInt i;
FT_UInt x_offset;
@ -553,9 +554,9 @@
{
const WOFF2_PointRec point = points[i];
FT_Int flag = point.on_curve ? GLYF_ON_CURVE : 0;
FT_Int dx = point.x - last_x;
FT_Int dy = point.y - last_y;
FT_Byte flag = point.on_curve ? GLYF_ON_CURVE : 0;
FT_Int dx = point.x - last_x;
FT_Int dy = point.y - last_y;
if ( dx == 0 )
@ -632,7 +633,7 @@
if ( dx == 0 )
;
else if ( dx > -256 && dx < 256 )
dst[x_offset++] = FT_ABS( dx );
dst[x_offset++] = (FT_Byte)FT_ABS( dx );
else
{
pointer = dst + x_offset;
@ -645,7 +646,7 @@
if ( dy == 0 )
;
else if ( dy > -256 && dy < 256 )
dst[y_offset++] = FT_ABS( dy );
dst[y_offset++] = (FT_Byte)FT_ABS( dy );
else
{
pointer = dst + y_offset;
@ -917,7 +918,7 @@
bbox_bitmap_offset = substreams[BBOX_STREAM].offset;
/* Size of bboxBitmap = 4 * floor((numGlyphs + 31) / 32) */
bitmap_length = ( ( num_glyphs + 31 ) >> 5 ) << 2;
bitmap_length = ( ( num_glyphs + 31U ) >> 5 ) << 2;
substreams[BBOX_STREAM].offset += bitmap_length;
glyph_buf_size = WOFF2_DEFAULT_GLYPH_BUF;
@ -1195,7 +1196,7 @@
/* Store x_mins, may be required to reconstruct `hmtx'. */
if ( n_contours > 0 )
info->x_mins[i] = x_min;
info->x_mins[i] = (FT_Short)x_min;
}
info->glyf_table->dst_length = dest_offset - info->glyf_table->dst_offset;
@ -1343,7 +1344,7 @@
if ( FT_STREAM_SEEK( glyf_offset ) || FT_STREAM_SKIP( 2 ) )
return error;
if ( FT_READ_USHORT( info->x_mins[i] ) )
if ( FT_READ_SHORT( info->x_mins[i] ) )
return error;
}

View File

@ -3751,6 +3751,7 @@
static const TT_CMap_Class tt_cmap_classes[] =
{
#undef TTCMAPCITEM
#define TTCMAPCITEM( a ) &a,
#include "ttcmapc.h"
NULL,

View File

@ -90,6 +90,11 @@ FT_BEGIN_HEADER
};
#undef TTCMAPCITEM
#define TTCMAPCITEM( a ) FT_CALLBACK_TABLE const TT_CMap_ClassRec a;
#include "ttcmapc.h"
typedef struct TT_ValidatorRec_
{
FT_ValidatorRec validator;

View File

@ -358,8 +358,8 @@
cover = ( spans->coverage + SCALE * SCALE / 2 ) / ( SCALE * SCALE );
for ( x = 0; x < spans->len; x++ )
{
sum = dst[ ( spans->x + x ) / SCALE ] + cover;
dst[ ( spans->x + x ) / SCALE ] = sum - ( sum >> 8 );
sum = dst[( spans->x + x ) / SCALE] + cover;
dst[( spans->x + x ) / SCALE] = (unsigned char)( sum - ( sum >> 8 ) );
}
}
}

View File

@ -6081,7 +6081,7 @@
exc->zp0.org[point].x = TT_MulFix14( distance,
exc->GS.freeVector.x );
exc->zp0.org[point].y = TT_MulFix14( distance,
exc->GS.freeVector.y ),
exc->GS.freeVector.y );
exc->zp0.cur[point] = exc->zp0.org[point];
}
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY