summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc
diff options
context:
space:
mode:
authorRalf Corsepius <ralf.corsepius@rtems.org>2011-02-01 05:38:01 +0000
committerRalf Corsepius <ralf.corsepius@rtems.org>2011-02-01 05:38:01 +0000
commitc368bd64147fece1323b565fc22517f458f7b39b (patch)
treee55a0b16171f5edd28d73a89c5880c48fe0c8663 /cpukit/libmisc
parent2011-02-01 Ralf Corsepius <ralf.corsepius@rtems.org> (diff)
downloadrtems-c368bd64147fece1323b565fc22517f458f7b39b.tar.bz2
2011-02-01 Ralf Corsepius <ralf.corsepius@rtems.org>
* libmisc/stringto/stringtounsignedlonglong.c: Reformat range check. c99 portability improvements.
Diffstat (limited to 'cpukit/libmisc')
-rw-r--r--cpukit/libmisc/stringto/stringtounsignedlonglong.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/cpukit/libmisc/stringto/stringtounsignedlonglong.c b/cpukit/libmisc/stringto/stringtounsignedlonglong.c
index e418a64624..61c6e2e063 100644
--- a/cpukit/libmisc/stringto/stringtounsignedlonglong.c
+++ b/cpukit/libmisc/stringto/stringtounsignedlonglong.c
@@ -21,6 +21,11 @@
#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)
*/
@@ -49,11 +54,9 @@ rtems_status_code rtems_string_to_unsigned_long_long (
if ( end == s )
return RTEMS_NOT_DEFINED;
- if ( (result == ULONG_LONG_MAX) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
-
- if ( (result == 0) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
+ if ( ( errno == ERANGE ) &&
+ (( result == 0 ) || ( result == ULONG_LONG_MAX )))
+ return RTEMS_INVALID_NUMBER;
*n = result;