Commit 750fa961c63e35913583c0d78e9bfa5bb3dfda59

David Turner 2005-05-01T10:11:32

* 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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
diff --git a/ChangeLog b/ChangeLog
index 519f7fe..b61ff2c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2005-05-01  David Turner  <david@freetype.org>
+
+  * 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  <wl@gnu.org>
 
 	* docs/TODO: Updated.
diff --git a/Jamfile b/Jamfile
index 4d8c487..6edf31e 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 9db9fa7..b918055 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 d81df01..a3095ee 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 d6cfaa6..1aef9bb 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 fee3607..2da2314 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 b28e7c3..b6dd776 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 9a91f35..b94d90e 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 b2812c9..eb0c19e 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 3935f72..5252c5a 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 f89d4b1..a7740e1 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 34ad12b..e6ca5ce 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 2b438c2..c215844 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 8df0ea5..9144a76 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 701f94d..ea74d17 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 79e0e96..a066df5 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 c7ff3e9..e6051a2 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 );