diff --git a/capinfos.c b/capinfos.c index 555dfff312..31a6fb32ff 100644 --- a/capinfos.c +++ b/capinfos.c @@ -81,9 +81,10 @@ #include /* to get the libz version number */ #endif -#include -#include #include +#include +#include +#include #include #ifdef HAVE_PLUGINS @@ -1118,11 +1119,13 @@ main(int argc, char *argv[]) gchar *err_info; int opt; int overall_error_status; +DIAG_OFF(cast-qual) static const struct option long_options[] = { {(char *)"help", no_argument, NULL, 'h'}, {(char *)"version", no_argument, NULL, 'v'}, {0, 0, 0, 0 } }; +DIAG_ON(cast-qual) int status = 0; #ifdef HAVE_PLUGINS diff --git a/captype.c b/captype.c index 1dc853b445..2488ddda69 100644 --- a/captype.c +++ b/captype.c @@ -50,10 +50,11 @@ #include -#include -#include -#include #include +#include +#include +#include +#include #include #ifdef HAVE_PLUGINS @@ -129,11 +130,13 @@ main(int argc, char *argv[]) int i; int opt; int overall_error_status; +DIAG_OFF(cast-qual) static const struct option long_options[] = { {(char *)"help", no_argument, NULL, 'h'}, {(char *)"version", no_argument, NULL, 'v'}, {0, 0, 0, 0 } }; +DIAG_ON(cast-qual) #ifdef HAVE_PLUGINS char *init_progfile_dir_error; diff --git a/dumpcap.c b/dumpcap.c index 7664a777b9..016a6760bd 100644 --- a/dumpcap.c +++ b/dumpcap.c @@ -72,6 +72,7 @@ #include #include +#include #include #ifndef HAVE_GETOPT_LONG @@ -888,8 +889,10 @@ compile_capture_filter(const char *iface, pcap_t *pcap_h, * third argument to pcap_compile() as a const pointer. Cast * away the warning. */ +DIAG_OFF(cast-qual) if (pcap_compile(pcap_h, fcode, (char *)cfilter, 1, netmask) < 0) return FALSE; +DIAG_ON(cast-qual) return TRUE; } @@ -4225,12 +4228,14 @@ main(int argc, char *argv[]) GString *comp_info_str; GString *runtime_info_str; int opt; +DIAG_OFF(cast-qual) static const struct option long_options[] = { {(char *)"help", no_argument, NULL, 'h'}, {(char *)"version", no_argument, NULL, 'v'}, LONGOPT_CAPTURE_COMMON {0, 0, 0, 0 } }; +DIAG_ON(cast-qual) gboolean arg_error = FALSE; diff --git a/editcap.c b/editcap.c index bd7a71abe3..5fc83072bd 100644 --- a/editcap.c +++ b/editcap.c @@ -81,13 +81,14 @@ # include "wsutil/strptime.h" #endif -#include +#include #include -#include -#include #include #include -#include +#include +#include +#include +#include #include #include "ringbuffer.h" /* For RINGBUFFER_MAX_NUM_FILES */ @@ -881,11 +882,13 @@ main(int argc, char *argv[]) int i, j, err; gchar *err_info; int opt; +DIAG_OFF(cast-qual) static const struct option long_options[] = { {(char *)"help", no_argument, NULL, 'h'}, {(char *)"version", no_argument, NULL, 'V'}, {0, 0, 0, 0 } }; +DIAG_ON(cast-qual) char *p; guint32 snaplen = 0; /* No limit */ @@ -1074,7 +1077,7 @@ main(int argc, char *argv[]) break; case 'E': - err_prob = strtod(optarg, &p); + err_prob = g_ascii_strtod(optarg, &p); if (p == optarg || err_prob < 0.0 || err_prob > 1.0) { fprintf(stderr, "editcap: probability \"%s\" must be between 0.0 and 1.0\n", optarg); diff --git a/mergecap.c b/mergecap.c index 3f345be9d4..5446fc6584 100644 --- a/mergecap.c +++ b/mergecap.c @@ -54,10 +54,11 @@ #endif #include -#include -#include #include #include +#include +#include +#include #include #include @@ -215,11 +216,13 @@ main(int argc, char *argv[]) GString *comp_info_str; GString *runtime_info_str; int opt; +DIAG_OFF(cast-qual) static const struct option long_options[] = { {(char *)"help", no_argument, NULL, 'h'}, {(char *)"version", no_argument, NULL, 'V'}, {0, 0, 0, 0 } }; +DIAG_ON(cast-qual) gboolean do_append = FALSE; gboolean verbose = FALSE; int in_file_count = 0; diff --git a/randpkt.c b/randpkt.c index 9ddfd78e28..bf391be2bb 100644 --- a/randpkt.c +++ b/randpkt.c @@ -48,6 +48,7 @@ #include #include "wiretap/wtap.h" #include "wsutil/file_util.h" +#include #ifdef _WIN32 #include @@ -512,10 +513,12 @@ main(int argc, char **argv) char *produce_filename = NULL; int produce_max_bytes = 5000; pkt_example *example; +DIAG_OFF(cast-qual) static const struct option long_options[] = { {(char *)"help", no_argument, NULL, 'h'}, {0, 0, 0, 0 } }; +DIAG_ON(cast-qual) #ifdef _WIN32 arg_list_utf_16to8(argc, argv); diff --git a/rawshark.c b/rawshark.c index f75f9abb5b..6c901fcb57 100644 --- a/rawshark.c +++ b/rawshark.c @@ -68,11 +68,12 @@ #include #include -#include -#include #include +#include #include +#include #include +#include #include "globals.h" #include @@ -440,11 +441,13 @@ main(int argc, char *argv[]) GPtrArray *disp_fields = g_ptr_array_new(); guint fc; gboolean skip_pcap_header = FALSE; +DIAG_OFF(cast-qual) static const struct option long_options[] = { {(char *)"help", no_argument, NULL, 'h'}, {(char *)"version", no_argument, NULL, 'v'}, {0, 0, 0, 0 } }; +DIAG_ON(cast-qual) #define OPTSTRING_INIT "d:F:hlnN:o:pr:R:sS:t:v" diff --git a/reordercap.c b/reordercap.c index 1dcac3d4a6..4c64033926 100644 --- a/reordercap.c +++ b/reordercap.c @@ -46,8 +46,9 @@ #include "wsutil/wsgetopt.h" #endif -#include #include +#include +#include #include /* Show command-line usage */ @@ -197,11 +198,13 @@ main(int argc, char *argv[]) FrameRecord_t *prevFrame = NULL; int opt; +DIAG_OFF(cast-qual) static const struct option long_options[] = { {(char *)"help", no_argument, NULL, 'h'}, {(char *)"version", no_argument, NULL, 'v'}, {0, 0, 0, 0 } }; +DIAG_ON(cast-qual) int file_count; char *infile; char *outfile; diff --git a/text2pcap.c b/text2pcap.c index 3f22c0c397..bd41e2acff 100644 --- a/text2pcap.c +++ b/text2pcap.c @@ -112,6 +112,7 @@ #include #include #include +#include #include #include @@ -1534,11 +1535,13 @@ parse_options (int argc, char *argv[]) GString *runtime_info_str; int c; char *p; +DIAG_OFF(cast-qual) static const struct option long_options[] = { {(char *)"help", no_argument, NULL, 'h'}, {(char *)"version", no_argument, NULL, 'v'}, {0, 0, 0, 0 } }; +DIAG_ON(cast-qual) #ifdef _WIN32 arg_list_utf_16to8(argc, argv); diff --git a/tfshark.c b/tfshark.c index d87f6e3aba..ddf9e6695a 100644 --- a/tfshark.c +++ b/tfshark.c @@ -64,10 +64,11 @@ #include #include #include -#include -#include #include +#include +#include #include +#include #include #include "globals.h" @@ -772,11 +773,13 @@ main(int argc, char *argv[]) GString *runtime_info_str; char *init_progfile_dir_error; int opt; +DIAG_OFF(cast-qual) static const struct option long_options[] = { {(char *)"help", no_argument, NULL, 'h'}, {(char *)"version", no_argument, NULL, 'v'}, {0, 0, 0, 0 } }; +DIAG_ON(cast-qual) gboolean arg_error = FALSE; char *gpf_path, *pf_path; diff --git a/tshark.c b/tshark.c index ffbb30343f..ff3235cffb 100644 --- a/tshark.c +++ b/tshark.c @@ -73,10 +73,11 @@ #include #include #include -#include -#include #include +#include +#include #include +#include #include #include "globals.h" @@ -948,12 +949,14 @@ main(int argc, char *argv[]) GString *runtime_info_str; char *init_progfile_dir_error; int opt; +DIAG_OFF(cast-qual) static const struct option long_options[] = { {(char *)"help", no_argument, NULL, 'h'}, {(char *)"version", no_argument, NULL, 'v'}, LONGOPT_CAPTURE_COMMON {0, 0, 0, 0 } }; +DIAG_ON(cast-qual) gboolean arg_error = FALSE; #ifdef _WIN32 diff --git a/ui/gtk/main.c b/ui/gtk/main.c index f404c9d8d3..bfdee9669a 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -57,13 +57,14 @@ #endif /* HAVE_LIBPORTAUDIO */ #include +#include #include #include #include #include #include #include -#include +#include #include #include @@ -2176,6 +2177,7 @@ main(int argc, char *argv[]) #endif #define OPTSTRING OPTSTRING_CAPTURE_COMMON "C:g:Hh" "jJ:kK:lm:nN:o:P:r:R:St:u:vw:X:Y:z:" +DIAG_OFF(cast-qual) static const struct option long_options[] = { {(char *)"help", no_argument, NULL, 'h'}, {(char *)"read-file", required_argument, NULL, 'r' }, @@ -2185,6 +2187,7 @@ main(int argc, char *argv[]) LONGOPT_CAPTURE_COMMON {0, 0, 0, 0 } }; +DIAG_ON(cast-qual) static const char optstring[] = OPTSTRING; cmdarg_err_init(wireshark_cmdarg_err, wireshark_cmdarg_err_cont);