Changeset 34260 for trunk/Ohana/src/opihi/lib.shell/check_stack.c
- Timestamp:
- Jul 31, 2012, 4:02:00 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/lib.shell/check_stack.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/lib.shell/check_stack.c
r20936 r34260 1 1 # include "opihi.h" 2 # ifndef MAX_INT 3 # define MAX_INT 2147483647 4 # endif 2 5 3 6 int check_stack (StackVar *stack, int Nstack, int validsize) { … … 12 15 13 16 /** if this is a number, put it on the list of scalars and move on. assume value is 14 * an int unless proven otherwise **/ 17 * an int unless proven otherwise. 18 19 If we have built libdvo with opihi_int defined as a 32bit signed int, then we have 20 an overflow for values > MAX_INT (2^31). If the float value is larger than this, 21 we should treat the value as a float. (NOTE: this means we cannot use 32bit flags, 22 only 31bit flags. 23 24 **/ 25 15 26 stack[i].FltValue = strtod (stack[i].name, &c1); 16 27 stack[i].IntValue = strtol (stack[i].name, &c2, 0); 28 if ((fabs(stack[i].FltValue) > MAX_INT) && (c1 == stack[i].name + strlen (stack[i].name))) { 29 stack[i].type = 'S'; // 'S' == (float) 30 continue; 31 } 17 32 if (c2 == stack[i].name + strlen (stack[i].name)) { 18 33 stack[i].type = 's'; // 's' == (int)
Note:
See TracChangeset
for help on using the changeset viewer.
