mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Resolve Visual Studio compatability bugs
Includes bugfix for Item ID calculation in Mailmark as reported by Milton Neal
This commit is contained in:
parent
3853897d88
commit
e749872e7d
@ -593,7 +593,7 @@ int channel_code(struct zint_symbol *symbol, unsigned char source[], int length)
|
|||||||
|
|
||||||
|
|
||||||
/* Vehicle Identification Number (VIN) */
|
/* 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 */
|
/* 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 weight[17] = {8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2};
|
||||||
int sum;
|
int sum;
|
||||||
int i;
|
int i;
|
||||||
|
int length = (int) in_length;
|
||||||
|
|
||||||
// Check length
|
// Check length
|
||||||
if (length > 17) {
|
if (length > 17) {
|
||||||
|
@ -122,7 +122,7 @@ int verify_postcode(char* postcode, int type) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Royal Mail Mailmark */
|
/* 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];
|
char local_source[28];
|
||||||
int format;
|
int format;
|
||||||
@ -145,6 +145,7 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
char bar[80];
|
char bar[80];
|
||||||
int check_count;
|
int check_count;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
int length = (int) in_length;
|
||||||
|
|
||||||
if (length > 26) {
|
if (length > 26) {
|
||||||
strcpy(symbol->errtxt, "580: Input too long");
|
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++) {
|
for (i = 0; i < 9; i++) {
|
||||||
postcode[i] = local_source[(length - 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_load(destination_postcode, "0", 1);
|
||||||
binary_add(destination_postcode, b);
|
binary_add(destination_postcode, b);
|
||||||
|
|
||||||
@ -373,7 +374,7 @@ int mailmark(struct zint_symbol *symbol, unsigned char source[], int length) {
|
|||||||
|
|
||||||
// Add Item ID
|
// Add Item ID
|
||||||
binary_load(temp, "0", 1);
|
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;
|
if (0x01 & (item_id >> i)) temp[i] = 1;
|
||||||
}
|
}
|
||||||
binary_add(cdv, temp);
|
binary_add(cdv, temp);
|
||||||
|
Loading…
Reference in New Issue
Block a user