examples/wgetjson/wgetjson_main.c: nxstyle fixes

The rest of errors are about cJSON identifiers:

    wgetjson_main.c:181:2: error: Mixed case identifier found
    wgetjson_main.c:183:9: error: Mixed case identifier found
    wgetjson_main.c:186:37: error: Mixed case identifier found
    wgetjson_main.c:190:12: error: Mixed case identifier found
    wgetjson_main.c:191:6: error: Mixed case identifier found
    wgetjson_main.c:203:39: error: Mixed case identifier found
    wgetjson_main.c:256:36: error: Mixed case identifier found
    wgetjson_main.c:283:2: error: Mixed case identifier found
    wgetjson_main.c:286:9: error: Mixed case identifier found
    wgetjson_main.c:289:37: error: Mixed case identifier found
    wgetjson_main.c:295:6: error: Mixed case identifier found
This commit is contained in:
YAMAMOTO Takashi 2020-09-29 11:49:56 +09:00 committed by Xiang Xiao
parent c4ed4445f4
commit f9ae5608ef

View File

@ -142,11 +142,13 @@ static void wgetjson_callback(FAR char **buffer, int offset, int datend,
len = CONFIG_EXAMPLES_WGETJSON_MAXSIZE - g_json_bufflen;
}
new_json_buff = (FAR char *)realloc(g_json_buff, g_json_bufflen + len + 1);
new_json_buff = (FAR char *)realloc(g_json_buff,
g_json_bufflen + len + 1);
if (new_json_buff)
{
g_json_buff = new_json_buff;
memcpy(&g_json_buff[g_json_bufflen-1], &((*buffer)[offset]), len);
memcpy(&g_json_buff[g_json_bufflen - 1], &((*buffer)[offset]),
len);
g_json_buff[g_json_bufflen + len] = 0;
g_json_bufflen += org;
}
@ -197,7 +199,8 @@ static void wgetjson_doit(char *text)
* Name: wgetjson_json_item_callback
****************************************************************************/
static int wgetjson_json_item_callback(const char *name,int type,cJSON *item)
static int wgetjson_json_item_callback(const char *name, int type,
cJSON *item)
{
if (strlen(name) > 8 && !memcmp(name, "/(null)", 7))
{
@ -208,32 +211,39 @@ static int wgetjson_json_item_callback(const char *name,int type,cJSON *item)
if (!strcmp(name, "name"))
{
printf("name:\t\t\t%s \n", item->valuestring);
// todo something....
/* todo something.... */
}
else if (strcmp(name, "format/type") == 0)
{
printf("format/type:\t\t%s \n", item->valuestring);
// todo something....
/* todo something.... */
}
else if (!strcmp(name, "format/width"))
{
printf("format/width:\t\t%d \n", item->valueint);
// todo something....
/* todo something.... */
}
else if (!strcmp(name, "format/height"))
{
printf("format/height:\t\t%d \n", item->valueint);
// todo something....
/* todo something.... */
}
else if (!strcmp(name, "format/interlace"))
{
printf("format/interlace:\t%s \n", (item->valueint) ? "true" : "false");
// todo something....
printf("format/interlace:\t%s \n",
(item->valueint) ? "true" : "false");
/* todo something.... */
}
else if (!strcmp(name, "format/frame rate"))
{
printf("format/frame rate:\t%d \n", item->valueint);
// todo something....
/* todo something.... */
}
return 1;
@ -310,8 +320,16 @@ int main(int argc, FAR char *argv[])
int post_buff_len = 0;
char *post_single_name = "type";
char *post_single_value = "string";
char *post_multi_names[MULTI_POST_NDATA] = {"name", "gender", "country"};
char *post_multi_values[MULTI_POST_NDATA] = {"darcy", "man", "china"};
char *post_multi_names[MULTI_POST_NDATA] =
{
"name", "gender", "country"
};
char *post_multi_values[MULTI_POST_NDATA] =
{
"darcy", "man", "china"
};
wget_callback_t wget_cb = wgetjson_callback;
while ((option = getopt(argc, argv, ":pPD")) != ERROR)
@ -344,7 +362,8 @@ int main(int argc, FAR char *argv[])
if (badarg)
{
printf("usage: wgetjson -p(single post) -P(multi post) -D(debug wget callback)\n");
printf("usage: wgetjson -p(single post) -P(multi post) "
"-D(debug wget callback)\n");
return -1;
}
@ -368,15 +387,20 @@ int main(int argc, FAR char *argv[])
url = CONFIG_EXAMPLES_WGETPOST_URL;
if (is_post_multi)
{
post_buff_len = web_posts_strlen(post_multi_names, post_multi_values, MULTI_POST_NDATA);
post_buff_len = web_posts_strlen(post_multi_names,
post_multi_values,
MULTI_POST_NDATA);
post_buff = malloc(post_buff_len);
web_posts_str(post_buff, &post_buff_len, post_multi_names, post_multi_values, MULTI_POST_NDATA);
web_posts_str(post_buff, &post_buff_len, post_multi_names,
post_multi_values, MULTI_POST_NDATA);
}
else
{
post_buff_len = web_post_strlen(post_single_name, post_single_value);
post_buff_len = web_post_strlen(post_single_name,
post_single_value);
post_buff = malloc(post_buff_len);
web_post_str(post_buff, &post_buff_len, post_single_name, post_single_value);
web_post_str(post_buff, &post_buff_len, post_single_name,
post_single_value);
}
if (post_buff)