Fix linux gcc warnings and strtol corrections

This commit is contained in:
William S Fulton 2015-01-11 17:30:25 +00:00
commit 06e361dbf2
2 changed files with 6 additions and 4 deletions

View file

@ -1268,7 +1268,7 @@ public:
break; break;
char *p; char *p;
errno = 0; errno = 0;
int n = strtol(Char(value), &p, 0); long n = strtol(Char(value), &p, 0);
Clear(value); Clear(value);
if (errno || *p) { if (errno || *p) {
Append(value, "?"); Append(value, "?");
@ -1286,7 +1286,7 @@ public:
case T_LONG: { case T_LONG: {
char *p; char *p;
errno = 0; errno = 0;
unsigned int n = strtol(Char(value), &p, 0); long n = strtol(Char(value), &p, 0);
(void) n; (void) n;
if (errno || *p) { if (errno || *p) {
Clear(value); Clear(value);

View file

@ -1825,7 +1825,8 @@ public:
const char *const s = Char(v); const char *const s = Char(v);
char *end; char *end;
(void)strtod(s, &end); double value = strtod(s, &end);
(void) value;
if (errno != ERANGE && end != s) { if (errno != ERANGE && end != s) {
// An added complication: at least some versions of strtod() recognize // An added complication: at least some versions of strtod() recognize
// hexadecimal floating point numbers which don't exist in Python, so // hexadecimal floating point numbers which don't exist in Python, so
@ -1868,7 +1869,8 @@ public:
char *end; char *end;
// Check if this is a number in any base. // Check if this is a number in any base.
(void)strtol(s, &end, 0); long value = strtol(s, &end, 0);
(void) value;
if (end != s) { if (end != s) {
if (errno == ERANGE) { if (errno == ERANGE) {
// There was an overflow, we could try representing the value as Python // There was an overflow, we could try representing the value as Python