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

diff --git a/Changes b/Changes
index 05e7074b3711e86fb3551e64556a75667a4aa555..691def68d84f253c578f7d41a7bab97aeb31d959 100644 (file)
--- a/Changes
+++ b/Changes
@@ -72,6 +72,9 @@ High severity:
  - avoid dead code in i_ft2_glyph_name(), which is the implementation
    of glyph_names() for FT2.  CID 185342.
 
  - avoid dead code in i_ft2_glyph_name(), which is the implementation
    of glyph_names() for FT2.  CID 185342.
 
+ - avoid dead code in i_t1_glyph_names(), which is the implementation
+   of glyph_names() for T1.  CID 185322.
+
  - avoid an unneeded EXTEND() call when the FT2 has_chars()
    implementation returns 0. CID 185292.
 
  - avoid an unneeded EXTEND() call when the FT2 has_chars()
    implementation returns 0. CID 185292.
 
index 252f3fadfa6a23a540c608498f0fe8c911f3ccaf..9e32cca1f99ba41c79b96ae2ce2779c7347efcc6 100644 (file)
@@ -6,6 +6,9 @@ Coverity detected issue:
  - adjust a pointer parameter from an array-style declaration with 6
    elements to pointer style (since it hasn't been 6 for years.)
 
  - adjust a pointer parameter from an array-style declaration with 6
    elements to pointer style (since it hasn't been 6 for years.)
 
+ - avoid dead code in i_t1_glyph_names(), which is the implementation
+   of glyph_names() for T1.  CID 185322.
+
 Imager::Font::T1 1.024
 ======================
 
 Imager::Font::T1 1.024
 ======================
 
index 56348d5c85061a6831081e51ce257574ab1f44dc..ff30c9585ba692815e137fc7225d253958945f34 100644 (file)
--- a/T1/T1.xs
+++ b/T1/T1.xs
@@ -195,16 +195,14 @@ i_t1_glyph_names(font, text_sv, utf8 = 0)
             ch = *text++;
             --len;
           }
             ch = *text++;
             --len;
           }
-          EXTEND(SP, count+1);
+          EXTEND(SP, 1);
           if (i_t1_glyph_name(font, ch, name, sizeof(name))) {
           if (i_t1_glyph_name(font, ch, name, sizeof(name))) {
-            ST(count) = sv_2mortal(newSVpv(name, 0));
+            PUSHs(sv_2mortal(newSVpv(name, 0)));
           }
           else {
           }
           else {
-            ST(count) = &PL_sv_undef;
+            PUSHs(&PL_sv_undef);
           }
           }
-         ++count;
         }
         }
-       XSRETURN(count);
 
 int
 i_t1_CLONE_SKIP(...)
 
 int
 i_t1_CLONE_SKIP(...)
@@ -216,4 +214,4 @@ i_t1_CLONE_SKIP(...)
 
 BOOT:
        PERL_INITIALIZE_IMAGER_CALLBACKS;
 
 BOOT:
        PERL_INITIALIZE_IMAGER_CALLBACKS;
-       i_t1_start();
\ No newline at end of file
+       i_t1_start();
index 5c820189dd982f5f22a97ce064d2ed6cae2b3cc1..7668641ef08efc0500c78b93bbd92e4a58bc9d19 100644 (file)
@@ -8,8 +8,6 @@ use Cwd qw(getcwd abs_path);
 
 #$Imager::DEBUG=1;
 
 
 #$Imager::DEBUG=1;
 
-plan tests => 110;
-
 ok($Imager::formats{t1}, "must have t1");
 
 -d "testout" or mkdir "testout";
 ok($Imager::formats{t1}, "must have t1");
 
 -d "testout" or mkdir "testout";
@@ -194,6 +192,9 @@ SKIP:
     @glyph_names = $font->glyph_names(string=>$text, utf8=>1);
     is($glyph_names[0], undef, "expect no glyph_name for \\x{20A1}");
 
     @glyph_names = $font->glyph_names(string=>$text, utf8=>1);
     is($glyph_names[0], undef, "expect no glyph_name for \\x{20A1}");
 
+    my @bad = $font->glyph_names(string => "ab\xC0", utf8 => 1);
+    is(@bad, 0, "should be no results for bad utf8");
+
     # make sure a missing string parameter is handled correctly
     eval {
       $font->glyph_names();
     # make sure a missing string parameter is handled correctly
     eval {
       $font->glyph_names();
@@ -406,6 +407,7 @@ SKIP:
   }
 }
 
   }
 }
 
+done_testing();
 
 #malloc_state();
 
 
 #malloc_state();