From a0c534b803960f2edd26970dee62d1429b28d3f6 Mon Sep 17 00:00:00 2001 From: josch Date: Mon, 29 Dec 2014 09:49:48 +0100 Subject: [PATCH] adjust includes according to iwyu 3.5 --- fuse/filecache.c | 5 +--- fuse/main.c | 3 --- fuse/operations.c | 5 ++-- fuse/operations.h | 6 +++++ mfapi/apicalls.c | 15 +++++++----- mfapi/apicalls.h | 16 +++++++++---- mfapi/apicalls/file_get_links.c | 8 +++---- mfapi/link_type.def | 41 --------------------------------- mfshell/commands/get.c | 2 +- mfshell/commands/links.c | 2 +- 10 files changed, 36 insertions(+), 67 deletions(-) delete mode 100644 mfapi/link_type.def diff --git a/fuse/filecache.c b/fuse/filecache.c index 02b9e8c..7e7e1fc 100644 --- a/fuse/filecache.c +++ b/fuse/filecache.c @@ -21,9 +21,6 @@ #include #include #include -#ifdef __linux -#include -#endif #include #include #include @@ -336,7 +333,7 @@ static int filecache_download_file(const char *filecache_path, file = file_alloc(); retval = mfconn_api_file_get_links(conn, file, (char *)quickkey, - LINK_TYPE_DIRECT_DOWNLOAD); + MFCONN_FILE_LINK_TYPE_DIRECT_DOWNLOAD); if (retval != 0) { fprintf(stderr, "mfconn_api_file_get_links failed\n"); diff --git a/fuse/main.c b/fuse/main.c index d80e4d0..a48b1bc 100644 --- a/fuse/main.c +++ b/fuse/main.c @@ -31,12 +31,9 @@ #include #include #include -#ifdef __linux #include -#endif #include #include -#include #include #include "../mfapi/mfconn.h" diff --git a/fuse/operations.c b/fuse/operations.c index 81bbd5a..8c15387 100644 --- a/fuse/operations.c +++ b/fuse/operations.c @@ -31,15 +31,16 @@ #include #include #include -#ifdef __linux #include -#endif #include #include #include +#include +#include #include "../mfapi/mfconn.h" #include "../mfapi/apicalls.h" +#include "../utils/stringv.h" #include "hashtbl.h" #include "operations.h" diff --git a/fuse/operations.h b/fuse/operations.h index c037412..85e4657 100644 --- a/fuse/operations.h +++ b/fuse/operations.h @@ -26,6 +26,12 @@ #include "hashtbl.h" #include "../utils/stringv.h" +struct fuse_conn_info; +struct fuse_file_info; +struct stat; +struct statvfs; +struct timespec; + struct mediafirefs_context_private { mfconn *conn; folder_tree *tree; diff --git a/mfapi/apicalls.c b/mfapi/apicalls.c index a284067..c0f4d95 100644 --- a/mfapi/apicalls.c +++ b/mfapi/apicalls.c @@ -22,14 +22,17 @@ #include "../utils/http.h" -#define X_LINK_TYPE(a,b,c) c, -const char *link_types[] = { -#include "link_type.def" - NULL +const char *mfconn_file_link_types[] = { + "normal_download", + "direct_download", + "view", + "edit", + "watch", + "listen", + "streaming", + "one_time_download" }; -#undef X_LINK_TYPE - int mfapi_check_response(json_t * response, const char *apicall) { json_t *j_obj; diff --git a/mfapi/apicalls.h b/mfapi/apicalls.h index 7fe12aa..23893df 100644 --- a/mfapi/apicalls.h +++ b/mfapi/apicalls.h @@ -43,12 +43,18 @@ enum mfconn_device_change_type { MFCONN_DEVICE_CHANGE_END }; -#define X_LINK_TYPE(a,b,c) a, -enum { -#include "link_type.def" +enum mfconn_file_link_type { + MFCONN_FILE_LINK_TYPE_NORMAL_DOWNLOAD, + MFCONN_FILE_LINK_TYPE_DIRECT_DOWNLOAD, + MFCONN_FILE_LINK_TYPE_VIEW, + MFCONN_FILE_LINK_TYPE_EDIT, + MFCONN_FILE_LINK_TYPE_WATCH, + MFCONN_FILE_LINK_TYPE_LISTEN, + MFCONN_FILE_LINK_TYPE_STREAMING, + MFCONN_FILE_LINK_TYPE_ONE_TIME_DOWNLOAD }; -#undef X_LINK_TYPE +extern const char *mfconn_file_link_types[]; // declared in apicalls.c struct mfconn_device_change { enum mfconn_device_change_type change; @@ -66,7 +72,7 @@ int mfconn_api_file_get_info(mfconn * conn, mffile * file, int mfconn_api_file_get_links(mfconn * conn, mffile * file, const char *quickkey, - uint32_t link_mask); + enum mfconn_file_link_type link_mask); int mfconn_api_file_move(mfconn * conn, const char *quickkey, const char *folderkey); diff --git a/mfapi/apicalls/file_get_links.c b/mfapi/apicalls/file_get_links.c index 98e749f..7a2210e 100644 --- a/mfapi/apicalls/file_get_links.c +++ b/mfapi/apicalls/file_get_links.c @@ -23,7 +23,6 @@ #include #include "../../utils/http.h" -#include "../../utils/strings.h" #include "../mfconn.h" #include "../file.h" #include "../apicalls.h" // IWYU pragma: keep @@ -31,10 +30,10 @@ static int _decode_file_get_links(mfhttp * conn, void *data); int mfconn_api_file_get_links(mfconn * conn, mffile * file, - const char *quickkey, uint32_t link_mask) + const char *quickkey, + enum mfconn_file_link_type link_mask) { const char *api_call; - extern const char *link_types[]; // declared in apicalls.c int retval; int len; mfhttp *http; @@ -59,7 +58,8 @@ int mfconn_api_file_get_links(mfconn * conn, mffile * file, "?quick_key=%s" "&link_type=%s" "&response_format=json", - quickkey, link_types[link_mask]); + quickkey, + mfconn_file_link_types[link_mask]); if (api_call == NULL) { fprintf(stderr, "mfconn_create_signed_get failed\n"); return -1; diff --git a/mfapi/link_type.def b/mfapi/link_type.def deleted file mode 100644 index 134e74e..0000000 --- a/mfapi/link_type.def +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2013 Bryan Christ - * 2014 Johannes Schauer - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2, as published by - * the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -/* - x-macro for link type definitions used with the file/get_links as of - REST API version 1.2 and higher. - - - field definitions - - field 1 - enumerated name - field 2 - bit value - field 3 - REST API paramenter string -*/ - -X_LINK_TYPE(LINK_TYPE_SHARING, (1 << 0), "normal_download") -X_LINK_TYPE(LINK_TYPE_DIRECT_DOWNLOAD, (1 << 1), "direct_download") -X_LINK_TYPE(LINK_TYPE_VIEW, (1 << 2), "view") -X_LINK_TYPE(LINK_TYPE_EDIT, (1 << 3), "edit") -X_LINK_TYPE(LINK_TYPE_WATCH, (1 << 4), "watch") -X_LINK_TYPE(LINK_TYPE_LISTEN, (1 << 5), "listen") -X_LINK_TYPE(LINK_TYPE_STREAMING, (1 << 6), "streaming") - -X_LINK_TYPE(LINK_TYPE_ONE_TIME_DOWNLOAD, (1 << 16), "one_time_download") - diff --git a/mfshell/commands/get.c b/mfshell/commands/get.c index 0315fb2..06f54b7 100644 --- a/mfshell/commands/get.c +++ b/mfshell/commands/get.c @@ -80,7 +80,7 @@ int mfshell_cmd_get(mfshell * mfshell, int argc, char *const argv[]) // request a direct download (streaming) link retval = mfconn_api_file_get_links(mfshell->conn, file, (char *)quickkey, - LINK_TYPE_DIRECT_DOWNLOAD); + MFCONN_FILE_LINK_TYPE_DIRECT_DOWNLOAD); if (retval != 0) { file_free(file); diff --git a/mfshell/commands/links.c b/mfshell/commands/links.c index c3f0438..197185c 100644 --- a/mfshell/commands/links.c +++ b/mfshell/commands/links.c @@ -63,7 +63,7 @@ int mfshell_cmd_links(mfshell * mfshell, int argc, char *const argv[]) // this should be updated. retval = mfconn_api_file_get_links(mfshell->conn, file, (char *)quickkey, - LINK_TYPE_DIRECT_DOWNLOAD); + MFCONN_FILE_LINK_TYPE_DIRECT_DOWNLOAD); if (retval != 0) { fprintf(stderr, "api call unsuccessful\n"); }