diff host/libcdl/cdlmisc.cxx @ 82:6736c52df507 ecos-sw-2000-04-14

Merge from eCos master repository on 2000-04-14-13:35:46-BST
author jlarmour
date Tue, 18 Apr 2000 21:51:55 +0000
parents 435cced73e2f
children 95f3e12a6327
line wrap: on
line diff
--- a/host/libcdl/cdlmisc.cxx
+++ b/host/libcdl/cdlmisc.cxx
@@ -200,6 +200,9 @@ Cdl::string_to_integer(std::string data,
     CYG_REPORT_FUNCNAMETYPE("Cdl::string_to_integer", "success %d");
 
     bool negative       = false;
+    bool seen_plus      = false;
+    bool seen_minus     = false;
+    
     // Life is a bit easier if I can check for '\0'
     const char* ptr           = data.c_str();
 
@@ -207,7 +210,23 @@ Cdl::string_to_integer(std::string data,
     while (isspace(*ptr))
         ptr++;
 
+    if ('+' == *ptr) {
+        if (seen_plus) {
+            target = 0;
+            CYG_REPORT_RETVAL(false);
+            return false;
+        }
+        seen_plus = true;
+        ptr++;
+    }
+    
     if ('-' == *ptr) {
+        if (seen_minus) {
+            target = 0;
+            CYG_REPORT_RETVAL(false);
+            return false;
+        }
+        seen_minus = true;
         negative = true;
         ptr++;
     }