diff options
Diffstat (limited to 'plugin/business/pangu-http/src/edit_element.cpp')
| -rw-r--r-- | plugin/business/pangu-http/src/edit_element.cpp | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/plugin/business/pangu-http/src/edit_element.cpp b/plugin/business/pangu-http/src/edit_element.cpp index ed686e2..988ba6e 100644 --- a/plugin/business/pangu-http/src/edit_element.cpp +++ b/plugin/business/pangu-http/src/edit_element.cpp @@ -100,14 +100,14 @@ int construct_cjson_by_treatment(cJSON *a_element, char **node, int *step, int * { if(*node != NULL && strcasecmp(*node, start_indicator) != 0) { - return 0; + return -2; } } if(a_element->type == cJSON_Array) { if(a_element->string != NULL && strcasecmp(a_element->string, start_indicator)) { - return 0; + return -2; } } } @@ -135,14 +135,14 @@ int construct_cjson_by_treatment(cJSON *a_element, char **node, int *step, int * { if(*node != NULL && strcasecmp(*node, start_indicator) != 0) { - return 0; + return -2; } } if(a_element->type == cJSON_Array) { if(a_element->string != NULL && strcasecmp(a_element->string, start_indicator)) { - return 0; + return -2; } } } @@ -157,7 +157,7 @@ int construct_cjson_by_treatment(cJSON *a_element, char **node, int *step, int * } } - return 0; + return 1; } int construct_html_by_treatment(const struct edit_element_rule * rules, xmlNodePtr node, xmlNodePtr *parent_array, size_t *n_parent, int *match) @@ -271,15 +271,15 @@ int cjson_dump_array(cJSON *a, int *depth, int *step, int *step_array_level, cha } if(*depth == 0) { - construct_cjson_by_treatment(a_element, node, step, step_array_level, rules); + xret = construct_cjson_by_treatment(a_element, node, step, step_array_level, rules); } - if(xret == 1) + if(xret == 1 || xret == -2) { *step = (*step >= 2047) ? 2047 : *step; step_array_level[*step] = array_cnt; *node = a_element->string; *depth = *depth -1; - return 1; + return xret; } array_cnt++; a_element = a_element->next; @@ -302,13 +302,13 @@ int cjson_dump_object(cJSON *a, int *depth, int *step, int *step_array_level, ch } if(*depth == 0) { - construct_cjson_by_treatment(a_element, node, step, step_array_level, rules); + xret = construct_cjson_by_treatment(a_element, node, step, step_array_level, rules); } - if(xret == 1) + if(xret == 1 || xret == -2) { *node = a_element->string; *depth = *depth -1; - return 1; + return xret; } } return xret; @@ -526,7 +526,7 @@ size_t parse_json_output_unformatted(const char * in, size_t in_sz, const struct } } - if(match == 0) + if(match == 0 || match == -2) { goto finish; } @@ -587,7 +587,7 @@ size_t format_json_file_type(const char * in, size_t in_sz, const struct edit_el match_num--; } - if(match == 0) + if(match == 0 || match == -2) { goto finish; } @@ -751,7 +751,12 @@ size_t format_input_html(const char * in, size_t in_sz, const struct edit_elemen { if(doc->children != NULL && doc->children->next != NULL) { - xmlNewProp(doc->children->next, (const xmlChar *)"need_check", (const xmlChar *)"true"); + xmlNodePtr node = doc->children->next; + while(node->type != XML_ELEMENT_NODE) + { + node = node->next; + } + xmlNewProp(node, (const xmlChar *)"need_check", (const xmlChar *)"true"); } else if(doc->children != NULL) { |
