From e0ee1e5f8fd5011d1e2de23fb251213727f75018 Mon Sep 17 00:00:00 2001 From: josch Date: Fri, 19 Sep 2014 21:14:30 +0200 Subject: [PATCH] fix clang warnings --- mfapi/mfconn.c | 4 +--- mfapi/mfconn.h | 4 +--- mfshell/commands/help.c | 2 +- mfshell/mfshell.c | 4 ++-- mfshell/mfshell.h | 14 +++++--------- utils/http.c | 3 ++- utils/http.h | 4 +--- 7 files changed, 13 insertions(+), 22 deletions(-) diff --git a/mfapi/mfconn.c b/mfapi/mfconn.c index 727b6ae..59f24e5 100644 --- a/mfapi/mfconn.c +++ b/mfapi/mfconn.c @@ -28,9 +28,7 @@ #include "mfconn.h" #include "apicalls.h" -typedef struct _mfconn_s mfconn_t; - -struct _mfconn_s +struct mfconn_t { char *server; uint32_t secret_key; diff --git a/mfapi/mfconn.h b/mfapi/mfconn.h index 8f785a0..2eda748 100644 --- a/mfapi/mfconn.h +++ b/mfapi/mfconn.h @@ -23,9 +23,7 @@ #include "file.h" -typedef struct _mfconn_s mfconn_t; - -struct _mfconn_s; +typedef struct mfconn_t mfconn_t; mfconn_t* mfconn_create(char *server, char *username, char *password, int app_id, char *app_key); diff --git a/mfshell/commands/help.c b/mfshell/commands/help.c index 6709cd9..42f735d 100644 --- a/mfshell/commands/help.c +++ b/mfshell/commands/help.c @@ -44,7 +44,7 @@ mfshell_cmd_help(mfshell_t *mfshell, int argc, char **argv) unsigned int column1_width = 0; unsigned int column2_width = 0; - _cmd_t* curr_cmd; + cmd_t* curr_cmd; for (curr_cmd = mfshell->commands; curr_cmd->name != NULL; curr_cmd++) { if (strlen(curr_cmd->name) > column1_width) column1_width = strlen(curr_cmd->name); diff --git a/mfshell/mfshell.c b/mfshell/mfshell.c index 398b579..d86d298 100644 --- a/mfshell/mfshell.c +++ b/mfshell/mfshell.c @@ -37,7 +37,7 @@ #include "mfshell.h" #include "commands.h" -struct _cmd_s commands[] = { +struct cmd_t commands[] = { {"help", "", "show this help", mfshell_cmd_help}, {"debug", "", "show debug information", mfshell_cmd_debug}, {"host", "", "change target server", mfshell_cmd_host}, @@ -95,7 +95,7 @@ mfshell_create(int app_id,char *app_key,char *server) int mfshell_exec(mfshell_t *mfshell, int argc, char **argv) { - _cmd_t* curr_cmd; + cmd_t* curr_cmd; for (curr_cmd = mfshell->commands; curr_cmd->name != NULL; curr_cmd++) { if (strcmp(argv[0], curr_cmd->name) == 0) { return curr_cmd->handler(mfshell, argc, argv); diff --git a/mfshell/mfshell.h b/mfshell/mfshell.h index fef86ab..27a959b 100644 --- a/mfshell/mfshell.h +++ b/mfshell/mfshell.h @@ -24,10 +24,10 @@ #include "../mfapi/folder.h" #include "../mfapi/mfconn.h" -typedef struct _cmd_s _cmd_t; -typedef struct _mfshell_s mfshell_t; +typedef struct cmd_t cmd_t; +typedef struct mfshell_t mfshell_t; -struct _cmd_s +struct cmd_t { char *name; char *argstring; @@ -35,7 +35,7 @@ struct _cmd_s int (*handler) (mfshell_t *mfshell, int argc, char **argv); }; -struct _mfshell_s +struct mfshell_t { int app_id; char *app_key; @@ -48,15 +48,11 @@ struct _mfshell_s char *local_working_dir; /* shell commands */ - _cmd_t *commands; + cmd_t *commands; mfconn_t *mfconn; }; -typedef struct _mfshell_s mfshell_t; -typedef struct _folder_s folder_t; -typedef struct _cmd_s cmd_t; - mfshell_t* mfshell_create(int app_id,char *app_key,char *server); int mfshell_authenticate_user(mfshell_t *mfshell); diff --git a/utils/http.c b/utils/http.c index bae78c7..d8ad953 100644 --- a/utils/http.c +++ b/utils/http.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include "http.h" @@ -28,7 +29,7 @@ static size_t http_read_buf_cb(char *data, size_t size, size_t nmemb, void *user static size_t http_write_buf_cb(char *data, size_t size, size_t nmemb, void *user_ptr); static size_t http_write_file_cb(char *data, size_t size, size_t nmemb, void *user_ptr); -struct _http_s +struct http_t { CURL *curl_handle; char *write_buf; diff --git a/utils/http.h b/utils/http.h index fa3f879..890d2f2 100644 --- a/utils/http.h +++ b/utils/http.h @@ -21,9 +21,7 @@ #include -typedef struct _http_s http_t; - -struct _http_s; +typedef struct http_t http_t; http_t* http_create(void); void http_destroy(http_t* conn);