--- parser3/src/classes/json.C 2015/08/10 23:47:52 1.37 +++ parser3/src/classes/json.C 2016/05/24 17:48:37 1.42 @@ -1,7 +1,7 @@ /** @file Parser: @b json parser class. - Copyright (c) 2000-2012 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2000-2015 Art. Lebedev Studio (http://www.artlebedev.com) */ #include "classes.h" @@ -18,7 +18,7 @@ #include "pa_vxdoc.h" #endif -volatile const char * IDENT_JSON_C="$Id: json.C,v 1.37 2015/08/10 23:47:52 moko Exp $"; +volatile const char * IDENT_JSON_C="$Id: json.C,v 1.42 2016/05/24 17:48:37 moko Exp $"; // class @@ -29,7 +29,7 @@ public: // global variable -DECLARE_CLASS_VAR(json, new MJson, 0); +DECLARE_CLASS_VAR(json, new MJson); // methods struct Json { @@ -97,7 +97,7 @@ String* json_string(Json *json, const ch String::C result = json->charset !=NULL ? Charset::transcode(String::C(value, length), UTF8_charset, *json->charset) : String::C(pa_strdup(value, length), length); - return new String(result.str, json->taint, result.length); + return new String(result, json->taint); } static Value *json_hook(Request &r, Junction *hook, String* key, Value* value){ @@ -477,7 +477,7 @@ static void _string(Request& r, MethodPa } else if(key == "date" && value->is_string()){ const String& svalue=value->as_string(); if(!json.set_date_format(svalue)) - throw Exception(PARSER_RUNTIME, &svalue, "must be 'sql-string', 'gmt-string' or 'unix-timestamp'"); + throw Exception(PARSER_RUNTIME, &svalue, "must be 'sql-string', 'gmt-string', 'iso-string' or 'unix-timestamp'"); valid_options++; } else if(key == "indent"){ if(value->is_string()){ @@ -523,7 +523,7 @@ static void _string(Request& r, MethodPa if(!value->is_string()){ Junction* junction=value->get_junction(); if(!junction || !junction->method || !junction->method->params_names || junction->method->params_names->count() != 3) - throw Exception(PARSER_RUNTIME, 0, "$.%s must be string or parser method with 3 parameters", HASH_DEFAULT_ELEMENT_NAME); + throw Exception(PARSER_RUNTIME, 0, "$._default must be string or parser method with 3 parameters"); } json.default_method=value; }