Avoids initial zero-length byte sequence when input starts with 6+ digits followed by kanji by adding mode0NbeforeB NbeforeK -> N check in mode -1.
Previously would -> B in mode -1 then bounce immediately to -> N in mode B (due to modeBNbeforeK NbeforeK check).
Now 4+ digits will cause mode N to be used, same as NbeforeB, which seems reasonable and conservative I think given that deciding between mode N and mode B.
Alternatively could just check for charslen being zero when looping through the sequences and skip if so... more defensive in case there're other ways 0-length sequences could arise but somewhat hacky?
(Discovered this when adding a test case to Zint for the "invalid byte pairs in Kanji mode" fix [8fcbe7c]. Note the barcode still decodes ok, just unnecessary bloat.)
Avoids initial zero-length byte sequence when input starts with 6+ digits followed by kanji by adding
mode0NbeforeB NbeforeK
-> N check in mode -1.Previously would -> B in mode -1 then bounce immediately to -> N in mode B (due to
modeBNbeforeK NbeforeK
check).Now 4+ digits will cause mode N to be used, same as
NbeforeB
, which seems reasonable and conservative I think given that deciding between mode N and mode B.Alternatively could just check for
charslen
being zero when looping through the sequences and skip if so... more defensive in case there're other ways 0-length sequences could arise but somewhat hacky?(Discovered this when adding a test case to Zint for the "invalid byte pairs in Kanji mode" fix [8fcbe7c]. Note the barcode still decodes ok, just unnecessary bloat.)