From 750fa961c63e35913583c0d78e9bfa5bb3dfda59 Mon Sep 17 00:00:00 2001 From: David Turner Date: Sun, 1 May 2005 10:11:32 +0000 Subject: [PATCH] * Jamfile: removing otvalid from the list of compiled modules * include/freetype/internal/ftserv.h: added compiler pragmas to get rid of annoying warnings with Visual C++ compiler in maximum warning mode * src/autofit/afhints.c, src/autofit/aflatin.c, src/base/ftstroke.c, src/bdf/bdfdrivr.c, src/cache/ftcbasic.c, src/cache/ftccmap.c, src/cache/ftcmanag.c, src/cff/cffload.c, src/cid/cidload.c, src/lzw/zopen.c, src/otvalid/otvgdef.c, src/pcf/pcfread.c, src/sfnt/sfobjs.c, src/truetype/ttgxvar.c: removing compiler warnings --- ChangeLog | 13 +++++++++++++ Jamfile | 2 +- include/freetype/internal/ftserv.h | 7 +++++++ src/autofit/afhints.c | 12 ++++++------ src/autofit/aflatin.c | 14 +++++++------- src/base/ftstroke.c | 2 +- src/bdf/bdfdrivr.c | 2 +- src/cache/ftcbasic.c | 8 ++++---- src/cache/ftccmap.c | 2 +- src/cache/ftcmanag.c | 2 +- src/cff/cffload.c | 4 ++-- src/cid/cidload.c | 12 ++++++------ src/lzw/zopen.c | 8 ++++---- src/otvalid/otvgdef.c | 4 ++-- src/pcf/pcfread.c | 2 +- src/sfnt/sfobjs.c | 2 +- src/truetype/ttgxvar.c | 26 +++++++++++++++----------- 17 files changed, 73 insertions(+), 49 deletions(-) diff --git a/ChangeLog b/ChangeLog index 519f7fe84..b61ff2c68 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-05-01 David Turner + + * Jamfile: removing otvalid from the list of compiled modules + * include/freetype/internal/ftserv.h: added compiler pragmas to get rid + of annoying warnings with Visual C++ compiler in maximum warning mode + + * src/autofit/afhints.c, src/autofit/aflatin.c, src/base/ftstroke.c, + src/bdf/bdfdrivr.c, src/cache/ftcbasic.c, src/cache/ftccmap.c, + src/cache/ftcmanag.c, src/cff/cffload.c, src/cid/cidload.c, + src/lzw/zopen.c, src/otvalid/otvgdef.c, src/pcf/pcfread.c, + src/sfnt/sfobjs.c, src/truetype/ttgxvar.c: removing compiler warnings + + 2005-04-28 Werner Lemberg * docs/TODO: Updated. diff --git a/Jamfile b/Jamfile index 4d8c487c6..6edf31ecb 100644 --- a/Jamfile +++ b/Jamfile @@ -69,7 +69,7 @@ FT2_COMPONENTS ?= autofit # auto-fitter cid # PostScript CID-keyed font driver gzip # support for gzip-compressed files lzw # support for LZW-compressed files - otvalid # validation of OpenType tables + #otvalid # validation of OpenType tables pcf # PCF font driver pfr # PFR/TrueDoc font driver psaux # common PostScript routines module diff --git a/include/freetype/internal/ftserv.h b/include/freetype/internal/ftserv.h index 9db9fa792..b91805585 100644 --- a/include/freetype/internal/ftserv.h +++ b/include/freetype/internal/ftserv.h @@ -34,6 +34,13 @@ FT_BEGIN_HEADER +#if defined( _MSC_VER ) /* Visual C++ (and Intel C++) */ + + /* we disable the warning `conditional expression is constant' here */ + /* in order to compile cleanly with the maximum level of warnings */ +#pragma warning( disable : 4127 ) + +#endif /* _MSC_VER */ /* * @macro: diff --git a/src/autofit/afhints.c b/src/autofit/afhints.c index d81df01ff..a3095ee21 100644 --- a/src/autofit/afhints.c +++ b/src/autofit/afhints.c @@ -551,8 +551,8 @@ for ( point = points; point < point_limit; point++, vec++, tag++ ) { - point->fx = vec->x; - point->fy = vec->y; + point->fx = (FT_Short)vec->x; + point->fy = (FT_Short)vec->y; point->ox = point->x = FT_MulFix( vec->x, x_scale ) + x_delta; point->oy = point->y = FT_MulFix( vec->y, y_scale ) + y_delta; @@ -634,13 +634,13 @@ in_x = point->fx - prev->fx; in_y = point->fy - prev->fy; - point->in_dir = af_direction_compute( in_x, in_y ); + point->in_dir = (FT_Char)af_direction_compute( in_x, in_y ); next = point->next; out_x = next->fx - point->fx; out_y = next->fy - point->fy; - point->out_dir = af_direction_compute( out_x, out_y ); + point->out_dir = (FT_Char)af_direction_compute( out_x, out_y ); if ( point->flags & ( AF_FLAG_CONIC | AF_FLAG_CUBIC ) ) { @@ -688,8 +688,8 @@ for ( ; point < limit; point++, vec++, tag++ ) { - vec->x = (FT_Pos)point->x; - vec->y = (FT_Pos)point->y; + vec->x = point->x; + vec->y = point->y; if ( point->flags & AF_FLAG_CONIC ) tag[0] = FT_CURVE_TAG_CONIC; diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c index d6cfaa653..1aef9bb96 100644 --- a/src/autofit/aflatin.c +++ b/src/autofit/aflatin.c @@ -688,7 +688,7 @@ { /* we are just leaving an edge; record a new segment! */ segment->last = point; - segment->pos = ( min_pos + max_pos ) >> 1; + segment->pos = (FT_Short)(( min_pos + max_pos ) >> 1); /* a segment is round if either its first or last point */ /* is a control point */ @@ -705,8 +705,8 @@ if ( v > max_pos ) max_pos = v; - segment->min_coord = min_pos; - segment->max_coord = max_pos; + segment->min_coord = (FT_Short) min_pos; + segment->max_coord = (FT_Short) max_pos; on_edge = 0; segment = NULL; @@ -732,7 +732,7 @@ if ( error ) goto Exit; - segment->dir = segment_dir; + segment->dir = (FT_Char) segment_dir; segment->flags = AF_EDGE_NORMAL; min_pos = max_pos = point->u; segment->first = point; @@ -1150,10 +1150,10 @@ edge->dir = AF_DIR_NONE; if ( ups > downs ) - edge->dir = up_dir; + edge->dir = (FT_Char) up_dir; else if ( ups < downs ) - edge->dir = -up_dir; + edge->dir = (FT_Char) -up_dir; else if ( ups == downs ) edge->dir = 0; /* both up and down! */ @@ -1232,7 +1232,7 @@ /* zone, check for left edges */ /* */ /* of course, that's for TrueType */ - is_top_blue = ( blue->flags & AF_LATIN_BLUE_TOP ) != 0; + is_top_blue = (FT_Byte)(( blue->flags & AF_LATIN_BLUE_TOP ) != 0); is_major_dir = FT_BOOL( edge->dir == axis->major_dir ); /* if it is a top zone, the edge must be against the major */ diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c index fee3607d6..2da2314da 100644 --- a/src/base/ftstroke.c +++ b/src/base/ftstroke.c @@ -1425,7 +1425,7 @@ dst_tag[0] &= ~FT_STROKE_TAG_BEGIN_END; else { - FT_Byte ttag = dst_tag[0] & FT_STROKE_TAG_BEGIN_END; + FT_Byte ttag = (FT_Byte)(dst_tag[0] & FT_STROKE_TAG_BEGIN_END); /* switch begin/end tags if necessary */ diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c index b28e7c3c3..b6dd776a7 100644 --- a/src/bdf/bdfdrivr.c +++ b/src/bdf/bdfdrivr.c @@ -422,7 +422,7 @@ THE SOFTWARE. if ( prop ) bsize->width = (FT_Short)( ( prop->value.int32 + 5 ) / 10 ); else - bsize->width = bsize->height * 2/3; + bsize->width = (FT_Short)( bsize->height * 2/3 ); prop = bdf_get_font_property( font, "POINT_SIZE" ); if ( prop ) diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c index 9a91f357b..b94d90e6b 100644 --- a/src/cache/ftcbasic.c +++ b/src/cache/ftcbasic.c @@ -39,8 +39,8 @@ } FTC_BasicAttrRec, *FTC_BasicAttrs; #define FTC_BASIC_ATTR_COMPARE( a, b ) \ - ( FTC_SCALER_COMPARE( &(a)->scaler, &(b)->scaler ) && \ - (a)->load_flags == (b)->load_flags ) + FT_BOOL( FTC_SCALER_COMPARE( &(a)->scaler, &(b)->scaler ) && \ + (a)->load_flags == (b)->load_flags ) #define FTC_BASIC_ATTR_HASH( a ) \ ( FTC_SCALER_HASH( &(a)->scaler ) + 31*(a)->load_flags ) @@ -266,7 +266,7 @@ FTC_Node *anode ) { FTC_BasicQueryRec query; - FTC_INode node; + FTC_INode node = 0; /* make compiler happy */ FT_Error error; FT_UInt32 hash; @@ -385,7 +385,7 @@ { FT_Error error; FTC_BasicQueryRec query; - FTC_SNode node; + FTC_SNode node = 0; /* make compiler happy */ FT_UInt32 hash; diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c index b2812c951..eb0c19eaf 100644 --- a/src/cache/ftccmap.c +++ b/src/cache/ftccmap.c @@ -292,7 +292,7 @@ FT_Set_Charmap( face, old ); } - node->indices[char_code - node->first] = gindex; + node->indices[char_code - node->first] = (FT_UShort)gindex; } Exit: diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c index 3935f7234..5252c5a76 100644 --- a/src/cache/ftcmanag.c +++ b/src/cache/ftcmanag.c @@ -164,7 +164,7 @@ FTC_FaceID face_id = (FTC_FaceID)ftcface_id; - return node->scaler.face_id == face_id; + return FT_BOOL(node->scaler.face_id == face_id); } diff --git a/src/cff/cffload.c b/src/cff/cffload.c index f89d4b12a..a7740e1e3 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1687,7 +1687,7 @@ FT_MEM_ZERO( charset->cids, sizeof ( FT_UShort ) * max_cid ); for ( i = 0; i < num_glyphs; i++ ) - charset->cids[charset->sids[i]] = i; + charset->cids[charset->sids[i]] = (FT_UShort)i; } Exit: @@ -2240,7 +2240,7 @@ /* read the Charset and Encoding tables if available */ if ( font->num_glyphs > 0 ) { - FT_Bool invert = dict->cid_registry != 0xFFFFU; + FT_Bool invert = FT_BOOL( dict->cid_registry != 0xFFFFU ); error = cff_charset_load( &font->charset, font->num_glyphs, stream, diff --git a/src/cid/cidload.c b/src/cid/cidload.c index 34ad12b45..e6ca5ce59 100644 --- a/src/cid/cidload.c +++ b/src/cid/cidload.c @@ -536,11 +536,11 @@ } if ( ft_isdigit( *p ) ) - val = *p - '0'; + val = (FT_Byte)(*p - '0'); else if ( *p >= 'a' && *p <= 'f' ) - val = *p - 'a'; + val = (FT_Byte)(*p - 'a'); else if ( *p >= 'A' && *p <= 'F' ) - val = *p - 'A' + 10; + val = (FT_Byte)(*p - 'A' + 10); else if ( *p == ' ' || *p == '\t' || *p == '\r' || @@ -563,14 +563,14 @@ } if ( upper_nibble ) - *d = val << 4; + *d = (FT_Byte)(val << 4); else { - *d += val; + *d = (FT_Byte)(*d + val); d++; } - upper_nibble = 1 - upper_nibble; + upper_nibble = (FT_Byte)(1 - upper_nibble); if ( done ) break; diff --git a/src/lzw/zopen.c b/src/lzw/zopen.c index 2b438c25b..c21584475 100644 --- a/src/lzw/zopen.c +++ b/src/lzw/zopen.c @@ -250,7 +250,7 @@ zread(s_zstate_t *zs) /* Special case for KwKwK string. */ if (code >= free_ent) { - *stackp++ = finchar; + *stackp++ = (unsigned char)finchar; code = oldcode; } @@ -259,7 +259,7 @@ zread(s_zstate_t *zs) *stackp++ = tab_suffixof(code); code = tab_prefixof(code); } - *stackp++ = finchar = tab_suffixof(code); + *stackp++ = (unsigned char)(finchar = tab_suffixof(code)); /* And put them out in forward order. */ middle: @@ -277,7 +277,7 @@ middle: /* Generate the new entry. */ if ((code = free_ent) < maxmaxcode) { tab_prefixof(code) = (unsigned short) oldcode; - tab_suffixof(code) = finchar; + tab_suffixof(code) = (unsigned char) finchar; free_ent = code + 1; } @@ -322,7 +322,7 @@ getcode(s_zstate_t *zs) } if ( zs->avail_in < (unsigned int)n_bits && in_count > (long)n_bits ) { memcpy (buf, zs->next_in, zs->avail_in); - buf_len = zs->avail_in; + buf_len = (unsigned char)zs->avail_in; zs->avail_in = 0; return -1; } diff --git a/src/otvalid/otvgdef.c b/src/otvalid/otvgdef.c index 8df0ea58b..9144a76e7 100644 --- a/src/otvalid/otvgdef.c +++ b/src/otvalid/otvgdef.c @@ -174,9 +174,9 @@ /* so we use this ugly hack to find out whether the */ /* table is needed actually. */ - need_MarkAttachClassDef = + need_MarkAttachClassDef = FT_BOOL( otv_GSUBGPOS_have_MarkAttachmentType_flag( gsub ) || - otv_GSUBGPOS_have_MarkAttachmentType_flag( gpos ); + otv_GSUBGPOS_have_MarkAttachmentType_flag( gpos ) ); if ( need_MarkAttachClassDef ) table_size = 12; /* OpenType >= 1.2 */ diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c index 701f94dd6..ea74d17d5 100644 --- a/src/pcf/pcfread.c +++ b/src/pcf/pcfread.c @@ -1110,7 +1110,7 @@ THE SOFTWARE. if ( prop ) bsize->width = (FT_Short)( ( prop->value.integer + 5 ) / 10 ); else - bsize->width = bsize->height * 2/3; + bsize->width = (FT_Short)( bsize->height * 2/3 ); prop = pcf_find_property( face, "POINT_SIZE" ); if ( prop ) diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c index 79e0e9619..a066df527 100644 --- a/src/sfnt/sfobjs.c +++ b/src/sfnt/sfobjs.c @@ -208,7 +208,7 @@ case TT_MS_ID_SYMBOL_CS: case TT_MS_ID_UNICODE_CS: case TT_MS_ID_UCS_4: - is_english = ( rec->languageID & 0x3FF ) == 0x009; + is_english = FT_BOOL(( rec->languageID & 0x3FF ) == 0x009); found_win = n; break; diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c index c7ff3e9b4..e6051a289 100644 --- a/src/truetype/ttgxvar.c +++ b/src/truetype/ttgxvar.c @@ -154,18 +154,18 @@ if ( runcnt & GX_PT_POINTS_ARE_WORDS ) { runcnt = runcnt & GX_PT_POINT_RUN_COUNT_MASK; - points[i++] = first = FT_GET_USHORT(); + first = points[i++] = FT_GET_USHORT(); /* first point not included in runcount */ for ( j = 0; j < runcnt; ++j ) - points[i++] = ( first += FT_GET_USHORT() ); + points[i++] = (FT_UShort)( first += FT_GET_USHORT() ); } else { - points[i++] = first = FT_GET_BYTE(); + first = points[i++] = FT_GET_BYTE(); for ( j = 0; j < runcnt; ++j ) - points[i++] = ( first += FT_GET_BYTE() ); + points[i++] = (FT_UShort)( first += FT_GET_BYTE() ); } } @@ -1209,7 +1209,7 @@ } apply = ft_var_apply_tuple( blend, - tupleIndex, + (FT_UShort) tupleIndex, tuple_coords, im_start_coords, im_end_coords ); @@ -1238,15 +1238,19 @@ { /* this means that there are deltas for every entry in cvt */ for ( j = 0; j < face->cvt_size; ++j ) - face->cvt[j] += (FT_Short)FT_MulFix( deltas[j], - apply ); + face->cvt[j] = (FT_Short)( face->cvt[j] + FT_MulFix( deltas[j], + apply ) ); } else { for ( j = 0; j < point_count; ++j ) - face->cvt[localpoints[j]] += (FT_Short)FT_MulFix( deltas[j], - apply ); + { + int pindex = localpoints[j]; + + face->cvt[pindex] = (FT_Short)( face->cvt[pindex] + + FT_MulFix( deltas[j], apply ) ); + } } if ( localpoints != ALL_POINTS ) @@ -1314,7 +1318,7 @@ FT_Fixed* im_end_coords = NULL; FT_UInt point_count, spoint_count = 0; FT_UShort* sharedpoints = NULL; - FT_UShort* localpoints; + FT_UShort* localpoints = NULL; FT_UShort* points; FT_Short *deltas_x, *deltas_y; @@ -1400,7 +1404,7 @@ } apply = ft_var_apply_tuple( blend, - tupleIndex, + (FT_UShort) tupleIndex, tuple_coords, im_start_coords, im_end_coords );