mirror of https://github.com/freetype/freetype
Fix compiler warnings.
* include/freetype/internal/ftmemory.h: Decorate memory allocation macros with `FT_Long' where appropriate. Remove duplicate of FT_MEM_QRENEW_ARRAY definition. * src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): Use cast. * src/base/ftobjs.c: Add warning disabling pragma for MSVC while including `md5.c'. * src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdESC>: Add cast. * src/sfnt/ttsbit.c (tt_sbit_decoder_load_compound): Fix casts. (tt_sbit_decoder_load_bitmap): Beautification. * src/smooth/ftsmooth.c (ft_smooth_render_generic): Initialize variables (earlier). * src/truetype/ttgload.c (TT_Process_Simple_Glyph): Pacify compiler. * src/truetype/ttgxvar.c (TT_Get_MM_Var): Use unsigned constants where appropriate. * src/type1/t1load.c (T1_Get_MM_Var): Ditto.
This commit is contained in:
parent
d963498faf
commit
45392b77a8
30
ChangeLog
30
ChangeLog
|
@ -1,3 +1,33 @@
|
|||
2013-06-05 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
Fix compiler warnings.
|
||||
|
||||
* include/freetype/internal/ftmemory.h: Decorate memory allocation
|
||||
macros with `FT_Long' where appropriate.
|
||||
Remove duplicate of FT_MEM_QRENEW_ARRAY definition.
|
||||
|
||||
* src/base/ftbitmap.c (ft_gray_for_premultiplied_srgb_bgra): Use
|
||||
cast.
|
||||
|
||||
* src/base/ftobjs.c: Add warning disabling pragma for MSVC while
|
||||
including `md5.c'.
|
||||
|
||||
* src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdESC>: Add
|
||||
cast.
|
||||
|
||||
* src/sfnt/ttsbit.c (tt_sbit_decoder_load_compound): Fix casts.
|
||||
(tt_sbit_decoder_load_bitmap): Beautification.
|
||||
|
||||
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Initialize
|
||||
variables (earlier).
|
||||
|
||||
* src/truetype/ttgload.c (TT_Process_Simple_Glyph): Pacify compiler.
|
||||
|
||||
* src/truetype/ttgxvar.c (TT_Get_MM_Var): Use unsigned constants
|
||||
where appropriate.
|
||||
|
||||
* src/type1/t1load.c (T1_Get_MM_Var): Ditto.
|
||||
|
||||
2013-06-04 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* src/cff/cf2font.c (cf2_getGlyphWidth): Initialize `advWidth'.
|
||||
|
|
|
@ -141,8 +141,10 @@ FT_BEGIN_HEADER
|
|||
const void* P );
|
||||
|
||||
|
||||
#define FT_MEM_ALLOC( ptr, size ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, (size), &error ) )
|
||||
#define FT_MEM_ALLOC( ptr, size ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_alloc( memory, \
|
||||
(FT_Long)(size), \
|
||||
&error ) )
|
||||
|
||||
#define FT_MEM_FREE( ptr ) \
|
||||
FT_BEGIN_STMNT \
|
||||
|
@ -154,45 +156,60 @@ FT_BEGIN_HEADER
|
|||
FT_MEM_ALLOC( ptr, sizeof ( *(ptr) ) )
|
||||
|
||||
#define FT_MEM_REALLOC( ptr, cursz, newsz ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, 1, \
|
||||
(cursz), (newsz), \
|
||||
(ptr), &error ) )
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
|
||||
1, \
|
||||
(FT_Long)(cursz), \
|
||||
(FT_Long)(newsz), \
|
||||
(ptr), \
|
||||
&error ) )
|
||||
|
||||
#define FT_MEM_QALLOC( ptr, size ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, (size), &error ) )
|
||||
#define FT_MEM_QALLOC( ptr, size ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_qalloc( memory, \
|
||||
(FT_Long)(size), \
|
||||
&error ) )
|
||||
|
||||
#define FT_MEM_QNEW( ptr ) \
|
||||
FT_MEM_QALLOC( ptr, sizeof ( *(ptr) ) )
|
||||
|
||||
#define FT_MEM_QREALLOC( ptr, cursz, newsz ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, 1, \
|
||||
(cursz), (newsz), \
|
||||
(ptr), &error ) )
|
||||
#define FT_MEM_QREALLOC( ptr, cursz, newsz ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
|
||||
1, \
|
||||
(FT_Long)(cursz), \
|
||||
(FT_Long)(newsz), \
|
||||
(ptr), \
|
||||
&error ) )
|
||||
|
||||
#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \
|
||||
(cursz), (newsz), \
|
||||
(ptr), &error ) )
|
||||
#define FT_MEM_ALLOC_MULT( ptr, count, item_size ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
|
||||
(FT_Long)(item_size), \
|
||||
0, \
|
||||
(FT_Long)(count), \
|
||||
NULL, \
|
||||
&error ) )
|
||||
|
||||
#define FT_MEM_ALLOC_MULT( ptr, count, item_size ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, (item_size), \
|
||||
0, (count), \
|
||||
NULL, &error ) )
|
||||
#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
|
||||
(FT_Long)(itmsz), \
|
||||
(FT_Long)(oldcnt), \
|
||||
(FT_Long)(newcnt), \
|
||||
(ptr), \
|
||||
&error ) )
|
||||
|
||||
#define FT_MEM_REALLOC_MULT( ptr, oldcnt, newcnt, itmsz ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, (itmsz), \
|
||||
(oldcnt), (newcnt), \
|
||||
(ptr), &error ) )
|
||||
#define FT_MEM_QALLOC_MULT( ptr, count, item_size ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
|
||||
(FT_Long)(item_size), \
|
||||
0, \
|
||||
(FT_Long)(count), \
|
||||
NULL, \
|
||||
&error ) )
|
||||
|
||||
#define FT_MEM_QALLOC_MULT( ptr, count, item_size ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, (item_size), \
|
||||
0, (count), \
|
||||
NULL, &error ) )
|
||||
|
||||
#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, (itmsz), \
|
||||
(oldcnt), (newcnt), \
|
||||
(ptr), &error ) )
|
||||
#define FT_MEM_QREALLOC_MULT( ptr, oldcnt, newcnt, itmsz) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
|
||||
(FT_Long)(itmsz), \
|
||||
(FT_Long)(oldcnt), \
|
||||
(FT_Long)(newcnt), \
|
||||
(ptr), \
|
||||
&error ) )
|
||||
|
||||
|
||||
#define FT_MEM_SET_ERROR( cond ) ( (cond), error != 0 )
|
||||
|
@ -236,26 +253,37 @@ FT_BEGIN_HEADER
|
|||
/* _typed_ in order to automatically compute array element sizes. */
|
||||
/* */
|
||||
|
||||
#define FT_MEM_NEW_ARRAY( ptr, count ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, sizeof ( *(ptr) ), \
|
||||
0, (count), \
|
||||
NULL, &error ) )
|
||||
#define FT_MEM_NEW_ARRAY( ptr, count ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
|
||||
sizeof ( *(ptr) ), \
|
||||
0, \
|
||||
(FT_Long)(count), \
|
||||
NULL, \
|
||||
&error ) )
|
||||
|
||||
#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, sizeof ( *(ptr) ), \
|
||||
(cursz), (newsz), \
|
||||
(ptr), &error ) )
|
||||
#define FT_MEM_RENEW_ARRAY( ptr, cursz, newsz ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_realloc( memory, \
|
||||
sizeof ( *(ptr) ), \
|
||||
(FT_Long)(cursz), \
|
||||
(FT_Long)(newsz), \
|
||||
(ptr), \
|
||||
&error ) )
|
||||
|
||||
#define FT_MEM_QNEW_ARRAY( ptr, count ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \
|
||||
0, (count), \
|
||||
NULL, &error ) )
|
||||
|
||||
#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, sizeof ( *(ptr) ), \
|
||||
(cursz), (newsz), \
|
||||
(ptr), &error ) )
|
||||
#define FT_MEM_QNEW_ARRAY( ptr, count ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
|
||||
sizeof ( *(ptr) ), \
|
||||
0, \
|
||||
(FT_Long)(count), \
|
||||
NULL, \
|
||||
&error ) )
|
||||
|
||||
#define FT_MEM_QRENEW_ARRAY( ptr, cursz, newsz ) \
|
||||
FT_ASSIGNP_INNER( ptr, ft_mem_qrealloc( memory, \
|
||||
sizeof ( *(ptr) ), \
|
||||
(FT_Long)(cursz), \
|
||||
(FT_Long)(newsz), \
|
||||
(ptr), \
|
||||
&error ) )
|
||||
|
||||
#define FT_ALLOC( ptr, size ) \
|
||||
FT_MEM_SET_ERROR( FT_MEM_ALLOC( ptr, size ) )
|
||||
|
|
|
@ -424,7 +424,7 @@
|
|||
* So the formula is a * (1 - l).
|
||||
*/
|
||||
|
||||
return FT_MulFix( 65535 - l, a ) >> 8;
|
||||
return (FT_Byte)( FT_MulFix( 65535 - l, a ) >> 8 );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -43,13 +43,28 @@
|
|||
|
||||
|
||||
#ifdef FT_DEBUG_LEVEL_TRACE
|
||||
|
||||
#include FT_BITMAP_H
|
||||
#define free md5_free /* suppress a shadow warning */
|
||||
|
||||
#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */
|
||||
/* We disable the warning `conversion from XXX to YYY, */
|
||||
/* possible loss of data' in order to compile cleanly with */
|
||||
/* the maximum level of warnings: `md5.c' is non-FreeType */
|
||||
/* code, and it gets used during development builds only. */
|
||||
#pragma warning( disable : 4244 )
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* it's easiest to include `md5.c' directly */
|
||||
#define free md5_free /* suppress a shadow warning */
|
||||
#include "md5.c"
|
||||
#undef free
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
#pragma warning( enable : 4244 )
|
||||
#endif
|
||||
|
||||
#endif /* FT_DEBUG_LEVEL_TRACE */
|
||||
|
||||
|
||||
#define GRID_FIT_METRICS
|
||||
|
||||
|
|
|
@ -789,7 +789,7 @@
|
|||
|
||||
case cf2_cmdESC:
|
||||
{
|
||||
FT_Byte op2 = cf2_buf_readByte( charstring );
|
||||
FT_Byte op2 = (FT_Byte)cf2_buf_readByte( charstring );
|
||||
|
||||
|
||||
switch ( op2 )
|
||||
|
|
|
@ -697,8 +697,8 @@
|
|||
decoder->metrics->vertBearingX = vertBearingX;
|
||||
decoder->metrics->vertBearingY = vertBearingY;
|
||||
decoder->metrics->vertAdvance = vertAdvance;
|
||||
decoder->metrics->width = (FT_UInt)decoder->bitmap->width;
|
||||
decoder->metrics->height = (FT_UInt)decoder->bitmap->rows;
|
||||
decoder->metrics->width = (FT_Byte)decoder->bitmap->width;
|
||||
decoder->metrics->height = (FT_Byte)decoder->bitmap->rows;
|
||||
|
||||
Exit:
|
||||
return error;
|
||||
|
@ -892,11 +892,13 @@
|
|||
|
||||
decoder->bitmap = orig;
|
||||
|
||||
if ( error ||
|
||||
/* explicitly test against FT_Err_Ok to avoid compiler warnings */
|
||||
/* (we do an assignment within a conditional) */
|
||||
if ( error ||
|
||||
( error = FT_Bitmap_Convert( library,
|
||||
&color,
|
||||
decoder->bitmap,
|
||||
1 ) ) )
|
||||
1 ) ) != FT_Err_Ok )
|
||||
{
|
||||
FT_Bitmap_Done( library, &color );
|
||||
goto Fail;
|
||||
|
|
|
@ -109,11 +109,13 @@
|
|||
#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
|
||||
FT_Pos height_org, width_org;
|
||||
#endif
|
||||
FT_Bitmap* bitmap;
|
||||
FT_Memory memory;
|
||||
FT_Int hmul = mode == FT_RENDER_MODE_LCD;
|
||||
FT_Int vmul = mode == FT_RENDER_MODE_LCD_V;
|
||||
FT_Pos x_shift, y_shift, x_left, y_top;
|
||||
FT_Bitmap* bitmap = &slot->bitmap;
|
||||
FT_Memory memory = render->root.memory;
|
||||
FT_Int hmul = mode == FT_RENDER_MODE_LCD;
|
||||
FT_Int vmul = mode == FT_RENDER_MODE_LCD_V;
|
||||
FT_Pos x_shift = 0;
|
||||
FT_Pos y_shift = 0;
|
||||
FT_Pos x_left, y_top;
|
||||
|
||||
FT_Raster_Params params;
|
||||
|
||||
|
@ -175,9 +177,6 @@
|
|||
else
|
||||
height = ( cbox.yMax - cbox.yMin ) >> 6;
|
||||
|
||||
bitmap = &slot->bitmap;
|
||||
memory = render->root.memory;
|
||||
|
||||
#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
|
||||
width_org = width;
|
||||
height_org = height;
|
||||
|
|
|
@ -932,8 +932,8 @@
|
|||
FT_Vector* vec = outline->points;
|
||||
FT_Vector* limit = outline->points + n_points;
|
||||
|
||||
FT_Fixed x_scale;
|
||||
FT_Fixed y_scale;
|
||||
FT_Fixed x_scale = 0; /* pacify compiler */
|
||||
FT_Fixed y_scale = 0;
|
||||
|
||||
FT_Bool do_scale = FALSE;
|
||||
|
||||
|
|
|
@ -703,7 +703,7 @@
|
|||
mmvar->num_axis =
|
||||
fvar_head.axisCount;
|
||||
mmvar->num_designs =
|
||||
~0; /* meaningless in this context; each glyph */
|
||||
~0U; /* meaningless in this context; each glyph */
|
||||
/* may have a different number of designs */
|
||||
/* (or tuples, as called by Apple) */
|
||||
mmvar->num_namedstyles =
|
||||
|
|
|
@ -320,7 +320,7 @@
|
|||
|
||||
mmvar->num_axis = mmaster.num_axis;
|
||||
mmvar->num_designs = mmaster.num_designs;
|
||||
mmvar->num_namedstyles = ~0; /* Does not apply */
|
||||
mmvar->num_namedstyles = ~0U; /* Does not apply */
|
||||
mmvar->axis = (FT_Var_Axis*)&mmvar[1];
|
||||
/* Point to axes after MM_Var struct */
|
||||
mmvar->namedstyle = NULL;
|
||||
|
@ -333,8 +333,8 @@
|
|||
mmvar->axis[i].def = ( mmvar->axis[i].minimum +
|
||||
mmvar->axis[i].maximum ) / 2;
|
||||
/* Does not apply. But this value is in range */
|
||||
mmvar->axis[i].strid = ~0; /* Does not apply */
|
||||
mmvar->axis[i].tag = ~0; /* Does not apply */
|
||||
mmvar->axis[i].strid = ~0U; /* Does not apply */
|
||||
mmvar->axis[i].tag = ~0U; /* Does not apply */
|
||||
|
||||
if ( ft_strcmp( mmvar->axis[i].name, "Weight" ) == 0 )
|
||||
mmvar->axis[i].tag = FT_MAKE_TAG( 'w', 'g', 'h', 't' );
|
||||
|
|
Loading…
Reference in New Issue