backend: define z_alloca() and use for both Unix and Windows;

replace double-slash comments with old-skool slash asterisk ones;
  define uint16_t etc for Windows ourselves and remove ms_stdint.h &
  stdint_msvc.h as no longer used;
  (backend (excepting test suite) now C89 compatible)
LICENSE: move from backend to root and move COPYING to frontend, with
  copies in frontend_qt & backend_qt, so in where it applies;
  add LICENSE section from manual to root README
This commit is contained in:
gitlost 2022-07-14 16:01:30 +01:00
parent 5ee3895bca
commit 930f458979
70 changed files with 2650 additions and 2038 deletions

View file

@ -31,9 +31,6 @@
/* SPDX-License-Identifier: BSD-3-Clause */
#include <stdio.h>
#ifdef _MSC_VER
#include <malloc.h>
#endif
#include "common.h"
#include "gs1.h"
@ -1189,14 +1186,10 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[]
char obracket = symbol->input_mode & GS1PARENS_MODE ? '(' : '[';
char cbracket = symbol->input_mode & GS1PARENS_MODE ? ')' : ']';
int ai_max = chr_cnt(source, src_len, obracket) + 1; /* Plus 1 so non-zero */
#ifndef _MSC_VER
int ai_value[ai_max], ai_location[ai_max], data_location[ai_max], data_length[ai_max];
#else
int *ai_value = (int *) _alloca(ai_max * sizeof(int));
int *ai_location = (int *) _alloca(ai_max * sizeof(int));
int *data_location = (int *) _alloca(ai_max * sizeof(int));
int *data_length = (int *) _alloca(ai_max * sizeof(int));
#endif
int *ai_value = (int *) z_alloca(sizeof(int) * ai_max);
int *ai_location = (int *) z_alloca(sizeof(int) * ai_max);
int *data_location = (int *) z_alloca(sizeof(int) * ai_max);
int *data_length = (int *) z_alloca(sizeof(int) * ai_max);
/* Detect extended ASCII characters */
for (i = 0; i < src_len; i++) {
@ -1327,8 +1320,8 @@ INTERNAL int gs1_verify(struct zint_symbol *symbol, const unsigned char source[]
}
}
// Check for valid AI values and data lengths according to GS1 General
// Specifications Release 21.0.1, January 2021
/* Check for valid AI values and data lengths according to GS1 General
Specifications Release 21.0.1, January 2021 */
for (i = 0; i < ai_count; i++) {
int err_no, err_posn;
char err_msg[50];