]> git.imager.perl.org - imager.git/commitdiff
avoid dead code in i_ft2_glyph_name()
authorTony Cook <tony@develop-help.com>
Wed, 2 Jan 2019 08:04:33 +0000 (19:04 +1100)
committerTony Cook <tony@develop-help.com>
Wed, 2 Jan 2019 08:04:33 +0000 (19:04 +1100)
Changes
FT2/Changes
FT2/FT2.pm
FT2/FT2.xs
FT2/t/t10ft2.t

diff --git a/Changes b/Changes
index fde0e81f66c6ff4f58d684461bc9c46ed4ab42cf..0fa06a2038ad17c2e9bf91df03d6c018b27b3b70 100644 (file)
--- a/Changes
+++ b/Changes
@@ -69,6 +69,9 @@ High severity:
  - avoid dead code in i_get_anonymous_color_histo(), which is the
    implementation of getcolorusage().  CID 185327.
 
+ - avoid dead code in i_ft2_glyph_name(), which is the implementation
+   of glyph_names() for FT2.  CID 185342.
+
 Imager 1.008 - 31 Dec 2018
 ============
 
index 3b7b1ca3cef6994f10d0dc084467c14484964749..8d6b5e1c28f0cbeb99ae460403586e24e73b170a 100644 (file)
@@ -1,3 +1,9 @@
+Imager-Font-FT2 0.95
+====================
+
+ - avoid dead code in i_ft2_glyph_name(), which is the implementation
+   of glyph_names().  CID 185342.
+
 Imager-Font-FT2 0.94
 ====================
 
index e89b1470fea80e51a7a78c926eb0c1d7494ff3b0..93cd707fbf0767a6fc7622952c8316b25efd06aa 100644 (file)
@@ -6,7 +6,7 @@ use vars qw($VERSION @ISA);
 @ISA = qw(Imager::Font);
 
 BEGIN {
-  $VERSION = "0.95";
+  $VERSION = "0.96";
 
   require XSLoader;
   XSLoader::load('Imager::Font::FT2', $VERSION);
index 7b9a8b9f72427122e61d3eb6707dfa62ee9b41c3..dd934427da56a37568ed84b1412f037865a53f34 100644 (file)
@@ -303,17 +303,15 @@ i_ft2_glyph_name(handle, text_sv, utf8 = 0, reliable_only = 1)
             ch = *text++;
             --len;
           }
-          EXTEND(SP, count+1);
+          EXTEND(SP, 1);
           if (i_ft2_glyph_name(handle, ch, name, sizeof(name), 
                                          reliable_only)) {
-            ST(count) = sv_2mortal(newSVpv(name, 0));
+            PUSHs(sv_2mortal(newSVpv(name, 0)));
           }
           else {
-            ST(count) = &PL_sv_undef;
+            PUSHs(&PL_sv_undef);
           }
-         ++count;
         }
-       XSRETURN(count);
 
 int
 i_ft2_can_do_glyph_names()
index af9654546e35b87e6534291b4d6d64dab4de4536..4643f9d775ceb7bc6aa3cf9146286d750576ab03 100644 (file)
@@ -1,6 +1,6 @@
 #!perl -w
 use strict;
-use Test::More tests => 204;
+use Test::More;
 use Cwd qw(getcwd abs_path);
 
 use Imager qw(:all);
@@ -332,6 +332,10 @@ SKIP:
       my @names = $exfont->glyph_names(string=>$text,
                                        utf8=>1, reliable_only=>0);
       is($names[0], "hyphentwo", "check utf8 glyph name");
+
+      # make sure we get an empty list with bad utf8
+      my @bad = $exfont->glyph_names(string => "ab\xC0", utf8 => 1);
+      is(@bad, 0, "properly got empty result with bad utf8");
     }
   }
 
@@ -595,6 +599,8 @@ SKIP:
 
 Imager->close_log();
 
+done_testing();
+
 END {
   unless ($ENV{IMAGER_KEEP_FILES}) {
     unlink map "testout/$_", @test_output;