shithub: freetype+ttf2subf

Download patch

ref: 04edbbda3cdf2ac0c7b90203ea87549e6f90753b
parent: 3e86711ebf6efdea405f8f35bc34baf737b744df
author: Werner Lemberg <[email protected]>
date: Tue Nov 25 05:21:13 EST 2014

*/*: s/Invalid_Argument/Invalid_Face_Handle/ where appropriate.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-11-25  Werner Lemberg  <[email protected]>
+
+	*/*: s/Invalid_Argument/Invalid_Face_Handle/ where appropriate.
+
 2014-11-24  Werner Lemberg  <[email protected]>
 
 	[Savannah bug #43682] Adjust some renderer callbacks.
@@ -9,7 +13,7 @@
 	for orthogonality.
 	(ft_grays_raster): Use it.
 
-2014-11-24  Werner Lemberg  <[email protected]>
+2014-11-25  Werner Lemberg  <[email protected]>
 
 	[Savannah bug #43682] Properly handle missing return errors.
 
@@ -25,7 +29,7 @@
 	TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
 	src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
 
-2014-11-24  Werner Lemberg  <[email protected]>
+2014-11-25  Werner Lemberg  <[email protected]>
 
 	[Savannah bug #43682] Add/remove `void' casts to some functions.
 
@@ -39,7 +43,7 @@
 	src/type1/t1load.c (parse_encoding), src/type42/t42parse.c
 	(t42_parse_encoding): Do it.
 
-2014-11-24  Werner Lemberg  <[email protected]>
+2014-11-25  Werner Lemberg  <[email protected]>
 
 	[Savannah bug #43682] Change some signatures to `void' return type.
 
--- a/src/autofit/afmodule.c
+++ b/src/autofit/afmodule.c
@@ -55,7 +55,7 @@
 
 
     if ( !face )
-      return FT_THROW( Invalid_Argument );
+      return FT_THROW( Invalid_Face_Handle );
 
     globals = (AF_FaceGlobals)face->autohint.data;
     if ( !globals )
--- a/src/base/ftadvanc.c
+++ b/src/base/ftadvanc.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Quick computation of advance widths (body).                          */
 /*                                                                         */
-/*  Copyright 2008, 2009, 2011, 2013 by                                    */
+/*  Copyright 2008, 2009, 2011, 2013, 2014 by                              */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -80,6 +80,9 @@
     if ( !face )
       return FT_THROW( Invalid_Face_Handle );
 
+    if ( !padvance )
+      return FT_THROW( Invalid_Argument );
+
     if ( gindex >= (FT_UInt)face->num_glyphs )
       return FT_THROW( Invalid_Glyph_Index );
 
@@ -117,6 +120,9 @@
 
     if ( !face )
       return FT_THROW( Invalid_Face_Handle );
+
+    if ( !padvances )
+      return FT_THROW( Invalid_Argument );
 
     num = (FT_UInt)face->num_glyphs;
     end = start + count;
--- a/src/base/ftbdf.c
+++ b/src/base/ftbdf.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType API for accessing BDF-specific strings (body).              */
 /*                                                                         */
-/*  Copyright 2002-2004, 2013 by                                           */
+/*  Copyright 2002-2004, 2013, 2014 by                                     */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -17,6 +17,8 @@
 
 
 #include <ft2build.h>
+#include FT_INTERNAL_DEBUG_H
+
 #include FT_INTERNAL_OBJECTS_H
 #include FT_SERVICE_BDF_H
 
@@ -32,20 +34,17 @@
     const char*  encoding = NULL;
     const char*  registry = NULL;
 
+    FT_Service_BDF  service;
 
-    error = FT_ERR( Invalid_Argument );
 
-    if ( face )
-    {
-      FT_Service_BDF  service;
+    if ( !face )
+      return FT_THROW( Invalid_Face_Handle );
 
+    FT_FACE_FIND_SERVICE( face, service, BDF );
 
-      FT_FACE_FIND_SERVICE( face, service, BDF );
+    if ( service && service->get_charset_id )
+      error = service->get_charset_id( face, &encoding, &registry );
 
-      if ( service && service->get_charset_id )
-        error = service->get_charset_id( face, &encoding, &registry );
-    }
-
     if ( acharset_encoding )
       *acharset_encoding = encoding;
 
@@ -65,23 +64,23 @@
   {
     FT_Error  error;
 
+    FT_Service_BDF  service;
 
-    error = FT_ERR( Invalid_Argument );
 
-    aproperty->type = BDF_PROPERTY_TYPE_NONE;
+    if ( !face )
+      return FT_THROW( Invalid_Face_Handle );
 
-    if ( face )
-    {
-      FT_Service_BDF  service;
+    if ( !aproperty )
+      return FT_THROW( Invalid_Argument );
 
+    aproperty->type = BDF_PROPERTY_TYPE_NONE;
 
-      FT_FACE_FIND_SERVICE( face, service, BDF );
+    FT_FACE_FIND_SERVICE( face, service, BDF );
 
-      if ( service && service->get_property )
-        error = service->get_property( face, prop_name, aproperty );
-    }
+    if ( service && service->get_property )
+      error = service->get_property( face, prop_name, aproperty );
 
-    return  error;
+    return error;
   }
 
 
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -408,7 +408,10 @@
     FT_GlyphSlot     slot = NULL;
 
 
-    if ( !face || !face->driver )
+    if ( !face )
+      return FT_THROW( Invalid_Face_Handle );
+
+    if ( !face->driver )
       return FT_THROW( Invalid_Argument );
 
     driver = face->driver;
@@ -3630,7 +3633,7 @@
   FT_Get_Sfnt_Table( FT_Face      face,
                      FT_Sfnt_Tag  tag )
   {
-    void*                  table = 0;
+    void*                  table = NULL;
     FT_Service_SFNT_Table  service;
 
 
@@ -3752,7 +3755,7 @@
 
     face = size->face;
     if ( !face || !face->driver )
-      return FT_THROW( Invalid_Argument );
+      return FT_THROW( Invalid_Face_Handle );
 
     /* we don't need anything more complex than that; all size objects */
     /* are already listed by the face                                  */
--- a/src/base/ftpfr.c
+++ b/src/base/ftpfr.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    FreeType API for accessing PFR-specific data (body).                 */
 /*                                                                         */
-/*  Copyright 2002-2004, 2008, 2010, 2013 by                               */
+/*  Copyright 2002-2004, 2008, 2010, 2013, 2014 by                         */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -50,7 +50,7 @@
 
 
     if ( !face )
-      return FT_THROW( Invalid_Argument );
+      return FT_THROW( Invalid_Face_Handle );
 
     service = ft_pfr_check( face );
     if ( service )
@@ -106,7 +106,7 @@
 
 
     if ( !face )
-      return FT_THROW( Invalid_Argument );
+      return FT_THROW( Invalid_Face_Handle );
 
     service = ft_pfr_check( face );
     if ( service )
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -679,7 +679,13 @@
     FT_UNUSED( load_flags );
 
 
-    if ( !face || glyph_index >= (FT_UInt)face->num_glyphs )
+    if ( !face )
+    {
+      error = FT_THROW( Invalid_Face_Handle );
+      goto Exit;
+    }
+
+    if ( glyph_index >= (FT_UInt)face->num_glyphs )
     {
       error = FT_THROW( Invalid_Argument );
       goto Exit;
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -494,7 +494,13 @@
 
     FT_TRACE1(( "PCF_Glyph_Load: glyph index %d\n", glyph_index ));
 
-    if ( !face || glyph_index >= (FT_UInt)face->root.num_glyphs )
+    if ( !face )
+    {
+      error = FT_THROW( Invalid_Face_Handle );
+      goto Exit;
+    }
+
+    if ( glyph_index >= (FT_UInt)face->root.num_glyphs )
     {
       error = FT_THROW( Invalid_Argument );
       goto Exit;
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -370,7 +370,7 @@
       return FT_THROW( Invalid_Size_Handle );
 
     if ( !face )
-      return FT_THROW( Invalid_Argument );
+      return FT_THROW( Invalid_Face_Handle );
 
 #ifdef FT_CONFIG_OPTION_INCREMENTAL
     if ( glyph_index >= (FT_UInt)face->num_glyphs &&
--- a/src/winfonts/winfnt.c
+++ b/src/winfonts/winfnt.c
@@ -974,7 +974,7 @@
 
     if ( !face )
     {
-      error = FT_THROW( Invalid_Argument );
+      error = FT_THROW( Invalid_Face_Handle );
       goto Exit;
     }