aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>2015-12-12 02:34:47 +0000
committerGuy Harris <guy@alum.mit.edu>2015-12-14 23:52:28 +0000
commitfbf2e3cf8fc07ef9f8b7cc4627fec82885560f98 (patch)
tree1eaf16ee020f4d5cd043497b5784eb4a8a0ab127
parentd835b271679c5e5eae7146b96ae1a65cbd5c16b4 (diff)
Make init_progfile_dir() take a function pointer [-Wpedantic]
Change-Id: I45f8ea5ee6ccc5a484c60ad6e686aaf30f6b0c98 Reviewed-on: https://code.wireshark.org/review/12557 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--capinfos.c2
-rw-r--r--captype.c2
-rw-r--r--dftest.c2
-rw-r--r--echld/dispatcher.c2
-rw-r--r--editcap.c2
-rw-r--r--rawshark.c2
-rw-r--r--tfshark.c2
-rw-r--r--tshark.c2
-rw-r--r--ui/gtk/main.c2
-rw-r--r--wireshark-qt.cpp2
-rw-r--r--wsutil/filesystem.c8
-rw-r--r--wsutil/filesystem.h2
12 files changed, 17 insertions, 13 deletions
diff --git a/capinfos.c b/capinfos.c
index 9180678..5e5c953 100644
--- a/capinfos.c
+++ b/capinfos.c
@@ -1440,7 +1440,7 @@ main(int argc, char *argv[])
init_open_routines();
#ifdef HAVE_PLUGINS
- if ((init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main))) {
+ if ((init_progfile_dir_error = init_progfile_dir(argv[0], main))) {
g_warning("capinfos: init_progfile_dir(): %s", init_progfile_dir_error);
g_free(init_progfile_dir_error);
} else {
diff --git a/captype.c b/captype.c
index 697ff8a..13b5673 100644
--- a/captype.c
+++ b/captype.c
@@ -161,7 +161,7 @@ main(int argc, char *argv[])
init_open_routines();
#ifdef HAVE_PLUGINS
- if ((init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main))) {
+ if ((init_progfile_dir_error = init_progfile_dir(argv[0], main))) {
g_warning("captype: init_progfile_dir(): %s", init_progfile_dir_error);
g_free(init_progfile_dir_error);
} else {
diff --git a/dftest.c b/dftest.c
index 9af46c1..9b4276e 100644
--- a/dftest.c
+++ b/dftest.c
@@ -70,7 +70,7 @@ main(int argc, char **argv)
/*
* Attempt to get the pathname of the executable file.
*/
- init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main);
+ init_progfile_dir_error = init_progfile_dir(argv[0], main);
if (init_progfile_dir_error != NULL) {
fprintf(stderr, "dftest: Can't get pathname of dftest program: %s.\n",
init_progfile_dir_error);
diff --git a/echld/dispatcher.c b/echld/dispatcher.c
index 53907d1..36642c1 100644
--- a/echld/dispatcher.c
+++ b/echld/dispatcher.c
@@ -474,7 +474,7 @@ static void preinit_epan(char* argv0, int (*main)(int, char **)) {
int dp_open_errno, dp_read_errno;
char* error;
- error = init_progfile_dir(argv0, (void *)main);
+ error = init_progfile_dir(argv0, main);
comp_info_str = get_compiled_version_info(NULL, epan_get_compiled_version_info);
diff --git a/editcap.c b/editcap.c
index c8977e0..fc38be2 100644
--- a/editcap.c
+++ b/editcap.c
@@ -985,7 +985,7 @@ main(int argc, char *argv[])
#ifdef HAVE_PLUGINS
/* Register wiretap plugins */
- if ((init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main))) {
+ if ((init_progfile_dir_error = init_progfile_dir(argv[0], main))) {
g_warning("editcap: init_progfile_dir(): %s", init_progfile_dir_error);
g_free(init_progfile_dir_error);
} else {
diff --git a/rawshark.c b/rawshark.c
index b757124..523313c 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -484,7 +484,7 @@ main(int argc, char *argv[])
/*
* Attempt to get the pathname of the executable file.
*/
- init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main);
+ init_progfile_dir_error = init_progfile_dir(argv[0], main);
if (init_progfile_dir_error != NULL) {
fprintf(stderr, "rawshark: Can't get pathname of rawshark program: %s.\n",
init_progfile_dir_error);
diff --git a/tfshark.c b/tfshark.c
index 015184d..fea110c 100644
--- a/tfshark.c
+++ b/tfshark.c
@@ -835,7 +835,7 @@ main(int argc, char *argv[])
/*
* Attempt to get the pathname of the executable file.
*/
- init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main);
+ init_progfile_dir_error = init_progfile_dir(argv[0], main);
if (init_progfile_dir_error != NULL) {
fprintf(stderr, "tfshark: Can't get pathname of tfshark program: %s.\n",
init_progfile_dir_error);
diff --git a/tshark.c b/tshark.c
index 67e64ae..10b9ecf 100644
--- a/tshark.c
+++ b/tshark.c
@@ -1059,7 +1059,7 @@ main(int argc, char *argv[])
/*
* Attempt to get the pathname of the executable file.
*/
- init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main);
+ init_progfile_dir_error = init_progfile_dir(argv[0], main);
if (init_progfile_dir_error != NULL) {
fprintf(stderr, "tshark: Can't get pathname of tshark program: %s.\n",
init_progfile_dir_error);
diff --git a/ui/gtk/main.c b/ui/gtk/main.c
index 7a40b46..add9afb 100644
--- a/ui/gtk/main.c
+++ b/ui/gtk/main.c
@@ -2266,7 +2266,7 @@ main(int argc, char *argv[])
/*
* Attempt to get the pathname of the executable file.
*/
- init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main);
+ init_progfile_dir_error = init_progfile_dir(argv[0], main);
/* initialize the funnel mini-api */
initialize_funnel_ops();
diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp
index 16cde1c..dc6db3c 100644
--- a/wireshark-qt.cpp
+++ b/wireshark-qt.cpp
@@ -518,7 +518,7 @@ int main(int argc, char *argv[])
* Attempt to get the pathname of the executable file.
*/
/* init_progfile_dir_error = */ init_progfile_dir(ws_argv[0],
- (void *) get_gui_compiled_info);
+ (int (*)(int, char **)) get_gui_compiled_info);
g_log(NULL, G_LOG_LEVEL_DEBUG, "progfile_dir: %s", get_progfile_dir());
#ifdef _WIN32
diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c
index 787ad6e..e8bdea3 100644
--- a/wsutil/filesystem.c
+++ b/wsutil/filesystem.c
@@ -62,6 +62,7 @@
#include <wsutil/report_err.h>
#include <wsutil/privileges.h>
#include <wsutil/file_util.h>
+#include <wsutil/ws_diag_control.h>
#include <wiretap/wtap.h> /* for WTAP_ERR_SHORT_WRITE */
@@ -454,7 +455,7 @@ init_progfile_dir(const char *arg0
#ifdef _WIN32
_U_
#endif
-, void *function_addr
+, int (*function_addr)(int, char **)
#if defined(_WIN32) || !defined(HAVE_DLADDR)
_U_
#endif
@@ -560,8 +561,11 @@ init_progfile_dir(const char *arg0
* path and obviate the need for us to determine the absolute
* path.
*/
- if (dladdr(function_addr, &info))
+DIAG_OFF(pedantic)
+ if (dladdr((void *)function_addr, &info)) {
+DIAG_ON(pedantic)
execname = info.dli_fname;
+ }
}
#endif
if (execname == NULL) {
diff --git a/wsutil/filesystem.h b/wsutil/filesystem.h
index 03d2877..137f0da 100644
--- a/wsutil/filesystem.h
+++ b/wsutil/filesystem.h
@@ -40,7 +40,7 @@ extern "C" {
* and save it for future use. Returns NULL on success, and a
* g_mallocated string containing an error on failure.
*/
-WS_DLL_PUBLIC char *init_progfile_dir(const char *arg0, void *function_addr);
+WS_DLL_PUBLIC char *init_progfile_dir(const char *arg0, int (*function_addr)(int, char **));
/*
* Get the directory in which the program resides.