mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-17 16:44:34 -04:00
raster/output: use new isfintf() to test floats integral (CodeQL)
This commit is contained in:
parent
37fac73cb1
commit
a312cd8e8e
5 changed files with 12 additions and 8 deletions
|
@ -540,7 +540,7 @@ INTERNAL float output_large_bar_height(struct zint_symbol *symbol, int si) {
|
|||
for (i = 0; i < symbol->rows; i++) {
|
||||
if (symbol->row_height[i]) {
|
||||
fixed_height += symbol->row_height[i];
|
||||
if (!round_rows && si && symbol->row_height[i] * si != (int) (symbol->row_height[i] * si)) {
|
||||
if (!round_rows && si && !isfintf(symbol->row_height[i] * si)) {
|
||||
round_rows = 1;
|
||||
}
|
||||
} else {
|
||||
|
@ -554,7 +554,7 @@ INTERNAL float output_large_bar_height(struct zint_symbol *symbol, int si) {
|
|||
large_bar_height = 0.01f; /* Token positive value */
|
||||
symbol->height = large_bar_height * zero_count + fixed_height;
|
||||
}
|
||||
if (si && large_bar_height * si != (int) (large_bar_height * si)) {
|
||||
if (si && !isfintf(large_bar_height * si)) {
|
||||
large_bar_height = roundf(large_bar_height * si) / si;
|
||||
symbol->height = large_bar_height * zero_count + fixed_height;
|
||||
}
|
||||
|
@ -564,7 +564,7 @@ INTERNAL float output_large_bar_height(struct zint_symbol *symbol, int si) {
|
|||
if (round_rows) {
|
||||
fixed_height = 0.0f;
|
||||
for (i = 0; i < symbol->rows; i++) {
|
||||
if (symbol->row_height[i] * si != (int) (symbol->row_height[i] * si)) {
|
||||
if (!isfintf(symbol->row_height[i] * si)) {
|
||||
symbol->row_height[i] = roundf(symbol->row_height[i] * si) / si;
|
||||
}
|
||||
fixed_height += symbol->row_height[i];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue