X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fdata-in.c;h=b0120677b3f7b079d78e7a15c4c17a5073612ac7;hb=cb4654463fdc1768642e0fda0f2cb56d4ccb8599;hp=14a24fffe26d367497e9262fd9daa1a0709a68c0;hpb=f481fd69631024bcdc7dc2369bbc1592d7a43ac7;p=pspp diff --git a/src/data/data-in.c b/src/data/data-in.c index 14a24fffe2..b0120677b3 100644 --- a/src/data/data-in.c +++ b/src/data/data-in.c @@ -76,7 +76,11 @@ static int hexit_value (int c); Stores the parsed representation in OUTPUT, which the caller must have initialized with the given WIDTH (0 for a numeric field, otherwise the string width). If FORMAT is FMT_A, then OUTPUT_ENCODING must specify the - correct encoding for OUTPUT (normally obtained via dict_get_encoding()). */ + correct encoding for OUTPUT (normally obtained via dict_get_encoding()). + + If successful NULL is the return value. Otherwise a string describing + the problem is returned. The caller must free this string. + */ char * data_in (struct substring input, const char *input_encoding, enum fmt_type format, @@ -281,7 +285,6 @@ parse_number (struct data_in *i) struct string tmp; - bool explicit_decimals = false; int save_errno; char *tail; @@ -334,7 +337,6 @@ parse_number (struct data_in *i) /* Decimal point and following digits. */ if (ss_match_byte (&i->input, style->decimal)) { - explicit_decimals = true; ds_put_byte (&tmp, '.'); while (c_isdigit (ss_first (i->input))) ds_put_byte (&tmp, ss_get_byte (&i->input)); @@ -345,7 +347,6 @@ parse_number (struct data_in *i) && !ss_is_empty (i->input) && strchr ("eEdD-+", ss_first (i->input))) { - explicit_decimals = true; ds_put_byte (&tmp, 'e'); if (strchr ("eEdD", ss_first (i->input))) @@ -922,7 +923,7 @@ parse_year (struct data_in *i, long *year, size_t max_digits) else *year += epoch_century + 100; } - if (*year >= 1582 || *year <= 19999) + if (*year >= 1582 && *year <= 19999) return NULL; return xasprintf (_("Year (%ld) must be between 1582 and 19999."), *year); @@ -1047,7 +1048,7 @@ parse_minute_second (struct data_in *i, double *time) *cp++ = ss_get_byte (&i->input); *cp = '\0'; - *time += strtod (buf, NULL); + *time += c_strtod (buf, NULL); return NULL; }