diff --git a/common.c b/common.c index 7284aa407dac279adc6596aab845b699081e9e8f..9a77177987203eada2edd608c8fcd2eb04c6c10d 100644 --- a/common.c +++ b/common.c @@ -69,19 +69,18 @@ char *xml_parser(struct write_result *result, char *tag) xpathctx_ptr = doc_ptr ? xmlXPathNewContext(doc_ptr) : NULL; xpathobj_ptr = xpathctx_ptr ? xmlXPathEvalExpression((xmlChar *)tag, xpathctx_ptr) : NULL; - if (xpathobj_ptr) - { + if (xpathobj_ptr) { int n; + xmlNodeSetPtr nodeset_ptr = xpathobj_ptr->nodesetval; - for (n = 0; nodeset_ptr && n < xmlXPathNodeSetGetLength(nodeset_ptr); n++) - { + for (n = 0; nodeset_ptr && n < xmlXPathNodeSetGetLength(nodeset_ptr); n++) { //if (DEBUG) //debug_print("n value: %d\n", n); xmlNodePtr node_ptr = nodeset_ptr->nodeTab[n]; + if (node_ptr->type != XML_ATTRIBUTE_NODE && node_ptr->type != XML_ELEMENT_NODE && node_ptr->type != XML_CDATA_SECTION_NODE) continue; - if (node_ptr->children) - { + if (node_ptr->children) { //tag_content = (char*) node_ptr->children->content; strcpy(tag_content, (char *)node_ptr->children->content); debug_print("tag content: %s\n", tag_content); @@ -108,16 +107,13 @@ void xml_to_json(xmlNode *anode, json_object *jobj) xmlNodePtr cur_node = NULL; json_object *cur_jstr = NULL; - for (cur_node = anode; cur_node; cur_node = cur_node->next) - { + for (cur_node = anode; cur_node; cur_node = cur_node->next) { debug_print("child address: %p\n", cur_node); debug_print("next addres: %p\n", cur_node->next); debug_print("root child content: %s\n", (uint8_t *)xmlNodeGetContent(cur_node)); - if (cur_node->type == XML_ELEMENT_NODE) - { - if (xmlChildElementCount(cur_node) == 0) - { + if (cur_node->type == XML_ELEMENT_NODE) { + if (xmlChildElementCount(cur_node) == 0) { cur_jstr = json_object_new_string((char *)xmlNodeGetContent(cur_node)); debug_print("xmlNodeGet name: %sn", (char *)cur_node->name); diff --git a/dongle.c b/dongle.c index c4d9b9a30fdf0c9896afca559ef3d6f50a639f52..4518c8ffc367cede44832e82852c0c32a5df1c87 100644 --- a/dongle.c +++ b/dongle.c @@ -41,14 +41,11 @@ int parse_args(int argc, char **argv) { char ch; - while ((ch = getopt_long(argc, argv, "d:", long_options, NULL)) != -1) - { - switch (ch) - { + while ((ch = getopt_long(argc, argv, "d:", long_options, NULL)) != -1) { + switch (ch) { case 'd': debug = atoi(optarg); - if (debug > 1 || debug < 0) - { + if (debug > 1 || debug < 0) { printf("%s: option '-%c' is invalid.\n", argv[0], optopt); //cant exactly do debug print in here... goto fail; } @@ -103,6 +100,7 @@ int tag_missing_devices(void) int add_device(struct device *new_dev) { struct device *dev; + dev = search_list(new_dev->usb.if_name); if (dev) { if (dev->ip) @@ -502,8 +500,7 @@ int list_to_blob(struct blob_buf *bb) if (rv < 0) goto fail_string; - if (net_dev->ip) - { + if (net_dev->ip) { rv = blobmsg_add_string(bb, "ip", net_dev->ip); if (rv < 0) goto fail_string;