diff --git a/backend/code.c b/backend/code.c index ff8e7828..6e96bb87 100644 --- a/backend/code.c +++ b/backend/code.c @@ -211,18 +211,21 @@ INTERNAL int code39(struct zint_symbol *symbol, unsigned char source[], int leng (void) set_height(symbol, 0.0f, 50.f, 0.0f, 1 /*no_errtxt*/); } + /* Display a space check digit as _, otherwise it looks like an error */ + if (symbol->option_2 == 1 && !raw_text && check_digit == ' ') { + check_digit = '_'; + } if (symbol->symbology == BARCODE_CODE39 && !raw_text) { hrt_cpy_chr(symbol, '*'); hrt_cat_nochk(symbol, source, length); if (symbol->option_2 == 1) { /* Visible check digit */ - /* Display a space check digit as _, otherwise it looks like an error */ - hrt_cat_chr_nochk(symbol, check_digit == ' ' ? '_' : check_digit); + hrt_cat_chr_nochk(symbol, check_digit); } hrt_cat_chr_nochk(symbol, '*'); } else { hrt_cpy_nochk(symbol, source, length); if (symbol->option_2 == 1 || (raw_text && check_digit)) { - hrt_cat_chr_nochk(symbol, !raw_text && check_digit == ' ' ? '_' : check_digit); + hrt_cat_chr_nochk(symbol, check_digit); } } return error_number; diff --git a/backend/plessey.c b/backend/plessey.c index c50086cf..5355b187 100644 --- a/backend/plessey.c +++ b/backend/plessey.c @@ -118,10 +118,10 @@ INTERNAL int plessey(struct zint_symbol *symbol, unsigned char source[], int len hrt_cpy_nochk(symbol, source, length); if (symbol->option_2 == 1 || raw_text) { - const unsigned c1 = check_digits & 0xF; - const unsigned c2 = check_digits >> 4; - hrt_cat_chr_nochk(symbol, xtoc(c1)); - hrt_cat_chr_nochk(symbol, xtoc(c2)); + const unsigned int c1 = check_digits & 0xF; + const unsigned int c2 = check_digits >> 4; + hrt_cat_chr_nochk(symbol, (char) xtoc(c1)); + hrt_cat_chr_nochk(symbol, (char) xtoc(c2)); } return error_number; diff --git a/backend/postal.c b/backend/postal.c index ec011664..7d44bcc7 100644 --- a/backend/postal.c +++ b/backend/postal.c @@ -184,7 +184,7 @@ static int postnet_enc(struct zint_symbol *symbol, const unsigned char source[], if (raw_text) { hrt_cpy_nochk(symbol, source, length); - hrt_cat_chr_nochk(symbol, check_digit + '0'); + hrt_cat_chr_nochk(symbol, (char) itoc(check_digit)); } return error_number; @@ -258,7 +258,7 @@ static int planet_enc(struct zint_symbol *symbol, const unsigned char source[], if (raw_text) { hrt_cpy_nochk(symbol, source, length); - hrt_cat_chr_nochk(symbol, check_digit + '0'); + hrt_cat_chr_nochk(symbol, (char) itoc(check_digit)); } return error_number; diff --git a/backend/telepen.c b/backend/telepen.c index 4749aa09..023e9df0 100644 --- a/backend/telepen.c +++ b/backend/telepen.c @@ -140,7 +140,7 @@ INTERNAL int telepen(struct zint_symbol *symbol, unsigned char source[], int len hrt_cpy_iso8859_1(symbol, source, length); if (raw_text) { - hrt_cat_chr_nochk(symbol, check_digit); + hrt_cat_chr_nochk(symbol, (char) check_digit); } return error_number; @@ -219,7 +219,7 @@ INTERNAL int telepen_num(struct zint_symbol *symbol, unsigned char source[], int hrt_cpy_nochk(symbol, local_source, length); if (raw_text) { - hrt_cat_chr_nochk(symbol, check_digit); + hrt_cat_chr_nochk(symbol, (char) check_digit); } return error_number;