]> git.imager.perl.org - imager.git/blobdiff - fontft1.c
avoid a possible sign-extension for offsets/sizes in SGI
[imager.git] / fontft1.c
index cf2043f70c4bc63902386ec3462bf708d33b0c8a..50602902d3c9ef750c23e426fb33ce4d0283aef4 100644 (file)
--- a/fontft1.c
+++ b/fontft1.c
@@ -613,7 +613,7 @@ i_tt_get_glyph( TT_Fonthandle *handle, int inst, unsigned long j) {
   if ( LTT_hinted ) load_flags |= TTLOAD_HINT_GLYPH;
   
   if ( !TT_VALID(handle->char_map) ) {
-    code = (j - ' ' + 1) < 0 ? 0 : (j - ' ' + 1);
+    code = (j < ' ' - 1)  ? 0 : (j - (' ' - 1));
     if ( code >= handle->properties.num_Glyphs ) code = 0;
   } else code = TT_Char_Index( handle->char_map, j );
   
@@ -687,7 +687,7 @@ i_tt_has_chars(TT_Fonthandle *handle, char const *text, size_t len, int utf8,
       index = TT_Char_Index(handle->char_map, c);
     }
     else {
-      index = (c - ' ' + 1) < 0 ? 0 : (c - ' ' + 1);
+      index = (c < ' ' - 1) ? 0 : (c - (' ' - 1));
       if (index >= handle->properties.num_Glyphs)
         index = 0;
     }