- gradgen() allocated the wrong amount of space (always too much) for
the color array. CID 185291.
+ - avoid dead code in i_tt_glyph_names(). CID 185321.
+
Imager 1.008 - 31 Dec 2018
============
size_t len;
size_t outsize;
char name[255];
- SSize_t count = 0;
PPCODE:
i_clear_error();
text = SvPV(text_sv, work_len);
ch = *text++;
--len;
}
- EXTEND(SP, count+1);
+ EXTEND(SP, 1);
if ((outsize = i_tt_glyph_name(handle, ch, name, sizeof(name))) != 0) {
- 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);
#endif
#!perl -w
use strict;
-use Test::More tests => 97;
+use Test::More;
$|=1;
is($glyph_names[0], 'exclam', "check exclam name OO");
ok(!defined($glyph_names[1]), "check for no J name OO");
is($glyph_names[2], 'slash', "check slash name OO");
+
+ # check invalid utf8
+ my @bad = $hcfont->glyph_names(string => "!/\xC0", utf8 => 1);
+ is(@bad, 0, "should return nothing for invalid UTF-8");
print "# ** name table of the test font **\n";
Imager::i_tt_dump_names($hcfont->{id});
ok(1, "end of code");
}
+
+done_testing();