1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- The ERANGE initialization is not necessary.

git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15031 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-09-28 09:51:16 +00:00
parent 3099f6210a
commit f84fbc32cb
9 changed files with 10 additions and 33 deletions

View File

@ -1,9 +1,8 @@
- strtoimax(), strtoumax(), strtod(), strtof(), strtol(), strtoll(),
strtoul() and strtoull() now count how many digits were converted.
If that number is zero, then the conversion is considered to have
failed: 0 is returned, errno is set to ERANGE and the 'ptr' parameter
reference is initialized with a pointer to the string to be converted.
This has two consequences:
failed: 0 is returned and the 'ptr' parameter reference is initialized
with a pointer to the string to be converted. This has two consequences:
1) A floating point number that has no digits in the significand
is no longer converted to zero. For example ".e10" can no longer

View File

@ -1,5 +1,5 @@
/*
* $Id: inttypes_strtoimax.c,v 1.2 2005-09-28 09:28:39 obarthel Exp $
* $Id: inttypes_strtoimax.c,v 1.3 2005-09-28 09:51:16 obarthel Exp $
*
* :ts=4
*
@ -181,10 +181,7 @@ strtoimax(const char *str, char **ptr, int base)
/* Did we convert anything? */
if(num_digits_converted == 0)
{
__set_errno(ERANGE);
goto out;
}
if(is_negative)
result = (-sum);

View File

@ -1,5 +1,5 @@
/*
* $Id: inttypes_strtoumax.c,v 1.2 2005-09-28 09:28:39 obarthel Exp $
* $Id: inttypes_strtoumax.c,v 1.3 2005-09-28 09:51:16 obarthel Exp $
*
* :ts=4
*
@ -182,10 +182,7 @@ strtoumax(const char *str, char **ptr, int base)
/* Did we convert anything? */
if(num_digits_converted == 0)
{
__set_errno(ERANGE);
goto out;
}
if(is_negative)
result = (-sum);

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib_strtod.c,v 1.9 2005-09-28 09:28:39 obarthel Exp $
* $Id: stdlib_strtod.c,v 1.10 2005-09-28 09:51:16 obarthel Exp $
*
* :ts=4
*
@ -364,8 +364,6 @@ strtod(const char *str, char ** ptr)
if(num_digits_converted == 0)
{
__set_errno(ERANGE);
sum = 0;
}
else

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib_strtof.c,v 1.9 2005-09-28 09:28:39 obarthel Exp $
* $Id: stdlib_strtof.c,v 1.10 2005-09-28 09:51:16 obarthel Exp $
*
* :ts=4
*
@ -364,8 +364,6 @@ strtof(const char *str, char ** ptr)
if(num_digits_converted == 0)
{
__set_errno(ERANGE);
sum = 0;
}
else

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib_strtol.c,v 1.4 2005-09-28 09:28:39 obarthel Exp $
* $Id: stdlib_strtol.c,v 1.5 2005-09-28 09:51:16 obarthel Exp $
*
* :ts=4
*
@ -181,10 +181,7 @@ strtol(const char *str, char **ptr, int base)
/* Did we convert anything? */
if(num_digits_converted == 0)
{
__set_errno(ERANGE);
goto out;
}
if(is_negative)
result = (-sum);

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib_strtoll.c,v 1.4 2005-09-28 09:28:39 obarthel Exp $
* $Id: stdlib_strtoll.c,v 1.5 2005-09-28 09:51:16 obarthel Exp $
*
* :ts=4
*
@ -185,10 +185,7 @@ strtoll(const char *str, char **ptr, int base)
/* Did we convert anything? */
if(num_digits_converted == 0)
{
__set_errno(ERANGE);
goto out;
}
if(is_negative)
result = (-sum);

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib_strtoul.c,v 1.4 2005-09-28 09:28:39 obarthel Exp $
* $Id: stdlib_strtoul.c,v 1.5 2005-09-28 09:51:16 obarthel Exp $
*
* :ts=4
*
@ -178,10 +178,7 @@ strtoul(const char *str, char **ptr, int base)
/* Did we convert anything? */
if(num_digits_converted == 0)
{
__set_errno(ERANGE);
goto out;
}
if(is_negative)
result = (-sum);

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib_strtoull.c,v 1.4 2005-09-28 09:28:39 obarthel Exp $
* $Id: stdlib_strtoull.c,v 1.5 2005-09-28 09:51:16 obarthel Exp $
*
* :ts=4
*
@ -182,10 +182,7 @@ strtoull(const char *str, char **ptr, int base)
/* Did we convert anything? */
if(num_digits_converted == 0)
{
__set_errno(ERANGE);
goto out;
}
if(is_negative)
result = (-sum);