mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
build with std=c99
This commit is contained in:
@@ -6,22 +6,21 @@ project(mediafire-tools)
|
||||
# to feed iwyu during tests
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra -Werror")
|
||||
# the following is until we learn how to reorder the gcc arguments to correctly link on Ubuntu
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-as-needed")
|
||||
|
||||
add_library(mfapi SHARED mfapi/mfconn.c mfapi/file.c mfapi/folder.c mfapi/apicalls/file_get_info.c mfapi/apicalls/user_get_info.c mfapi/apicalls/file_get_links.c mfapi/apicalls/user_session.c mfapi/apicalls/folder_get_info.c mfapi/apicalls/folder_create.c mfapi/apicalls/folder_get_content.c mfapi/apicalls/folder_delete.c mfapi/apicalls/device_get_status.c mfapi/apicalls/device_get_changes.c)
|
||||
set_target_properties(mfapi PROPERTIES COMPILE_FLAGS "-Wall -Wextra -Werror")
|
||||
|
||||
add_library(mfutils SHARED utils/http.c utils/json.c utils/strings.c utils/stringv.c)
|
||||
set_target_properties(mfutils PROPERTIES COMPILE_FLAGS "-Wall -Wextra -Werror")
|
||||
|
||||
add_executable(mediafire-shell mfshell/main.c mfshell/mfshell.c mfshell/commands/folder.c mfshell/commands/auth.c mfshell/commands/chdir.c mfshell/commands/debug.c mfshell/commands/file.c mfshell/commands/get.c mfshell/commands/help.c mfshell/commands/host.c mfshell/commands/lcd.c mfshell/commands/links.c mfshell/commands/list.c mfshell/commands/lpwd.c mfshell/commands/mkdir.c mfshell/commands/pwd.c mfshell/commands/whoami.c mfshell/commands/rmdir.c mfshell/commands/status.c mfshell/commands/changes.c mfshell/config.c mfshell/options.c)
|
||||
set_target_properties(mediafire-shell PROPERTIES COMPILE_FLAGS "-Wall -Wextra -Werror")
|
||||
set_target_properties(mediafire-shell PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
|
||||
target_link_libraries(mediafire-shell curl ssl crypto jansson mfapi mfutils)
|
||||
|
||||
enable_testing()
|
||||
|
||||
add_executable(mediafire-fuse fuse/main.c fuse/hashtbl.c)
|
||||
set_target_properties(mediafire-fuse PROPERTIES COMPILE_FLAGS "-Wall -Wextra -Werror -D_FILE_OFFSET_BITS=64")
|
||||
set_target_properties(mediafire-fuse PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
|
||||
set_target_properties(mediafire-fuse PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
|
||||
target_link_libraries(mediafire-fuse curl ssl fuse jansson mfapi mfutils)
|
||||
|
||||
add_test(iwyu ${CMAKE_SOURCE_DIR}/tests/iwyu.py ${CMAKE_BINARY_DIR})
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L // for strdup and struct timespec (in fuse.h)
|
||||
// and S_IFDIR and S_IFREG
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -60,7 +63,12 @@ static unsigned char base36_decoding_table[] = {
|
||||
|
||||
/*
|
||||
* a macro to convert a char* of the key into a hash of its first three
|
||||
* characters
|
||||
* characters, treating those first three characters as if they represented a
|
||||
* number in base36
|
||||
*
|
||||
* in the future this could be made more dynamic by using the ability of
|
||||
* strtoll to convert numbers of base36 and then only retrieving the desired
|
||||
* amount of high-bits for the desired size of the hashtable
|
||||
*/
|
||||
#define HASH_OF_KEY(key) base36_decoding_table[(int)(key)[0]]*36*36+\
|
||||
base36_decoding_table[(int)(key)[1]]*36+\
|
||||
@@ -518,7 +526,7 @@ static struct h_entry *folder_tree_lookup_path(folder_tree * tree,
|
||||
result = curr_dir;
|
||||
break;
|
||||
}
|
||||
slash_pos = index(tmp_path, '/');
|
||||
slash_pos = strchr(tmp_path, '/');
|
||||
if (slash_pos == NULL) {
|
||||
// no slash found in the remaining path:
|
||||
// find entry in current directory and return it
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L // for strdup and struct timespec
|
||||
|
||||
#define FUSE_USE_VERSION 30
|
||||
|
||||
#include <fuse/fuse.h>
|
||||
@@ -199,7 +201,7 @@ static int mediafirefs_mkdir(const char *path, mode_t mode)
|
||||
|
||||
/* split into dirname and basename */
|
||||
|
||||
basename = rindex(dirname, '/');
|
||||
basename = strrchr(dirname, '/');
|
||||
if (basename == NULL) {
|
||||
fprintf(stderr, "cannot find slash\n");
|
||||
return -ENOENT;
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L // for strdup
|
||||
|
||||
#include <jansson.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L // for strdup
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L // for strdup
|
||||
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L // for getline
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L // for gmtime_r
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L // for PATH_MAX
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L // for strdup and getline
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L // for strdup
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L // for PATH_MAX
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L // for getline
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <pwd.h>
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L // for strdup
|
||||
|
||||
#include <openssl/ssl.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L // for strdup and getline
|
||||
#define _BSD_SOURCE // for strsep
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L // for strdup
|
||||
|
||||
#include <stdio.h>
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define _POSIX_C_SOURCE 200809L // for strdup
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
Reference in New Issue
Block a user