shithub: freetype+ttf2subf

Download patch

ref: 3d167cbe7f672208f4197237945d52a4356de420
parent: f34f1925358057d2e374303408088f6c15bebfb8
author: Werner Lemberg <[email protected]>
date: Thu Nov 27 00:19:41 EST 2014

* src/base/ftobjs.c (FT_Get_Glyph_Name): Fix compiler warning.

Introdruced in previous change.  Reported by Alexei.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-27  Werner Lemberg  <[email protected]>
+
+	* src/base/ftobjs.c (FT_Get_Glyph_Name): Fix compiler warning.
+
+	Introdruced in previous change.  Reported by Alexei.
+
 2014-11-26  Werner Lemberg  <[email protected]>
 
 	* src/*: Add checks for parameters of API functions where missing.
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -3635,7 +3635,8 @@
                      FT_Pointer  buffer,
                      FT_UInt     buffer_max )
   {
-    FT_Error  error;
+    FT_Error              error;
+    FT_Service_GlyphDict  service;
 
 
     if ( !face )
@@ -3645,21 +3646,15 @@
       return FT_THROW( Invalid_Argument );
 
     /* clean up buffer */
-    ((FT_Byte*)buffer)[0] = 0;
+    ((FT_Byte*)buffer)[0] = '\0';
 
-    if ( (FT_Long)glyph_index <= face->num_glyphs &&
-         FT_HAS_GLYPH_NAMES( face )               )
-    {
-      FT_Service_GlyphDict  service;
+    if ( (FT_Long)glyph_index > face->num_glyphs ||
+         !FT_HAS_GLYPH_NAMES( face )             )
+      return FT_THROW( Invalid_Argument );
 
-
-      FT_FACE_LOOKUP_SERVICE( face,
-                              service,
-                              GLYPH_DICT );
-
-      if ( service && service->get_name )
-        error = service->get_name( face, glyph_index, buffer, buffer_max );
-    }
+    FT_FACE_LOOKUP_SERVICE( face, service, GLYPH_DICT );
+    if ( service && service->get_name )
+      error = service->get_name( face, glyph_index, buffer, buffer_max );
     else
       error = FT_THROW( Invalid_Argument );