[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-barcode] Correction to codabar
From: |
Kees Cook |
Subject: |
[Bug-barcode] Correction to codabar |
Date: |
Thu, 16 Jan 2014 11:51:03 -0800 |
Hi, with this correction, output barcodes match what I'm seeing with other
codabar outputs. Found in Debian:
Author: Chris Howie <address@hidden>
Description: Following codabar specification (Closes: #320908).
Index: barcode-0.99/codabar.c
===================================================================
--- barcode-0.99.orig/codabar.c 2014-01-16 10:47:29.089436277 -0800
+++ barcode-0.99/codabar.c 2014-01-16 10:47:29.085436222 -0800
@@ -28,10 +28,11 @@
/* this is ordered in decades to simplify encoding */
static char alphabet[] =
- "0123456789" "-$:/.+ABCD";
+ "0123456789" "-$:/.+ABCDTN*E";
#define CODE_A 16
#define CODE_B 17
+#define CODE_T 20
#define NARROW 12
#define WIDE 14
@@ -41,7 +42,8 @@
"1111133","1111331","1113113","3311111","1131131",
"3111131","1311113","1311311","1331111","3113111",
"1113311","1133111","3111313","3131113","3131311",
-"1131313","1133131","1313113","1113133","1113331" };
+"1131313","1133131","1313113","1113133","1113331",
+"1133131","1313113","1113133","1113331"};
/*
* Check that the text can be encoded. Returns 0 or -1.
@@ -166,13 +168,13 @@
}
if (!startpresent) {
if (usesum) {
- /* if no start character specified, B is used as a stop char */
- checksum += CODE_B;
+ /* if no start character specified, T is used as a stop char */
+ checksum += CODE_T;
checksum = (checksum + 15) / 16 * 16 - checksum;
add_one(ptr, checksum);
ptr += strlen(ptr);
}
- add_one(ptr, CODE_B);
+ add_one(ptr, CODE_T);
}
bc->partial = partial;
bc->textinfo = textinfo;
--
Kees Cook @outflux.net
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug-barcode] Correction to codabar,
Kees Cook <=