forked from Imagelibrary/rtems
2011-02-01 Ralf Corsepius <ralf.corsepius@rtems.org>
* libmisc/stringto/stringtounsignedlonglong.c: Reformat range check. c99 portability improvements.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
2011-02-01 Ralf Corsepius <ralf.corsepius@rtems.org>
|
2011-02-01 Ralf Corsepius <ralf.corsepius@rtems.org>
|
||||||
|
|
||||||
|
* libmisc/stringto/stringtounsignedlonglong.c: Reformat range check.
|
||||||
|
c99 portability improvements.
|
||||||
* libmisc/stringto/stringtounsignedlong.c: Reformat range check.
|
* libmisc/stringto/stringtounsignedlong.c: Reformat range check.
|
||||||
* libmisc/stringto/stringtolong.c: Reformat range check.
|
* libmisc/stringto/stringtolong.c: Reformat range check.
|
||||||
Add check for result==0.
|
Add check for result==0.
|
||||||
|
|||||||
@@ -21,6 +21,11 @@
|
|||||||
|
|
||||||
#include <rtems/stringto.h>
|
#include <rtems/stringto.h>
|
||||||
|
|
||||||
|
/* c99 has ULLONG_MAX instead of ULONG_LONG_MAX */
|
||||||
|
#ifndef ULONG_LONG_MAX
|
||||||
|
#define ULONG_LONG_MAX ULLONG_MAX
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Instantiate an error checking wrapper for strtoull (unsigned long long)
|
* Instantiate an error checking wrapper for strtoull (unsigned long long)
|
||||||
*/
|
*/
|
||||||
@@ -49,10 +54,8 @@ rtems_status_code rtems_string_to_unsigned_long_long (
|
|||||||
if ( end == s )
|
if ( end == s )
|
||||||
return RTEMS_NOT_DEFINED;
|
return RTEMS_NOT_DEFINED;
|
||||||
|
|
||||||
if ( (result == ULONG_LONG_MAX) && (errno == ERANGE) )
|
if ( ( errno == ERANGE ) &&
|
||||||
return RTEMS_INVALID_NUMBER;
|
(( result == 0 ) || ( result == ULONG_LONG_MAX )))
|
||||||
|
|
||||||
if ( (result == 0) && (errno == ERANGE) )
|
|
||||||
return RTEMS_INVALID_NUMBER;
|
return RTEMS_INVALID_NUMBER;
|
||||||
|
|
||||||
*n = result;
|
*n = result;
|
||||||
|
|||||||
Reference in New Issue
Block a user