change log for rtems (2011-02-01)
rtems-vc at rtems.org
rtems-vc at rtems.org
Tue Feb 1 06:10:30 UTC 2011
*ralf*:
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
* libmisc/stringto/stringtolong.c: Reformat range check.
Add check for result==0.
M 1.2688 cpukit/ChangeLog
M 1.4 cpukit/libmisc/stringto/stringtolong.c
diff -u rtems/cpukit/ChangeLog:1.2687 rtems/cpukit/ChangeLog:1.2688
--- rtems/cpukit/ChangeLog:1.2687 Mon Jan 31 20:39:20 2011
+++ rtems/cpukit/ChangeLog Mon Jan 31 23:29:26 2011
@@ -1,4 +1,9 @@
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
+
+ * libmisc/stringto/stringtolong.c: Reformat range check.
+ Add check for result==0.
+
+2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
* libmisc/Makefile.am: Remove stringto/stringto_template.h.
* libmisc/stringto/stringto_template.h: Remove.
diff -u rtems/cpukit/libmisc/stringto/stringtolong.c:1.3 rtems/cpukit/libmisc/stringto/stringtolong.c:1.4
--- rtems/cpukit/libmisc/stringto/stringtolong.c:1.3 Mon Jan 31 20:32:45 2011
+++ rtems/cpukit/libmisc/stringto/stringtolong.c Mon Jan 31 23:29:26 2011
@@ -49,11 +49,9 @@
if ( end == s )
return RTEMS_NOT_DEFINED;
- if ( (result == LONG_MAX) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
-
- if ( (result == LONG_MIN) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
+ if ( ( errno == ERANGE ) &&
+ (( result == 0 ) || ( result == LONG_MAX ) || ( result == LONG_MIN )))
+ return RTEMS_INVALID_NUMBER;
*n = result;
*ralf*:
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
* libmisc/stringto/stringtounsignedlong.c: Reformat range check.
M 1.2689 cpukit/ChangeLog
M 1.4 cpukit/libmisc/stringto/stringtounsignedlong.c
diff -u rtems/cpukit/ChangeLog:1.2688 rtems/cpukit/ChangeLog:1.2689
--- rtems/cpukit/ChangeLog:1.2688 Mon Jan 31 23:29:26 2011
+++ rtems/cpukit/ChangeLog Mon Jan 31 23:36:03 2011
@@ -1,5 +1,6 @@
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
+ * libmisc/stringto/stringtounsignedlong.c: Reformat range check.
* libmisc/stringto/stringtolong.c: Reformat range check.
Add check for result==0.
diff -u rtems/cpukit/libmisc/stringto/stringtounsignedlong.c:1.3 rtems/cpukit/libmisc/stringto/stringtounsignedlong.c:1.4
--- rtems/cpukit/libmisc/stringto/stringtounsignedlong.c:1.3 Mon Jan 31 20:32:46 2011
+++ rtems/cpukit/libmisc/stringto/stringtounsignedlong.c Mon Jan 31 23:36:03 2011
@@ -49,11 +49,9 @@
if ( end == s )
return RTEMS_NOT_DEFINED;
- if ( (result == ULONG_MAX) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
-
- if ( (result == 0) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
+ if ( ( errno == ERANGE ) &&
+ (( result == 0 ) || ( result == ULONG_MAX )))
+ return RTEMS_INVALID_NUMBER;
*n = result;
*ralf*:
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
* libmisc/stringto/stringtounsignedlonglong.c: Reformat range check.
c99 portability improvements.
M 1.2690 cpukit/ChangeLog
M 1.4 cpukit/libmisc/stringto/stringtounsignedlonglong.c
diff -u rtems/cpukit/ChangeLog:1.2689 rtems/cpukit/ChangeLog:1.2690
--- rtems/cpukit/ChangeLog:1.2689 Mon Jan 31 23:36:03 2011
+++ rtems/cpukit/ChangeLog Mon Jan 31 23:38:01 2011
@@ -1,5 +1,7 @@
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
+ * libmisc/stringto/stringtounsignedlonglong.c: Reformat range check.
+ c99 portability improvements.
* libmisc/stringto/stringtounsignedlong.c: Reformat range check.
* libmisc/stringto/stringtolong.c: Reformat range check.
Add check for result==0.
diff -u rtems/cpukit/libmisc/stringto/stringtounsignedlonglong.c:1.3 rtems/cpukit/libmisc/stringto/stringtounsignedlonglong.c:1.4
--- rtems/cpukit/libmisc/stringto/stringtounsignedlonglong.c:1.3 Mon Jan 31 20:32:46 2011
+++ rtems/cpukit/libmisc/stringto/stringtounsignedlonglong.c Mon Jan 31 23:38:01 2011
@@ -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 @@
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;
*ralf*:
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
* libmisc/stringto/stringtolonglong.c: Reformat range check.
c99 portability improvements. Add check for result==0.
M 1.2691 cpukit/ChangeLog
M 1.4 cpukit/libmisc/stringto/stringtolonglong.c
diff -u rtems/cpukit/ChangeLog:1.2690 rtems/cpukit/ChangeLog:1.2691
--- rtems/cpukit/ChangeLog:1.2690 Mon Jan 31 23:38:01 2011
+++ rtems/cpukit/ChangeLog Mon Jan 31 23:39:20 2011
@@ -1,5 +1,7 @@
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
+ * libmisc/stringto/stringtolonglong.c: Reformat range check.
+ c99 portability improvements. Add check for result==0.
* libmisc/stringto/stringtounsignedlonglong.c: Reformat range check.
c99 portability improvements.
* libmisc/stringto/stringtounsignedlong.c: Reformat range check.
diff -u rtems/cpukit/libmisc/stringto/stringtolonglong.c:1.3 rtems/cpukit/libmisc/stringto/stringtolonglong.c:1.4
--- rtems/cpukit/libmisc/stringto/stringtolonglong.c:1.3 Mon Jan 31 20:32:46 2011
+++ rtems/cpukit/libmisc/stringto/stringtolonglong.c Mon Jan 31 23:39:20 2011
@@ -21,6 +21,15 @@
#include <rtems/stringto.h>
+/* c99 has LLONG_MAX instead of LONG_LONG_MAX */
+#ifndef LONG_LONG_MAX
+#define LONG_LONG_MAX LLONG_MAX
+#endif
+/* c99 has LLONG_MIN instead of LONG_LONG_MIN */
+#ifndef LONG_LONG_MIN
+#define LONG_LONG_MIN LLONG_MIN
+#endif
+
/*
* Instantiate an error checking wrapper for strtoll (long long)
*/
@@ -49,11 +58,9 @@
if ( end == s )
return RTEMS_NOT_DEFINED;
- if ( (result == LONG_LONG_MAX) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
-
- if ( (result == LONG_LONG_MIN) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
+ if ( ( errno == ERANGE ) &&
+ (( result == 0 ) || ( result == LONG_LONG_MAX ) || ( result == LONG_LONG_MIN )))
+ return RTEMS_INVALID_NUMBER;
*n = result;
*ralf*:
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
* libmisc/stringto/stringtodouble.c: Reformat range check.
Add check for result = -HUGE_VAL.
M 1.2692 cpukit/ChangeLog
M 1.4 cpukit/libmisc/stringto/stringtodouble.c
diff -u rtems/cpukit/ChangeLog:1.2691 rtems/cpukit/ChangeLog:1.2692
--- rtems/cpukit/ChangeLog:1.2691 Mon Jan 31 23:39:20 2011
+++ rtems/cpukit/ChangeLog Mon Jan 31 23:41:07 2011
@@ -1,5 +1,7 @@
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
+ * libmisc/stringto/stringtodouble.c: Reformat range check.
+ Add check for result = -HUGE_VAL.
* libmisc/stringto/stringtolonglong.c: Reformat range check.
c99 portability improvements. Add check for result==0.
* libmisc/stringto/stringtounsignedlonglong.c: Reformat range check.
diff -u rtems/cpukit/libmisc/stringto/stringtodouble.c:1.3 rtems/cpukit/libmisc/stringto/stringtodouble.c:1.4
--- rtems/cpukit/libmisc/stringto/stringtodouble.c:1.3 Mon Jan 31 20:34:19 2011
+++ rtems/cpukit/libmisc/stringto/stringtodouble.c Mon Jan 31 23:41:07 2011
@@ -48,9 +48,8 @@
if ( end == s )
return RTEMS_NOT_DEFINED;
- if ( (result == HUGE_VAL) && (errno == ERANGE))
- return RTEMS_INVALID_NUMBER;
- if ( (result == 0) && (errno == ERANGE))
+ if ( ( errno == ERANGE ) &&
+ (( result == 0 ) || ( result == HUGE_VAL ) || ( result == -HUGE_VAL )))
return RTEMS_INVALID_NUMBER;
*n = result;
*ralf*:
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
* libmisc/stringto/stringtofloat.c: Reformat range check.
Add check for result = -HUGE_VALF.
M 1.2693 cpukit/ChangeLog
M 1.4 cpukit/libmisc/stringto/stringtofloat.c
diff -u rtems/cpukit/ChangeLog:1.2692 rtems/cpukit/ChangeLog:1.2693
--- rtems/cpukit/ChangeLog:1.2692 Mon Jan 31 23:41:07 2011
+++ rtems/cpukit/ChangeLog Mon Jan 31 23:41:47 2011
@@ -1,5 +1,7 @@
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
+ * libmisc/stringto/stringtofloat.c: Reformat range check.
+ Add check for result = -HUGE_VALF.
* libmisc/stringto/stringtodouble.c: Reformat range check.
Add check for result = -HUGE_VAL.
* libmisc/stringto/stringtolonglong.c: Reformat range check.
diff -u rtems/cpukit/libmisc/stringto/stringtofloat.c:1.3 rtems/cpukit/libmisc/stringto/stringtofloat.c:1.4
--- rtems/cpukit/libmisc/stringto/stringtofloat.c:1.3 Mon Jan 31 20:34:19 2011
+++ rtems/cpukit/libmisc/stringto/stringtofloat.c Mon Jan 31 23:41:48 2011
@@ -48,9 +48,8 @@
if ( end == s )
return RTEMS_NOT_DEFINED;
- if ( (result == HUGE_VALF) && (errno == ERANGE))
- return RTEMS_INVALID_NUMBER;
- if ( (result == 0) && (errno == ERANGE))
+ if ( ( errno == ERANGE ) &&
+ (( result == 0 ) || ( result == HUGE_VALF ) || ( result == -HUGE_VALF )))
return RTEMS_INVALID_NUMBER;
*n = result;
*ralf*:
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
* libmisc/stringto/stringtoint.c: Reformat range check.
Add check for result==0.
M 1.2694 cpukit/ChangeLog
M 1.4 cpukit/libmisc/stringto/stringtoint.c
diff -u rtems/cpukit/ChangeLog:1.2693 rtems/cpukit/ChangeLog:1.2694
--- rtems/cpukit/ChangeLog:1.2693 Mon Jan 31 23:41:47 2011
+++ rtems/cpukit/ChangeLog Mon Jan 31 23:43:21 2011
@@ -1,5 +1,7 @@
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
+ * libmisc/stringto/stringtoint.c: Reformat range check.
+ Add check for result==0.
* libmisc/stringto/stringtofloat.c: Reformat range check.
Add check for result = -HUGE_VALF.
* libmisc/stringto/stringtodouble.c: Reformat range check.
diff -u rtems/cpukit/libmisc/stringto/stringtoint.c:1.3 rtems/cpukit/libmisc/stringto/stringtoint.c:1.4
--- rtems/cpukit/libmisc/stringto/stringtoint.c:1.3 Mon Jan 31 10:25:13 2011
+++ rtems/cpukit/libmisc/stringto/stringtoint.c Mon Jan 31 23:43:21 2011
@@ -49,11 +49,9 @@
if ( end == s )
return RTEMS_NOT_DEFINED;
- if ( (result == LONG_MAX) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
-
- if ( (result == LONG_MIN) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
+ if ( ( errno == ERANGE ) &&
+ (( result == 0 ) || ( result == LONG_MAX ) || ( result == LONG_MIN )))
+ return RTEMS_INVALID_NUMBER;
#if (INT_MAX < LONG_MAX)
if ( result > INT_MAX ) {
*ralf*:
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
* libmisc/stringto/stringto.h: Rename header-guard.
Add rtems_string_to_long_double.
M 1.2695 cpukit/ChangeLog
M 1.4 cpukit/libmisc/stringto/stringto.h
diff -u rtems/cpukit/ChangeLog:1.2694 rtems/cpukit/ChangeLog:1.2695
--- rtems/cpukit/ChangeLog:1.2694 Mon Jan 31 23:43:21 2011
+++ rtems/cpukit/ChangeLog Mon Jan 31 23:45:33 2011
@@ -1,5 +1,7 @@
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
+ * libmisc/stringto/stringto.h: Rename header-guard.
+ Add rtems_string_to_long_double.
* libmisc/stringto/stringtoint.c: Reformat range check.
Add check for result==0.
* libmisc/stringto/stringtofloat.c: Reformat range check.
diff -u rtems/cpukit/libmisc/stringto/stringto.h:1.3 rtems/cpukit/libmisc/stringto/stringto.h:1.4
--- rtems/cpukit/libmisc/stringto/stringto.h:1.3 Tue Dec 1 16:16:10 2009
+++ rtems/cpukit/libmisc/stringto/stringto.h Mon Jan 31 23:45:33 2011
@@ -9,8 +9,8 @@
* $Id$
*/
-#ifndef __STRING_TO_A_TYPE_h__
-#define __STRING_TO_A_TYPE_h__
+#ifndef _RTEMS_STRINGTO_H
+#define _RTEMS_STRINGTO_H
#include <rtems.h>
@@ -224,4 +224,23 @@
char **endptr
);
+/**
+ * @brief Convert String to long double (with validation)
+ *
+ * This method converts a string to a long double with range validation.
+ *
+ * @param[in] s is the string to convert
+ * @param[in] n points to the variable to place the converted output in
+ * @param[in] endptr is used to keep track of the position in the string
+ *
+ * @return This method returns RTEMS_SUCCESSFUL on successful conversion
+ * and *n is filled in. Otherwise, the status indicates the
+ * source of the error.
+ */
+rtems_status_code rtems_string_to_long_double(
+ const char *s,
+ long double *n,
+ char **endptr
+);
+
#endif
*ralf*:
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
* libmisc/Makefile.am: Add stringto/stringtolongdouble.c.
* libmisc/stringto/stringtolongdouble.c: New.
M 1.2696 cpukit/ChangeLog
M 1.87 cpukit/libmisc/Makefile.am
A 1.1 cpukit/libmisc/stringto/stringtolongdouble.c
diff -u rtems/cpukit/ChangeLog:1.2695 rtems/cpukit/ChangeLog:1.2696
--- rtems/cpukit/ChangeLog:1.2695 Mon Jan 31 23:45:33 2011
+++ rtems/cpukit/ChangeLog Mon Jan 31 23:48:30 2011
@@ -1,5 +1,7 @@
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
+ * libmisc/Makefile.am: Add stringto/stringtolongdouble.c.
+ * libmisc/stringto/stringtolongdouble.c: New.
* libmisc/stringto/stringto.h: Rename header-guard.
Add rtems_string_to_long_double.
* libmisc/stringto/stringtoint.c: Reformat range check.
diff -u rtems/cpukit/libmisc/Makefile.am:1.86 rtems/cpukit/libmisc/Makefile.am:1.87
--- rtems/cpukit/libmisc/Makefile.am:1.86 Mon Jan 31 20:39:20 2011
+++ rtems/cpukit/libmisc/Makefile.am Mon Jan 31 23:48:30 2011
@@ -135,6 +135,7 @@
noinst_LIBRARIES += libstringto.a
libstringto_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/stringto
libstringto_a_SOURCES = stringto/stringtodouble.c stringto/stringtofloat.c \
+ stringto/stringtolongdouble.c \
stringto/stringtoint.c stringto/stringtolong.c stringto/stringtolonglong.c \
stringto/stringtopointer.c stringto/stringtounsignedint.c \
stringto/stringtounsignedchar.c stringto/stringtounsignedlong.c \
diff -u /dev/null rtems/cpukit/libmisc/stringto/stringtolongdouble.c:1.1
--- /dev/null Tue Feb 1 00:10:29 2011
+++ rtems/cpukit/libmisc/stringto/stringtolongdouble.c Mon Jan 31 23:48:30 2011
@@ -0,0 +1,58 @@
+/*
+ * COPYRIGHT (c) 2009.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * Copyright (c) 2011 Ralf Corsépius, Ulm, Germany.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include <math.h>
+
+#include <rtems/stringto.h>
+
+/*
+ * Instantiate an error checking wrapper for strtod (double)
+ */
+
+rtems_status_code rtems_string_to_long_double (
+ const char *s,
+ long double *n,
+ char **endptr
+)
+{
+ long double result;
+ char *end;
+
+ if ( !n )
+ return RTEMS_INVALID_ADDRESS;
+
+ errno = 0;
+ *n = 0;
+
+ result = strtold( s, &end );
+
+ if ( endptr )
+ *endptr = end;
+
+ if ( end == s )
+ return RTEMS_NOT_DEFINED;
+
+ if ( ( errno == ERANGE ) &&
+ (( result == 0 ) || ( result == HUGE_VALL ) || ( result == -HUGE_VALL )))
+ return RTEMS_INVALID_NUMBER;
+
+ *n = result;
+
+ return RTEMS_SUCCESSFUL;
+}
*ralf*:
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
* libmisc/stringto/stringtounsignedchar.c,
libmisc/stringto/stringtounsignedint.c: Reformat range check.
M 1.2697 cpukit/ChangeLog
M 1.4 cpukit/libmisc/stringto/stringtounsignedchar.c
M 1.4 cpukit/libmisc/stringto/stringtounsignedint.c
diff -u rtems/cpukit/ChangeLog:1.2696 rtems/cpukit/ChangeLog:1.2697
--- rtems/cpukit/ChangeLog:1.2696 Mon Jan 31 23:48:30 2011
+++ rtems/cpukit/ChangeLog Mon Jan 31 23:55:32 2011
@@ -1,5 +1,7 @@
2011-02-01 Ralf Corsepius <ralf.corsepius at rtems.org>
+ * libmisc/stringto/stringtounsignedchar.c,
+ libmisc/stringto/stringtounsignedint.c: Reformat range check.
* libmisc/Makefile.am: Add stringto/stringtolongdouble.c.
* libmisc/stringto/stringtolongdouble.c: New.
* libmisc/stringto/stringto.h: Rename header-guard.
diff -u rtems/cpukit/libmisc/stringto/stringtounsignedchar.c:1.3 rtems/cpukit/libmisc/stringto/stringtounsignedchar.c:1.4
--- rtems/cpukit/libmisc/stringto/stringtounsignedchar.c:1.3 Mon Jan 31 10:25:13 2011
+++ rtems/cpukit/libmisc/stringto/stringtounsignedchar.c Mon Jan 31 23:55:32 2011
@@ -49,11 +49,9 @@
if ( end == s )
return RTEMS_NOT_DEFINED;
- if ( (result == ULONG_MAX) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
-
- if ( (result == 0) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
+ if ( ( errno == ERANGE ) &&
+ (( result == 0 ) || ( result == ULONG_MAX )))
+ return RTEMS_INVALID_NUMBER;
#if (UCHAR_MAX < ULONG_MAX)
if ( result > UCHAR_MAX ) {
diff -u rtems/cpukit/libmisc/stringto/stringtounsignedint.c:1.3 rtems/cpukit/libmisc/stringto/stringtounsignedint.c:1.4
--- rtems/cpukit/libmisc/stringto/stringtounsignedint.c:1.3 Mon Jan 31 10:25:13 2011
+++ rtems/cpukit/libmisc/stringto/stringtounsignedint.c Mon Jan 31 23:55:32 2011
@@ -49,11 +49,9 @@
if ( end == s )
return RTEMS_NOT_DEFINED;
- if ( (result == ULONG_MAX) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
-
- if ( (result == 0) && (errno == ERANGE) )
- return RTEMS_INVALID_NUMBER;
+ if ( ( errno == ERANGE ) &&
+ (( result == 0 ) || ( result == ULONG_MAX )))
+ return RTEMS_INVALID_NUMBER;
#if (UINT_MAX < ULONG_MAX)
if ( result > UINT_MAX ) {
--
Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110201/4579daf8/attachment.html>
More information about the vc
mailing list