From 4ebbe3696f5d9d62efa514db7f16fb17e5cca445 Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Sun, 9 May 2010 09:00:44 +0200 Subject: [PATCH] Fix integer parameter check for 32bit platforms Replace strtol() with strtoll() as we need to handle 64bit values for daap.songalbumid at least. --- src/DAAP2SQL.g | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/DAAP2SQL.g b/src/DAAP2SQL.g index 7ffb91a3..820887bb 100644 --- a/src/DAAP2SQL.g +++ b/src/DAAP2SQL.g @@ -96,7 +96,7 @@ expr returns [ pANTLR3_STRING result, int valid ] int neg_op; struct dmap_query_field_map *dqfm; char *end; - long longval; + long long llval; escaped = NULL; @@ -191,10 +191,10 @@ expr returns [ pANTLR3_STRING result, int valid ] if (dqfm->as_int) { errno = 0; - longval = strtol((const char *)val, &end, 10); + llval = strtoll((const char *)val, &end, 10); - if (((errno == ERANGE) && ((longval == LONG_MAX) || (longval == LONG_MIN))) - || ((errno != 0) && (longval == 0))) + if (((errno == ERANGE) && ((llval == LLONG_MAX) || (llval == LLONG_MIN))) + || ((errno != 0) && (llval == 0))) { DPRINTF(E_LOG, L_DAAP, "Value '\%s' in clause '\%s\%s\%c\%s' does not convert to an integer type\n", val, field, (neg_op) ? "!" : "", op, val);