MAXICODE: fix mask typos for ECI 3/4 bytes

This commit is contained in:
gitlost 2021-03-18 16:21:22 +00:00
parent 14f67331c2
commit 4e501c77da
2 changed files with 14 additions and 7 deletions

View File

@ -432,14 +432,14 @@ static int maxi_text_process(unsigned char maxi_codeword[144], const int mode, c
} else if (eci <= 1023) { } else if (eci <= 1023) {
maxi_bump(set, character, 1); maxi_bump(set, character, 1);
maxi_bump(set, character, 1); maxi_bump(set, character, 1);
character[1] = 0x20 + ((eci >> 6) & 0x0F); character[1] = 0x20 | ((eci >> 6) & 0x0F);
character[2] = eci & 0x3F; character[2] = eci & 0x3F;
length += 3; length += 3;
} else if (eci <= 32767) { } else if (eci <= 32767) {
maxi_bump(set, character, 1); maxi_bump(set, character, 1);
maxi_bump(set, character, 1); maxi_bump(set, character, 1);
maxi_bump(set, character, 1); maxi_bump(set, character, 1);
character[1] = 0x30 + ((eci >> 12) & 0x03); character[1] = 0x30 | ((eci >> 12) & 0x07);
character[2] = (eci >> 6) & 0x3F; character[2] = (eci >> 6) & 0x3F;
character[3] = eci & 0x3F; character[3] = eci & 0x3F;
length += 4; length += 4;
@ -448,7 +448,7 @@ static int maxi_text_process(unsigned char maxi_codeword[144], const int mode, c
maxi_bump(set, character, 1); maxi_bump(set, character, 1);
maxi_bump(set, character, 1); maxi_bump(set, character, 1);
maxi_bump(set, character, 1); maxi_bump(set, character, 1);
character[1] = 0x38 + ((eci >> 18) & 0x02); character[1] = 0x38 | ((eci >> 18) & 0x03);
character[2] = (eci >> 12) & 0x3F; character[2] = (eci >> 12) & 0x3F;
character[3] = (eci >> 6) & 0x3F; character[3] = (eci >> 6) & 0x3F;
character[4] = eci & 0x3F; character[4] = eci & 0x3F;

View File

@ -161,10 +161,17 @@ static void test_input(int index, int generate, int debug) {
/* 27*/ { UNICODE_MODE, -1, -1, 100, "A", -1, "123456123456", 0, 30, "(144) 02 10 22 07 00 20 31 1E 20 1C 0E 29 13 1B 0D 26 36 25 3B 22 3B 2A 29 3B 28 1E 30 31", "SCM prefix version" }, /* 27*/ { UNICODE_MODE, -1, -1, 100, "A", -1, "123456123456", 0, 30, "(144) 02 10 22 07 00 20 31 1E 20 1C 0E 29 13 1B 0D 26 36 25 3B 22 3B 2A 29 3B 28 1E 30 31", "SCM prefix version" },
/* 28*/ { UNICODE_MODE, -1, -1, 101, "A", -1, "123456123456", ZINT_ERROR_INVALID_OPTION, 0, "Error 557: Invalid SCM prefix version", "SCM prefix version" }, /* 28*/ { UNICODE_MODE, -1, -1, 101, "A", -1, "123456123456", ZINT_ERROR_INVALID_OPTION, 0, "Error 557: Invalid SCM prefix version", "SCM prefix version" },
/* 29*/ { UNICODE_MODE, 3, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 03 01 21 21 21 21 21 21 2F 14 23 21 05 24 27 00 24 0C 21 21 21 21 21 21 21 21", "" }, /* 29*/ { UNICODE_MODE, 3, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 03 01 21 21 21 21 21 21 2F 14 23 21 05 24 27 00 24 0C 21 21 21 21 21 21 21 21", "" },
/* 30*/ { UNICODE_MODE, 32, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 20 20 01 21 21 21 21 21 3D 15 0F 30 0D 22 24 35 22 06 21 21 21 21 21 21 21 21", "" }, /* 30*/ { UNICODE_MODE, 31, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 1F 01 21 21 21 21 21 21 00 2F 0E 09 39 3B 24 1A 21 05 21 21 21 21 21 21 21 21", "ECI 0x1F" },
/* 31*/ { UNICODE_MODE, 1024, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 30 10 00 01 21 21 21 21 11 2F 15 10 1D 29 06 35 14 2B 21 21 21 21 21 21 21 21", "" }, /* 31*/ { UNICODE_MODE, 32, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 20 20 01 21 21 21 21 21 3D 15 0F 30 0D 22 24 35 22 06 21 21 21 21 21 21 21 21", "ECI 0x20" },
/* 32*/ { UNICODE_MODE, 32768, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 38 08 00 00 01 21 21 21 10 30 3A 04 26 23 0E 21 3D 0F 21 21 21 21 21 21 21 21", "" }, /* 32*/ { UNICODE_MODE, 1023, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 2F 3F 01 21 21 21 21 21 2E 27 23 1D 35 19 21 04 3A 26 21 21 21 21 21 21 21 21", "ECI 0x3FF" },
/* 33*/ { UNICODE_MODE, -1, 1, -1, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 550: Invalid MaxiCode Mode", "" }, /* 33*/ { UNICODE_MODE, 1024, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 30 10 00 01 21 21 21 21 11 2F 15 10 1D 29 06 35 14 2B 21 21 21 21 21 21 21 21", "ECI 0x400" },
/* 34*/ { UNICODE_MODE, 32767, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 37 3F 3F 01 21 21 21 21 3E 15 12 01 07 30 39 27 04 2B 21 21 21 21 21 21 21 21", "ECI 0x7FFF" },
/* 35*/ { UNICODE_MODE, 32768, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 38 08 00 00 01 21 21 21 10 30 3A 04 26 23 0E 21 3D 0F 21 21 21 21 21 21 21 21", "ECI 0x8000" },
/* 36*/ { UNICODE_MODE, 65535, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 38 0F 3F 3F 01 21 21 21 1C 0E 1D 39 3B 0D 38 25 00 30 21 21 21 21 21 21 21 21", "ECI 0xFFFF" },
/* 37*/ { UNICODE_MODE, 65536, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 38 10 00 00 01 21 21 21 2B 1F 24 06 38 2E 17 1B 10 2F 21 21 21 21 21 21 21 21", "ECI 0x10000" },
/* 38*/ { UNICODE_MODE, 131071, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 38 1F 3F 3F 01 21 21 21 0F 05 09 04 2F 3A 17 09 36 31 21 21 21 21 21 21 21 21", "ECI 0x1FFFF" },
/* 39*/ { UNICODE_MODE, 999999, -1, -1, "A", -1, "", 0, 30, "(144) 04 1B 3B 34 08 3F 01 21 21 21 26 3B 2B 23 08 17 32 05 26 35 21 21 21 21 21 21 21 21", "Max ECI" },
/* 40*/ { UNICODE_MODE, -1, 1, -1, "A", -1, "", ZINT_ERROR_INVALID_OPTION, 0, "Error 550: Invalid MaxiCode Mode", "" },
}; };
int data_size = ARRAY_SIZE(data); int data_size = ARRAY_SIZE(data);