adjust includes according to iwyu 3.5

This commit is contained in:
josch
2014-12-29 09:49:48 +01:00
parent 8c5bb77601
commit a0c534b803
10 changed files with 36 additions and 67 deletions

View File

@@ -21,9 +21,6 @@
#include <stdio.h>
#include <string.h>
#include <openssl/sha.h>
#ifdef __linux
#include <fcntl.h>
#endif
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
@@ -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");

View File

@@ -31,12 +31,9 @@
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#ifdef __linux
#include <fcntl.h>
#endif
#include <pwd.h>
#include <wordexp.h>
#include <fcntl.h>
#include <stdbool.h>
#include "../mfapi/mfconn.h"

View File

@@ -31,15 +31,16 @@
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#ifdef __linux
#include <fcntl.h>
#endif
#include <fuse/fuse_common.h>
#include <stdint.h>
#include <libgen.h>
#include <stdbool.h>
#include <time.h>
#include "../mfapi/mfconn.h"
#include "../mfapi/apicalls.h"
#include "../utils/stringv.h"
#include "hashtbl.h"
#include "operations.h"

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -23,7 +23,6 @@
#include <string.h>
#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;

View File

@@ -1,41 +0,0 @@
/*
* Copyright (C) 2013 Bryan Christ <bryan.christ@mediafire.com>
* 2014 Johannes Schauer <j.schauer@email.de>
*
* 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")

View File

@@ -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);

View File

@@ -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");
}