--- parser3/src/main/pa_string.C 2002/06/24 11:59:33 1.160 +++ parser3/src/main/pa_string.C 2002/08/01 11:26:51 1.164 @@ -3,10 +3,10 @@ Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) - - $Id: pa_string.C,v 1.160 2002/06/24 11:59:33 paf Exp $ */ +static const char* IDENT_STRING_C="$Id: pa_string.C,v 1.164 2002/08/01 11:26:51 paf Exp $"; + #include "pcre.h" #include "pa_pool.h" @@ -705,6 +705,11 @@ double String::as_double() const { cstr=buf; } else cstr=this->cstr(); + while(*cstr && isspace(*cstr)) + cstr++; + if(!*cstr) + return 0; + char *error_pos; // 0xABC if(cstr[0]=='0') @@ -728,12 +733,17 @@ int String::as_int() const { const char *cstr; char buf[MAX_NUMBER]; if(head.chunk.rows+1==append_here) { - int size=min(head.chunk.rows[0].item.size, MAX_NUMBER-1); + size_t size=min(head.chunk.rows[0].item.size, MAX_NUMBER-1); memcpy(buf, head.chunk.rows[0].item.ptr, size); buf[size]=0; cstr=buf; } else cstr=this->cstr(); + while(*cstr && isspace(*cstr)) + cstr++; + if(!*cstr) + return 0; + char *error_pos; // 0xABC if(cstr[0]=='0')