--- parser3/src/main/pa_string.C 2001/09/06 14:55:06 1.102 +++ parser3/src/main/pa_string.C 2001/09/07 17:11:51 1.102.2.1 @@ -5,7 +5,7 @@ Author: Alexander Petrosyan (http://design.ru/paf) */ -static const char *RCSId="$Id: pa_string.C,v 1.102 2001/09/06 14:55:06 parser Exp $"; +static const char *RCSId="$Id: pa_string.C,v 1.102.2.1 2001/09/07 17:11:51 parser Exp $"; #include "pa_config_includes.h" @@ -712,10 +712,13 @@ double String::as_double() const { else result=(double)strtod(cstr, &error_pos); - if(error_pos==cstr/*empty*/ || *error_pos/*not eos*/) - THROW(0, 0, - this, - "invalid number (double)"); + if(error_pos==cstr/*empty*/) + result=0; + else + if(*error_pos/*not eos*/) + THROW(0, 0, + this, + "invalid number (double)"); return result; } @@ -732,10 +735,13 @@ int String::as_int() const { else result=(int)strtol(cstr, &error_pos, 0); - if(error_pos==cstr/*empty*/ || *error_pos/*not eos*/) - THROW(0, 0, - this, - "invalid number (int)"); + if(error_pos==cstr/*empty*/) + result=0; + else + if(*error_pos/*not eos*/) + THROW(0, 0, + this, + "invalid number (int)"); return result; }