diff --git a/ChangeLog b/ChangeLog index 32f06a308..f406b9cf8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-11-27 Werner Lemberg + + * src/base/ftobjs.c (FT_Get_Glyph_Name): Fix compiler warning. + + Introdruced in previous change. Reported by Alexei. + 2014-11-26 Werner Lemberg * src/*: Add checks for parameters of API functions where missing. diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 96d83c652..32a372b7f 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; + 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 );