diff --git a/backend/dm200.c b/backend/dm200.c index aef37f0a..99a56e0f 100644 --- a/backend/dm200.c +++ b/backend/dm200.c @@ -250,8 +250,9 @@ char ecc200encode(unsigned char *t, int tl, unsigned char *s, int sl, case 't': // Text case 'x': // X12 { - char out[6], p = 0; - const char *e, + char out[6]; + int p = 0; + const char *e=0, *s2 = "!\"#$%&'()*+,-./:;<=>?@[\\]_", *s3 = 0; if (newenc == 'c') { @@ -264,6 +265,8 @@ char ecc200encode(unsigned char *t, int tl, unsigned char *s, int sl, } if (newenc == 'x') e = " 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\r*>"; + if (!e) + break; do { unsigned char c = s[sp++]; char *w; @@ -493,7 +496,7 @@ static char *encmake(int l, unsigned char *s, int *lenp, char exact) { char *encoding = 0; int p = l; - char e; + int e; struct { // number of bytes of source that can be encoded in a row at this point // using this encoding mode @@ -508,8 +511,8 @@ static char *encmake(int l, unsigned char *s, int *lenp, char exact) if (l > MAXBARCODE) return 0; // not valid while (p--) { - char b = 0, sub; - int sl, tl, bl, t; + char sub; + int b = 0, sl, tl, bl, t; // consider each encoding from this point // ASCII sl = tl = 1; @@ -790,10 +793,9 @@ static char *encmake(int l, unsigned char *s, int *lenp, char exact) encoding = safemalloc(l + 1); p = 0; { - char cur = E_ASCII; // starts ASCII + int cur = E_ASCII; // starts ASCII while (p < l) { - int t, m = 0; - char b = 0; + int t, m = 0, b = 0; for (e = 0; e < E_MAX; e++) if (enc[p][e].t && ((t = enc[p][e].t + switchcost[cur][e]) <