mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 21:24:28 -08:00
remove the _t postfix from type names because POSIX reserves types ending in _t
This commit is contained in:
@@ -32,16 +32,16 @@
|
||||
#include "../../utils/http.h"
|
||||
|
||||
static int
|
||||
_decode_file_get_info(http_t *conn, void *data);
|
||||
_decode_file_get_info(mfhttp *conn, void *data);
|
||||
|
||||
int
|
||||
mfconn_api_file_get_info(mfconn_t *mfconn,file_t *file,char *quickkey)
|
||||
mfconn_api_file_get_info(mfconn *conn,mffile *file,char *quickkey)
|
||||
{
|
||||
char *api_call;
|
||||
int retval;
|
||||
int len;
|
||||
|
||||
if(mfconn == NULL) return -1;
|
||||
if(conn == NULL) return -1;
|
||||
|
||||
if(file == NULL) return -1;
|
||||
if(quickkey == NULL) return -1;
|
||||
@@ -51,18 +51,18 @@ mfconn_api_file_get_info(mfconn_t *mfconn,file_t *file,char *quickkey)
|
||||
// key must either be 11 or 15 chars
|
||||
if(len != 11 && len != 15) return -1;
|
||||
|
||||
api_call = mfconn_create_signed_get(mfconn, 1, "file/get_info.php",
|
||||
api_call = mfconn_create_signed_get(conn, 1, "file/get_info.php",
|
||||
"?quick_key=%s&response_format=json", quickkey);
|
||||
|
||||
http_t *conn = http_create();
|
||||
retval = http_get_buf(conn, api_call, _decode_file_get_info, file);
|
||||
http_destroy(conn);
|
||||
mfhttp *http = http_create();
|
||||
retval = http_get_buf(http, api_call, _decode_file_get_info, file);
|
||||
http_destroy(http);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
_decode_file_get_info(http_t *conn, void *data)
|
||||
_decode_file_get_info(mfhttp *conn, void *data)
|
||||
{
|
||||
json_error_t error;
|
||||
json_t *root;
|
||||
@@ -71,11 +71,11 @@ _decode_file_get_info(http_t *conn, void *data)
|
||||
json_t *file_hash;
|
||||
json_t *file_name;
|
||||
int retval = 0;
|
||||
file_t *file;
|
||||
mffile *file;
|
||||
|
||||
if(data == NULL) return -1;
|
||||
|
||||
file = (file_t *)data;
|
||||
file = (mffile *)data;
|
||||
|
||||
root = http_parse_buf_json(conn, 0, &error);
|
||||
|
||||
|
||||
@@ -32,16 +32,16 @@
|
||||
#include "../../utils/http.h"
|
||||
|
||||
static int
|
||||
_decode_file_get_links(http_t *conn, void *data);
|
||||
_decode_file_get_links(mfhttp *conn, void *data);
|
||||
|
||||
int
|
||||
mfconn_api_file_get_links(mfconn_t *mfconn,file_t *file,char *quickkey)
|
||||
mfconn_api_file_get_links(mfconn *conn,mffile *file,char *quickkey)
|
||||
{
|
||||
char *api_call;
|
||||
int retval;
|
||||
int len;
|
||||
|
||||
if(mfconn == NULL) return -1;
|
||||
if(conn == NULL) return -1;
|
||||
|
||||
if(file == NULL) return -1;
|
||||
if(quickkey == NULL) return -1;
|
||||
@@ -51,18 +51,18 @@ mfconn_api_file_get_links(mfconn_t *mfconn,file_t *file,char *quickkey)
|
||||
// key must either be 11 or 15 chars
|
||||
if(len != 11 && len != 15) return -1;
|
||||
|
||||
api_call = mfconn_create_signed_get(mfconn,0,"file/get_links.php",
|
||||
api_call = mfconn_create_signed_get(conn,0,"file/get_links.php",
|
||||
"?quick_key=%s&response_format=json", quickkey);
|
||||
|
||||
http_t *conn = http_create();
|
||||
retval = http_get_buf(conn, api_call, _decode_file_get_links, file);
|
||||
http_destroy(conn);
|
||||
mfhttp *http = http_create();
|
||||
retval = http_get_buf(http, api_call, _decode_file_get_links, file);
|
||||
http_destroy(http);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
_decode_file_get_links(http_t *conn, void *data)
|
||||
_decode_file_get_links(mfhttp *conn, void *data)
|
||||
{
|
||||
json_error_t error;
|
||||
json_t *root;
|
||||
@@ -73,11 +73,11 @@ _decode_file_get_links(http_t *conn, void *data)
|
||||
json_t *onetime_link;
|
||||
json_t *links_array;
|
||||
int retval = 0;
|
||||
file_t *file;
|
||||
mffile *file;
|
||||
|
||||
if(data == NULL) return -1;
|
||||
|
||||
file = (file_t *)data;
|
||||
file = (mffile *)data;
|
||||
|
||||
root = http_parse_buf_json(conn, 0, &error);
|
||||
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
#include "../../utils/strings.h"
|
||||
|
||||
int
|
||||
mfconn_api_folder_create(mfconn_t *mfconn,char *parent,char *name)
|
||||
mfconn_api_folder_create(mfconn *conn,char *parent,char *name)
|
||||
{
|
||||
char *api_call;
|
||||
int retval;
|
||||
|
||||
if(mfconn == NULL) return -1;
|
||||
if(conn == NULL) return -1;
|
||||
|
||||
if(name == NULL) return -1;
|
||||
if(strlen(name) < 1) return -1;
|
||||
@@ -52,7 +52,7 @@ mfconn_api_folder_create(mfconn_t *mfconn,char *parent,char *name)
|
||||
|
||||
if(parent != NULL)
|
||||
{
|
||||
api_call = mfconn_create_signed_get(mfconn,0,"folder/create.php",
|
||||
api_call = mfconn_create_signed_get(conn,0,"folder/create.php",
|
||||
"?parent_key=%s"
|
||||
"&foldername=%s"
|
||||
"&response_format=json",
|
||||
@@ -60,13 +60,13 @@ mfconn_api_folder_create(mfconn_t *mfconn,char *parent,char *name)
|
||||
}
|
||||
else
|
||||
{
|
||||
api_call = mfconn_create_signed_get(mfconn,0,"folder/create.php",
|
||||
api_call = mfconn_create_signed_get(conn,0,"folder/create.php",
|
||||
"?foldername=%s&response_format=json", name);
|
||||
}
|
||||
|
||||
http_t *conn = http_create();
|
||||
retval = http_get_buf(conn, api_call, NULL, NULL);
|
||||
http_destroy(conn);
|
||||
mfhttp *http = http_create();
|
||||
retval = http_get_buf(http, api_call, NULL, NULL);
|
||||
http_destroy(http);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -33,19 +33,19 @@
|
||||
#include "../../utils/http.h"
|
||||
|
||||
static int
|
||||
_decode_folder_get_content_folders(http_t *conn, void *data);
|
||||
_decode_folder_get_content_folders(mfhttp *conn, void *data);
|
||||
|
||||
static int
|
||||
_decode_folder_get_content_files(http_t *conn, void *data);
|
||||
_decode_folder_get_content_files(mfhttp *conn, void *data);
|
||||
|
||||
long
|
||||
mfconn_api_folder_get_content(mfconn_t *mfconn, int mode, folder_t *folder_curr)
|
||||
mfconn_api_folder_get_content(mfconn *conn, int mode, mffolder *folder_curr)
|
||||
{
|
||||
char *api_call;
|
||||
int retval;
|
||||
char *content_type;
|
||||
|
||||
if(mfconn == NULL) return -1;
|
||||
if(conn == NULL) return -1;
|
||||
|
||||
if(mode == 0)
|
||||
content_type = "folders";
|
||||
@@ -61,26 +61,26 @@ mfconn_api_folder_get_content(mfconn_t *mfconn, int mode, folder_t *folder_curr)
|
||||
fprintf(stderr, "folder_get_key '\\0'\n");
|
||||
return 0;
|
||||
}*/
|
||||
api_call = mfconn_create_signed_get(mfconn,0,"folder/get_content.php",
|
||||
api_call = mfconn_create_signed_get(conn,0,"folder/get_content.php",
|
||||
"?folder_key=%s"
|
||||
"&content_type=%s"
|
||||
"&response_format=json",
|
||||
folderkey,
|
||||
content_type);
|
||||
|
||||
http_t* conn = http_create();
|
||||
mfhttp* http = http_create();
|
||||
|
||||
if(mode == 0)
|
||||
retval = http_get_buf(conn, api_call, _decode_folder_get_content_folders, NULL);
|
||||
retval = http_get_buf(http, api_call, _decode_folder_get_content_folders, NULL);
|
||||
else
|
||||
retval = http_get_buf(conn, api_call, _decode_folder_get_content_files, NULL);
|
||||
http_destroy(conn);
|
||||
retval = http_get_buf(http, api_call, _decode_folder_get_content_files, NULL);
|
||||
http_destroy(http);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
_decode_folder_get_content_folders(http_t *conn, void *user_ptr)
|
||||
_decode_folder_get_content_folders(mfhttp *conn, void *user_ptr)
|
||||
{
|
||||
json_error_t error;
|
||||
json_t *root;
|
||||
@@ -143,7 +143,7 @@ _decode_folder_get_content_folders(http_t *conn, void *user_ptr)
|
||||
}
|
||||
|
||||
static int
|
||||
_decode_folder_get_content_files(http_t *conn, void *user_ptr)
|
||||
_decode_folder_get_content_files(mfhttp *conn, void *user_ptr)
|
||||
{
|
||||
json_error_t error;
|
||||
json_t *root;
|
||||
|
||||
@@ -33,15 +33,15 @@
|
||||
#include "../../utils/http.h"
|
||||
|
||||
static int
|
||||
_decode_folder_get_info(http_t *conn, void *data);
|
||||
_decode_folder_get_info(mfhttp *conn, void *data);
|
||||
|
||||
int
|
||||
mfconn_api_folder_get_info(mfconn_t *mfconn,folder_t *folder,char *folderkey)
|
||||
mfconn_api_folder_get_info(mfconn *conn,mffolder *folder,char *folderkey)
|
||||
{
|
||||
char *api_call;
|
||||
int retval;
|
||||
|
||||
if(mfconn == NULL) return -1;
|
||||
if(conn == NULL) return -1;
|
||||
|
||||
if(folder == NULL) return -1;
|
||||
if(folderkey == NULL) return -1;
|
||||
@@ -52,18 +52,18 @@ mfconn_api_folder_get_info(mfconn_t *mfconn,folder_t *folder,char *folderkey)
|
||||
if(strcmp(folderkey,"myfiles") == 0) return -1;
|
||||
}
|
||||
|
||||
api_call = mfconn_create_signed_get(mfconn,0,"folder/get_info.php",
|
||||
api_call = mfconn_create_signed_get(conn,0,"folder/get_info.php",
|
||||
"?folder_key=%s&response_format=json", folderkey);
|
||||
|
||||
http_t *conn = http_create();
|
||||
retval = http_get_buf(conn, api_call, _decode_folder_get_info, folder);
|
||||
http_destroy(conn);
|
||||
mfhttp *http = http_create();
|
||||
retval = http_get_buf(http, api_call, _decode_folder_get_info, folder);
|
||||
http_destroy(http);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
_decode_folder_get_info(http_t *conn, void *data)
|
||||
_decode_folder_get_info(mfhttp *conn, void *data)
|
||||
{
|
||||
json_error_t error;
|
||||
json_t *root;
|
||||
@@ -72,11 +72,11 @@ _decode_folder_get_info(http_t *conn, void *data)
|
||||
json_t *folder_name;
|
||||
json_t *parent_folder;
|
||||
int retval = 0;
|
||||
folder_t *folder;
|
||||
mffolder *folder;
|
||||
|
||||
if(data == NULL) return -1;
|
||||
|
||||
folder = (folder_t *)data;
|
||||
folder = (mffolder *)data;
|
||||
|
||||
root = http_parse_buf_json(conn, 0, &error);
|
||||
|
||||
@@ -110,7 +110,7 @@ _decode_folder_get_info(http_t *conn, void *data)
|
||||
// sample user callback
|
||||
/*
|
||||
static void
|
||||
_mycallback(char *data,size_t sz,cfile_t *cfile)
|
||||
_mycallback(char *data,size_t sz,cmffile *cfile)
|
||||
{
|
||||
double bytes_read;
|
||||
double bytes_total;
|
||||
|
||||
@@ -32,29 +32,29 @@
|
||||
#include "../../utils/http.h"
|
||||
|
||||
static int
|
||||
_decode_user_get_info(http_t *conn, void *data);
|
||||
_decode_user_get_info(mfhttp *conn, void *data);
|
||||
|
||||
int
|
||||
mfconn_api_user_get_info(mfconn_t *mfconn)
|
||||
mfconn_api_user_get_info(mfconn *conn)
|
||||
{
|
||||
char *api_call;
|
||||
int retval;
|
||||
// char *rx_buffer;
|
||||
|
||||
if(mfconn == NULL) return -1;
|
||||
if(conn == NULL) return -1;
|
||||
|
||||
api_call = mfconn_create_signed_get(mfconn,0,"user/get_info.php",
|
||||
api_call = mfconn_create_signed_get(conn,0,"user/get_info.php",
|
||||
"&response_format=json");
|
||||
|
||||
http_t* conn = http_create();
|
||||
retval = http_get_buf(conn, api_call, _decode_user_get_info, NULL);
|
||||
http_destroy(conn);
|
||||
mfhttp* http = http_create();
|
||||
retval = http_get_buf(http, api_call, _decode_user_get_info, NULL);
|
||||
http_destroy(http);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static int
|
||||
_decode_user_get_info(http_t *conn, void *data)
|
||||
_decode_user_get_info(mfhttp *conn, void *data)
|
||||
{
|
||||
json_error_t error;
|
||||
json_t *root;
|
||||
@@ -92,7 +92,7 @@ _decode_user_get_info(http_t *conn, void *data)
|
||||
// sample user callback
|
||||
/*
|
||||
static void
|
||||
_mycallback(char *data,size_t sz,cfile_t *cfile)
|
||||
_mycallback(char *data,size_t sz,cmffile *cfile)
|
||||
{
|
||||
double bytes_read;
|
||||
double bytes_total;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include "../../utils/json.h"
|
||||
|
||||
static int
|
||||
_decode_get_session_token(http_t *conn, void *data);
|
||||
_decode_get_session_token(mfhttp *conn, void *data);
|
||||
|
||||
struct user_get_session_token_response
|
||||
{
|
||||
@@ -42,7 +42,7 @@ struct user_get_session_token_response
|
||||
};
|
||||
|
||||
int
|
||||
mfconn_api_user_get_session_token(mfconn_t *mfconn, char *server,
|
||||
mfconn_api_user_get_session_token(mfconn *conn, char *server,
|
||||
char *username, char *password, int app_id, char *app_key,
|
||||
uint32_t *secret_key, char **secret_time, char **session_token)
|
||||
{
|
||||
@@ -52,14 +52,14 @@ mfconn_api_user_get_session_token(mfconn_t *mfconn, char *server,
|
||||
int retval;
|
||||
struct user_get_session_token_response response;
|
||||
|
||||
if(mfconn == NULL) return -1;
|
||||
if(conn == NULL) return -1;
|
||||
|
||||
// configure url for operation
|
||||
login_url = strdup_printf("https://%s/api/user/get_session_token.php",
|
||||
server);
|
||||
|
||||
// create user signature
|
||||
user_signature = mfconn_create_user_signature(mfconn, username, password, app_id, app_key);
|
||||
user_signature = mfconn_create_user_signature(conn, username, password, app_id, app_key);
|
||||
|
||||
post_args = strdup_printf(
|
||||
"email=%s"
|
||||
@@ -70,9 +70,9 @@ mfconn_api_user_get_session_token(mfconn_t *mfconn, char *server,
|
||||
"&response_format=json",
|
||||
username, password, user_signature);
|
||||
|
||||
http_t *conn = http_create();
|
||||
retval = http_post_buf(conn, login_url, post_args, _decode_get_session_token, (void *)(&response));
|
||||
http_destroy(conn);
|
||||
mfhttp *http = http_create();
|
||||
retval = http_post_buf(http, login_url, post_args, _decode_get_session_token, (void *)(&response));
|
||||
http_destroy(http);
|
||||
|
||||
free(login_url);
|
||||
free(post_args);
|
||||
@@ -85,7 +85,7 @@ mfconn_api_user_get_session_token(mfconn_t *mfconn, char *server,
|
||||
}
|
||||
|
||||
static int
|
||||
_decode_get_session_token(http_t *conn, void *user_ptr)
|
||||
_decode_get_session_token(mfhttp *conn, void *user_ptr)
|
||||
{
|
||||
json_error_t error;
|
||||
json_t *root = NULL;
|
||||
@@ -133,7 +133,7 @@ _decode_get_session_token(http_t *conn, void *user_ptr)
|
||||
// sample user callback
|
||||
/*
|
||||
static void
|
||||
_mycallback(char *data,size_t sz,cfile_t *cfile)
|
||||
_mycallback(char *data,size_t sz,cmffile *cfile)
|
||||
{
|
||||
double bytes_read;
|
||||
double bytes_total;
|
||||
|
||||
Reference in New Issue
Block a user