Diff for /parser3/src/classes/math.C between versions 1.60 and 1.61

version 1.60, 2012/05/23 20:51:40 version 1.61, 2012/05/28 10:33:18
Line 357  static void _crc32(Request& r, MethodPar Line 357  static void _crc32(Request& r, MethodPar
         r.write_no_lang(*new VInt(pa_crc32(string, strlen(string))));          r.write_no_lang(*new VInt(pa_crc32(string, strlen(string))));
 }  }
   
 static void toBase(unsigned long value, unsigned int base, char*& ptr){  static void toBase(unsigned int value, unsigned int base, char*& ptr){
         static const char* hex="0123456789ABCDEF";          static const char* hex="0123456789ABCDEF";
         int rest = value % base;          int rest = value % base;
         if(value >= base)          if(value >= base)
Line 376  static void _convert(Request& r, MethodP Line 376  static void _convert(Request& r, MethodP
         if(base_to < 2 || base_to > 16)          if(base_to < 2 || base_to > 16)
                 throw Exception(PARSER_RUNTIME, 0, "base to must be an integer from 2 to 16");                  throw Exception(PARSER_RUNTIME, 0, "base to must be an integer from 2 to 16");
   
         while(*str && isspace((unsigned char)*str))          while(isspace(*str))
                 str++;                  str++;
   
         if(!*str)          if(!*str)
                 return;                  return;
   
         char *error_pos;  
   
         bool negative=false;          bool negative=false;
         if(str[0]=='-') {          if(str[0]=='-') {
                 negative=true;                  negative=true;
Line 392  static void _convert(Request& r, MethodP Line 390  static void _convert(Request& r, MethodP
                 str++;                  str++;
         }          }
   
         errno=0;          unsigned int value=pa_atoui(str, base_from);
         unsigned long value=strtoul(str, &error_pos, base_from);  
         if(errno==ERANGE)  
                         throw Exception("number.format", 0, "'%s' is out of range (int)", str);  
   
         while(char c=*error_pos++)  
                 if(!isspace((unsigned char)c))  
                         throw Exception("number.format", 0, "'%s' is invalid number (int)", str);  
   
         char result_cstr[sizeof(unsigned long)*8+1/*minus for negative number*/+1/*terminator*/];          char result_cstr[sizeof(unsigned int)*8+1/*minus for negative number*/+1/*terminator*/];
         char* ptr=result_cstr;          char* ptr=result_cstr;
         if(negative)          if(negative)
                 *ptr++='-';                  *ptr++='-';

Removed from v.1.60  
changed lines
  Added in v.1.61


E-mail: