shithub: freetype+ttf2subf

Download patch

ref: 3650f8016588ecbf89eb3034c45111b77c3c3ca4
parent: bf06b62a09f538f86a3890efaef96d709693aaae
author: Huw Davies <[email protected]>
date: Wed Mar 14 14:29:57 EDT 2012

[sfnt] A refinement of the previous commit.

* src/sfnt/sfobjs.c (tt_name_entry_ascii_from_utf16,
tt_name_entry_ascii_from_other): Stop at null byte.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2012-03-14  Huw Davies  <[email protected]>
 
+	[sfnt] A refinement of the previous commit.
+
+	* src/sfnt/sfobjs.c (tt_name_entry_ascii_from_utf16,
+	tt_name_entry_ascii_from_other): Stop at null byte.
+
+2012-03-14  Huw Davies  <[email protected]>
+
 	[sfnt] Add `name' table compatibility to MS Windows.
 
 	* src/sfnt/sfobjs.c (tt_name_entry_ascii_from_utf16,
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -64,13 +64,17 @@
     for ( n = 0; n < len; n++ )
     {
       code = FT_NEXT_USHORT( read );
-      if ( code != 0 && ( code < 32 || code > 127 ) )
+
+      if ( code == 0 )
+        break;
+
+      if ( code < 32 || code > 127 )
         code = '?';
 
       string[n] = (char)code;
     }
 
-    string[len] = 0;
+    string[n] = 0;
 
     return string;
   }
@@ -95,13 +99,17 @@
     for ( n = 0; n < len; n++ )
     {
       code = *read++;
-      if ( code != 0 && ( code < 32 || code > 127 ) )
+
+      if ( code == 0 )
+        break;
+
+      if ( code < 32 || code > 127 )
         code = '?';
 
       string[n] = (char)code;
     }
 
-    string[len] = 0;
+    string[n] = 0;
 
     return string;
   }