* src/base/ftobjs.c (FT_Get_Glyph_Name): Fix compiler warning. Introdruced in previous change. Reported by Alexei.
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
diff --git a/ChangeLog b/ChangeLog
index 32f06a3..f406b9c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-27 Werner Lemberg <wl@gnu.org>
+
+ * src/base/ftobjs.c (FT_Get_Glyph_Name): Fix compiler warning.
+
+ Introdruced in previous change. Reported by Alexei.
+
2014-11-26 Werner Lemberg <wl@gnu.org>
* src/*: Add checks for parameters of API functions where missing.
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 96d83c6..32a372b 100644
--- 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;
-
-
- FT_FACE_LOOKUP_SERVICE( face,
- service,
- GLYPH_DICT );
+ if ( (FT_Long)glyph_index > face->num_glyphs ||
+ !FT_HAS_GLYPH_NAMES( face ) )
+ return FT_THROW( Invalid_Argument );
- 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 );