diff --git a/backend/codablock.c b/backend/codablock.c index 4ce91ba6..625096ab 100644 --- a/backend/codablock.c +++ b/backend/codablock.c @@ -640,7 +640,7 @@ INTERNAL int codablock(struct zint_symbol *symbol, unsigned char source[], int l int emptyColumns; char dest[1000]; int r, c; - float min_row_height; + float min_row_height = 0.0f; #ifdef _MSC_VER CharacterSetTable *T; unsigned char *data; @@ -997,8 +997,7 @@ INTERNAL int codablock(struct zint_symbol *symbol, unsigned char source[], int l error_number = set_height(symbol, min_row_height, (min_row_height > 10.0f ? min_row_height : 10.0f) * rows, 0.0f, 0 /*no_errtxt*/); #else - (void)min_row_height; - (void) set_height(symbol, 0.0f, 10.0f * rows, 0.0f, 1 /*no_errtxt*/); + (void) set_height(symbol, min_row_height, 10.0f * rows, 0.0f, 1 /*no_errtxt*/); #endif symbol->output_options |= BARCODE_BIND; diff --git a/backend/code1.c b/backend/code1.c index 2cb32d02..f590a4b1 100644 --- a/backend/code1.c +++ b/backend/code1.c @@ -861,7 +861,7 @@ static int c1_encode(struct zint_symbol *symbol, unsigned char source[], unsigne db_p = bin_append_posn(1, 2, decimal_binary, db_p); } - (void)decimal_binary_transfer(decimal_binary, db_p, target, &tp); + (void) decimal_binary_transfer(decimal_binary, db_p, target, &tp); } current_mode = C1_ASCII; diff --git a/backend/code16k.c b/backend/code16k.c index 41e3c133..acc5597c 100644 --- a/backend/code16k.c +++ b/backend/code16k.c @@ -120,7 +120,7 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len int input_length; int gs1, c_count; int separator; - float min_row_height; + float min_row_height = 0.0f; /* Suppresses clang-analyzer-core.UndefinedBinaryOperatorResult warning on fset which is fully set */ assert(length > 0); @@ -500,8 +500,8 @@ INTERNAL int code16k(struct zint_symbol *symbol, unsigned char source[], int len error_number = set_height(symbol, min_row_height, (min_row_height > 10.0f ? min_row_height : 10.0f) * rows, 0.0f, 0 /*no_errtxt*/); #else - (void)min_row_height; (void)separator; - (void) set_height(symbol, 0.0f, 10.0f * rows, 0.0f, 1 /*no_errtxt*/); + (void)&separator; + (void) set_height(symbol, min_row_height, 10.0f * rows, 0.0f, 1 /*no_errtxt*/); #endif symbol->output_options |= BARCODE_BIND; diff --git a/backend/code49.c b/backend/code49.c index 3fec358c..e009ab8a 100644 --- a/backend/code49.c +++ b/backend/code49.c @@ -50,7 +50,7 @@ INTERNAL int code_49(struct zint_symbol *symbol, unsigned char source[], int len int gs1; int h, len; int separator; - float min_row_height; + float min_row_height = 0.0f; int error_number = 0; if (length > 81) { @@ -358,8 +358,8 @@ INTERNAL int code_49(struct zint_symbol *symbol, unsigned char source[], int len error_number = set_height(symbol, min_row_height, (min_row_height > 10.0f ? min_row_height : 10.0f) * rows, 0.0f, 0 /*no_errtxt*/); #else - (void)min_row_height; (void)separator; - (void) set_height(symbol, 0.0f, 10.0f * rows, 0.0f, 1 /*no_errtxt*/); + (void)&separator; + (void) set_height(symbol, min_row_height, 10.0f * rows, 0.0f, 1 /*no_errtxt*/); #endif symbol->output_options |= BARCODE_BIND; diff --git a/backend/common.h b/backend/common.h index 0856364a..ab826f40 100644 --- a/backend/common.h +++ b/backend/common.h @@ -64,6 +64,9 @@ # define ceilf (float) ceil # define floorf (float) floor # define roundf(arg) ((float) floor((arg) + 0.5f)) +# if _MSC_VER == 1200 /* VC6 */ +# define round(arg) floor((arg) + 0.5f) +# endif # endif # pragma warning(disable: 4244) /* conversion from int to float */ # if _MSC_VER >= 1900 /* MSVC 2015 */ diff --git a/backend/library.c b/backend/library.c index a8ee2145..bbb1c243 100644 --- a/backend/library.c +++ b/backend/library.c @@ -1243,7 +1243,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int if (error_number == 0) { error_number = warn_number; } - (void)error_tag(symbol->errtxt, error_number); + (void) error_tag(symbol->errtxt, error_number); if (error_number < ZINT_ERROR) { if (symbol->height < 0.5f) { /* Absolute minimum */ diff --git a/backend/output.c b/backend/output.c index ebf4bf66..b24f9afd 100644 --- a/backend/output.c +++ b/backend/output.c @@ -555,7 +555,7 @@ INTERNAL float output_large_bar_height(struct zint_symbol *symbol, int si) { symbol->height = large_bar_height * zero_count + fixed_height; } if (si && large_bar_height * si != (int) (large_bar_height * si)) { - large_bar_height = (float) (round(large_bar_height * si) / si); + large_bar_height = roundf(large_bar_height * si) / si; symbol->height = large_bar_height * zero_count + fixed_height; } /* Note should never happen that have both zero_count and round_rows */ @@ -565,7 +565,7 @@ INTERNAL float output_large_bar_height(struct zint_symbol *symbol, int si) { fixed_height = 0.0f; for (i = 0; i < symbol->rows; i++) { if (symbol->row_height[i] * si != (int) (symbol->row_height[i] * si)) { - symbol->row_height[i] = (float) (round(symbol->row_height[i] * si) / si); + symbol->row_height[i] = roundf(symbol->row_height[i] * si) / si; } fixed_height += symbol->row_height[i]; } diff --git a/backend/vector.c b/backend/vector.c index bf267850..2e230c7e 100644 --- a/backend/vector.c +++ b/backend/vector.c @@ -35,10 +35,6 @@ #ifdef _MSC_VER #include -/* For Visual C++ 6 suppress conversion from int to float warning */ -#if _MSC_VER == 1200 -#pragma warning(disable: 4244) -#endif #endif #include "common.h"