emf free malloc bufs; tif don't free alloca bufs (Win); -Wextra; tests

This commit is contained in:
gitlost
2020-04-04 16:53:29 +01:00
parent 2d0b966de6
commit 5d60d67a84
44 changed files with 814 additions and 79 deletions

View File

@ -2,7 +2,7 @@
/*
libzint - the open source barcode library
Copyright (C) 2009-2017 Robin Stuart <rstuart114@gmail.com>
Copyright (C) 2009 - 2020 Robin Stuart <rstuart114@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@ -32,7 +32,6 @@
/* vim: set ts=4 sw=4 et : */
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef _MSC_VER
#include <malloc.h>
@ -93,7 +92,7 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[]
#endif
/* Detect extended ASCII characters */
for (i = 0; i < src_len; i++) {
for (i = 0; i < (int) src_len; i++) {
if (source[i] >= 128) {
strcpy(symbol->errtxt, "250: Extended ASCII characters are not supported by GS1");
return ZINT_ERROR_INVALID_DATA;
@ -121,7 +120,7 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[]
min_ai_length = 5;
j = 0;
ai_latch = 0;
for (i = 0; i < src_len; i++) {
for (i = 0; i < (int) src_len; i++) {
ai_length += j;
if (((j == 1) && (source[i] != ']')) && ((source[i] < '0') || (source[i] > '9'))) {
ai_latch = 1;
@ -178,7 +177,7 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[]
}
ai_count = 0;
for (i = 1; i < src_len; i++) {
for (i = 1; i < (int) src_len; i++) {
if (source[i - 1] == '[') {
ai_location[ai_count] = i;
j = 0;
@ -203,7 +202,7 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[]
data_length[i] = 0;
do {
data_length[i]++;
} while ((source[data_location[i] + data_length[i] - 1] != '[') && (data_location[i] + data_length[i] <= src_len));
} while ((source[data_location[i] + data_length[i] - 1] != '[') && (data_location[i] + data_length[i] <= (int) src_len));
data_length[i]--;
}
@ -662,7 +661,7 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[]
j = 0;
last_ai = 0;
ai_latch = 1;
for (i = 0; i < src_len; i++) {
for (i = 0; i < (int) src_len; i++) {
if ((source[i] != '[') && (source[i] != ']')) {
reduced[j++] = source[i];
}