diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-02-19 16:23:39 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-02-20 00:24:08 +0000 |
commit | 9423a13b2db427d15f6b3d11b73624fffc02608f (patch) | |
tree | a241140b23d189d8cb5466b72522dd6432a4ba96 | |
parent | ec6ec4994152f7d06d09544d61900f3ce1d55ced (diff) |
Just have init_progfile_dir() take a void pointer.
dladdr() takes a void * as a code pointer; have init_progfile_dir() do
so, and do the casting in the calls. We don't care about the signature
of the function whose address we're passing, we just want to pass a
pointer to *something* in the main program.
Change-Id: I9372620a97b0eb53c2bb3c0c41a238b4408f3709
Reviewed-on: https://code.wireshark.org/review/7270
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | capinfos.c | 2 | ||||
-rw-r--r-- | captype.c | 2 | ||||
-rw-r--r-- | dftest.c | 2 | ||||
-rw-r--r-- | echld/dispatcher.c | 2 | ||||
-rw-r--r-- | editcap.c | 2 | ||||
-rw-r--r-- | rawshark.c | 2 | ||||
-rw-r--r-- | tfshark.c | 2 | ||||
-rw-r--r-- | tshark.c | 2 | ||||
-rw-r--r-- | ui/gtk/main.c | 2 | ||||
-rw-r--r-- | wireshark-qt.cpp | 2 | ||||
-rw-r--r-- | wsutil/filesystem.c | 6 | ||||
-rw-r--r-- | wsutil/filesystem.h | 3 |
12 files changed, 14 insertions, 15 deletions
diff --git a/capinfos.c b/capinfos.c index 083a010a09..555dfff312 100644 --- a/capinfos.c +++ b/capinfos.c @@ -1164,7 +1164,7 @@ main(int argc, char *argv[]) init_open_routines(); #ifdef HAVE_PLUGINS - if ((init_progfile_dir_error = init_progfile_dir(argv[0], main))) { + if ((init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main))) { g_warning("capinfos: init_progfile_dir(): %s", init_progfile_dir_error); g_free(init_progfile_dir_error); } else { @@ -168,7 +168,7 @@ main(int argc, char *argv[]) init_open_routines(); #ifdef HAVE_PLUGINS - if ((init_progfile_dir_error = init_progfile_dir(argv[0], main))) { + if ((init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main))) { g_warning("captype: init_progfile_dir(): %s", init_progfile_dir_error); g_free(init_progfile_dir_error); } else { @@ -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], main); + init_progfile_dir_error = init_progfile_dir(argv[0], (void *)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 b18261b701..21f0957312 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, main); + error = init_progfile_dir(argv0, (void *)main); comp_info_str = get_compiled_version_info(NULL, epan_get_compiled_version_info); @@ -944,7 +944,7 @@ main(int argc, char *argv[]) #ifdef HAVE_PLUGINS /* Register wiretap plugins */ - if ((init_progfile_dir_error = init_progfile_dir(argv[0], main))) { + if ((init_progfile_dir_error = init_progfile_dir(argv[0], (void *)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 41fce66ecf..f75f9abb5b 100644 --- a/rawshark.c +++ b/rawshark.c @@ -495,7 +495,7 @@ main(int argc, char *argv[]) /* * Attempt to get the pathname of the executable file. */ - init_progfile_dir_error = init_progfile_dir(argv[0], main); + init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main); if (init_progfile_dir_error != NULL) { fprintf(stderr, "rawshark: Can't get pathname of rawshark program: %s.\n", init_progfile_dir_error); @@ -846,7 +846,7 @@ main(int argc, char *argv[]) /* * Attempt to get the pathname of the executable file. */ - init_progfile_dir_error = init_progfile_dir(argv[0], main); + init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main); if (init_progfile_dir_error != NULL) { fprintf(stderr, "tfshark: Can't get pathname of tfshark program: %s.\n", init_progfile_dir_error); @@ -1047,7 +1047,7 @@ main(int argc, char *argv[]) /* * Attempt to get the pathname of the executable file. */ - init_progfile_dir_error = init_progfile_dir(argv[0], main); + init_progfile_dir_error = init_progfile_dir(argv[0], (void *)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 e10150f03a..f404c9d8d3 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -2207,7 +2207,7 @@ main(int argc, char *argv[]) /* * Attempt to get the pathname of the executable file. */ - init_progfile_dir_error = init_progfile_dir(argv[0], main); + init_progfile_dir_error = init_progfile_dir(argv[0], (void *)main); /* initialize the funnel mini-api */ initialize_funnel_ops(); diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp index 30a1bce60f..e6ee76f54c 100644 --- a/wireshark-qt.cpp +++ b/wireshark-qt.cpp @@ -483,7 +483,7 @@ int main(int argc, char *argv[]) * Attempt to get the pathname of the executable file. */ /* init_progfile_dir_error = */ init_progfile_dir(argv[0], - (progfile_main_t) get_gui_compiled_info); + (void *) get_gui_compiled_info); g_log(NULL, G_LOG_LEVEL_DEBUG, "progfile_dir: %s", get_progfile_dir()); /* Get the compile-time version information string */ diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c index c34b95a02b..85bd7ebfd4 100644 --- a/wsutil/filesystem.c +++ b/wsutil/filesystem.c @@ -479,7 +479,7 @@ init_progfile_dir(const char *arg0 #ifdef _WIN32 _U_ #endif -, progfile_main_t main_addr +, void *function_addr #if defined(_WIN32) || !defined(HAVE_DLADDR) _U_ #endif @@ -575,7 +575,7 @@ init_progfile_dir(const char *arg0 execname = get_executable_path(); #ifdef HAVE_DLADDR - if (main_addr != NULL && execname == NULL) { + if (function_addr != NULL && execname == NULL) { /* * Try to use dladdr() to find the pathname of the executable. * dladdr() is not guaranteed to give you anything better than @@ -585,7 +585,7 @@ init_progfile_dir(const char *arg0 * path and obviate the need for us to determine the absolute * path. */ - if (dladdr((void *)main_addr, &info)) + if (dladdr(function_addr, &info)) execname = info.dli_fname; } #endif diff --git a/wsutil/filesystem.h b/wsutil/filesystem.h index b8b1d3f433..03d2877e65 100644 --- a/wsutil/filesystem.h +++ b/wsutil/filesystem.h @@ -40,8 +40,7 @@ extern "C" { * and save it for future use. Returns NULL on success, and a * g_mallocated string containing an error on failure. */ -typedef int (*progfile_main_t)(int, char **); -WS_DLL_PUBLIC char *init_progfile_dir(const char *arg0, progfile_main_t main_addr); +WS_DLL_PUBLIC char *init_progfile_dir(const char *arg0, void *function_addr); /* * Get the directory in which the program resides. |