diff options
author | Guy Harris <guy@alum.mit.edu> | 2016-03-26 19:05:20 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2016-03-27 02:06:28 +0000 |
commit | f0ada20a91b2f8aeb785dfd121060af0442dd307 (patch) | |
tree | 39d7e386b3c00d1e2b4372811c7c53d956a3fb05 | |
parent | 445a57bdc35f5f09ef878b6bf5a46d7018ddddcc (diff) |
Make failure_alert_box() be printf-like.
Have it be printf-like, and have vfailure_alert_box() be vprintf-like.
Rename a few variables to make it clearer what pointers point to
vprintf-like functions.
Change-Id: I960e2138a18edcc742c450d68a0c6f7248f50c3f
Reviewed-on: https://code.wireshark.org/review/14646
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | ui/alert_box.c | 12 | ||||
-rw-r--r-- | ui/alert_box.h | 3 | ||||
-rw-r--r-- | ui/gtk/main.c | 2 | ||||
-rw-r--r-- | wireshark-qt.cpp | 2 | ||||
-rw-r--r-- | wsutil/report_err.c | 8 | ||||
-rw-r--r-- | wsutil/report_err.h | 2 |
6 files changed, 20 insertions, 9 deletions
diff --git a/ui/alert_box.c b/ui/alert_box.c index aac268558d..c367fb43c7 100644 --- a/ui/alert_box.c +++ b/ui/alert_box.c @@ -37,7 +37,17 @@ * Alert box for general errors. */ void -failure_alert_box(const char *msg_format, va_list ap) +failure_alert_box(const char *msg_format, ...) +{ + va_list ap; + + va_start(ap, msg_format); + vsimple_error_message_box(msg_format, ap); + va_end(ap); +} + +void +vfailure_alert_box(const char *msg_format, va_list ap) { vsimple_error_message_box(msg_format, ap); } diff --git a/ui/alert_box.h b/ui/alert_box.h index 69f11faa51..1028027eb1 100644 --- a/ui/alert_box.h +++ b/ui/alert_box.h @@ -31,7 +31,8 @@ extern "C" { /* * Alert box for general errors. */ -extern void failure_alert_box(const char *msg_format, va_list ap); +extern void failure_alert_box(const char *msg_format, ...) G_GNUC_PRINTF(1, 2); +extern void vfailure_alert_box(const char *msg_format, va_list ap); /* * Alert box for a failed attempt to open or create a file. diff --git a/ui/gtk/main.c b/ui/gtk/main.c index b2e096d483..1a4e53383d 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -2528,7 +2528,7 @@ main(int argc, char *argv[]) capture_session_init(&global_capture_session, &cfile); #endif - init_report_err(failure_alert_box, open_failure_alert_box, + init_report_err(vfailure_alert_box, open_failure_alert_box, read_failure_alert_box, write_failure_alert_box); /* Non-blank filter means we're remote. Throttle splash screen and resolution updates. */ diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp index 54b7f556bf..ec2d74b4f2 100644 --- a/wireshark-qt.cpp +++ b/wireshark-qt.cpp @@ -793,7 +793,7 @@ int main(int argc, char *argv[]) capture_opts_init(&global_capture_opts); #endif - init_report_err(failure_alert_box, open_failure_alert_box, + init_report_err(vfailure_alert_box, open_failure_alert_box, read_failure_alert_box, write_failure_alert_box); init_open_routines(); diff --git a/wsutil/report_err.c b/wsutil/report_err.c index 6b9fd13ae7..557b200c90 100644 --- a/wsutil/report_err.c +++ b/wsutil/report_err.c @@ -32,17 +32,17 @@ #include <glib.h> #include "report_err.h" -static void (*report_failure_func)(const char *, va_list); +static void (*vreport_failure_func)(const char *, va_list); static void (*report_open_failure_func)(const char *, int, gboolean); static void (*report_read_failure_func)(const char *, int); static void (*report_write_failure_func)(const char *, int); -void init_report_err(void (*report_failure_fcn_p)(const char *, va_list), +void init_report_err(void (*vreport_failure_fcn_p)(const char *, va_list), void (*report_open_failure_fcn_p)(const char *, int, gboolean), void (*report_read_failure_fcn_p)(const char *, int), void (*report_write_failure_fcn_p)(const char *, int)) { - report_failure_func = report_failure_fcn_p; + vreport_failure_func = vreport_failure_fcn_p; report_open_failure_func = report_open_failure_fcn_p; report_read_failure_func = report_read_failure_fcn_p; report_write_failure_func = report_write_failure_fcn_p; @@ -57,7 +57,7 @@ report_failure(const char *msg_format, ...) va_list ap; va_start(ap, msg_format); - (*report_failure_func)(msg_format, ap); + (*vreport_failure_func)(msg_format, ap); va_end(ap); } diff --git a/wsutil/report_err.h b/wsutil/report_err.h index ef781ca3ba..fcef2e2e4b 100644 --- a/wsutil/report_err.h +++ b/wsutil/report_err.h @@ -41,7 +41,7 @@ extern "C" { * Initialize the report err routines */ WS_DLL_PUBLIC void init_report_err( - void (*report_failure)(const char *, va_list), + void (*vreport_failure)(const char *, va_list), void (*report_open_failure)(const char *, int, gboolean), void (*report_read_failure)(const char *, int), void (*report_write_failure)(const char *, int)); |