shithub: freetype+ttf2subf

Download patch

ref: 25a6e3a1677aadd56b8c000f0b9d00f22d3c95f1
parent: b1d8f73df686862cc12dc00def031ecff028d151
author: David Turner <[email protected]>
date: Mon Jun 10 19:03:35 EDT 2002

* include/freetype/internal/ftobjs.h, src/autohint/ahglyph.c,
    src/base/ftobjs.c, src/objs/fttype1.c, src/sfnt/ttcmap0.c,
    src/smooth/ftgrays.c: changed uses of "setjmp" and "longjmp"
    to "ft_setjmp" and "ft_lonjmp". Removed direct references to
    <stdio.h> and <setjmp.h> when appropriate, to eventually replace
    them with a FT_CONFIG_STANDARD_LIBRARY_H. Useful for the XFree86
    Font Server backend based on FT2.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2002-06-08  Juliusz Chroboczek <[email protected]>
+
+    * include/freetype/internal/ftobjs.h, src/autohint/ahglyph.c,
+    src/base/ftobjs.c, src/objs/fttype1.c, src/sfnt/ttcmap0.c,
+    src/smooth/ftgrays.c: changed uses of "setjmp" and "longjmp"
+    to "ft_setjmp" and "ft_lonjmp". Removed direct references to
+    <stdio.h> and <setjmp.h> when appropriate, to eventually replace
+    them with a FT_CONFIG_STANDARD_LIBRARY_H. Useful for the XFree86
+    Font Server backend based on FT2.
+
 2002-06-08  David Turner  <[email protected]>
 
     * src/pcf/pcfdriver.c (pcf_cmap_char_next): fixed a bug that caused
--- a/include/freetype/internal/ftobjs.h
+++ b/include/freetype/internal/ftobjs.h
@@ -26,8 +26,8 @@
 #ifndef __FTOBJS_H__
 #define __FTOBJS_H__
 
-#include <setjmp.h>
 #include <ft2build.h>
+#include FT_CONFIG_STANDARD_LIBRARY_H   /* for ft_setjmp and ft_longjmp */
 #include FT_RENDER_H
 #include FT_SIZES_H
 #include FT_INTERNAL_MEMORY_H
--- a/src/autohint/ahglyph.c
+++ b/src/autohint/ahglyph.c
@@ -26,10 +26,10 @@
 #include "ahglobal.h"
 #include "aherrors.h"
 
-#include <stdio.h>
 
-
 #ifdef AH_DEBUG
+
+#include <stdio.h>
 
   void
   ah_dump_edges( AH_Outline*  outline )
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -37,15 +37,15 @@
     valid->level = level;
     valid->error = 0;
   }
-                       
 
+
   FT_BASE_DEF( FT_Int )
   ft_validator_run( FT_Validator  valid )
   {
     int  result;
-    
 
-    result = setjmp( valid->jump_buffer );
+
+    result = ft_setjmp( valid->jump_buffer );
     return result;
   }
 
@@ -55,8 +55,8 @@
                       FT_Error      error )
   {
     valid->error = error;
-    longjmp( valid->jump_buffer, 1 );
-  }                      
+    ft_longjmp( valid->jump_buffer, 1 );
+  }
 
 
   /*************************************************************************/
@@ -619,18 +619,18 @@
     /* discard charmaps */
     {
       FT_Int  n;
-      
 
+
       for ( n = 0; n < face->num_charmaps; n++ )
       {
         FT_CMap  cmap = FT_CMAP( face->charmaps[n] );
-        
 
+
         FT_CMap_Done( cmap );
-        
+
         face->charmaps[n] = NULL;
       }
-      
+
       FT_FREE( face->charmaps );
       face->num_charmaps = 0;
     }
@@ -1515,8 +1515,8 @@
     if ( face && face->charmap )
     {
       FT_CMap  cmap = FT_CMAP( face->charmap );
-      
 
+
       result = cmap->clazz->char_index( cmap, charcode );
     }
     return  result;
@@ -2403,7 +2403,7 @@
 
 
   /* documentation is in freetype.h */
-  
+
   FT_EXPORT_DEF( void )
   FT_Library_Version( FT_Library   library,
                       FT_Int      *amajor,
@@ -2414,7 +2414,7 @@
     FT_Int  minor = 0;
     FT_Int  patch = 0;
 
-    
+
     if ( library )
     {
       major = library->version_major;
@@ -2421,16 +2421,16 @@
       minor = library->version_minor;
       patch = library->version_patch;
     }
-    
+
     if ( *amajor )
       *amajor = major;
-      
+
     if ( *aminor )
       *aminor = minor;
-      
+
     if ( *apatch )
       *apatch = patch;
-  }                      
+  }
 
 
   /* documentation is in ftmodule.h */
--- a/src/base/fttype1.c
+++ b/src/base/fttype1.c
@@ -89,8 +89,8 @@
       /* this will probably happen later...                         */
 
       driver_name = face->driver->root.clazz->module_name;
-      result      = ( ft_strcmp( driver_name, "type1" ) ||
-                      ft_strcmp( driver_name, "cff"   ) );
+      result      = ( ft_strcmp( driver_name, "type1" ) == 0 ||
+                      ft_strcmp( driver_name, "cff"   ) == 0 );
     }
 
     return result;
--- a/src/sfnt/ttcmap0.c
+++ b/src/sfnt/ttcmap0.c
@@ -742,42 +742,42 @@
         FT_UInt  min = 0;
         FT_UInt  max = num_segs2 >> 1;
         FT_UInt  mid, start, end, offset;
-        
 
+
         while ( min < max )
         {
           mid   = ( min + max ) >> 1;
           p     = table + 14 + mid * 2;
-          end   = TT_NEXT_USHORT( p ); 
+          end   = TT_NEXT_USHORT( p );
           p    += num_segs2;
           start = TT_PEEK_USHORT( p);
-          
+
           if ( code < start )
             max = mid;
-          
+
           else if ( code > end )
             min = mid + 1;
-          
+
           else
           {
             /* we found the segment */
             idx = code;
-            
+
             p += num_segs2;
             delta = TT_PEEK_SHORT( p );
-            
+
             p += num_segs2;
             offset = TT_PEEK_USHORT( p );
-            
+
             if ( offset != 0 )
             {
               p  += offset + 2 * ( idx - start );
               idx = TT_PEEK_USHORT( p );
             }
-            
+
             if ( idx != 0 )
               result = (FT_UInt)( idx + delta ) & 0xFFFFU;
-            
+
             goto Exit;
           }
         }
@@ -793,32 +793,32 @@
         p = table + 14;               /* ends table   */
         q = table + 16 + num_segs2;   /* starts table */
 
-        
+
         for ( n = 0; n < num_segs2; n += 2 )
         {
           FT_UInt  end   = TT_NEXT_USHORT( p );
           FT_UInt  start = TT_NEXT_USHORT( q );
           FT_UInt  offset;
-  
-  
+
+
           if ( code < start )
             break;
-  
+
           if ( code <= end )
           {
             idx = code;
-  
+
             p = q + num_segs2 - 2;
             delta = TT_PEEK_SHORT( p );
             p += num_segs2;
             offset = TT_PEEK_USHORT( p );
-  
+
             if ( offset != 0 )
             {
               p  += offset + 2 * ( idx - start );
               idx = TT_PEEK_USHORT( p );
             }
-  
+
             if ( idx != 0 )
               result = (FT_UInt)( idx + delta ) & 0xFFFFU;
           }
@@ -828,7 +828,7 @@
 #endif /* 0 */
 
     }
-    
+
   Exit:
     return result;
   }
@@ -1032,7 +1032,7 @@
     FT_UInt32  result    = 0;
     FT_UInt32  char_code = *pchar_code + 1;
     FT_UInt    gindex    = 0;
-    
+
     FT_Byte*   p         = table + 6;
     FT_UInt    start     = TT_NEXT_USHORT( p );
     FT_UInt    count     = TT_NEXT_USHORT( p );
@@ -1716,14 +1716,14 @@
           if ( clazz->format == format )
           {
             volatile TT_ValidatorRec  valid;
-            
 
+
             ft_validator_init( FT_VALIDATOR( &valid ), cmap, limit,
                                FT_VALIDATE_DEFAULT );
-                               
+
             valid.num_glyphs = face->root.num_glyphs;
 
-            if ( setjmp( FT_VALIDATOR( &valid )->jump_buffer ) == 0 )
+            if ( ft_setjmp( FT_VALIDATOR( &valid )->jump_buffer ) == 0 )
             {
               /* validate this cmap sub-table */
               clazz->validate( cmap, FT_VALIDATOR( &valid ) );
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -106,6 +106,11 @@
 #include <limits.h>
 #define FT_UINT_MAX  UINT_MAX
 
+#define  ft_setjmp   setjmp
+#define  ft_longjmp  longjmp
+#define  ft_jmp_buf  jmp_buf
+
+
 #define ErrRaster_Invalid_Mode     -2
 #define ErrRaster_Invalid_Outline  -1
 
@@ -391,7 +396,7 @@
     if ( !ras.invalid && ( ras.area | ras.cover ) )
     {
       if ( ras.num_cells >= ras.max_cells )
-        longjmp( ras.jump_buffer, 1 );
+        ft_longjmp( ras.jump_buffer, 1 );
 
       cell        = ras.cells + ras.num_cells++;
       cell->x     = ras.ex - ras.min_ex;
@@ -1355,7 +1360,7 @@
     if ( ras.outline.flags & ft_outline_even_odd_fill )
     {
       coverage &= 511;
-      
+
       if ( coverage > 256 )
         coverage = 512 - coverage;
       else if ( coverage == 256 )
@@ -1791,7 +1796,7 @@
 
     volatile int  error = 0;
 
-    if ( setjmp( ras.jump_buffer ) == 0 )
+    if ( ft_setjmp( ras.jump_buffer ) == 0 )
     {
       error = FT_Outline_Decompose( &ras.outline, &func_interface, &ras );
       gray_record_cell( RAS_VAR );