mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Change height and row_height array to floats: VC6, CodeQL fixes
This commit is contained in:
parent
c693482aa1
commit
e5115bad07
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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];
|
||||
}
|
||||
|
@ -35,10 +35,6 @@
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <malloc.h>
|
||||
/* For Visual C++ 6 suppress conversion from int to float warning */
|
||||
#if _MSC_VER == 1200
|
||||
#pragma warning(disable: 4244)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "common.h"
|
||||
|
Loading…
Reference in New Issue
Block a user