summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2020-07-07 16:58:14 +0200
committerWerner Lemberg <wl@gnu.org>2020-07-07 16:58:14 +0200
commit96fb73efd5c69c2c34ebe2a4d7096774c87da145 (patch)
tree7baa5351214ccdd57b3844dd3324ab3e08797258
parent0f35b042e02e23cc6fb29d805d25aa85679274eb (diff)
downloadfreetype2-96fb73efd5c69c2c34ebe2a4d7096774c87da145.tar.gz
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.
-rw-r--r--ChangeLog42
-rw-r--r--include/freetype/internal/autohint.h3
-rw-r--r--include/freetype/internal/ftobjs.h7
-rw-r--r--src/autofit/afmodule.c4
-rw-r--r--src/autofit/afmodule.h1
-rw-r--r--src/base/ftbase.h4
-rw-r--r--src/base/ftglyph.c2
-rw-r--r--src/cff/cffcmap.h4
-rw-r--r--src/cff/cffparse.c10
-rw-r--r--src/pcf/pcfdrivr.c2
-rw-r--r--src/psaux/psauxmod.c8
-rw-r--r--src/psaux/psauxmod.h14
-rw-r--r--src/pshinter/pshmod.c1
-rw-r--r--src/sfnt/sfwoff2.c47
-rw-r--r--src/sfnt/ttcmap.c1
-rw-r--r--src/sfnt/ttcmap.h5
-rw-r--r--src/smooth/ftsmooth.c4
-rw-r--r--src/truetype/ttinterp.c2
18 files changed, 119 insertions, 42 deletions
diff --git a/ChangeLog b/ChangeLog
index 39d2e8915..c305860e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/include/freetype/internal/autohint.h b/include/freetype/internal/autohint.h
index d4220a274..2a472e20b 100644
--- a/include/freetype/internal/autohint.h
+++ b/include/freetype/internal/autohint.h
@@ -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_, \
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index 07c5e70a8..25db2c494 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -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_, \
diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c
index 95d58b840..f52b2b2f4 100644
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -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,
diff --git a/src/autofit/afmodule.h b/src/autofit/afmodule.h
index 74c4ff6e7..e8fe4a93a 100644
--- a/src/autofit/afmodule.h
+++ b/src/autofit/afmodule.h
@@ -46,6 +46,7 @@ FT_BEGIN_HEADER
} AF_ModuleRec, *AF_Module;
+FT_DECLARE_AUTOHINTER_INTERFACE( af_autofitter_interface )
FT_DECLARE_MODULE( autofit_module_class )
diff --git a/src/base/ftbase.h b/src/base/ftbase.h
index b03922ae6..25afa9bc3 100644
--- a/src/base/ftbase.h
+++ b/src/base/ftbase.h
@@ -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; */
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index 78dff7ff2..825eba2c4 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -35,6 +35,8 @@
#include <freetype/ftbitmap.h>
#include <freetype/internal/ftobjs.h>
+#include "ftbase.h"
+
/**************************************************************************
*
diff --git a/src/cff/cffcmap.h b/src/cff/cffcmap.h
index fc6bd90a7..69fab8dc6 100644
--- a/src/cff/cffcmap.h
+++ b/src/cff/cffcmap.h
@@ -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
diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c
index 25c90d2f3..758788e16 100644
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -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;
diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c
index b0b5ee405..f68e60e51 100644
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -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 ) )
diff --git a/src/psaux/psauxmod.c b/src/psaux/psauxmod.c
index bfc507c07..e73ba2245 100644
--- a/src/psaux/psauxmod.c
+++ b/src/psaux/psauxmod.c
@@ -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 */
diff --git a/src/psaux/psauxmod.h b/src/psaux/psauxmod.h
index 400d0ea93..a6bebe4b9 100644
--- a/src/psaux/psauxmod.h
+++ b/src/psaux/psauxmod.h
@@ -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_ */
diff --git a/src/pshinter/pshmod.c b/src/pshinter/pshmod.c
index 801bf926a..e0abd386f 100644
--- a/src/pshinter/pshmod.c
+++ b/src/pshinter/pshmod.c
@@ -19,6 +19,7 @@
#include <freetype/internal/ftobjs.h>
#include "pshrec.h"
#include "pshalgo.h"
+#include "pshmod.h"
/* the Postscript Hinter module structure */
diff --git a/src/sfnt/sfwoff2.c b/src/sfnt/sfwoff2.c
index 781b93206..895d6cf49 100644
--- a/src/sfnt/sfwoff2.c
+++ b/src/sfnt/sfwoff2.c
@@ -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;
}
diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c
index e54baf9e9..556a71219 100644
--- a/src/sfnt/ttcmap.c
+++ b/src/sfnt/ttcmap.c
@@ -3751,6 +3751,7 @@
static const TT_CMap_Class tt_cmap_classes[] =
{
+#undef TTCMAPCITEM
#define TTCMAPCITEM( a ) &a,
#include "ttcmapc.h"
NULL,
diff --git a/src/sfnt/ttcmap.h b/src/sfnt/ttcmap.h
index 428ad21ef..c7d7c21d2 100644
--- a/src/sfnt/ttcmap.h
+++ b/src/sfnt/ttcmap.h
@@ -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;
diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c
index b32629205..3ce1cea24 100644
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -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 ) );
}
}
}
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 6aecfb4f5..41b174e4f 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -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