1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Fix strtoll("0x", ptr, 0) to set *ptr to position of 'x', not after it.

This commit is contained in:
hniksic 2005-08-27 12:27:46 -07:00
parent 6cae84266c
commit 7700d6c999
2 changed files with 14 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2005-08-27 Hrvoje Niksic <hniksic@xemacs.org>
* cmpt.c (strtoll): Correctly handle strtoll("0x", ptr, 0) and
strtoll("0x<nonhexchar>", ptr, 0) -- in both cases *ptr must be
set to the position of 'x', not after it.
2005-08-27 Hrvoje Niksic <hniksic@xemacs.org>
* hash.c (hash_table_map): Rename to hash_table_for_each and

View File

@ -1348,6 +1348,13 @@ strtoll (const char *nptr, char **endptr, int base)
{
base = 16;
nptr += 2;
/* "0x" must be followed by at least one hex char. If not,
return 0 and place ENDPTR on 'x'. */
if (!ISXDIGIT (*nptr))
{
--nptr;
goto out;
}
}
else if (base == 0)
base = 8;
@ -1387,6 +1394,7 @@ strtoll (const char *nptr, char **endptr, int base)
result = newresult;
}
}
out:
if (endptr)
*endptr = (char *) nptr;
return result;