mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Re MR #121 calcium -> static; reinstate STATIC_UNLESS_ZINT_TEST error_tag/strip_bom; whitespace
This commit is contained in:
parent
43d7493cf2
commit
ede1234b8f
@ -192,7 +192,7 @@ INTERNAL int dpd_parcel(struct zint_symbol *symbol, unsigned char source[], int
|
|||||||
INTERNAL int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to PNG/BMP/PCX */
|
INTERNAL int plot_raster(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to PNG/BMP/PCX */
|
||||||
INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to EPS/EMF/SVG */
|
INTERNAL int plot_vector(struct zint_symbol *symbol, int rotate_angle, int file_type); /* Plot to EPS/EMF/SVG */
|
||||||
|
|
||||||
INTERNAL int error_tag(char error_string[100], int error_number) {
|
STATIC_UNLESS_ZINT_TEST int error_tag(char error_string[100], int error_number) {
|
||||||
|
|
||||||
if (error_number != 0) {
|
if (error_number != 0) {
|
||||||
const char *fmt = error_number >= ZINT_ERROR ? "Error %.93s" : "Warning %.91s"; /* Truncate if too long */
|
const char *fmt = error_number >= ZINT_ERROR ? "Error %.93s" : "Warning %.91s"; /* Truncate if too long */
|
||||||
@ -931,7 +931,7 @@ static int reduced_charset(struct zint_symbol *symbol, unsigned char *source, in
|
|||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
|
|
||||||
INTERNAL void strip_bom(unsigned char *source, int *input_length) {
|
STATIC_UNLESS_ZINT_TEST void strip_bom(unsigned char *source, int *input_length) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Note if BOM is only data then not stripped */
|
/* Note if BOM is only data then not stripped */
|
||||||
|
@ -236,7 +236,7 @@ INTERNAL int codabar(struct zint_symbol *symbol, unsigned char source[], int len
|
|||||||
add_checksum = symbol->option_2 == 1;
|
add_checksum = symbol->option_2 == 1;
|
||||||
|
|
||||||
for (i = 0; i < length; i++) {
|
for (i = 0; i < length; i++) {
|
||||||
const char calcium[] = CALCIUM;
|
static const char calcium[] = CALCIUM;
|
||||||
if (add_checksum) {
|
if (add_checksum) {
|
||||||
count += strchr(calcium, source[i]) - calcium;
|
count += strchr(calcium, source[i]) - calcium;
|
||||||
if (i + 1 == length) {
|
if (i + 1 == length) {
|
||||||
|
@ -338,7 +338,7 @@ static void test_encode_file_empty(void) {
|
|||||||
FILE *fstream;
|
FILE *fstream;
|
||||||
int ret;
|
int ret;
|
||||||
char filename[] = "in.bin";
|
char filename[] = "in.bin";
|
||||||
|
|
||||||
struct zint_symbol *symbol = ZBarcode_Create();
|
struct zint_symbol *symbol = ZBarcode_Create();
|
||||||
assert_nonnull(symbol, "Symbol not created\n");
|
assert_nonnull(symbol, "Symbol not created\n");
|
||||||
|
|
||||||
@ -346,26 +346,26 @@ static void test_encode_file_empty(void) {
|
|||||||
|
|
||||||
fstream = fopen(filename, "w+");
|
fstream = fopen(filename, "w+");
|
||||||
fclose(fstream);
|
fclose(fstream);
|
||||||
|
|
||||||
ret = ZBarcode_Encode_File(symbol, filename);
|
ret = ZBarcode_Encode_File(symbol, filename);
|
||||||
assert_equal(ret, ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_File empty ret %d != ZINT_ERROR_INVALID_DATA (%s)\n", ret, symbol->errtxt);
|
assert_equal(ret, ZINT_ERROR_INVALID_DATA, "ZBarcode_Encode_File empty ret %d != ZINT_ERROR_INVALID_DATA (%s)\n", ret, symbol->errtxt);
|
||||||
|
|
||||||
ret = remove(filename);
|
ret = remove(filename);
|
||||||
assert_zero(ret, "remove(%s) != 0 (%d: %s)\n", filename, errno, strerror(errno));
|
assert_zero(ret, "remove(%s) != 0 (%d: %s)\n", filename, errno, strerror(errno));
|
||||||
|
|
||||||
ZBarcode_Delete(symbol);
|
ZBarcode_Delete(symbol);
|
||||||
|
|
||||||
testFinish();
|
testFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_encode_file_too_large(void) {
|
static void test_encode_file_too_large(void) {
|
||||||
testStart("");
|
testStart("");
|
||||||
|
|
||||||
FILE *fstream;
|
FILE *fstream;
|
||||||
int ret;
|
int ret;
|
||||||
char filename[] = "in.bin";
|
char filename[] = "in.bin";
|
||||||
char buf[ZINT_MAX_DATA_LEN + 1] = {0};
|
char buf[ZINT_MAX_DATA_LEN + 1] = {0};
|
||||||
|
|
||||||
struct zint_symbol *symbol = ZBarcode_Create();
|
struct zint_symbol *symbol = ZBarcode_Create();
|
||||||
assert_nonnull(symbol, "Symbol not created\n");
|
assert_nonnull(symbol, "Symbol not created\n");
|
||||||
|
|
||||||
@ -375,15 +375,15 @@ static void test_encode_file_too_large(void) {
|
|||||||
ret = fwrite(buf, 1, sizeof(buf), fstream);
|
ret = fwrite(buf, 1, sizeof(buf), fstream);
|
||||||
assert_equal(ret, sizeof(buf), "fwrite retun value: %d != %d\n", ret, (int)sizeof(buf));
|
assert_equal(ret, sizeof(buf), "fwrite retun value: %d != %d\n", ret, (int)sizeof(buf));
|
||||||
fclose(fstream);
|
fclose(fstream);
|
||||||
|
|
||||||
ret = ZBarcode_Encode_File(symbol, filename);
|
ret = ZBarcode_Encode_File(symbol, filename);
|
||||||
assert_equal(ret, ZINT_ERROR_TOO_LONG, "ZBarcode_Encode_File too large ret %d != ZINT_ERROR_TOO_LONG (%s)\n", ret, symbol->errtxt);
|
assert_equal(ret, ZINT_ERROR_TOO_LONG, "ZBarcode_Encode_File too large ret %d != ZINT_ERROR_TOO_LONG (%s)\n", ret, symbol->errtxt);
|
||||||
|
|
||||||
ret = remove(filename);
|
ret = remove(filename);
|
||||||
assert_zero(ret, "remove(%s) != 0 (%d: %s)\n", filename, errno, strerror(errno));
|
assert_zero(ret, "remove(%s) != 0 (%d: %s)\n", filename, errno, strerror(errno));
|
||||||
|
|
||||||
ZBarcode_Delete(symbol);
|
ZBarcode_Delete(symbol);
|
||||||
|
|
||||||
testFinish();
|
testFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ static void test_encode_file_too_large(void) {
|
|||||||
static void test_encode_file_unreadable(void) {
|
static void test_encode_file_unreadable(void) {
|
||||||
|
|
||||||
testStart("");
|
testStart("");
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
testSkip("Test not implemented on Windows");
|
testSkip("Test not implemented on Windows");
|
||||||
#else
|
#else
|
||||||
@ -569,7 +569,7 @@ static void test_valid_id(void) {
|
|||||||
testFinish();
|
testFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
int error_tag(char error_string[100], int error_number);
|
STATIC_UNLESS_ZINT_TEST int error_tag(char error_string[100], int error_number);
|
||||||
|
|
||||||
static void test_error_tag(int index) {
|
static void test_error_tag(int index) {
|
||||||
|
|
||||||
@ -608,7 +608,7 @@ static void test_error_tag(int index) {
|
|||||||
testFinish();
|
testFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
void strip_bom(unsigned char *source, int *input_length);
|
STATIC_UNLESS_ZINT_TEST void strip_bom(unsigned char *source, int *input_length);
|
||||||
|
|
||||||
static void test_strip_bom(void) {
|
static void test_strip_bom(void) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user