Commit c3e83b4662962bdfd6cf9c6f4acaececea806ca0

Werner Lemberg 2016-07-11T05:56:26

Replace calls to `atol' with `strtol'. We later on need strtol's `endptr' feature. * include/freetype/config/ftstdlib.h (ft_atol): Replace with... (ft_strtol): ... this. * src/base/ftdbgmem.c (ft_mem_debug_init): Updated. * src/cid/cidparse.c (cid_parser_new): Ditto. * src/type42/t42drivr.c (t42_get_name_index), src/type42/t42objs.c (T42_GlyphSlot_Load): Ditto.

diff --git a/ChangeLog b/ChangeLog
index 4f917b2..830840e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2016-07-11  Werner Lemberg  <wl@gnu.org>
+
+	Replace calls to `atol' with `strtol'.
+
+	We later on need strtol's `endptr' feature.
+
+	* include/freetype/config/ftstdlib.h (ft_atol): Replace with...
+	(ft_strtol): ... this.
+
+	* src/base/ftdbgmem.c (ft_mem_debug_init): Updated.
+	* src/cid/cidparse.c (cid_parser_new): Ditto.
+	* src/type42/t42drivr.c (t42_get_name_index), src/type42/t42objs.c
+	(T42_GlyphSlot_Load): Ditto.
+
 2016-07-10  Werner Lemberg  <wl@gnu.org>
 
 	Implement handling of `FREETYPE_PROPERTIES' environment variable.
diff --git a/include/freetype/config/ftstdlib.h b/include/freetype/config/ftstdlib.h
index 58b95a7..6eefa9f 100644
--- a/include/freetype/config/ftstdlib.h
+++ b/include/freetype/config/ftstdlib.h
@@ -142,7 +142,7 @@
   /**********************************************************************/
 
 
-#define ft_atol    atol
+#define ft_strtol  strtol
 #define ft_getenv  getenv
 
 
diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c
index 6ab5072..38d1a80 100644
--- a/src/base/ftdbgmem.c
+++ b/src/base/ftdbgmem.c
@@ -842,7 +842,7 @@
         p = getenv( "FT2_ALLOC_TOTAL_MAX" );
         if ( p != NULL )
         {
-          FT_Long   total_max = ft_atol( p );
+          FT_Long  total_max = ft_strtol( p, NULL, 10 );
 
 
           if ( total_max > 0 )
@@ -855,7 +855,7 @@
         p = getenv( "FT2_ALLOC_COUNT_MAX" );
         if ( p != NULL )
         {
-          FT_Long  total_count = ft_atol( p );
+          FT_Long  total_count = ft_strtol( p, NULL, 10 );
 
 
           if ( total_count > 0 )
@@ -868,7 +868,7 @@
         p = getenv( "FT2_KEEP_ALIVE" );
         if ( p != NULL )
         {
-          FT_Long  keep_alive = ft_atol( p );
+          FT_Long  keep_alive = ft_strtol( p, NULL, 10 );
 
 
           if ( keep_alive > 0 )
diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c
index 73aca2a..cca4363 100644
--- a/src/cid/cidparse.c
+++ b/src/cid/cidparse.c
@@ -213,7 +213,7 @@
       {
         if ( ft_strncmp( (char*)arg1, "(Hex)", 5 ) == 0 )
         {
-          FT_Long  tmp = ft_atol( (const char *)arg2 );
+          FT_Long  tmp = ft_strtol( (const char *)arg2, NULL, 10 );
 
 
           if ( tmp < 0 )
diff --git a/src/type42/t42drivr.c b/src/type42/t42drivr.c
index c63ed0c..54c4eb3 100644
--- a/src/type42/t42drivr.c
+++ b/src/type42/t42drivr.c
@@ -81,7 +81,8 @@
 
 
       if ( glyph_name[0] == gname[0] && !ft_strcmp( glyph_name, gname ) )
-        return (FT_UInt)ft_atol( (const char *)face->type1.charstrings[i] );
+        return (FT_UInt)ft_strtol( (const char *)face->type1.charstrings[i],
+                                   NULL, 10 );
     }
 
     return 0;
diff --git a/src/type42/t42objs.c b/src/type42/t42objs.c
index 4672c6e..089ae0f 100644
--- a/src/type42/t42objs.c
+++ b/src/type42/t42objs.c
@@ -656,8 +656,9 @@
     FT_TRACE1(( "T42_GlyphSlot_Load: glyph index %d\n", glyph_index ));
 
     /* map T42 glyph index to embedded TTF's glyph index */
-    glyph_index = (FT_UInt)ft_atol(
-                    (const char *)t42face->type1.charstrings[glyph_index] );
+    glyph_index = (FT_UInt)ft_strtol(
+                    (const char *)t42face->type1.charstrings[glyph_index],
+                    NULL, 10 );
 
     t42_glyphslot_clear( t42slot->ttslot );
     error = ttclazz->load_glyph( t42slot->ttslot,