Fix segfaults on 32bit arch with --log-level=debug
There were a few improper uses of %ld for 64 bit numbers, as well as some other 32 bit related warnings that I've fixed. Signed-off-by: ktprograms <ktprograms@gmail.com>
This commit is contained in:
10
src/c2.c
10
src/c2.c
@@ -1324,13 +1324,13 @@ static inline void c2_match_once_leaf(session_t *ps, const struct managed_win *w
|
||||
switch (pleaf->ptntype) {
|
||||
// Deal with integer patterns
|
||||
case C2_L_PTINT: {
|
||||
long *targets = NULL;
|
||||
long *targets_free = NULL;
|
||||
long long *targets = NULL;
|
||||
long long *targets_free = NULL;
|
||||
size_t ntargets = 0;
|
||||
|
||||
// Get the value
|
||||
// A predefined target
|
||||
long predef_target = 0;
|
||||
long long predef_target = 0;
|
||||
if (pleaf->predef != C2_L_PUNDEFINED) {
|
||||
*perr = false;
|
||||
switch (pleaf->predef) {
|
||||
@@ -1379,7 +1379,7 @@ static inline void c2_match_once_leaf(session_t *ps, const struct managed_win *w
|
||||
|
||||
ntargets = (pleaf->index < 0 ? prop.nitems : min2(prop.nitems, 1));
|
||||
if (ntargets > 0) {
|
||||
targets = targets_free = ccalloc(ntargets, long);
|
||||
targets = targets_free = ccalloc(ntargets, long long);
|
||||
*perr = false;
|
||||
for (size_t i = 0; i < ntargets; ++i) {
|
||||
targets[i] = winprop_get_int(prop, i);
|
||||
@@ -1395,7 +1395,7 @@ static inline void c2_match_once_leaf(session_t *ps, const struct managed_win *w
|
||||
// Do comparison
|
||||
bool res = false;
|
||||
for (size_t i = 0; i < ntargets; ++i) {
|
||||
long tgt = targets[i];
|
||||
long long tgt = targets[i];
|
||||
switch (pleaf->op) {
|
||||
case C2_L_OEXISTS:
|
||||
res = (pleaf->predef != C2_L_PUNDEFINED ? tgt : true);
|
||||
|
||||
Reference in New Issue
Block a user