diff --git a/backend/code.c b/backend/code.c index d7b50040..0ca5dee5 100644 --- a/backend/code.c +++ b/backend/code.c @@ -593,7 +593,7 @@ int channel_code(struct zint_symbol *symbol, unsigned char source[], int length) /* Vehicle Identification Number (VIN) */ -int vin(struct zint_symbol *symbol, unsigned char source[], int length) { +int vin(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length) { /* This code verifies the check digit present in North American VIN codes */ @@ -606,6 +606,7 @@ int vin(struct zint_symbol *symbol, unsigned char source[], int length) { int weight[17] = {8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2}; int sum; int i; + int length = (int) in_length; // Check length if (length > 17) { diff --git a/backend/mailmark.c b/backend/mailmark.c index 25a91ecb..05ba9d5a 100644 --- a/backend/mailmark.c +++ b/backend/mailmark.c @@ -122,7 +122,7 @@ int verify_postcode(char* postcode, int type) { } /* Royal Mail Mailmark */ -int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) { +int mailmark(struct zint_symbol *symbol, const unsigned char source[], const size_t in_length) { char local_source[28]; int format; @@ -145,6 +145,7 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) { char bar[80]; int check_count; int i, j; + int length = (int) in_length; if (length > 26) { strcpy(symbol->errtxt, "580: Input too long"); @@ -223,7 +224,7 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) { } } - // Seperate Destination Post Code plus DPS field + // Separate Destination Post Code plus DPS field for (i = 0; i < 9; i++) { postcode[i] = local_source[(length - 9) + i]; } @@ -326,7 +327,7 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) { } } - // detination_postcode = a + b + // destination_postcode = a + b binary_load(destination_postcode, "0", 1); binary_add(destination_postcode, b); @@ -373,7 +374,7 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) { // Add Item ID binary_load(temp, "0", 1); - for (i = 0; i < 38; i++) { + for (i = 0; i < 31; i++) { if (0x01 & (item_id >> i)) temp[i] = 1; } binary_add(cdv, temp);