Fix integer parameter check for 32bit platforms

Replace strtol() with strtoll() as we need to handle 64bit values for
daap.songalbumid at least.
This commit is contained in:
Julien BLACHE 2010-05-09 09:00:44 +02:00
parent 84279b817d
commit 4ebbe3696f

View File

@ -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);