From: Ed D. <ede...@gm...> - 2015-08-17 12:28:09
|
Hi Herald, Yes. This change looks good to me. Thank you for taking it, and thank you for taking on the task of maintaining the Zint C/C++ repository. Ed On Mon, Aug 17, 2015 at 5:52 AM, Harald Oehlmann <har...@el...> wrote: > Ed, > > thank you providing the patch. > > Is this ok for you: > http://sourceforge.net/u/oehhar/zint/ > ? > > Thank you, > Harald > > Am 12.08.2015 um 05:01 schrieb Ed Deinstadt: >> >> I have a code change which fixes the issue below. The changes are in >> maxicode.c. >> >> There are actually two issues showing up in this test. First this code: >> /* Number compression */ >> char substring[11]; >> int value; >> >> for(j = 0; j < 10; j++) { >> substring[j] = character[i + j]; >> } >> substring[10] = '\0'; >> value = atoi(substring); >> >> It extracts 10 characters from character, puts them in substring and >> null terminates the new string. It should however only extract 9 >> characters as the maxicode algorithm only allows for the compression >> of 9 numeric characters in a single run. With the current code, and a >> run of 10 or more digits available, "value" will be too large (10 >> digits worth). The fix is straightforward: >> >> /* Number compression */ >> char substring[10]; >> int value; >> >> for(j = 0; j < 9; j++) { >> substring[j] = character[i + j]; >> } >> substring[9] = '\0'; >> value = atoi(substring); >> >> After making the above change, the data I supplied is now decoded >> properly, except for the last zero. The following loop: >> >> /* Add shift and latch characters */ >> current_set = 1; >> i = 0; >> do { >> >> if(set[i] != current_set ) { >> switch(set[i]) { >> case 1: >> if(set[i + 1] == 1) { >> if(set[i + 2] == 1) { >> if(set[i + 3] == 1) { >> /* Latch A */ >> . >> . >> . >> >> case 6: >> /* Number Compressed */ >> /* Do nothing */ >> break; >> } >> i++; >> } >> i++; >> } while(i < 145); >> >> skips over the character after each set[i] value of 6 when setting the >> shift and latch characters (i is incremented twice even though no new >> Shift/Latch control characters have been inserted). This change fixes >> this issue: >> >> /* Add shift and latch characters */ >> current_set = 1; >> i = 0; >> do { >> >> if(set[i] != current_set && set[i] != 6) { >> . >> . >> . >> Please consider putting these changes into the Zint library. >> >> Thanks >> Ed Deinstadt >> >> >> >> >> >> On Mon, Aug 10, 2015 at 12:48 PM, Ed Deinstadt <ede...@gm...> >> wrote: >>> >>> Hi, >>> >>> I am a c/C++ developer, I am new to Zint. I have been using the Zint >>> backend library (version 2.4.3 cloned from >>> git://git.code.sf.net/p/zint/code zint-code). I am producing MaxiCode >>> symbols, but I have come across what seems to be an error when >>> encoding some specific data in a MaxiCode symbol. I can reproduce the >>> symptom in Zint BarCode studio 2.4. I am encoding the following data >>> in Mode 4. >>> >>> When I encode the data: "MaxiCode >>> ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890" >>> (without the quotes), and scan the symbol my scanner, a Honeywell >>> 4600g, I get "MaxiCode >>> ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz160826066,". >>> >>> The data returned by the scanner matches the input except for the last >>> 9 bytes. I have observed that if I shorten the data by removing the >>> last character(the zero), the data returned matches the input. >>> >>> I was able to successfully encode, and scan the data above with the >>> ByteScout encoder available from: >>> http://bytescout.com/files/BarCodeGenerator.exe >>> >>> I have attached .png file (ZintMaxiCode.png) generated by Zint BarCode >>> Studio (which does not scan properly), and a .png file generated by >>> ByteScout's BarCodeGenerator which I have scanned properly. >>> >>> Has anyone seen this issue before? Is there a fix available? Perhaps I >>> have exceeded some limit. I haven't been able to find a post, but like >>> I said I am new to Zint... >>> >>> Thanks for any help! >>> >>> Ed Deinstadt |