Fixed errors in string_to_int.
authoretisserant
Sun, 04 Jan 2009 17:23:06 +0100
changeset 163 61f65dd6eeb9
parent 162 60a124678842
child 164 a0679c78143a
Fixed errors in string_to_int.
lib/iec_std_lib.h
lib/iec_types.h
--- a/lib/iec_std_lib.h	Sun Jan 04 17:21:33 2009 +0100
+++ b/lib/iec_std_lib.h	Sun Jan 04 17:23:06 2009 +0100
@@ -559,7 +559,7 @@
                 shift += 1;
             }else if( c >= '.' ){ /* reset value */
                 res = 0;
-                fac = 1;
+                fac = IN->body[0] == '-' ? -1 : 1;
                 shift = 0;
             }            
         }
--- a/lib/iec_types.h	Sun Jan 04 17:21:33 2009 +0100
+++ b/lib/iec_types.h	Sun Jan 04 17:23:06 2009 +0100
@@ -52,7 +52,7 @@
 #endif
 
 #ifndef STR_LEN_TYPE
-#define STR_LEN_TYPE uint8_t
+#define STR_LEN_TYPE int8_t
 #endif
 
 typedef STR_LEN_TYPE __strlen_t;