IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34124


Ignore:
Timestamp:
Jul 6, 2012, 12:12:25 PM (14 years ago)
Author:
eugene
Message:

deal with large int values OK (still 32bit signed int limit, though)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120627/Ohana/src/opihi/lib.shell/check_stack.c

    r20936 r34124  
    11# include "opihi.h"
     2# ifndef MAX_INT
     3# define MAX_INT 2147483647
     4# endif
    25
    36int check_stack (StackVar *stack, int Nstack, int validsize) {
     
    1215
    1316      /** 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
    1526      stack[i].FltValue = strtod (stack[i].name, &c1);
    1627      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      }
    1732      if (c2 == stack[i].name + strlen (stack[i].name)) {
    1833        stack[i].type  = 's'; // 's' == (int)
Note: See TracChangeset for help on using the changeset viewer.