Diff for /parser3/src/classes/json.C between versions 1.31 and 1.34

version 1.31, 2014/05/23 02:47:16 version 1.34, 2015/03/17 07:28:43
Line 427  static void _string(Request& r, MethodPa Line 427  static void _string(Request& r, MethodPa
                                         if(!json.set_file_format(svalue))                                          if(!json.set_file_format(svalue))
                                                 throw Exception(PARSER_RUNTIME, &svalue, "must be 'base64', 'text' or 'stat'");                                                  throw Exception(PARSER_RUNTIME, &svalue, "must be 'base64', 'text' or 'stat'");
                                         valid_options++;                                          valid_options++;
                                   } else if(key == "void" && value->is_string()){
                                           const String& svalue=value->as_string();
                                           if(!json.set_void_format(svalue))
                                                   throw Exception(PARSER_RUNTIME, &svalue, "must be 'string' or 'null'");
                                           valid_options++;
 #ifdef XML  #ifdef XML
                                 } else if(key == "xdoc" && (vvalue = value->get_hash())){                                  } else if(key == "xdoc" && (vvalue = value->get_hash())){
                                         json.xdoc_options=new XDocOutputOptions();                                          json.xdoc_options=new XDocOutputOptions();
Line 447  static void _string(Request& r, MethodPa Line 452  static void _string(Request& r, MethodPa
                         // special handling for $._default                           // special handling for $._default 
                         if(VHash* vhash=static_cast<VHash*>(params[1].as(VHASH_TYPE)))                          if(VHash* vhash=static_cast<VHash*>(params[1].as(VHASH_TYPE)))
                                 if(Value* value=vhash->get_default()) {                                  if(Value* value=vhash->get_default()) {
                                           if(!value->is_string()){
                                         Junction* junction=value->get_junction();                                          Junction* junction=value->get_junction();
                                         if(!junction || !junction->method || !junction->method->params_names || junction->method->params_names->count() != 3)                                          if(!junction || !junction->method || !junction->method->params_names || junction->method->params_names->count() != 3)
                                                 throw Exception(PARSER_RUNTIME, 0, "$.%s must be parser method with 3 parameters", HASH_DEFAULT_ELEMENT_NAME);                                                          throw Exception(PARSER_RUNTIME, 0, "$.%s must be string or parser method with 3 parameters", HASH_DEFAULT_ELEMENT_NAME);
                                           }
                                         json.default_method=value;                                          json.default_method=value;
                                 }                                  }
   
Line 457  static void _string(Request& r, MethodPa Line 464  static void _string(Request& r, MethodPa
                                 json.methods=methods;                                  json.methods=methods;
                 }                  }
   
         const String& result_string=value_json_string(String::Body(), params[0], json);          const String& result_string=value_json_string(String::Body(), r.process_to_value(params[0]), json);
         String::Body result_body=result_string.cstr_to_string_body_untaint(String::L_JSON, r.connection(false), &r.charsets);          String::Body result_body=result_string.cstr_to_string_body_untaint(String::L_JSON, r.connection(false), &r.charsets);
         r.write_pass_lang(*new String(result_body, String::L_AS_IS));          r.write_pass_lang(*new String(result_body, String::L_AS_IS));
  }   }

Removed from v.1.31  
changed lines
  Added in v.1.34


E-mail: