*/*: s/Invalid_Argument/Invalid_Face_Handle/ where appropriate.
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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296
diff --git a/ChangeLog b/ChangeLog
index 93ee74e..29ea4c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2014-11-25 Werner Lemberg <wl@gnu.org>
+
+ */*: s/Invalid_Argument/Invalid_Face_Handle/ where appropriate.
+
2014-11-24 Werner Lemberg <wl@gnu.org>
[Savannah bug #43682] Adjust some renderer callbacks.
@@ -9,7 +13,7 @@
for orthogonality.
(ft_grays_raster): Use it.
-2014-11-24 Werner Lemberg <wl@gnu.org>
+2014-11-25 Werner Lemberg <wl@gnu.org>
[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 <wl@gnu.org>
+2014-11-25 Werner Lemberg <wl@gnu.org>
[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 <wl@gnu.org>
+2014-11-25 Werner Lemberg <wl@gnu.org>
[Savannah bug #43682] Change some signatures to `void' return type.
diff --git a/src/autofit/afmodule.c b/src/autofit/afmodule.c
index 181cf55..81ece38 100644
--- 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 )
diff --git a/src/base/ftadvanc.c b/src/base/ftadvanc.c
index 5207847..18884ef 100644
--- 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 );
@@ -118,6 +121,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;
if ( start >= num || end < start || end > num )
diff --git a/src/base/ftbdf.c b/src/base/ftbdf.c
index 5755f85..6b53432 100644
--- 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,19 +34,16 @@
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, ®istry );
- }
+ if ( service && service->get_charset_id )
+ error = service->get_charset_id( face, &encoding, ®istry );
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;
}
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 3c107e4..b73957b 100644
--- 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 */
diff --git a/src/base/ftpfr.c b/src/base/ftpfr.c
index 0ba955f..ddb58c1 100644
--- 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 )
diff --git a/src/bdf/bdfdrivr.c b/src/bdf/bdfdrivr.c
index c270d59..55a428c 100644
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -679,7 +679,13 @@ THE SOFTWARE.
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;
diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c
index 5183f6f..96f6912 100644
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -494,7 +494,13 @@ THE SOFTWARE.
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;
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index af8824f..64e433d 100644
--- 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 &&
diff --git a/src/winfonts/winfnt.c b/src/winfonts/winfnt.c
index fd5cc4a..f90b084 100644
--- 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;
}