--- parser3/src/classes/string.C 2015/10/08 23:14:56 1.221 +++ parser3/src/classes/string.C 2015/11/16 18:27:15 1.223 @@ -1,7 +1,7 @@ /** @file Parser: @b string parser class. - Copyright (c) 2001-2012 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2015 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ @@ -20,7 +20,7 @@ #include "pa_vregex.h" #include "pa_charsets.h" -volatile const char * IDENT_STRING_C="$Id: string.C,v 1.221 2015/10/08 23:14:56 moko Exp $"; +volatile const char * IDENT_STRING_C="$Id: string.C,v 1.223 2015/11/16 18:27:15 moko Exp $"; // class @@ -92,25 +92,22 @@ static void _int(Request& r, MethodParam static void _double(Request& r, MethodParams& params) { const String& self_string=GET_SELF(r, VString).string(); - double converted; if(self_string.is_empty()) { if(params.count()>0) - converted=params.as_double(0, "default must be double", r); // (default) + r.write_no_lang(*new VDouble(params.as_double(0, "default must be double", r))); // (default) else throw Exception(PARSER_RUNTIME, 0, "unable to convert empty string without default specified"); } else { try { - converted=self_string.as_double(); + r.write_no_lang(*new VDouble(self_string.as_double())); } catch(...) { // convert problem if(params.count()>0) - converted=params.as_double(0, "default must be double", r); // (default) + r.write_no_lang(*new VDouble(params.as_double(0, "default must be double", r))); // (default) else rethrow; // we have a problem when no default } } - - r.write_no_lang(*new VDouble(converted)); } static void _bool(Request& r, MethodParams& params) {