Remove -Wwrite-strings compiler flag
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>
Sat, 21 Nov 2015 23:48:27 +0000 (23:48 +0000)
committerMichael Mann <mmann78@netscape.net>
Sat, 12 Dec 2015 16:21:19 +0000 (16:21 +0000)
The "-Wwrite-strings" flag produces nuisance warnings. These warnings are
not useful, they're impossible to fix in a sane way and therefore are being
handled with casts of static strings to (char *).

This just moves the warning to [-Wcast-qual] and a compiler pragma is
in turn required (and used) to squelch that warning.

Remove the Wwrite-strings warning. Let that responsibility fall on the
programmer (as is done by casting).

Change-Id: I5a44dfd9decd6d80797a521a3373593074962fb5
Reviewed-on: https://code.wireshark.org/review/12162
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
29 files changed:
CMakeLists.txt
capinfos.c
capture_opts.h
captype.c
configure.ac
dumpcap.c
editcap.c
epan/dissectors/packet-bluetooth.c
epan/dissectors/packet-dcerpc-spoolss.c
epan/dissectors/packet-diameter.c
epan/dissectors/packet-mq.h
epan/dissectors/packet-ncp2222.inc
epan/dissectors/packet-reload.c
epan/dissectors/packet-xml.c
mergecap.c
plugins/wimaxasncp/packet-wimaxasncp.c
randpkt.c
rawshark.c
reordercap.c
text2pcap.c
tfshark.c
tshark.c
ui/gtk/dissector_tables_dlg.c
ui/gtk/drag_and_drop.c
ui/gtk/gui_utils.c
ui/gtk/main.c
ui/tap-rlc-graph.c
wireshark-qt.cpp
wsutil/wsgetopt.c

index 1f3b00769851124933b6b402379b891192b68d97..8b53e7cfc899a12176d04604b2f2c4f738aeea85 100644 (file)
@@ -359,7 +359,6 @@ else()
                -Wignored-qualifiers
                -Wpragmas
                -Wno-overlength-strings
-               -Wwrite-strings
                -Wno-long-long
                -Wheader-guard
                -Wunused-const-variable
index 4742d2adb8b8de8173296bfc52c3031509b408f2..9180678d5c3818c47ae33e7d96faadd916b9d851 100644 (file)
@@ -1394,13 +1394,11 @@ 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'},
+      {"help", no_argument, NULL, 'h'},
+      {"version", no_argument, NULL, 'v'},
       {0, 0, 0, 0 }
   };
-DIAG_ON(cast-qual)
 
   int status = 0;
 #ifdef HAVE_PLUGINS
index 520a0e1e453265df13dac022cb50fefbe16951e1..eda550e7c938592623b6a516fddcabd58a0e54fe 100644 (file)
@@ -79,7 +79,7 @@ extern "C" {
 
 #ifdef CAN_SET_CAPTURE_BUFFER_SIZE
 #define LONGOPT_BUFFER_SIZE \
-    {(char *)"buffer-size", required_argument, NULL, 'B'},
+    {"buffer-size", required_argument, NULL, 'B'},
 #define OPTSTRING_B "B:"
 #else
 #define LONGOPT_BUFFER_SIZE
@@ -87,7 +87,7 @@ extern "C" {
 #endif
 
 #ifdef HAVE_PCAP_CREATE
-#define LONGOPT_MONITOR_MODE {(char *)"monitor-mode", no_argument, NULL, 'I'},
+#define LONGOPT_MONITOR_MODE {"monitor-mode", no_argument, NULL, 'I'},
 #define OPTSTRING_I "I"
 #else
 #define LONGOPT_MONITOR_MODE
@@ -95,20 +95,20 @@ extern "C" {
 #endif
 
 #define LONGOPT_CAPTURE_COMMON \
-    {(char *)"capture-comment",      required_argument, NULL, LONGOPT_NUM_CAP_COMMENT}, \
-    {(char *)"autostop",             required_argument, NULL, 'a'}, \
-    {(char *)"ring-buffer",          required_argument, NULL, 'b'}, \
+    {"capture-comment",      required_argument, NULL, LONGOPT_NUM_CAP_COMMENT}, \
+    {"autostop",             required_argument, NULL, 'a'}, \
+    {"ring-buffer",          required_argument, NULL, 'b'}, \
     LONGOPT_BUFFER_SIZE \
-    {(char *)"list-interfaces",      no_argument,       NULL, 'D'}, \
-    {(char *)"interface",            required_argument, NULL, 'i'}, \
+    {"list-interfaces",      no_argument,       NULL, 'D'}, \
+    {"interface",            required_argument, NULL, 'i'}, \
     LONGOPT_MONITOR_MODE \
-    {(char *)"list-data-link-types", no_argument,       NULL, 'L'}, \
-    {(char *)"no-promiscuous-mode",  no_argument,       NULL, 'p'}, \
-    {(char *)"snapshot-length",      required_argument, NULL, 's'}, \
-    {(char *)"linktype",             required_argument, NULL, 'y'}, \
-    {(char *)"disable-protocol", required_argument, NULL, LONGOPT_DISABLE_PROTOCOL }, \
-    {(char *)"enable-heuristic", required_argument, NULL, LONGOPT_ENABLE_HEURISTIC }, \
-    {(char *)"disable-heuristic", required_argument, NULL, LONGOPT_DISABLE_HEURISTIC },
+    {"list-data-link-types", no_argument,       NULL, 'L'}, \
+    {"no-promiscuous-mode",  no_argument,       NULL, 'p'}, \
+    {"snapshot-length",      required_argument, NULL, 's'}, \
+    {"linktype",             required_argument, NULL, 'y'}, \
+    {"disable-protocol", required_argument, NULL, LONGOPT_DISABLE_PROTOCOL }, \
+    {"enable-heuristic", required_argument, NULL, LONGOPT_ENABLE_HEURISTIC }, \
+    {"disable-heuristic", required_argument, NULL, LONGOPT_DISABLE_HEURISTIC },
 
 #define OPTSTRING_CAPTURE_COMMON \
     "a:" OPTSTRING_A "b:" OPTSTRING_B "c:Df:i:" OPTSTRING_I "Lps:y:"
index 49cb3e05c5dd26d7ab9c48bded9f8c9079fc0f1c..697ff8a4a42675ba64a86db908811282a834601c 100644 (file)
--- a/captype.c
+++ b/captype.c
@@ -122,13 +122,11 @@ 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'},
+      {"help", no_argument, NULL, 'h'},
+      {"version", no_argument, NULL, 'v'},
       {0, 0, 0, 0 }
   };
-DIAG_ON(cast-qual)
 
 #ifdef HAVE_PLUGINS
   char  *init_progfile_dir_error;
index 6330d9a074e0355776c58db95958f680642f7bf6..1427a6e79c93f3bbd563e536664f52c82b52169c 100644 (file)
@@ -964,7 +964,6 @@ AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wdiv-by-zero)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wignored-qualifiers)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wpragmas)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-overlength-strings)
-AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wwrite-strings)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wno-long-long)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wheader-guard)
 AC_WIRESHARK_COMPILER_FLAGS_CHECK(-Wunused-const-variable)
index c5e8679b7bf7dcf92bc4afbc733ec09dc465bb5f..0375d3fa271b741be26364f1f3e41fa8a1effee4 100644 (file)
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -4317,14 +4317,12 @@ 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'},
+        {"help", no_argument, NULL, 'h'},
+        {"version", no_argument, NULL, 'v'},
         LONGOPT_CAPTURE_COMMON
         {0, 0, 0, 0 }
     };
-DIAG_ON(cast-qual)
 
     gboolean          arg_error             = FALSE;
 
index 3775dbeac58061d5fe58775a525a1d7fd73b9dd6..c8977e0b1c43db2e1d4bf8c277b29a37b00a901b 100644 (file)
--- a/editcap.c
+++ b/editcap.c
@@ -920,13 +920,11 @@ main(int argc, char *argv[])
     int           i, j, read_err, write_err;
     gchar        *read_err_info, *write_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'},
+        {"help", no_argument, NULL, 'h'},
+        {"version", no_argument, NULL, 'V'},
         {0, 0, 0, 0 }
     };
-DIAG_ON(cast-qual)
 
     char         *p;
     guint32       snaplen            = 0; /* No limit               */
index 36dbff9ce0064d607769c498bb585ae310711b5d..3014ac9a09bff0291dca4ca7fa88685a85360220 100644 (file)
@@ -1958,8 +1958,8 @@ proto_reg_handoff_bluetooth(void)
 
     dissector_add_for_decode_as("usb.device", bluetooth_usb_handle);
 
-    wmem_tree_insert_string(bluetooth_uuids, "00000001-0000-1000-8000-0002EE000002", (gchar *) "SyncML Server", 0);
-    wmem_tree_insert_string(bluetooth_uuids, "00000002-0000-1000-8000-0002EE000002", (gchar *) "SyncML Client", 0);
+    wmem_tree_insert_string(bluetooth_uuids, "00000001-0000-1000-8000-0002EE000002", "SyncML Server", 0);
+    wmem_tree_insert_string(bluetooth_uuids, "00000002-0000-1000-8000-0002EE000002", "SyncML Client", 0);
 /* TODO: Add UUID128 verion of UUID16; UUID32? UUID16? */
 }
 
index 235791a615fecd33631ac1bbb20bdbe4d4248c35..8479845d6d00f65ef1260ebc8754e0222897bc7b 100644 (file)
@@ -6224,7 +6224,7 @@ SpoolssEnumPrinterKey_q(tvbuff_t *tvb, int offset,
                hf_printerdata_key, TRUE, &key_name);
 
        if (!key_name[0])
-               key_name = (char*)"\"\"";
+               key_name = "\"\"";
 
        col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", key_name);
 
index 3cdb016e51d747dbdb78928f744dff0c1ab40d60..5ed573b44c3c452f1bbdf78cb6f792c7b9ac3171 100644 (file)
@@ -387,7 +387,7 @@ diameterstat_init(struct register_srt* srt _U_, GArray* srt_array, srt_gui_init_
        idx = (int *)g_malloc(sizeof(int));
        *idx = 0;
        diameterstat_cmd_str_hash = g_hash_table_new(g_str_hash,g_str_equal);
-       g_hash_table_insert(diameterstat_cmd_str_hash, (gchar *)"Unknown", idx);
+       g_hash_table_insert(diameterstat_cmd_str_hash, "Unknown", idx);
 
        /** @todo the filter to use in stead of NULL is "diameter.cmd.code"
         * to enable the filter popup in the service response time dalouge
@@ -1882,7 +1882,7 @@ dictionary_load(void)
        all_cmds = g_array_new(TRUE,TRUE,sizeof(value_string));
 
        wmem_tree_insert32(dictionary.vnds,0,&no_vnd);
-       g_hash_table_insert(vendors,(gchar *)"None",&no_vnd);
+       g_hash_table_insert(vendors,"None",&no_vnd);
 
        /* initialize the types hash with the known basic types */
        for (type = basic_types; type->name; type++) {
index 2334b2810ab0846b9ddacda55cb21bb3722d5689..c693d31b9a94e50dc17828aca4f81be0f16a0492 100644 (file)
@@ -2495,14 +2495,14 @@ typedef struct _mq_parm_t
 /****************************************************************/
 
 /* Inquire on all properties -  "%" */
-#define MQ_MQPROP_INQUIRE_ALL     (MQPTR)(char*)"%",\
+#define MQ_MQPROP_INQUIRE_ALL     (MQPTR)"%",\
     0,\
     0,\
     1,\
     MQCCSI_APPL
 
 /* Inquire on all 'usr' properties - "usr.%" */
-#define MQ_MQPROP_INQUIRE_ALL_USR (MQPTR)(char*)"usr.%",\
+#define MQ_MQPROP_INQUIRE_ALL_USR (MQPTR)"usr.%",\
     0,\
     0,\
     5,\
index b99d48ecd81baad9972cab84cde61c67272e2124..e8f950e3481dcf782e233d68e041c13594fac643 100644 (file)
@@ -2898,7 +2898,7 @@ static void file_rights_expert_func(ptvcursor_t *ptvc, packet_info *pinfo, const
         if (request) {
             guint8 oaction = 0, path_count = 0;
             guint16 rights = 0;
-            gchar* filename = (gchar*)"";
+            gchar* filename = "";
 
             if (ncp_rec->func == 87) {
                 switch(ncp_rec->subfunc)
index 54e04148d531f40fced51b09dda12cb36cfb8c7c..aaeb387479105b85469e05d1d9f066bbf6164d64 100644 (file)
@@ -693,24 +693,24 @@ typedef struct _Kind {
 } kind_t;
 
 static kind_t predefined_kinds[] = {
-  {(gchar *)"INVALID"                        ,DATAKINDID_INVALID,                     -1},
-  {(gchar *)"SIP-REGISTRATION"               ,DATAKINDID_SIP_REGISTRATION,            DATAMODEL_DICTIONARY},
-  {(gchar *)"TURN-SERVICE"                   ,DATAKINDID_TURNSERVICE,                 DATAMODEL_SINGLE},
-  {(gchar *)"CERTIFICATE_BY_NODE"            ,DATAKINDID_CERTIFICATE_BY_NODE,         DATAMODEL_ARRAY},
-  {(gchar *)"RESERVED_ROUTING_TABLE_SIZE"    ,DATAKINDID_RESERVED_ROUTING_TABLE_SIZE, -1},
-  {(gchar *)"RESERVED_SOFTWARE_VERSION"      ,DATAKINDID_RESERVED_SOFTWARE_VERSION,   -1},
-  {(gchar *)"RESERVED_MACHINE_UPTIME"        ,DATAKINDID_RESERVED_MACHINE_UPTIME,     -1},
-  {(gchar *)"DATAKINDID_RESERVED_APP_UPTIME" ,DATAKINDID_RESERVED_APP_UPTIME,         -1},
-  {(gchar *)"RESERVED_MEMORY_FOOTPRINT"      ,DATAKINDID_RESERVED_MEMORY_FOOTPRINT,   -1},
-  {(gchar *)"RESERVED_DATASIZE_STORED"       ,DATAKINDID_RESERVED_DATASIZE_STORED,    -1},
-  {(gchar *)"RESERVED_INSTANCES_STORED"      ,DATAKINDID_RESERVED_INSTANCES_STORED,   -1},
-  {(gchar *)"RESERVED_MESSAGES_SENT_RCVD"    ,DATAKINDID_RESERVED_MESSAGES_SENT_RCVD, -1},
-  {(gchar *)"RESERVED_EWMA_BYTES_SENT"       ,DATAKINDID_RESERVED_EWMA_BYTES_SENT,    -1},
-  {(gchar *)"RESERVED_EWMA_BYTES_RCVD"       ,DATAKINDID_RESERVED_EWMA_BYTES_RCVD,    -1},
-  {(gchar *)"RESERVED_LAST_CONTACT"          ,DATAKINDID_RESERVED_LAST_CONTACT,       -1},
-  {(gchar *)"RESERVED_RTT"                   ,DATAKINDID_RESERVED_RTT,                -1},
-  {(gchar *)"CERTIFICATE_BY_USER"            ,DATAKINDID_CERTIFICATE_BY_USER,         DATAMODEL_ARRAY},
-  {(gchar *)"REDIR"                          ,DATAKINDID_REDIR,                       DATAMODEL_DICTIONARY},
+  {"INVALID"                        ,DATAKINDID_INVALID,                     -1},
+  {"SIP-REGISTRATION"               ,DATAKINDID_SIP_REGISTRATION,            DATAMODEL_DICTIONARY},
+  {"TURN-SERVICE"                   ,DATAKINDID_TURNSERVICE,                 DATAMODEL_SINGLE},
+  {"CERTIFICATE_BY_NODE"            ,DATAKINDID_CERTIFICATE_BY_NODE,         DATAMODEL_ARRAY},
+  {"RESERVED_ROUTING_TABLE_SIZE"    ,DATAKINDID_RESERVED_ROUTING_TABLE_SIZE, -1},
+  {"RESERVED_SOFTWARE_VERSION"      ,DATAKINDID_RESERVED_SOFTWARE_VERSION,   -1},
+  {"RESERVED_MACHINE_UPTIME"        ,DATAKINDID_RESERVED_MACHINE_UPTIME,     -1},
+  {"DATAKINDID_RESERVED_APP_UPTIME" ,DATAKINDID_RESERVED_APP_UPTIME,         -1},
+  {"RESERVED_MEMORY_FOOTPRINT"      ,DATAKINDID_RESERVED_MEMORY_FOOTPRINT,   -1},
+  {"RESERVED_DATASIZE_STORED"       ,DATAKINDID_RESERVED_DATASIZE_STORED,    -1},
+  {"RESERVED_INSTANCES_STORED"      ,DATAKINDID_RESERVED_INSTANCES_STORED,   -1},
+  {"RESERVED_MESSAGES_SENT_RCVD"    ,DATAKINDID_RESERVED_MESSAGES_SENT_RCVD, -1},
+  {"RESERVED_EWMA_BYTES_SENT"       ,DATAKINDID_RESERVED_EWMA_BYTES_SENT,    -1},
+  {"RESERVED_EWMA_BYTES_RCVD"       ,DATAKINDID_RESERVED_EWMA_BYTES_RCVD,    -1},
+  {"RESERVED_LAST_CONTACT"          ,DATAKINDID_RESERVED_LAST_CONTACT,       -1},
+  {"RESERVED_RTT"                   ,DATAKINDID_RESERVED_RTT,                -1},
+  {"CERTIFICATE_BY_USER"            ,DATAKINDID_CERTIFICATE_BY_USER,         DATAMODEL_ARRAY},
+  {"REDIR"                          ,DATAKINDID_REDIR,                       DATAMODEL_DICTIONARY},
 };
 
 
index 1f13abc1e282b17df4b2237721f2b8a96f43f3c7..398b6f2d1f70e78093dd2776fa2e322016af803e 100644 (file)
@@ -75,8 +75,8 @@ static tvbparse_wanted_t *want_heur;
 static GHashTable *xmpli_names;
 static GHashTable *media_types;
 
-static xml_ns_t xml_ns     = {(gchar *)"xml",     "/", -1, -1, -1, NULL, NULL, NULL};
-static xml_ns_t unknown_ns = {(gchar *)"unknown", "?", -1, -1, -1, NULL, NULL, NULL};
+static xml_ns_t xml_ns     = {"xml",     "/", -1, -1, -1, NULL, NULL, NULL};
+static xml_ns_t unknown_ns = {"unknown", "?", -1, -1, -1, NULL, NULL, NULL};
 static xml_ns_t *root_ns;
 
 static gboolean pref_heuristic_unicode    = FALSE;
index 287653621c9bfcc5ce792cbfa0bbc155e18636d4..ef167d05874cf2cc52d4d7b70206beb9f549e09d 100644 (file)
@@ -254,13 +254,11 @@ 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'},
+      {"help", no_argument, NULL, 'h'},
+      {"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;
index be4cd986b125910ef42c2897afefd86af8295e8d..bafb2fc0d725b87089f9b7eece38e0e627dbf96d 100644 (file)
@@ -133,7 +133,7 @@ wimaxasncp_build_dict_t wimaxasncp_build_dict;
 
 static wimaxasncp_dict_tlv_t wimaxasncp_tlv_not_found =
 {
-    0, (char *)"Unknown", NULL, WIMAXASNCP_TLV_UNKNOWN, 0,
+    0, "Unknown", NULL, WIMAXASNCP_TLV_UNKNOWN, 0,
     -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
     NULL, NULL, NULL
 };
index e6de985226ec453ed47c7f932c8f6a48a5a4f2bf..ec34a35471948b6638c59a661be21e90950ebba5 100644 (file)
--- a/randpkt.c
+++ b/randpkt.c
@@ -86,12 +86,10 @@ main(int argc, char **argv)
        guint8*                 type = NULL;
        int                     allrandom = FALSE;
        wtap_dumper             *savedump;
-DIAG_OFF(cast-qual)
        static const struct option long_options[] = {
-               {(char *)"help", no_argument, NULL, 'h'},
+               {"help", no_argument, NULL, 'h'},
                {0, 0, 0, 0 }
        };
-DIAG_ON(cast-qual)
 
 #ifdef _WIN32
        arg_list_utf_16to8(argc, argv);
index b3c26eb63246c2c0b692dd8f2b8dd4bbbdfc2bdf..b757124101dc15d3079629c776a546ef22b41e30 100644 (file)
@@ -429,13 +429,11 @@ 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'},
+      {"help", no_argument, NULL, 'h'},
+      {"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"
 
index 61c3d9c0c0461e77a2d2f9d895ce1abcaf978e5f..76bd66d68adae161163c43ccd1581f536dcd673c 100644 (file)
@@ -195,13 +195,11 @@ 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'},
+        {"help", no_argument, NULL, 'h'},
+        {"version", no_argument, NULL, 'v'},
         {0, 0, 0, 0 }
     };
-DIAG_ON(cast-qual)
     int file_count;
     char *infile;
     const char *outfile;
index ccc2a187b94fa4e29ee9413a7de4c15bff8776e6..3f002fd86c0c2db64987a72a830c66ef198df69c 100644 (file)
@@ -1531,13 +1531,11 @@ 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'},
+        {"help", no_argument, NULL, 'h'},
+        {"version", no_argument, NULL, 'v'},
         {0, 0, 0, 0 }
     };
-DIAG_ON(cast-qual)
 
 #ifdef _WIN32
     arg_list_utf_16to8(argc, argv);
index 310b4a6e30261636cbbe09214a8eb947fddc2f06..015184dec9e5a4342c34615607d0f50137298f9c 100644 (file)
--- a/tfshark.c
+++ b/tfshark.c
@@ -761,13 +761,11 @@ 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'},
+    {"help", no_argument, NULL, 'h'},
+    {"version", no_argument, NULL, 'v'},
     {0, 0, 0, 0 }
   };
-DIAG_ON(cast-qual)
   gboolean             arg_error = FALSE;
 
   char                *gpf_path, *pf_path;
index 4896c2ef8060feaf65c799e78bf79f433b43e095..67e64ae9f045ac026873b310a89d944c027d8404 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -955,14 +955,12 @@ 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'},
+    {"help", no_argument, NULL, 'h'},
+    {"version", no_argument, NULL, 'v'},
     LONGOPT_CAPTURE_COMMON
     {0, 0, 0, 0 }
   };
-DIAG_ON(cast-qual)
   gboolean             arg_error = FALSE;
 
 #ifdef _WIN32
index aff3936f9e48c7e4c6c8d75564fe465e9de7013f..d400a5d231251d1518840038a3fd7e9a1c172163 100644 (file)
@@ -156,7 +156,7 @@ decode_proto_add_to_list (const gchar *table_name _U_, ftenum_t selector_type,
             str = (gchar*)dissector_handle_get_dissector_name(handle);
             if (str == NULL)
             {
-                str = (gchar*)"<Unknown>";
+                str = "<Unknown>";
             }
             proto_add_to_list(tree_info, store, str, proto_name);
             break;
index e7ea594ac653e924db956e3824b512a8d982c20a..e1cae02d791c859492ff364054486bd7e11e690e 100644 (file)
@@ -316,7 +316,7 @@ dnd_init(GtkWidget *w)
     static GtkTargetEntry target_entry[] = {
          /*{"STRING", 0, DND_TARGET_STRING},*/
          /*{"text/plain", 0, DND_TARGET_STRING},*/
-         {(gchar *)"text/uri-list", 0, DND_TARGET_URL}
+         {"text/uri-list", 0, DND_TARGET_URL}
     };
 
     /* set this window as a dnd destination */
index d00d6095b6bb904d220260fd270a0511e00e0085..66127274b05e307dc5b97bc49241751eb5dee8da 100644 (file)
@@ -1093,7 +1093,7 @@ copy_binary_to_clipboard(const guint8 *data_p,
                          int           len)
 {
     static GtkTargetEntry target_entry[] = {
-        {(char *)"application/octet-stream", 0, 0}};
+        {"application/octet-stream", 0, 0}};
     /* XXX - this is not understood by most applications,
      * but can be pasted into the better hex editors - is
      * there something better that we can do?
index c3fe025305e286d8a171e2258c2a54f958cb7184..7a40b467dd1dda130bff7deb1084272f0119bf0b 100644 (file)
@@ -2231,17 +2231,15 @@ main(int argc, char *argv[])
     GSList              *disable_heur_slist = NULL;
 
 #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' },
-        {(char *)"read-filter", required_argument, NULL, 'R' },
-        {(char *)"display-filter", required_argument, NULL, 'Y' },
-        {(char *)"version", no_argument, NULL, 'v'},
+        {"help", no_argument, NULL, 'h'},
+        {"read-file", required_argument, NULL, 'r' },
+        {"read-filter", required_argument, NULL, 'R' },
+        {"display-filter", required_argument, NULL, 'Y' },
+        {"version", no_argument, NULL, 'v'},
         LONGOPT_CAPTURE_COMMON
         {0, 0, 0, 0 }
     };
-DIAG_ON(cast-qual)
     static const char optstring[] = OPTSTRING;
 
 #ifdef HAVE_GRESOURCE
index 64175b51dd3c2dba408180b3ac4a18e8f576726b..20b8a582ca53239872ec0be6592b34a26e7542c0 100644 (file)
@@ -156,7 +156,7 @@ rlc_lte_tap_info *select_rlc_lte_session(capture_file *cf,
         /* This "shouldn't happen", as the graph menu items won't
          * even be enabled if the selected packet isn't an RLC PDU.
          */
-        *err_msg = (char*)"Selected packet doesn't have an RLC PDU";
+        *err_msg = "Selected packet doesn't have an RLC PDU";
         *free_err_msg = FALSE;
         return NULL;
     }
@@ -164,7 +164,7 @@ rlc_lte_tap_info *select_rlc_lte_session(capture_file *cf,
      * to select which session he wants here */
     if (th.num_hdrs>1){
         /* Can only handle a single RLC channel yet */
-        *err_msg = (char*)"The selected packet has more than one LTE RLC channel in it.";
+        *err_msg = "The selected packet has more than one LTE RLC channel in it.";
         *free_err_msg = FALSE;
         return NULL;
     }
@@ -294,7 +294,7 @@ gboolean rlc_graph_segment_list_get(capture_file *cf, struct rlc_graph *g, gbool
     remove_tap_listener(g);
 
     if (g->last_segment == NULL) {
-        *err_string = (char*)"No packets found";
+        *err_string = "No packets found";
         *free_err_string = FALSE;
         return FALSE;
     }
index 4033b5d2015fca89d9a6f3e01f4ee461b8bbeed3..18605ff80df864a3c35f4ec702a8fa8dae9914d6 100644 (file)
@@ -616,17 +616,15 @@ int main(int argc, char *argv[])
      */
     // XXX Should the remaining code be in WiresharkApplcation::WiresharkApplication?
 #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' },
-        {(char *)"read-filter", required_argument, NULL, 'R' },
-        {(char *)"display-filter", required_argument, NULL, 'Y' },
-        {(char *)"version", no_argument, NULL, 'v'},
+        {"help", no_argument, NULL, 'h'},
+        {"read-file", required_argument, NULL, 'r' },
+        {"read-filter", required_argument, NULL, 'R' },
+        {"display-filter", required_argument, NULL, 'Y' },
+        {"version", no_argument, NULL, 'v'},
         LONGOPT_CAPTURE_COMMON
         {0, 0, 0, 0 }
     };
-DIAG_ON(cast-qual)
     static const char optstring[] = OPTSTRING;
 
     opterr = 0;
index eac72d5af4420d1eb6e47cbb36eb0a587f83a9bb..5302bc756392c27d6d23b892059b9009a96f17ab 100644 (file)
@@ -820,7 +820,7 @@ _getopt_internal_r (int argc, char *const *argv, const char *optstring,
                 }
 #endif
             }
-          d->__nextchar = (char *) "";
+          d->__nextchar = "";
           d->optind++;
           d->optopt = 0;
           return '?';