mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
fix indentation
This commit is contained in:
@@ -57,7 +57,8 @@ int mfconn_api_user_get_session_token(mfconn * conn,
|
|||||||
|
|
||||||
int mfconn_api_folder_delete(mfconn * conn, const char *folderkey);
|
int mfconn_api_folder_delete(mfconn * conn, const char *folderkey);
|
||||||
|
|
||||||
int mfconn_api_device_get_status(mfconn * conn, uint64_t *revision);
|
int mfconn_api_device_get_status(mfconn * conn,
|
||||||
|
uint64_t * revision);
|
||||||
|
|
||||||
int mfconn_api_device_get_changes(mfconn * conn, uint64_t revision);
|
int mfconn_api_device_get_changes(mfconn * conn, uint64_t revision);
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,9 @@ int mfconn_api_device_get_status(mfconn * conn, uint64_t *revision)
|
|||||||
"?response_format=json");
|
"?response_format=json");
|
||||||
|
|
||||||
http = http_create();
|
http = http_create();
|
||||||
retval = http_get_buf(http, api_call, _decode_device_get_status, (void *)revision);
|
retval =
|
||||||
|
http_get_buf(http, api_call, _decode_device_get_status,
|
||||||
|
(void *)revision);
|
||||||
http_destroy(http);
|
http_destroy(http);
|
||||||
|
|
||||||
free((void *)api_call);
|
free((void *)api_call);
|
||||||
@@ -69,7 +71,8 @@ static int _decode_device_get_status(mfhttp * conn, void *data)
|
|||||||
|
|
||||||
device_revision = json_object_get(node, "device_revision");
|
device_revision = json_object_get(node, "device_revision");
|
||||||
if (device_revision != NULL) {
|
if (device_revision != NULL) {
|
||||||
fprintf(stderr, "device_revision: %s\n", json_string_value(device_revision));
|
fprintf(stderr, "device_revision: %s\n",
|
||||||
|
json_string_value(device_revision));
|
||||||
*revision = atoll(json_string_value(device_revision));
|
*revision = atoll(json_string_value(device_revision));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,9 @@ static int _decode_folder_get_content_files(mfhttp * conn, void *data);
|
|||||||
* values.
|
* values.
|
||||||
*/
|
*/
|
||||||
long
|
long
|
||||||
mfconn_api_folder_get_content(mfconn * conn, int mode, mffolder * folder_curr, mffolder ***mffolder_result, mffile ***mffile_result)
|
mfconn_api_folder_get_content(mfconn * conn, int mode, mffolder * folder_curr,
|
||||||
|
mffolder *** mffolder_result,
|
||||||
|
mffile *** mffile_result)
|
||||||
{
|
{
|
||||||
const char *api_call;
|
const char *api_call;
|
||||||
int retval;
|
int retval;
|
||||||
@@ -76,11 +78,13 @@ mfconn_api_folder_get_content(mfconn * conn, int mode, mffolder * folder_curr, m
|
|||||||
if (mode == 0)
|
if (mode == 0)
|
||||||
retval =
|
retval =
|
||||||
http_get_buf(http, api_call,
|
http_get_buf(http, api_call,
|
||||||
_decode_folder_get_content_folders, (void *)mffolder_result);
|
_decode_folder_get_content_folders,
|
||||||
|
(void *)mffolder_result);
|
||||||
else
|
else
|
||||||
retval =
|
retval =
|
||||||
http_get_buf(http, api_call,
|
http_get_buf(http, api_call,
|
||||||
_decode_folder_get_content_files, (void *)mffile_result);
|
_decode_folder_get_content_files,
|
||||||
|
(void *)mffile_result);
|
||||||
http_destroy(http);
|
http_destroy(http);
|
||||||
|
|
||||||
free((void *)api_call);
|
free((void *)api_call);
|
||||||
@@ -145,7 +149,8 @@ static int _decode_folder_get_content_folders(mfhttp * conn, void *user_ptr)
|
|||||||
|
|
||||||
j_obj = json_object_get(data, "revision");
|
j_obj = json_object_get(data, "revision");
|
||||||
if (j_obj != NULL) {
|
if (j_obj != NULL) {
|
||||||
folder_set_revision(tmp_folder, atoll(json_string_value(j_obj)));
|
folder_set_revision(tmp_folder,
|
||||||
|
atoll(json_string_value(j_obj)));
|
||||||
}
|
}
|
||||||
|
|
||||||
j_obj = json_object_get(data, "parent");
|
j_obj = json_object_get(data, "parent");
|
||||||
@@ -165,7 +170,8 @@ static int _decode_folder_get_content_folders(mfhttp * conn, void *user_ptr)
|
|||||||
len_mffolder_result++;
|
len_mffolder_result++;
|
||||||
*mffolder_result =
|
*mffolder_result =
|
||||||
(mffolder **) realloc(*mffolder_result,
|
(mffolder **) realloc(*mffolder_result,
|
||||||
len_mffolder_result*sizeof(mffolder*));
|
len_mffolder_result *
|
||||||
|
sizeof(mffolder *));
|
||||||
(*mffolder_result)[len_mffolder_result - 1] = tmp_folder;
|
(*mffolder_result)[len_mffolder_result - 1] = tmp_folder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -173,7 +179,9 @@ static int _decode_folder_get_content_folders(mfhttp * conn, void *user_ptr)
|
|||||||
|
|
||||||
// append an terminating empty mffolder
|
// append an terminating empty mffolder
|
||||||
len_mffolder_result++;
|
len_mffolder_result++;
|
||||||
*mffolder_result = (mffolder**)realloc(*mffolder_result, len_mffolder_result*sizeof(mffolder*));
|
*mffolder_result =
|
||||||
|
(mffolder **) realloc(*mffolder_result,
|
||||||
|
len_mffolder_result * sizeof(mffolder *));
|
||||||
// write an empty last element
|
// write an empty last element
|
||||||
(*mffolder_result)[len_mffolder_result - 1] = NULL;
|
(*mffolder_result)[len_mffolder_result - 1] = NULL;
|
||||||
|
|
||||||
@@ -251,9 +259,9 @@ static int _decode_folder_get_content_files(mfhttp * conn, void *user_ptr)
|
|||||||
|
|
||||||
j_obj = json_object_get(data, "revision");
|
j_obj = json_object_get(data, "revision");
|
||||||
if (j_obj != NULL) {
|
if (j_obj != NULL) {
|
||||||
file_set_revision(tmp_file, atoll(json_string_value(j_obj)));
|
file_set_revision(tmp_file,
|
||||||
|
atoll(json_string_value(j_obj)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME don't save hex ascii string but binary chars instead
|
// FIXME don't save hex ascii string but binary chars instead
|
||||||
j_obj = json_object_get(data, "hash");
|
j_obj = json_object_get(data, "hash");
|
||||||
if (j_obj != NULL) {
|
if (j_obj != NULL) {
|
||||||
@@ -271,7 +279,9 @@ static int _decode_folder_get_content_files(mfhttp * conn, void *user_ptr)
|
|||||||
|
|
||||||
// append a terminating empty file
|
// append a terminating empty file
|
||||||
len_mffile_result++;
|
len_mffile_result++;
|
||||||
*mffile_result = (mffile**)realloc(*mffile_result, len_mffile_result*sizeof(mffile*));
|
*mffile_result =
|
||||||
|
(mffile **) realloc(*mffile_result,
|
||||||
|
len_mffile_result * sizeof(mffile *));
|
||||||
// write an empty last element
|
// write an empty last element
|
||||||
(*mffile_result)[len_mffile_result - 1] = NULL;
|
(*mffile_result)[len_mffile_result - 1] = NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -42,15 +42,16 @@ int mfshell_cmd_list(mfshell * mfshell, int argc, char *const argv[])
|
|||||||
fprintf(stderr, "Invalid number of arguments\n");
|
fprintf(stderr, "Invalid number of arguments\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// first folders
|
// first folders
|
||||||
folder_result = NULL;
|
folder_result = NULL;
|
||||||
retval =
|
retval =
|
||||||
mfconn_api_folder_get_content(mfshell->conn, 0, mfshell->folder_curr, &folder_result, NULL);
|
mfconn_api_folder_get_content(mfshell->conn, 0, mfshell->folder_curr,
|
||||||
|
&folder_result, NULL);
|
||||||
mfconn_update_secret_key(mfshell->conn);
|
mfconn_update_secret_key(mfshell->conn);
|
||||||
|
|
||||||
for (i = 0; folder_result[i] != NULL; i++) {
|
for (i = 0; folder_result[i] != NULL; i++) {
|
||||||
printf("%s %s\n", folder_get_name(folder_result[i]), folder_get_key(folder_result[i]));
|
printf("%s %s\n", folder_get_name(folder_result[i]),
|
||||||
|
folder_get_key(folder_result[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; folder_result[i] != NULL; i++) {
|
for (i = 0; folder_result[i] != NULL; i++) {
|
||||||
@@ -61,11 +62,13 @@ int mfshell_cmd_list(mfshell * mfshell, int argc, char *const argv[])
|
|||||||
// then files
|
// then files
|
||||||
file_result = NULL;
|
file_result = NULL;
|
||||||
retval =
|
retval =
|
||||||
mfconn_api_folder_get_content(mfshell->conn, 1, mfshell->folder_curr, NULL, &file_result);
|
mfconn_api_folder_get_content(mfshell->conn, 1, mfshell->folder_curr,
|
||||||
|
NULL, &file_result);
|
||||||
mfconn_update_secret_key(mfshell->conn);
|
mfconn_update_secret_key(mfshell->conn);
|
||||||
|
|
||||||
for (i = 0; file_result[i] != NULL; i++) {
|
for (i = 0; file_result[i] != NULL; i++) {
|
||||||
printf("%s %s\n", file_get_name(file_result[i]), file_get_key(file_result[i]));
|
printf("%s %s\n", file_get_name(file_result[i]),
|
||||||
|
file_get_key(file_result[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; file_result[i] != NULL; i++) {
|
for (i = 0; file_result[i] != NULL; i++) {
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ struct mfcmd commands[] = {
|
|||||||
{"get", "[quickkey]", "download a file", mfshell_cmd_get},
|
{"get", "[quickkey]", "download a file", mfshell_cmd_get},
|
||||||
{"rmdir", "[folderkey]", "remove directory", mfshell_cmd_rmdir},
|
{"rmdir", "[folderkey]", "remove directory", mfshell_cmd_rmdir},
|
||||||
{"status", "", "device status", mfshell_cmd_status},
|
{"status", "", "device status", mfshell_cmd_status},
|
||||||
{"changes", "<revision>", "device changes (default: 0)", mfshell_cmd_changes},
|
{"changes", "<revision>", "device changes (default: 0)",
|
||||||
|
mfshell_cmd_changes},
|
||||||
{NULL, NULL, NULL, NULL}
|
{NULL, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user