Commit 0240d29cac53975d5b7309678c7ae59b35775e54

Werner Lemberg 2003-06-09T15:54:18

* src/gzip/ftgzip.c (ft_gzip_file_fill_output): Handle Z_STREAM_END correctly. * src/pshinter/pshglob.c (psh_globals_new): Change calculation of dim->stdw.count to avoid compiler problem. * src/truetype/ttgload.c (TT_Load_Simple_Glyph): Move the block variables to the beginning of the function to avoid compiler problems. Add casts necessary for 16bit compilers. * src/pfr/rules.mk (PFR_DRV_SRC): Add pfrsbit.c. (PFR_DRV_H): Add pfrtypes.h. * include/freetype/config/ftconfig.h: s/__MWKS__/__MWERKS__/. * src/pfr/pfrsbit.c (pfr_bitwriter_init): Change type of third argument to FT_Bool. (pfr_lookup_bitmap_data): Change type of third and fourth argument to FT_UInt. Updated caller. (pfr_load_bitmap_bits): Change type of fourth argument to FT_Bool.

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
454
455
456
diff --git a/ChangeLog b/ChangeLog
index ee7beba..ac4612c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2003-06-09  Alexis S. L. Carvalho  <alexis@cecm.usp.br>
+
+	* src/gzip/ftgzip.c (ft_gzip_file_fill_output): Handle Z_STREAM_END
+	correctly.
+
+2003-06-09  Wolfgang Domröse  <porthos.domroese@harz.de>
+
+	* src/pshinter/pshglob.c (psh_globals_new): Change calculation of
+	dim->stdw.count to avoid compiler problem.
+
+	* src/truetype/ttgload.c (TT_Load_Simple_Glyph): Move the block
+	variables to the beginning of the function to avoid compiler
+	problems.
+	Add casts necessary for 16bit compilers.
+
+2003-06-09  Werner Lemberg  <wl@gnu.org>
+
+	* src/pfr/rules.mk (PFR_DRV_SRC): Add pfrsbit.c.
+	(PFR_DRV_H): Add pfrtypes.h.
+
+	* include/freetype/config/ftconfig.h: s/__MWKS__/__MWERKS__/.
+
+2003-06-08  Karl Schultz  <kschultz@rsinc.com>
+
+	* src/pfr/pfrsbit.c (pfr_bitwriter_init): Change type of third
+	argument to FT_Bool.
+	(pfr_lookup_bitmap_data): Change type of third and fourth argument
+	to FT_UInt.  Updated caller.
+	(pfr_load_bitmap_bits): Change type of fourth argument to FT_Bool.
+
 2003-06-08  Werner Lemberg  <wl@gnu.org>
 
 	Completely revised FreeType's make management.
@@ -4713,10 +4743,10 @@
 
 2001-12-12  David Turner  <david@freetype.org>
 
-	* src/pshint/pshglob.c (psh_blues_scale_zones, psh_blues_snap_stem
+	* src/pshinter/pshglob.c (psh_blues_scale_zones, psh_blues_snap_stem
 	psh_globals_new): Adding correct BlueScale/BlueShift support, plus
 	family blues processing.
-	* src/pshint/pshglob.h (PSH_BluesRec): Updated.
+	* src/pshinter/pshglob.h (PSH_BluesRec): Updated.
 
 	Started adding support for the Postscript hinter in the CFF module.
 
diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h
index 70f5026..88bb40c 100644
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    ANSI-specific configuration file (specification only).               */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002 by                                           */
+/*  Copyright 1996-2001, 2002, 2003 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -178,7 +178,7 @@ FT_BEGIN_HEADER
 
   /* Watcom doesn't provide 64-bit data types */
 
-#elif defined( __MWKS__ )      /* Metrowerks CodeWarrior */
+#elif defined( __MWERKS__ )    /* Metrowerks CodeWarrior */
 
   /* I don't know if it provides 64-bit data types, any suggestion */
   /* is welcome.                                                   */
diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h
index b6057db..1389fa8 100644
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -112,7 +112,7 @@ FT_BEGIN_HEADER
   /*   return an error later when trying to load the glyph).               */
   /*                                                                       */
   /*   It also check that fields that must be a multiple of 2, 4, or 8     */
-  /*   dont' have incorrect values, etc.                                   */
+  /*   don't have incorrect values, etc.                                   */
   /*                                                                       */
   /* FT_VALIDATE_PARANOID ::                                               */
   /*   Only for font debugging.  Checks that a table follows the           */
diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c
index 1c2dda0..d2e6282 100644
--- a/src/gzip/ftgzip.c
+++ b/src/gzip/ftgzip.c
@@ -397,7 +397,8 @@
       if ( err == Z_STREAM_END )
       {
         zip->limit = zstream->next_out;
-        error      = FT_Err_Invalid_Stream_Operation;
+        if ( zip->limit == zip->cursor )
+          error = FT_Err_Invalid_Stream_Operation;
         break;
       }
       else if ( err != Z_OK )
diff --git a/src/pfr/Jamfile b/src/pfr/Jamfile
index 3ba0ee9..4c38a2d 100644
--- a/src/pfr/Jamfile
+++ b/src/pfr/Jamfile
@@ -8,7 +8,7 @@ SubDir  FT2_TOP $(FT2_SRC_DIR) pfr ;
 
   if $(FT2_MULTI)
   {
-    _sources = pfrdrivr  pfrgload  pfrload  pfrobjs pfrcmap pfrsbit ;
+    _sources = pfrdrivr pfrgload pfrload pfrobjs pfrcmap pfrsbit ;
   }
   else
   {
diff --git a/src/pfr/pfrsbit.c b/src/pfr/pfrsbit.c
index 5499d29..5dabfe7 100644
--- a/src/pfr/pfrsbit.c
+++ b/src/pfr/pfrsbit.c
@@ -49,7 +49,7 @@
   static void
   pfr_bitwriter_init( PFR_BitWriter  writer,
                       FT_Bitmap*     target,
-                      FT_UInt        decreasing )
+                      FT_Bool        decreasing )
   {
     writer->line   = target->buffer;
     writer->pitch  = target->pitch;
@@ -274,8 +274,8 @@
   static void
   pfr_lookup_bitmap_data( FT_Byte*   base,
                           FT_Byte*   limit,
-                          FT_Int     count,
-                          FT_Byte    flags,
+                          FT_UInt    count,
+                          FT_UInt    flags,
                           FT_UInt    char_code,
                           FT_ULong*  found_offset,
                           FT_ULong*  found_size )
@@ -481,7 +481,7 @@
   pfr_load_bitmap_bits( FT_Byte*    p,
                         FT_Byte*    limit,
                         FT_UInt     format,
-                        FT_UInt     decreasing,
+                        FT_Bool     decreasing,
                         FT_Bitmap*  target )
   {
     FT_Error          error = 0;
@@ -583,7 +583,7 @@
       pfr_lookup_bitmap_data( stream->cursor,
                               stream->limit,
                               strike->num_bitmaps,
-                              (FT_Byte)strike->flags,
+                              strike->flags,
                               character->char_code,
                               &gps_offset,
                               &gps_size );
diff --git a/src/pfr/rules.mk b/src/pfr/rules.mk
index d973186..60b96c7 100644
--- a/src/pfr/rules.mk
+++ b/src/pfr/rules.mk
@@ -29,12 +29,14 @@ PFR_DRV_SRC := $(PFR_DIR)/pfrload.c  \
                $(PFR_DIR)/pfrgload.c \
                $(PFR_DIR)/pfrcmap.c  \
                $(PFR_DIR)/pfrdrivr.c \
+               $(PFR_DIR)/pfrsbit.c  \
                $(PFR_DIR)/pfrobjs.c
 
 # pfr driver headers
 #
 PFR_DRV_H := $(PFR_DRV_SRC:%.c=%.h) \
-             $(PFR_DIR)/pfrerror.h
+             $(PFR_DIR)/pfrerror.h  \
+             $(PFR_DIR)/pfrtypes.h
 
 
 # Pfr driver object(s)
diff --git a/src/pshinter/pshglob.c b/src/pshinter/pshglob.c
index 7c09ea4..3ae5728 100644
--- a/src/pshinter/pshglob.c
+++ b/src/pshinter/pshglob.c
@@ -644,7 +644,7 @@
           read++;
         }
 
-        dim->stdw.count = write - dim->stdw.widths;
+        dim->stdw.count = priv->num_snap_widths;
       }
 
       /* copy standard heights */
@@ -663,7 +663,7 @@
           read++;
         }
 
-        dim->stdw.count = write - dim->stdw.widths;
+        dim->stdw.count = priv->num_snap_heights;
       }
 
       /* copy blue zones */
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index bab6385..deff1c0 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -294,36 +294,39 @@
     FT_Int          n, n_points;
     FT_Int          byte_len   = load->byte_len;
 
+    FT_Byte         *flag, *flag_limit;
+    FT_Byte         c, count;
+    FT_Vector       *vec, *vec_limit;
+    FT_Pos          x;
+    FT_Short        *cont, *cont_limit;
 
-    /* reading the contours endpoints & number of points */
-    {
-      short*  cur   = gloader->current.outline.contours;
-      short*  limit = cur + n_contours;
 
+    /* reading the contours endpoints & number of points */
+    cont       = gloader->current.outline.contours;
+    cont_limit = cont + n_contours;
 
-      /* check space for contours array + instructions count */
-      byte_len -= 2 * ( n_contours + 1 );
-      if ( byte_len < 0 )
-        goto Invalid_Outline;
+    /* check space for contours array + instructions count */
+    byte_len -= 2 * ( n_contours + 1 );
+    if ( byte_len < 0 )
+      goto Invalid_Outline;
 
-      for ( ; cur < limit; cur++ )
-        cur[0] = FT_GET_USHORT();
+    for ( ; cont < cont_limit; cont++ )
+      cont[0] = FT_GET_USHORT();
 
-      n_points = 0;
-      if ( n_contours > 0 )
-        n_points = cur[-1] + 1;
+    n_points = 0;
+    if ( n_contours > 0 )
+      n_points = cont[-1] + 1;
 
-      error = FT_GlyphLoader_CheckPoints( gloader, n_points + 2, 0 );
-      if ( error )
-        goto Fail;
+    error = FT_GlyphLoader_CheckPoints( gloader, n_points + 2, 0 );
+    if ( error )
+      goto Fail;
 
-      /* we'd better check the contours table right now */
-      outline = &gloader->current.outline;
+    /* we'd better check the contours table right now */
+    outline = &gloader->current.outline;
 
-      for ( cur = outline->contours + 1; cur < limit; cur++ )
-        if ( cur[-1] >= cur[0] )
-          goto Invalid_Outline;
-    }
+    for ( cont = outline->contours + 1; cont < cont_limit; cont++ )
+      if ( cont[-1] >= cont[0] )
+        goto Invalid_Outline;
 
     /* reading the bytecode instructions */
     slot->control_len  = 0;
@@ -331,7 +334,7 @@
 
     n_ins = FT_GET_USHORT();
 
-    FT_TRACE5(( "  Instructions size: %d\n", n_ins ));
+    FT_TRACE5(( "  Instructions size: %u\n", n_ins ));
 
     if ( n_ins > face->max_profile.maxSizeOfInstructions )
     {
@@ -340,7 +343,7 @@
       goto Fail;
     }
 
-    byte_len -= n_ins;
+    byte_len -= (FT_Int)n_ins;
     if ( byte_len < 0 )
     {
       FT_TRACE0(( "TT_Load_Simple_Glyph: Instruction count mismatch!\n" ));
@@ -357,112 +360,102 @@
       slot->control_len  = n_ins;
       slot->control_data = load->instructions;
 
-      FT_MEM_COPY( load->instructions, stream->cursor, n_ins );
+      FT_MEM_COPY( load->instructions, stream->cursor, (FT_Long)n_ins );
     }
 
 #endif /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
 
-    stream->cursor += n_ins;
+    stream->cursor += (FT_Int)n_ins;
 
     /* reading the point tags */
-    {
-      FT_Byte*  flag  = (FT_Byte*)outline->tags;
-      FT_Byte*  limit = flag + n_points;
-      FT_Byte   c, count;
+    flag       = (FT_Byte*)outline->tags;
+    flag_limit = flag + n_points;
 
+    while ( flag < flag_limit )
+    {
+      if ( --byte_len < 0 )
+        goto Invalid_Outline;
 
-      while ( flag < limit )
+      *flag++ = c = FT_GET_BYTE();
+      if ( c & 8 )
       {
         if ( --byte_len < 0 )
           goto Invalid_Outline;
 
-        *flag++ = c = FT_GET_BYTE();
-        if ( c & 8 )
-        {
-          if ( --byte_len < 0 )
-            goto Invalid_Outline;
-
-          count = FT_GET_BYTE();
-          if ( flag + count > limit )
-            goto Invalid_Outline;
+        count = FT_GET_BYTE();
+        if ( flag + (FT_Int)count > flag_limit )
+          goto Invalid_Outline;
 
-          for ( ; count > 0; count-- )
-            *flag++ = c;
-        }
+        for ( ; count > 0; count-- )
+          *flag++ = c;
       }
+    }
 
-      /* check that there is enough room to load the coordinates */
-      for ( flag = (FT_Byte*)outline->tags; flag < limit; flag++ )
-      {
-        if ( *flag & 2 )
-          byte_len -= 1;
-        else if ( ( *flag & 16 ) == 0 )
-          byte_len -= 2;
-
-        if ( *flag & 4 )
-          byte_len -= 1;
-        else if ( ( *flag & 32 ) == 0 )
-          byte_len -= 2;
-      }
+    /* check that there is enough room to load the coordinates */
+    for ( flag = (FT_Byte*)outline->tags; flag < flag_limit; flag++ )
+    {
+      if ( *flag & 2 )
+        byte_len -= 1;
+      else if ( ( *flag & 16 ) == 0 )
+        byte_len -= 2;
 
-      if ( byte_len < 0 )
-        goto Invalid_Outline;
+      if ( *flag & 4 )
+        byte_len -= 1;
+      else if ( ( *flag & 32 ) == 0 )
+        byte_len -= 2;
     }
 
+    if ( byte_len < 0 )
+      goto Invalid_Outline;
+
     /* reading the X coordinates */
 
+    vec       = outline->points;
+    vec_limit = vec + n_points;
+    flag      = (FT_Byte*)outline->tags;
+    x         = 0;
+
+    for ( ; vec < vec_limit; vec++, flag++ )
     {
-      FT_Vector*  vec   = outline->points;
-      FT_Vector*  limit = vec + n_points;
-      FT_Byte*    flag  = (FT_Byte*)outline->tags;
-      FT_Pos      x     = 0;
+      FT_Pos  y = 0;
 
 
-      for ( ; vec < limit; vec++, flag++ )
+      if ( *flag & 2 )
       {
-        FT_Pos  y = 0;
-
-
-        if ( *flag & 2 )
-        {
-          y = FT_GET_BYTE();
-          if ( ( *flag & 16 ) == 0 )
-            y = -y;
-        }
-        else if ( ( *flag & 16 ) == 0 )
-          y = FT_GET_SHORT();
-
-        x     += y;
-        vec->x = x;
+        y = (FT_Pos)FT_GET_BYTE();
+        if ( ( *flag & 16 ) == 0 )
+          y = -y;
       }
+      else if ( ( *flag & 16 ) == 0 )
+        y = (FT_Pos)FT_GET_SHORT();
+
+      x     += y;
+      vec->x = x;
     }
 
     /* reading the Y coordinates */
 
+    vec       = gloader->current.outline.points;
+    vec_limit = vec + n_points;
+    flag      = (FT_Byte*)outline->tags;
+    x         = 0;
+
+    for ( ; vec < vec_limit; vec++, flag++ )
     {
-      FT_Vector*  vec   = gloader->current.outline.points;
-      FT_Vector*  limit = vec + n_points;
-      FT_Byte*    flag  = (FT_Byte*)outline->tags;
-      FT_Pos      x     = 0;
+      FT_Pos  y = 0;
 
 
-      for ( ; vec < limit; vec++, flag++ )
+      if ( *flag & 4 )
       {
-        FT_Pos  y = 0;
-
-
-        if ( *flag & 4 )
-        {
-          y = FT_GET_BYTE();
-          if ( ( *flag & 32 ) == 0 )
-            y = -y;
-        }
-        else if ( ( *flag & 32 ) == 0 )
-          y = FT_GET_SHORT();
-
-        x     += y;
-        vec->y = x;
+        y = (FT_Pos)FT_GET_BYTE();
+        if ( ( *flag & 32 ) == 0 )
+          y = -y;
       }
+      else if ( ( *flag & 32 ) == 0 )
+        y = (FT_Pos)FT_GET_SHORT();
+
+      x     += y;
+      vec->y = x;
     }
 
     /* clear the touch tags */