From a219b95c1775c4df2488731e0365bff2d1b7eb0e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 30 Oct 2016 10:55:27 -0700 Subject: [PATCH] Fix a bunch of warnings --- include/benchmark.h | 3 +++ include/shared.h | 4 ++-- include/terminal.h | 12 ++++++------ src/benchmark.c | 4 ++-- src/folder.c | 10 +++++----- src/hashcat.c | 5 ++--- src/hwmon.c | 2 +- src/main.c | 2 +- src/monitor.c | 10 +++++----- src/status.c | 2 -- src/terminal.c | 2 +- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/benchmark.h b/include/benchmark.h index ffa0de91b..fcd4e035d 100644 --- a/include/benchmark.h +++ b/include/benchmark.h @@ -6,4 +6,7 @@ #ifndef _BENCHMARK_H #define _BENCHMARK_H +extern const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_CNT; +extern const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_BUF[]; + #endif // _BENCHMARK_H diff --git a/include/shared.h b/include/shared.h index 1fa73fcf3..a5291e284 100644 --- a/include/shared.h +++ b/include/shared.h @@ -27,8 +27,8 @@ void naive_escape (char *s, size_t s_max, const char key_char, const char escape void hc_sleep_msec (const u32 msec); void hc_sleep (const u32 sec); -void setup_environment_variables (); -void setup_umask (); +void setup_environment_variables (void); +void setup_umask (void); void setup_seeding (const bool rp_gen_seed_chgd, const u32 rp_gen_seed); #endif // _SHARED_H diff --git a/include/terminal.h b/include/terminal.h index 2c23101ea..231fabf0a 100644 --- a/include/terminal.h +++ b/include/terminal.h @@ -26,10 +26,10 @@ void welcome_screen (hashcat_ctx_t *hashcat_ctx, const char *version_tag); void goodbye_screen (hashcat_ctx_t *hashcat_ctx, const time_t proc_start, const time_t proc_stop); -int setup_console (); +int setup_console (void); -void send_prompt (); -void clear_prompt (); +void send_prompt (void); +void clear_prompt (void); void *thread_keypress (void *p); @@ -37,9 +37,9 @@ void *thread_keypress (void *p); void SetConsoleWindowSize (const int x); #endif -int tty_break(); -int tty_getchar(); -int tty_fix(); +int tty_break(void); +int tty_getchar(void); +int tty_fix(void); void opencl_info (hashcat_ctx_t *hashcat_ctx); void opencl_info_compact (hashcat_ctx_t *hashcat_ctx); diff --git a/src/benchmark.c b/src/benchmark.c index 7ba0518bb..fa965bc7c 100644 --- a/src/benchmark.c +++ b/src/benchmark.c @@ -6,9 +6,9 @@ #include "common.h" #include "benchmark.h" -const int DEFAULT_BENCHMARK_ALGORITHMS_CNT = 146; +const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_CNT = 146; -const int DEFAULT_BENCHMARK_ALGORITHMS_BUF[] = +const unsigned int DEFAULT_BENCHMARK_ALGORITHMS_BUF[] = { 900, 0, diff --git a/src/folder.c b/src/folder.c index 4a235e1a1..6b7c19e1e 100644 --- a/src/folder.c +++ b/src/folder.c @@ -18,8 +18,6 @@ #include "event.h" #endif -static const char SLASH[] = "/"; - int sort_by_stringptr (const void *p1, const void *p2) { const char **s1 = (const char **) p1; @@ -76,7 +74,7 @@ static int get_exec_path (char *exec_path, const size_t exec_path_sz) return 0; } -void get_install_dir (char *install_dir, const char *exec_path) +static void get_install_dir (char *install_dir, const char *exec_path) { strncpy (install_dir, exec_path, HCBUFSIZ_TINY - 1); @@ -97,12 +95,12 @@ void get_install_dir (char *install_dir, const char *exec_path) } } -void get_profile_dir (char *profile_dir, const char *home_dir) +static void get_profile_dir (char *profile_dir, const char *home_dir) { snprintf (profile_dir, HCBUFSIZ_TINY - 1, "%s/%s", home_dir, DOT_HASHCAT); } -void get_session_dir (char *session_dir, const char *profile_dir) +static void get_session_dir (char *session_dir, const char *profile_dir) { snprintf (session_dir, HCBUFSIZ_TINY - 1, "%s/%s", profile_dir, SESSIONS_FOLDER); } @@ -250,6 +248,8 @@ int folder_config_init (hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const char *ins #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) + static const char SLASH[] = "/"; + if (install_folder == NULL) install_folder = SLASH; // makes library use easier char *resolved_install_folder = realpath (install_folder, NULL); diff --git a/src/hashcat.c b/src/hashcat.c index 6ccb9c1fc..258d5b855 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -23,6 +23,7 @@ #include "affinity.h" #include "autotune.h" +#include "benchmark.h" #include "bitmap.h" #include "combinator.h" #include "cpt.h" @@ -30,6 +31,7 @@ #include "dictstat.h" #include "dispatch.h" #include "event.h" +#include "hashcat.h" #include "hashes.h" #include "hwmon.h" #include "induct.h" @@ -52,9 +54,6 @@ #include "weak_hash.h" #include "wordlist.h" -extern const u32 DEFAULT_BENCHMARK_ALGORITHMS_CNT; -extern const u32 DEFAULT_BENCHMARK_ALGORITHMS_BUF[]; - // inner2_loop iterates through wordlists, then calls kernel execution static int inner2_loop (hashcat_ctx_t *hashcat_ctx) diff --git a/src/hwmon.c b/src/hwmon.c index b33a3ebd7..19c612230 100644 --- a/src/hwmon.c +++ b/src/hwmon.c @@ -2676,7 +2676,7 @@ int hm_set_fanspeed_with_device_id_xnvctrl (hashcat_ctx_t *hashcat_ctx, const u3 return -1; } -int hm_set_fanctrl_with_device_id_xnvctrl (hashcat_ctx_t *hashcat_ctx, const u32 device_id, const int val) +static int hm_set_fanctrl_with_device_id_xnvctrl (hashcat_ctx_t *hashcat_ctx, const u32 device_id, const int val) { hwmon_ctx_t *hwmon_ctx = hashcat_ctx->hwmon_ctx; diff --git a/src/main.c b/src/main.c index 7d3ea5d05..e969798a9 100644 --- a/src/main.c +++ b/src/main.c @@ -781,7 +781,7 @@ static void main_hashlist_sort_salt_post (MAYBE_UNUSED hashcat_ctx_t *hashcat_ct event_log_info_nn (hashcat_ctx, "Sorted salts..."); } -void event (const u32 id, hashcat_ctx_t *hashcat_ctx, const void *buf, const size_t len) +static void event (const u32 id, hashcat_ctx_t *hashcat_ctx, const void *buf, const size_t len) { switch (id) { diff --git a/src/monitor.c b/src/monitor.c index 79a1bbb90..f1ca0882c 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -33,11 +33,11 @@ int get_runtime_left (const hashcat_ctx_t *hashcat_ctx) time (&runtime_cur); - const int runtime_left = status_ctx->runtime_start - + status_ctx->prepare_time - + user_options->runtime - + (msec_paused / 1000) - - runtime_cur; + const int runtime_left = (int) (status_ctx->runtime_start + + status_ctx->prepare_time + + user_options->runtime + + (msec_paused / 1000) + - runtime_cur); return runtime_left; } diff --git a/src/status.c b/src/status.c index c04d7fc68..92cca2199 100644 --- a/src/status.c +++ b/src/status.c @@ -935,8 +935,6 @@ int status_get_progress_mode (const hashcat_ctx_t *hashcat_ctx) { return PROGRESS_MODE_KEYSPACE_UNKNOWN; } - - return PROGRESS_MODE_NONE; } double status_get_progress_finished_percent (const hashcat_ctx_t *hashcat_ctx) diff --git a/src/terminal.c b/src/terminal.c index 1f42967c3..3694f6e71 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -19,7 +19,7 @@ #include "terminal.h" #include "hashcat.h" -const char *PROMPT = "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => "; +static const char *PROMPT = "[s]tatus [p]ause [r]esume [b]ypass [c]heckpoint [q]uit => "; void welcome_screen (hashcat_ctx_t *hashcat_ctx, const char *version_tag) {