From 1de8b89807222b5673505fea2bec1af4c0af8c7d Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Fri, 22 Jul 2022 21:08:09 +0200 Subject: Correct function prototypes,add more Cflags for sanity,add sanity assets --- src/CMakeLists.txt | 3 +++ src/cli/main.c | 2 +- src/cli/updater.c | 4 ++++ src/fs.c | 1 + src/net.c | 4 ++-- src/net.h | 4 ++-- src/qt/mainwindow.cpp | 3 +++ src/qt/workers.cpp | 8 ++++++++ src/steam.c | 10 +++++----- src/steam.h | 10 +++++----- 10 files changed, 34 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ffc77c7..af7cbe3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,6 +6,9 @@ add_subdirectory(vdf) set(CFLAGS -Wall -Wextra -pedantic + -Wfloat-equal -Wundef + -Wstrict-overflow=5 -Wunreachable-code + -Wcast-qual -Wswitch-default -Wconversion -Wshadow -Wstrict-aliasing -Winit-self -Wcast-align -Wpointer-arith -Wmissing-declarations -Wmissing-include-dirs diff --git a/src/cli/main.c b/src/cli/main.c index 7971c7d..c27f6fc 100644 --- a/src/cli/main.c +++ b/src/cli/main.c @@ -5,7 +5,7 @@ #include "net.h" #include "commands.h" -static void help() +static void help(void) { fprintf(stderr, "OFCL \n"); \ diff --git a/src/cli/updater.c b/src/cli/updater.c index 68757c5..9dcd9da 100644 --- a/src/cli/updater.c +++ b/src/cli/updater.c @@ -143,6 +143,10 @@ void update_setup(char* of_dir, char* remote, int local_rev, int remote_rev) free(buf); } break; + + default: + assert(0); + break; } } diff --git a/src/fs.c b/src/fs.c index ee11a1b..a7f7888 100644 --- a/src/fs.c +++ b/src/fs.c @@ -122,6 +122,7 @@ char* normalizeUnixPath(char* path) return path; } + int makeDir(const char* path) { char pathcpy[PATH_MAX]; diff --git a/src/net.c b/src/net.c index cbf6568..03b3990 100644 --- a/src/net.c +++ b/src/net.c @@ -12,12 +12,12 @@ // official servers only whitelist some UAs #define USER_AGENT "murse/0.1 (" NAME "/" VERSION ")" -void net_init() +void net_init(void) { curl_global_init(CURL_GLOBAL_ALL); } -void net_deinit() +void net_deinit(void) { curl_global_cleanup(); } diff --git a/src/net.h b/src/net.h index fc6d34a..098a8d7 100644 --- a/src/net.h +++ b/src/net.h @@ -13,8 +13,8 @@ struct MemoryStruct { size_t size; }; -void net_init(); -void net_deinit(); +void net_init(void); +void net_deinit(void); struct MemoryStruct* downloadToRam(const char* URL); size_t downloadToFile(const char*, const char*); diff --git a/src/qt/mainwindow.cpp b/src/qt/mainwindow.cpp index 15e5526..5bf013d 100644 --- a/src/qt/mainwindow.cpp +++ b/src/qt/mainwindow.cpp @@ -159,6 +159,9 @@ void MainWindow::workerResult(const enum Worker::Results_t& result) QMessageBox::information(this, windowTitle(), "Steam is not running" ); break; + default: + assert(0); + break; } in_progress = false; diff --git a/src/qt/workers.cpp b/src/qt/workers.cpp index a66061d..5c20f0e 100644 --- a/src/qt/workers.cpp +++ b/src/qt/workers.cpp @@ -231,6 +231,10 @@ int Worker::update_setup(int local_rev, int remote_rev) free(buf); } break; + + default: + assert(0); + break; } } @@ -334,6 +338,10 @@ void Worker::doWork(const enum Worker::Tasks_t ¶meter) { free(argv); } break; + + default: + assert(0); + break; } emit resultReady(result); diff --git a/src/steam.c b/src/steam.c index 85c9511..f8a809b 100644 --- a/src/steam.c +++ b/src/steam.c @@ -17,7 +17,7 @@ * Returns a heap allocated path to the main steam directory * If a problem occurs returns NULL */ -char* getSteamDir() +char* getSteamDir(void) { #if defined(__linux__) || defined(__FreeBSD__) char* home = getenv("HOME"); @@ -83,7 +83,7 @@ char* getSteamDir() * Returns a heap allocated path to the sourcemod dirctory * If a problem occurs returns NULL */ -char* getSourcemodDir() +char* getSourcemodDir(void) { char* steam = getSteamDir(); if (!steam) @@ -96,7 +96,7 @@ char* getSourcemodDir() return steam; } -char* getOpenFortressDir() +char* getOpenFortressDir(void) { char* sm_dir = getSourcemodDir(); if (!sm_dir) @@ -109,7 +109,7 @@ char* getOpenFortressDir() return sm_dir; } -char* getSourceSDK2013MpDir() +char* getSourceSDK2013MpDir(void) { char* librayfolders = getSteamDir(); if (!librayfolders) @@ -171,7 +171,7 @@ char* getSourceSDK2013MpDir() * function to fetch the PID of a running Steam process. * If none were found returns -1 */ -long getSteamPID() +long getSteamPID(void) { #if defined(__linux__) || defined(__FreeBSD__) diff --git a/src/steam.h b/src/steam.h index c6f6887..beffa06 100644 --- a/src/steam.h +++ b/src/steam.h @@ -50,11 +50,11 @@ extern "C" { #else #endif -char* getSteamDir(); -char* getSourcemodDir(); -char* getOpenFortressDir(); -char* getSourceSDK2013MpDir(); -long getSteamPID(); +char* getSteamDir(void); +char* getSourcemodDir(void); +char* getOpenFortressDir(void); +char* getSourceSDK2013MpDir(void); +long getSteamPID(void); int runOpenFortress(char**, size_t); #ifdef __cplusplus -- cgit v1.2.3