mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-25 04:24:31 -04:00
Supress malloc warning using gcc 8
Explicitly prevents malloc with negative number to supress -Walloc-size-larger-than Fixes #168 reported by Ian Jeffray
This commit is contained in:
parent
03d99ceb23
commit
7bcc0252a9
1 changed files with 6 additions and 1 deletions
|
@ -49,7 +49,7 @@
|
||||||
// size.
|
// size.
|
||||||
|
|
||||||
#include <stdio.h> // only needed for debug (main)
|
#include <stdio.h> // only needed for debug (main)
|
||||||
#include <stdlib.h> // only needed for malloc/free
|
#include <malloc.h>
|
||||||
#include "reedsol.h"
|
#include "reedsol.h"
|
||||||
static int logmod; // 2**symsize - 1
|
static int logmod; // 2**symsize - 1
|
||||||
static int rlen;
|
static int rlen;
|
||||||
|
@ -75,6 +75,11 @@ void rs_init_gf(const int poly) {
|
||||||
b >>= 1;
|
b >>= 1;
|
||||||
m--;
|
m--;
|
||||||
|
|
||||||
|
// Ensure m not negative to supress gcc -Walloc-size-larger-than
|
||||||
|
if (m < 0) {
|
||||||
|
m = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate the log/alog tables
|
// Calculate the log/alog tables
|
||||||
logmod = (1 << m) - 1;
|
logmod = (1 << m) - 1;
|
||||||
logt = (int *) malloc(sizeof (int) * (logmod + 1));
|
logt = (int *) malloc(sizeof (int) * (logmod + 1));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue