diff --git a/Makefile.am b/Makefile.am index 617a377296..cdac8e7dd3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -861,11 +861,9 @@ EXTRA_DIST = \ $(tpncp_DATA) \ $(ui_DATA) \ $(wimaxasncp_DATA) \ - randpkt.c \ reordercap.c \ smi_modules \ text2pcap-scanner.l \ - text2pcap.c \ text2pcap.h \ services \ wireshark.desktop \ diff --git a/airpcap_loader.c b/airpcap_loader.c index 76566f6c51..3b745823c2 100644 --- a/airpcap_loader.c +++ b/airpcap_loader.c @@ -350,7 +350,7 @@ write_wlan_wep_keys_to_registry(airpcap_if_info_t* info_if, GList* key_list) /* * Calculate the size of the keys collection */ - KeysCollectionSize = sizeof(AirpcapKeysCollection) + keys_in_list * sizeof(AirpcapKey); + KeysCollectionSize = (guint)(sizeof(AirpcapKeysCollection) + keys_in_list * sizeof(AirpcapKey)); /* * Allocate the collection @@ -449,7 +449,7 @@ write_wlan_driver_wep_keys_to_registry(GList* key_list) /* * Calculate the size of the keys collection */ - KeysCollectionSize = sizeof(AirpcapKeysCollection) + keys_in_list * sizeof(AirpcapKey); + KeysCollectionSize = (guint)(sizeof(AirpcapKeysCollection) + keys_in_list * sizeof(AirpcapKey)); /* * Allocate the collection @@ -568,7 +568,7 @@ save_wlan_driver_wep_keys(void) /* Number of keys in key list */ if (fake_info_if->keysCollectionSize != 0) - keys_in_list = (guint)(fake_info_if->keysCollectionSize - sizeof(AirpcapKeysCollection))/sizeof(AirpcapKey); + keys_in_list = (guint)((fake_info_if->keysCollectionSize - sizeof(AirpcapKeysCollection))/sizeof(AirpcapKey)); else keys_in_list = 0; @@ -1775,7 +1775,7 @@ get_airpcap_device_keys(airpcap_if_info_t* info_if) /* Number of keys in key list */ if (info_if->keysCollectionSize != 0) - keys_in_list = (guint)(info_if->keysCollectionSize - sizeof(AirpcapKeysCollection))/sizeof(AirpcapKey); + keys_in_list = (guint)((info_if->keysCollectionSize - sizeof(AirpcapKeysCollection))/sizeof(AirpcapKey)); else keys_in_list = 0; @@ -1847,7 +1847,7 @@ get_airpcap_driver_keys(void) /* Number of keys in key list */ if (fake_info_if->keysCollectionSize != 0) - keys_in_list = (guint)(fake_info_if->keysCollectionSize - sizeof(AirpcapKeysCollection))/sizeof(AirpcapKey); + keys_in_list = (guint)((fake_info_if->keysCollectionSize - sizeof(AirpcapKeysCollection))/sizeof(AirpcapKey)); else keys_in_list = 0; diff --git a/asn1/ansi_map/packet-ansi_map-template.c b/asn1/ansi_map/packet-ansi_map-template.c index d9362e2095..e20cf5e49d 100644 --- a/asn1/ansi_map/packet-ansi_map-template.c +++ b/asn1/ansi_map/packet-ansi_map-template.c @@ -403,7 +403,7 @@ update_saved_invokedata(packet_info *pinfo, proto_tree *tree _U_, tvbuff_t *tvb address* dst = &(pinfo->dst); guint8 *src_str; guint8 *dst_str; - char *buf = NULL; + const char *buf = NULL; src_str = ep_address_to_str(src); dst_str = ep_address_to_str(dst); diff --git a/asn1/disp/packet-disp-template.c b/asn1/disp/packet-disp-template.c index b9224fc91f..961cf9dcf7 100644 --- a/asn1/disp/packet-disp-template.c +++ b/asn1/disp/packet-disp-template.c @@ -82,7 +82,7 @@ dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_item *item=NULL; proto_tree *tree=NULL; int (*disp_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL; - char *disp_op_name; + const char *disp_op_name; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); diff --git a/asn1/dop/packet-dop-template.c b/asn1/dop/packet-dop-template.c index 434c894130..07b40d18be 100644 --- a/asn1/dop/packet-dop-template.c +++ b/asn1/dop/packet-dop-template.c @@ -60,7 +60,7 @@ static int proto_dop = -1; static struct SESSION_DATA_STRUCTURE* session = NULL; static const char *binding_type = NULL; /* binding_type */ -static int call_dop_oid_callback(char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char *col_info); +static int call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *col_info); #include "packet-dop-hf.c" @@ -83,7 +83,7 @@ static void append_oid(packet_info *pinfo, const char *oid) #include "packet-dop-fn.c" static int -call_dop_oid_callback(char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char *col_info) +call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *col_info) { char* binding_param; @@ -120,7 +120,7 @@ dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_item *item=NULL; proto_tree *tree=NULL; int (*dop_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL; - char *dop_op_name; + const char *dop_op_name; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); diff --git a/asn1/dsp/packet-dsp-template.c b/asn1/dsp/packet-dsp-template.c index 77187b1f10..946119212c 100644 --- a/asn1/dsp/packet-dsp-template.c +++ b/asn1/dsp/packet-dsp-template.c @@ -76,7 +76,7 @@ dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_item *item=NULL; proto_tree *tree=NULL; int (*dsp_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL; - char *dsp_op_name; + const char *dsp_op_name; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); diff --git a/asn1/mms/mms.cnf b/asn1/mms/mms.cnf index 4447a01e1b..852dbb343b 100644 --- a/asn1/mms/mms.cnf +++ b/asn1/mms/mms.cnf @@ -78,7 +78,7 @@ UtcTime TYPE = FT_STRING DISPLAY = BASE_NONE /* 86400 seconds in one day */ ts.secs = (days + 5113) * 86400 + milliseconds / 1000; - ts.nsecs = (milliseconds %% 1000) * G_GINT64_CONSTANT(1000000U); + ts.nsecs = (milliseconds %% 1000) * 1000000U; ptime = abs_time_to_str(&ts, ABSOLUTE_TIME_UTC, TRUE); if(hf_index >= 0) diff --git a/asn1/p1/packet-p1-template.c b/asn1/p1/packet-p1-template.c index d65380f511..7400b1478f 100644 --- a/asn1/p1/packet-p1-template.c +++ b/asn1/p1/packet-p1-template.c @@ -161,7 +161,7 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_item *item=NULL; proto_tree *tree=NULL; int (*p1_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_, proto_tree *tree, int hf_index _U_) = NULL; - char *p1_op_name; + const char *p1_op_name; int hf_p1_index = -1; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); diff --git a/asn1/pkix1explicit/packet-pkix1explicit-template.h b/asn1/pkix1explicit/packet-pkix1explicit-template.h index cd25c58a55..28c132709f 100644 --- a/asn1/pkix1explicit/packet-pkix1explicit-template.h +++ b/asn1/pkix1explicit/packet-pkix1explicit-template.h @@ -27,7 +27,9 @@ int dissect_pkix1explicit_Certificate(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index); int dissect_pkix1explicit_CertificateList(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index); +#if 0 int dissect_pkix1explicit_CertificateSerialNumber(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index); +#endif int dissect_pkix1explicit_Name(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index); int dissect_pkix1explicit_GeneralName(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index); int dissect_pkix1explicit_AlgorithmIdentifier(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx,proto_tree *tree, int hf_index); diff --git a/asn1/rtse/rtse.cnf b/asn1/rtse/rtse.cnf index 2bf6f8956d..4e470101a6 100644 --- a/asn1/rtse/rtse.cnf +++ b/asn1/rtse/rtse.cnf @@ -6,7 +6,7 @@ RTORJapdu RTABapdu #.FN_BODY RTORJapdu/userDataRJ - char *oid = NULL; + const char *oid = NULL; switch(app_proto) { case 1: /* mts-transfer-protocol-1984 */ @@ -51,7 +51,7 @@ RTABapdu #.FN_BODY ConnectionData/open - char *oid = NULL; + const char *oid = NULL; switch(app_proto) { case 1: /* mts-transfer-protocol-1984 */ diff --git a/asn1/spnego/packet-spnego-template.c b/asn1/spnego/packet-spnego-template.c index 71b60affc6..9da3d1e5f7 100644 --- a/asn1/spnego/packet-spnego-template.c +++ b/asn1/spnego/packet-spnego-template.c @@ -418,11 +418,11 @@ arcfour_mic_cksum(guint8 *key_data, int key_length, */ static int gssapi_verify_pad(unsigned char *wrapped_data, int wrapped_length, - size_t datalen, - size_t *padlen) + int datalen, + int *padlen) { unsigned char *pad; - size_t padlength; + int padlength; int i; pad = wrapped_data + wrapped_length - 1; @@ -449,14 +449,14 @@ decrypt_arcfour(packet_info *pinfo, { guint8 Klocaldata[16]; int ret; - size_t datalen; + int datalen; guint8 k6_data[16]; guint32 SND_SEQ[2]; guint8 Confounder[8]; guint8 cksum_data[8]; int cmp; int conf_flag; - size_t padlen = 0; + int padlen = 0; datalen = tvb_length(pinfo->gssapi_encrypted_tvb); diff --git a/capture_opts.c b/capture_opts.c index 65e848d2e0..a34317da82 100644 --- a/capture_opts.c +++ b/capture_opts.c @@ -487,7 +487,7 @@ capture_opts_add_iface_opt(capture_options *capture_opts, const char *optarg_str } return 2; } - if_info = (if_info_t *)g_list_nth_data(if_list, adapter_index - 1); + if_info = (if_info_t *)g_list_nth_data(if_list, (int)(adapter_index - 1)); if (if_info == NULL) { cmdarg_err("There is no interface with that adapter index"); return 1; diff --git a/capture_sync.c b/capture_sync.c index 1020f18fdb..d3de9994cd 100644 --- a/capture_sync.c +++ b/capture_sync.c @@ -115,7 +115,7 @@ static const char *sync_pipe_signame(int); static gboolean sync_pipe_input_cb(gint source, gpointer user_data); static int sync_pipe_wait_for_child(int fork_child, gchar **msgp); static void pipe_convert_header(const guchar *header, int header_len, char *indicator, int *block_len); -static int pipe_read_block(int pipe_fd, char *indicator, int len, char *msg, +static ssize_t pipe_read_block(int pipe_fd, char *indicator, int len, char *msg, char **err_msg); @@ -949,7 +949,7 @@ sync_pipe_run_command(const char** argv, gchar **data, gchar **primary_msg, int data_pipe_read_fd, sync_pipe_read_fd, fork_child, ret; char *wait_msg; gchar buffer[PIPE_BUF_SIZE+1]; - int nread; + ssize_t nread; char indicator; int primary_msg_len; char *primary_msg_text; @@ -957,7 +957,7 @@ sync_pipe_run_command(const char** argv, gchar **data, gchar **primary_msg, char *secondary_msg_text; char *combined_msg; GString *data_buf = NULL; - int count; + size_t count; ret = sync_pipe_open_command(argv, &data_pipe_read_fd, &sync_pipe_read_fd, &fork_child, &msg); @@ -1262,7 +1262,7 @@ sync_interface_stats_open(int *data_read_fd, int *fork_child, gchar **msg) int message_read_fd, ret; char *wait_msg; gchar buffer[PIPE_BUF_SIZE+1]; - int nread; + ssize_t nread; char indicator; int primary_msg_len; char *primary_msg_text; @@ -1416,11 +1416,11 @@ sync_interface_stats_close(int *read_fd, int *fork_child, gchar **msg) /* read a number of bytes from a pipe */ /* (blocks until enough bytes read or an error occurs) */ -static int +static ssize_t pipe_read_bytes(int pipe_fd, char *bytes, int required, char **msg) { - int newly; - int offset = 0; + ssize_t newly; + ssize_t offset = 0; int error; while(required) { @@ -1443,7 +1443,7 @@ pipe_read_bytes(int pipe_fd, char *bytes, int required, char **msg) return newly; } - required -= newly; + required -= (int)newly; offset += newly; } @@ -1484,7 +1484,7 @@ static gboolean pipe_data_available(int pipe_fd) { /* Read a line from a pipe, similar to fgets */ int sync_pipe_gets_nonblock(int pipe_fd, char *bytes, int max) { - int newly; + ssize_t newly; int offset = -1; while(offset < max - 1) { @@ -1495,11 +1495,11 @@ sync_pipe_gets_nonblock(int pipe_fd, char *bytes, int max) { if (newly == 0) { /* EOF - not necessarily an error */ break; - } else if (newly < 0) { + } else if (newly == -1) { /* error */ g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "read from pipe %d: error(%u): %s", pipe_fd, errno, g_strerror(errno)); - return newly; + return -1; } else if (bytes[offset] == '\n') { break; } @@ -1526,12 +1526,12 @@ pipe_convert_header(const guchar *header, int header_len, char *indicator, int * /* read a message from the sending pipe in the standard format (1-byte message indicator, 3-byte message length (excluding length and indicator field), and the rest is the message) */ -static int +static ssize_t pipe_read_block(int pipe_fd, char *indicator, int len, char *msg, char **err_msg) { int required; - int newly; + ssize_t newly; guchar header[4]; /* read header (indicator and 3-byte length) */ @@ -1548,13 +1548,13 @@ pipe_read_block(int pipe_fd, char *indicator, int len, char *msg, return 0; } g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, - "read %d failed to read header: %u", pipe_fd, newly); + "read %d failed to read header: %lu", pipe_fd, (long)newly); if (newly != -1) { /* * Short read, but not an immediate EOF. */ - *err_msg = g_strdup_printf("Premature EOF reading from sync pipe: got only %d bytes", - newly); + *err_msg = g_strdup_printf("Premature EOF reading from sync pipe: got only %ld bytes", + (long)newly); } return -1; } @@ -1617,13 +1617,14 @@ sync_pipe_input_cb(gint source, gpointer user_data) capture_options *capture_opts = (capture_options *)user_data; int ret; char buffer[SP_MAX_MSG_LEN+1]; - int nread; + ssize_t nread; char indicator; int primary_len; char *primary_msg; int secondary_len; char *secondary_msg; char *wait_msg, *combined_msg; + int npackets; nread = pipe_read_block(source, &indicator, SP_MAX_MSG_LEN, buffer, &primary_msg); @@ -1701,9 +1702,9 @@ sync_pipe_input_cb(gint source, gpointer user_data) } break; case SP_PACKET_COUNT: - nread = atoi(buffer); - g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "sync_pipe_input_cb: new packets %u", nread); - capture_input_new_packets(capture_opts, nread); + npackets = atoi(buffer); + g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "sync_pipe_input_cb: new packets %u", npackets); + capture_input_new_packets(capture_opts, npackets); break; case SP_ERROR_MSG: /* convert primary message */ @@ -1817,8 +1818,8 @@ sync_pipe_wait_for_child(int fork_child, gchar **msgp) #endif g_get_current_time(&end_time); - elapsed = (end_time.tv_sec - start_time.tv_sec) + - ((end_time.tv_usec - start_time.tv_usec) / (float) 1e6); + elapsed = (float) ((end_time.tv_sec - start_time.tv_sec) + + ((end_time.tv_usec - start_time.tv_usec) / 1e6)); g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "sync_pipe_wait_for_child: capture child closed after %.3fs", elapsed); return ret; } diff --git a/clopts_common.c b/clopts_common.c index 0e8c0cf978..53cf2363d3 100644 --- a/clopts_common.c +++ b/clopts_common.c @@ -54,14 +54,14 @@ get_natural_int(const char *string, const char *name) name, string, INT_MAX); exit(1); } - return number; + return (int)number; } int get_positive_int(const char *string, const char *name) { - long number; + int number; number = get_natural_int(string, name); diff --git a/configure.ac b/configure.ac index 03343d20ae..05edd2011b 100644 --- a/configure.ac +++ b/configure.ac @@ -377,43 +377,44 @@ AC_ARG_ENABLE(extra-gcc-checks, if test $enableval != no then AC_WIRESHARK_GCC_CFLAGS_CHECK(-pedantic) + # + # Various code blocks this one. + # AC_WIRESHARK_GCC_CFLAGS_CHECK(-Woverflow) - AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wlogical-op) - AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-overlength-strings) -# AC_WIRESHARK_GCC_CFLAGS_CHECK(-fstrict-overflow -Wstrict-overflow=4) -# AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wunreachable-code) -# AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wunsafe-loop-optimizations) - AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-long-long) - AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wbad-function-cast, C) + AC_WIRESHARK_GCC_CFLAGS_CHECK(-fstrict-overflow -Wstrict-overflow=4) + # + # Some memset() calls to clear out structures + # on the stack are getting flagged as "will never + # be executed" by this, at least by Apple's + # i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on + # Apple Inc. build 5658) (LLVM build 2336.11.00), for + # some unknown reason. + # + AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wunreachable-code) + # + # Due to various places where APIs we don't control + # require us to cast away constness, we can probably + # never enable these ones with -Werror. + # AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-qual) - AC_WIRESHARK_GCC_CFLAGS_CHECK(-Waddress) - AC_WIRESHARK_GCC_CFLAGS_CHECK(-Warray-bounds) - AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wattributes) - AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wdiv-by-zero) - AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wignored-qualifiers) - AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wpragmas) + AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wbad-function-cast, C) + # + # Some generated ASN.1 dissectors block this one; + # multiple function declarations for the same + # function are being generated. + # AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wredundant-decls) - AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wvla) + # + # A ton of code blocks this one - it warns about + # implict conversions of void * to/from arbitrary + # pointer types, for example. + # AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wc++-compat, C) - AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wjump-misses-init, C) - # - # epan/dissectors/packet-ncp2222.inc blocks this one - # for now. - # - AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wwrite-strings) - # - # GLib blocks this for now. - # - AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wstrict-prototypes) # # All the registration functions block these for now. # AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wmissing-prototypes) AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wmissing-declarations) - # - # More cleanup needed for this on LP64. - # - AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wshorten-64-to-32) fi ],) AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wall -W) # -W is now known as -Wextra @@ -426,6 +427,21 @@ AC_WIRESHARK_GCC_CFLAGS_CHECK(-Warray-bounds) AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wcast-align) AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wformat-security) AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wold-style-definition, C) +AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wshorten-64-to-32) +AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wstrict-prototypes) +AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wjump-misses-init, C) +AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wvla) +AC_WIRESHARK_GCC_CFLAGS_CHECK(-Waddress) +AC_WIRESHARK_GCC_CFLAGS_CHECK(-Warray-bounds) +AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wattributes) +AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wdiv-by-zero) +AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wignored-qualifiers) +AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wpragmas) +AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wlogical-op) +AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-overlength-strings) +AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wwrite-strings) +AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wunsafe-loop-optimizations) +AC_WIRESHARK_GCC_CFLAGS_CHECK(-Wno-long-long) CFLAGS_before_pie=$CFLAGS AC_WIRESHARK_GCC_CFLAGS_CHECK(-fPIE, C) @@ -525,9 +541,9 @@ warnings_as_errors_default="yes" AC_MSG_CHECKING(whether we should treat compiler warnings as errors) AC_ARG_ENABLE(warnings-as-errors, AC_HELP_STRING( [--enable-warnings-as-errors], - [treat warnings as errors (only for GCC or clang) @<:@default=yes@:>@]), + [treat warnings as errors (only for GCC or clang) @<:@default=yes, unless extra warnings are enabled@:>@]), [ - if test "x$ac_supports_gcc_flags" = "xyes" -a "x$enableval" = "xyes" -a "x$wireshark_extra_gcc_flags" != "xyes"; then + if test "x$ac_supports_gcc_flags" = "xyes" -a "x$enableval" = "xyes"; then with_warnings_as_errors="yes" AC_MSG_RESULT(yes) else @@ -535,6 +551,7 @@ AC_ARG_ENABLE(warnings-as-errors, AC_MSG_RESULT(no) fi ], +[ if test "x$ac_supports_gcc_flags" = "xyes" -a "x$wireshark_extra_gcc_flags" = "x" -a "x$warnings_as_errors_default" = "xyes"; then with_warnings_as_errors="yes" AC_MSG_RESULT(yes) @@ -542,6 +559,7 @@ AC_ARG_ENABLE(warnings-as-errors, with_warnings_as_errors="no" AC_MSG_RESULT(no) fi +] ) AM_CONDITIONAL(HAVE_WARNINGS_AS_ERRORS, test "x$with_warnings_as_errors" = "xyes") diff --git a/dumpcap.c b/dumpcap.c index b63ed1dc43..58d3eaea36 100644 --- a/dumpcap.c +++ b/dumpcap.c @@ -251,8 +251,8 @@ typedef struct _pcap_options { #if defined(_WIN32) char * cap_pipe_buf; /* Pointer to the data buffer we read into */ #endif - int cap_pipe_bytes_to_read; /* Used by cap_pipe_dispatch */ - int cap_pipe_bytes_read; /* Used by cap_pipe_dispatch */ + size_t cap_pipe_bytes_to_read; /* Used by cap_pipe_dispatch */ + size_t cap_pipe_bytes_read; /* Used by cap_pipe_dispatch */ enum { STATE_EXPECT_REC_HDR, STATE_READ_REC_HDR, @@ -1679,7 +1679,7 @@ cap_pipe_adjust_header(gboolean byte_swapped, struct pcap_hdr *hdr, struct pcapr /* Wrapper: distinguish between recv/read if we're reading on Windows, * or just read(). */ -static int +static ssize_t cap_pipe_read(int pipe_fd, char *buf, size_t sz, gboolean from_socket _U_) { #ifdef _WIN32 @@ -1713,7 +1713,7 @@ cap_pipe_read(int pipe_fd, char *buf, size_t sz, gboolean from_socket _U_) static void *cap_thread_read(void *arg) { pcap_options *pcap_opts; - int bytes_read; + size_t bytes_read; #ifdef _WIN32 BOOL res; DWORD b, last_err; @@ -1726,7 +1726,7 @@ static void *cap_thread_read(void *arg) g_async_queue_pop(pcap_opts->cap_pipe_pending_q); /* Wait for our cue (ahem) from the main thread */ g_mutex_lock(pcap_opts->cap_pipe_read_mtx); bytes_read = 0; - while (bytes_read < (int) pcap_opts->cap_pipe_bytes_to_read) { + while (bytes_read < pcap_opts->cap_pipe_bytes_to_read) { if ((pcap_opts->from_cap_socket) #ifndef _WIN32 || 1 @@ -1926,9 +1926,10 @@ cap_pipe_open_live(char *pipename, char *pncopy, *pos; wchar_t *err_str; #endif - int b, fd, sel_ret; - unsigned int bytes_read; - guint32 magic = 0; + ssize_t b; + int fd, sel_ret; + size_t bytes_read; + guint32 magic = 0; pcap_opts->cap_pipe_fd = -1; #ifdef _WIN32 @@ -2111,7 +2112,9 @@ cap_pipe_open_live(char *pipename, "Unexpected error from select: %s", g_strerror(errno)); goto error; } else if (sel_ret > 0) { - b = cap_pipe_read(fd, ((char *)&magic)+bytes_read, sizeof magic-bytes_read, pcap_opts->from_cap_socket); + b = cap_pipe_read(fd, ((char *)&magic)+bytes_read, + sizeof magic-bytes_read, + pcap_opts->from_cap_socket); if (b <= 0) { if (b == 0) g_snprintf(errmsg, errmsgl, "End of file on pipe magic during open"); @@ -2201,7 +2204,8 @@ cap_pipe_open_live(char *pipename, goto error; } else if (sel_ret > 0) { b = cap_pipe_read(fd, ((char *)hdr)+bytes_read, - sizeof(struct pcap_hdr) - bytes_read, pcap_opts->from_cap_socket); + sizeof(struct pcap_hdr) - bytes_read, + pcap_opts->from_cap_socket); if (b <= 0) { if (b == 0) g_snprintf(errmsg, errmsgl, "End of file on pipe header during open"); @@ -2274,7 +2278,7 @@ cap_pipe_dispatch(loop_data *ld, pcap_options *pcap_opts, guchar *data, char *er gpointer q_status; wchar_t *err_str; #endif - int b; + ssize_t b; #ifdef LOG_CAPTURE_VERBOSE g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "cap_pipe_dispatch"); @@ -2338,7 +2342,7 @@ cap_pipe_dispatch(loop_data *ld, pcap_options *pcap_opts, guchar *data, char *er } } #endif - if ((pcap_opts->cap_pipe_bytes_read) < pcap_opts->cap_pipe_bytes_to_read) + if (pcap_opts->cap_pipe_bytes_read < pcap_opts->cap_pipe_bytes_to_read) return 0; result = PD_REC_HDR_READ; break; @@ -2366,8 +2370,10 @@ cap_pipe_dispatch(loop_data *ld, pcap_options *pcap_opts, guchar *data, char *er || 1 #endif ) { - b = cap_pipe_read(pcap_opts->cap_pipe_fd, data+pcap_opts->cap_pipe_bytes_read, - pcap_opts->cap_pipe_bytes_to_read - pcap_opts->cap_pipe_bytes_read, pcap_opts->from_cap_socket); + b = cap_pipe_read(pcap_opts->cap_pipe_fd, + data+pcap_opts->cap_pipe_bytes_read, + pcap_opts->cap_pipe_bytes_to_read - pcap_opts->cap_pipe_bytes_read, + pcap_opts->from_cap_socket); if (b <= 0) { if (b == 0) result = PD_PIPE_EOF; @@ -2399,7 +2405,7 @@ cap_pipe_dispatch(loop_data *ld, pcap_options *pcap_opts, guchar *data, char *er } } #endif - if ((pcap_opts->cap_pipe_bytes_read) < pcap_opts->cap_pipe_bytes_to_read) + if (pcap_opts->cap_pipe_bytes_read < pcap_opts->cap_pipe_bytes_to_read) return 0; result = PD_DATA_READ; break; diff --git a/editcap.c b/editcap.c index 9b873733dc..cad8856506 100644 --- a/editcap.c +++ b/editcap.c @@ -368,7 +368,7 @@ set_time_adjustment(char *optarg_str_p) frac_digits++; } } - time_adj.tv.tv_usec = val; + time_adj.tv.tv_usec = (int)val; } static void @@ -443,7 +443,7 @@ set_strict_time_adj(char *optarg_str_p) frac_digits++; } } - strict_time_adj.tv.tv_usec = val; + strict_time_adj.tv.tv_usec = (int)val; } static void @@ -513,7 +513,7 @@ set_rel_time(char *optarg_str_p) frac_digits++; } } - relative_time_window.nsecs = val; + relative_time_window.nsecs = (int)val; } static gboolean @@ -894,7 +894,7 @@ main(int argc, char *argv[]) break; case 'c': - split_packet_count = strtol(optarg, &p, 10); + split_packet_count = (int)strtol(optarg, &p, 10); if (p == optarg || *p != '\0') { fprintf(stderr, "editcap: \"%s\" isn't a valid packet count\n", optarg); @@ -908,7 +908,7 @@ main(int argc, char *argv[]) break; case 'C': - choplen = strtol(optarg, &p, 10); + choplen = (int)strtol(optarg, &p, 10); if (p == optarg || *p != '\0') { fprintf(stderr, "editcap: \"%s\" isn't a valid chop length\n", optarg); @@ -925,7 +925,7 @@ main(int argc, char *argv[]) case 'D': dup_detect = TRUE; dup_detect_by_time = FALSE; - dup_window = strtol(optarg, &p, 10); + dup_window = (int)strtol(optarg, &p, 10); if (p == optarg || *p != '\0') { fprintf(stderr, "editcap: \"%s\" isn't a valid duplicate window value\n", optarg); @@ -969,7 +969,7 @@ main(int argc, char *argv[]) break; case 's': - snaplen = strtol(optarg, &p, 10); + snaplen = (guint32)strtol(optarg, &p, 10); if (p == optarg || *p != '\0') { fprintf(stderr, "editcap: \"%s\" isn't a valid snapshot length\n", optarg); diff --git a/epan/addr_resolv.c b/epan/addr_resolv.c index 2f9466cfc6..fd4f7d4383 100644 --- a/epan/addr_resolv.c +++ b/epan/addr_resolv.c @@ -1070,7 +1070,7 @@ parse_ether_address(const char *cp, ether_t *eth, unsigned int *mask, if (num == 0 || num >= 48) return FALSE; /* bogus mask */ /* Mask out the bits not covered by the mask */ - *mask = num; + *mask = (int)num; for (i = 0; num >= 8; i++, num -= 8) ; /* skip octets entirely covered by the mask */ /* Mask out the first masked octet */ diff --git a/epan/address_to_str.c b/epan/address_to_str.c index e805a8fa2e..933f239c94 100644 --- a/epan/address_to_str.c +++ b/epan/address_to_str.c @@ -84,13 +84,13 @@ char *bytes_to_hexstr_punct(char *out, const guint8 *ad, guint32 len, char punct /* XXX FIXME remove this one later when every call has been converted to ep_address_to_str() */ -gchar * +const gchar * ether_to_str(const guint8 *ad) { return bytestring_to_str(ad, 6, ':'); } -gchar * +const gchar * tvb_ether_to_str(tvbuff_t *tvb, const gint offset) { return bytestring_to_str(tvb_get_ptr(tvb, offset, 6), 6, ':'); @@ -386,9 +386,9 @@ tipc_addr_to_str_buf( const guint8 *data, gchar *buf, int buf_len){ static void ib_addr_to_str_buf( const address *addr, gchar *buf, int buf_len){ if (addr->len >= 16) { /* GID is 128bits */ - #define PREAMBLE_STR_LEN (sizeof("GID: ") - 1) + #define PREAMBLE_STR_LEN ((int)(sizeof("GID: ") - 1)) g_snprintf(buf,buf_len,"GID: "); - if (buf_len < (int)PREAMBLE_STR_LEN || + if (buf_len < PREAMBLE_STR_LEN || inet_ntop(AF_INET6, addr->data, buf + PREAMBLE_STR_LEN, buf_len - PREAMBLE_STR_LEN) == NULL ) /* Returns NULL if no space and does not touch buf */ g_snprintf ( buf, buf_len, BUF_TOO_SMALL_ERR ); /* Let the unexpected value alert user */ @@ -403,13 +403,13 @@ ib_addr_to_str_buf( const address *addr, gchar *buf, int buf_len){ /* XXX FIXME remove this one later when every call has been converted to ep_address_to_str() */ -gchar * +const gchar * fc_to_str(const guint8 *ad) { return bytestring_to_str (ad, 3, '.'); } -gchar * +const gchar * tvb_fc_to_str(tvbuff_t *tvb, const gint offset) { return bytestring_to_str (tvb_get_ptr(tvb, offset, 3), 3, '.'); @@ -478,7 +478,7 @@ tvb_fcwwn_to_str(tvbuff_t *tvb, const gint offset) /* XXX FIXME remove this one later when every call has been converted to address_to_str() */ -gchar * +const gchar * ax25_to_str(const guint8 *ad) { return bytestring_to_str(ad, 7, ':'); diff --git a/epan/adler32.c b/epan/adler32.c index baa64ad62c..542876dc6f 100644 --- a/epan/adler32.c +++ b/epan/adler32.c @@ -26,16 +26,18 @@ #include +#include + #include #define BASE 65521 /* largest prime smaller than 65536 */ /*--- update_adler32 --------------------------------------------------------*/ -unsigned long update_adler32(unsigned long adler, const unsigned char *buf, int len) +guint32 update_adler32(guint32 adler, const guint8 *buf, size_t len) { - unsigned long s1 = adler & 0xffff; - unsigned long s2 = (adler >> 16) & 0xffff; - int n; + guint32 s1 = adler & 0xffff; + guint32 s2 = (adler >> 16) & 0xffff; + size_t n; for (n = 0; n < len; n++) { s1 = (s1 + buf[n]) % BASE; @@ -45,15 +47,15 @@ unsigned long update_adler32(unsigned long adler, const unsigned char *buf, int } /*--- adler32 ---------------------------------------------------------------*/ -unsigned long adler32_bytes(const unsigned char *buf, int len) +guint32 adler32_bytes(const guint8 *buf, size_t len) { - return update_adler32(1L, buf, len); + return update_adler32(1, buf, len); } /*--- adler32_str -----------------------------------------------------------*/ -unsigned long adler32_str(const char *buf) +guint32 adler32_str(const char *buf) { - return update_adler32(1L, (const unsigned char*)buf, (int)strlen(buf)); + return update_adler32(1, (const guint8*)buf, strlen(buf)); } /*---------------------------------------------------------------------------*/ diff --git a/epan/adler32.h b/epan/adler32.h index fa0537db62..14221eb7f0 100644 --- a/epan/adler32.h +++ b/epan/adler32.h @@ -30,9 +30,9 @@ extern "C"{ #endif -unsigned long update_adler32(unsigned long adler, const unsigned char *buf, int len); -unsigned long adler32_bytes(const unsigned char *buf, int len); -unsigned long adler32_str(const char *buf); +guint32 update_adler32(guint32 adler, const guint8 *buf, size_t len); +guint32 adler32_bytes(const guint8 *buf, size_t len); +guint32 adler32_str(const char *buf); #ifdef __cplusplus } diff --git a/epan/column-utils.c b/epan/column-utils.c index 8953a01f51..71365dccf7 100644 --- a/epan/column-utils.c +++ b/epan/column-utils.c @@ -676,58 +676,58 @@ set_abs_date_time(const frame_data *fd, gchar *buf, gboolean local) break; case TS_PREC_FIXED_DSEC: case TS_PREC_AUTO_DSEC: - g_snprintf(buf, COL_MAX_LEN,"%04d-%02d-%02d %02d:%02d:%02d.%01ld", + g_snprintf(buf, COL_MAX_LEN,"%04d-%02d-%02d %02d:%02d:%02d.%01d", tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec, - (long)fd->abs_ts.nsecs / 100000000); + fd->abs_ts.nsecs / 100000000); break; case TS_PREC_FIXED_CSEC: case TS_PREC_AUTO_CSEC: - g_snprintf(buf, COL_MAX_LEN,"%04d-%02d-%02d %02d:%02d:%02d.%02ld", + g_snprintf(buf, COL_MAX_LEN,"%04d-%02d-%02d %02d:%02d:%02d.%02d", tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec, - (long)fd->abs_ts.nsecs / 10000000); + fd->abs_ts.nsecs / 10000000); break; case TS_PREC_FIXED_MSEC: case TS_PREC_AUTO_MSEC: - g_snprintf(buf, COL_MAX_LEN, "%04d-%02d-%02d %02d:%02d:%02d.%03ld", + g_snprintf(buf, COL_MAX_LEN, "%04d-%02d-%02d %02d:%02d:%02d.%03d", tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec, - (long)fd->abs_ts.nsecs / 1000000); + fd->abs_ts.nsecs / 1000000); break; case TS_PREC_FIXED_USEC: case TS_PREC_AUTO_USEC: - g_snprintf(buf, COL_MAX_LEN, "%04d-%02d-%02d %02d:%02d:%02d.%06ld", + g_snprintf(buf, COL_MAX_LEN, "%04d-%02d-%02d %02d:%02d:%02d.%06d", tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec, - (long)fd->abs_ts.nsecs / 1000); + fd->abs_ts.nsecs / 1000); break; case TS_PREC_FIXED_NSEC: case TS_PREC_AUTO_NSEC: - g_snprintf(buf, COL_MAX_LEN, "%04d-%02d-%02d %02d:%02d:%02d.%09ld", + g_snprintf(buf, COL_MAX_LEN, "%04d-%02d-%02d %02d:%02d:%02d.%09d", tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec, - (long)fd->abs_ts.nsecs); + fd->abs_ts.nsecs); break; default: g_assert_not_reached(); @@ -1051,43 +1051,43 @@ set_abs_time(const frame_data *fd, gchar *buf, gboolean local) break; case TS_PREC_FIXED_DSEC: case TS_PREC_AUTO_DSEC: - g_snprintf(buf, COL_MAX_LEN,"%02d:%02d:%02d.%01ld", + g_snprintf(buf, COL_MAX_LEN,"%02d:%02d:%02d.%01d", tmp->tm_hour, tmp->tm_min, tmp->tm_sec, - (long)fd->abs_ts.nsecs / 100000000); + fd->abs_ts.nsecs / 100000000); break; case TS_PREC_FIXED_CSEC: case TS_PREC_AUTO_CSEC: - g_snprintf(buf, COL_MAX_LEN,"%02d:%02d:%02d.%02ld", + g_snprintf(buf, COL_MAX_LEN,"%02d:%02d:%02d.%02d", tmp->tm_hour, tmp->tm_min, tmp->tm_sec, - (long)fd->abs_ts.nsecs / 10000000); + fd->abs_ts.nsecs / 10000000); break; case TS_PREC_FIXED_MSEC: case TS_PREC_AUTO_MSEC: - g_snprintf(buf, COL_MAX_LEN,"%02d:%02d:%02d.%03ld", + g_snprintf(buf, COL_MAX_LEN,"%02d:%02d:%02d.%03d", tmp->tm_hour, tmp->tm_min, tmp->tm_sec, - (long)fd->abs_ts.nsecs / 1000000); + fd->abs_ts.nsecs / 1000000); break; case TS_PREC_FIXED_USEC: case TS_PREC_AUTO_USEC: - g_snprintf(buf, COL_MAX_LEN,"%02d:%02d:%02d.%06ld", + g_snprintf(buf, COL_MAX_LEN,"%02d:%02d:%02d.%06d", tmp->tm_hour, tmp->tm_min, tmp->tm_sec, - (long)fd->abs_ts.nsecs / 1000); + fd->abs_ts.nsecs / 1000); break; case TS_PREC_FIXED_NSEC: case TS_PREC_AUTO_NSEC: - g_snprintf(buf, COL_MAX_LEN, "%02d:%02d:%02d.%09ld", + g_snprintf(buf, COL_MAX_LEN, "%02d:%02d:%02d.%09d", tmp->tm_hour, tmp->tm_min, tmp->tm_sec, - (long)fd->abs_ts.nsecs); + fd->abs_ts.nsecs); break; default: g_assert_not_reached(); @@ -1364,7 +1364,7 @@ col_set_fmt_time(const frame_data *fd, column_info *cinfo, const gint fmt, const * applying/preparing/copying as filter) */ void -col_set_time(column_info *cinfo, const gint el, const nstime_t *ts, char *fieldname) +col_set_time(column_info *cinfo, const gint el, const nstime_t *ts, const char *fieldname) { int col; diff --git a/epan/column-utils.h b/epan/column-utils.h index 9efcd6cf9f..daa7353e36 100644 --- a/epan/column-utils.h +++ b/epan/column-utils.h @@ -246,7 +246,7 @@ extern void col_append_sep_fstr(column_info *cinfo, const gint col, const gchar * applying/preparing/copying as filter) */ extern void col_set_time(column_info *cinfo, const int col, - const nstime_t *ts, char *fieldname); + const nstime_t *ts, const char *fieldname); extern void set_fd_time(frame_data *fd, gchar *buf); diff --git a/epan/dfilter/dfilter-macro.c b/epan/dfilter/dfilter-macro.c index b3f04df317..3c43191515 100644 --- a/epan/dfilter/dfilter-macro.c +++ b/epan/dfilter/dfilter-macro.c @@ -149,14 +149,14 @@ void dfilter_macro_dump(void) { #endif } -static gchar* dfilter_macro_resolve(gchar* name, gchar** args, const gchar** error) { +static const gchar* dfilter_macro_resolve(gchar* name, gchar** args, const gchar** error) { GString* text; int argc = 0; dfilter_macro_t* m = NULL; fvt_cache_entry_t* e; int* arg_pos_p; gchar** parts; - gchar* ret; + const gchar* ret; guint i; for (i = 0; i < num_macros; i++) { @@ -215,7 +215,7 @@ static gchar* dfilter_macro_resolve(gchar* name, gchar** args, const gchar** err } -static gchar* dfilter_macro_apply_recurse(const gchar* text, guint depth, const gchar** error) { +static const gchar* dfilter_macro_apply_recurse(const gchar* text, guint depth, const gchar** error) { enum { OUTSIDE, STARTING, NAME, ARGS } state = OUTSIDE; GString* out; GString* name = NULL; @@ -293,7 +293,7 @@ static gchar* dfilter_macro_apply_recurse(const gchar* text, guint depth, const } else if ( c == ':') { state = ARGS; } else if ( c == '}') { - gchar* resolved; + const gchar* resolved; g_ptr_array_add(args,NULL); @@ -339,7 +339,7 @@ static gchar* dfilter_macro_apply_recurse(const gchar* text, guint depth, const g_string_append_c(arg,c); break; } case '}': { - gchar* resolved; + const gchar* resolved; g_ptr_array_add(args,arg->str); g_ptr_array_add(args,NULL); @@ -369,11 +369,11 @@ finish: FREE_ALL(); if (changed) { - gchar* resolved = dfilter_macro_apply_recurse(out->str, depth + 1, error); + const gchar* resolved = dfilter_macro_apply_recurse(out->str, depth + 1, error); g_string_free(out,TRUE); return (*error) ? NULL : resolved; } else { - gchar* out_str = ep_strdup(out->str); + const gchar* out_str = ep_strdup(out->str); g_string_free(out,TRUE); return out_str; } @@ -387,7 +387,7 @@ on_error: } } -gchar* dfilter_macro_apply(const gchar* text, const gchar** error) { +const gchar* dfilter_macro_apply(const gchar* text, const gchar** error) { return dfilter_macro_apply_recurse(text, 0, error); } diff --git a/epan/dfilter/dfilter-macro.h b/epan/dfilter/dfilter-macro.h index 6a41dc45d6..9b03c46bdc 100644 --- a/epan/dfilter/dfilter-macro.h +++ b/epan/dfilter/dfilter-macro.h @@ -48,7 +48,7 @@ void dfilter_macro_save(const gchar*, gchar**); void dfilter_macro_dump(void); /* applies all macros to the given text and returns the resulting string or NULL on failure */ -gchar* dfilter_macro_apply(const gchar* text, const gchar** error); +const gchar* dfilter_macro_apply(const gchar* text, const gchar** error); void dfilter_macro_init(void); diff --git a/epan/dissectors/packet-6lowpan.c b/epan/dissectors/packet-6lowpan.c index 00e3fef188..30d7fe6e38 100644 --- a/epan/dissectors/packet-6lowpan.c +++ b/epan/dissectors/packet-6lowpan.c @@ -791,7 +791,7 @@ lowpan_reassemble_ipv6(tvbuff_t *tvb, struct ip6_hdr *ipv6, struct lowpan_nhdr * }; /* Return the reassembed packet. */ - ret = tvb_new_child_real_data(tvb, buffer, length + sizeof(struct ip6_hdr), reported + sizeof(struct ip6_hdr)); + ret = tvb_new_child_real_data(tvb, buffer, length + (int)sizeof(struct ip6_hdr), reported + (int)sizeof(struct ip6_hdr)); tvb_set_free_cb(ret, g_free); return ret; } /* lowpan_reassemble_ipv6 */ @@ -1029,40 +1029,40 @@ dissect_6lowpan_hc1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint dg */ /* Create a tree for the HC1 Header. */ if (tree) { - ti = proto_tree_add_text(tree, tvb, 0, sizeof(guint16), "HC1 Encoding"); + ti = proto_tree_add_text(tree, tvb, 0, (int)sizeof(guint16), "HC1 Encoding"); hc_tree = proto_item_add_subtree(ti, ett_6lowpan_hc1); /* Get and display the pattern. */ proto_tree_add_bits_item(hc_tree, hf_6lowpan_pattern, tvb, 0, LOWPAN_PATTERN_HC1_BITS, ENC_BIG_ENDIAN); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Get and display the HC1 encoding bits. */ hc1_encoding = tvb_get_guint8(tvb, offset); next_header = ((hc1_encoding & LOWPAN_HC1_NEXT) >> 1); if (tree) { - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_source_prefix, tvb, offset, sizeof(guint8), hc1_encoding & LOWPAN_HC1_SOURCE_PREFIX); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_source_ifc, tvb, offset, sizeof(guint8), hc1_encoding & LOWPAN_HC1_SOURCE_IFC); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_dest_prefix, tvb, offset, sizeof(guint8), hc1_encoding & LOWPAN_HC1_DEST_PREFIX); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_dest_ifc, tvb, offset, sizeof(guint8), hc1_encoding & LOWPAN_HC1_DEST_IFC); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_class, tvb, offset, sizeof(guint8), hc1_encoding & LOWPAN_HC1_TRAFFIC_CLASS); - proto_tree_add_uint(hc_tree, hf_6lowpan_hc1_next, tvb, offset, sizeof(guint8), hc1_encoding & LOWPAN_HC1_NEXT); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_more, tvb, offset, sizeof(guint8), hc1_encoding & LOWPAN_HC1_MORE); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_source_prefix, tvb, offset, (int)sizeof(guint8), hc1_encoding & LOWPAN_HC1_SOURCE_PREFIX); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_source_ifc, tvb, offset, (int)sizeof(guint8), hc1_encoding & LOWPAN_HC1_SOURCE_IFC); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_dest_prefix, tvb, offset, (int)sizeof(guint8), hc1_encoding & LOWPAN_HC1_DEST_PREFIX); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_dest_ifc, tvb, offset, (int)sizeof(guint8), hc1_encoding & LOWPAN_HC1_DEST_IFC); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_class, tvb, offset, (int)sizeof(guint8), hc1_encoding & LOWPAN_HC1_TRAFFIC_CLASS); + proto_tree_add_uint(hc_tree, hf_6lowpan_hc1_next, tvb, offset, (int)sizeof(guint8), hc1_encoding & LOWPAN_HC1_NEXT); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc1_more, tvb, offset, (int)sizeof(guint8), hc1_encoding & LOWPAN_HC1_MORE); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Get and display the HC2 encoding bits, if present. */ if (hc1_encoding & LOWPAN_HC1_MORE) { if (next_header == LOWPAN_HC1_NEXT_UDP) { hc_udp_encoding = tvb_get_guint8(tvb, offset); if (tree) { - ti = proto_tree_add_text(tree, tvb, offset, sizeof(guint8), "HC_UDP Encoding"); + ti = proto_tree_add_text(tree, tvb, offset, (int)sizeof(guint8), "HC_UDP Encoding"); hc_tree = proto_item_add_subtree(ti, ett_6lowpan_hc2_udp); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc2_udp_src, tvb, offset, sizeof(guint8), hc_udp_encoding & LOWPAN_HC2_UDP_SRCPORT); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc2_udp_dst, tvb, offset, sizeof(guint8), hc_udp_encoding & LOWPAN_HC2_UDP_DSTPORT); - proto_tree_add_boolean(hc_tree, hf_6lowpan_hc2_udp_len, tvb, offset, sizeof(guint8), hc_udp_encoding & LOWPAN_HC2_UDP_LENGTH); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc2_udp_src, tvb, offset, (int)sizeof(guint8), hc_udp_encoding & LOWPAN_HC2_UDP_SRCPORT); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc2_udp_dst, tvb, offset, (int)sizeof(guint8), hc_udp_encoding & LOWPAN_HC2_UDP_DSTPORT); + proto_tree_add_boolean(hc_tree, hf_6lowpan_hc2_udp_len, tvb, offset, (int)sizeof(guint8), hc_udp_encoding & LOWPAN_HC2_UDP_LENGTH); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } else { /* HC1 states there are more bits, but an illegal next header was defined. */ @@ -1264,7 +1264,7 @@ dissect_6lowpan_hc1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint dg else { udp.length = tvb_reported_length(tvb); udp.length -= BITS_TO_BYTE_LEN(0, bit_offset + LOWPAN_UDP_CHECKSUM_BITS); - udp.length += sizeof(struct udp_hdr); + udp.length += (int)sizeof(struct udp_hdr); } udp.length = g_ntohs(udp.length); @@ -1283,7 +1283,7 @@ dissect_6lowpan_hc1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint dg nhdr_list = (struct lowpan_nhdr *)ep_alloc(sizeof(struct lowpan_nhdr) + sizeof(struct udp_hdr) + length); nhdr_list->next = NULL; nhdr_list->proto = IP_PROTO_UDP; - nhdr_list->length = length + sizeof(struct udp_hdr); + nhdr_list->length = length + (int)sizeof(struct udp_hdr); nhdr_list->reported = g_ntohs(udp.length); /* Copy the UDP header into the buffer. */ @@ -1306,7 +1306,7 @@ dissect_6lowpan_hc1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint dg nhdr_list->reported = tvb_reported_length_remaining(tvb, offset); } else { - nhdr_list->reported = dgram_size - sizeof(struct ip6_hdr); + nhdr_list->reported = dgram_size - (int)sizeof(struct ip6_hdr); } tvb_memcpy(tvb, LOWPAN_NHDR_DATA(nhdr_list), offset, nhdr_list->length); } @@ -1377,7 +1377,7 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d /* Create a tree for the IPHC header. */ if (tree) { - ti = proto_tree_add_text(tree, tvb, 0, sizeof(guint16), "IPHC Header"); + ti = proto_tree_add_text(tree, tvb, 0, (int)sizeof(guint16), "IPHC Header"); iphc_tree = proto_item_add_subtree(ti, ett_6lowpan_iphc); /* Display the pattern. */ @@ -1395,20 +1395,20 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d iphc_dst_mode = (iphc_flags & LOWPAN_IPHC_FLAG_DST_MODE) >> LOWPAN_IPHC_FLAG_OFFSET_DST_MODE; if (tree) { const value_string *dam_vs; - proto_tree_add_uint (iphc_tree, hf_6lowpan_iphc_flag_tf, tvb, offset, sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_FLOW); - proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_nhdr, tvb, offset, sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_NHDR); - proto_tree_add_uint (iphc_tree, hf_6lowpan_iphc_flag_hlim, tvb, offset, sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_HLIM); - proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_cid, tvb, offset, sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_CONTEXT_ID); - proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_sac, tvb, offset, sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_SRC_COMP); - proto_tree_add_uint(iphc_tree, hf_6lowpan_iphc_flag_sam, tvb, offset, sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_SRC_MODE); - proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_mcast, tvb, offset, sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_MCAST_COMP); - proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_dac, tvb, offset, sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_DST_COMP); + proto_tree_add_uint (iphc_tree, hf_6lowpan_iphc_flag_tf, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_FLOW); + proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_nhdr, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_NHDR); + proto_tree_add_uint (iphc_tree, hf_6lowpan_iphc_flag_hlim, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_HLIM); + proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_cid, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_CONTEXT_ID); + proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_sac, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_SRC_COMP); + proto_tree_add_uint(iphc_tree, hf_6lowpan_iphc_flag_sam, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_SRC_MODE); + proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_mcast, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_MCAST_COMP); + proto_tree_add_boolean (iphc_tree, hf_6lowpan_iphc_flag_dac, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_DST_COMP); /* Destination address mode changes meanings depending on multicast compression. */ dam_vs = (iphc_flags & LOWPAN_IPHC_FLAG_MCAST_COMP) ? (lowpan_iphc_mcast_modes) : (lowpan_iphc_addr_modes); - ti_dam = proto_tree_add_uint_format_value(iphc_tree, hf_6lowpan_iphc_flag_dam, tvb, offset, sizeof(guint16), + ti_dam = proto_tree_add_uint_format_value(iphc_tree, hf_6lowpan_iphc_flag_dam, tvb, offset, (int)sizeof(guint16), iphc_flags & LOWPAN_IPHC_FLAG_DST_MODE, "%s (0x%04x)", val_to_str_const(iphc_dst_mode, dam_vs, "Reserved"), iphc_dst_mode); } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); /* Display the context identifier extension, if present. */ if (iphc_flags & LOWPAN_IPHC_FLAG_CONTEXT_ID) { @@ -1416,10 +1416,10 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d iphc_sci = (iphc_ctx & LOWPAN_IPHC_FLAG_SCI) >> LOWPAN_IPHC_FLAG_OFFSET_SCI; iphc_dci = (iphc_ctx & LOWPAN_IPHC_FLAG_DCI) >> LOWPAN_IPHC_FLAG_OFFSET_DCI; if (tree) { - proto_tree_add_uint(iphc_tree, hf_6lowpan_iphc_sci, tvb, offset, sizeof(guint8), iphc_ctx & LOWPAN_IPHC_FLAG_SCI); - proto_tree_add_uint(iphc_tree, hf_6lowpan_iphc_dci, tvb, offset, sizeof(guint8), iphc_ctx & LOWPAN_IPHC_FLAG_DCI); + proto_tree_add_uint(iphc_tree, hf_6lowpan_iphc_sci, tvb, offset, (int)sizeof(guint8), iphc_ctx & LOWPAN_IPHC_FLAG_SCI); + proto_tree_add_uint(iphc_tree, hf_6lowpan_iphc_dci, tvb, offset, (int)sizeof(guint8), iphc_ctx & LOWPAN_IPHC_FLAG_DCI); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } /* Use link-local contexts if stateless. */ if (!(iphc_flags & LOWPAN_IPHC_FLAG_SRC_COMP)) { @@ -1455,12 +1455,12 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d if ((tree) && (iphc_traffic != LOWPAN_IPHC_FLOW_COMPRESSED)) { /* Create a tree for the traffic class. */ proto_tree * tf_tree; - ti = proto_tree_add_uint(tree, hf_6lowpan_traffic_class, tvb, offset>>3, sizeof(guint8), ipv6_class); + ti = proto_tree_add_uint(tree, hf_6lowpan_traffic_class, tvb, offset>>3, (int)sizeof(guint8), ipv6_class); tf_tree = proto_item_add_subtree(ti, ett_6lopwan_traffic_class); /* Add the ECN and DSCP fields. */ - proto_tree_add_uint(tf_tree, hf_6lowpan_ecn, tvb, offset>>3, sizeof(guint8), ipv6_class & LOWPAN_IPHC_TRAFFIC_ECN); - proto_tree_add_uint(tf_tree, hf_6lowpan_dscp, tvb, offset>>3, sizeof(guint8), ipv6_class & LOWPAN_IPHC_TRAFFIC_DSCP); + proto_tree_add_uint(tf_tree, hf_6lowpan_ecn, tvb, offset>>3, (int)sizeof(guint8), ipv6_class & LOWPAN_IPHC_TRAFFIC_ECN); + proto_tree_add_uint(tf_tree, hf_6lowpan_dscp, tvb, offset>>3, (int)sizeof(guint8), ipv6_class & LOWPAN_IPHC_TRAFFIC_DSCP); } /* Parse and display the traffic label. */ @@ -1490,10 +1490,10 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d if (!(iphc_flags & LOWPAN_IPHC_FLAG_NHDR)) { ipv6.ip6_nxt = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_uint_format(tree, hf_6lowpan_next_header, tvb, offset, sizeof(guint8), ipv6.ip6_nxt, + proto_tree_add_uint_format(tree, hf_6lowpan_next_header, tvb, offset, (int)sizeof(guint8), ipv6.ip6_nxt, "Next header: %s (0x%02x)", ipprotostr(ipv6.ip6_nxt), ipv6.ip6_nxt); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } /* Get the hop limit field, if present. */ @@ -1509,9 +1509,9 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d else { ipv6.ip6_hlim = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_uint(tree, hf_6lowpan_hop_limit, tvb, offset, sizeof(guint8), ipv6.ip6_hlim); + proto_tree_add_uint(tree, hf_6lowpan_hop_limit, tvb, offset, (int)sizeof(guint8), ipv6.ip6_hlim); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } /*===================================================== @@ -1531,17 +1531,17 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d /* Full Address inline. */ else if (iphc_src_mode == LOWPAN_IPHC_ADDR_FULL_INLINE) { if (!(iphc_flags & LOWPAN_IPHC_FLAG_SRC_COMP)) sctx = &lowpan_context_default; - length = sizeof(ipv6.ip6_src); + length = (int)sizeof(ipv6.ip6_src); tvb_memcpy(tvb, &ipv6.ip6_src, offset, length); } /* 64-bits inline. */ else if (iphc_src_mode == LOWPAN_IPHC_ADDR_64BIT_INLINE) { - length = sizeof(guint64); + length = (int)sizeof(guint64); tvb_memcpy(tvb, &ipv6.ip6_src.bytes[sizeof(ipv6.ip6_src) - length], offset, length); } /* 16-bits inline. */ else if (iphc_src_mode == LOWPAN_IPHC_ADDR_16BIT_INLINE) { - length = sizeof(guint16); + length = (int)sizeof(guint16); /* Format becomes ff:fe00:xxxx */ ipv6.ip6_src.bytes[11] = 0xff; ipv6.ip6_src.bytes[12] = 0xfe; @@ -1583,7 +1583,7 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d /* Stateless multicast compression. */ if ((iphc_flags & LOWPAN_IPHC_FLAG_MCAST_COMP) && !(iphc_flags & LOWPAN_IPHC_FLAG_DST_COMP)) { if (iphc_dst_mode == LOWPAN_IPHC_ADDR_FULL_INLINE) { - length = sizeof(ipv6.ip6_dst); + length = (int)sizeof(ipv6.ip6_dst); tvb_memcpy(tvb, &ipv6.ip6_dst.bytes[sizeof(ipv6.ip6_dst) - length], offset, length); } else if (iphc_dst_mode == LOWPAN_IPHC_MCAST_48BIT) { @@ -1657,17 +1657,17 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d /* Full Address inline. */ else if (iphc_dst_mode == LOWPAN_IPHC_ADDR_FULL_INLINE) { dctx = &lowpan_context_default; - length = sizeof(ipv6.ip6_dst); + length = (int)sizeof(ipv6.ip6_dst); tvb_memcpy(tvb, &ipv6.ip6_dst, offset, length); } /* 64-bits inline. */ else if (iphc_dst_mode == LOWPAN_IPHC_ADDR_64BIT_INLINE) { - length = sizeof(guint64); + length = (int)sizeof(guint64); tvb_memcpy(tvb, &ipv6.ip6_dst.bytes[sizeof(ipv6.ip6_dst) - length], offset, length); } /* 16-bits inline. */ else if (iphc_dst_mode == LOWPAN_IPHC_ADDR_16BIT_INLINE) { - length = sizeof(guint16); + length = (int)sizeof(guint16); /* Format becomes ff:fe00:xxxx */ ipv6.ip6_dst.bytes[11] = 0xff; ipv6.ip6_dst.bytes[12] = 0xfe; @@ -1710,7 +1710,7 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d ipv6.ip6_nxt = lowpan_parse_nhc_proto(tvb, offset); /* Parse the 6LoWPAN NHC fields. */ - nhdr_list = dissect_6lowpan_iphc_nhc(tvb, pinfo, tree, offset, dgram_size - sizeof(struct ip6_hdr), siid, diid); + nhdr_list = dissect_6lowpan_iphc_nhc(tvb, pinfo, tree, offset, dgram_size - (int)sizeof(struct ip6_hdr), siid, diid); } /* Create an extension header for the remaining payload. */ else { @@ -1723,7 +1723,7 @@ dissect_6lowpan_iphc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint d nhdr_list->reported = tvb_reported_length_remaining(tvb, offset); } else { - nhdr_list->reported = dgram_size - sizeof(struct ip6_hdr); + nhdr_list->reported = dgram_size - (int)sizeof(struct ip6_hdr); } tvb_memcpy(tvb, LOWPAN_NHDR_DATA(nhdr_list), offset, nhdr_list->length); } @@ -1776,7 +1776,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Create a tree for the IPv6 extension header. */ if (tree) { - ti = proto_tree_add_text(tree, tvb, offset, sizeof(guint16), "IPv6 extension header"); + ti = proto_tree_add_text(tree, tvb, offset, (int)sizeof(guint16), "IPv6 extension header"); nhc_tree = proto_item_add_subtree(ti, ett_6lowpan_nhc_ext); /* Display the NHC-UDP pattern. */ proto_tree_add_bits_item(nhc_tree, hf_6lowpan_nhc_pattern, tvb, offset<<3, LOWPAN_NHC_PATTERN_EXT_BITS, ENC_BIG_ENDIAN); @@ -1785,13 +1785,13 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Get and display the extension header compression flags. */ ext_flags = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_uint(nhc_tree, hf_6lowpan_nhc_ext_eid, tvb, offset, sizeof(guint8), ext_flags & LOWPAN_NHC_EXT_EID); - proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_ext_nh, tvb, offset, sizeof(guint8), ext_flags & LOWPAN_NHC_EXT_NHDR); + proto_tree_add_uint(nhc_tree, hf_6lowpan_nhc_ext_eid, tvb, offset, (int)sizeof(guint8), ext_flags & LOWPAN_NHC_EXT_EID); + proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_ext_nh, tvb, offset, (int)sizeof(guint8), ext_flags & LOWPAN_NHC_EXT_NHDR); if (ext_flags & LOWPAN_NHC_EXT_NHDR) { /* TODO: Flag a warning, the NH bit MUST be 0 when EID==0x7 (IP-in-IP). */ } } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Decode the remainder of the packet using IPHC encoding. */ iphc_tvb = dissect_6lowpan_iphc(tvb_new_subset_remaining(tvb, offset), pinfo, tree, dgram_size, siid, diid); @@ -1821,7 +1821,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Create a tree for the IPv6 extension header. */ if (tree) { - ti = proto_tree_add_text(tree, tvb, offset, sizeof(guint16), "IPv6 extension header"); + ti = proto_tree_add_text(tree, tvb, offset, (int)sizeof(guint16), "IPv6 extension header"); nhc_tree = proto_item_add_subtree(ti, ett_6lowpan_nhc_ext); /* Display the NHC-UDP pattern. */ proto_tree_add_bits_item(nhc_tree, hf_6lowpan_nhc_pattern, tvb, offset<<3, LOWPAN_NHC_PATTERN_EXT_BITS, ENC_BIG_ENDIAN); @@ -1830,31 +1830,31 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Get and display the extension header compression flags. */ ext_flags = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_uint(nhc_tree, hf_6lowpan_nhc_ext_eid, tvb, offset, sizeof(guint8), ext_flags & LOWPAN_NHC_EXT_EID); - proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_ext_nh, tvb, offset, sizeof(guint8), ext_flags & LOWPAN_NHC_EXT_NHDR); + proto_tree_add_uint(nhc_tree, hf_6lowpan_nhc_ext_eid, tvb, offset, (int)sizeof(guint8), ext_flags & LOWPAN_NHC_EXT_EID); + proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_ext_nh, tvb, offset, (int)sizeof(guint8), ext_flags & LOWPAN_NHC_EXT_NHDR); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Get and display the next header field, if present. */ if (!(ext_flags & LOWPAN_NHC_EXT_NHDR)) { ipv6_ext.ip6e_nxt = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_uint_format(nhc_tree, hf_6lowpan_nhc_ext_next, tvb, offset, sizeof(guint8), ipv6_ext.ip6e_nxt, + proto_tree_add_uint_format(nhc_tree, hf_6lowpan_nhc_ext_next, tvb, offset, (int)sizeof(guint8), ipv6_ext.ip6e_nxt, "Next header: %s (0x%02x)", ipprotostr(ipv6_ext.ip6e_nxt), ipv6_ext.ip6e_nxt); - proto_item_set_end(ti, tvb, offset+sizeof(guint8)); + proto_item_set_end(ti, tvb, offset+(int)sizeof(guint8)); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } /* Get and display the extension header length. */ ext_len = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_uint(nhc_tree, hf_6lowpan_nhc_ext_length, tvb, offset, sizeof(guint8), ext_len); + proto_tree_add_uint(nhc_tree, hf_6lowpan_nhc_ext_length, tvb, offset, (int)sizeof(guint8), ext_len); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Compute the length of the extension header padded to an 8-byte alignment. */ - length = sizeof(struct ip6_ext) + ext_len; + length = (int)sizeof(struct ip6_ext) + ext_len; length = (length + 7) & ~0x7; /* Create the next header structure for the IPv6 extension header. */ @@ -1881,7 +1881,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, nhc_tree); /* Copy the remainder, and truncate the real buffer length. */ - nhdr->length = tvb_length_remaining(tvb, offset) + sizeof(struct ip6_ext); + nhdr->length = tvb_length_remaining(tvb, offset) + (int)sizeof(struct ip6_ext); tvb_memcpy(tvb, LOWPAN_NHDR_DATA(nhdr) + sizeof(struct ip6_ext), offset, tvb_length_remaining(tvb, offset)); /* There is nothing more we can do. */ @@ -1900,7 +1900,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi * There are more LOWPAN_NHC structures to parse. Call ourself again * recursively to parse them and build the linked list. */ - nhdr->next = dissect_6lowpan_iphc_nhc(tvb, pinfo, tree, offset, dgram_size - ext_len - sizeof(struct ip6_ext), siid, diid); + nhdr->next = dissect_6lowpan_iphc_nhc(tvb, pinfo, tree, offset, dgram_size - ext_len - (int)sizeof(struct ip6_ext), siid, diid); } else { /* Create another next header structure for the remaining payload. */ @@ -1913,7 +1913,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi nhdr->next->reported = tvb_reported_length_remaining(tvb, offset); } else { - nhdr->next->reported = dgram_size - ext_len - sizeof(struct ip6_ext); + nhdr->next->reported = dgram_size - ext_len - (int)sizeof(struct ip6_ext); } tvb_memcpy(tvb, LOWPAN_NHDR_DATA(nhdr->next), offset, nhdr->next->length); } @@ -1933,7 +1933,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Create a tree for the UDP header. */ if (tree) { - ti = proto_tree_add_text(tree, tvb, 0, sizeof(guint8), "UDP header compression"); + ti = proto_tree_add_text(tree, tvb, 0, (int)sizeof(guint8), "UDP header compression"); nhc_tree = proto_item_add_subtree(ti, ett_6lowpan_nhc_udp); /* Display the NHC-UDP pattern. */ proto_tree_add_bits_item(nhc_tree, hf_6lowpan_nhc_pattern, tvb, offset<<3, LOWPAN_NHC_PATTERN_UDP_BITS, ENC_BIG_ENDIAN); @@ -1942,11 +1942,11 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Get and display the UDP header compression options */ udp_flags = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_udp_checksum, tvb, offset, sizeof(guint8), udp_flags & LOWPAN_NHC_UDP_CHECKSUM); - proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_udp_src, tvb, offset, sizeof(guint8), udp_flags & LOWPAN_NHC_UDP_SRCPORT); - proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_udp_dst, tvb, offset, sizeof(guint8), udp_flags & LOWPAN_NHC_UDP_DSTPORT); + proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_udp_checksum, tvb, offset, (int)sizeof(guint8), udp_flags & LOWPAN_NHC_UDP_CHECKSUM); + proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_udp_src, tvb, offset, (int)sizeof(guint8), udp_flags & LOWPAN_NHC_UDP_SRCPORT); + proto_tree_add_boolean(nhc_tree, hf_6lowpan_nhc_udp_dst, tvb, offset, (int)sizeof(guint8), udp_flags & LOWPAN_NHC_UDP_DSTPORT); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Get and display the ports. */ switch (udp_flags & (LOWPAN_NHC_UDP_SRCPORT | LOWPAN_NHC_UDP_DSTPORT)) { @@ -1991,9 +1991,9 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Parse the checksum. */ udp.checksum = tvb_get_ntohs(tvb, offset); if (tree) { - proto_tree_add_uint(tree, hf_6lowpan_udp_checksum, tvb, offset, sizeof(guint16), udp.checksum); + proto_tree_add_uint(tree, hf_6lowpan_udp_checksum, tvb, offset, (int)sizeof(guint16), udp.checksum); } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); udp.checksum = g_ntohs(udp.checksum); } else { @@ -2003,7 +2003,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Compute the datagram length. */ if (dgram_size < 0) { length = tvb_reported_length_remaining(tvb, offset); - udp.length = g_htons(length + sizeof(struct udp_hdr)); + udp.length = g_htons(length + (int)sizeof(struct udp_hdr)); } else { udp.length = g_htons(dgram_size); @@ -2040,7 +2040,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi /* Fill in the pseudo-header. */ memcpy(&cksum_phdr.src, pinfo->src.data, sizeof(struct e_in6_addr)); memcpy(&cksum_phdr.dst, pinfo->dst.data, sizeof(struct e_in6_addr)); - cksum_phdr.length = g_htonl(length + sizeof(struct udp_hdr)); + cksum_phdr.length = g_htonl(length + (int)sizeof(struct udp_hdr)); memset(cksum_phdr.zero, 0, sizeof(cksum_phdr.zero)); cksum_phdr.proto = IP_PROTO_UDP; @@ -2061,7 +2061,7 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi nhdr = (struct lowpan_nhdr *)ep_alloc(sizeof(struct lowpan_nhdr) + sizeof(struct udp_hdr) + length); nhdr->next = NULL; nhdr->proto = IP_PROTO_UDP; - nhdr->length = length + sizeof(struct udp_hdr); + nhdr->length = length + (int)sizeof(struct udp_hdr); nhdr->reported = g_ntohs(udp.length); /* Copy the UDP header and payload into the buffer. */ @@ -2098,15 +2098,15 @@ dissect_6lowpan_bc0(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree) /* Create a tree for the broadcast header. */ if (tree) { - ti = proto_tree_add_text(tree, tvb, 0, sizeof(guint16), "Broadcast Header"); + ti = proto_tree_add_text(tree, tvb, 0, (int)sizeof(guint16), "Broadcast Header"); bcast_tree = proto_item_add_subtree(ti, ett_6lowpan_bcast); /* Get and display the pattern. */ proto_tree_add_bits_item(bcast_tree, hf_6lowpan_pattern, tvb, 0, LOWPAN_PATTERN_BC0_BITS, ENC_BIG_ENDIAN); /* Get and display the sequence number. */ - seqnum = tvb_get_guint8(tvb, sizeof(guint8)); - proto_tree_add_uint(bcast_tree, hf_6lowpan_bcast_seqnum, tvb, sizeof(guint8), sizeof(guint8), seqnum); + seqnum = tvb_get_guint8(tvb, (int)sizeof(guint8)); + proto_tree_add_uint(bcast_tree, hf_6lowpan_bcast_seqnum, tvb, (int)sizeof(guint8), (int)sizeof(guint8), seqnum); } /* Return the remaining buffer. */ @@ -2150,45 +2150,45 @@ dissect_6lowpan_mesh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree * flag_tree; /* Create the mesh header subtree. */ - flag_item = proto_tree_add_text(mesh_tree, tvb, offset, sizeof(guint8), "Flags"); + flag_item = proto_tree_add_text(mesh_tree, tvb, offset, (int)sizeof(guint8), "Flags"); flag_tree = proto_item_add_subtree(flag_item, ett_6lowpan_mesh); /* Add the mesh header fields. */ proto_tree_add_bits_item(flag_tree, hf_6lowpan_pattern, tvb, offset * 8, LOWPAN_PATTERN_MESH_BITS, ENC_BIG_ENDIAN); - proto_tree_add_boolean(flag_tree, hf_6lowpan_mesh_v, tvb, offset, sizeof(guint8), mesh_header & LOWPAN_MESH_HEADER_V); - proto_tree_add_boolean(flag_tree, hf_6lowpan_mesh_f, tvb, offset, sizeof(guint8), mesh_header & LOWPAN_MESH_HEADER_F); + proto_tree_add_boolean(flag_tree, hf_6lowpan_mesh_v, tvb, offset, (int)sizeof(guint8), mesh_header & LOWPAN_MESH_HEADER_V); + proto_tree_add_boolean(flag_tree, hf_6lowpan_mesh_f, tvb, offset, (int)sizeof(guint8), mesh_header & LOWPAN_MESH_HEADER_F); if ((mesh_header & LOWPAN_MESH_HEADER_HOPS)==15) { guint8 HopsLeft; - proto_tree_add_uint(flag_tree, hf_6lowpan_mesh_hops, tvb, offset, sizeof(guint8), mesh_header & LOWPAN_MESH_HEADER_HOPS); - offset += sizeof(guint8); + proto_tree_add_uint(flag_tree, hf_6lowpan_mesh_hops, tvb, offset, (int)sizeof(guint8), mesh_header & LOWPAN_MESH_HEADER_HOPS); + offset += (int)sizeof(guint8); HopsLeft=tvb_get_guint8(tvb, offset); - proto_tree_add_uint(mesh_tree, hf_6lowpan_mesh_hops8, tvb, offset, sizeof(guint8), HopsLeft); + proto_tree_add_uint(mesh_tree, hf_6lowpan_mesh_hops8, tvb, offset, (int)sizeof(guint8), HopsLeft); } else - proto_tree_add_uint(flag_tree, hf_6lowpan_mesh_hops, tvb, offset, sizeof(guint8), mesh_header & LOWPAN_MESH_HEADER_HOPS); + proto_tree_add_uint(flag_tree, hf_6lowpan_mesh_hops, tvb, offset, (int)sizeof(guint8), mesh_header & LOWPAN_MESH_HEADER_HOPS); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Get and display the originator address. */ if (!(mesh_header & LOWPAN_MESH_HEADER_V)) { guint64 addr64 = tvb_get_ntoh64(tvb, offset); if (tree) { - proto_tree_add_uint64(mesh_tree, hf_6lowpan_mesh_orig64, tvb, offset, sizeof(guint64), addr64); + proto_tree_add_uint64(mesh_tree, hf_6lowpan_mesh_orig64, tvb, offset, (int)sizeof(guint64), addr64); } - src_ifcid = tvb_get_ptr(tvb, offset, sizeof(guint64)); - offset += sizeof(guint64); + src_ifcid = tvb_get_ptr(tvb, offset, (int)sizeof(guint64)); + offset += (int)sizeof(guint64); } else { guint16 addr16 = tvb_get_ntohs(tvb, offset); guint8 * ifcid; if (tree) { - proto_tree_add_uint(mesh_tree, hf_6lowpan_mesh_orig16, tvb, offset, sizeof(guint16), addr16); + proto_tree_add_uint(mesh_tree, hf_6lowpan_mesh_orig16, tvb, offset, (int)sizeof(guint16), addr16); } ifcid = (guint8 *)wmem_alloc(pinfo->pool, sizeof(guint64)); lowpan_addr16_to_ifcid(addr16, ifcid); src_ifcid = ifcid; - offset += sizeof(guint16); + offset += (int)sizeof(guint16); } SET_ADDRESS(&pinfo->src, AT_EUI64, sizeof(guint64), src_ifcid); SET_ADDRESS(&pinfo->net_src, AT_EUI64, sizeof(guint64), src_ifcid); @@ -2197,21 +2197,21 @@ dissect_6lowpan_mesh(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!(mesh_header & LOWPAN_MESH_HEADER_F)) { guint64 addr64 = tvb_get_ntoh64(tvb, offset); if (tree) { - proto_tree_add_uint64(mesh_tree, hf_6lowpan_mesh_dest64, tvb, offset, sizeof(guint64), addr64); + proto_tree_add_uint64(mesh_tree, hf_6lowpan_mesh_dest64, tvb, offset, (int)sizeof(guint64), addr64); } - dst_ifcid = tvb_get_ptr(tvb, offset, sizeof(guint64)); - offset += sizeof(guint64); + dst_ifcid = tvb_get_ptr(tvb, offset, (int)sizeof(guint64)); + offset += (int)sizeof(guint64); } else { guint16 addr16 = tvb_get_ntohs(tvb, offset); guint8 * ifcid; if (tree) { - proto_tree_add_uint(mesh_tree, hf_6lowpan_mesh_dest16, tvb, offset, sizeof(guint16), addr16); + proto_tree_add_uint(mesh_tree, hf_6lowpan_mesh_dest16, tvb, offset, (int)sizeof(guint16), addr16); } - ifcid = (guint8 *)wmem_alloc(pinfo->pool, sizeof(guint64)); + ifcid = (guint8 *)wmem_alloc(pinfo->pool, (int)sizeof(guint64)); lowpan_addr16_to_ifcid(addr16, ifcid); dst_ifcid = ifcid; - offset += sizeof(guint16); + offset += (int)sizeof(guint16); } SET_ADDRESS(&pinfo->dst, AT_EUI64, sizeof(guint64), dst_ifcid); SET_ADDRESS(&pinfo->net_dst, AT_EUI64, sizeof(guint64), dst_ifcid); @@ -2270,16 +2270,16 @@ dissect_6lowpan_frag_first(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dgram_size = tvb_get_bits16(tvb, (offset * 8) + LOWPAN_PATTERN_FRAG_BITS, LOWPAN_FRAG_DGRAM_SIZE_BITS, ENC_BIG_ENDIAN); if (tree) { proto_tree_add_bits_item(frag_tree, hf_6lowpan_pattern, tvb, offset * 8, LOWPAN_PATTERN_FRAG_BITS, ENC_BIG_ENDIAN); - length_item = proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_size, tvb, offset, sizeof(guint16), dgram_size); + length_item = proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_size, tvb, offset, (int)sizeof(guint16), dgram_size); } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); /* Get and display the datagram tag. */ dgram_tag = tvb_get_ntohs(tvb, offset); if (tree) { - proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_tag, tvb, offset, sizeof(guint16), dgram_tag); + proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_tag, tvb, offset, (int)sizeof(guint16), dgram_tag); } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); /* Adjust the fragmentation header length. */ if (tree) { @@ -2390,23 +2390,23 @@ dissect_6lowpan_frag_middle(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) dgram_size = tvb_get_bits16(tvb, (offset * 8) + LOWPAN_PATTERN_FRAG_BITS, LOWPAN_FRAG_DGRAM_SIZE_BITS, ENC_BIG_ENDIAN); if (tree) { proto_tree_add_bits_item(frag_tree, hf_6lowpan_pattern, tvb, offset * 8, LOWPAN_PATTERN_FRAG_BITS, ENC_BIG_ENDIAN); - proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_size, tvb, offset, sizeof(guint16), dgram_size); + proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_size, tvb, offset, (int)sizeof(guint16), dgram_size); } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); /* Get and display the datagram tag. */ dgram_tag = tvb_get_ntohs(tvb, offset); if (tree) { - proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_tag, tvb, offset, sizeof(guint16), dgram_tag); + proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_tag, tvb, offset, (int)sizeof(guint16), dgram_tag); } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); /* Get and display the datagram offset. */ dgram_offset = tvb_get_guint8(tvb, offset) * 8; if (tree) { - proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_offset, tvb, offset, sizeof(guint8), dgram_offset); + proto_tree_add_uint(frag_tree, hf_6lowpan_frag_dgram_offset, tvb, offset, (int)sizeof(guint8), dgram_offset); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Adjust the fragmentation header length. */ frag_size = tvb_reported_length_remaining(tvb, offset); @@ -2465,7 +2465,7 @@ dissect_6lowpan_unknown(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } /* Create a tvbuff subset for the remaining data. */ - data_tvb = tvb_new_subset_remaining(tvb, sizeof(guint8)); + data_tvb = tvb_new_subset_remaining(tvb, (int)sizeof(guint8)); call_dissector(data_handle, data_tvb, pinfo, proto_tree_get_root(tree)); } /* dissect_6lowpan_unknown */ diff --git a/epan/dissectors/packet-aarp.c b/epan/dissectors/packet-aarp.c index a4f9c511f2..bf67abc996 100644 --- a/epan/dissectors/packet-aarp.c +++ b/epan/dissectors/packet-aarp.c @@ -111,7 +111,7 @@ tvb_atalkid_to_str(tvbuff_t *tvb, gint offset) return cur; } -static gchar * +static const gchar * tvb_aarphrdaddr_to_str(tvbuff_t *tvb, gint offset, int ad_len, guint16 type) { if (AARP_HW_IS_ETHER(type, ad_len)) { @@ -151,7 +151,7 @@ dissect_aarp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *ti; const gchar *op_str; int sha_offset, spa_offset, tha_offset, tpa_offset; - gchar *sha_str, *spa_str, /* *tha_str, */ *tpa_str; + const gchar *sha_str, *spa_str, /* *tha_str, */ *tpa_str; col_set_str(pinfo->cinfo, COL_PROTOCOL, "AARP"); col_clear(pinfo->cinfo, COL_INFO); diff --git a/epan/dissectors/packet-actrace.c b/epan/dissectors/packet-actrace.c index e14976308f..a4af536afd 100644 --- a/epan/dissectors/packet-actrace.c +++ b/epan/dissectors/packet-actrace.c @@ -498,7 +498,7 @@ static void dissect_actrace_cas(tvbuff_t *tvb, packet_info *pinfo, proto_tree *a /* Declare variables */ gint32 value, function, trunk, bchannel, source, event, curr_state, next_state; gint32 par0, par1, par2; - gchar *frame_label = NULL; + const gchar *frame_label = NULL; int direction = 0; int offset = 0; diff --git a/epan/dissectors/packet-actrace.h b/epan/dissectors/packet-actrace.h index 48db97d5d3..b87275f2f4 100644 --- a/epan/dissectors/packet-actrace.h +++ b/epan/dissectors/packet-actrace.h @@ -31,6 +31,6 @@ typedef struct _actrace_info_t int direction; /* direction BLADE_TO_PSTN=0 PSTN_TO_BLADE=1 */ int trunk; gint32 cas_bchannel; - gchar *cas_frame_label; + const gchar *cas_frame_label; } actrace_info_t; diff --git a/epan/dissectors/packet-adwin.c b/epan/dissectors/packet-adwin.c index 29dd0b7aac..abfbaf1aca 100644 --- a/epan/dissectors/packet-adwin.c +++ b/epan/dissectors/packet-adwin.c @@ -868,7 +868,7 @@ dissect_UDPR2(tvbuff_t *tvb, packet_info *pinfo, for (i = 0; i < 250; i++) { proto_item *item; - guint32 offset = 8 + i * sizeof(guint32); + guint32 offset = 8 + i * (int)sizeof(guint32); gint32 value = tvb_get_letohl(tvb, offset); void * fvalue = &value; proto_tree_add_text(adwin_debug_tree, tvb, offset, 4, @@ -907,7 +907,7 @@ dissect_UDPR3(tvbuff_t *tvb, packet_info *pinfo, for (i = 0; i < 350; i++) { proto_item *item; - guint32 offset = 8 + i * sizeof(guint32); + guint32 offset = 8 + i * (int)sizeof(guint32); gint32 value = tvb_get_letohl(tvb, offset); void * fvalue = &value; proto_tree_add_text(adwin_debug_tree, tvb, offset, 4, @@ -959,7 +959,7 @@ dissect_UDPR4(tvbuff_t *tvb, packet_info *pinfo, for (i = 0; i < 350; i++) { proto_item *item; - guint32 offset = 8 + i * sizeof(guint32); + guint32 offset = 8 + i * (int)sizeof(guint32); gint32 value = tvb_get_letohl(tvb, offset); void * fvalue = &value; switch (data_type) { @@ -1018,7 +1018,7 @@ dissect_GDSHP(tvbuff_t *tvb, packet_info *pinfo, for (i = 0; i < 336; i++) { proto_item *item; - guint32 offset = 12 + i * sizeof(guint32); + guint32 offset = 12 + i * (int)sizeof(guint32); gint32 value = tvb_get_letohl(tvb, offset); void * fvalue = &value; proto_tree_add_text(adwin_debug_tree, tvb, offset, 4, diff --git a/epan/dissectors/packet-bacapp.c b/epan/dissectors/packet-bacapp.c index 6a9c7e2fed..4978faca0e 100644 --- a/epan/dissectors/packet-bacapp.c +++ b/epan/dissectors/packet-bacapp.c @@ -4658,7 +4658,7 @@ register_bacapp_stat_trees(void) /* 'data' must be ep_ allocated */ static gint -updateBacnetInfoValue(gint whichval, gchar *data) +updateBacnetInfoValue(gint whichval, const gchar *data) { if (whichval == BACINFO_SERVICE) { bacinfo.service_type = data; diff --git a/epan/dissectors/packet-bacapp.h b/epan/dissectors/packet-bacapp.h index 8d48065d1f..3cac1acb5d 100644 --- a/epan/dissectors/packet-bacapp.h +++ b/epan/dissectors/packet-bacapp.h @@ -33,10 +33,10 @@ /* Used for BACnet statistics */ typedef struct _bacapp_info_value_t { - gchar *service_type; - gchar *invoke_id; - gchar *instance_ident; - gchar *object_ident; + const gchar *service_type; + const gchar *invoke_id; + const gchar *instance_ident; + const gchar *object_ident; } bacapp_info_value_t; #endif /* __PACKET_BACNET_H__ */ diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c index 5b5544abc2..d29b76e0ff 100644 --- a/epan/dissectors/packet-bootp.c +++ b/epan/dissectors/packet-bootp.c @@ -3974,7 +3974,7 @@ dissect_packetcable_mta_cap(proto_tree *v_tree, tvbuff_t *tvb, int voff, int len if (raw_val == PKT_MDC_PROV_FLOWS) { for (i = 0 ; i < 3; i++) { if (flow_val & pkt_mdc_supp_flow_vals[i].value) { - decode_bitfield_value(bit_fld, flow_val, pkt_mdc_supp_flow_vals[i].value, 16); + decode_bitfield_value(bit_fld, (guint32)flow_val, pkt_mdc_supp_flow_vals[i].value, 16); proto_tree_add_text(subtree, tvb, off + 4, 4, "%s%s", bit_fld, pkt_mdc_supp_flow_vals[i].strptr); } diff --git a/epan/dissectors/packet-bpdu.c b/epan/dissectors/packet-bpdu.c index 90ff515a0f..dc4140669a 100644 --- a/epan/dissectors/packet-bpdu.c +++ b/epan/dissectors/packet-bpdu.c @@ -228,11 +228,11 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 flags; guint16 root_identifier_bridge_priority; guint16 root_identifier_system_id_extension = 0; - gchar *root_identifier_mac_str; + const gchar *root_identifier_mac_str; guint32 root_path_cost; guint16 bridge_identifier_bridge_priority; guint16 bridge_identifier_system_id_extension = 0; - gchar *bridge_identifier_mac_str; + const gchar *bridge_identifier_mac_str; guint16 port_identifier; double message_age; double max_age; @@ -245,12 +245,12 @@ dissect_bpdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint8 config_format_selector; guint16 cist_bridge_identifier_bridge_priority; guint16 cist_bridge_identifier_system_id_extension = 0; - gchar *cist_bridge_identifier_mac_str; + const gchar *cist_bridge_identifier_mac_str; guint16 msti_mstid; guint32 msti_regional_root_mstid, msti_regional_root_priority; - gchar *msti_regional_root_mac_str; + const gchar *msti_regional_root_mac_str; guint16 msti_bridge_identifier_priority, msti_port_identifier_priority; - gchar *msti_bridge_identifier_mac_str; + const gchar *msti_bridge_identifier_mac_str; int total_msti_length, offset, msti, msti_format; int msti_length_remaining; guint8 agree_num = 0, dagree_num = 0; diff --git a/epan/dissectors/packet-bt-dht.c b/epan/dissectors/packet-bt-dht.c index 504164a504..b129fcc3a6 100644 --- a/epan/dissectors/packet-bt-dht.c +++ b/epan/dissectors/packet-bt-dht.c @@ -159,7 +159,7 @@ dissect_bencoded_int(tvbuff_t *tvb, packet_info _U_*pinfo, proto_tree *tree, gui } /* pre definition of dissect_bencoded_dict(), which is needed by dissect_bencoded_list() */ -static int dissect_bencoded_dict(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, char *label ); +static int dissect_bencoded_dict(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, const char *label ); /* dissect a bencoded list from tvb, start at offset. it's like "lXXXe", "X" is any bencoded thing */ static int @@ -285,7 +285,7 @@ dissect_bt_dht_values(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint } static int -dissect_bt_dht_nodes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, char **result, char *label ) +dissect_bt_dht_nodes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, char **result, const char *label ) { proto_item *ti; proto_tree *sub_tree; @@ -428,7 +428,7 @@ dissect_bencoded_dict_entry(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* dict = d...e */ static int -dissect_bencoded_dict(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, char *label ) +dissect_bencoded_dict(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, const char *label ) { proto_item *ti; proto_tree *sub_tree; diff --git a/epan/dissectors/packet-btsap.c b/epan/dissectors/packet-btsap.c index 848707b019..6a20549806 100644 --- a/epan/dissectors/packet-btsap.c +++ b/epan/dissectors/packet-btsap.c @@ -565,26 +565,26 @@ dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (parameters_check < required_parameters) { - gchar *error_message = "There is no required parameters"; - pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message, NULL); + static const gchar error_message[] = "There are no required parameters"; + pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message); PROTO_ITEM_SET_GENERATED(pitem); - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message, NULL); + expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message); } else if (parameters_check > required_parameters) { - gchar *error_message = "Invalid parameters"; - pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message, NULL); + static const gchar error_message[] = "Invalid parameters"; + pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message); PROTO_ITEM_SET_GENERATED(pitem); - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message, NULL); + expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message); } if (number_of_parameters < required_parameters) { - gchar *error_message = "Too few parameters"; - pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message, NULL); + static const gchar error_message[] = "Too few parameters"; + pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message); PROTO_ITEM_SET_GENERATED(pitem); - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message, NULL); + expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message); } else if (number_of_parameters > required_parameters) { - gchar *error_message = "Too many parameters"; - pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message, NULL); + static const gchar error_message[] = "Too many parameters"; + pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message); PROTO_ITEM_SET_GENERATED(pitem); - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message, NULL); + expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message); } if (tvb_length(tvb) > offset) { diff --git a/epan/dissectors/packet-collectd.c b/epan/dissectors/packet-collectd.c index f95f4bd732..f1cee8f5e3 100644 --- a/epan/dissectors/packet-collectd.c +++ b/epan/dissectors/packet-collectd.c @@ -88,7 +88,7 @@ struct string_counter_s; typedef struct string_counter_s string_counter_t; struct string_counter_s { - gchar *string; + const gchar *string; gint count; string_counter_t *next; }; diff --git a/epan/dissectors/packet-cops.c b/epan/dissectors/packet-cops.c index 4eeac3f4b7..0d41b09444 100644 --- a/epan/dissectors/packet-cops.c +++ b/epan/dissectors/packet-cops.c @@ -1058,7 +1058,7 @@ static int dissect_cops_object(tvbuff_t *tvb, packet_info *pinfo, guint8 op_code /* Pad to 32bit boundary */ if (object_len % sizeof (guint32)) - object_len += (sizeof (guint32) - object_len % sizeof (guint32)); + object_len += ((int)sizeof (guint32) - object_len % (int)sizeof (guint32)); return object_len; } @@ -1116,7 +1116,7 @@ static void dissect_cops_pr_objects(tvbuff_t *tvb, packet_info *pinfo, guint32 o /* Pad to 32bit boundary */ if (object_len % sizeof (guint32)) - object_len += (sizeof (guint32) - object_len % sizeof (guint32)); + object_len += ((int)sizeof (guint32) - object_len % (int)sizeof (guint32)); pr_len -= object_len - COPS_OBJECT_HDR_SIZE; offset += object_len - COPS_OBJECT_HDR_SIZE; @@ -1163,7 +1163,7 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32 offset += 4; } else if (c_type == 2) { /* IPv6 */ tvb_get_ipv6(tvb, offset, &ipv6addr); - ifindex = tvb_get_ntohl(tvb, offset + sizeof ipv6addr); + ifindex = tvb_get_ntohl(tvb, offset + (int)sizeof ipv6addr); ti = proto_tree_add_text(tree, tvb, offset, 20, "Contents: IPv6 address %s, ifIndex: %u", ip6_to_str(&ipv6addr), ifindex); itf_tree = proto_item_add_subtree(ti, ett_cops_itf); @@ -1304,7 +1304,7 @@ static void dissect_cops_object_data(tvbuff_t *tvb, packet_info *pinfo, guint32 offset += 4; } else if (c_type == 2) { /* IPv6 */ tvb_get_ipv6(tvb, offset, &ipv6addr); - tcp_port = tvb_get_ntohs(tvb, offset + sizeof ipv6addr + 2); + tcp_port = tvb_get_ntohs(tvb, offset + (int)sizeof ipv6addr + 2); ti = proto_tree_add_text(tree, tvb, offset, 20, "Contents: IPv6 address %s, TCP Port Number: %u", ip6_to_str(&ipv6addr), tcp_port); pdp_tree = proto_item_add_subtree(ti, ett_cops_pdp); diff --git a/epan/dissectors/packet-csm-encaps.c b/epan/dissectors/packet-csm-encaps.c index baefcd38b2..38c7dee399 100644 --- a/epan/dissectors/packet-csm-encaps.c +++ b/epan/dissectors/packet-csm-encaps.c @@ -155,7 +155,7 @@ static gint ett_csm_encaps_control = -1; /* returns the command name */ -static gchar * +static const gchar * csm_fc(guint16 fc, guint16 ct) { if (fc == 0x0000) { @@ -196,7 +196,7 @@ dissect_csm_encaps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint control, type, sequence, length; guint i; gboolean show_error_param= FALSE; - gchar *str_function_name; + const gchar *str_function_name; function_code = tvb_get_letohs(tvb, 10); diff --git a/epan/dissectors/packet-csn1.h b/epan/dissectors/packet-csn1.h index c7acea4ce0..fd32a868e9 100644 --- a/epan/dissectors/packet-csn1.h +++ b/epan/dissectors/packet-csn1.h @@ -179,9 +179,9 @@ typedef struct gint16 i; union { - void* ptr; + const void* ptr; guint32 value; - crumb_spec_t const *crumb_spec; + const crumb_spec_t const *crumb_spec; } descr; size_t offset; gboolean may_be_null; diff --git a/epan/dissectors/packet-data.c b/epan/dissectors/packet-data.c index 9a32c269f6..6e9370a6ea 100644 --- a/epan/dissectors/packet-data.c +++ b/epan/dissectors/packet-data.c @@ -81,7 +81,7 @@ dissect_data(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree) const guint8 *cp; md5_state_t md_ctx; md5_byte_t digest[16]; - gchar *digest_string; + const gchar *digest_string; cp = tvb_get_ptr(tvb, 0, bytes); diff --git a/epan/dissectors/packet-dbus.c b/epan/dissectors/packet-dbus.c index a7cb69d2e6..36c7f04002 100644 --- a/epan/dissectors/packet-dbus.c +++ b/epan/dissectors/packet-dbus.c @@ -111,7 +111,7 @@ typedef struct { guint32 body_len; guint32 fields_len; - char *body_sig; + const char *body_sig; } dbus_info_t; typedef union { diff --git a/epan/dissectors/packet-dcc.c b/epan/dissectors/packet-dcc.c index 7f8532d75f..a13b14fcb3 100644 --- a/epan/dissectors/packet-dcc.c +++ b/epan/dissectors/packet-dcc.c @@ -78,8 +78,8 @@ static gint ett_dcc_trace = -1; /* Utility macros */ #define D_SIGNATURE() \ proto_tree_add_item(dcc_optree, hf_dcc_signature, tvb, \ - offset, sizeof(DCC_SIGNATURE), ENC_NA); \ - offset += sizeof(DCC_SIGNATURE); + offset, (int)sizeof(DCC_SIGNATURE), ENC_NA); \ + offset += (int)sizeof(DCC_SIGNATURE); #define D_LABEL(label,len) \ proto_tree_add_text(dcc_optree, tvb, offset, len, label); \ @@ -100,12 +100,9 @@ static gint ett_dcc_trace = -1; #define D_TARGET() \ - hidden_item = proto_tree_add_item(dcc_tree, hf_dcc_target, tvb, \ - offset, sizeof(DCC_TGTS), ENC_BIG_ENDIAN); \ - PROTO_ITEM_SET_HIDDEN(hidden_item); \ - proto_tree_add_text(dcc_optree, tvb, offset, sizeof(DCC_TGTS), "%s", \ - val_to_str(tvb_get_ntohl(tvb,offset), dcc_target_vals, "Targets (%u)")); \ - offset += sizeof(DCC_TGTS); \ + proto_tree_add_item(dcc_tree, hf_dcc_target, tvb, \ + offset, (int)sizeof(DCC_TGTS), ENC_BIG_ENDIAN); \ + offset += (int)sizeof(DCC_TGTS); #define D_DATE() { \ nstime_t ts; \ @@ -118,7 +115,7 @@ static gint ett_dcc_trace = -1; #define D_CHECKSUM() { \ proto_tree *cktree, *ckti; \ - ckti = proto_tree_add_text(dcc_optree, tvb, offset, sizeof(DCC_CK), \ + ckti = proto_tree_add_text(dcc_optree, tvb, offset, (int)sizeof(DCC_CK), \ "Checksum - %s", val_to_str(tvb_get_guint8(tvb,offset), \ dcc_cktype_vals, \ "Unknown Type: %u")); \ @@ -128,8 +125,8 @@ static gint ett_dcc_trace = -1; proto_tree_add_item(cktree, hf_dcc_ck_len, tvb, offset, 1, ENC_BIG_ENDIAN); \ offset += 1; \ proto_tree_add_item(cktree, hf_dcc_ck_sum, tvb, offset, \ - sizeof(DCC_SUM), ENC_NA); \ - offset += sizeof(DCC_SUM); \ + (int)sizeof(DCC_SUM), ENC_NA); \ + offset += (int)sizeof(DCC_SUM); \ } @@ -206,7 +203,6 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) { proto_tree *dcc_tree, *dcc_optree, *dcc_opnumtree, *ti; proto_tree *dcc_tracetree; - proto_item *hidden_item; int offset = 0; int client_is_le = 0; int op = 0; @@ -304,7 +300,7 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) case DCC_OP_REPORT: D_TARGET(); for (i=0; i<=DCC_QUERY_MAX && - tvb_bytes_exist(tvb, offset+sizeof(DCC_SIGNATURE),1); i++) + tvb_bytes_exist(tvb, offset+(int)sizeof(DCC_SIGNATURE),1); i++) { D_CHECKSUM(); } @@ -313,7 +309,7 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) case DCC_OP_QUERY_RESP: for (i=0; i<=DCC_QUERY_MAX && - tvb_bytes_exist(tvb, offset+sizeof(DCC_SIGNATURE),1); i++) + tvb_bytes_exist(tvb, offset+(int)sizeof(DCC_SIGNATURE),1); i++) { D_TARGET(); } @@ -324,17 +320,17 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) if ( is_response ) { int left_local = tvb_length_remaining(tvb, offset) - - sizeof(DCC_SIGNATURE); + (int)sizeof(DCC_SIGNATURE); if ( left_local == sizeof(DCC_ADMN_RESP_CLIENTS) ) { D_LABEL("Addr", 16); - D_LABEL("Id", sizeof(DCC_CLNT_ID)); + D_LABEL("Id", (int)sizeof(DCC_CLNT_ID)); D_LABEL("Last Used", 4); D_LABEL("Requests", 4); } else { - D_TEXT("Response Text", sizeof(DCC_SIGNATURE)); + D_TEXT("Response Text", (int)sizeof(DCC_SIGNATURE)); } D_SIGNATURE(); } @@ -397,8 +393,8 @@ dissect_dcc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) offset += 2; proto_tree_add_item(dcc_optree, hf_dcc_brand, tvb, - offset, sizeof(DCC_BRAND), ENC_ASCII|ENC_NA); - offset += sizeof(DCC_BRAND); + offset, (int)sizeof(DCC_BRAND), ENC_ASCII|ENC_NA); + offset += (int)sizeof(DCC_BRAND); D_SIGNATURE(); break; @@ -478,7 +474,7 @@ proto_register_dcc(void) { &hf_dcc_target, { "Target", "dcc.target", FT_UINT32, BASE_HEX, - NULL, 0, NULL, HFILL }}, + VALS(dcc_target_vals), 0, NULL, HFILL }}, { &hf_dcc_date, { "Date", "dcc.date", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, diff --git a/epan/dissectors/packet-dccp.c b/epan/dissectors/packet-dccp.c index 380e4e713c..5939054ed3 100644 --- a/epan/dissectors/packet-dccp.c +++ b/epan/dissectors/packet-dccp.c @@ -624,7 +624,7 @@ dccp_csum_coverage(const e_dccphdr *dccph, guint len) if (dccph->cscov == 0) return len; - cov = (dccph->data_offset + dccph->cscov - 1) * sizeof (guint32); + cov = (dccph->data_offset + dccph->cscov - 1) * (guint)sizeof (guint32); return (cov > len) ? len : cov; } diff --git a/epan/dissectors/packet-dcerpc-netlogon.c b/epan/dissectors/packet-dcerpc-netlogon.c index ef7031f878..7b394309a7 100644 --- a/epan/dissectors/packet-dcerpc-netlogon.c +++ b/epan/dissectors/packet-dcerpc-netlogon.c @@ -6849,7 +6849,7 @@ static guint32 get_keytab_as_list(md4_pass **p_pass_list,const char* ntlm_pass _ if (ntlm_pass[0] != '\0' && ( strlen(ntlm_pass) < 129 )) { nb_pass++; debugprintf("Password: %s\n",ntlm_pass); - password_len = strlen(ntlm_pass); + password_len = (int)strlen(ntlm_pass); str_to_unicode(ntlm_pass,ntlm_pass_unicode); crypt_md4(ntlm_pass_hash.md4,ntlm_pass_unicode,password_len*2); printnbyte(ntlm_pass_hash.md4,16,"Hash of the NT pass: ","\n"); diff --git a/epan/dissectors/packet-dcerpc-nt.c b/epan/dissectors/packet-dcerpc-nt.c index c64ff1a49a..f0da4686e9 100644 --- a/epan/dissectors/packet-dcerpc-nt.c +++ b/epan/dissectors/packet-dcerpc-nt.c @@ -1143,7 +1143,7 @@ PIDL_dissect_policy_hnd(tvbuff_t *tvb, gint offset, packet_info *pinfo, && !pinfo->fd->flags.visited && !di->conformant_run){ char *pol_string=NULL; - char *pol_name=NULL; + const char *pol_name=NULL; dcerpc_call_value *dcv; dcv = (dcerpc_call_value *)di->call_data; diff --git a/epan/dissectors/packet-dcerpc.c b/epan/dissectors/packet-dcerpc.c index b58c2a9a10..2931ae65a8 100644 --- a/epan/dissectors/packet-dcerpc.c +++ b/epan/dissectors/packet-dcerpc.c @@ -4348,7 +4348,7 @@ dissect_dcerpc_cn(tvbuff_t *tvb, int offset, packet_info *pinfo, hdr.flags = tvb_get_guint8(tvb, offset++); tvb_memcpy(tvb, (guint8 *)hdr.drep, offset, sizeof (hdr.drep)); - offset += sizeof (hdr.drep); + offset += (int)sizeof (hdr.drep); hdr.frag_len = dcerpc_tvb_get_ntohs(tvb, offset, hdr.drep); offset += 2; @@ -4441,7 +4441,7 @@ dissect_dcerpc_cn(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree_add_uint(drep_tree, hf_dcerpc_drep_byteorder, tvb, offset, 1, hdr.drep[0] >> 4); proto_tree_add_uint(drep_tree, hf_dcerpc_drep_character, tvb, offset, 1, hdr.drep[0] & 0x0f); proto_tree_add_uint(drep_tree, hf_dcerpc_drep_fp, tvb, offset+1, 1, hdr.drep[1]); - offset += sizeof (hdr.drep); + offset += (int)sizeof (hdr.drep); proto_tree_add_uint(dcerpc_tree, hf_dcerpc_cn_frag_len, tvb, offset, 2, hdr.frag_len); offset += 2; @@ -5201,7 +5201,7 @@ dissect_dcerpc_dg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat col_add_str(pinfo->cinfo, COL_INFO, pckt_vals[hdr.ptype].strptr); tvb_memcpy(tvb, (guint8 *)hdr.drep, offset, sizeof (hdr.drep)); - offset += sizeof (hdr.drep); + offset += (int)sizeof (hdr.drep); hdr.serial_hi = tvb_get_guint8(tvb, offset++); dcerpc_tvb_get_uuid(tvb, offset, hdr.drep, &hdr.obj_id); offset += 16; @@ -5306,7 +5306,7 @@ dissect_dcerpc_dg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat val_to_str_const(hdr.drep[1], drep_fp_vals, "Unknown")); } } - offset += sizeof (hdr.drep); + offset += (int)sizeof (hdr.drep); if (tree) proto_tree_add_uint(dcerpc_tree, hf_dcerpc_dg_serial_hi, tvb, offset, 1, hdr.serial_hi); diff --git a/epan/dissectors/packet-dcm.c b/epan/dissectors/packet-dcm.c index 3825726a2c..fc71cfa2cf 100644 --- a/epan/dissectors/packet-dcm.c +++ b/epan/dissectors/packet-dcm.c @@ -3712,7 +3712,7 @@ static guint32 dissect_dcm_pdv_header (tvbuff_t *tvb, packet_info *pinfo, p static guint32 dissect_dcm_pdv_fragmented (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_state_assoc_t *assoc, guint32 offset, guint32 pdv_len, gchar **pdv_description); static guint32 dissect_dcm_pdv_body (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_state_pdv_t *pdv, guint32 offset, guint32 pdv_body_len, gchar **pdv_description); -static guint32 dissect_dcm_tag (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_state_pdv_t *pdv, guint32 offset, guint32 endpos, gboolean is_first_tag, gchar **tag_description, gboolean *end_of_seq_or_item); +static guint32 dissect_dcm_tag (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_state_pdv_t *pdv, guint32 offset, guint32 endpos, gboolean is_first_tag, const gchar **tag_description, gboolean *end_of_seq_or_item); static guint32 dissect_dcm_tag_open (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_state_pdv_t *pdv, guint32 offset, guint32 endpos, gboolean *is_first_tag); static guint32 dissect_dcm_tag_value (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_state_pdv_t *pdv, guint32 offset, guint16 grp, guint16 elm, guint32 vl, guint32 vl_max, const gchar* vr, gchar **tag_value); @@ -4229,7 +4229,7 @@ dcm_export_create_tag_str(guint8 *buffer, guint32 bufflen, guint32 offset, static guint8* -dcm_export_create_header(guint32 *dcm_header_len, gchar *sop_class_uid, gchar *sop_instance_uid, gchar *xfer_uid) +dcm_export_create_header(guint32 *dcm_header_len, const gchar *sop_class_uid, gchar *sop_instance_uid, gchar *xfer_uid) { guint8 *dcm_header=NULL; guint32 offset=0; @@ -4317,7 +4317,7 @@ dcm_export_create_object(packet_info *pinfo, dcm_state_assoc_t *assoc, dcm_state gchar *filename; const gchar *hostname; - gchar *sop_class_uid; + const gchar *sop_class_uid; gchar *sop_instance_uid; /* Calculate total PDV length, i.e. all packets until last PDV without continuation */ @@ -4440,7 +4440,7 @@ dissect_dcm_assoc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu guint16 assoc_ver; - gchar *buf_desc = NULL; + const gchar *buf_desc = NULL; const char *reject_result_desc = ""; const char *reject_source_desc = ""; const char *reject_reason_desc = ""; @@ -4453,8 +4453,6 @@ dissect_dcm_assoc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu guint8 abort_source; guint8 abort_reason; - buf_desc = (gchar *)ep_alloc0(MAX_BUF_LEN); /* Valid for this packet */ - assoc_header_pitem = proto_tree_add_text(tree, tvb, offset, pdu_len-6, "Association Header"); assoc_header_ptree = proto_item_add_subtree(assoc_header_pitem, ett_assoc_header); @@ -4479,7 +4477,7 @@ dissect_dcm_assoc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu offset += 32; /* 32 reserved bytes */ - g_snprintf(buf_desc, MAX_BUF_LEN, "A-ASSOCIATE request %s --> %s", + buf_desc = ep_strdup_printf("A-ASSOCIATE request %s --> %s", g_strstrip(assoc->ae_calling), g_strstrip(assoc->ae_called)); offset = dissect_dcm_assoc_detail(tvb, pinfo, assoc_header_ptree, assoc, @@ -4506,7 +4504,7 @@ dissect_dcm_assoc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu offset += 32; /* 32 reserved bytes */ - g_snprintf(buf_desc, MAX_BUF_LEN, "A-ASSOCIATE accept %s <-- %s", + buf_desc = ep_strdup_printf("A-ASSOCIATE accept %s <-- %s", g_strstrip(assoc->ae_calling_resp), g_strstrip(assoc->ae_called_resp)); offset = dissect_dcm_assoc_detail(tvb, pinfo, assoc_header_ptree, assoc, @@ -4565,7 +4563,7 @@ dissect_dcm_assoc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu offset += 3; /* Provider aborted */ - g_snprintf(buf_desc, MAX_BUF_LEN,"A-ASSOCIATE reject %s <-- %s (%s)", + buf_desc = ep_strdup_printf("A-ASSOCIATE reject %s <-- %s (%s)", g_strstrip(assoc->ae_calling), g_strstrip(assoc->ae_called), reject_reason_desc); expert_add_info_format(pinfo, assoc_header_pitem, @@ -4623,12 +4621,12 @@ dissect_dcm_assoc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gu if (abort_source == 0) { /* User aborted */ - g_snprintf(buf_desc, MAX_BUF_LEN,"ABORT %s --> %s", + buf_desc = ep_strdup_printf("ABORT %s --> %s", g_strstrip(assoc->ae_calling), g_strstrip(assoc->ae_called)); } else { /* Provider aborted, slightly more information */ - g_snprintf(buf_desc, MAX_BUF_LEN,"ABORT %s <-- %s (%s)", + buf_desc = ep_strdup_printf("ABORT %s <-- %s (%s)", g_strstrip(assoc->ae_calling), g_strstrip(assoc->ae_called), abort_reason_desc); } @@ -5625,7 +5623,7 @@ dcm_tag_summary(guint16 grp, guint16 elm, guint32 vl, const gchar *tag_desc, con static guint32 dissect_dcm_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, dcm_state_pdv_t *pdv, guint32 offset, guint32 endpos, - gboolean is_first_tag, gchar **tag_description, + gboolean is_first_tag, const gchar **tag_description, gboolean *end_of_seq_or_item) { /* Decode one tag. If it is a sequence or item start create a subtree. @@ -5921,7 +5919,7 @@ dissect_dcm_tag(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean local_end_of_seq_or_item = FALSE; gboolean is_first_desc = TRUE; - gchar *item_description = NULL; /* Will be allocated as ep_ memory in dissect_dcm_tag() */ + const gchar *item_description = NULL; /* Will be allocated as ep_ memory in dissect_dcm_tag() */ if (vl == 0xFFFFFFFF) { /* Undefined length */ @@ -6113,7 +6111,7 @@ dissect_dcm_pdv_body(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { /* Handle one PDV inside a data PDU */ - gchar *tag_value = NULL; + const gchar *tag_value = NULL; gboolean dummy = FALSE; guint32 endpos = 0; diff --git a/epan/dissectors/packet-disp.c b/epan/dissectors/packet-disp.c index 2d6c2ae9d8..fcb2445f9c 100644 --- a/epan/dissectors/packet-disp.c +++ b/epan/dissectors/packet-disp.c @@ -1509,7 +1509,7 @@ dissect_disp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_item *item=NULL; proto_tree *tree=NULL; int (*disp_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL; - char *disp_op_name; + const char *disp_op_name; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); diff --git a/epan/dissectors/packet-dmp.c b/epan/dissectors/packet-dmp.c index 959e3a8430..f04c39dc20 100644 --- a/epan/dissectors/packet-dmp.c +++ b/epan/dissectors/packet-dmp.c @@ -1674,7 +1674,7 @@ static gchar *dissect_7bit_string (tvbuff_t *tvb, gint offset, gint length) return (gchar *) decoded; } -static gchar *dissect_thales_mts_id (tvbuff_t *tvb, gint offset, gint length) +static const gchar *dissect_thales_mts_id (tvbuff_t *tvb, gint offset, gint length) { /* Thales XOmail uses this format: "MTA-NAME/000000000000" */ if (length >= 7 && length <= 22) { @@ -1687,7 +1687,7 @@ static gchar *dissect_thales_mts_id (tvbuff_t *tvb, gint offset, gint length) return ILLEGAL_FORMAT; } -static gchar *dissect_thales_ipm_id (tvbuff_t *tvb, gint offset, gint length, gint modifier) +static const gchar *dissect_thales_ipm_id (tvbuff_t *tvb, gint offset, gint length, gint modifier) { /* Thales XOmail uses this format: "0000 YYMMDDhhmmssZ" */ if (length >= 6 && length <= 20 && modifier >= 0 && modifier <= 2) { @@ -1842,12 +1842,12 @@ static gint dissect_dmp_sic (tvbuff_t *tvb, packet_info *pinfo, } else if ((key & 0xF0) == 0xB0) { /* bit 7-4: 1011 */ length = 7; bytes = 6; - value = ((guint64)tvb_get_ntohs (tvb, offset) & 0x0FFF) << 32 | + value = ((guint64)(tvb_get_ntohs (tvb, offset) & 0x0FFF)) << 32 | tvb_get_ntohl (tvb, offset + 2); } else if ((key & 0xF0) == 0x90) { /* bit 7-4: 1001 */ length = 8; bytes = 7; - value = ((guint64)(tvb_get_ntohl (tvb, offset)>>8) & 0x0FFF)<<32 | + value = ((guint64)((tvb_get_ntohl (tvb, offset)>>8) & 0x0FFF))<<32 | tvb_get_ntohl (tvb, offset + 3); } else { /* bit 7-4: 0xxx or 1000 */ length = 5; @@ -2692,7 +2692,7 @@ static gint dissect_mts_identifier (tvbuff_t *tvb, packet_info *pinfo _U_, proto gint offset, gboolean subject) { proto_item *hidden_item; - gchar *mts_id; + const gchar *mts_id; if (dmp.msg_id_type == X400_MSG_ID || dmp_nat_decode == NAT_DECODE_DMP) { mts_id = dissect_7bit_string (tvb, offset, dmp.mts_id_length); @@ -2725,7 +2725,7 @@ static gint dissect_ipm_identifier (tvbuff_t *tvb, packet_info *pinfo _U_, proto { proto_tree *field_tree; proto_item *tf, *hidden_item; - gchar *ipm_id; + const gchar *ipm_id; gint length, modifier, ipm_id_length; length = tvb_get_guint8 (tvb, offset); @@ -3491,7 +3491,8 @@ static gint dissect_dmp_notification (tvbuff_t *tvb, packet_info *pinfo _U_, /* Ref chapter 6.2.1.2.8 SecurityCategories */ static gint dissect_dmp_security_category (tvbuff_t *tvb, packet_info *pinfo, - proto_tree *tree, gchar **label_string, + proto_tree *tree, + const gchar **label_string, gint offset, guint8 ext) { proto_tree *field_tree = NULL; @@ -3602,7 +3603,7 @@ static gint dissect_dmp_content (tvbuff_t *tvb, packet_info *pinfo, proto_tree *field_tree = NULL; proto_item *en = NULL, *ei = NULL, *tf = NULL; proto_item *hidden_item; - gchar *label_string = ep_strdup (""); + const char *label_string = ep_strdup (""); const gchar *class_name = NULL; guint8 message, dmp_sec_pol, dmp_sec_class, dmp_nation = 0, exp_time, dtg; gint32 secs = 0; diff --git a/epan/dissectors/packet-dnp.c b/epan/dissectors/packet-dnp.c index 105e3f77c3..aa5a29f740 100644 --- a/epan/dissectors/packet-dnp.c +++ b/epan/dissectors/packet-dnp.c @@ -1487,7 +1487,7 @@ dnp3_al_get_timestamp(nstime_t *timestamp, tvbuff_t *tvb, int data_pos) time_ms = (guint64)hi * 0x10000 + lo; timestamp->secs = (long)(time_ms / 1000); - timestamp->nsecs = (long)(time_ms % 1000) * 1000000; + timestamp->nsecs = (int)(time_ms % 1000) * 1000000; } /*****************************************************************/ diff --git a/epan/dissectors/packet-dns.c b/epan/dissectors/packet-dns.c index 3c1d0dc134..8c462694ab 100644 --- a/epan/dissectors/packet-dns.c +++ b/epan/dissectors/packet-dns.c @@ -625,7 +625,7 @@ dns_type_name (guint type) return val_to_str(type, dns_types, "Unknown (%u)"); } -static char * +static const char * dns_type_description (guint type) { static const char *type_names[] = { diff --git a/epan/dissectors/packet-dop.c b/epan/dissectors/packet-dop.c index 8c32d65d1f..d6a4155585 100644 --- a/epan/dissectors/packet-dop.c +++ b/epan/dissectors/packet-dop.c @@ -68,7 +68,7 @@ static int proto_dop = -1; static struct SESSION_DATA_STRUCTURE* session = NULL; static const char *binding_type = NULL; /* binding_type */ -static int call_dop_oid_callback(char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char *col_info); +static int call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *col_info); /*--- Included file: packet-dop-hf.c ---*/ @@ -2045,7 +2045,7 @@ static void dissect_ACIItem_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto #line 84 "../../asn1/dop/packet-dop-template.c" static int -call_dop_oid_callback(char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, char *col_info) +call_dop_oid_callback(const char *base_string, tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char *col_info) { char* binding_param; @@ -2082,7 +2082,7 @@ dissect_dop(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_item *item=NULL; proto_tree *tree=NULL; int (*dop_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL; - char *dop_op_name; + const char *dop_op_name; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); diff --git a/epan/dissectors/packet-dsp.c b/epan/dissectors/packet-dsp.c index d4ab3c2ba0..bffa753d20 100644 --- a/epan/dissectors/packet-dsp.c +++ b/epan/dissectors/packet-dsp.c @@ -1798,7 +1798,7 @@ dissect_dsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_item *item=NULL; proto_tree *tree=NULL; int (*dsp_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index _U_) = NULL; - char *dsp_op_name; + const char *dsp_op_name; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); diff --git a/epan/dissectors/packet-e164.h b/epan/dissectors/packet-e164.h index 43cf956b9c..941be27615 100644 --- a/epan/dissectors/packet-e164.h +++ b/epan/dissectors/packet-e164.h @@ -40,7 +40,7 @@ typedef enum { typedef struct { e164_number_type_t e164_number_type; guint nature_of_address; - char *E164_number_str; /* E164 number string */ + const char *E164_number_str; /* E164 number string */ guint E164_number_length; /* Length of the E164_number string */ } e164_info_t; diff --git a/epan/dissectors/packet-erf.c b/epan/dissectors/packet-erf.c index cc25c4f1de..3a8b937ba4 100644 --- a/epan/dissectors/packet-erf.c +++ b/epan/dissectors/packet-erf.c @@ -724,7 +724,7 @@ channelised_fill_vc_id_string(emem_strbuf_t* out_string, sdh_g707_format_t* in_f int i; gboolean is_printed = FALSE; - static char* g_vc_size_strings[] = { + static const char* g_vc_size_strings[] = { "unknown", /*0x0*/ "VC3", /*0x1*/ "VC4", /*0x2*/ diff --git a/epan/dissectors/packet-fip.c b/epan/dissectors/packet-fip.c index 59618d2959..19ab34536c 100644 --- a/epan/dissectors/packet-fip.c +++ b/epan/dissectors/packet-fip.c @@ -342,7 +342,7 @@ dissect_fip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint val; tvbuff_t *desc_tvb; const char *info; - char *text; + const char *text; col_set_str(pinfo->cinfo, COL_PROTOCOL, "FIP"); col_clear(pinfo->cinfo, COL_INFO); diff --git a/epan/dissectors/packet-frame.c b/epan/dissectors/packet-frame.c index 14f3c3e607..277d0b86ad 100644 --- a/epan/dissectors/packet-frame.c +++ b/epan/dissectors/packet-frame.c @@ -380,7 +380,7 @@ dissect_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) const guint8 *cp; md5_state_t md_ctx; md5_byte_t digest[16]; - gchar *digest_string; + const gchar *digest_string; cp = tvb_get_ptr(tvb, 0, cap_len); diff --git a/epan/dissectors/packet-ftp.c b/epan/dissectors/packet-ftp.c index cebf76ee2f..bf7bc072a4 100644 --- a/epan/dissectors/packet-ftp.c +++ b/epan/dissectors/packet-ftp.c @@ -641,7 +641,7 @@ dissect_ftp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * of a multi-line reply. */ tvb_get_nstringz0(tvb, 0, sizeof(code_str), code_str); - code = strtoul(code_str, NULL, 10); + code = (guint32)strtoul(code_str, NULL, 10); proto_tree_add_uint(reqresp_tree, hf_ftp_response_code, tvb, 0, 3, code); diff --git a/epan/dissectors/packet-gadu-gadu.c b/epan/dissectors/packet-gadu-gadu.c index a0d96f3e32..3499b6493e 100644 --- a/epan/dissectors/packet-gadu-gadu.c +++ b/epan/dissectors/packet-gadu-gadu.c @@ -506,7 +506,7 @@ dissect_gadu_gadu_uint32_string_utf8(tvbuff_t *tvb, int hfindex, proto_tree *tre { const int org_offset = offset; - char *str; + const char *str; guint32 len; len = tvb_get_letohl(tvb, offset); diff --git a/epan/dissectors/packet-giop.c b/epan/dissectors/packet-giop.c index f65fee381d..536797c2cb 100644 --- a/epan/dissectors/packet-giop.c +++ b/epan/dissectors/packet-giop.c @@ -315,11 +315,12 @@ static void decode_IIOP_IOR_profile(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, - guint32 boundary, gboolean new_endianness, gchar *repobuf, + guint32 boundary, gboolean new_endianness, + const gchar *repobuf, gboolean store_flag); static void decode_TaggedProfile(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, - guint32 boundary, gboolean stream_is_big_endian, gchar *repobuf); + guint32 boundary, gboolean stream_is_big_endian, const gchar *repobuf); static void decode_IOR(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, guint32 boundary, gboolean stream_is_big_endian ); @@ -990,7 +991,7 @@ typedef enum collection_data collection_data_t; struct giop_object_key { - guint8 *objkey; /* ptr to object key */ + const guint8 *objkey; /* ptr to object key */ guint32 objkey_len; /* length */ }; @@ -1017,7 +1018,7 @@ static const char *giop_ior_file = "IOR.txt"; * Insert FN,reqid,operation and sub handle in list. DOES not check for duplicates yet. */ -static GList *insert_in_comp_req_list(GList *list, guint32 fn, guint32 reqid, gchar * op, giop_sub_handle_t *sh ) { +static GList *insert_in_comp_req_list(GList *list, guint32 fn, guint32 reqid, const gchar * op, giop_sub_handle_t *sh ) { comp_req_list_entry_t * entry; entry = se_alloc(sizeof(comp_req_list_entry_t)); @@ -1351,7 +1352,7 @@ static guint32 giop_hash_objkey_hash(gconstpointer v) { * Blindly Inserts even if it does exist, See TODO at top for reason. */ -static void insert_in_objkey_hash(GHashTable *hash, gchar *obj, guint32 len, gchar *repoid, ior_src_t src) { +static void insert_in_objkey_hash(GHashTable *hash, const gchar *obj, guint32 len, const gchar *repoid, ior_src_t src) { struct giop_object_key objkey_key, *new_objkey_key; struct giop_object_val *objkey_val = NULL; @@ -1642,7 +1643,7 @@ void register_giop_user(giop_sub_dissector_t *sub, const gchar *name, int sub_pr * */ -static gchar * get_repoid_from_objkey(GHashTable *hash, guint8 *obj, guint32 len) { +static gchar * get_repoid_from_objkey(GHashTable *hash, const guint8 *obj, guint32 len) { struct giop_object_key objkey_key; struct giop_object_val *objkey_val = NULL; @@ -1930,7 +1931,7 @@ static void giop_dump_collection(collection_data_t collection_type) { */ static gboolean try_heuristic_giop_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 *offset, - MessageHeader *header, gchar *operation ) { + MessageHeader *header, const gchar *operation ) { int i,len; gboolean res = FALSE; /* result of calling a heuristic sub dissector */ @@ -1991,7 +1992,7 @@ static gboolean try_heuristic_giop_dissector(tvbuff_t *tvb, packet_info *pinfo, */ static gboolean try_explicit_giop_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, - MessageHeader *header, gchar *operation, gchar *repoid ) { + MessageHeader *header, const gchar *operation, gchar *repoid ) { giop_sub_handle_t *subdiss = NULL; /* handle */ gboolean res = FALSE; @@ -2063,7 +2064,7 @@ static gboolean try_explicit_giop_dissector(tvbuff_t *tvb, packet_info *pinfo, p * the initial sequence. */ -gchar * make_printable_string (gchar *in, guint32 len) { +gchar * make_printable_string (const gchar *in, guint32 len) { guint32 i = 0; gchar *print_string = NULL; @@ -2154,7 +2155,7 @@ static void dissect_data_for_typecode(tvbuff_t *tvb, packet_info *pinfo, proto_t gdouble my_double; /* double */ gfloat my_float; /* float */ - gchar *buf = NULL; /* ptr to string buffer */ + const gchar *buf = NULL; /* ptr to string buffer */ /* Grab the data according to data type */ @@ -2290,7 +2291,7 @@ static void dissect_typecode_string_param(tvbuff_t *tvb, proto_tree *tree, gint gboolean new_stream_is_big_endian, guint32 new_boundary, int hf_id ) { guint32 u_octet4; /* unsigned int32 */ - gchar *buf; /* ptr to string buffer */ + const gchar *buf; /* ptr to string buffer */ /* get string */ u_octet4 = get_CDR_string(tvb,&buf,offset,new_stream_is_big_endian,new_boundary); @@ -2353,7 +2354,7 @@ static void dissect_tk_struct_params(tvbuff_t *tvb, packet_info *pinfo, proto_tr count = get_CDR_ulong(tvb,offset,new_stream_is_big_endian,new_boundary); if (tree) { proto_tree_add_uint(tree,hf_giop_typecode_count,tvb, - *offset-sizeof(count),4,count); + *offset-(int)sizeof(count),4,count); } /* get all tuples */ @@ -2570,7 +2571,7 @@ static void dissect_tk_except_params(tvbuff_t *tvb, packet_info *pinfo, proto_tr count = get_CDR_ulong(tvb,offset,new_stream_is_big_endian,new_boundary); if (tree) { proto_tree_add_uint(tree,hf_giop_typecode_count,tvb, - *offset-sizeof(count),4,count); + *offset-(int)sizeof(count),4,count); } /* get all tuples */ @@ -2637,7 +2638,7 @@ static void dissect_tk_value_params(tvbuff_t *tvb, packet_info *pinfo, proto_tre s_octet2 = get_CDR_short(tvb,offset,stream_is_big_endian,boundary); if (tree) { proto_tree_add_int(tree,hf_giop_typecode_Visibility,tvb, - *offset-sizeof(s_octet2),2,s_octet2); + *offset-(int)sizeof(s_octet2),2,s_octet2); } } @@ -2752,7 +2753,7 @@ guint32 get_CDR_encap_info(tvbuff_t *tvb, proto_tree *tree, gint *offset, /* Get sequence length of parameter list */ seqlen = get_CDR_ulong(tvb,offset,old_stream_is_big_endian,old_boundary); proto_tree_add_uint(tree,hf_giop_sequence_length,tvb, - *offset-sizeof(seqlen),4,seqlen); + *offset-(int)sizeof(seqlen),4,seqlen); /* * seqlen == 0, implies no endianness and no data @@ -3205,7 +3206,8 @@ guint8 get_CDR_octet(tvbuff_t *tvb, int *offset) { * This function also increments offset by len. */ -void get_CDR_octet_seq(tvbuff_t *tvb, gchar **seq, int *offset, guint32 len) { +void get_CDR_octet_seq(tvbuff_t *tvb, const gchar **seq, int *offset, guint32 len) { + guint8 *seq_buf; /* * Make sure that the entire sequence of octets is in the buffer before @@ -3221,8 +3223,9 @@ void get_CDR_octet_seq(tvbuff_t *tvb, gchar **seq, int *offset, guint32 len) { * do what we do now, and null-terminate the string (which also means * we don't need to zero out the entire allocation, just the last byte)? */ - *seq = ep_alloc_array0(gchar, len + 1); - tvb_memcpy( tvb, *seq, *offset, len); + seq_buf = ep_alloc_array0(gchar, len + 1); + tvb_memcpy( tvb, seq_buf, *offset, len); + *seq = seq_buf; *offset += len; } @@ -3260,7 +3263,7 @@ giop_add_CDR_string(proto_tree *tree, tvbuff_t *tvb, int *offset, gboolean stream_is_big_endian, int boundary, int hf) { guint32 u_octet4; - gchar *seq = NULL; + const gchar *seq = NULL; u_octet4 = get_CDR_string(tvb, &seq, offset, stream_is_big_endian, boundary); proto_tree_add_string(tree, hf, tvb, *offset-u_octet4, u_octet4, (u_octet4 > 0) ? seq : ""); @@ -3286,7 +3289,7 @@ giop_add_CDR_string(proto_tree *tree, tvbuff_t *tvb, int *offset, */ -guint32 get_CDR_string(tvbuff_t *tvb, gchar **seq, int *offset, gboolean stream_is_big_endian, +guint32 get_CDR_string(tvbuff_t *tvb, const gchar **seq, int *offset, gboolean stream_is_big_endian, int boundary ) { guint32 slength; @@ -3387,7 +3390,7 @@ guint32 get_CDR_typeCode(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, u_octet4 = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary); /* get maximum length */ if (tree) { proto_tree_add_uint(tree,hf_giop_typecode_max_length,tvb, - *offset-sizeof(u_octet4),4,u_octet4); + *offset-(int)sizeof(u_octet4),4,u_octet4); } break; @@ -3415,7 +3418,7 @@ guint32 get_CDR_typeCode(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, u_octet4 = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary); /* get maximum length */ if (tree) { proto_tree_add_uint(tree,hf_giop_typecode_max_length,tvb, - *offset-sizeof(u_octet4),4,u_octet4); + *offset-(int)sizeof(u_octet4),4,u_octet4); } break; @@ -3423,13 +3426,13 @@ guint32 get_CDR_typeCode(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, u_octet2 = get_CDR_ushort(tvb,offset,stream_is_big_endian,boundary); /* get digits */ if (tree) { proto_tree_add_uint(tree,hf_giop_typecode_digits,tvb, - *offset-sizeof(u_octet2),2,u_octet2); + *offset-(int)sizeof(u_octet2),2,u_octet2); } s_octet2 = get_CDR_short(tvb,offset,stream_is_big_endian,boundary); /* get scale */ if (tree) { proto_tree_add_int(tree,hf_giop_typecode_scale,tvb, - *offset-sizeof(s_octet2),2,s_octet2); + *offset-(int)sizeof(s_octet2),2,s_octet2); } break; @@ -3559,10 +3562,10 @@ guint16 get_CDR_ushort(tvbuff_t *tvb, int *offset, gboolean stream_is_big_endian * Wchar is not supported for GIOP 1.0. */ -gint get_CDR_wchar(tvbuff_t *tvb, gchar **seq, int *offset, MessageHeader * header) { +gint get_CDR_wchar(tvbuff_t *tvb, const gchar **seq, int *offset, MessageHeader * header) { gint slength; - gchar *raw_wstring; + const gchar *raw_wstring; /* CORBA chapter 15: * - prior to GIOP 1.2 wchar limited to two octet fixed length. @@ -3614,12 +3617,12 @@ gint get_CDR_wchar(tvbuff_t *tvb, gchar **seq, int *offset, MessageHeader * head */ -guint32 get_CDR_wstring(tvbuff_t *tvb, gchar **seq, int *offset, gboolean stream_is_big_endian, +guint32 get_CDR_wstring(tvbuff_t *tvb, const gchar **seq, int *offset, gboolean stream_is_big_endian, int boundary, MessageHeader * header) { guint32 slength; gint reported_length; - gchar *raw_wstring; + const gchar *raw_wstring; /* CORBA chapter 15: * - prior to GIOP 1.2 wstring limited to two octet fixed length. @@ -3689,10 +3692,10 @@ guint32 get_CDR_wstring(tvbuff_t *tvb, gchar **seq, int *offset, gboolean stream static void dissect_target_address(tvbuff_t * tvb, packet_info *pinfo, int *offset, proto_tree * tree, gboolean stream_is_big_endian, guint32 *object_key_len, - gchar **object_key_val) + const gchar **object_key_val) { guint16 discriminant; - gchar *object_key = NULL; + const gchar *object_key = NULL; guint32 len = 0; guint32 u_octet4; proto_item* ti; @@ -3796,7 +3799,7 @@ static void decode_UnknownServiceContext(tvbuff_t *tvb, packet_info *pinfo, prot gboolean stream_is_be, guint32 boundary) { guint32 context_data_len; - gchar *context_data; + const gchar *context_data; proto_item *ti; /* get sequence length, and NO encapsulation */ @@ -3874,7 +3877,7 @@ static void decode_ServiceContextList(tvbuff_t *tvb, packet_info *pinfo, proto_t /* Get sequence length (number of elements) */ seqlen = get_CDR_ulong(tvb,offset,stream_is_be,boundary); proto_tree_add_uint(tree,hf_giop_sequence_length,tvb, - *offset-sizeof(seqlen),4,seqlen); + *offset-(int)sizeof(seqlen),4,seqlen); /* return if zero length sequence */ @@ -4263,13 +4266,13 @@ dissect_giop_request_1_1 (tvbuff_t * tvb, packet_info * pinfo, guint32 len = 0; guint32 objkey_len = 0; /* object key length */ - gchar *objkey = NULL; /* object key sequence */ + const gchar *objkey = NULL; /* object key sequence */ gboolean exres = FALSE; /* result of trying explicit dissectors */ - gchar *operation; - gchar *requesting_principal; + const gchar *operation; + const gchar *requesting_principal; guint8 response_expected; - gchar *reserved; + const gchar *reserved; gchar miop[4]; proto_tree *request_tree; proto_item *tf; @@ -4399,7 +4402,7 @@ dissect_giop_request_1_1 (tvbuff_t * tvb, packet_info * pinfo, } if (!exres && !strcmp(giop_op_is_a, operation) && request_tree) { - gchar *type_id; + const gchar *type_id; len = get_CDR_string(tvb, &type_id, &offset, stream_is_big_endian, 0); proto_tree_add_uint (request_tree, hf_giop_type_id_len, tvb, offset - 4 - len, 4, len); proto_tree_add_string(request_tree, hf_giop_type_id, tvb, offset - len, len, type_id); @@ -4433,14 +4436,14 @@ dissect_giop_request_1_2 (tvbuff_t * tvb, packet_info * pinfo, guint32 offset = 0; guint32 request_id; guint32 len = 0; - gchar *reserved; - gchar *operation = NULL; + const gchar *reserved; + const gchar *operation = NULL; proto_tree *request_tree; proto_item *tf; gboolean exres = FALSE; /* result of trying explicit dissectors */ guint32 objkey_len = 0; /* object key length */ - gchar *objkey = NULL; /* object key sequence */ + const gchar *objkey = NULL; /* object key sequence */ gchar *repoid = NULL; /* from object key lookup in objkey hash */ tf = proto_tree_add_text (tree, tvb, offset, -1, "General Inter-ORB Protocol Request"); @@ -4517,7 +4520,7 @@ dissect_giop_request_1_2 (tvbuff_t * tvb, packet_info * pinfo, } if (!exres && !strcmp(giop_op_is_a, operation) && request_tree) { - gchar *type_id; + const gchar *type_id; len = get_CDR_string(tvb, &type_id, &offset, stream_is_big_endian, 0); proto_tree_add_uint (request_tree, hf_giop_type_id_len, tvb, offset - 4 - len, 4, len); proto_tree_add_string(request_tree, hf_giop_type_id, tvb, offset - len, len, type_id); @@ -5454,7 +5457,7 @@ static void decode_IOR(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int proto_tree *tree = NULL; /* IOR tree */ proto_item *tf; - gchar *repobuf; /* for repository ID */ + const gchar *repobuf; /* for repository ID */ guint32 i; @@ -5466,7 +5469,7 @@ static void decode_IOR(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int u_octet4 = get_CDR_string(tvb,&repobuf,offset,stream_is_big_endian,boundary); proto_tree_add_uint(tree,hf_giop_string_length,tvb, - *offset-u_octet4-sizeof(u_octet4),4,u_octet4); + *offset-u_octet4-(int)sizeof(u_octet4),4,u_octet4); if (u_octet4 > 0) { proto_tree_add_string(tree,hf_giop_type_id,tvb, *offset-u_octet4,u_octet4,repobuf); @@ -5477,7 +5480,7 @@ static void decode_IOR(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int seqlen_p = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary); proto_tree_add_uint(tree,hf_giop_sequence_length,tvb, - *offset-sizeof(seqlen_p),4,seqlen_p); + *offset-(int)sizeof(seqlen_p),4,seqlen_p); /* fetch all TaggedProfiles in this sequence */ for (i=0; i< seqlen_p; i++) { @@ -5486,11 +5489,11 @@ static void decode_IOR(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ptree, int } static void decode_TaggedProfile(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, - guint32 boundary, gboolean stream_is_big_endian, gchar *repobuf) { + guint32 boundary, gboolean stream_is_big_endian, const gchar *repobuf) { guint32 seqlen_pd; /* sequence length of profile data */ guint32 pidtag; /* profile ID TAG */ - gchar *profile_data; /* profile_data pointer */ + const gchar *profile_data; /* profile_data pointer */ guint32 new_boundary; /* for encapsulations encountered */ gboolean new_big_endianness; /* for encapsulations encountered */ proto_item *ti; @@ -5498,7 +5501,7 @@ static void decode_TaggedProfile(tvbuff_t *tvb, packet_info *pinfo, proto_tree * /* Get ProfileId tag */ pidtag = get_CDR_ulong(tvb,offset,stream_is_big_endian,boundary); ti = proto_tree_add_uint(tree,hf_giop_profile_id,tvb, - *offset-sizeof(pidtag),4,pidtag); + *offset-(int)sizeof(pidtag),4,pidtag); /* get sequence length, new endianness and boundary for encapsulation */ seqlen_pd = get_CDR_encap_info(tvb, tree, offset, @@ -5551,18 +5554,19 @@ static void decode_TaggedProfile(tvbuff_t *tvb, packet_info *pinfo, proto_tree * static void decode_IIOP_IOR_profile(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, - guint32 boundary, gboolean stream_is_big_endian, gchar *repo_id_buf, + guint32 boundary, gboolean stream_is_big_endian, + const gchar *repo_id_buf, gboolean store_flag) { guint32 i; /* loop index */ guint8 v_major,v_minor; /* IIOP version */ - gchar *buf; + const gchar *buf; guint32 u_octet4; /* u long */ guint16 u_octet2; /* u short */ guint32 seqlen; /* generic sequence length */ guint32 seqlen1; /* generic sequence length */ - gchar *objkey; /* object key pointer */ + const gchar *objkey; /* object key pointer */ proto_item *ti, *ti_minor; @@ -5696,7 +5700,7 @@ static void decode_SystemExceptionReplyBody (tvbuff_t *tvb, proto_tree *tree, gi guint32 minor_code_value; guint32 completion_status; - gchar *buf; /* pointer to string buffer */ + const gchar *buf; /* pointer to string buffer */ length = get_CDR_string(tvb, &buf, offset, stream_is_big_endian, boundary); proto_tree_add_uint(tree, hf_giop_exception_len, tvb, *offset-4, 4, length); diff --git a/epan/dissectors/packet-giop.h b/epan/dissectors/packet-giop.h index 7807ea1eef..1e71d71648 100644 --- a/epan/dissectors/packet-giop.h +++ b/epan/dissectors/packet-giop.h @@ -98,7 +98,7 @@ typedef enum ReplyStatusType { */ typedef gboolean (giop_sub_dissector_t)(tvbuff_t *, packet_info *, proto_tree *, int *, - MessageHeader *, gchar * , gchar *); + MessageHeader *, const gchar * , gchar *); /* * Generic Subdissector handle, wraps user info. @@ -359,7 +359,7 @@ extern guint8 get_CDR_octet(tvbuff_t *tvb, int *offset); * This function also increments offset by len. */ -extern void get_CDR_octet_seq(tvbuff_t *tvb, gchar **seq, int *offset, guint32 len); +extern void get_CDR_octet_seq(tvbuff_t *tvb, const gchar **seq, int *offset, guint32 len); /* Copy a 2 octet sequence from the tvbuff * which represents a signed short value, and convert @@ -396,7 +396,7 @@ extern void giop_add_CDR_string(proto_tree *tree, tvbuff_t *tvb, int *offset, * */ -extern guint32 get_CDR_string(tvbuff_t *tvb, gchar **seq, int *offset, +extern guint32 get_CDR_string(tvbuff_t *tvb, const gchar **seq, int *offset, gboolean stream_is_big_endian, int boundary); @@ -482,7 +482,7 @@ extern guint16 get_CDR_ushort(tvbuff_t *tvb, int *offset, * Wchar is not supported for GIOP 1.0. */ -extern gint get_CDR_wchar(tvbuff_t *tvb, gchar **seq, int *offset, +extern gint get_CDR_wchar(tvbuff_t *tvb, const gchar **seq, int *offset, MessageHeader * header); @@ -505,7 +505,7 @@ extern gint get_CDR_wchar(tvbuff_t *tvb, gchar **seq, int *offset, * Wstring is not supported for GIOP 1.0. */ -extern guint32 get_CDR_wstring(tvbuff_t *tvb, gchar **seq, int *offset, +extern guint32 get_CDR_wstring(tvbuff_t *tvb, const gchar **seq, int *offset, gboolean stream_is_big_endian, int boundary, MessageHeader * header); @@ -540,7 +540,7 @@ extern guint32 get_CDR_encap_info(tvbuff_t *tvb, proto_tree *tree, gint *offset, * the initial sequence. */ -extern gchar * make_printable_string (gchar *in, guint32 len); +extern gchar * make_printable_string (const gchar *in, guint32 len); /* * Enums for TCkind diff --git a/epan/dissectors/packet-gluster_cli.c b/epan/dissectors/packet-gluster_cli.c index 05042950c2..7198668b6d 100644 --- a/epan/dissectors/packet-gluster_cli.c +++ b/epan/dissectors/packet-gluster_cli.c @@ -76,11 +76,9 @@ static int gluster_cli_2_common_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar* errstr= NULL; - offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = dissect_rpc_string(tvb, tree, hf_gluster_op_errstr, offset, - &errstr); + NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_gluster_dict, offset); return offset; @@ -90,15 +88,12 @@ static int gluster_cli_2_probe_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar* hostname = NULL; - gchar* errstr = NULL; - offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = dissect_rpc_uint32(tvb, tree, hf_gluster_port, offset); offset = dissect_rpc_string(tvb, tree, hf_gluster_hostname, offset, - &hostname); + NULL); offset = dissect_rpc_string(tvb, tree, hf_gluster_op_errstr, offset, - &errstr); + NULL); return offset; } @@ -107,10 +102,8 @@ static int gluster_cli_2_probe_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* hostname = NULL; - offset = dissect_rpc_string(tvb, tree, hf_gluster_hostname, offset, - &hostname); + NULL); offset = dissect_rpc_uint32(tvb, tree, hf_gluster_port, offset); return offset; @@ -120,11 +113,9 @@ static int gluster_cli_2_deprobe_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar* hostname = NULL; - offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = dissect_rpc_string(tvb, tree, hf_gluster_hostname, offset, - &hostname); + NULL); return offset; } @@ -133,10 +124,8 @@ static int gluster_cli_2_deprobe_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* hostname = NULL; - offset = dissect_rpc_string(tvb, tree, hf_gluster_hostname, offset, - &hostname); + NULL); offset = dissect_rpc_uint32(tvb, tree, hf_gluster_port, offset); offset = dissect_rpc_uint32(tvb, tree, hf_gluster_flags, offset); @@ -147,9 +136,7 @@ static int gluster_cli_2_fsm_log_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* name = NULL; - - offset = dissect_rpc_string(tvb, tree, hf_gluster_wd, offset, &name); + offset = dissect_rpc_string(tvb, tree, hf_gluster_wd, offset, NULL); return offset; } @@ -158,10 +145,8 @@ static int gluster_cli_2_getwd_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar* wd = NULL; - offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); - offset = dissect_rpc_string(tvb, tree, hf_gluster_wd, offset, &wd); + offset = dissect_rpc_string(tvb, tree, hf_gluster_wd, offset, NULL); return offset; } @@ -179,10 +164,8 @@ static int gluster_cli_2_mount_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* label = NULL; - offset = dissect_rpc_string(tvb, tree, hf_gluster_label, offset, - &label); + NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_gluster_dict, offset); return offset; @@ -192,10 +175,8 @@ static int gluster_cli_2_mount_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar* path = NULL; - offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); - offset = dissect_rpc_string(tvb, tree, hf_gluster_path, offset, &path); + offset = dissect_rpc_string(tvb, tree, hf_gluster_path, offset, NULL); return offset; } @@ -204,10 +185,8 @@ static int gluster_cli_2_umount_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* path = NULL; - offset = dissect_rpc_uint32(tvb, tree, hf_gluster_lazy, offset); - offset = dissect_rpc_string(tvb, tree, hf_gluster_path, offset, &path); + offset = dissect_rpc_string(tvb, tree, hf_gluster_path, offset, NULL); return offset; } diff --git a/epan/dissectors/packet-gluster_pmap.c b/epan/dissectors/packet-gluster_pmap.c index d2113bdcca..7d02a6b51f 100644 --- a/epan/dissectors/packet-gluster_pmap.c +++ b/epan/dissectors/packet-gluster_pmap.c @@ -80,9 +80,8 @@ static int gluster_pmap_portbybrick_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *brick = NULL; offset = dissect_rpc_string(tvb, tree, hf_gluster_brick, offset, - &brick); + NULL); return offset; } @@ -96,7 +95,7 @@ gluster_dump_reply_detail(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, { proto_item *detail_item; proto_tree *detail_tree; - gchar *progname = NULL; + const gchar *progname = NULL; detail_item = proto_tree_add_text(tree, tvb, offset, -1, "Available Progam: "); diff --git a/epan/dissectors/packet-glusterd.c b/epan/dissectors/packet-glusterd.c index 6d9a6321a0..2fec7bf25c 100644 --- a/epan/dissectors/packet-glusterd.c +++ b/epan/dissectors/packet-glusterd.c @@ -118,12 +118,10 @@ static int gluster_gd_mgmt_probe_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar *hostname = NULL; - offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset, - &hostname); + NULL); offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset); offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); @@ -134,12 +132,10 @@ static int gluster_gd_mgmt_probe_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *hostname = NULL; - offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset, - &hostname); + NULL); offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset); return offset; @@ -149,12 +145,10 @@ static int gluster_gd_mgmt_friend_add_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar *hostname = NULL; - offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset, - &hostname); + NULL); offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset); @@ -165,12 +159,10 @@ static int gluster_gd_mgmt_friend_add_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *hostname = NULL; - offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterd_hostname, offset, - &hostname); + NULL); offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_port, offset); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_vols, offset); @@ -204,13 +196,11 @@ static int gluster_gd_mgmt_stage_op_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar *errstr = NULL; - offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset, - &errstr); + NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset); return offset; } @@ -231,14 +221,12 @@ static int gluster_gd_mgmt_commit_op_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar *errstr = NULL; - offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_buf, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset, - &errstr); + NULL); return offset; } @@ -307,14 +295,12 @@ static int glusterd_mgmt_2_stage_op_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar *errstr = NULL; - offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset); offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset, - &errstr); + NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset); return offset; @@ -336,14 +322,12 @@ static int glusterd_mgmt_2_commit_op_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar *errstr = NULL; - offset = gluster_gd_mgmt_dissect_uuid(tvb, tree, hf_glusterd_uuid, offset); offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_buf, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset, - &errstr); + NULL); return offset; } @@ -366,11 +350,9 @@ static int glusterd_brick_2_common_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar *errstr = NULL; - offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = dissect_rpc_string(tvb, tree, hf_glusterd_op_errstr, offset, - &errstr); + NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset); return offset; @@ -380,10 +362,8 @@ static int glusterd_brick_2_common_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *name = NULL; - offset = dissect_rpc_string(tvb, tree, hf_glusterd_name, offset, - &name); + NULL); offset = dissect_rpc_uint32(tvb, tree, hf_glusterd_op, offset); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterd_dict, offset); diff --git a/epan/dissectors/packet-glusterfs.c b/epan/dissectors/packet-glusterfs.c index b1db9d6669..14a19f2b59 100644 --- a/epan/dissectors/packet-glusterfs.c +++ b/epan/dissectors/packet-glusterfs.c @@ -473,7 +473,8 @@ glusterfs_rpc_dissect_statfs(proto_tree *tree, tvbuff_t *tvb, int offset) int gluster_rpc_dissect_dict(proto_tree *tree, tvbuff_t *tvb, int hfindex, int offset) { - gchar *key, *value, *name; + gchar *key, *value; + const gchar *name; gint items, i, len, roundup, value_len, key_len; proto_item *subtree_item; @@ -484,7 +485,7 @@ gluster_rpc_dissect_dict(proto_tree *tree, tvbuff_t *tvb, int hfindex, int offse /* create a subtree for all the items in the dict */ if (hfindex >= 0) { header_field_info *hfinfo = proto_registrar_get_nth(hfindex); - name = (gchar*) hfinfo->name; + name = hfinfo->name; } else name = ""; @@ -608,11 +609,9 @@ static int glusterfs_gfs3_op_unlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* path = NULL; - gchar* bname = NULL; offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, &path); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, NULL); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); return offset; } @@ -629,10 +628,8 @@ static int glusterfs_gfs3_op_statfs_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *path = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, &path); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, NULL); return offset; } @@ -650,12 +647,10 @@ static int glusterfs_gfs3_op_setxattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *path = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = glusterfs_rpc_dissect_flags(tree, tvb, offset); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, &path); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, NULL); return offset; } @@ -673,10 +668,8 @@ static int glusterfs_gfs3_op_opendir_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *path = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, &path); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, NULL); return offset; } @@ -703,14 +696,11 @@ static int glusterfs_gfs3_op_create_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *path = NULL; - gchar *bname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); offset = glusterfs_rpc_dissect_flags(tree, tvb, offset); offset = glusterfs_rpc_dissect_mode(tree, tvb, hf_glusterfs_mode, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, &path); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, NULL); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -734,14 +724,11 @@ static int glusterfs_gfs3_op_lookup_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *path = NULL; - gchar *bname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); offset = glusterfs_rpc_dissect_flags(tree, tvb, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, &path); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, NULL); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -753,8 +740,6 @@ glusterfs_gfs3_op_inodelk_call(tvbuff_t *tvb, int offset, { proto_item *flock_item; proto_tree *flock_tree; - gchar* path = NULL; - gchar* volume = NULL; offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_cmd, offset); @@ -764,8 +749,8 @@ glusterfs_gfs3_op_inodelk_call(tvbuff_t *tvb, int offset, flock_tree = proto_item_add_subtree(flock_item, ett_glusterfs_flock); offset = glusterfs_rpc_dissect_gf_flock(flock_tree, tvb, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, &path); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, &volume); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, NULL); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, NULL); return offset; } @@ -775,7 +760,7 @@ _glusterfs_gfs_op_readdir_entry(tvbuff_t *tvb, int offset, proto_tree *tree, { proto_item *entry_item; proto_tree *entry_tree; - gchar* path = NULL; + const gchar* path = NULL; entry_item = proto_tree_add_text(tree, tvb, offset, -1, "Entry"); entry_tree = proto_item_add_subtree(entry_item, ett_glusterfs_entry); @@ -883,14 +868,12 @@ glusterfs_rpc_dissect_setattr(proto_tree *tree, tvbuff_t *tvb, int offset) static int glusterfs_gfs3_op_setattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *path = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = glusterfs_rpc_dissect_gf_iatt(tree, tvb, hf_glusterfs_iatt, offset); offset = glusterfs_rpc_dissect_setattr(tree, tvb, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, &path); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, NULL); return offset; } @@ -942,13 +925,11 @@ static int glusterfs_gfs3_3_op_mknod_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *bname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); offset = dissect_rpc_uint64(tvb, tree, hf_glusterfs_offset, offset); offset = glusterfs_rpc_dissect_mode(tree, tvb, hf_glusterfs_mode, offset); offset = glusterfs_rpc_dissect_mode(tree, tvb, hf_glusterfs_umask, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -958,12 +939,10 @@ static int glusterfs_gfs3_3_op_mkdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *bname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); offset = glusterfs_rpc_dissect_mode(tree, tvb, hf_glusterfs_mode, offset); offset = glusterfs_rpc_dissect_mode(tree, tvb, hf_glusterfs_umask, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -973,13 +952,11 @@ static int glusterfs_gfs3_3_op_readlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar* path = NULL; - offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = glusterfs_rpc_dissect_gf_iatt(tree, tvb, hf_glusterfs_iatt, offset); offset = dissect_rpc_string(tvb, tree, hf_glusterfs_path, offset, - &path); + NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1016,10 +993,9 @@ glusterfs_gfs3_3_op_unlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { guint xflags; - gchar* bname = NULL; offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); xflags = tvb_get_ntohl(tvb, offset); proto_tree_add_uint_format(tree, hf_glusterfs_xflags, tvb, offset, 4, xflags, "Flags: 0%02o", xflags); offset += 4; @@ -1032,14 +1008,13 @@ static int glusterfs_gfs3_3_op_rmdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* bname = NULL; guint xflags; offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); xflags = tvb_get_ntohl(tvb, offset); proto_tree_add_uint_format(tree, hf_glusterfs_xflags, tvb, offset, 4, xflags, "Flags: 0%02o", xflags); offset += 4; - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1049,14 +1024,11 @@ static int glusterfs_gfs3_3_op_symlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *bname = NULL; - gchar *linkname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); offset = glusterfs_rpc_dissect_mode(tree, tvb, hf_glusterfs_umask, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_linkname, offset, &linkname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_linkname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1066,14 +1038,10 @@ static int glusterfs_gfs3_3_op_rename_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - - gchar *oldbname = NULL; - gchar *newbname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_oldgfid, offset); offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_newgfid, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_oldbname, offset, &oldbname); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_newbname, offset, &newbname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_oldbname, offset, NULL); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_newbname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1113,11 +1081,9 @@ static int glusterfs_gfs3_3_op_link_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *newbname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_oldgfid, offset); offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_newgfid, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_newbname, offset, &newbname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_newbname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1259,11 +1225,9 @@ static int glusterfs_gfs3_3_op_getxattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* name = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_namelen, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, &name); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1285,9 +1249,8 @@ static int glusterfs_gfs3_3_op_removexattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* name = NULL; offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, &name); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1360,13 +1323,11 @@ static int glusterfs_gfs3_3_op_create_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *bname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); offset = glusterfs_rpc_dissect_flags(tree, tvb, offset); offset = glusterfs_rpc_dissect_mode(tree, tvb, hf_glusterfs_mode, offset); offset = glusterfs_rpc_dissect_mode(tree, tvb, hf_glusterfs_umask, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1447,12 +1408,10 @@ static int glusterfs_gfs3_3_op_lookup_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *bname = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_pargfid, offset); offset = glusterfs_rpc_dissect_flags(tree, tvb, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, &bname); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_bname, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1487,13 +1446,11 @@ static int glusterfs_gfs3_3_op_inodelk_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* volume = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_cmd, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_type, offset); offset = glusterfs_rpc_dissect_gf_2_flock(tree, tvb, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, &volume); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1503,8 +1460,6 @@ static int glusterfs_gfs3_3_op_finodelk_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* volume = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = dissect_rpc_uint64(tvb, tree, hf_glusterfs_fd, offset); @@ -1512,7 +1467,7 @@ glusterfs_gfs3_3_op_finodelk_call(tvbuff_t *tvb, int offset, offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_type, offset); offset = glusterfs_rpc_dissect_gf_2_flock(tree, tvb, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, &volume); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1522,14 +1477,12 @@ static int glusterfs_gfs3_3_op_entrylk_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* volume = NULL; - gchar* name = NULL; offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_cmd, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_type, offset); offset = dissect_rpc_uint64(tvb, tree, hf_glusterfs_entrylk_namelen, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, &name); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, &volume); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, NULL); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1539,15 +1492,13 @@ static int glusterfs_gfs3_3_op_fentrylk_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* volume = NULL; - gchar* name = NULL; offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = dissect_rpc_uint64(tvb, tree, hf_glusterfs_fd, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_cmd, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_type, offset); offset = dissect_rpc_uint64(tvb, tree, hf_glusterfs_entrylk_namelen, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, &name); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, &volume); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, NULL); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_volume, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; @@ -1593,12 +1544,10 @@ static int glusterfs_gfs3_3_op_fgetxattr_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* name = NULL; - offset = glusterfs_rpc_dissect_gfid(tree, tvb, hf_glusterfs_gfid, offset); offset = dissect_rpc_uint64(tvb, tree, hf_glusterfs_fd, offset); offset = dissect_rpc_uint32(tvb, tree, hf_glusterfs_namelen, offset); - offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, &name); + offset = dissect_rpc_string(tvb, tree, hf_glusterfs_name, offset, NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_glusterfs_dict, offset); return offset; diff --git a/epan/dissectors/packet-glusterfs_hndsk.c b/epan/dissectors/packet-glusterfs_hndsk.c index 4b0cc40040..ad83f1ab70 100644 --- a/epan/dissectors/packet-glusterfs_hndsk.c +++ b/epan/dissectors/packet-glusterfs_hndsk.c @@ -104,10 +104,9 @@ static int gluster_hndsk_2_getspec_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - gchar* spec = NULL; offset = gluster_dissect_common_reply(tvb, offset, pinfo, tree); offset = dissect_rpc_string(tvb, tree, hf_gluster_hndsk_spec, offset, - &spec); + NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_gluster_hndsk_dict, offset); return offset; @@ -117,14 +116,12 @@ static int gluster_hndsk_2_getspec_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar *key = NULL; - if (tree) proto_tree_add_item(tree, hf_gluster_hndsk_flags, tvb, offset, 4, ENC_NA); offset += 4; offset = dissect_rpc_string(tvb, tree, hf_gluster_hndsk_key, offset, - &key); + NULL); offset = gluster_rpc_dissect_dict(tree, tvb, hf_gluster_hndsk_dict, offset); return offset; @@ -143,9 +140,8 @@ static int gluster_hndsk_2_set_lk_ver_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - gchar* uid = NULL; offset = dissect_rpc_string(tvb, tree, hf_gluster_hndsk_uid, offset, - &uid); + NULL); offset = dissect_rpc_uint32(tvb, tree,hf_gluster_hndsk_lk_ver, offset); return offset; } diff --git a/epan/dissectors/packet-gmrp.c b/epan/dissectors/packet-gmrp.c index fe20aa21ff..2e7d753751 100644 --- a/epan/dissectors/packet-gmrp.c +++ b/epan/dissectors/packet-gmrp.c @@ -69,7 +69,7 @@ static const value_string attribute_type_vals[] = { /* The length of GMRP LeaveAll attribute should be 2 octets (one for length * and the other for event) */ -#define GMRP_LENGTH_LEAVEALL (sizeof(guint8)+sizeof(guint8)) +#define GMRP_LENGTH_LEAVEALL (int)(sizeof(guint8)+sizeof(guint8)) /* The length of GMRP attribute other than LeaveAll should be: * @@ -78,8 +78,8 @@ static const value_string attribute_type_vals[] = { * 3 bytes for Service Requirement (1 for length, 1 for event, 1 for attribute value) * */ -#define GMRP_GROUP_MEMBERSHIP_NON_LEAVEALL (sizeof(guint8)+sizeof(guint8)+(6*sizeof(guint8))) -#define GMRP_SERVICE_REQUIREMENT_NON_LEAVEALL (sizeof(guint8)+sizeof(guint8)+sizeof(guint8)) +#define GMRP_GROUP_MEMBERSHIP_NON_LEAVEALL (int)(sizeof(guint8)+sizeof(guint8)+(6*sizeof(guint8))) +#define GMRP_SERVICE_REQUIREMENT_NON_LEAVEALL (int)(sizeof(guint8)+sizeof(guint8)+sizeof(guint8)) /* Packet offset definitions */ #define GARP_PROTOCOL_ID 0 @@ -128,7 +128,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) protocol_id = tvb_get_ntohs(tvb, GARP_PROTOCOL_ID); proto_tree_add_uint_format(gmrp_tree, hf_gmrp_proto_id, tvb, - GARP_PROTOCOL_ID, sizeof(guint16), + GARP_PROTOCOL_ID, (int)sizeof(guint16), protocol_id, "Protocol Identifier: 0x%04x (%s)", protocol_id, @@ -139,16 +139,16 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Currently only one protocol ID is supported */ if (protocol_id != GARP_DEFAULT_PROTOCOL_ID) { - proto_tree_add_text(gmrp_tree, tvb, GARP_PROTOCOL_ID, sizeof(guint16), + proto_tree_add_text(gmrp_tree, tvb, GARP_PROTOCOL_ID, (int)sizeof(guint16), " (Warning: this version of Wireshark only knows about protocol id = 1)"); call_dissector(data_handle, - tvb_new_subset_remaining(tvb, GARP_PROTOCOL_ID + sizeof(guint16)), + tvb_new_subset_remaining(tvb, GARP_PROTOCOL_ID + (int)sizeof(guint16)), pinfo, tree); return; } - offset += sizeof(guint16); - length -= sizeof(guint16); + offset += (int)sizeof(guint16); + length -= (int)sizeof(guint16); msg_index = 0; @@ -167,7 +167,7 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* End of GARP PDU */ if (msg_index) { - proto_tree_add_text(gmrp_tree, tvb, offset, sizeof(guint8), + proto_tree_add_text(gmrp_tree, tvb, offset, (int)sizeof(guint8), "End of pdu"); break; } @@ -180,14 +180,14 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); msg_item = proto_tree_add_text(gmrp_tree, tvb, msg_start, -1, "Message %d", msg_index + 1); proto_tree_add_uint(gmrp_tree, hf_gmrp_attribute_type, tvb, - msg_start, sizeof(guint8), octet); + msg_start, (int)sizeof(guint8), octet); /* GMRP supports Group Membership and Service Requirement as attribute types */ if ( (octet != GMRP_ATTRIBUTE_TYPE_GROUP_MEMBERSHIP) && (octet != GMRP_ATTRIBUTE_TYPE_SERVICE_REQUIREMENT) ) @@ -217,10 +217,10 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (attr_index) { proto_tree_add_text(gmrp_tree, tvb, offset, - sizeof(guint8), " End of mark"); + (int)sizeof(guint8), " End of mark"); - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); proto_item_set_len(msg_item, offset - msg_start); break; @@ -237,23 +237,23 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint8 event; - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); attr_item = proto_tree_add_text(gmrp_tree, tvb, attr_start, -1, " Attribute %d", attr_index + 1); proto_tree_add_uint(gmrp_tree, hf_gmrp_attribute_length, - tvb, attr_start, sizeof(guint8), octet); + tvb, attr_start, (int)sizeof(guint8), octet); /* Read in attribute event */ event = tvb_get_guint8(tvb, offset); proto_tree_add_uint(gmrp_tree, hf_gmrp_attribute_event, - tvb, offset, sizeof(guint8), event); + tvb, offset, (int)sizeof(guint8), event); - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); switch (event) { @@ -287,20 +287,20 @@ dissect_gmrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* Group Membership */ proto_tree_add_item(gmrp_tree, hf_gmrp_attribute_value_group_membership, - tvb, offset, (6*sizeof(guint8)), ENC_NA); + tvb, offset, (int)(6*sizeof(guint8)), ENC_NA); - offset += 6*sizeof(guint8); - length -= 6*sizeof(guint8); + offset += (int)(6*sizeof(guint8)); + length -= (int)(6*sizeof(guint8)); } else if ( GMRP_ATTRIBUTE_TYPE_SERVICE_REQUIREMENT == attribute_type ) { /* Service Requirement */ proto_tree_add_item(gmrp_tree, hf_gmrp_attribute_value_service_requirement, - tvb, offset, sizeof(guint8), ENC_BIG_ENDIAN); + tvb, offset, (int)sizeof(guint8), ENC_BIG_ENDIAN); - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); } else { diff --git a/epan/dissectors/packet-gsm_a_common.c b/epan/dissectors/packet-gsm_a_common.c index a249231cc0..5af4ce027a 100644 --- a/epan/dissectors/packet-gsm_a_common.c +++ b/epan/dissectors/packet-gsm_a_common.c @@ -40,6 +40,7 @@ #include "packet-bssap.h" #include "packet-sccp.h" #include "packet-gsm_a_common.h" +#include "packet-gmr1_common.h" #include "packet-e212.h" diff --git a/epan/dissectors/packet-gsm_a_common.h b/epan/dissectors/packet-gsm_a_common.h index 6baa1f1b1e..633c7ab731 100644 --- a/epan/dissectors/packet-gsm_a_common.h +++ b/epan/dissectors/packet-gsm_a_common.h @@ -153,7 +153,6 @@ extern int hf_bssgp_elem_id; extern const value_string gmr1_ie_common_strings[]; extern elem_fcn gmr1_ie_common_func[]; extern gint ett_gmr1_ie_common[]; -extern int hf_gmr1_elem_id; extern const value_string gmr1_ie_rr_strings[]; extern elem_fcn gmr1_ie_rr_func[]; diff --git a/epan/dissectors/packet-gsm_abis_oml.c b/epan/dissectors/packet-gsm_abis_oml.c index 2cba113abc..92dd2c81c3 100644 --- a/epan/dissectors/packet-gsm_abis_oml.c +++ b/epan/dissectors/packet-gsm_abis_oml.c @@ -1801,7 +1801,7 @@ dissect_oml_manuf(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tvb_memeql(tvb, offset+1, ipaccess_magic, sizeof(ipaccess_magic))) return offset; - offset += sizeof(ipaccess_magic) + 1; + offset += (int)sizeof(ipaccess_magic) + 1; return dissect_oml_fom(tvb, pinfo, tree, offset, top_ti); } diff --git a/epan/dissectors/packet-gvrp.c b/epan/dissectors/packet-gvrp.c index 42e1ef88f8..165744f869 100644 --- a/epan/dissectors/packet-gvrp.c +++ b/epan/dissectors/packet-gvrp.c @@ -60,12 +60,12 @@ static const value_string attribute_type_vals[] = { /* The length of GVRP LeaveAll attribute should be 2 octets (one for length * and the other for event) */ -#define GVRP_LENGTH_LEAVEALL (sizeof(guint8)+sizeof(guint8)) +#define GVRP_LENGTH_LEAVEALL (int)(sizeof(guint8)+sizeof(guint8)) /* The length of GVRP attribute other than LeaveAll should be 4 octets (one * for length, one for event, and the last two for VID value). */ -#define GVRP_LENGTH_NON_LEAVEALL (sizeof(guint8)+sizeof(guint8)+sizeof(guint16)) +#define GVRP_LENGTH_NON_LEAVEALL (int)(sizeof(guint8)+sizeof(guint8)+sizeof(guint16)) /* Packet offset definitions */ #define GARP_PROTOCOL_ID 0 @@ -115,7 +115,7 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) protocol_id = tvb_get_ntohs(tvb, GARP_PROTOCOL_ID); proto_tree_add_uint_format(gvrp_tree, hf_gvrp_proto_id, tvb, - GARP_PROTOCOL_ID, sizeof(guint16), + GARP_PROTOCOL_ID, (int)sizeof(guint16), protocol_id, "Protocol Identifier: 0x%04x (%s)", protocol_id, @@ -126,16 +126,16 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Currently only one protocol ID is supported */ if (protocol_id != GARP_DEFAULT_PROTOCOL_ID) { - proto_tree_add_text(gvrp_tree, tvb, GARP_PROTOCOL_ID, sizeof(guint16), + proto_tree_add_text(gvrp_tree, tvb, GARP_PROTOCOL_ID, (int)sizeof(guint16), " (Warning: this version of Wireshark only knows about protocol id = 1)"); call_dissector(data_handle, - tvb_new_subset(tvb, GARP_PROTOCOL_ID + sizeof(guint16), -1, -1), + tvb_new_subset(tvb, GARP_PROTOCOL_ID + (int)sizeof(guint16), -1, -1), pinfo, tree); return; } - offset += sizeof(guint16); - length -= sizeof(guint16); + offset += (int)sizeof(guint16); + length -= (int)sizeof(guint16); msg_index = 0; @@ -154,7 +154,7 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* End of GARP PDU */ if (msg_index) { - proto_tree_add_text(gvrp_tree, tvb, offset, sizeof(guint8), + proto_tree_add_text(gvrp_tree, tvb, offset, (int)sizeof(guint8), "End of mark"); break; } @@ -166,14 +166,14 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); msg_item = proto_tree_add_text(gvrp_tree, tvb, msg_start, -1, "Message %d", msg_index + 1); proto_tree_add_uint(gvrp_tree, hf_gvrp_attribute_type, tvb, - msg_start, sizeof(guint8), octet); + msg_start, (int)sizeof(guint8), octet); /* GVRP only supports one attribute type. */ if (octet != GVRP_ATTRIBUTE_TYPE) @@ -202,10 +202,10 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (attr_index) { proto_tree_add_text(gvrp_tree, tvb, offset, - sizeof(guint8), " End of mark"); + (int)sizeof(guint8), " End of mark"); - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); proto_item_set_len(msg_item, offset - msg_start); break; @@ -221,23 +221,23 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint8 event; - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); attr_item = proto_tree_add_text(gvrp_tree, tvb, attr_start, -1, " Attribute %d", attr_index + 1); proto_tree_add_uint(gvrp_tree, hf_gvrp_attribute_length, - tvb, attr_start, sizeof(guint8), octet); + tvb, attr_start, (int)sizeof(guint8), octet); /* Read in attribute event */ event = tvb_get_guint8(tvb, offset); proto_tree_add_uint(gvrp_tree, hf_gvrp_attribute_event, - tvb, offset, sizeof(guint8), event); + tvb, offset, (int)sizeof(guint8), event); - offset += sizeof(guint8); - length -= sizeof(guint8); + offset += (int)sizeof(guint8); + length -= (int)sizeof(guint8); switch (event) { @@ -266,10 +266,10 @@ dissect_gvrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Show attribute value */ proto_tree_add_item(gvrp_tree, hf_gvrp_attribute_value, - tvb, offset, sizeof(guint16), ENC_BIG_ENDIAN); + tvb, offset, (int)sizeof(guint16), ENC_BIG_ENDIAN); - offset += sizeof(guint16); - length -= sizeof(guint16); + offset += (int)sizeof(guint16); + length -= (int)sizeof (guint16); break; default: diff --git a/epan/dissectors/packet-hartip.c b/epan/dissectors/packet-hartip.c index 1aa16f7b25..280e32e14e 100644 --- a/epan/dissectors/packet-hartip.c +++ b/epan/dissectors/packet-hartip.c @@ -390,8 +390,8 @@ dissect_float(proto_tree *tree, int hf, tvbuff_t *tvb, gint offset) } static gint -dissect_string(proto_tree *tree, int hf, char *name, int len, tvbuff_t *tvb, - gint offset) +dissect_string(proto_tree *tree, int hf, const char *name, int len, + tvbuff_t *tvb, gint offset) { proto_item *ti; char *str; @@ -408,8 +408,8 @@ dissect_string(proto_tree *tree, int hf, char *name, int len, tvbuff_t *tvb, } static gint -dissect_packAscii(proto_tree *tree, int hf, char *name, int len, tvbuff_t *tvb, - gint offset) +dissect_packAscii(proto_tree *tree, int hf, const char *name, int len, + tvbuff_t *tvb, gint offset) { gushort usIdx; gushort usGroupCnt; @@ -458,8 +458,8 @@ dissect_packAscii(proto_tree *tree, int hf, char *name, int len, tvbuff_t *tvb, } static gint -dissect_timestamp(proto_tree *tree, int hf, char *name, int len, tvbuff_t *tvb, - gint offset) +dissect_timestamp(proto_tree *tree, int hf, const char *name, int len, + tvbuff_t *tvb, gint offset) { proto_item *ti; guint32 t; diff --git a/epan/dissectors/packet-hclnfsd.c b/epan/dissectors/packet-hclnfsd.c index a626126926..f1a0d537b0 100644 --- a/epan/dissectors/packet-hclnfsd.c +++ b/epan/dissectors/packet-hclnfsd.c @@ -144,18 +144,24 @@ static const value_string names_request_type[] = { { 0, NULL } }; -static void -hclnfsd_decode_obscure(char *ident, int ident_len) +static char * +hclnfsd_decode_obscure(const char *ident, int ident_len) { + char *ident_decoded, *ident_out; int j, x, y; + ident_decoded = ep_alloc(ident_len); + ident_out = ident_decoded; for (x = -1, j = 0; j < ident_len; j++) { y = *ident; x ^= *ident; - *ident++ = x; + *ident_out = x; x = y; + ident++; + ident_out++; } + return ident_decoded; } @@ -163,7 +169,8 @@ static int dissect_hclnfsd_authorize_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { guint32 request_type; - char *ident = NULL; + const char *ident = NULL; + char *ident_decoded; char *username = NULL; char *password = NULL; int ident_len = 0; @@ -204,9 +211,9 @@ dissect_hclnfsd_authorize_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_ proto_item_set_len(ident_item, ident_len); - hclnfsd_decode_obscure(ident, ident_len); + ident_decoded = hclnfsd_decode_obscure(ident, ident_len); - username = ident + 2; + username = ident_decoded + 2; password = username + strlen(username) + 1; proto_tree_add_text(ident_tree, tvb, offset, ident_len, diff --git a/epan/dissectors/packet-hdfs.c b/epan/dissectors/packet-hdfs.c index aaa31526eb..be17fc6af6 100644 --- a/epan/dissectors/packet-hdfs.c +++ b/epan/dissectors/packet-hdfs.c @@ -614,7 +614,7 @@ dissect_hdfs_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (!tvb_memeql(tvb, offset, REQUEST_STR, sizeof(REQUEST_STR) - 1)) { proto_tree_add_item(hdfs_tree, hf_hdfs_sequenceno, tvb, offset, sizeof(REQUEST_STR) - 1, ENC_ASCII|ENC_NA); - offset += sizeof(REQUEST_STR) - 1; + offset += (int)sizeof(REQUEST_STR) - 1; proto_tree_add_item(hdfs_tree, hf_hdfs_pdu_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; diff --git a/epan/dissectors/packet-hdfsdata.c b/epan/dissectors/packet-hdfsdata.c index 9bb4101200..21ff553f03 100644 --- a/epan/dissectors/packet-hdfsdata.c +++ b/epan/dissectors/packet-hdfsdata.c @@ -130,9 +130,9 @@ dissect_variable_length_long (tvbuff_t *tvb, proto_tree *hdfsdata_tree, int* off { int byte_count = 1; int idx = 0; - long i = 0; - char first_byte = tvb_get_guint8(tvb, *offset); - long size = 0; + guint i = 0; + gint8 first_byte = tvb_get_guint8(tvb, *offset); + guint size = 0; int len = decode_vint_size(first_byte); if (len == 1) { @@ -147,7 +147,7 @@ dissect_variable_length_long (tvbuff_t *tvb, proto_tree *hdfsdata_tree, int* off i = i << 8; i = i | (b & 0xFF); } - size = ((first_byte < -120 || (first_byte >= -112 && first_byte < 0)) ? (i ^ -1L) : i); + size = ((first_byte < -120 || (first_byte >= -112 && first_byte < 0)) ? (i ^ 0xFFFFFFFF) : i); proto_tree_add_item(hdfsdata_tree, hf_hdfsdata_clientlen, tvb, *offset, byte_count, ENC_BIG_ENDIAN); *offset = (*offset) + byte_count; diff --git a/epan/dissectors/packet-http.c b/epan/dissectors/packet-http.c index 32dad27aa2..7c7379af7c 100644 --- a/epan/dissectors/packet-http.c +++ b/epan/dissectors/packet-http.c @@ -1360,7 +1360,7 @@ basic_request_dissector(tvbuff_t *tvb, proto_tree *tree, int offset, http_conv_t *conv_data) { const guchar *next_token; - gchar *request_uri; + const gchar *request_uri; int tokenlen; /* The first token is the method. */ @@ -1380,7 +1380,7 @@ basic_request_dissector(tvbuff_t *tvb, proto_tree *tree, int offset, tokenlen = get_token_len(line, lineend, &next_token); /* Save the request URI for various later uses */ - request_uri = (gchar *)tvb_get_ephemeral_string(tvb, offset, tokenlen); + request_uri = tvb_get_ephemeral_string(tvb, offset, tokenlen); stat_info->request_uri = ep_strdup(request_uri); conv_data->request_uri = se_strdup(request_uri); @@ -1430,7 +1430,7 @@ basic_response_dissector(tvbuff_t *tvb, proto_tree *tree, int offset, response_code_chars[3] = '\0'; stat_info->response_code = conv_data->response_code = - strtoul(response_code_chars, NULL, 10); + (guint)strtoul(response_code_chars, NULL, 10); proto_tree_add_uint(tree, hf_http_response_code, tvb, offset, 3, stat_info->response_code); @@ -1708,7 +1708,7 @@ chunked_encoding_dissector(tvbuff_t **tvb_ptr, packet_info *pinfo, *c = '\0'; } - chunk_size = strtol((gchar*)chunk_string, NULL, 16); + chunk_size = (guint32)strtol((gchar*)chunk_string, NULL, 16); if (chunk_size > datalen) { /* @@ -1815,7 +1815,7 @@ http_payload_subdissector(tvbuff_t *tvb, proto_tree *tree, PROTO_ITEM_SET_GENERATED(item); item = proto_tree_add_uint(proxy_tree, hf_http_proxy_connect_port, - tvb, 0, 0, strtol(strings[1], NULL, 10) ); + tvb, 0, 0, (guint32)strtol(strings[1], NULL, 10) ); PROTO_ITEM_SET_GENERATED(item); } @@ -2241,7 +2241,7 @@ process_header(tvbuff_t *tvb, int offset, int next_offset, case FT_INT16: case FT_INT24: case FT_INT32: - tmp=strtol(value, NULL, 10); + tmp=(guint32)strtol(value, NULL, 10); hdr_item = proto_tree_add_uint(tree, *headers[hf_index].hf, tvb, offset, len, tmp); break; default: diff --git a/epan/dissectors/packet-http.h b/epan/dissectors/packet-http.h index afb09aaa8f..975cc8e15f 100644 --- a/epan/dissectors/packet-http.h +++ b/epan/dissectors/packet-http.h @@ -34,7 +34,7 @@ typedef struct _http_info_value_t { gchar *request_method; guint response_code; gchar *http_host; - gchar *request_uri; + const gchar *request_uri; } http_info_value_t; /* Used for HTTP Export Object feature */ diff --git a/epan/dissectors/packet-iax2.h b/epan/dissectors/packet-iax2.h index 13ff9e971b..9cfd978d67 100644 --- a/epan/dissectors/packet-iax2.h +++ b/epan/dissectors/packet-iax2.h @@ -249,8 +249,8 @@ typedef struct _iax2_info_t guint payload_len; voip_call_state callState; const gchar *messageName; - gchar *callingParty; - gchar *calledParty; + const gchar *callingParty; + const gchar *calledParty; const guint8 *payload_data; } iax2_info_t; diff --git a/epan/dissectors/packet-icep.c b/epan/dissectors/packet-icep.c index c19bc50e52..5943a1084c 100644 --- a/epan/dissectors/packet-icep.c +++ b/epan/dissectors/packet-icep.c @@ -280,7 +280,6 @@ static void dissect_ice_facet(packet_info *pinfo, proto_tree *tree, proto_item * */ guint32 Size = 0; /* number of elements in the sequence */ - char *s = NULL; (*consumed) = 0; @@ -305,9 +304,8 @@ static void dissect_ice_facet(packet_info *pinfo, proto_tree *tree, proto_item * if ( Size == 0 ) { if (tree) { - s = ep_strdup( "(empty)" ); /* display the 0x00 Size byte when click on a empty ice_string */ - proto_tree_add_string(tree, hf_icep, tvb, offset - 1, 1, s); + proto_tree_add_string(tree, hf_icep, tvb, offset - 1, 1, "(empty)"); } return; } diff --git a/epan/dissectors/packet-icmp.c b/epan/dissectors/packet-icmp.c index 4c1cecdf3a..90c84ad470 100644 --- a/epan/dissectors/packet-icmp.c +++ b/epan/dissectors/packet-icmp.c @@ -1658,9 +1658,9 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree) { guint32 frame_ts, orig_ts; - frame_ts = ((pinfo->fd->abs_ts.secs * 1000) + + frame_ts = (guint32)(((pinfo->fd->abs_ts.secs * 1000) + (pinfo->fd->abs_ts.nsecs / 1000000)) % - 86400000; + 86400000); orig_ts = get_best_guess_mstimeofday(tvb, 8, frame_ts); diff --git a/epan/dissectors/packet-icq.c b/epan/dissectors/packet-icq.c index 4d39bc80e8..14a9362b3e 100644 --- a/epan/dissectors/packet-icq.c +++ b/epan/dissectors/packet-icq.c @@ -511,10 +511,10 @@ proto_add_icq_attr(proto_tree* tree, /* The tree to add to */ len = tvb_get_letohs(tvb, offset); if (len > tvb_reported_length_remaining(tvb, offset)) return -1; /* length goes past end of packet */ - proto_tree_add_text(tree, tvb, offset, sizeof(guint16) + len, + proto_tree_add_text(tree, tvb, offset, (int)sizeof(guint16) + len, "%s[%u]: %.*s", descr, len, len, - tvb_get_ephemeral_string(tvb, offset + sizeof(guint16), len)); - return len + sizeof(guint16); + tvb_get_ephemeral_string(tvb, offset + (int)sizeof(guint16), len)); + return len + (int)sizeof(guint16); } static void @@ -643,7 +643,7 @@ icqv5_decode_msgType(proto_tree* tree, tvbuff_t *tvb, int offset, int size, "Authorization: (%u) %s",auth_suc, (auth_suc==0)?"Denied":"Allowed"); offset++; - proto_tree_add_text(subtree, tvb, offset, sizeof(guint16), "x1: 0x%04x", + proto_tree_add_text(subtree, tvb, offset, (int)sizeof(guint16), "x1: 0x%04x", tvb_get_letohs(tvb, offset)); break; } @@ -1208,10 +1208,10 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ /* Read the length field */ pktLen = tvb_get_letohs(tvb, offset); - proto_tree_add_text(sstree, tvb, offset, sizeof(guint16), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint16), "Length: %u", pktLen); - offset += sizeof(guint16); + offset += (int)sizeof(guint16); } /* FALLTHRU */ case META_USER_FOUND: @@ -1233,9 +1233,9 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ /* * Read UIN */ - proto_tree_add_text(sstree, tvb, offset, sizeof(guint32), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint32), "UIN: %u", tvb_get_letohl(tvb, offset)); - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); for ( ; *d!=NULL; d++) { len = proto_add_icq_attr(sstree, tvb, offset, *d); @@ -1249,11 +1249,11 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ "authorization: %s", (auth==0x01)?"Necessary":"Who needs it"); offset++; /* Get x2 */ - proto_tree_add_text(sstree, tvb, offset, sizeof(guint16), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint16), "x2: 0x%04x", tvb_get_letohs(tvb, offset)); - offset+=sizeof(guint16); + offset+=(int)sizeof(guint16); /* Get x3 */ - proto_tree_add_text(sstree, tvb, offset, sizeof(guint32), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint32), "x3: 0x%08x", tvb_get_letohl(tvb, offset)); break; } @@ -1263,9 +1263,9 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ /* Get the about information */ len = tvb_get_letohs(tvb, offset); - offset+=sizeof(guint16); - proto_tree_add_text(sstree, tvb, offset - sizeof(guint16), - sizeof(guint16)+len, "About(%d): %.*s", len, + offset+=(int)sizeof(guint16); + proto_tree_add_text(sstree, tvb, offset - (int)sizeof(guint16), + (int)sizeof(guint16)+len, "About(%d): %.*s", len, len, tvb_get_ephemeral_string(tvb, offset, len)); break; } @@ -1299,9 +1299,9 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ #if 0 /* Get the uin */ uin = tvb_get_letohl(tvb, offset); - proto_tree_add_text(sstree, tvb, offset, sizeof(guint32), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint32), "UIN: %u", uin); - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); #endif /* @@ -1309,10 +1309,10 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ */ while ((*d)!=NULL) { len = tvb_get_letohs(tvb, offset); - offset+=sizeof(guint16); + offset+=(int)sizeof(guint16); if (len>0) { - proto_tree_add_text(sstree, tvb, offset - sizeof(guint16), - sizeof(guint16)+len, "%s(%d): %.*s", + proto_tree_add_text(sstree, tvb, offset - (int)sizeof(guint16), + (int)sizeof(guint16)+len, "%s(%d): %.*s", *d, len, len - 1, tvb_get_ephemeral_string(tvb, offset, len - 1)); offset+=len; @@ -1321,29 +1321,29 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */ } /* Get country code */ country = tvb_get_letohs(tvb, offset); - proto_tree_add_text(sstree, tvb, offset, sizeof(guint16), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint16), "Countrycode: %u", country); - offset+=sizeof(guint16); + offset+=(int)sizeof(guint16); /* Get the timezone setting */ user_timezone = tvb_get_guint8(tvb, offset); - proto_tree_add_text(sstree, tvb, offset, sizeof(unsigned char), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(unsigned char), "Timezone: %u", user_timezone); offset++; /* Get the authorize setting */ auth = tvb_get_guint8(tvb, offset); - proto_tree_add_text(sstree, tvb, offset, sizeof(unsigned char), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(unsigned char), "Authorization: (%u) %s", auth, (auth==0)?"No":"Yes"); offset++; /* Get the webaware setting */ auth = tvb_get_guint8(tvb, offset); - proto_tree_add_text(sstree, tvb, offset, sizeof(unsigned char), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(unsigned char), "Webaware: (%u) %s", auth, (auth==0)?"No":"Yes"); offset++; /* Get the authorize setting */ auth = tvb_get_guint8(tvb, offset); - proto_tree_add_text(sstree, tvb, offset, sizeof(unsigned char), + proto_tree_add_text(sstree, tvb, offset, (int)sizeof(unsigned char), "HideIP: (%u) %s", auth, (auth==0)?"No":"Yes"); break; } @@ -1376,7 +1376,7 @@ icqv5_srv_recv_message(proto_tree* tree, /* Tree to put the data in */ ti = proto_tree_add_text(tree, tvb, offset, 4, "Body"); subtree = proto_item_add_subtree(ti, ett_icq_body); proto_tree_add_item(subtree, hf_icq_uin, tvb, offset + SRV_RECV_MSG_UIN, - sizeof(guint32), ENC_LITTLE_ENDIAN); + (int)sizeof(guint32), ENC_LITTLE_ENDIAN); year = tvb_get_letohs(tvb, offset + SRV_RECV_MSG_YEAR); month = tvb_get_guint8(tvb, offset + SRV_RECV_MSG_MONTH); day = tvb_get_guint8(tvb, offset + SRV_RECV_MSG_DAY); @@ -1384,7 +1384,7 @@ icqv5_srv_recv_message(proto_tree* tree, /* Tree to put the data in */ minute = tvb_get_guint8(tvb, offset + SRV_RECV_MSG_MINUTE); proto_tree_add_text(subtree, tvb, offset + SRV_RECV_MSG_YEAR, - sizeof(guint16) + 4*sizeof(unsigned char), + (int)sizeof(guint16) + 4*(int)sizeof(unsigned char), "Time: %u-%u-%u %02u:%02u", day, month, year, hour, minute); icqv5_decode_msgType(subtree, tvb, offset + SRV_RECV_MSG_MSG_TYPE, @@ -1412,32 +1412,32 @@ icqv5_srv_rand_user(proto_tree* tree, /* Tree to put the data in */ /* guint32 UIN */ uin = tvb_get_letohl(tvb, offset + SRV_RAND_USER_UIN); proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_UIN, - sizeof(guint32), "UIN: %u", uin); + (int)sizeof(guint32), "UIN: %u", uin); /* guint32 IP */ proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_IP, - sizeof(guint32), "IP: %s", tvb_ip_to_str(tvb, offset + SRV_RAND_USER_IP)); + (int)sizeof(guint32), "IP: %s", tvb_ip_to_str(tvb, offset + SRV_RAND_USER_IP)); /* guint16 portNum */ /* XXX - 16 bits, or 32 bits? */ port = tvb_get_letohs(tvb, offset + SRV_RAND_USER_PORT); proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_UIN, - sizeof(guint32), "Port: %u", port); + (int)sizeof(guint32), "Port: %u", port); /* guint32 realIP */ proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_REAL_IP, - sizeof(guint32), "RealIP: %s", tvb_ip_to_str(tvb, offset + SRV_RAND_USER_REAL_IP)); + (int)sizeof(guint32), "RealIP: %s", tvb_ip_to_str(tvb, offset + SRV_RAND_USER_REAL_IP)); /* guint8 Communication Class */ commClass = tvb_get_guint8(tvb, offset + SRV_RAND_USER_CLASS); proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_CLASS, - sizeof(guint8), "Class: %s", + (int)sizeof(guint8), "Class: %s", (commClass!=4)?"User to User":"Through Server"); /* guint32 status */ /* XXX - 16 bits, or 32 bits? */ status = tvb_get_letohs(tvb, offset + SRV_RAND_USER_STATUS); proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_STATUS, - sizeof(guint32), "Status: %s", findStatus(status)); + (int)sizeof(guint32), "Status: %s", findStatus(status)); /* guint16 tcpVersion */ tcpVer = tvb_get_letohs(tvb, offset + SRV_RAND_USER_TCP_VER); proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_TCP_VER, - sizeof(guint16), "TCPVersion: %u", tcpVer); + (int)sizeof(guint16), "TCPVersion: %u", tcpVer); } } diff --git a/epan/dissectors/packet-ieee80211-radiotap.c b/epan/dissectors/packet-ieee80211-radiotap.c index a9e9c5d177..e1f0f465d5 100644 --- a/epan/dissectors/packet-ieee80211-radiotap.c +++ b/epan/dissectors/packet-ieee80211-radiotap.c @@ -278,9 +278,9 @@ static const int ieee80211_vht_bw2rate_index[] = { }; struct mcs_vht_info { - char *modulation; - char *coding_rate; - float rates[4][2]; + const char *modulation; + const char *coding_rate; + float rates[4][2]; }; static const struct mcs_vht_info ieee80211_vhtinfo[MAX_MCS_VHT_INDEX+1] = { @@ -894,8 +894,8 @@ capture_radiotap(const guchar * pd, int offset, int len, packet_counts * ld) } present = pletohl(&hdr->it_present); - offset += sizeof(struct ieee80211_radiotap_header); - it_len -= sizeof(struct ieee80211_radiotap_header); + offset += (int)sizeof(struct ieee80211_radiotap_header); + it_len -= (int)sizeof(struct ieee80211_radiotap_header); /* skip over other present bitmaps */ xpresent = present; diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c index a8fe89bd50..36f8a4a377 100644 --- a/epan/dissectors/packet-ieee802154.c +++ b/epan/dissectors/packet-ieee802154.c @@ -938,7 +938,7 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g packet->key_source.addr32 = tvb_get_ntohl(tvb, offset); proto_tree_add_uint64(field_tree, hf_ieee802154_aux_sec_key_source, tvb, offset, 4, packet->key_source.addr32); proto_item_set_len(ti, 1 + 4); - offset += sizeof (guint32); + offset += (int)sizeof (guint32); } if (packet->key_id_mode == KEY_ID_MODE_KEY_EXPLICIT_8) { packet->key_source.addr64 = tvb_get_ntoh64(tvb, offset); @@ -993,12 +993,12 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g /* Frame Counter and Key Sequence Counter prepended to the payload of an encrypted frame */ if (IEEE802154_IS_ENCRYPTED(packet->security_level)) { packet->frame_counter = tvb_get_letohl (tvb, offset); - proto_tree_add_uint(ieee802154_tree, hf_ieee802154_sec_frame_counter, tvb, offset, sizeof(guint32), packet->frame_counter); - offset += sizeof(guint32); + proto_tree_add_uint(ieee802154_tree, hf_ieee802154_sec_frame_counter, tvb, offset, (int)sizeof(guint32), packet->frame_counter); + offset += (int)sizeof(guint32); packet->key_sequence_counter = tvb_get_guint8 (tvb, offset); - proto_tree_add_uint(ieee802154_tree, hf_ieee802154_sec_key_sequence_counter, tvb, offset, sizeof(guint8), packet->key_sequence_counter); - offset += sizeof(guint8); + proto_tree_add_uint(ieee802154_tree, hf_ieee802154_sec_key_sequence_counter, tvb, offset, (int)sizeof(guint8), packet->key_sequence_counter); + offset += (int)sizeof(guint8); } } @@ -2152,7 +2152,7 @@ ccm_cbc_mac(const gchar *key _U_, const gchar *iv _U_, const gchar *a _U_, gint else {memcpy(block, a, a_len); memset(block+a_len, 0, sizeof(block)-a_len);} /* Adjust pointers. */ a += sizeof(block); - a_len -= sizeof(block); + a_len -= (int)sizeof(block); /* Execute the CBC-MAC algorithm. */ if (gcry_cipher_encrypt(cipher_hd, mic, 16, block, sizeof(block))) { gcry_cipher_close(cipher_hd); @@ -2167,7 +2167,7 @@ ccm_cbc_mac(const gchar *key _U_, const gchar *iv _U_, const gchar *a _U_, gint else {memcpy(block, m, m_len); memset(block+m_len, 0, sizeof(block)-m_len);} /* Adjust pointers. */ m += sizeof(block); - m_len -= sizeof(block); + m_len -= (int)sizeof(block); /* Execute the CBC-MAC algorithm. */ if (gcry_cipher_encrypt(cipher_hd, mic, 16, block, sizeof(block))) { gcry_cipher_close(cipher_hd); diff --git a/epan/dissectors/packet-ieee802a.c b/epan/dissectors/packet-ieee802a.c index 07b2ae8ef2..117849f4d0 100644 --- a/epan/dissectors/packet-ieee802a.c +++ b/epan/dissectors/packet-ieee802a.c @@ -55,7 +55,7 @@ static GHashTable *oui_info_table = NULL; * Add an entry for a new OUI. */ void -ieee802a_add_oui(guint32 oui, const char *table_name, char *table_ui_name, +ieee802a_add_oui(guint32 oui, const char *table_name, const char *table_ui_name, hf_register_info *hf_item) { oui_info_t *new_info; diff --git a/epan/dissectors/packet-ieee802a.h b/epan/dissectors/packet-ieee802a.h index 46d9242c27..c491bde97c 100644 --- a/epan/dissectors/packet-ieee802a.h +++ b/epan/dissectors/packet-ieee802a.h @@ -27,6 +27,6 @@ /* * Add an entry for a new OUI. */ -void ieee802a_add_oui(guint32, const char *, char *, hf_register_info *); +void ieee802a_add_oui(guint32, const char *, const char *, hf_register_info *); #endif diff --git a/epan/dissectors/packet-imf.c b/epan/dissectors/packet-imf.c index 20f950a151..6f9f44c7cc 100644 --- a/epan/dissectors/packet-imf.c +++ b/epan/dissectors/packet-imf.c @@ -554,7 +554,7 @@ dissect_imf_siolabel(tvbuff_t *tvb, int offset, int length, proto_item *item, pa label_string = ep_strbuf_append(label_string, label); if (tvb_get_guint8(tvb, item_offset + 5) == '*') { /* continuations */ - int num = strtol(tvb_get_ephemeral_string(tvb, item_offset + 6, value_offset - item_offset + 6), NULL, 10); + int num = (int)strtol(tvb_get_ephemeral_string(tvb, item_offset + 6, value_offset - item_offset + 6), NULL, 10); proto_tree_add_string_format(tree, hf_imf_siolabel_label, tvb, value_offset, value_length, label, "Label[%d]: \"%s\"", num, label); } else { diff --git a/epan/dissectors/packet-ipsec.c b/epan/dissectors/packet-ipsec.c index 7e39557e4b..12424c9106 100644 --- a/epan/dissectors/packet-ipsec.c +++ b/epan/dissectors/packet-ipsec.c @@ -884,7 +884,7 @@ dissect_ah_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, col_clear(pinfo->cinfo, COL_INFO); tvb_memcpy(tvb, (guint8 *)&ah, 0, sizeof(ah)); - advance = sizeof(ah) + ((ah.ah_len - 1) << 2); + advance = (int)sizeof(ah) + ((ah.ah_len - 1) << 2); if (check_col(pinfo->cinfo, COL_INFO)) { col_add_fstr(pinfo->cinfo, COL_INFO, "AH (SPI=0x%08x)", @@ -1381,7 +1381,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) crypt_algo_libgcrypt = GCRY_CIPHER_3DES; crypt_mode_libgcrypt = GCRY_CIPHER_MODE_CBC; - decrypted_len = len - sizeof(struct newesp); + decrypted_len = len - (int)sizeof(struct newesp); if (decrypted_len <= 0) decrypt_ok = FALSE; @@ -1416,7 +1416,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) esp_iv_len = 16; crypt_mode_libgcrypt = GCRY_CIPHER_MODE_CBC; - decrypted_len = len - sizeof(struct newesp); + decrypted_len = len - (int)sizeof(struct newesp); if (decrypted_len <= 0) decrypt_ok = FALSE; @@ -1464,7 +1464,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) esp_iv_len = 8; crypt_mode_libgcrypt = GCRY_CIPHER_MODE_CBC; - decrypted_len = len - sizeof(struct newesp); + decrypted_len = len - (int)sizeof(struct newesp); if (decrypted_len <= 0) decrypt_ok = FALSE; @@ -1501,7 +1501,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) esp_iv_len = 8; crypt_algo_libgcrypt = GCRY_CIPHER_DES; crypt_mode_libgcrypt = GCRY_CIPHER_MODE_CBC; - decrypted_len = len - sizeof(struct newesp); + decrypted_len = len - (int)sizeof(struct newesp); if (decrypted_len <= 0) decrypt_ok = FALSE; @@ -1536,7 +1536,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) esp_iv_len = 8; crypt_mode_libgcrypt = GCRY_CIPHER_MODE_CTR; - decrypted_len = len - sizeof(struct newesp); + decrypted_len = len - (int)sizeof(struct newesp); if (decrypted_len <= 0) decrypt_ok = FALSE; @@ -1583,7 +1583,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) esp_iv_len = 16; crypt_mode_libgcrypt = GCRY_CIPHER_MODE_CBC; - decrypted_len = len - sizeof(struct newesp); + decrypted_len = len - (int)sizeof(struct newesp); if (decrypted_len <= 0) decrypt_ok = FALSE; @@ -1629,7 +1629,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) crypt_algo_libgcrypt = GCRY_CIPHER_BLOWFISH; crypt_mode_libgcrypt = GCRY_CIPHER_MODE_CBC; - decrypted_len = len - sizeof(struct newesp); + decrypted_len = len - (int)sizeof(struct newesp); if (decrypted_len <= 0) decrypt_ok = FALSE; @@ -1655,7 +1655,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) default : /* Fix parameters */ esp_iv_len = 0; - decrypted_len = len - sizeof(struct newesp); + decrypted_len = len - (int)sizeof(struct newesp); if (decrypted_len <= 0) decrypt_ok = FALSE; @@ -1763,7 +1763,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(decrypt_ok && (decrypted_len > esp_iv_len)) { tvb_decrypted = tvb_new_child_real_data(tvb, g_memdup(decrypted_data+sizeof(guint8)*esp_iv_len, - (decrypted_len - esp_iv_len)*sizeof(guint8)), + decrypted_len - esp_iv_len), decrypted_len - esp_iv_len, decrypted_len - esp_iv_len); g_free(decrypted_data); @@ -1871,7 +1871,7 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(!g_esp_enable_encryption_decode && g_esp_enable_authentication_check && sad_is_present) { call_dissector(data_handle, - tvb_new_subset(tvb, sizeof(struct newesp), len - sizeof(struct newesp) - esp_auth_len, -1), + tvb_new_subset(tvb, (int)sizeof(struct newesp), len - (int)sizeof(struct newesp) - esp_auth_len, -1), pinfo, esp_tree); if(esp_tree) @@ -1899,9 +1899,9 @@ dissect_esp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(dissector_try_uint(ip_dissector_table, encapsulated_protocol, tvb_new_subset(tvb, - sizeof(struct newesp), + (int)sizeof(struct newesp), -1, - len - sizeof(struct newesp) - 14 - esp_pad_len), + len - (int)sizeof(struct newesp) - 14 - esp_pad_len), pinfo, tree)) { diff --git a/epan/dissectors/packet-ipv6.c b/epan/dissectors/packet-ipv6.c index 5532863d6c..c21346741a 100644 --- a/epan/dissectors/packet-ipv6.c +++ b/epan/dissectors/packet-ipv6.c @@ -600,20 +600,20 @@ dissect_routing6(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo rthdr_tree = proto_item_add_subtree(ti, ett_ipv6); proto_tree_add_text(rthdr_tree, tvb, - offset + offsetof(struct ip6_rthdr, ip6r_nxt), 1, + offset + (int)offsetof(struct ip6_rthdr, ip6r_nxt), 1, "Next header: %s (%u)", ipprotostr(rt.ip6r_nxt), rt.ip6r_nxt); proto_tree_add_text(rthdr_tree, tvb, - offset + offsetof(struct ip6_rthdr, ip6r_len), 1, + offset + (int)offsetof(struct ip6_rthdr, ip6r_len), 1, "Length: %u (%d bytes)", rt.ip6r_len, len); proto_tree_add_item(rthdr_tree, hf_ipv6_routing_hdr_type, tvb, - offset + offsetof(struct ip6_rthdr, ip6r_type), 1, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_rthdr, ip6r_type), 1, ENC_BIG_ENDIAN); proto_tree_add_item(rthdr_tree, hf_ipv6_routing_hdr_left, tvb, - offset + offsetof(struct ip6_rthdr, ip6r_segleft), 1, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_rthdr, ip6r_segleft), 1, ENC_BIG_ENDIAN); - seg_left = tvb_get_guint8(tvb, offset + offsetof(struct ip6_rthdr, ip6r_segleft)); + seg_left = tvb_get_guint8(tvb, offset + (int)offsetof(struct ip6_rthdr, ip6r_segleft)); if (rt.ip6r_type == IPv6_RT_HEADER_SOURCE_ROUTING && len <= sizeof(buf)) { struct e_in6_addr *a; @@ -627,12 +627,12 @@ dissect_routing6(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo a < (struct e_in6_addr *)(buf + len); a++, n++) { proto_tree_add_item(rthdr_tree, hf_ipv6_routing_hdr_addr, tvb, - offset + offsetof(struct ip6_rthdr0, ip6r0_addr) - + n * sizeof(struct e_in6_addr), - sizeof(struct e_in6_addr), ENC_NA); + offset + (int)(offsetof(struct ip6_rthdr0, ip6r0_addr) + + n * sizeof(struct e_in6_addr)), + (int)sizeof(struct e_in6_addr), ENC_NA); if (seg_left) TVB_SET_ADDRESS(&pinfo->dst, AT_IPv6, tvb, - offset + offsetof(struct ip6_rthdr0, ip6r0_addr) + n * sizeof(struct e_in6_addr), 16); + offset + (int)offsetof(struct ip6_rthdr0, ip6r0_addr) + n * (int)sizeof(struct e_in6_addr), 16); } } if (rt.ip6r_type == IPv6_RT_HEADER_MobileIP) { @@ -820,21 +820,21 @@ dissect_frag6(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, rthdr_tree = proto_item_add_subtree(ti, ett_ipv6); proto_tree_add_item(rthdr_tree, hf_ipv6_frag_nxt, tvb, - offset + offsetof(struct ip6_frag, ip6f_nxt), 1, + offset + (int)offsetof(struct ip6_frag, ip6f_nxt), 1, ENC_BIG_ENDIAN); proto_tree_add_item(rthdr_tree, hf_ipv6_frag_reserved, tvb, - offset + offsetof(struct ip6_frag, ip6f_reserved), 1, + offset + (int)offsetof(struct ip6_frag, ip6f_reserved), 1, ENC_BIG_ENDIAN); proto_tree_add_item(rthdr_tree, hf_ipv6_frag_offset, tvb, - offset + offsetof(struct ip6_frag, ip6f_offlg), 2, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_frag, ip6f_offlg), 2, ENC_BIG_ENDIAN); proto_tree_add_item(rthdr_tree, hf_ipv6_frag_reserved_bits, tvb, - offset + offsetof(struct ip6_frag, ip6f_offlg), 2, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_frag, ip6f_offlg), 2, ENC_BIG_ENDIAN); proto_tree_add_item(rthdr_tree, hf_ipv6_frag_more, tvb, - offset + offsetof(struct ip6_frag, ip6f_offlg), 2, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_frag, ip6f_offlg), 2, ENC_BIG_ENDIAN); proto_tree_add_item(rthdr_tree, hf_ipv6_frag_id, tvb, - offset + offsetof(struct ip6_frag, ip6f_ident), 4, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_frag, ip6f_ident), 4, ENC_BIG_ENDIAN); } return len; } @@ -1580,17 +1580,17 @@ dissect_shim6(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info * pinfo) /* Next Header */ proto_tree_add_uint_format(shim_tree, hf_ipv6_shim6_nxt, tvb, - offset + offsetof(struct ip6_shim, ip6s_nxt), 1, shim.ip6s_nxt, + offset + (int)offsetof(struct ip6_shim, ip6s_nxt), 1, shim.ip6s_nxt, "Next header: %s (%u)", ipprotostr(shim.ip6s_nxt), shim.ip6s_nxt); /* Header Extension Length */ proto_tree_add_uint_format(shim_tree, hf_ipv6_shim6_len, tvb, - offset + offsetof(struct ip6_shim, ip6s_len), 1, shim.ip6s_len, + offset + (int)offsetof(struct ip6_shim, ip6s_len), 1, shim.ip6s_len, "Header Ext Length: %u (%d bytes)", shim.ip6s_len, len); /* P Field */ proto_tree_add_item(shim_tree, hf_ipv6_shim6_p, tvb, - offset + offsetof(struct ip6_shim, ip6s_p), 1, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_shim, ip6s_p), 1, ENC_BIG_ENDIAN); /* skip the first 2 bytes (nxt hdr, hdr ext len, p+7bits) */ p = offset + 3; @@ -1605,7 +1605,7 @@ dissect_shim6(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info * pinfo) /* Payload Extension Header */ proto_tree_add_none_format(shim_tree, hf_ipv6_shim6_ct, tvb, - offset + offsetof(struct ip6_shim, ip6s_p), 6, + offset + (int)offsetof(struct ip6_shim, ip6s_p), 6, "Receiver Context Tag: %02x %02x %02x %02x %02x %02x", shim.ip6s_p & SHIM6_BITMASK_CT, tmp[0], tmp[1], tmp[2], tmp[3], tmp[4]); } @@ -1617,7 +1617,7 @@ dissect_shim6(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info * pinfo) /* Message Type */ proto_tree_add_item(shim_tree, hf_ipv6_shim6_type, tvb, - offset + offsetof(struct ip6_shim, ip6s_p), 1, + offset + (int)offsetof(struct ip6_shim, ip6s_p), 1, ENC_BIG_ENDIAN ); @@ -1687,7 +1687,7 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) plen = g_ntohs(ipv6.ip6_plen); /* Adjust the length of this tvbuff to include only the IPv6 datagram. */ - set_actual_length(tvb, plen + sizeof (struct ip6_hdr)); + set_actual_length(tvb, plen + (guint)sizeof (struct ip6_hdr)); TVB_SET_ADDRESS(&pinfo->net_src, AT_IPv6, tvb, offset + IP6H_SRC, 16); TVB_SET_ADDRESS(&pinfo->src, AT_IPv6, tvb, offset + IP6H_SRC, 16); @@ -1706,47 +1706,47 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* !!! warning: (4-bit) version, (6-bit) DSCP, (1-bit) ECN-ECT, (1-bit) ECN-CE and (20-bit) Flow */ pi = proto_tree_add_item(ipv6_tree, hf_ipv6_version, tvb, - offset + offsetof(struct ip6_hdr, ip6_vfc), 1, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_vfc), 1, ENC_BIG_ENDIAN); pt = proto_item_add_subtree(pi,ett_ipv6_version); pi = proto_tree_add_item(pt, hf_ip_version, tvb, - offset + offsetof(struct ip6_hdr, ip6_vfc), 1, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_vfc), 1, ENC_BIG_ENDIAN); PROTO_ITEM_SET_GENERATED(pi); ipv6_tc = proto_tree_add_item(ipv6_tree, hf_ipv6_class, tvb, - offset + offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); ipv6_tc_tree = proto_item_add_subtree(ipv6_tc, ett_ipv6_traffic_class); proto_tree_add_item(ipv6_tc_tree, hf_ipv6_traffic_class_dscp, tvb, - offset + offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); proto_tree_add_item(ipv6_tc_tree, hf_ipv6_traffic_class_ect, tvb, - offset + offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); proto_tree_add_item(ipv6_tc_tree, hf_ipv6_traffic_class_ce, tvb, - offset + offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); proto_tree_add_item(ipv6_tree, hf_ipv6_flow, tvb, - offset + offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_flow), 4, ENC_BIG_ENDIAN); proto_tree_add_item(ipv6_tree, hf_ipv6_plen, tvb, - offset + offsetof(struct ip6_hdr, ip6_plen), 2, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_plen), 2, ENC_BIG_ENDIAN); proto_tree_add_uint_format(ipv6_tree, hf_ipv6_nxt, tvb, - offset + offsetof(struct ip6_hdr, ip6_nxt), 1, + offset + (int)offsetof(struct ip6_hdr, ip6_nxt), 1, ipv6.ip6_nxt, "Next header: %s (%u)", ipprotostr(ipv6.ip6_nxt), ipv6.ip6_nxt); proto_tree_add_item(ipv6_tree, hf_ipv6_hlim, tvb, - offset + offsetof(struct ip6_hdr, ip6_hlim), 1, ENC_BIG_ENDIAN); + offset + (int)offsetof(struct ip6_hdr, ip6_hlim), 1, ENC_BIG_ENDIAN); /* Yes, there is not TTL in IPv6 Header... but it is the same of Hop Limit...*/ - pinfo->ip_ttl = tvb_get_guint8(tvb, offset + offsetof(struct ip6_hdr, ip6_hlim)); + pinfo->ip_ttl = tvb_get_guint8(tvb, offset + (int)offsetof(struct ip6_hdr, ip6_hlim)); /* Add the different items for the source address */ proto_tree_add_item(ipv6_tree, hf_ipv6_src, tvb, - offset + offsetof(struct ip6_hdr, ip6_src), 16, ENC_NA); + offset + (int)offsetof(struct ip6_hdr, ip6_src), 16, ENC_NA); ti = proto_tree_add_ipv6(ipv6_tree, hf_ipv6_addr, tvb, - offset + offsetof(struct ip6_hdr, ip6_src), + offset + (int)offsetof(struct ip6_hdr, ip6_src), 16, (guint8 *)&ipv6.ip6_src); PROTO_ITEM_SET_HIDDEN(ti); name = get_addr_name(&pinfo->src); @@ -1754,12 +1754,12 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_append_text(ipv6_item, ", Src: %s (%s)", name, ip6_to_str(&ipv6.ip6_src)); } ti = proto_tree_add_string(ipv6_tree, hf_ipv6_src_host, tvb, - offset + offsetof(struct ip6_hdr, ip6_src), + offset + (int)offsetof(struct ip6_hdr, ip6_src), 16, name); PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_HIDDEN(ti); ti = proto_tree_add_string(ipv6_tree, hf_ipv6_host, tvb, - offset + offsetof(struct ip6_hdr, ip6_src), + offset + (int)offsetof(struct ip6_hdr, ip6_src), 16, name); PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_HIDDEN(ti); @@ -1831,9 +1831,9 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Add different items for the destination address */ proto_tree_add_item(ipv6_tree, hf_ipv6_dst, tvb, - offset + offsetof(struct ip6_hdr, ip6_dst), 16, ENC_NA); + offset + (int)offsetof(struct ip6_hdr, ip6_dst), 16, ENC_NA); ti = proto_tree_add_ipv6(ipv6_tree, hf_ipv6_addr, tvb, - offset + offsetof(struct ip6_hdr, ip6_dst), + offset + (int)offsetof(struct ip6_hdr, ip6_dst), 16, (guint8 *)&ipv6.ip6_dst); PROTO_ITEM_SET_HIDDEN(ti); name = get_addr_name(&pinfo->dst); @@ -1841,12 +1841,12 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item_append_text(ipv6_item, ", Dst: %s (%s)", name, ip6_to_str(&ipv6.ip6_dst)); } ti = proto_tree_add_string(ipv6_tree, hf_ipv6_dst_host, tvb, - offset + offsetof(struct ip6_hdr, ip6_dst), + offset + (int)offsetof(struct ip6_hdr, ip6_dst), 16, name); PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_HIDDEN(ti); ti = proto_tree_add_string(ipv6_tree, hf_ipv6_host, tvb, - offset + offsetof(struct ip6_hdr, ip6_dst), + offset + (int)offsetof(struct ip6_hdr, ip6_dst), 16, name); PROTO_ITEM_SET_GENERATED(ti); PROTO_ITEM_SET_HIDDEN(ti); @@ -1925,7 +1925,7 @@ dissect_ipv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* start of the new header (could be a extension header) */ nxt = tvb_get_guint8(tvb, offset + 6); - offset += sizeof(struct ip6_hdr); + offset += (int)sizeof(struct ip6_hdr); offlg = 0; ident = 0; @@ -2032,7 +2032,7 @@ again: /* collect packet info */ pinfo->ipproto = nxt; - pinfo->iplen = sizeof(ipv6) + plen + offset; + pinfo->iplen = (int)sizeof(ipv6) + plen + offset; pinfo->iphdrlen = offset; tap_queue_packet(ipv6_tap, pinfo, &ipv6); diff --git a/epan/dissectors/packet-isakmp.c b/epan/dissectors/packet-isakmp.c index 8343e54d3d..28b12c6abc 100644 --- a/epan/dissectors/packet-isakmp.c +++ b/epan/dissectors/packet-isakmp.c @@ -1513,7 +1513,7 @@ static const value_string rohc_attr_type[] = { { 0, NULL }, }; -#define ISAKMP_HDR_SIZE (sizeof(struct isakmp_hdr) + (2 * COOKIE_SIZE)) +#define ISAKMP_HDR_SIZE ((int)sizeof(struct isakmp_hdr) + (2 * COOKIE_SIZE)) #ifdef HAVE_LIBGCRYPT @@ -4804,7 +4804,7 @@ isakmp_hash_func(gconstpointer c) { guint val = 0, keychunk, i; /* XOR our icookie down to the size of a guint */ - for (i = 0; i < COOKIE_SIZE - (COOKIE_SIZE % sizeof(keychunk)); i += sizeof(keychunk)) { + for (i = 0; i < COOKIE_SIZE - (COOKIE_SIZE % (guint)sizeof(keychunk)); i += (guint)sizeof(keychunk)) { memcpy(&keychunk, &i_cookie[i], sizeof(keychunk)); val ^= keychunk; } @@ -4826,11 +4826,11 @@ static guint ikev2_key_hash_func(gconstpointer k) { guint hash = 0, keychunk, i; /* XOR our icookie down to the size of a guint */ - for (i = 0; i < key->spii_len - (key->spii_len % sizeof(keychunk)); i += sizeof(keychunk)) { + for (i = 0; i < key->spii_len - (key->spii_len % (guint)sizeof(keychunk)); i += (guint)sizeof(keychunk)) { memcpy(&keychunk, &key->spii[i], sizeof(keychunk)); hash ^= keychunk; } - for (i = 0; i < key->spir_len - (key->spir_len % sizeof(keychunk)); i += sizeof(keychunk)) { + for (i = 0; i < key->spir_len - (key->spir_len % (guint)sizeof(keychunk)); i += (guint)sizeof(keychunk)) { memcpy(&keychunk, &key->spir[i], sizeof(keychunk)); hash ^= keychunk; } diff --git a/epan/dissectors/packet-jxta.c b/epan/dissectors/packet-jxta.c index 027f356301..0932c554c0 100644 --- a/epan/dissectors/packet-jxta.c +++ b/epan/dissectors/packet-jxta.c @@ -421,7 +421,7 @@ static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr return 0; } - offset += sizeof(JXTA_UDP_SIG); + offset += (int)sizeof(JXTA_UDP_SIG); jxta_message_framing_tvb = tvb_new_subset_remaining(tvb, offset); processed = dissect_jxta_message_framing(jxta_message_framing_tvb, pinfo, NULL, &content_length, &content_type); @@ -471,8 +471,8 @@ static int dissect_jxta_udp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tr gchar *content_type = NULL; tvbuff_t *jxta_message_tvb; - proto_tree_add_item(jxta_udp_tree, hf_jxta_udpsig, tvb, tree_offset, sizeof(JXTA_UDP_SIG), ENC_ASCII|ENC_NA); - tree_offset += sizeof(JXTA_UDP_SIG); + proto_tree_add_item(jxta_udp_tree, hf_jxta_udpsig, tvb, tree_offset, (int)sizeof(JXTA_UDP_SIG), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(JXTA_UDP_SIG); jxta_message_framing_tvb = tvb_new_subset_remaining(tvb, tree_offset); @@ -988,7 +988,7 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro break; } else { headername_len = tvb_get_guint8(tvb, offset); - offset += sizeof(guint8); + offset += (int)sizeof(guint8); headername_offset = offset; available = tvb_reported_length_remaining(tvb, offset); @@ -1009,7 +1009,7 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro break; } else { headervalue_len = tvb_get_ntohs(tvb, offset); - offset += sizeof(guint16); + offset += (int)sizeof(guint16); headervalue_offset = offset; available = tvb_reported_length_remaining(tvb, offset); @@ -1061,35 +1061,35 @@ static int dissect_jxta_message_framing(tvbuff_t * tvb, packet_info * pinfo, pro /* * Put header name into the protocol tree */ - proto_tree_add_item(framing_header_tree, hf_jxta_framing_header_name, tvb, tree_offset, sizeof(gint8), ENC_ASCII|ENC_NA); + proto_tree_add_item(framing_header_tree, hf_jxta_framing_header_name, tvb, tree_offset, (int)sizeof(gint8), ENC_ASCII|ENC_NA); /* * Append header name into the header protocol item. It's a nice hint so you don't have to reveal all headers. */ if (headernamelen > 0) { proto_item_append_text(framing_header_tree_item, " \"%s\"", - tvb_format_text(tvb, tree_offset + sizeof(guint8), headernamelen)); + tvb_format_text(tvb, tree_offset + (int)sizeof(guint8), headernamelen)); } - tree_offset += sizeof(guint8) + headernamelen; + tree_offset += (int)sizeof(guint8) + headernamelen; if (headernamelen > 0) { guint16 headervaluelen = tvb_get_ntohs(tvb, tree_offset); if (tree) { proto_tree_add_uint(framing_header_tree, hf_jxta_framing_header_value_length, tvb, tree_offset, - sizeof(guint16), headervaluelen); + (int)sizeof(guint16), headervaluelen); /** TODO bondolo Add specific handling for known header types */ /* * Put header value into protocol tree. */ - proto_tree_add_item(framing_header_tree, hf_jxta_framing_header_value, tvb, tree_offset + sizeof(guint16), + proto_tree_add_item(framing_header_tree, hf_jxta_framing_header_value, tvb, tree_offset + (int)sizeof(guint16), headervaluelen, ENC_NA); } - tree_offset += sizeof(guint16) + headervaluelen; + tree_offset += (int)sizeof(guint16) + headervaluelen; } proto_item_set_end(framing_header_tree_item, tvb, tree_offset); @@ -1150,7 +1150,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree return 0; } - offset += sizeof(JXTA_MSG_SIG); + offset += (int)sizeof(JXTA_MSG_SIG); available = tvb_reported_length_remaining(tvb, offset); if (available < sizeof(guint8)) { @@ -1159,7 +1159,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree } else { message_version = tvb_get_guint8(tvb, offset); - offset += sizeof(guint8); + offset += (int)sizeof(guint8); if ((JXTA_MSG_VERSION_1 != message_version) && (JXTA_MSG_VERSION_2 != message_version)) { /* Sort of a lie, we say that we don't recognize it at all. */ @@ -1174,7 +1174,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree needed = (gint) (sizeof(guint8) - available); break; } else { - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } } @@ -1187,7 +1187,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree guint16 msg_names_count = tvb_get_ntohs(tvb, offset); guint each_name; - offset += sizeof(guint16); + offset += (int)sizeof(guint16); for (each_name = 0; each_name < msg_names_count; each_name++) { guint16 name_len; @@ -1200,13 +1200,13 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree name_len = tvb_get_ntohs(tvb, offset); - available = tvb_reported_length_remaining(tvb, offset + sizeof(name_len)); + available = tvb_reported_length_remaining(tvb, offset + (int)sizeof(name_len)); if (available < name_len) { needed = (gint) (name_len - available); break; } - offset += sizeof(name_len) + name_len; + offset += (int)sizeof(name_len) + name_len; } } @@ -1219,7 +1219,7 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree guint16 elem_count = tvb_get_ntohs(tvb, offset); guint each_elem; - offset += sizeof(guint16); + offset += (int)sizeof(guint16); /* parse elements */ for (each_elem = 0; each_elem < elem_count; each_elem++) { @@ -1309,8 +1309,8 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree jxta_msg_tree = proto_item_add_subtree(jxta_msg_tree_item, ett_jxta_msg); - proto_tree_add_item(jxta_msg_tree, hf_jxta_message_sig, tvb, tree_offset, sizeof(JXTA_MSG_SIG), ENC_ASCII|ENC_NA); - tree_offset += sizeof(JXTA_MSG_SIG); + proto_tree_add_item(jxta_msg_tree, hf_jxta_message_sig, tvb, tree_offset, (int)sizeof(JXTA_MSG_SIG), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(JXTA_MSG_SIG); tree_item = proto_tree_add_string(jxta_msg_tree, hf_jxta_message_src, tvb, 0, 0, src_addr->str); PROTO_ITEM_SET_GENERATED(tree_item); @@ -1345,21 +1345,21 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree } message_version = tvb_get_guint8(tvb, tree_offset); - proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_version, tvb, tree_offset, sizeof(guint8), message_version); - tree_offset += sizeof(guint8); + proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_version, tvb, tree_offset, (int)sizeof(guint8), message_version); + tree_offset += (int)sizeof(guint8); if( message_version > 0 ) { guint8 flags = tvb_get_guint8(tvb, tree_offset); - proto_item *flags_ti = proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_flags, tvb, tree_offset, sizeof(guint8), flags); + proto_item *flags_ti = proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_flags, tvb, tree_offset, (int)sizeof(guint8), flags); proto_tree *jxta_msg_flags_tree = proto_item_add_subtree(flags_ti, ett_jxta_msg_flags); proto_tree_add_boolean(jxta_msg_flags_tree, hf_jxta_message_flag_utf16be, tvb, tree_offset, 1, flags); proto_tree_add_boolean(jxta_msg_flags_tree, hf_jxta_message_flag_ucs32be, tvb, tree_offset, 1, flags); - tree_offset += sizeof(guint8); + tree_offset += (int)sizeof(guint8); } msg_names_count = tvb_get_ntohs(tvb, tree_offset); - proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_names_count, tvb, tree_offset, sizeof(guint16), msg_names_count); - tree_offset += sizeof(guint16); + proto_tree_add_uint(jxta_msg_tree, hf_jxta_message_names_count, tvb, tree_offset, (int)sizeof(guint16), msg_names_count); + tree_offset += (int)sizeof(guint16); names_table = ep_alloc((msg_names_count + 2) * sizeof(const gchar *)); names_table[0] = ""; @@ -1369,15 +1369,15 @@ static int dissect_jxta_message(tvbuff_t * tvb, packet_info * pinfo, proto_tree for (each_name = 0; each_name < msg_names_count; each_name++) { guint16 name_len = tvb_get_ntohs(tvb, tree_offset); - names_table[2 + each_name] = tvb_get_ephemeral_string(tvb, tree_offset + sizeof(name_len), name_len); - proto_tree_add_item(jxta_msg_tree, hf_jxta_message_names_name, tvb, tree_offset, sizeof(name_len), ENC_ASCII|ENC_NA); - tree_offset += sizeof(name_len) + name_len; + names_table[2 + each_name] = tvb_get_ephemeral_string(tvb, tree_offset + (int)sizeof(name_len), name_len); + proto_tree_add_item(jxta_msg_tree, hf_jxta_message_names_name, tvb, tree_offset, (int)sizeof(name_len), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(name_len) + name_len; } /* parse element count */ elem_count = tvb_get_ntohs(tvb, tree_offset); - proto_tree_add_item(jxta_msg_tree, hf_jxta_message_element_count, tvb, tree_offset, sizeof(guint16), ENC_BIG_ENDIAN); - tree_offset += sizeof(guint16); + proto_tree_add_item(jxta_msg_tree, hf_jxta_message_element_count, tvb, tree_offset, (int)sizeof(guint16), ENC_BIG_ENDIAN); + tree_offset += (int)sizeof(guint16); /* FIXME bondolo Element count 0 (Process elements until FIN) should be supported. */ @@ -1442,7 +1442,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p return 0; } - offset += sizeof(JXTA_MSGELEM_SIG); + offset += (int)sizeof(JXTA_MSGELEM_SIG); /* namespace id field */ available = tvb_reported_length_remaining(tvb, offset); @@ -1451,7 +1451,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p break; } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* flags field */ available = tvb_reported_length_remaining(tvb, offset); @@ -1460,7 +1460,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p break; } else { flags = tvb_get_guint8(tvb, offset); - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } /* name field */ @@ -1470,7 +1470,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p break; } else { guint16 name_len = tvb_get_ntohs(tvb, offset); - offset += sizeof(guint16); + offset += (int)sizeof(guint16); available = tvb_reported_length_remaining(tvb, offset); if (available < name_len) { @@ -1492,7 +1492,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p } type_len = tvb_get_ntohs(tvb, offset); - offset += sizeof(guint16); + offset += (int)sizeof(guint16); available = tvb_reported_length_remaining(tvb, offset); if (available < type_len) { @@ -1514,7 +1514,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p } encoding_len = tvb_get_ntohs(tvb, offset); - offset += sizeof(guint16); + offset += (int)sizeof(guint16); available = tvb_reported_length_remaining(tvb, offset); if (available < encoding_len) { @@ -1532,7 +1532,7 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p break; } else { guint32 content_len = tvb_get_ntohl(tvb, offset); - offset += sizeof(guint32); + offset += (int)sizeof(guint32); available = tvb_reported_length_remaining(tvb, offset); if (available < content_len) { @@ -1588,37 +1588,37 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p gchar *mediatype = NULL; tvbuff_t *element_content_tvb; - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_sig, tvb, tree_offset, sizeof(JXTA_MSGELEM_SIG), ENC_ASCII|ENC_NA); - tree_offset += sizeof(JXTA_MSGELEM_SIG); + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_sig, tvb, tree_offset, (int)sizeof(JXTA_MSGELEM_SIG), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(JXTA_MSGELEM_SIG); namespaceID = tvb_get_guint8(tvb, tree_offset); namespace_ti = - proto_tree_add_uint(jxta_elem_tree, hf_jxta_element1_namespaceid, tvb, tree_offset, sizeof(guint8), namespaceID); + proto_tree_add_uint(jxta_elem_tree, hf_jxta_element1_namespaceid, tvb, tree_offset, (int)sizeof(guint8), namespaceID); if (namespaceID < ns_count) { proto_item_append_text(namespace_ti, " (%s)", names_table[namespaceID]); } else { proto_item_append_text(namespace_ti, " * BAD *"); } - tree_offset += sizeof(guint8); + tree_offset += (int)sizeof(guint8); flags = tvb_get_guint8(tvb, tree_offset); - flags_ti = proto_tree_add_uint(jxta_elem_tree, hf_jxta_element_flags, tvb, tree_offset, sizeof(guint8), flags); + flags_ti = proto_tree_add_uint(jxta_elem_tree, hf_jxta_element_flags, tvb, tree_offset, (int)sizeof(guint8), flags); jxta_elem_flags_tree = proto_item_add_subtree(flags_ti, ett_jxta_elem_1_flags); proto_tree_add_boolean(jxta_elem_flags_tree, hf_jxta_element1_flag_hasType, tvb, tree_offset, 1, flags); proto_tree_add_boolean(jxta_elem_flags_tree, hf_jxta_element1_flag_hasEncoding, tvb, tree_offset, 1, flags); proto_tree_add_boolean(jxta_elem_flags_tree, hf_jxta_element1_flag_hasSignature, tvb, tree_offset, 1, flags); - tree_offset += sizeof(guint8); + tree_offset += (int)sizeof(guint8); name_len = tvb_get_ntohs(tvb, tree_offset); - proto_item_append_text(jxta_elem_tree_item, " \"%s\"", tvb_format_text(tvb, tree_offset + sizeof(guint16), name_len)); - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_name, tvb, tree_offset, sizeof(guint16), ENC_ASCII|ENC_NA); - tree_offset += sizeof(guint16) + name_len; + proto_item_append_text(jxta_elem_tree_item, " \"%s\"", tvb_format_text(tvb, tree_offset + (int)sizeof(guint16), name_len)); + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_name, tvb, tree_offset, (int)sizeof(guint16), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(guint16) + name_len; /* process type */ if ((flags & JXTAMSG1_ELMFLAG_TYPE) != 0) { guint16 type_len = tvb_get_ntohs(tvb, tree_offset); - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_type, tvb, tree_offset, sizeof(guint16), ENC_ASCII|ENC_NA); - tree_offset += sizeof(guint16); + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_type, tvb, tree_offset, (int)sizeof(guint16), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(guint16); mediatype = tvb_get_ephemeral_string(tvb, tree_offset, type_len); @@ -1628,14 +1628,14 @@ static int dissect_jxta_message_element_1(tvbuff_t * tvb, packet_info * pinfo, p /* process encoding */ if ((flags & JXTAMSG1_ELMFLAG_ENCODING) != 0) { guint16 encoding_len = tvb_get_ntohs(tvb, tree_offset); - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_encoding, tvb, tree_offset, sizeof(guint16), ENC_ASCII|ENC_NA); - tree_offset += sizeof(guint16) + encoding_len; + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_encoding, tvb, tree_offset, (int)sizeof(guint16), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(guint16) + encoding_len; } /* content */ content_len = tvb_get_ntohl(tvb, tree_offset); - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_content_len, tvb, tree_offset, sizeof(guint32), ENC_BIG_ENDIAN); - tree_offset += sizeof(guint32); + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_content_len, tvb, tree_offset, (int)sizeof(guint32), ENC_BIG_ENDIAN); + tree_offset += (int)sizeof(guint32); element_content_tvb = tvb_new_subset(tvb, tree_offset, content_len, content_len); @@ -1690,7 +1690,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p return 0; } - offset += sizeof(JXTA_MSGELEM_SIG); + offset += (int)sizeof(JXTA_MSGELEM_SIG); /* flags field */ available = tvb_reported_length_remaining(tvb, offset); @@ -1699,7 +1699,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p break; } else { flags = tvb_get_guint8(tvb, offset); - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } /* namespace id field */ @@ -1709,7 +1709,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p break; } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); /* name field */ if ((flags & JXTAMSG2_ELMFLAG_NAME_LITERAL) == 0) { @@ -1719,7 +1719,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p break; } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); } else { /* literal name field */ available = tvb_reported_length_remaining(tvb, offset); @@ -1728,7 +1728,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p break; } else { guint16 name_len = tvb_get_ntohs(tvb, offset); - offset += sizeof(guint16); + offset += (int)sizeof(guint16); available = tvb_reported_length_remaining(tvb, offset); if (available < name_len) { @@ -1748,7 +1748,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p break; } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); } /* encoding field */ @@ -1759,7 +1759,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p break; } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); } @@ -1771,7 +1771,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p break; } else { guint64 content_len = tvb_get_ntoh64(tvb, offset); - offset += sizeof(guint64); + offset += (int)sizeof(guint64); available = tvb_reported_length_remaining(tvb, offset); if (available < content_len) { @@ -1788,7 +1788,7 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p break; } else { guint64 content_len = tvb_get_ntohl(tvb, offset); - offset += sizeof(guint32); + offset += (int)sizeof(guint32); available = tvb_reported_length_remaining(tvb, offset); if (available < content_len) { @@ -1846,11 +1846,11 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p const gchar *mediatype = NULL; tvbuff_t *element_content_tvb; - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_sig, tvb, tree_offset, sizeof(JXTA_MSGELEM_SIG), ENC_ASCII|ENC_NA); - tree_offset += sizeof(JXTA_MSGELEM_SIG); + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_sig, tvb, tree_offset, (int)sizeof(JXTA_MSGELEM_SIG), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(JXTA_MSGELEM_SIG); flags = tvb_get_guint8(tvb, tree_offset); - flags_ti = proto_tree_add_uint(jxta_elem_tree, hf_jxta_element_flags, tvb, tree_offset, sizeof(guint8), flags); + flags_ti = proto_tree_add_uint(jxta_elem_tree, hf_jxta_element_flags, tvb, tree_offset, (int)sizeof(guint8), flags); jxta_elem_flags_tree = proto_item_add_subtree(flags_ti, ett_jxta_elem_2_flags); proto_tree_add_boolean(jxta_elem_flags_tree, hf_jxta_element2_flag_64bitlens, tvb, tree_offset, 1, flags); proto_tree_add_boolean(jxta_elem_flags_tree, hf_jxta_element2_flag_nameLiteral, tvb, tree_offset, 1, flags); @@ -1858,43 +1858,43 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p proto_tree_add_boolean(jxta_elem_flags_tree, hf_jxta_element2_flag_hasSignature, tvb, tree_offset, 1, flags); proto_tree_add_boolean(jxta_elem_flags_tree, hf_jxta_element2_flag_hasEncoding, tvb, tree_offset, 1, flags); proto_tree_add_boolean(jxta_elem_flags_tree, hf_jxta_element2_flag_sigOfEncoded, tvb, tree_offset, 1, flags); - tree_offset += sizeof(guint8); + tree_offset += (int)sizeof(guint8); /* Namespace */ namespaceID = tvb_get_ntohs(tvb, tree_offset); namespace_ti = - proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_namespaceid, tvb, tree_offset, sizeof(guint16), namespaceID); + proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_namespaceid, tvb, tree_offset, (int)sizeof(guint16), namespaceID); if (namespaceID < names_count) { proto_item_append_text(namespace_ti, " (%s)", names_table[namespaceID]); } else { proto_item_append_text(namespace_ti, " * BAD *"); } - tree_offset += sizeof(guint16); + tree_offset += (int)sizeof(guint16); /* Name */ if ((flags & JXTAMSG2_ELMFLAG_NAME_LITERAL) == 0) { nameID = tvb_get_ntohs(tvb, tree_offset); name_ti = - proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_nameid, tvb, tree_offset, sizeof(guint16), nameID); + proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_nameid, tvb, tree_offset, (int)sizeof(guint16), nameID); if (namespaceID < names_count) { proto_item_append_text(name_ti, " (%s)", names_table[nameID]); } else { proto_item_append_text(name_ti, " * BAD *"); } - tree_offset += sizeof(guint16); + tree_offset += (int)sizeof(guint16); } else { /* literal name */ guint16 name_len = tvb_get_ntohs(tvb, tree_offset); - proto_item_append_text(jxta_elem_tree_item, " \"%s\"", tvb_format_text(tvb, tree_offset + sizeof(guint16), name_len)); - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_name, tvb, tree_offset, sizeof(guint16), ENC_ASCII|ENC_NA); - tree_offset += sizeof(guint16) + name_len; + proto_item_append_text(jxta_elem_tree_item, " \"%s\"", tvb_format_text(tvb, tree_offset + (int)sizeof(guint16), name_len)); + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_name, tvb, tree_offset, (int)sizeof(guint16), ENC_ASCII|ENC_NA); + tree_offset += (int)sizeof(guint16) + name_len; } /* process type */ if ((flags & JXTAMSG2_ELMFLAG_TYPE) != 0) { guint16 mimeID = tvb_get_ntohs(tvb, tree_offset); proto_item *mime_ti = - proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_mimeid, tvb, tree_offset, sizeof(guint16), mimeID); + proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_mimeid, tvb, tree_offset, (int)sizeof(guint16), mimeID); if (mimeID < names_count) { proto_item_append_text(mime_ti, " (%s)", names_table[mimeID]); @@ -1903,16 +1903,16 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p proto_item_append_text(mime_ti, " * BAD *"); } - tree_offset += sizeof(guint16); + tree_offset += (int)sizeof(guint16); } else { - mediatype = "application/octect-stream"; + mediatype = "application/octet-stream"; } /* process encoding */ if ((flags & JXTAMSG2_ELMFLAG_ENCODINGS) != 0) { guint16 encodingID = tvb_get_ntohs(tvb, tree_offset); proto_item *encoding_ti = - proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_encodingid, tvb, tree_offset, sizeof(guint16), encodingID); + proto_tree_add_uint(jxta_elem_tree, hf_jxta_element2_encodingid, tvb, tree_offset, (int)sizeof(guint16), encodingID); if (encodingID < names_count) { proto_item_append_text(encoding_ti, " (%s)", names_table[encodingID]); @@ -1920,18 +1920,18 @@ static int dissect_jxta_message_element_2(tvbuff_t * tvb, packet_info * pinfo, p proto_item_append_text(encoding_ti, " * BAD *"); } - tree_offset += sizeof(guint16); + tree_offset += (int)sizeof(guint16); } if ((flags & JXTAMSG2_ELMFLAG_UINT64_LENS) != 0) { content_len = tvb_get_ntoh64(tvb, tree_offset); - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_content_len64, tvb, tree_offset, sizeof(guint64), ENC_BIG_ENDIAN); - tree_offset += sizeof(guint64); + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_content_len64, tvb, tree_offset, (int)sizeof(guint64), ENC_BIG_ENDIAN); + tree_offset += (int)sizeof(guint64); } else { content_len = tvb_get_ntohl(tvb, tree_offset); - proto_tree_add_item(jxta_elem_tree, hf_jxta_element_content_len, tvb, tree_offset, sizeof(guint32), ENC_BIG_ENDIAN); - tree_offset += sizeof(guint32); + proto_tree_add_item(jxta_elem_tree, hf_jxta_element_content_len, tvb, tree_offset, (int)sizeof(guint32), ENC_BIG_ENDIAN); + tree_offset += (int)sizeof(guint32); } /* content */ diff --git a/epan/dissectors/packet-k12.c b/epan/dissectors/packet-k12.c index 2d5f3511e7..53065b5849 100644 --- a/epan/dissectors/packet-k12.c +++ b/epan/dissectors/packet-k12.c @@ -343,7 +343,7 @@ k12_copy_cb(void* dest, const void* orig, size_t len _U_) d->match = g_strdup(o->match); d->protos = g_strdup(o->protos); - d->handles = g_memdup(o->handles,sizeof(dissector_handle_t)*(num_protos+1)); + d->handles = g_memdup(o->handles,(guint)(sizeof(dissector_handle_t)*(num_protos+1))); return dest; } diff --git a/epan/dissectors/packet-lwapp.c b/epan/dissectors/packet-lwapp.c index f891945932..a4eee2d461 100644 --- a/epan/dissectors/packet-lwapp.c +++ b/epan/dissectors/packet-lwapp.c @@ -451,7 +451,7 @@ dissect_lwapp(tvbuff_t *tvb, packet_info *pinfo, } /* tree */ - next_client = tvb_new_subset_remaining(tvb, (have_destmac?6:0) + sizeof(LWAPP_Header)); + next_client = tvb_new_subset_remaining(tvb, (have_destmac?6:0) + (int)sizeof(LWAPP_Header)); if ((header.flags & LWAPP_FLAGS_T) == 0) { call_dissector(swap_frame_control ? wlan_bsfc_handle : wlan_handle, next_client, pinfo, tree); diff --git a/epan/dissectors/packet-lwres.c b/epan/dissectors/packet-lwres.c index a9c2d00ba9..ae67ba9956 100644 --- a/epan/dissectors/packet-lwres.c +++ b/epan/dissectors/packet-lwres.c @@ -472,7 +472,7 @@ static void dissect_a_records(tvbuff_t* tvb, proto_tree* tree,guint32 nrec,int o if(tree) { a_rec_item = proto_tree_add_text(tree,tvb,offset, - ((sizeof(guint32) + sizeof(guint16)) * nrec),"A records"); + (int)((sizeof(guint32) + sizeof(guint16)) * nrec),"A records"); a_rec_tree = proto_item_add_subtree(a_rec_item, ett_a_rec); } @@ -482,7 +482,7 @@ static void dissect_a_records(tvbuff_t* tvb, proto_tree* tree,guint32 nrec,int o for(i=0; icinfo, COL_INFO) ) col_add_fstr(pinfo->cinfo, COL_INFO, "%s Reply ", - tvb_format_text(tvb,tvb_offset,len)); - trx_id = strtoul(tvb_format_text(tvb,tvb_offset,len),NULL,10); + tvb_format_text(tvb,tvb_offset,len)); + trx_id = (guint)strtoul(tvb_format_text(tvb,tvb_offset,len),NULL,10); if(tree) my_proto_tree_add_string(message_body_tree, hf_megaco_transid, tvb, @@ -681,8 +681,8 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (check_col(pinfo->cinfo, COL_INFO) ) col_append_fstr(pinfo->cinfo, COL_INFO, "%s Request", - tvb_format_text(tvb,tvb_offset,len)); - trx_id = strtoul(tvb_format_text(tvb,tvb_offset,len),NULL,10); + tvb_format_text(tvb,tvb_offset,len)); + trx_id = (guint)strtoul(tvb_format_text(tvb,tvb_offset,len),NULL,10); if(tree) my_proto_tree_add_string(message_body_tree, hf_megaco_transid, tvb, tvb_offset,len, tvb_format_text(tvb,tvb_offset,len)); @@ -767,7 +767,7 @@ nextcontext: tvb_previous_offset, tokenlen, tvb_format_text(tvb, tvb_previous_offset, tokenlen)); - ctx_id = strtoul(tvb_format_text(tvb, tvb_previous_offset, tokenlen),NULL,10); + ctx_id = (guint)strtoul(tvb_format_text(tvb, tvb_previous_offset, tokenlen),NULL,10); if (check_col(pinfo->cinfo, COL_INFO) ) col_append_fstr(pinfo->cinfo, COL_INFO, " |=%s",tvb_format_text(tvb, tvb_previous_offset,tokenlen)); @@ -3221,7 +3221,7 @@ dissect_megaco_LocalControldescriptor(tvbuff_t *tvb, proto_tree *megaco_mediades tvb_get_nstringz0(tvb,tvb_current_offset,3,code_str); proto_item_append_text(item,"[ %s ]", - val_to_str_ext(strtoul(code_str,NULL,16), &dscp_vals_ext,"Unknown (%u)")); + val_to_str_ext((guint32)strtoul(code_str,NULL,16), &dscp_vals_ext,"Unknown (%u)")); tvb_current_offset = megaco_tvb_skip_wsp(tvb, tvb_offset +1); break; diff --git a/epan/dissectors/packet-mgcp.c b/epan/dissectors/packet-mgcp.c index a629c94ead..198849f2fd 100644 --- a/epan/dissectors/packet-mgcp.c +++ b/epan/dissectors/packet-mgcp.c @@ -1459,7 +1459,7 @@ static void dissect_mgcp_firstline(tvbuff_t *tvb, packet_info *pinfo, proto_tree { transid = tvb_format_text(tvb,tvb_previous_offset,tokenlen); /* XXX - what if this isn't a valid text string? */ - mi->transid = atol(transid); + mi->transid = (guint32)strtoul(transid, NULL, 10); proto_tree_add_string(tree, hf_mgcp_transid, tvb, tvb_previous_offset, tokenlen, transid); } @@ -1915,7 +1915,7 @@ dissect_mgcp_connectionparams(proto_tree *parent_tree, tvbuff_t *tvb, gint offse { if (hf_uint != -1) { - proto_tree_add_uint(tree, hf_uint, tvb, offset, tokenlen, atol(typval[1])); + proto_tree_add_uint(tree, hf_uint, tvb, offset, tokenlen, (guint32)strtoul(typval[1], NULL, 10)); } else if (hf_string != -1) { @@ -2075,7 +2075,7 @@ dissect_mgcp_localconnectionoptions(proto_tree *parent_tree, tvbuff_t *tvb, gint { if (hf_uint != -1) { - proto_tree_add_uint(tree, hf_uint, tvb, offset, tokenlen, atol(typval[1])); + proto_tree_add_uint(tree, hf_uint, tvb, offset, tokenlen, (guint32)strtoul(typval[1], NULL, 10)); } else if (hf_string != -1) { diff --git a/epan/dissectors/packet-mms.c b/epan/dissectors/packet-mms.c index b6a418c0f2..fe409b5b07 100644 --- a/epan/dissectors/packet-mms.c +++ b/epan/dissectors/packet-mms.c @@ -1861,7 +1861,7 @@ dissect_mms_TimeOfDay(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _ /* 86400 seconds in one day */ ts.secs = (days + 5113) * 86400 + milliseconds / 1000; - ts.nsecs = (milliseconds % 1000) * G_GINT64_CONSTANT(1000000U); + ts.nsecs = (milliseconds % 1000) * 1000000U; ptime = abs_time_to_str(&ts, ABSOLUTE_TIME_UTC, TRUE); if(hf_index >= 0) diff --git a/epan/dissectors/packet-mount.c b/epan/dissectors/packet-mount.c index 396abcd522..242be713ef 100644 --- a/epan/dissectors/packet-mount.c +++ b/epan/dissectors/packet-mount.c @@ -159,7 +159,7 @@ static int dissect_mount_dirpath_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { - char *mountpoint=NULL; + const char *mountpoint=NULL; if((!pinfo->fd->flags.visited) && nfs_file_name_snooping){ rpc_call_info_value *civ=pinfo->private_data; @@ -217,8 +217,8 @@ dissect_mountlist(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree proto_item* lock_item = NULL; proto_tree* lock_tree = NULL; int old_offset = offset; - char* hostname; - char* directory; + const char* hostname; + const char* directory; if (tree) { lock_item = proto_tree_add_item(tree, hf_mount_mountlist, tvb, @@ -294,7 +294,7 @@ dissect_exportlist(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr int groups_offset; proto_item* groups_item = NULL; proto_item* groups_tree = NULL; - char* directory; + const char* directory; group_name_list[0]=0; group_names_len=0; @@ -583,7 +583,7 @@ dissect_sgi_exportlist(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_ proto_item* exportlist_item = NULL; proto_tree* exportlist_tree = NULL; int old_offset = offset; - char* directory, *options; + const char* directory, *options; if (tree) { exportlist_item = proto_tree_add_item(tree, hf_mount_exportlist, diff --git a/epan/dissectors/packet-mpls-pm.c b/epan/dissectors/packet-mpls-pm.c index 342cd6129e..89570ef9d7 100644 --- a/epan/dissectors/packet-mpls-pm.c +++ b/epan/dissectors/packet-mpls-pm.c @@ -208,7 +208,7 @@ mpls_pm_dissect_counter(tvbuff_t *tvb, proto_tree *pm_tree, * fields represent octet counts. Otherwise Counter 1-4 fields * represent packet counts */ - gchar *unit = bflag ? "octets" : "packets"; + const gchar *unit = bflag ? "octets" : "packets"; if (query) { switch (i) { diff --git a/epan/dissectors/packet-mysql.c b/epan/dissectors/packet-mysql.c index 8f941fa8f5..97f8ca2b26 100644 --- a/epan/dissectors/packet-mysql.c +++ b/epan/dissectors/packet-mysql.c @@ -1850,7 +1850,7 @@ mysql_dissect_response_prepare(tvbuff_t *tvb, int offset, proto_tree *tree, mysq conn_data->stmt_num_params = tvb_get_letohs(tvb, offset); stmt_data = se_alloc(sizeof(struct my_stmt_data)); stmt_data->nparam = conn_data->stmt_num_params; - flagsize = sizeof(guint8) * stmt_data->nparam; + flagsize = (int)(sizeof(guint8) * stmt_data->nparam); stmt_data->param_flags = se_alloc(flagsize); memset(stmt_data->param_flags, 0, flagsize); se_tree_insert32(conn_data->stmts, stmt_id, stmt_data); diff --git a/epan/dissectors/packet-nasdaq-itch.c b/epan/dissectors/packet-nasdaq-itch.c index dbaf9a30c2..5fe9776bfd 100644 --- a/epan/dissectors/packet-nasdaq-itch.c +++ b/epan/dissectors/packet-nasdaq-itch.c @@ -157,7 +157,7 @@ order_ref_number(tvbuff_t *tvb, packet_info *pinfo, proto_tree *nasdaq_itch_tree if (nasdaq_itch_tree || col_info) { const char *str_value = tvb_get_ephemeral_string(tvb, offset, 9); - guint32 value = strtoul(str_value, NULL, 10); + guint32 value = (guint32)strtoul(str_value, NULL, 10); proto_tree_add_uint(nasdaq_itch_tree, hf_nasdaq_itch_order_reference, tvb, offset, 9, value); if (col_info) { @@ -177,7 +177,7 @@ time_stamp(tvbuff_t *tvb, proto_tree *nasdaq_itch_tree, int id, int offset, int const char *display = ""; const char *str_value = tvb_get_ephemeral_string(tvb, offset, size); - ms = val = strtoul(str_value, NULL, 10); + ms = val = (guint32)strtoul(str_value, NULL, 10); switch (size) { case 3: display = ep_strdup_printf(" %03u" , val); @@ -203,7 +203,7 @@ number_of_shares(tvbuff_t *tvb, packet_info *pinfo, proto_tree *nasdaq_itch_tree if (nasdaq_itch_tree || col_info) { const char *str_value = tvb_get_ephemeral_string(tvb, offset, size); - guint32 value = strtoul(str_value, NULL, 10); + guint32 value = (guint32)strtoul(str_value, NULL, 10); proto_tree_add_uint(nasdaq_itch_tree, id, tvb, offset, size, value); if (col_info) { diff --git a/epan/dissectors/packet-ncp2222.inc b/epan/dissectors/packet-ncp2222.inc index e8055b0210..f25f90852e 100644 --- a/epan/dissectors/packet-ncp2222.inc +++ b/epan/dissectors/packet-ncp2222.inc @@ -191,32 +191,32 @@ static const fragment_items nds_frag_items = { #define IT_ATLAST 24 /* Iteration information flags */ -#define DSI_OUTPUT_FIELDS 0x00000001L -#define DSI_ENTRY_ID 0x00000002L -#define DSI_ENTRY_FLAGS 0x00000004L -#define DSI_SUBORDINATE_COUNT 0x00000008L -#define DSI_MODIFICATION_TIME 0x00000010L -#define DSI_MODIFICATION_TIMESTAMP 0x00000020L -#define DSI_CREATION_TIMESTAMP 0x00000040L -#define DSI_PARTITION_ROOT_ID 0x00000080L -#define DSI_PARENT_ID 0x00000100L -#define DSI_REVISION_COUNT 0x00000200L -#define DSI_REPLICA_TYPE 0x00000400L -#define DSI_BASE_CLASS 0x00000800L -#define DSI_ENTRY_RDN 0x00001000L -#define DSI_ENTRY_DN 0x00002000L -#define DSI_PARTITION_ROOT_DN 0x00004000L -#define DSI_PARENT_DN 0x00008000L -#define DSI_PURGE_TIME 0x00010000L -#define DSI_DEREFERENCED_BASE_CLASS 0x00020000L -#define DSI_REPLICA_NUMBER 0x00040000L -#define DSI_REPLICA_STATE 0x00080000L -#define DSI_FEDERATION_BOUNDARY 0x00100000L -#define DSI_SCHEMA_BOUNDARY 0x00200000L -#define DSI_FEDERATION_BOUNDARY_ID 0x00400000L -#define DSI_SCHEMA_BOUNDARY_ID 0x00800000L -#define DSI_CUR_SUBCOUNT 0x01000000L -#define DSI_LOCAL_ENTRY_FLAGS 0x02000000L +#define DSI_OUTPUT_FIELDS 0x00000001U +#define DSI_ENTRY_ID 0x00000002U +#define DSI_ENTRY_FLAGS 0x00000004U +#define DSI_SUBORDINATE_COUNT 0x00000008U +#define DSI_MODIFICATION_TIME 0x00000010U +#define DSI_MODIFICATION_TIMESTAMP 0x00000020U +#define DSI_CREATION_TIMESTAMP 0x00000040U +#define DSI_PARTITION_ROOT_ID 0x00000080U +#define DSI_PARENT_ID 0x00000100U +#define DSI_REVISION_COUNT 0x00000200U +#define DSI_REPLICA_TYPE 0x00000400U +#define DSI_BASE_CLASS 0x00000800U +#define DSI_ENTRY_RDN 0x00001000U +#define DSI_ENTRY_DN 0x00002000U +#define DSI_PARTITION_ROOT_DN 0x00004000U +#define DSI_PARENT_DN 0x00008000U +#define DSI_PURGE_TIME 0x00010000U +#define DSI_DEREFERENCED_BASE_CLASS 0x00020000 +#define DSI_REPLICA_NUMBER 0x00040000 +#define DSI_REPLICA_STATE 0x00080000 +#define DSI_FEDERATION_BOUNDARY 0x00100000 +#define DSI_SCHEMA_BOUNDARY 0x00200000 +#define DSI_FEDERATION_BOUNDARY_ID 0x00400000 +#define DSI_SCHEMA_BOUNDARY_ID 0x00800000 +#define DSI_CUR_SUBCOUNT 0x01000000 +#define DSI_LOCAL_ENTRY_FLAGS 0x02000000 static const value_string zensearchenum[] = { { 0, "[Root]" }, @@ -2849,7 +2849,7 @@ trap_for_expert_event(proto_tree *ncp_tree, packet_info *pinfo, const ncp_record } expert_add_info_format(pinfo, NULL, PI_REQUEST_CODE, PI_CHAT, "%s: %s, Rights:(%s)", - val_to_str((strtoul(oaction, NULL, 16) & 0xeb), open_create_mode_vals, "Unknown: %d"), + val_to_str((guint32)(strtoul(oaction, NULL, 16) & 0xeb), open_create_mode_vals, "Unknown: %d"), p_filename, val_to_str((atoi(p_rights) & 0x5f), ncp_rights_vals, "Unknown: %d")); } diff --git a/epan/dissectors/packet-ndmp.c b/epan/dissectors/packet-ndmp.c index 27078be65c..7c1061d803 100644 --- a/epan/dissectors/packet-ndmp.c +++ b/epan/dissectors/packet-ndmp.c @@ -2371,7 +2371,7 @@ dissect_file_name(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *par proto_tree* tree = NULL; int old_offset=offset; guint32 type; - char *name; + const char *name; if (parent_tree) { item = proto_tree_add_text(parent_tree, tvb, offset, -1, diff --git a/epan/dissectors/packet-ndps.c b/epan/dissectors/packet-ndps.c index 7975593295..8a10c1f4af 100644 --- a/epan/dissectors/packet-ndps.c +++ b/epan/dissectors/packet-ndps.c @@ -355,7 +355,6 @@ static int hf_spx_ndps_func_delivery = -1; static int hf_spx_ndps_func_broker = -1; static gint ett_ndps = -1; -static dissector_handle_t ndps_data_handle; /* desegmentation of NDPS over TCP */ static gboolean ndps_desegment = TRUE; diff --git a/epan/dissectors/packet-netperfmeter.c b/epan/dissectors/packet-netperfmeter.c index f333292624..36fc3e5464 100644 --- a/epan/dissectors/packet-netperfmeter.c +++ b/epan/dissectors/packet-netperfmeter.c @@ -296,9 +296,9 @@ dissect_npmp_add_flow_message(tvbuff_t *message_tvb, proto_tree *message_tree) if (onoffevents > 0) { onofftree = proto_item_add_subtree(onoffitem, ett_onoffarray); for(i = 0;i < onoffevents;i++) { - onoffvalue = tvb_get_ntohl(message_tvb, offset_addflow_onoffeventarray + (sizeof(guint32) * i)); + onoffvalue = tvb_get_ntohl(message_tvb, offset_addflow_onoffeventarray + (int)(sizeof(guint32) * i)); proto_tree_add_uint_format(onofftree, hf_addflow_onoffeventarray, message_tvb, - offset_addflow_onoffeventarray + (sizeof(guint32) * i), sizeof(guint32), + offset_addflow_onoffeventarray + (int)(sizeof(guint32) * i), (int)sizeof(guint32), onoffvalue, "%1.3f s: set to %s", onoffvalue / 1000.0, (i & 1) ? "OFF" : "ON"); } } diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c index 0f1bb2bcc3..e785811335 100644 --- a/epan/dissectors/packet-nfs.c +++ b/epan/dissectors/packet-nfs.c @@ -1009,7 +1009,7 @@ nfs_name_snoop_init(void) } void -nfs_name_snoop_add_name(int xid, tvbuff_t *tvb, int name_offset, int name_len, int parent_offset, int parent_len, char *name) +nfs_name_snoop_add_name(int xid, tvbuff_t *tvb, int name_offset, int name_len, int parent_offset, int parent_len, const char *name) { nfs_name_snoop_t *nns, *old_nns; const char *ptr=NULL; @@ -2976,7 +2976,7 @@ dissect_sattr(tvbuff_t *tvb, int offset, proto_tree *tree, const char* name) /* RFC 1094, Page 17 */ static int -dissect_filename(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, char **string_ret) +dissect_filename(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, const char **string_ret) { offset = dissect_rpc_string(tvb, tree, hf, offset, string_ret); return offset; @@ -2985,7 +2985,7 @@ dissect_filename(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, char **str /* RFC 1094, Page 17 */ static int -dissect_path(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, char **name) +dissect_path(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, const char **name) { offset = dissect_rpc_string(tvb, tree, hf, offset, name); return offset; @@ -3044,7 +3044,7 @@ dissect_nfs2_getattr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, pr /* RFC 1094, Page 18 */ static int -dissect_diropargs(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char* label, guint32 *hash, char **name) +dissect_diropargs(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char* label, guint32 *hash, const char **name) { proto_item* diropargs_item = NULL; proto_tree* diropargs_tree = NULL; @@ -3089,7 +3089,7 @@ static int dissect_nfs2_rmdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 hash; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name); @@ -3103,7 +3103,7 @@ static int dissect_nfs2_remove_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 hash; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name); @@ -3117,7 +3117,7 @@ static int dissect_nfs2_lookup_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 hash; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name); @@ -3214,7 +3214,7 @@ dissect_nfs2_readlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, { guint32 status; const char *err; - char *name=NULL; + const char *name=NULL; offset = dissect_stat(tvb, offset, tree, &status); switch (status) { @@ -3330,7 +3330,7 @@ dissect_nfs2_mkdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 hash; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name); offset = dissect_sattr (tvb, offset, tree, "attributes"); @@ -3346,7 +3346,7 @@ dissect_nfs2_create_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 hash; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs(tvb, offset, pinfo, tree, "where", &hash, &name); offset = dissect_sattr (tvb, offset, tree, "attributes"); @@ -3364,9 +3364,9 @@ dissect_nfs2_rename_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 from_hash; - char *from_name=NULL; + const char *from_name=NULL; guint32 to_hash; - char *to_name=NULL; + const char *to_name=NULL; offset = dissect_diropargs(tvb, offset, pinfo, tree, "from", &from_hash, &from_name); offset = dissect_diropargs(tvb, offset, pinfo, tree, "to", &to_hash, &to_name); @@ -3385,7 +3385,7 @@ dissect_nfs2_link_call(tvbuff_t *tvb, int offset, packet_info *pinfo, { guint32 from_hash; guint32 to_hash; - char *to_name=NULL; + const char *to_name=NULL; offset = dissect_fhandle(tvb, offset, pinfo, tree, "from", &from_hash); offset = dissect_diropargs(tvb, offset, pinfo, tree, "to", &to_hash, &to_name); @@ -3403,8 +3403,8 @@ dissect_nfs2_symlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 from_hash; - char *from_name=NULL; - char *to_name=NULL; + const char *from_name=NULL; + const char *to_name=NULL; offset = dissect_diropargs(tvb, offset, pinfo, tree, "from", &from_hash, &from_name); offset = dissect_path(tvb, offset, tree, hf_nfs_symlink_to, &to_name); @@ -3454,7 +3454,7 @@ dissect_readdir_entry(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, int old_offset = offset; guint32 fileid; guint32 cookie; - char *name; + const char *name; if (tree) { entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb, @@ -3642,7 +3642,7 @@ static const value_string nfsv2_proc_vals[] = { /* RFC 1813, Page 15 */ static int -dissect_filename3(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, char **string_ret) +dissect_filename3(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, const char **string_ret) { offset = dissect_rpc_string(tvb, tree, hf, offset, string_ret); return offset; @@ -3651,7 +3651,7 @@ dissect_filename3(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, char **st /* RFC 1813, Page 15 */ static int -dissect_nfspath3(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, char **name) +dissect_nfspath3(tvbuff_t *tvb, int offset, proto_tree *tree, int hf, const char **name) { offset = dissect_rpc_string(tvb, tree, hf, offset, name); return offset; @@ -4545,7 +4545,7 @@ dissect_sattr3(tvbuff_t *tvb, int offset, proto_tree *tree, const char* name) static int dissect_diropargs3(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char* label, guint32 *hash, - char **name) + const char **name) { proto_item* diropargs3_item = NULL; proto_tree* diropargs3_tree = NULL; @@ -4598,7 +4598,7 @@ dissect_nfs3_remove_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 hash = 0; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs3(tvb, offset, pinfo, tree, "object", &hash, &name); @@ -4631,7 +4631,7 @@ dissect_nfs3_rmdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { guint32 hash = 0; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs3(tvb, offset, pinfo, tree, "object", &hash, &name); @@ -4782,7 +4782,7 @@ dissect_nfs3_lookup_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree) { guint32 hash = 0; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs3 (tvb, offset, pinfo, tree, "what", &hash, &name); @@ -5086,7 +5086,7 @@ dissect_nfs3_readlink_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, { guint32 status; const char *err; - char *name=NULL; + const char *name=NULL; offset = dissect_nfsstat3(tvb, offset, tree, &status); switch (status) { @@ -5303,7 +5303,7 @@ dissect_nfs3_create_call(tvbuff_t *tvb, int offset, packet_info *pinfo, { guint32 mode; guint32 hash = 0; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs3 (tvb, offset, pinfo, tree, "where", &hash, &name); offset = dissect_createmode3(tvb, offset, tree, &mode); @@ -5360,7 +5360,7 @@ dissect_nfs3_mkdir_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree) { guint32 hash = 0; - char *name=NULL; + const char *name=NULL; offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where", &hash, &name); offset = dissect_sattr3 (tvb, offset, tree, "attributes"); @@ -5406,8 +5406,8 @@ dissect_nfs3_symlink_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree) { guint32 from_hash = 0; - char *from_name=NULL; - char *to_name=NULL; + const char *from_name=NULL; + const char *to_name=NULL; offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where", &from_hash, &from_name); offset = dissect_sattr3 (tvb, offset, tree, "symlink_attributes"); @@ -5454,7 +5454,7 @@ dissect_nfs3_mknod_call(tvbuff_t *tvb, int offset, packet_info *pinfo, { guint32 type; guint32 hash = 0; - char *name=NULL; + const char *name=NULL; const char *type_str; offset = dissect_diropargs3(tvb, offset, pinfo, tree, "where", &hash, &name); @@ -5564,9 +5564,9 @@ dissect_nfs3_rename_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree) { guint32 from_hash = 0; - char *from_name=NULL; + const char *from_name=NULL; guint32 to_hash = 0; - char *to_name=NULL; + const char *to_name=NULL; offset = dissect_diropargs3(tvb, offset, pinfo, tree, "from", &from_hash, &from_name); offset = dissect_diropargs3(tvb, offset, pinfo, tree, "to", &to_hash, &to_name); @@ -5614,7 +5614,7 @@ dissect_nfs3_link_call(tvbuff_t *tvb, int offset, packet_info *pinfo, { guint32 from_hash = 0; guint32 to_hash = 0; - char *to_name=NULL; + const char *to_name=NULL; offset = dissect_nfs_fh3 (tvb, offset, pinfo, tree, "file", &from_hash); offset = dissect_diropargs3(tvb, offset, pinfo, tree, "link", &to_hash, &to_name); @@ -5684,7 +5684,7 @@ dissect_entry3(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_item* entry_item = NULL; proto_tree* entry_tree = NULL; int old_offset = offset; - char *name=NULL; + const char *name=NULL; if (tree) { entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb, @@ -5783,7 +5783,7 @@ dissect_entryplus3(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_item* entry_item = NULL; proto_tree* entry_tree = NULL; int old_offset = offset; - char *name=NULL; + const char *name=NULL; if (tree) { entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry, tvb, @@ -6268,7 +6268,7 @@ dissect_nfs_nfsstat4(tvbuff_t *tvb, int offset, static int dissect_nfs_utf8string(tvbuff_t *tvb, int offset, - proto_tree *tree, int hf, char **string_ret) + proto_tree *tree, int hf, const char **string_ret) { /* TODO: this dissector is subject to change; do not remove */ return dissect_rpc_string(tvb, tree, hf, offset, string_ret); @@ -7803,7 +7803,7 @@ static const value_string names_claim_type4[] = { /* XXX - need a better place to populate name than here, maybe? */ static int dissect_nfs_open_claim4(tvbuff_t *tvb, int offset, packet_info *pinfo, - proto_tree *tree, char **name) + proto_tree *tree, const char **name) { guint open_claim_type4; proto_item *fitem = NULL; @@ -7935,8 +7935,8 @@ dissect_nfs_openflag4(tvbuff_t *tvb, int offset, packet_info *pinfo, static int dissect_nfs_clientaddr4(tvbuff_t *tvb, int offset, proto_tree *tree) { - char *universal_ip_address = NULL; - char *protocol = NULL; + const char *universal_ip_address = NULL; + const char *protocol = NULL; guint b1, b2, b3, b4, b5, b6, b7, b8, b9, b10; guint16 port; int addr_offset; @@ -8992,7 +8992,7 @@ dissect_nfs_argop4(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *newftree = NULL; guint32 string_length; int cbprog; - char *name = NULL, *source_name = NULL, *dest_name=NULL; + const char *name = NULL, *source_name = NULL, *dest_name=NULL; const char *opname=NULL; guint32 last_fh_hash=0; guint32 saved_fh_hash=0; @@ -9612,7 +9612,7 @@ static int dissect_nfs4_compound_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree) { - char *tag=NULL; + const char *tag=NULL; offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_tag4, &tag); /* Display the NFSv4 tag. If it is empty, string generator will have returned "", in which case don't display anything */ @@ -10050,7 +10050,7 @@ dissect_nfs4_compound_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree) { guint32 status; - char *tag=NULL; + const char *tag=NULL; offset = dissect_nfs_nfsstat4(tvb, offset, tree, &status); offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_tag4, &tag); @@ -10493,7 +10493,7 @@ dissect_nfs_cb_argop(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree * static int dissect_nfs_cb_compound_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree) { - char *tag=NULL; + const char *tag=NULL; offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_tag4, &tag); @@ -10592,7 +10592,7 @@ dissect_nfs_cb_compound_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree) { guint32 status; - char *tag=NULL; + const char *tag=NULL; offset = dissect_nfs_nfsstat4(tvb, offset, tree, &status); offset = dissect_nfs_utf8string(tvb, offset, tree, hf_nfs_tag4, &tag); diff --git a/epan/dissectors/packet-nfs.h b/epan/dissectors/packet-nfs.h index 7fdfdfd7dc..b8946ea398 100644 --- a/epan/dissectors/packet-nfs.h +++ b/epan/dissectors/packet-nfs.h @@ -183,7 +183,7 @@ extern int dissect_nfs_fh3(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_ int dissect_nfs_post_op_attr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, const char* name); -void nfs_name_snoop_add_name(int xid, tvbuff_t *tvb, int name_offset, int name_len, int parent_offset, int parent_len, char *name); +void nfs_name_snoop_add_name(int xid, tvbuff_t *tvb, int name_offset, int name_len, int parent_offset, int parent_len, const char *name); extern gboolean nfs_fhandle_reqrep_matching; diff --git a/epan/dissectors/packet-ntlmssp.c b/epan/dissectors/packet-ntlmssp.c index c9322d0c25..cdfb765b63 100644 --- a/epan/dissectors/packet-ntlmssp.c +++ b/epan/dissectors/packet-ntlmssp.c @@ -482,7 +482,7 @@ get_md4pass_list(md4_pass** p_pass_list, const char* nt_password) if ((nt_password[0] != '\0') && (strlen(nt_password) < 129)) { int password_len; nb_pass++; - password_len = strlen(nt_password); + password_len = (int)strlen(nt_password); str_to_unicode(nt_password, nt_password_unicode); crypt_md4(nt_password_hash, nt_password_unicode, password_len*2); } diff --git a/epan/dissectors/packet-oipf.c b/epan/dissectors/packet-oipf.c index 0369bf422e..176f7e3553 100644 --- a/epan/dissectors/packet-oipf.c +++ b/epan/dissectors/packet-oipf.c @@ -49,7 +49,7 @@ static int hf_oipf_ciplus_data = -1; for the dissector table directly, we have to process it as a string (the string must not be a local variable as glib stores a pointer to it in the hash table) */ -static gchar *sas_app_id_str_oipf = "0x0108113101190000"; +static const gchar sas_app_id_str_oipf[] = "0x0108113101190000"; static const value_string oipf_ciplus_cmd_id[] = { { 0x01, "send_msg" }, diff --git a/epan/dissectors/packet-p1.c b/epan/dissectors/packet-p1.c index 5561f16662..305b5d7085 100644 --- a/epan/dissectors/packet-p1.c +++ b/epan/dissectors/packet-p1.c @@ -8345,7 +8345,7 @@ dissect_p1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) proto_item *item=NULL; proto_tree *tree=NULL; int (*p1_dissector)(gboolean implicit_tag _U_, tvbuff_t *tvb, int offset, asn1_ctx_t *actx _U_, proto_tree *tree, int hf_index _U_) = NULL; - char *p1_op_name; + const char *p1_op_name; int hf_p1_index = -1; asn1_ctx_t asn1_ctx; asn1_ctx_init(&asn1_ctx, ASN1_ENC_BER, TRUE, pinfo); diff --git a/epan/dissectors/packet-pcnfsd.c b/epan/dissectors/packet-pcnfsd.c index 1fb73533b4..fab3dd0d81 100644 --- a/epan/dissectors/packet-pcnfsd.c +++ b/epan/dissectors/packet-pcnfsd.c @@ -170,12 +170,18 @@ dissect_pcnfsd2_mapid_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, } /* "NFS Illustrated 14.7.13 */ -static void -pcnfsd_decode_obscure(char* data, int len) +static char * +pcnfsd_decode_obscure(const char* data, int len) { - for ( ; len>0 ; len--, data++) { - *data = (*data ^ 0x5b) & 0x7f; + char *decoded_buf; + char *decoded_data; + + decoded_buf = ep_alloc(len); + decoded_data = decoded_buf; + for ( ; len>0 ; len--, data++, decoded_data++) { + *decoded_data = (*data ^ 0x5b) & 0x7f; } + return decoded_buf; } @@ -185,10 +191,11 @@ dissect_pcnfsd2_auth_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { int newoffset; - char *ident = NULL; + const char *ident = NULL; + const char *ident_decoded; proto_item *ident_item = NULL; proto_tree *ident_tree = NULL; - char *password = NULL; + const char *password = NULL; proto_item *password_item = NULL; proto_tree *password_tree = NULL; @@ -210,13 +217,15 @@ dissect_pcnfsd2_auth_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, if (ident) { /* Only attempt to decode the ident if it has been specified */ - if (strcmp(ident, RPC_STRING_EMPTY)) - pcnfsd_decode_obscure(ident, (int)strlen(ident)); + if (strcmp(ident, RPC_STRING_EMPTY) != 0) + ident_decoded = pcnfsd_decode_obscure(ident, (int)strlen(ident)); + else + ident_decoded = ident; if (ident_tree) proto_tree_add_string(ident_tree, hf_pcnfsd_auth_ident_clear, - tvb, offset+4, (gint)strlen(ident), ident); + tvb, offset+4, (gint)strlen(ident_decoded), ident_decoded); } if (ident_item) { proto_item_set_text(ident_item, "Authentication Ident: %s", diff --git a/epan/dissectors/packet-pgm.c b/epan/dissectors/packet-pgm.c index dd01a5c086..9e4b77e976 100644 --- a/epan/dissectors/packet-pgm.c +++ b/epan/dissectors/packet-pgm.c @@ -505,7 +505,7 @@ dissect_pgmopts(ptvcursor_t* cursor, const char *pktname) tvb_memcpy(tvb, (guint8 *)naklist, ptvcursor_current_offset(cursor), optdata_len); firsttime = TRUE; soffset = 0; - naks = (optdata_len/sizeof(guint32)); + naks = (int)(optdata_len/sizeof(guint32)); nakbuf = ep_alloc(8192); j = 0; /* diff --git a/epan/dissectors/packet-pkix1explicit.h b/epan/dissectors/packet-pkix1explicit.h index 1dc24139a4..27b3c569b5 100644 --- a/epan/dissectors/packet-pkix1explicit.h +++ b/epan/dissectors/packet-pkix1explicit.h @@ -35,7 +35,9 @@ int dissect_pkix1explicit_Certificate(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index); int dissect_pkix1explicit_CertificateList(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index); +#if 0 int dissect_pkix1explicit_CertificateSerialNumber(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index); +#endif int dissect_pkix1explicit_Name(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index); int dissect_pkix1explicit_GeneralName(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx, proto_tree *tree, int hf_index); int dissect_pkix1explicit_AlgorithmIdentifier(gboolean implicit_tag, tvbuff_t *tvb, int offset, asn1_ctx_t *actx,proto_tree *tree, int hf_index); @@ -63,7 +65,7 @@ int dissect_pkix1explicit_TerminalType(gboolean implicit_tag _U_, tvbuff_t *tvb int dissect_pkix1explicit_TeletexDomainDefinedAttribute(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_); /*--- End of included file: packet-pkix1explicit-exp.h ---*/ -#line 38 "../../asn1/pkix1explicit/packet-pkix1explicit-template.h" +#line 40 "../../asn1/pkix1explicit/packet-pkix1explicit-template.h" #endif /* PACKET_PKIX1EXPLICIT_H */ diff --git a/epan/dissectors/packet-reload-framing.c b/epan/dissectors/packet-reload-framing.c index 2e659dceeb..60c0b3466a 100644 --- a/epan/dissectors/packet-reload-framing.c +++ b/epan/dissectors/packet-reload-framing.c @@ -185,14 +185,14 @@ dissect_reload_framing_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if (type==DATA) { transaction_id_key[1].length = 1; transaction_id_key[1].key = &pinfo->srcport; - transaction_id_key[2].length = (pinfo->src.len) / sizeof(guint32); + transaction_id_key[2].length = (pinfo->src.len) / (guint)sizeof(guint32); transaction_id_key[2].key = g_malloc(pinfo->src.len); memcpy(transaction_id_key[2].key, pinfo->src.data, pinfo->src.len); } else { transaction_id_key[1].length = 1; transaction_id_key[1].key = &pinfo->destport; - transaction_id_key[2].length = (pinfo->dst.len) / sizeof(guint32); + transaction_id_key[2].length = (pinfo->dst.len) / (guint)sizeof(guint32); transaction_id_key[2].key = g_malloc(pinfo->dst.len); memcpy(transaction_id_key[2].key, pinfo->dst.data, pinfo->dst.len); } diff --git a/epan/dissectors/packet-reload.c b/epan/dissectors/packet-reload.c index 4ee8469f4c..0296a6c9fb 100644 --- a/epan/dissectors/packet-reload.c +++ b/epan/dissectors/packet-reload.c @@ -687,24 +687,24 @@ typedef struct _Kind { } kind_t; static kind_t predefined_kinds[] = { - {"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}, + {(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}, }; diff --git a/epan/dissectors/packet-rpc.c b/epan/dissectors/packet-rpc.c index 26feaa2104..5d58477515 100644 --- a/epan/dissectors/packet-rpc.c +++ b/epan/dissectors/packet-rpc.c @@ -553,7 +553,7 @@ dissect_rpc_opaque_data(tvbuff_t *tvb, int offset, packet_info *pinfo, int hfindex, gboolean fixed_length, guint32 length, - gboolean string_data, char **string_buffer_ret, + gboolean string_data, const char **string_buffer_ret, dissect_function_t *dissect_it) { int data_offset; @@ -576,7 +576,7 @@ dissect_rpc_opaque_data(tvbuff_t *tvb, int offset, /* int string_item_offset; */ char *string_buffer = NULL; - char *string_buffer_print = NULL; + const char *string_buffer_print = NULL; if (fixed_length) { string_length = length; @@ -734,7 +734,7 @@ dissect_rpc_opaque_data(tvbuff_t *tvb, int offset, int dissect_rpc_string(tvbuff_t *tvb, proto_tree *tree, - int hfindex, int offset, char **string_buffer_ret) + int hfindex, int offset, const char **string_buffer_ret) { offset = dissect_rpc_opaque_data(tvb, offset, tree, NULL, hfindex, FALSE, 0, TRUE, string_buffer_ret, NULL); @@ -755,7 +755,7 @@ dissect_rpc_data(tvbuff_t *tvb, proto_tree *tree, int dissect_rpc_bytes(tvbuff_t *tvb, proto_tree *tree, int hfindex, int offset, guint32 length, - gboolean string_data, char **string_buffer_ret) + gboolean string_data, const char **string_buffer_ret) { offset = dissect_rpc_opaque_data(tvb, offset, tree, NULL, hfindex, TRUE, length, string_data, string_buffer_ret, NULL); diff --git a/epan/dissectors/packet-rpc.h b/epan/dissectors/packet-rpc.h index 32d30f56b0..82711f7a94 100644 --- a/epan/dissectors/packet-rpc.h +++ b/epan/dissectors/packet-rpc.h @@ -151,19 +151,19 @@ extern unsigned int rpc_roundup(unsigned int a); extern int dissect_rpc_bool(tvbuff_t *tvb, proto_tree *tree, int hfindex, int offset); extern int dissect_rpc_string(tvbuff_t *tvb, - proto_tree *tree, int hfindex, int offset, char **string_buffer_ret); + proto_tree *tree, int hfindex, int offset, const char **string_buffer_ret); int dissect_rpc_opaque_data(tvbuff_t *tvb, int offset, proto_tree *tree, packet_info *pinfo, int hfindex, gboolean fixed_length, guint32 length, - gboolean string_data, char **string_buffer_ret, + gboolean string_data, const char **string_buffer_ret, dissect_function_t *dissect_it); extern int dissect_rpc_data(tvbuff_t *tvb, proto_tree *tree, int hfindex, int offset); extern int dissect_rpc_bytes(tvbuff_t *tvb, proto_tree *tree, int hfindex, int offset, guint32 length, - gboolean string_data, char **string_buffer_ret); + gboolean string_data, const char **string_buffer_ret); extern int dissect_rpc_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, dissect_function_t *rpc_list_dissector); extern int dissect_rpc_array(tvbuff_t *tvb, packet_info *pinfo, diff --git a/epan/dissectors/packet-rsvp.c b/epan/dissectors/packet-rsvp.c index c40d888477..00b36951ce 100644 --- a/epan/dissectors/packet-rsvp.c +++ b/epan/dissectors/packet-rsvp.c @@ -3829,9 +3829,9 @@ dissect_glabel_lambda(proto_tree *ti _U_, proto_tree *rsvp_object_tree, tvbuff_t *tvb, int offset) { - float freq = 0.0; + float freq = 0.0f; guint32 wavelength = 0; - float cs_thz = 0.0; + float cs_thz = 0.0f; guint8 grid = ((tvb_get_guint8(tvb, offset) & 0xE0) >> 5); guint8 cs = ((tvb_get_guint8(tvb, offset) & 0x1E) >> 1); diff --git a/epan/dissectors/packet-rtcp.c b/epan/dissectors/packet-rtcp.c index c34f19e6b6..25be5b4b9b 100644 --- a/epan/dissectors/packet-rtcp.c +++ b/epan/dissectors/packet-rtcp.c @@ -587,7 +587,7 @@ static void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static gboolean global_rtcp_show_roundtrip_calculation = FALSE; #define MIN_ROUNDTRIP_TO_REPORT_DEFAULT 10 static guint global_rtcp_show_roundtrip_calculation_minimum = MIN_ROUNDTRIP_TO_REPORT_DEFAULT; -static void remember_outgoing_sr(packet_info *pinfo, long lsr); +static void remember_outgoing_sr(packet_info *pinfo, guint32 lsr); static void calculate_roundtrip_delay(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 lsr, guint32 dlsr); static void add_roundtrip_delay_info(tvbuff_t *tvb, packet_info *pinfo, @@ -2542,7 +2542,7 @@ void show_setup_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Update conversation data to record time that outgoing rr/sr was sent */ -static void remember_outgoing_sr(packet_info *pinfo, long lsr) +static void remember_outgoing_sr(packet_info *pinfo, guint32 lsr) { conversation_t *p_conv; struct _rtcp_conversation_info *p_conv_data; diff --git a/epan/dissectors/packet-rtp-midi.c b/epan/dissectors/packet-rtp-midi.c index e91ce261df..4533b25050 100644 --- a/epan/dissectors/packet-rtp-midi.c +++ b/epan/dissectors/packet-rtp-midi.c @@ -2914,7 +2914,7 @@ decodetime(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, unsigned int guint8 octet; unsigned int consumed; unsigned int i; - unsigned long deltatime; + unsigned int deltatime; consumed = 0; deltatime = 0; @@ -7115,7 +7115,7 @@ decode_sj_chapter_x( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un guint8 header; guint8 octet; unsigned int consumed = 0; - unsigned long cmdlen = 0; + unsigned int cmdlen = 0; unsigned int i; /* Can we read this chapter's header? */ @@ -7165,8 +7165,8 @@ decode_sj_chapter_x( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, un } if ( header & RTP_MIDI_SJ_CHAPTER_X_FLAG_F ) { - unsigned long field = 0; - unsigned long fieldlen = 0; + unsigned int field = 0; + unsigned int fieldlen = 0; /* FIRST is "compressed" using only the necessary amount of octets, like delta-time */ for ( i=0; i < 4; i++ ) { diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c index 9d2a61f561..7f27212bfe 100644 --- a/epan/dissectors/packet-rtps.c +++ b/epan/dissectors/packet-rtps.c @@ -579,17 +579,17 @@ static void rtps_util_add_long(proto_tree *, tvbuff_t *, gint, int, int, gboolean, gboolean, const char *, guint8 *, size_t); static void rtps_util_add_port(proto_tree *, tvbuff_t *, - gint, int, char *, guint8 *, gint); + gint, int, const char *, guint8 *, gint); static void rtps_util_add_boolean(proto_tree *, tvbuff_t *, - gint, char *, guint8 *, size_t); + gint, const char *, guint8 *, size_t); static void rtps_util_add_durability_service_qos(proto_tree *, tvbuff_t *, gint, int, guint8 *, gint); static void rtps_util_add_liveliness_qos(proto_tree *, tvbuff_t *, gint, int, guint8 *, gint); static void rtps_util_add_kind_qos(proto_tree *, tvbuff_t *, - gint, int, char *, const value_string *, guint8 *, size_t); + gint, int, const char *, const value_string *, guint8 *, size_t); static gint rtps_util_add_seq_string(proto_tree *, tvbuff_t *, - gint, int, int, char *, guint8 *, gint); + gint, int, int, const char *, guint8 *, gint); static void rtps_util_add_seq_octets(proto_tree *, tvbuff_t *, gint, int, int, int, guint8 *, gint); static int rtps_util_add_bitmap(proto_tree *, tvbuff_t *, @@ -597,7 +597,7 @@ static int rtps_util_add_bitmap(proto_tree *, tvbuff_t *, static void rtps_util_decode_flags(proto_tree *, tvbuff_t *, gint, guint8, const struct Flag_definition *); static gint rtps_util_add_seq_ulong(proto_tree *, tvbuff_t *, - gint, int, int, int, int, char *); + gint, int, int, int, int, const char *); @@ -1624,7 +1624,7 @@ static void rtps_util_add_port(proto_tree *tree, /* Can be NULL */ tvbuff_t * tvb, gint offset, gboolean little_endian, - char * label, + const char *label, guint8 * buffer, /* Can be NULL */ gint buffer_size) { guint8 tempBuffer[MAX_PORT_SIZE]; @@ -1659,7 +1659,7 @@ static void rtps_util_add_port(proto_tree *tree, /* Can be NULL */ static void rtps_util_add_boolean(proto_tree *tree, /* Can be NULL */ tvbuff_t * tvb, gint offset, - char * label, + const char *label, guint8 * buffer, /* Can be NULL */ size_t buffer_size) { const char *str; @@ -1807,7 +1807,7 @@ static void rtps_util_add_kind_qos(proto_tree *tree, /* Can be NULL */ tvbuff_t * tvb, gint offset, gboolean little_endian, - char * label, + const char *label, const value_string *vals, guint8 * buffer, /* Can be NULL */ size_t buffer_size) { @@ -1841,7 +1841,7 @@ static gint rtps_util_add_seq_string(proto_tree *tree, /* Can NOT be NULL */ gint offset, gboolean little_endian, int param_length, - char * label, + const char *label, guint8 * buffer, /* Can NOT be NULL */ gint buffer_size) { guint32 num_strings; @@ -1906,7 +1906,7 @@ static gint rtps_util_add_seq_ulong(proto_tree *tree, /* Can NOT be NULL */ int param_length, int is_hex, int is_signed, - char * label) { + const char *label) { guint32 num_elem; guint32 i; proto_tree *string_tree; diff --git a/epan/dissectors/packet-rtps2.c b/epan/dissectors/packet-rtps2.c index 354bee833f..a5c6f06d27 100644 --- a/epan/dissectors/packet-rtps2.c +++ b/epan/dissectors/packet-rtps2.c @@ -754,17 +754,17 @@ static guint16 rtps_util_add_short(proto_tree *, tvbuff_t *, gint, int, int, gboolean, gboolean, const char *, guint8 *, gint); static void rtps_util_add_port(proto_tree *, tvbuff_t *, - gint, int, char *, guint8 *, gint); + gint, int, const char *, guint8 *, gint); static void rtps_util_add_boolean(proto_tree *, tvbuff_t *, - gint, char *, guint8 *, size_t); + gint, const char *, guint8 *, size_t); static void rtps_util_add_durability_service_qos(proto_tree *, tvbuff_t *, gint, int, guint8 *, gint); static void rtps_util_add_liveliness_qos(proto_tree *, tvbuff_t *, gint, int, guint8 *, gint); static void rtps_util_add_kind_qos(proto_tree *, tvbuff_t *, - gint, int, char *, const value_string *, guint8 *, size_t); + gint, int, const char *, const value_string *, guint8 *, size_t); static gint rtps_util_add_seq_string(proto_tree *, tvbuff_t *, - gint, int, int, char *, guint8 *, gint); + gint, int, int, const char *, guint8 *, gint); static void rtps_util_add_seq_octets(proto_tree *, tvbuff_t *, gint, int, int, int, guint8 *, gint); static int rtps_util_add_bitmap(proto_tree *, tvbuff_t *, @@ -776,7 +776,7 @@ static void rtps_util_decode_flags(proto_tree *, tvbuff_t *, static void rtps_util_decode_flags_16bit(proto_tree *, tvbuff_t *, gint, guint16, const struct Flag_definition *); static gint rtps_util_add_seq_ulong(proto_tree *, tvbuff_t *, - gint, int, int, int, int, char *); + gint, int, int, int, int, const char *); static void rtps_util_add_extra_flags(proto_tree *, tvbuff_t *, gint, const char *); @@ -1914,7 +1914,7 @@ static void rtps_util_add_port(proto_tree *tree, tvbuff_t * tvb, gint offset, gboolean little_endian, - char * label, + const char *label, guint8 * buffer, /* Can be NULL */ gint buffer_size) { guint8 tempBuffer[MAX_PORT_SIZE]; @@ -1949,7 +1949,7 @@ static void rtps_util_add_port(proto_tree *tree, static void rtps_util_add_boolean(proto_tree *tree, tvbuff_t * tvb, gint offset, - char * label, + const char *label, guint8 * buffer, /* Can be NULL */ size_t buffer_size) { const char *str; @@ -2098,7 +2098,7 @@ static void rtps_util_add_kind_qos(proto_tree *tree, tvbuff_t * tvb, gint offset, gboolean little_endian, - char * label, + const char *label, const value_string *vals, guint8 * buffer, /* Can be NULL */ size_t buffer_size) { @@ -2132,7 +2132,7 @@ static gint rtps_util_add_seq_string(proto_tree *tree, gint offset, gboolean little_endian, int param_length, - char * label, + const char *label, guint8 * buffer, /* Can NOT be NULL */ gint buffer_size) { guint32 num_strings; @@ -2202,7 +2202,7 @@ static gint rtps_util_add_seq_ulong(proto_tree *tree, int param_length, int is_hex, int is_signed, - char * label) { + const char *label) { guint32 num_elem; guint32 i; proto_tree *string_tree; diff --git a/epan/dissectors/packet-rtse.c b/epan/dissectors/packet-rtse.c index f901c256ec..9b5c2065c5 100644 --- a/epan/dissectors/packet-rtse.c +++ b/epan/dissectors/packet-rtse.c @@ -266,7 +266,7 @@ static int dissect_rtse_T_open(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 53 "../../asn1/rtse/rtse.cnf" - char *oid = NULL; + const char *oid = NULL; switch(app_proto) { case 1: /* mts-transfer-protocol-1984 */ @@ -526,7 +526,7 @@ dissect_rtse_RefuseReason(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offs static int dissect_rtse_T_userDataRJ(gboolean implicit_tag _U_, tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { #line 9 "../../asn1/rtse/rtse.cnf" - char *oid = NULL; + const char *oid = NULL; switch(app_proto) { case 1: /* mts-transfer-protocol-1984 */ diff --git a/epan/dissectors/packet-rtsp.c b/epan/dissectors/packet-rtsp.c index 0d19104caf..d2e464b08e 100644 --- a/epan/dissectors/packet-rtsp.c +++ b/epan/dissectors/packet-rtsp.c @@ -460,7 +460,7 @@ is_rtsp_request_or_reply(const guchar *line, size_t linelen, rtsp_type_t *type) if (tokenlen >= 3) { memcpy(response_chars, next_token, 3); response_chars[3] = '\0'; - rtsp_stat_info->response_code = strtoul(response_chars, NULL, 10); + rtsp_stat_info->response_code = (guint)strtoul(response_chars, NULL, 10); } } return TRUE; @@ -678,7 +678,7 @@ rtsp_get_content_length(const guchar *line_begin, size_t line_len) up = p; if (up == tmp || (*up != '\0' && !isspace(*up))) return -1; /* not a valid number */ - return content_length; + return (int)content_length; } static const char rtsp_Session[] = "Session:"; @@ -1060,7 +1060,7 @@ dissect_rtspmessage(tvbuff_t *tvb, int offset, packet_info *pinfo, tvb_format_text(tvb, value_offset, value_len)); - offset = offset + STRLEN_CONST(rtsp_content_type); + offset = offset + (int)STRLEN_CONST(rtsp_content_type); /* Skip wsp */ offset = tvb_skip_wsp(tvb, offset, value_len); semi_colon_offset = tvb_find_guint8(tvb, value_offset, value_len, ';'); diff --git a/epan/dissectors/packet-sap.c b/epan/dissectors/packet-sap.c index ade2b6dc23..ca8f1c7d6b 100644 --- a/epan/dissectors/packet-sap.c +++ b/epan/dissectors/packet-sap.c @@ -135,7 +135,7 @@ dissect_sap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) is_comp = vers_flags&MCAST_SAP_BIT_C; sap_version = (vers_flags&MCAST_SAP_VERSION_MASK)>>MCAST_SAP_VERSION_SHIFT; - addr_len = (is_ipv6) ? sizeof(struct e_in6_addr) : 4; + addr_len = (is_ipv6) ? (int)sizeof(struct e_in6_addr) : 4; if (check_col(pinfo->cinfo, COL_INFO)) { col_add_fstr(pinfo->cinfo, COL_INFO, "%s (v%u)", @@ -176,7 +176,7 @@ dissect_sap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) int has_pad; guint8 pad_len = 0; - auth_data_len = auth_len * sizeof(guint32); + auth_data_len = (guint32)(auth_len * sizeof(guint32)); sdi = proto_tree_add_item(sap_tree, hf_auth_data, tvb, offset, auth_data_len, ENC_NA); sa_tree = proto_item_add_subtree(sdi, ett_sap_auth); diff --git a/epan/dissectors/packet-sdp.c b/epan/dissectors/packet-sdp.c index 8b59b97af7..0f271cdfd1 100644 --- a/epan/dissectors/packet-sdp.c +++ b/epan/dissectors/packet-sdp.c @@ -482,7 +482,7 @@ dissect_sdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) for (n = 0; n < transport_info.media_count; n++) { if (transport_info.media_port[n] != NULL) { - port = atol(transport_info.media_port[n]); + port = (guint32)strtol(transport_info.media_port[n], NULL, 10); } if (transport_info.media_proto[n] != NULL) { /* Check if media protocol is RTP @@ -1189,9 +1189,9 @@ dissect_sdp_media(tvbuff_t *tvb, proto_item *ti, "RTP/AVP") == 0) { media_format = tvb_get_ephemeral_string(tvb, offset, tokenlen); proto_tree_add_string(sdp_media_tree, hf_media_format, tvb, offset, - tokenlen, val_to_str_ext(atol((char*)media_format), &rtp_payload_type_vals_ext, "%u")); + tokenlen, val_to_str_ext((guint32)strtoul((char*)media_format, NULL, 10), &rtp_payload_type_vals_ext, "%u")); idx = transport_info->media[transport_info->media_count].pt_count; - transport_info->media[transport_info->media_count].pt[idx] = atol((char*)media_format); + transport_info->media[transport_info->media_count].pt[idx] = (gint32)strtol((char*)media_format, NULL, 10); if (idx < (SDP_MAX_RTP_PAYLOAD_TYPES-1)) transport_info->media[transport_info->media_count].pt_count++; } else { @@ -1372,7 +1372,7 @@ decode_sdp_fmtp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset tokenlen = end_offset - offset; format_specific_parameter = tvb_get_ephemeral_string(tvb, offset, tokenlen); item = proto_tree_add_uint(tree, hf_sdp_fmtp_mpeg4_profile_level_id, tvb, offset, tokenlen, - atol((char*)format_specific_parameter)); + (guint32)strtol((char*)format_specific_parameter, NULL, 10)); PROTO_ITEM_SET_GENERATED(item); } else if (strcmp((char*)field_name, "config") == 0) { /* String including "=" */ @@ -1394,14 +1394,14 @@ decode_sdp_fmtp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset tokenlen = end_offset - offset; format_specific_parameter = tvb_get_ephemeral_string(tvb, offset, tokenlen); item = proto_tree_add_uint(tree, hf_sdp_fmtp_h263_profile, tvb, offset, tokenlen, - atol((char*)format_specific_parameter)); + (guint32)strtol((char*)format_specific_parameter, NULL, 10)); PROTO_ITEM_SET_GENERATED(item); } else if (strcmp((char*)field_name, "level") == 0) { offset++; tokenlen = end_offset - offset; format_specific_parameter = tvb_get_ephemeral_string(tvb, offset, tokenlen); item = proto_tree_add_uint(tree, hf_sdp_fmtp_h263_level, tvb, offset, tokenlen, - atol((char*)format_specific_parameter)); + (guint32)strtol((char*)format_specific_parameter, NULL, 10)); PROTO_ITEM_SET_GENERATED(item); } } @@ -1445,7 +1445,7 @@ decode_sdp_fmtp(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, gint offset tokenlen = end_offset - offset; format_specific_parameter = tvb_get_ephemeral_string(tvb, offset, tokenlen); item = proto_tree_add_uint(tree, hf_sdp_h264_packetization_mode, tvb, offset, tokenlen, - atol((char*)format_specific_parameter)); + (guint32)strtol((char*)format_specific_parameter, NULL, 10)); PROTO_ITEM_SET_GENERATED(item); } else if (strcmp(field_name, "sprop-parameter-sets") == 0) { /* The value of the parameter is the @@ -1622,7 +1622,7 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto } key = se_alloc(sizeof (gint)); - *key = atol((char*)payload_type); + *key = (gint)strtol((char*)payload_type, NULL, 10); transport_info->encoding_name[pt] = (char*)tvb_get_ephemeral_string(tvb, offset, tokenlen); @@ -1665,7 +1665,7 @@ static void dissect_sdp_media_attribute(tvbuff_t *tvb, packet_info *pinfo, proto } else { /* we create a new key and encoding_name to assign to the other hash tables */ gint *key2; key2 = se_alloc(sizeof (gint)); - *key2 = atol((char*)payload_type); + *key2 = (gint)strtol((char*)payload_type, NULL, 10); g_hash_table_insert(transport_info->media[n].rtp_dyn_payload, key2, encoding_name_and_rate); } diff --git a/epan/dissectors/packet-sflow.c b/epan/dissectors/packet-sflow.c index 94a8fbdd76..6d9b0c9578 100644 --- a/epan/dissectors/packet-sflow.c +++ b/epan/dissectors/packet-sflow.c @@ -1746,7 +1746,7 @@ dissect_sflow_24_flow_sample(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_text(tree, tvb, offset + 24, 4, "Output interface: ifIndex %u", output & 0x7fffffff); } - offset += sizeof (flow_header); + offset += (int)sizeof (flow_header); /* what kind of flow sample is it? */ packet_type = tvb_get_ntohl(tvb, offset); @@ -2421,7 +2421,7 @@ dissect_sflow_24_counters_sample(tvbuff_t *tvb, proto_tree *tree, gint offset, p val_to_str_const(g_ntohl(counters_header.counters_type), sflow_245_counterstype, "Unknown type")); - offset += sizeof (counters_header); + offset += (int)sizeof (counters_header); /* most counters types have the "generic" counters first */ switch (g_ntohl(counters_header.counters_type)) { @@ -2504,19 +2504,19 @@ dissect_sflow_24_counters_sample(tvbuff_t *tvb, proto_tree *tree, gint offset, p switch (g_ntohl(counters_header.counters_type)) { case SFLOW_245_COUNTERS_ETHERNET: tvb_memcpy(tvb, (guint8 *) & ethc, offset, sizeof (ethc)); - offset += sizeof (ethc); + offset += (int)sizeof (ethc); break; case SFLOW_245_COUNTERS_TOKENRING: tvb_memcpy(tvb, (guint8 *) & tokc, offset, sizeof (tokc)); - offset += sizeof (tokc); + offset += (int)sizeof (tokc); break; case SFLOW_245_COUNTERS_VG: tvb_memcpy(tvb, (guint8 *) & vgc, offset, sizeof (vgc)); - offset += sizeof (vgc); + offset += (int)sizeof (vgc); break; case SFLOW_245_COUNTERS_VLAN: tvb_memcpy(tvb, (guint8 *) & vlanc, offset, sizeof (vlanc)); - offset += sizeof (vlanc); + offset += (int)sizeof (vlanc); break; default: diff --git a/epan/dissectors/packet-simulcrypt.c b/epan/dissectors/packet-simulcrypt.c index e45d6096f5..6a368a60bc 100644 --- a/epan/dissectors/packet-simulcrypt.c +++ b/epan/dissectors/packet-simulcrypt.c @@ -51,7 +51,7 @@ typedef struct Tecm_interpretation { int ca_system_id; - char *protocol_name; + const char *protocol_name; dissector_handle_t protocol_handle; guint ecmg_port; } ecm_interpretation; diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c index a9069f1116..1619db612f 100644 --- a/epan/dissectors/packet-sip.c +++ b/epan/dissectors/packet-sip.c @@ -1665,7 +1665,7 @@ dissect_sip_reason_header(tvbuff_t *tvb, proto_tree *tree, gint start_offset, gi length = line_end_offset - current_offset; /* q850_cause_code_vals */ - cause_value = strtoul(tvb_get_ephemeral_string(tvb, current_offset, length), NULL, 10); + cause_value = (guint)strtoul(tvb_get_ephemeral_string(tvb, current_offset, length), NULL, 10); proto_tree_add_text(tree, tvb, current_offset, length, "Cause: %u(0x%x)[%s]", cause_value,cause_value, val_to_str_ext(cause_value, &q850_cause_code_vals_ext, "Unknown (%d)" )); @@ -2679,7 +2679,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr { proto_tree_add_uint(rack_tree, hf_sip_rack_rseq_no, tvb, value_offset, sub_value_offset, - strtoul(value, NULL, 10)); + (guint32)strtoul(value, NULL, 10)); break; } } @@ -2703,7 +2703,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr proto_tree_add_uint(rack_tree, hf_sip_rack_cseq_no, tvb, value_offset+cseq_no_offset, sub_value_offset-cseq_no_offset, - strtoul(value+cseq_no_offset, NULL, 10)); + (guint32)strtoul(value+cseq_no_offset, NULL, 10)); break; } } @@ -2827,7 +2827,7 @@ dissect_sip_common(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tr sip_element_item = proto_tree_add_uint(hdr_tree, hf_header_array[hf_index], tvb, offset, next_offset - offset, - strtoul(value, NULL, 10)); + (guint32)strtoul(value, NULL, 10)); } break; diff --git a/epan/dissectors/packet-smpp.c b/epan/dissectors/packet-smpp.c index 2f8d989f14..922299920e 100644 --- a/epan/dissectors/packet-smpp.c +++ b/epan/dissectors/packet-smpp.c @@ -1240,11 +1240,11 @@ smpp_handle_string(proto_tree *tree, tvbuff_t *tvb, int field, int *offset) } /* NOTE - caller must free the returned string! */ -static char * +static const char * smpp_handle_string_return(proto_tree *tree, tvbuff_t *tvb, int field, int *offset) { gint len; - char *str; + const char *str; len = tvb_strsize(tvb, *offset); if (len > 1) { @@ -1926,8 +1926,8 @@ submit_sm(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset = 0; guint8 flag, udhi; guint8 length; - char *src_str = NULL; - char *dst_str = NULL; + const char *src_str = NULL; + const char *dst_str = NULL; address save_src, save_dst; smpp_handle_string_z(tree, tvb, hf_smpp_service_type, &offset, "(Default)"); diff --git a/epan/dissectors/packet-smtp.c b/epan/dissectors/packet-smtp.c index 125b972ccf..a7e68a2966 100644 --- a/epan/dissectors/packet-smtp.c +++ b/epan/dissectors/packet-smtp.c @@ -550,7 +550,7 @@ dissect_smtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ guint32 msg_len; - msg_len = strtoul (line+5, NULL, 10); + msg_len = (guint32)strtoul (line+5, NULL, 10); spd_frame_data->pdu_type = SMTP_PDU_CMD; session_state->data_seen = TRUE; diff --git a/epan/dissectors/packet-spice.c b/epan/dissectors/packet-spice.c index 4776a931ac..ac914e5cdb 100644 --- a/epan/dissectors/packet-spice.c +++ b/epan/dissectors/packet-spice.c @@ -1170,7 +1170,7 @@ dissect_RedCursor(tvbuff_t *tvb, proto_tree *tree, guint32 offset) offset += 2; type = dissect_CursorHeader(tvb, RedCursor_tree, offset, &width, &height); - offset += sizeof_CursorHeader; + offset += (int)sizeof_CursorHeader; if (((width == 0) || (height == 0)) || (flags == SPICE_CURSOR_FLAGS_FROM_CACHE)) { @@ -1545,7 +1545,7 @@ dissect_Image(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offse guint32 ImageSize = 0; const guint8 type = dissect_ImageDescriptor(tvb, tree, offset); - offset += sizeof_ImageDescriptor; + offset += (int)sizeof_ImageDescriptor; switch (type) { case IMAGE_TYPE_QUIC: @@ -1643,7 +1643,7 @@ dissect_RectList(tvbuff_t *tvb, proto_tree *tree, guint32 offset) offset += 4; for (i = 0; i < rectlist_size; i++ ) { dissect_SpiceRect(tvb, rectlist_tree, offset, i); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; } } @@ -1719,12 +1719,12 @@ dissect_Mask(tvbuff_t *tvb, proto_tree *tree, guint32 offset) ti = proto_tree_add_text(tree, tvb, offset, sizeof_Mask, "Mask"); Mask_tree = proto_item_add_subtree(ti, ett_Mask); - bitmap = tvb_get_letohl(tvb, offset + sizeof(point32_t) + 1); + bitmap = tvb_get_letohl(tvb, offset + (int)sizeof(point32_t) + 1); if (bitmap != 0) { proto_tree_add_item(Mask_tree, hf_Mask_flag, tvb, offset, 1, ENC_NA); offset += 1; dissect_POINT32(tvb, Mask_tree, offset); - offset += sizeof(point32_t); + offset += (int)sizeof(point32_t); proto_tree_add_item(Mask_tree, hf_Mask_bitmap, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_item_set_len(ti, sizeof_Mask + sizeof_ImageDescriptor); @@ -1734,7 +1734,7 @@ dissect_Mask(tvbuff_t *tvb, proto_tree *tree, guint32 offset) proto_tree_add_text(Mask_tree, tvb, offset, 1, "Mask flag - value irrelevant as bitmap address is 0"); offset += 1; proto_tree_add_text(Mask_tree, tvb, offset, sizeof(point32_t), "Point - value irrelevant as bitmap address is 0"); - offset += sizeof(point32_t); + offset += (int)sizeof(point32_t); proto_tree_add_item(Mask_tree, hf_Mask_bitmap, tvb, offset, 4, ENC_LITTLE_ENDIAN); } return sizeof_Mask; @@ -1798,9 +1798,9 @@ dissect_DisplayBase(tvbuff_t *tvb, proto_tree *tree, guint32 offset) offset += 4; rect = dissect_SpiceRect(tvb, DisplayBase_tree, offset, -1); proto_item_append_text(ti, " - SpiceRect box (%u-%u, %u-%u)",rect.left, rect.top, rect.right, rect.bottom); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; clip_type = dissect_Clip(tvb, DisplayBase_tree, offset); - offset += sizeof_Clip; + offset += (int)sizeof_Clip; if (clip_type == CLIP_TYPE_RECTS) { clip_size = dissect_RectList(tvb, DisplayBase_tree, offset); proto_item_set_len(ti, sizeof_DisplayBase + clip_size); @@ -2080,7 +2080,7 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo dissect_ID(tvb, tree, offset); offset += 4; dissect_SpiceRect(tvb, tree, offset, -1); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; data_size = dissect_Image(tvb, tree, pinfo, offset); offset += data_size; break; @@ -2093,7 +2093,7 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo displayBaseLen = dissect_DisplayBase(tvb, tree, offset); offset += displayBaseLen; dissect_POINT32(tvb, tree, offset); - offset += sizeof(point32_t); + offset += (int)sizeof(point32_t); break; case SPICE_DISPLAY_DRAW_WHITENESS: displayBaseLen = dissect_DisplayBase(tvb, tree, offset); @@ -2127,7 +2127,7 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo offset += 4; /* source area */ dissect_SpiceRect(tvb, tree, offset, -1); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; proto_tree_add_item(tree, hf_tranparent_src_color, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_tranparent_true_color, tvb, offset, 4, ENC_LITTLE_ENDIAN); @@ -2145,7 +2145,7 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo /* source area */ dissect_SpiceRect(tvb, tree, offset, -1); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; proto_tree_add_item(tree, hf_display_rop_descriptor, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; @@ -2167,7 +2167,7 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo /* source area */ dissect_SpiceRect(tvb, tree, offset, -1); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; data_size = dissect_Brush(tvb, tree, offset); offset += data_size; @@ -2192,7 +2192,7 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo offset += 4; r = dissect_SpiceRect(tvb, tree, offset, -1); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; if (!rect_is_empty(r)) { data_size = dissect_Brush(tvb, tree, offset); offset += data_size; @@ -2218,7 +2218,7 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo proto_tree_add_item(tree, hf_display_stream_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; clip_type = dissect_Clip(tvb, tree, offset); - offset += sizeof_Clip; + offset += (int)sizeof_Clip; if (clip_type == CLIP_TYPE_RECTS) { offset += dissect_RectList(tvb, tree, offset); } @@ -2243,9 +2243,9 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo proto_tree_add_item(tree, hf_display_stream_src_height, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; dissect_SpiceRect(tvb, tree, offset, -1); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; clip_type = dissect_Clip(tvb, tree, offset); - offset += sizeof_Clip; + offset += (int)sizeof_Clip; if (clip_type == CLIP_TYPE_RECTS) { offset += dissect_RectList(tvb, tree, offset); } @@ -2277,7 +2277,7 @@ dissect_spice_display_server(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo proto_tree_add_item(tree, hf_display_stream_height, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; dissect_SpiceRect(tvb, tree, offset, -1); - offset += sizeof_SpiceRect; + offset += (int)sizeof_SpiceRect; proto_tree_add_item(tree, hf_display_stream_data_size, tvb, offset, 4, ENC_LITTLE_ENDIAN); offset += 4; break; @@ -2387,7 +2387,7 @@ dissect_spice_cursor_server(tvbuff_t *tvb, proto_tree *tree, const guint16 messa switch (message_type) { case SPICE_CURSOR_INIT: dissect_POINT16(tvb, tree, offset); - offset += sizeof(point16_t); + offset += (int)sizeof(point16_t); proto_tree_add_item(tree, hf_cursor_trail_len, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; proto_tree_add_item(tree, hf_cursor_trail_freq, tvb, offset, 2, ENC_LITTLE_ENDIAN); @@ -2402,14 +2402,14 @@ dissect_spice_cursor_server(tvbuff_t *tvb, proto_tree *tree, const guint16 messa break; case SPICE_CURSOR_SET: dissect_POINT16(tvb, tree, offset); - offset += sizeof(point16_t); + offset += (int)sizeof(point16_t); offset +=1; /*TODO flags */ RedCursorSize = dissect_RedCursor(tvb, tree, offset); offset += RedCursorSize; break; case SPICE_CURSOR_MOVE: dissect_POINT16(tvb, tree, offset); - offset += sizeof(point16_t); + offset += (int)sizeof(point16_t); break; case SPICE_CURSOR_HIDE: proto_tree_add_text(tree, tvb, offset, 0, "CURSOR_HIDE message"); @@ -2698,7 +2698,7 @@ dissect_spice_inputs_client(tvbuff_t *tvb, proto_tree *tree, const guint16 messa ti = proto_tree_add_text(tree, tvb, offset, sizeof(point32_t) + 3, "Client MOUSE_POSITION message"); inputs_tree = proto_item_add_subtree(ti, ett_inputs_client); dissect_POINT32(tvb, inputs_tree, offset); - offset += sizeof(point32_t); + offset += (int)sizeof(point32_t); proto_tree_add_item(inputs_tree, hf_button_state, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; proto_tree_add_item(inputs_tree, hf_mouse_display_id, tvb, offset, 1, ENC_LITTLE_ENDIAN); @@ -2708,7 +2708,7 @@ dissect_spice_inputs_client(tvbuff_t *tvb, proto_tree *tree, const guint16 messa ti = proto_tree_add_text(tree, tvb, offset, sizeof(point32_t) + 4, "Client MOUSE_MOTION message"); inputs_tree = proto_item_add_subtree(ti, ett_inputs_client); dissect_POINT32(tvb, inputs_tree, offset); - offset += sizeof(point32_t); + offset += (int)sizeof(point32_t); proto_tree_add_item(inputs_tree, hf_button_state, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; break; @@ -3094,7 +3094,7 @@ dissect_spice_link_server_pdu(tvbuff_t *tvb, proto_tree *tree, spice_conversatio common_caps_len = tvb_get_letohl(tvb, offset + 4 + SPICE_TICKET_PUBKEY_BYTES); channel_caps_len = tvb_get_letohl(tvb, offset + 8 + SPICE_TICKET_PUBKEY_BYTES); - offset += sizeof_SpiceLinkHeader + SPICE_TICKET_PUBKEY_BYTES; + offset += (int)sizeof_SpiceLinkHeader + SPICE_TICKET_PUBKEY_BYTES; if (common_caps_len > 0) { ti = proto_tree_add_text(tree, tvb, offset, common_caps_len * 4, diff --git a/epan/dissectors/packet-spnego.c b/epan/dissectors/packet-spnego.c index 69719b8c77..91e085715b 100644 --- a/epan/dissectors/packet-spnego.c +++ b/epan/dissectors/packet-spnego.c @@ -899,11 +899,11 @@ arcfour_mic_cksum(guint8 *key_data, int key_length, */ static int gssapi_verify_pad(unsigned char *wrapped_data, int wrapped_length, - size_t datalen, - size_t *padlen) + int datalen, + int *padlen) { unsigned char *pad; - size_t padlength; + int padlength; int i; pad = wrapped_data + wrapped_length - 1; @@ -930,14 +930,14 @@ decrypt_arcfour(packet_info *pinfo, { guint8 Klocaldata[16]; int ret; - size_t datalen; + int datalen; guint8 k6_data[16]; guint32 SND_SEQ[2]; guint8 Confounder[8]; guint8 cksum_data[8]; int cmp; int conf_flag; - size_t padlen = 0; + int padlen = 0; datalen = tvb_length(pinfo->gssapi_encrypted_tvb); diff --git a/epan/dissectors/packet-srvloc.c b/epan/dissectors/packet-srvloc.c index 6b88d5a6ba..640087c91d 100644 --- a/epan/dissectors/packet-srvloc.c +++ b/epan/dissectors/packet-srvloc.c @@ -443,7 +443,7 @@ add_v1_string(proto_tree *tree, int hf, tvbuff_t *tvb, int offset, int length, * * XXX - this is also used with CHARSET_UTF_8. Is that a cut-and-pasteo? */ -static guint8* +static const guint8* unicode_to_bytes(tvbuff_t *tvb, int offset, int length, gboolean endianness) { const guint8 *ascii_text = tvb_get_ephemeral_string(tvb, offset, length); @@ -505,10 +505,10 @@ static void attr_list(proto_tree *tree, int hf, tvbuff_t *tvb, int offset, int length, guint16 encoding) { - char *attr_type; + const char *attr_type; int i, svc, ss, type_len, foffset=offset; guint32 prot; - guint8 *byte_value; + const guint8 *byte_value; proto_item *ti; proto_tree *srvloc_tree; char *tmp; @@ -549,16 +549,15 @@ attr_list(proto_tree *tree, int hf, tvbuff_t *tvb, int offset, int length, attr_type = tvb_get_ephemeral_unicode_string(tvb, offset, type_len*2, ENC_BIG_ENDIAN); proto_tree_add_string(tree, hf, tvb, offset, type_len*2, attr_type); offset += (type_len*2)+2; - /* If this is the attribute svcname */ if (strcmp(attr_type, "svcname-ws")==0) { + /* This is the attribute svcname */ tmp = tvb_get_ephemeral_unicode_string(tvb, offset, length-offset, ENC_BIG_ENDIAN); type_len = (int)strcspn(tmp, ")"); add_v1_string(tree, hf_srvloc_srvrply_svcname, tvb, offset, type_len*2, encoding); offset += (type_len*2)+4; - attr_type[0] = '\0'; - } - /* If this is the attribute svcaddr */ - if (strcmp(attr_type, "svcaddr-ws")==0) { + attr_type = ""; + } else if (strcmp(attr_type, "svcaddr-ws")==0) { + /* This is the attribute svcaddr */ i=1; for (foffset = offset; foffsetversion_netorder==SSLV3_VERSION){ @@ -2745,7 +2745,8 @@ ssl_load_key(FILE* fp) */ gnutls_x509_privkey_t priv_key; gnutls_datum_t key; - gint size, ret; + long size; + gint ret; guint bytes; Ssl_private_key_t *private_key = g_malloc0(sizeof(Ssl_private_key_t)); @@ -2770,7 +2771,7 @@ ssl_load_key(FILE* fp) return NULL; } key.data = g_malloc(size); - key.size = size; + key.size = (int)size; bytes = (guint) fread(key.data, 1, key.size, fp); if (bytes < key.size) { ssl_debug_printf("ssl_load_key: can't read from file %d bytes, got %d\n", diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c index 63caf9e15a..dbd259ee76 100644 --- a/epan/dissectors/packet-ssl.c +++ b/epan/dissectors/packet-ssl.c @@ -482,8 +482,6 @@ ssl_association_info_(gpointer key_ _U_, gpointer value_, gpointer s_) return FALSE; } -extern GTree* ssl_associations; - /** * @return an information string on the SSL protocol associations. The string has ephemeral lifetime/scope. */ diff --git a/epan/dissectors/packet-synphasor.c b/epan/dissectors/packet-synphasor.c index 7efbf1c16f..2a405c5d24 100644 --- a/epan/dissectors/packet-synphasor.c +++ b/epan/dissectors/packet-synphasor.c @@ -672,7 +672,7 @@ static gint dissect_header(tvbuff_t *tvb, proto_tree *tree) } /* forward declarations of helper functions for 'dissect_config_frame()' */ -static gint dissect_CHNAM (tvbuff_t *tvb, proto_tree *tree, gint offset, gint cnt, char *prefix); +static gint dissect_CHNAM (tvbuff_t *tvb, proto_tree *tree, gint offset, gint cnt, const char *prefix); static gint dissect_PHUNIT (tvbuff_t *tvb, proto_tree *tree, gint offset, gint cnt); static gint dissect_ANUNIT (tvbuff_t *tvb, proto_tree *tree, gint offset, gint cnt); static gint dissect_DIGUNIT(tvbuff_t *tvb, proto_tree *tree, gint offset, gint cnt); @@ -1171,7 +1171,7 @@ static gint dissect_DIGUNIT(tvbuff_t *tvb, proto_tree *tree, gint offset, gint c } /* used by 'dissect_config_frame()' to dissect the "channel name"-fields */ -static gint dissect_CHNAM(tvbuff_t *tvb, proto_tree *tree, gint offset, gint cnt, char *prefix) +static gint dissect_CHNAM(tvbuff_t *tvb, proto_tree *tree, gint offset, gint cnt, const char *prefix) { proto_item *temp_item = NULL; proto_tree *temp_tree = NULL; diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index 7d835e1e6f..d16c57455f 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -3415,7 +3415,7 @@ dissect_tcpopt_rvbd_probe(const ip_tcp_opt *optp _U_, tvbuff_t *tvb, int offset, if (tvb_memeql(tvb, offset + PROBE_V1_QUERY_LEN, qinfo_hdr, sizeof(qinfo_hdr)) == 0) { not_cfe = tvb_get_guint8(tvb, offset + PROBE_V1_QUERY_LEN + - sizeof(qinfo_hdr)) & RVBD_FLAGS_PROBE_NCFE; + (int)sizeof(qinfo_hdr)) & RVBD_FLAGS_PROBE_NCFE; } col_prepend_fstr(pinfo->cinfo, COL_INFO, "S%s, ", type == PROBE_TRACE ? "#" : diff --git a/epan/dissectors/packet-tds.c b/epan/dissectors/packet-tds.c index 83c1c947cd..130475d9df 100644 --- a/epan/dissectors/packet-tds.c +++ b/epan/dissectors/packet-tds.c @@ -1107,51 +1107,51 @@ dissect_tds7_login(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) td7hdr.total_packet_size = tvb_get_letohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_login_total_size, tvb, offset, sizeof(td7hdr.total_packet_size), td7hdr.total_packet_size); - offset += sizeof(td7hdr.total_packet_size); + offset += (int)sizeof(td7hdr.total_packet_size); td7hdr.tds_version = tvb_get_ntohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_version, tvb, offset, sizeof(td7hdr.tds_version), td7hdr.tds_version); - offset += sizeof(td7hdr.tds_version); + offset += (int)sizeof(td7hdr.tds_version); td7hdr.packet_size = tvb_get_ntohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_packet_size, tvb, offset, sizeof(td7hdr.packet_size), td7hdr.packet_size); - offset += sizeof(td7hdr.packet_size); + offset += (int)sizeof(td7hdr.packet_size); td7hdr.client_version = tvb_get_ntohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_client_version, tvb, offset, sizeof(td7hdr.client_version), td7hdr.client_version); - offset += sizeof(td7hdr.client_version); + offset += (int)sizeof(td7hdr.client_version); td7hdr.client_pid = tvb_get_letohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_client_pid, tvb, offset, sizeof(td7hdr.client_pid), td7hdr.client_pid); - offset += sizeof(td7hdr.client_pid); + offset += (int)sizeof(td7hdr.client_pid); td7hdr.connection_id= tvb_get_letohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_connection_id, tvb, offset, sizeof(td7hdr.connection_id), td7hdr.connection_id); - offset += sizeof(td7hdr.connection_id); + offset += (int)sizeof(td7hdr.connection_id); td7hdr.option_flags1 = tvb_get_guint8(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_option_flags1, tvb, offset, sizeof(td7hdr.option_flags1), td7hdr.option_flags1); - offset += sizeof(td7hdr.option_flags1); + offset += (int)sizeof(td7hdr.option_flags1); td7hdr.option_flags2 = tvb_get_guint8(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_option_flags2, tvb, offset, sizeof(td7hdr.option_flags2), td7hdr.option_flags2); - offset += sizeof(td7hdr.option_flags2); + offset += (int)sizeof(td7hdr.option_flags2); td7hdr.sql_type_flags = tvb_get_guint8(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_sql_type_flags, tvb, offset, sizeof(td7hdr.sql_type_flags), td7hdr.sql_type_flags); - offset += sizeof(td7hdr.sql_type_flags); + offset += (int)sizeof(td7hdr.sql_type_flags); td7hdr.reserved_flags = tvb_get_guint8(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_reserved_flags, tvb, offset, sizeof(td7hdr.reserved_flags), td7hdr.reserved_flags); - offset += sizeof(td7hdr.reserved_flags); + offset += (int)sizeof(td7hdr.reserved_flags); td7hdr.time_zone = tvb_get_ntohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_time_zone, tvb, offset, sizeof(td7hdr.time_zone), td7hdr.time_zone); - offset += sizeof(td7hdr.time_zone); + offset += (int)sizeof(td7hdr.time_zone); td7hdr.collation = tvb_get_ntohl(tvb, offset); proto_tree_add_uint(header_tree, hf_tds7_collation, tvb, offset, sizeof(td7hdr.collation), td7hdr.collation); - offset += sizeof(td7hdr.collation); + offset += (int)sizeof(td7hdr.collation); length_hdr = proto_tree_add_text(login_tree, tvb, offset, 50, "Lengths and offsets"); length_tree = proto_item_add_subtree(length_hdr, ett_tds7_hdr); diff --git a/epan/dissectors/packet-telnet.c b/epan/dissectors/packet-telnet.c index af10ee97ce..d97d527868 100644 --- a/epan/dissectors/packet-telnet.c +++ b/epan/dissectors/packet-telnet.c @@ -1091,7 +1091,6 @@ static void dissect_authentication_subopt(packet_info *pinfo, const char *optname _U_, tvbuff_t *tvb, int offset, int len, proto_tree *tree) { guint8 acmd; - char *name; /* XXX here we should really split it up in a conversation struct keeping track of what method we actually use and not just assume it is always @@ -1116,14 +1115,7 @@ dissect_authentication_subopt(packet_info *pinfo, const char *optname _U_, tvbuf } break; case TN_AC_NAME: - if(len<255){ - name=ep_alloc(256); - tvb_memcpy(tvb, (guint8*)name, offset, len); - name[len]=0; - } else { - name="<...name too long...>"; - } - proto_tree_add_string(tree, hf_telnet_auth_name, tvb, offset, len, name); + proto_tree_add_item(tree, hf_telnet_auth_name, tvb, offset, len, ENC_ASCII); break; } } diff --git a/epan/dissectors/packet-tftp.c b/epan/dissectors/packet-tftp.c index 021e08f2fc..a48e7d6274 100644 --- a/epan/dissectors/packet-tftp.c +++ b/epan/dissectors/packet-tftp.c @@ -148,7 +148,7 @@ tftp_dissect_options(tvbuff_t *tvb, packet_info *pinfo, int offset, /* Special code to handle individual options */ if (!g_ascii_strcasecmp((const char *)optionname, "blksize") && opcode == TFTP_OACK) { - gint blocksize = strtol((const char *)optionvalue, NULL, 10); + gint blocksize = (gint)strtol((const char *)optionvalue, NULL, 10); if (blocksize < 8 || blocksize > 65464) { expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_WARN, "TFTP blocksize out of range"); diff --git a/epan/dissectors/packet-tivoconnect.c b/epan/dissectors/packet-tivoconnect.c index 68b12087b6..fa4348e61f 100644 --- a/epan/dissectors/packet-tivoconnect.c +++ b/epan/dissectors/packet-tivoconnect.c @@ -70,7 +70,7 @@ dissect_tivoconnect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *d gchar * string = NULL; gint length = -1; /* value strings */ - gchar * proto_name = NULL; + const gchar * proto_name = NULL; gchar * packet_identity = NULL; gchar * packet_machine = NULL; diff --git a/epan/dissectors/packet-tpncp.c b/epan/dissectors/packet-tpncp.c index 6ed5720e84..23eb9947fa 100644 --- a/epan/dissectors/packet-tpncp.c +++ b/epan/dissectors/packet-tpncp.c @@ -585,7 +585,7 @@ static gint init_tpncp_data_fields_info(tpncp_data_field_info *data_fields_info, if (!was_registered) { /* Register non-standard data should be done only once. */ - hf_allocated = hf_size+array_length(hf_tpncp)-1; + hf_allocated = hf_size+(int)array_length(hf_tpncp)-1; if ((hf = (hf_register_info *)g_realloc(hf, hf_allocated * sizeof(hf_register_info))) == NULL) return (-1); for (idx = 0; idx < array_length(hf_tpncp); idx++) { diff --git a/epan/dissectors/packet-ucp.c b/epan/dissectors/packet-ucp.c index c66c62295a..d38f8cca8c 100644 --- a/epan/dissectors/packet-ucp.c +++ b/epan/dissectors/packet-ucp.c @@ -111,12 +111,12 @@ static int st_ucp_results = -1; static int st_ucp_results_pos = -1; static int st_ucp_results_neg = -1; -static gchar* st_str_ucp = "UCP Messages"; -static gchar* st_str_ops = "Operations"; -static gchar* st_str_res = "Results"; -static gchar* st_str_ucp_res = "UCP Results Acks/Nacks"; -static gchar* st_str_pos = "Positive"; -static gchar* st_str_neg = "Negative"; +static gchar st_str_ucp[] = "UCP Messages"; +static gchar st_str_ops[] = "Operations"; +static gchar st_str_res[] = "Results"; +static gchar st_str_ucp_res[] = "UCP Results Acks/Nacks"; +static gchar st_str_pos[] = "Positive"; +static gchar st_str_neg[] = "Negative"; /* * Data (variable) section @@ -749,7 +749,7 @@ check_ucp(tvbuff_t *tvb, int *endpkt) * \return The date in standard 'time_t' format. */ static time_t -ucp_mktime(char *datestr) +ucp_mktime(const char *datestr) { struct tm r_time; @@ -866,7 +866,7 @@ static guint ucp_handle_int(proto_tree *tree, tvbuff_t *tvb, int field, int *offset) { gint idx, len; - char *strval; + const char *strval; guint intval = 0; idx = tvb_find_guint8(tvb, *offset, -1, '/'); @@ -876,7 +876,7 @@ ucp_handle_int(proto_tree *tree, tvbuff_t *tvb, int field, int *offset) tvb_ensure_bytes_exist(tvb, *offset, len + 1); } else len = idx - *offset; - strval = (gchar*)tvb_get_ephemeral_string(tvb, *offset, len); + strval = tvb_get_ephemeral_string(tvb, *offset, len); if (len > 0) { intval = atoi(strval); proto_tree_add_uint(tree, field, tvb, *offset, len, intval); @@ -891,7 +891,7 @@ static void ucp_handle_time(proto_tree *tree, tvbuff_t *tvb, int field, int *offset) { gint idx, len; - char *strval; + const char *strval; time_t tval; nstime_t tmptime; @@ -902,7 +902,7 @@ ucp_handle_time(proto_tree *tree, tvbuff_t *tvb, int field, int *offset) tvb_ensure_bytes_exist(tvb, *offset, len + 1); } else len = idx - *offset; - strval = (gchar*)tvb_get_ephemeral_string(tvb, *offset, len); + strval = tvb_get_ephemeral_string(tvb, *offset, len); if (len > 0) { tval = ucp_mktime(strval); tmptime.secs = tval; diff --git a/epan/dissectors/packet-umts_mac.c b/epan/dissectors/packet-umts_mac.c index e690a884fb..57133186af 100644 --- a/epan/dissectors/packet-umts_mac.c +++ b/epan/dissectors/packet-umts_mac.c @@ -39,7 +39,6 @@ int proto_umts_mac = -1; extern int proto_fp; extern int proto_rlc; -extern int proto_rrc; /* dissector fields */ static int hf_mac_fach_fdd_tctf = -1; diff --git a/epan/dissectors/packet-umts_mac.h b/epan/dissectors/packet-umts_mac.h index 4ca6c7c52f..78f8f95184 100644 --- a/epan/dissectors/packet-umts_mac.h +++ b/epan/dissectors/packet-umts_mac.h @@ -84,6 +84,6 @@ enum enum_mac_tsn_size { MAC_TSN_6BITS, MAC_TSN_14BITS }; -gint get_mac_tsn_size(); +gint get_mac_tsn_size(void); #endif diff --git a/epan/dissectors/packet-vines.c b/epan/dissectors/packet-vines.c index 4e2123cbe5..bef0fada79 100644 --- a/epan/dissectors/packet-vines.c +++ b/epan/dissectors/packet-vines.c @@ -299,6 +299,11 @@ dissect_vines_frp_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, { guint8 vines_frp_ctrl; + if (pinfo->srcport != pinfo->destport) { + /* Require that the source and destination ports be the + * port for Vines FRP. */ + return 0; + } if (!tvb_bytes_exist(tvb, 0, 1)) { /* Too short to check the flags value. */ return 0; @@ -357,8 +362,6 @@ proto_reg_handoff_vines_frp(void) proto_vines_frp); dissector_add_uint("ip.proto", IP_PROTO_VINES, vines_frp_handle); - /* XXX: AFAIK, src and dst port must be the same; should - the dissector check for that? */ vines_frp_new_handle = new_create_dissector_handle(dissect_vines_frp_new, proto_vines_frp); dissector_add_uint("udp.port", UDP_PORT_VINES, vines_frp_new_handle); diff --git a/epan/dissectors/packet-vxi11.c b/epan/dissectors/packet-vxi11.c index a704e85f31..050ef5d3a3 100644 --- a/epan/dissectors/packet-vxi11.c +++ b/epan/dissectors/packet-vxi11.c @@ -319,7 +319,7 @@ dissect_create_link_parms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - char *str; + const char *str; offset = dissect_rpc_uint32(tvb, tree, hf_vxi11_core_client_id, offset); offset = dissect_rpc_bool(tvb, tree, hf_vxi11_core_lock_device, offset); diff --git a/epan/dissectors/packet-wccp.c b/epan/dissectors/packet-wccp.c index f8c877ff95..f88baf3d86 100644 --- a/epan/dissectors/packet-wccp.c +++ b/epan/dissectors/packet-wccp.c @@ -252,7 +252,7 @@ static void dissect_web_cache_list_entry(tvbuff_t *tvb, int offset, int idx, proto_tree *wccp_tree); static guint32 wccp_bucket_info(guint8 bucket_info, proto_tree *bucket_tree, guint32 start, tvbuff_t *tvb, int offset); -static gchar *bucket_name(guint8 bucket); +static const gchar *bucket_name(guint8 bucket); static guint16 dissect_wccp2_header(tvbuff_t *tvb, int offset, proto_tree *wccp_tree); static void dissect_wccp2_info(tvbuff_t *tvb, int offset, guint16 length, @@ -456,10 +456,10 @@ wccp_bucket_info(guint8 bucket_info, proto_tree *bucket_tree, guint32 start, return(start); } -static gchar * +static const gchar * bucket_name(guint8 bucket) { - gchar *cur; + const gchar *cur; if (bucket == 0xff) { cur="Unassigned"; @@ -956,10 +956,10 @@ dissect_wccp2_router_assignment_element(tvbuff_t *tvb, int offset, proto_tree_add_item(tree, hf_router_assignment_element_change_num, tvb, offset+8, 4, ENC_BIG_ENDIAN); } -static gchar * +static const gchar * assignment_bucket_name(guint8 bucket) { - gchar *cur; + const gchar *cur; if (bucket == 0xff) { cur="Unassigned"; diff --git a/epan/dissectors/packet-wsp.c b/epan/dissectors/packet-wsp.c index a7a2e7824b..9f5a54e95b 100644 --- a/epan/dissectors/packet-wsp.c +++ b/epan/dissectors/packet-wsp.c @@ -1317,7 +1317,7 @@ parameter_value_q (proto_tree *tree, proto_item *ti, tvbuff_t *tvb, int start); " " /* WSP well-known header parsing function prototypes; - * will be listed in the function lookup table WellKnownHeaders[] */ + * will be listed in the function lookup table WellKnownHeader[] */ static guint32 wkh_default (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_); static guint32 wkh_accept (proto_tree *tree, tvbuff_t *tvb, @@ -1414,9 +1414,6 @@ static guint32 wkh_authorization (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_); static guint32 wkh_proxy_authorization (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_); -/* Pragma */ -static guint32 wkh_pragma (proto_tree *tree, tvbuff_t *tvb, - guint32 hdr_start, packet_info *pinfo _U_); /* Integer-value */ static guint32 wkh_content_length (proto_tree *tree, tvbuff_t *tvb, guint32 hdr_start, packet_info *pinfo _U_); diff --git a/epan/dissectors/packet-x11.c b/epan/dissectors/packet-x11.c index ef190a2604..edf9f180f3 100644 --- a/epan/dissectors/packet-x11.c +++ b/epan/dissectors/packet-x11.c @@ -1229,11 +1229,11 @@ static const value_string zero_is_none_vals[] = { \ seqno = VALUE16(tvb, *offsetp); \ proto_tree_add_uint_format(t, hf_x11_reply_##name, tvb, \ - *offsetp, sizeof(seqno), seqno, \ + *offsetp, 2, seqno, \ "sequencenumber: %d (%s)", \ (int)seqno, \ val_to_str(opcode & 0xFF, state->opcode_vals, "")); \ - *offsetp += sizeof(seqno); \ + *offsetp += 2; \ } while (0) #define REPLYCONTENTS_COMMON() do { \ @@ -1580,10 +1580,12 @@ static void listOfColorItem(tvbuff_t *tvb, int *offsetp, proto_tree *t, int hf, } } +#if 0 /* XXX: Use of GTree no longer needed; use value_string_ext */ static gint compareGuint32(gconstpointer a, gconstpointer b) { return GPOINTER_TO_INT(b) - GPOINTER_TO_INT(a); } +#endif static void XConvertCase(register int sym, int *lower, int *upper) @@ -1893,7 +1895,7 @@ static void listOfKeycode(tvbuff_t *tvb, int *offsetp, proto_tree *t, int hf, guint byte_order _U_) { proto_item *ti = proto_tree_add_item(t, hf, tvb, *offsetp, - array_length(modifiers) * keycodes_per_modifier, ENC_NA); + (int)array_length(modifiers) * keycodes_per_modifier, ENC_NA); proto_tree *tt = proto_item_add_subtree(ti, ett_x11_list_of_keycode); size_t m; diff --git a/epan/dissectors/packet-xml.c b/epan/dissectors/packet-xml.c index 2ff61f0896..59a34affd5 100644 --- a/epan/dissectors/packet-xml.c +++ b/epan/dissectors/packet-xml.c @@ -53,7 +53,7 @@ struct _attr_reg_data { GArray *hf; - gchar *basename; + const gchar *basename; }; @@ -77,8 +77,8 @@ static tvbparse_wanted_t *want_heur; static GHashTable *xmpli_names; static GHashTable *media_types; -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 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 *root_ns; static gboolean pref_heuristic_media = FALSE; @@ -184,7 +184,7 @@ dissect_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) tvbparse_t *tt; static GPtrArray *stack; xml_frame_t *current_frame; - char *colinfo_str; + const char *colinfo_str; if (stack != NULL) g_ptr_array_free(stack, TRUE); @@ -210,8 +210,10 @@ dissect_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) root_ns = &xml_ns; colinfo_str = "/XML"; } else { - colinfo_str = ep_strdup_printf("/%s", root_ns->name); - ascii_strup_inplace(colinfo_str); + char *colinfo_str_buf; + colinfo_str_buf = ep_strdup_printf("/%s", root_ns->name); + ascii_strup_inplace(colinfo_str_buf); + colinfo_str = colinfo_str_buf; } col_append_str(pinfo->cinfo, COL_PROTOCOL, colinfo_str); @@ -769,7 +771,7 @@ static void init_xml_parser(void) } -static xml_ns_t *xml_new_namespace(GHashTable *hash, gchar *name, ...) +static xml_ns_t *xml_new_namespace(GHashTable *hash, const gchar *name, ...) { xml_ns_t *ns = g_malloc(sizeof(xml_ns_t)); va_list ap; @@ -798,7 +800,7 @@ static xml_ns_t *xml_new_namespace(GHashTable *hash, gchar *name, ...) } -static void add_xml_field(GArray *hfs, int *p_id, gchar *name, gchar *fqn) +static void add_xml_field(GArray *hfs, int *p_id, const gchar *name, const gchar *fqn) { hf_register_info hfri; @@ -1064,7 +1066,7 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) g_string_append_printf(errors, "element %s defined more than once\n", element->name); free_elements(NULL, element, NULL); } else { - g_hash_table_insert(elements, element->name, element); + g_hash_table_insert(elements, (gpointer)element->name, element); g_ptr_array_add(element_names, g_strdup(element->name)); } @@ -1140,7 +1142,7 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) make_xml_hier(root_name, root_element, elements, hier, errors, hfs, etts, dtd_data->proto_name); - g_hash_table_insert(root_element->elements, root_element->name, root_element); + g_hash_table_insert(root_element->elements, (gpointer)root_element->name, root_element); orig_root = g_hash_table_lookup(elements, root_name); @@ -1166,7 +1168,7 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) if( ! g_hash_table_lookup(root_element->elements, curr_name) ) { xml_ns_t *new = make_xml_hier(curr_name, root_element, elements, hier, errors, hfs, etts, dtd_data->proto_name); - g_hash_table_insert(root_element->elements, new->name, new); + g_hash_table_insert(root_element->elements, (gpointer)new->name, new); } g_free(curr_name); @@ -1200,7 +1202,7 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) g_ptr_array_free(new->element_names, TRUE); - g_hash_table_insert(root_element->elements, new->name, new); + g_hash_table_insert(root_element->elements, (gpointer)new->name, new); } } @@ -1241,7 +1243,7 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) g_array_free(etts, TRUE); } - g_hash_table_insert(xml_ns.elements, root_element->name, root_element); + g_hash_table_insert(xml_ns.elements, (gpointer)root_element->name, root_element); g_hash_table_foreach_remove(elements, free_elements, NULL); g_hash_table_destroy(elements); @@ -1345,7 +1347,7 @@ static void init_xml_names(void) } } - g_hash_table_foreach(xmpli_names, add_xmlpi_namespace, "xml.xmlpi"); + g_hash_table_foreach(xmpli_names, add_xmlpi_namespace, (gpointer)"xml.xmlpi"); g_free(dummy); } diff --git a/epan/dissectors/packet-xml.h b/epan/dissectors/packet-xml.h index 7bedc9b100..ae76465ed1 100644 --- a/epan/dissectors/packet-xml.h +++ b/epan/dissectors/packet-xml.h @@ -29,7 +29,7 @@ typedef struct _xml_ns_t { gchar* name; /* its fully qualified name */ - gchar* fqn; + const gchar* fqn; /* the contents of the whole element from <> to */ int hf_tag; diff --git a/epan/dissectors/packet-xmpp-core.c b/epan/dissectors/packet-xmpp-core.c index 099cc89e79..4f0697afda 100644 --- a/epan/dissectors/packet-xmpp-core.c +++ b/epan/dissectors/packet-xmpp-core.c @@ -243,7 +243,7 @@ xmpp_error(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t * if(cond_element) { fake_condition = xmpp_ep_init_attr_t(cond_element->name, cond_element->offset, cond_element->length); - g_hash_table_insert(element->attrs,"condition", fake_condition); + g_hash_table_insert(element->attrs, (gpointer)"condition", fake_condition); error_info = ep_strdup_printf("%s: %s;", error_info, cond_element->name); } @@ -317,13 +317,13 @@ xmpp_presence(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_ if((show = xmpp_steal_element_by_name(packet, "show"))!=NULL) { xmpp_attr_t *fake_show = xmpp_ep_init_attr_t(show->data?show->data->value:"",show->offset, show->length); - g_hash_table_insert(packet->attrs, "show", fake_show); + g_hash_table_insert(packet->attrs, (gpointer)"show", fake_show); } if((priority = xmpp_steal_element_by_name(packet, "priority"))!=NULL) { xmpp_attr_t *fake_priority = xmpp_ep_init_attr_t(priority->data?priority->data->value:"",priority->offset, priority->length); - g_hash_table_insert(packet->attrs, "priority", fake_priority); + g_hash_table_insert(packet->attrs, (gpointer)"priority", fake_priority); } xmpp_display_attrs(presence_tree, packet, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -352,7 +352,7 @@ xmpp_presence_status(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_e fake_value = xmpp_ep_init_attr_t("(empty)", element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_value); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_value); xmpp_display_attrs(status_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -411,7 +411,7 @@ xmpp_message(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t if((chatstate = xmpp_steal_element_by_attr(packet, "xmlns", "http://jabber.org/protocol/chatstates"))!=NULL) { xmpp_attr_t *fake_chatstate_attr = xmpp_ep_init_attr_t(chatstate->name, chatstate->offset, chatstate->length); - g_hash_table_insert(packet->attrs, "chatstate", fake_chatstate_attr); + g_hash_table_insert(packet->attrs, (gpointer)"chatstate", fake_chatstate_attr); } xmpp_display_attrs(message_tree, packet, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -450,7 +450,7 @@ xmpp_message_body(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_elem body_tree = proto_item_add_subtree(body_item, ett_xmpp_message_body); fake_data_attr = xmpp_ep_init_attr_t(element->data?element->data->value:"", element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_data_attr); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_data_attr); xmpp_display_attrs(body_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -474,7 +474,7 @@ xmpp_message_subject(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_e subject_tree = proto_item_add_subtree(subject_item, ett_xmpp_message_subject); fake_data_attr = xmpp_ep_init_attr_t(element->data?element->data->value:"", element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_data_attr); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_data_attr); xmpp_display_attrs(subject_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -499,7 +499,7 @@ xmpp_message_thread(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_el thread_tree = proto_item_add_subtree(thread_item, ett_xmpp_message_thread); fake_value = xmpp_ep_init_attr_t(element->data?element->data->value:"", element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_value); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_value); xmpp_display_attrs(thread_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -583,7 +583,7 @@ xmpp_failure(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t if((fail_condition = xmpp_steal_element_by_names(packet, fail_names, array_length(fail_names)))!=NULL) { xmpp_attr_t *fake_cond = xmpp_ep_init_attr_t(fail_condition->name, fail_condition->offset, fail_condition->length); - g_hash_table_insert(packet->attrs, "condition", fake_cond); + g_hash_table_insert(packet->attrs, (gpointer)"condition", fake_cond); } if((text = xmpp_steal_element_by_name(packet, "text"))!=NULL) diff --git a/epan/dissectors/packet-xmpp-gtalk.c b/epan/dissectors/packet-xmpp-gtalk.c index 4e643af1eb..24eca11aef 100644 --- a/epan/dissectors/packet-xmpp-gtalk.c +++ b/epan/dissectors/packet-xmpp-gtalk.c @@ -188,14 +188,14 @@ xmpp_gtalk_session_reason(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, x if((condition = xmpp_steal_element_by_names(element, reason_names, array_length(reason_names)))!=NULL) { xmpp_attr_t *fake_cond = xmpp_ep_init_attr_t(condition->name, condition->offset, condition->length); - g_hash_table_insert(element->attrs, "condition", fake_cond); + g_hash_table_insert(element->attrs, (gpointer)"condition", fake_cond); } if((text = xmpp_steal_element_by_name(element, "text"))!=NULL) { xmpp_attr_t *fake_text = xmpp_ep_init_attr_t(text->data?text->data->value:"", text->offset, text->length); - g_hash_table_insert(element->attrs, "text", fake_text); + g_hash_table_insert(element->attrs, (gpointer)"text", fake_text); } xmpp_display_attrs(reason_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -286,7 +286,7 @@ xmpp_gtalk_jingleinfo_relay(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, if((token = xmpp_steal_element_by_name(element, "token"))!=NULL) { xmpp_attr_t *fake_token = xmpp_ep_init_attr_t(token->data?token->data->value:"", token->offset, token->length); - g_hash_table_insert(element->attrs, "token", fake_token); + g_hash_table_insert(element->attrs, (gpointer)"token", fake_token); } xmpp_display_attrs(relay_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -484,12 +484,12 @@ xmpp_gtalk_mail_mail_info(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, x if((labels = xmpp_steal_element_by_name(element,"labels"))!=NULL) { xmpp_attr_t *fake_labels = xmpp_ep_init_attr_t(labels->data?labels->data->value:"",labels->offset, labels->length); - g_hash_table_insert(element->attrs, "labels", fake_labels); + g_hash_table_insert(element->attrs, (gpointer)"labels", fake_labels); } if((subject = xmpp_steal_element_by_name(element,"subject"))!=NULL) { xmpp_attr_t *fake_subject = xmpp_ep_init_attr_t(subject->data?subject->data->value:"",subject->offset, subject->length); - g_hash_table_insert(element->attrs, "subject", fake_subject); + g_hash_table_insert(element->attrs, (gpointer)"subject", fake_subject); } xmpp_display_attrs(mail_info_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -584,20 +584,20 @@ xmpp_gtalk_status_query(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmp if((status = xmpp_steal_element_by_name(element,"status"))!=NULL) { xmpp_attr_t *fake_status = xmpp_ep_init_attr_t(status->data?status->data->value:"",status->offset, status->length); - g_hash_table_insert(element->attrs, "status", fake_status); + g_hash_table_insert(element->attrs, (gpointer)"status", fake_status); } if((show = xmpp_steal_element_by_name(element,"show"))!=NULL) { xmpp_attr_t *fake_show = xmpp_ep_init_attr_t(show->data?show->data->value:"",show->offset, show->length); - g_hash_table_insert(element->attrs, "show", fake_show); + g_hash_table_insert(element->attrs, (gpointer)"show", fake_show); } if((invisible = xmpp_steal_element_by_name(element,"invisible"))!=NULL) { xmpp_attr_t *value = xmpp_get_attr(invisible, "value"); xmpp_attr_t *fake_invisible = xmpp_ep_init_attr_t(value?value->value:"",invisible->offset, invisible->length); - g_hash_table_insert(element->attrs, "invisible", fake_invisible); + g_hash_table_insert(element->attrs, (gpointer)"invisible", fake_invisible); } xmpp_display_attrs(query_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); diff --git a/epan/dissectors/packet-xmpp-jingle.c b/epan/dissectors/packet-xmpp-jingle.c index fb2ba59707..78a7e5f700 100644 --- a/epan/dissectors/packet-xmpp-jingle.c +++ b/epan/dissectors/packet-xmpp-jingle.c @@ -202,7 +202,7 @@ xmpp_jingle_reason(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_ele if((condition = xmpp_steal_element_by_names(element, reason_names, array_length(reason_names)))!=NULL) { xmpp_attr_t *fake_cond = xmpp_ep_init_attr_t(condition->name, condition->offset, condition->length); - g_hash_table_insert(element->attrs, "condition", fake_cond); + g_hash_table_insert(element->attrs, (gpointer)"condition", fake_cond); } else if((condition = xmpp_steal_element_by_name(element, "alternative-session"))!=NULL) { @@ -210,26 +210,26 @@ xmpp_jingle_reason(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_ele xmpp_element_t *sid; fake_cond = xmpp_ep_init_attr_t(condition->name, condition->offset, condition->length); - g_hash_table_insert(element->attrs, "condition", fake_cond); + g_hash_table_insert(element->attrs, (gpointer)"condition", fake_cond); if((sid = xmpp_steal_element_by_name(condition, "sid"))!=NULL) { fake_alter_sid = xmpp_ep_init_attr_t(sid->name, sid->offset, sid->length); - g_hash_table_insert(element->attrs, "sid", fake_alter_sid); + g_hash_table_insert(element->attrs, (gpointer)"sid", fake_alter_sid); } } if((rtp_error = xmpp_steal_element_by_names(element, rtp_error_names, array_length(rtp_error_names)))!=NULL) { xmpp_attr_t *fake_rtp_error = xmpp_ep_init_attr_t(rtp_error->name, rtp_error->offset, rtp_error->length); - g_hash_table_insert(element->attrs, "rtp-error", fake_rtp_error); + g_hash_table_insert(element->attrs, (gpointer)"rtp-error", fake_rtp_error); } if((text = xmpp_steal_element_by_name(element, "text"))!=NULL) { xmpp_attr_t *fake_text = xmpp_ep_init_attr_t(text->data?text->data->value:"", text->offset, text->length); - g_hash_table_insert(element->attrs, "text", fake_text); + g_hash_table_insert(element->attrs, (gpointer)"text", fake_text); } xmpp_display_attrs(reason_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -375,7 +375,7 @@ xmpp_jingle_cont_desc_rtp_enc_zrtp_hash(proto_tree* tree, tvbuff_t* tvb, packet_ if(element->data) { xmpp_attr_t *fake_hash = xmpp_ep_init_attr_t(element->data->value, element->offset, element->length); - g_hash_table_insert(element->attrs, "hash", fake_hash); + g_hash_table_insert(element->attrs, (gpointer)"hash", fake_hash); } xmpp_display_attrs(zrtp_hash_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -422,7 +422,7 @@ xmpp_jingle_cont_desc_rtp_bandwidth(proto_tree* tree, tvbuff_t* tvb, packet_info if(element->data) { xmpp_attr_t *fake_value = xmpp_ep_init_attr_t(element->data->value, element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_value); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_value); } xmpp_display_attrs(bandwidth_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -456,7 +456,7 @@ xmpp_jingle_cont_desc_rtp_hdrext(proto_tree* tree, tvbuff_t* tvb, packet_info *p { xmpp_attr_t *name = xmpp_get_attr(element, "name"); xmpp_attr_t *fake_attr = xmpp_ep_init_attr_t(name?name->value:"", parameter->offset, parameter->length); - g_hash_table_insert(element->attrs, "parameter", fake_attr); + g_hash_table_insert(element->attrs, (gpointer)"parameter", fake_attr); } xmpp_display_attrs(rtp_hdr_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); diff --git a/epan/dissectors/packet-xmpp-other.c b/epan/dissectors/packet-xmpp-other.c index c32a55ea13..3874e581b8 100644 --- a/epan/dissectors/packet-xmpp-other.c +++ b/epan/dissectors/packet-xmpp-other.c @@ -137,7 +137,7 @@ xmpp_vcard(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t * { xmpp_attr_t *fake_cdata; fake_cdata = xmpp_ep_init_attr_t(xmpp_element_to_string(tvb, cdata), cdata->offset, cdata->length); - g_hash_table_insert(element->attrs,"value", fake_cdata); + g_hash_table_insert(element->attrs,(gpointer)"value", fake_cdata); } xmpp_display_attrs(vcard_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -163,7 +163,7 @@ xmpp_vcard_x_update(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_el if((photo = xmpp_steal_element_by_name(element, "photo"))!=NULL) { xmpp_attr_t *fake_photo = xmpp_ep_init_attr_t(photo->data?photo->data->value:"", photo->offset, photo->length); - g_hash_table_insert(element->attrs, "photo", fake_photo); + g_hash_table_insert(element->attrs, (gpointer)"photo", fake_photo); } xmpp_display_attrs(x_tree, element,pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -525,7 +525,7 @@ xmpp_si_file(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t if((desc = xmpp_steal_element_by_name(element, "desc"))!=NULL) { xmpp_attr_t *fake_desc = xmpp_ep_init_attr_t(desc->data?desc->data->value:"", desc->offset, desc->length); - g_hash_table_insert(element->attrs, "desc", fake_desc); + g_hash_table_insert(element->attrs, (gpointer)"desc", fake_desc); } if((range = xmpp_steal_element_by_name(element, "range"))!=NULL) @@ -675,7 +675,7 @@ xmpp_x_data_field_option(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xm if((value = xmpp_steal_element_by_name(element, "value"))!=NULL) { xmpp_attr_t *fake_value = xmpp_ep_init_attr_t(value->data?value->data->value:"",value->offset, value->length); - g_hash_table_insert(element->attrs, "value", fake_value); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_value); } xmpp_display_attrs(option_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -701,7 +701,7 @@ xmpp_x_data_field_value(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmp fake_value = xmpp_ep_init_attr_t(element->data?element->data->value:"",element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_value); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_value); xmpp_display_attrs(value_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -782,7 +782,7 @@ xmpp_ibb_data(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_ if(element->data) { xmpp_attr_t *fake_data = xmpp_ep_init_attr_t(element->data->value, element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_data); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_data); } xmpp_display_attrs(data_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -810,7 +810,7 @@ xmpp_delay(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t * if(element->data) { xmpp_attr_t *fake_value = xmpp_ep_init_attr_t(element->data->value, element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_value); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_value); } xmpp_display_attrs(delay_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -868,7 +868,7 @@ xmpp_x_event(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t if((id = xmpp_steal_element_by_name(element, "id"))!=NULL) { xmpp_attr_t *fake_id = xmpp_ep_init_attr_t(id->data?id->data->value:"", id->offset, id->length); - g_hash_table_insert(element->attrs, "id", fake_id); + g_hash_table_insert(element->attrs, (gpointer)"id", fake_id); } while((cond = xmpp_steal_element_by_names(element, cond_names, array_length(cond_names))) != NULL) @@ -880,7 +880,7 @@ xmpp_x_event(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t } fake_cond = xmpp_ep_init_attr_t(cond_value, element->offset, element->length); - g_hash_table_insert(element->attrs, "condition", fake_cond); + g_hash_table_insert(element->attrs, (gpointer)"condition", fake_cond); xmpp_display_attrs(x_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -908,7 +908,7 @@ xmpp_muc_x(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t * if((pass = xmpp_steal_element_by_name(element, "password"))!=NULL) { xmpp_attr_t *fake_pass = xmpp_ep_init_attr_t(pass->data?pass->data->value:"",pass->offset, pass->length); - g_hash_table_insert(element->attrs, "password", fake_pass); + g_hash_table_insert(element->attrs, (gpointer)"password", fake_pass); } xmpp_display_attrs(x_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -963,7 +963,7 @@ xmpp_muc_user_x(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_elemen if((password = xmpp_steal_element_by_name(element, "password"))!=NULL) { xmpp_attr_t *fake_pass = xmpp_ep_init_attr_t(password->data?password->data->value:"",password->offset, password->length); - g_hash_table_insert(element->attrs, "password", fake_pass); + g_hash_table_insert(element->attrs, (gpointer)"password", fake_pass); } xmpp_display_attrs(x_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -1016,14 +1016,14 @@ xmpp_muc_user_item(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_ele if((reason = xmpp_steal_element_by_name(element, "reason"))!=NULL) { xmpp_attr_t *fake_reason = xmpp_ep_init_attr_t(reason->data?reason->data->value:"",reason->offset, reason->length); - g_hash_table_insert(element->attrs,"reason",fake_reason); + g_hash_table_insert(element->attrs,(gpointer)"reason",fake_reason); } if((actor = xmpp_steal_element_by_name(element, "actor"))!=NULL) { xmpp_attr_t *jid = xmpp_get_attr(actor, "jid"); xmpp_attr_t *fake_actor_jid = xmpp_ep_init_attr_t(jid?jid->value:"",actor->offset, actor->length); - g_hash_table_insert(element->attrs, "actor_jid", fake_actor_jid); + g_hash_table_insert(element->attrs, (gpointer)"actor_jid", fake_actor_jid); } xmpp_display_attrs(item_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -1060,7 +1060,7 @@ xmpp_muc_user_invite(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_e if((reason = xmpp_steal_element_by_name(element, "reason"))!=NULL) { xmpp_attr_t *fake_reason = xmpp_ep_init_attr_t(reason->data?reason->data->value:"",reason->offset, reason->length); - g_hash_table_insert(element->attrs, "reason", fake_reason); + g_hash_table_insert(element->attrs, (gpointer)"reason", fake_reason); } xmpp_display_attrs(invite_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -1148,7 +1148,7 @@ xmpp_last_query(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_elemen if(element->data) { xmpp_attr_t *fake_data = xmpp_ep_init_attr_t(element->data->value, element->data->offset, element->data->length); - g_hash_table_insert(element->attrs, "value", fake_data); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_data); } xmpp_display_attrs(query_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -1179,19 +1179,19 @@ xmpp_version_query(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_ele if((name = xmpp_steal_element_by_name(element,"name"))!=NULL) { xmpp_attr_t *fake_name = xmpp_ep_init_attr_t(name->data?name->data->value:"", name->offset, name->length); - g_hash_table_insert(element->attrs, "name", fake_name); + g_hash_table_insert(element->attrs, (gpointer)"name", fake_name); } if((version = xmpp_steal_element_by_name(element,"version"))!=NULL) { xmpp_attr_t *fake_version = xmpp_ep_init_attr_t(version->data?version->data->value:"", version->offset, version->length); - g_hash_table_insert(element->attrs, "version", fake_version); + g_hash_table_insert(element->attrs, (gpointer)"version", fake_version); } if((os = xmpp_steal_element_by_name(element,"os"))!=NULL) { xmpp_attr_t *fake_os = xmpp_ep_init_attr_t(os->data?os->data->value:"", os->offset, os->length); - g_hash_table_insert(element->attrs, "os", fake_os); + g_hash_table_insert(element->attrs, (gpointer)"os", fake_os); } xmpp_display_attrs(query_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); @@ -1249,7 +1249,7 @@ xmpp_hashes_hash(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_eleme }; xmpp_attr_t *fake_cdata = xmpp_ep_init_attr_t(xmpp_elem_cdata(element), element->offset, element->length); - g_hash_table_insert(element->attrs, "value", fake_cdata); + g_hash_table_insert(element->attrs, (gpointer)"value", fake_cdata); hash_item = proto_tree_add_text(tree, tvb, element->offset, element->length, "HASH"); hash_tree = proto_item_add_subtree(hash_item, ett_xmpp_hashes_hash); @@ -1302,7 +1302,7 @@ xmpp_jitsi_inputevt_rmt_ctrl(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo if((action = xmpp_steal_element_by_names(element, action_names, array_length(action_names)))!=NULL) { xmpp_attr_t *fake_action = xmpp_ep_init_attr_t(action->name, action->offset, action->length); - g_hash_table_insert(element->attrs,"action", fake_action); + g_hash_table_insert(element->attrs,(gpointer)"action", fake_action); if(strcmp(action->name,"mouse-move") == 0) { @@ -1310,21 +1310,21 @@ xmpp_jitsi_inputevt_rmt_ctrl(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo xmpp_attr_t *y = xmpp_get_attr(action,"y"); if(x) - g_hash_table_insert(element->attrs,"x",x); + g_hash_table_insert(element->attrs,(gpointer)"x",x); if(y) - g_hash_table_insert(element->attrs,"y",y); + g_hash_table_insert(element->attrs,(gpointer)"y",y); } else if(strcmp(action->name,"mouse-press") == 0 || strcmp(action->name,"mouse-release") == 0) { xmpp_attr_t *btns = xmpp_get_attr(action,"btns"); if(btns) - g_hash_table_insert(element->attrs,"btns",btns); + g_hash_table_insert(element->attrs,(gpointer)"btns",btns); } else if(strcmp(action->name,"key-press") == 0 || strcmp(action->name,"key-release") == 0) { xmpp_attr_t *keycode = xmpp_get_attr(action,"keycode"); if(keycode) - g_hash_table_insert(element->attrs,"keycode",keycode); + g_hash_table_insert(element->attrs,(gpointer)"keycode",keycode); } } diff --git a/epan/dissectors/packet-xmpp-utils.c b/epan/dissectors/packet-xmpp-utils.c index 48584684b4..eae09919fd 100644 --- a/epan/dissectors/packet-xmpp-utils.c +++ b/epan/dissectors/packet-xmpp-utils.c @@ -366,7 +366,7 @@ xmpp_ep_init_array_t(const gchar** array, gint len) } xmpp_attr_t* -xmpp_ep_init_attr_t(gchar *value, gint offset, gint length) +xmpp_ep_init_attr_t(const gchar *value, gint offset, gint length) { xmpp_attr_t *result; result = ep_alloc(sizeof(xmpp_attr_t)); @@ -552,7 +552,7 @@ xmpp_xml_frame_to_element_t(xml_frame_t *xml_frame, xmpp_element_t *parent, tvbu xmpp_copy_hash_table(parent->namespaces, node->namespaces); } else { - g_hash_table_insert(node->namespaces, "", "jabber:client"); + g_hash_table_insert(node->namespaces, (gpointer)"", (gpointer)"jabber:client"); } if(xml_frame->item != NULL) @@ -613,7 +613,7 @@ xmpp_xml_frame_to_element_t(xml_frame_t *xml_frame, xmpp_element_t *parent, tvbu g_hash_table_insert(node->namespaces, (gpointer)ep_strdup(&attr->name[6]), (gpointer)ep_strdup(attr->value)); } else if(attr->name[5] == '\0') { - g_hash_table_insert(node->namespaces, "", (gpointer)ep_strdup(attr->value)); + g_hash_table_insert(node->namespaces, (gpointer)"", (gpointer)ep_strdup(attr->value)); } } @@ -946,16 +946,16 @@ xmpp_display_attrs_ext(proto_tree *tree, xmpp_element_t *element, packet_info *p struct name_attr_t { - gchar *name; - gchar *attr_name; - gchar *attr_value; + const gchar *name; + const gchar *attr_name; + const gchar *attr_value; }; /* returns pointer to the struct that contains 3 strings(element name, attribute name, attribute value) */ gpointer -xmpp_name_attr_struct(gchar *name, gchar *attr_name, gchar *attr_value) +xmpp_name_attr_struct(const gchar *name, const gchar *attr_name, const gchar *attr_value) { struct name_attr_t *result; @@ -979,7 +979,7 @@ xmpp_display_elems(proto_tree *tree, xmpp_element_t *parent, packet_info *pinfo, { gboolean loop = TRUE; - struct + const struct { gchar *name; gchar *attr_name; @@ -997,7 +997,7 @@ xmpp_display_elems(proto_tree *tree, xmpp_element_t *parent, packet_info *pinfo, } else if(elems[i].type == NAME) { gboolean loop = TRUE; - gchar *name = elems[i].data; + const gchar *name = elems[i].data; while(loop && (elem = xmpp_steal_element_by_name(parent, name))!=NULL) { @@ -1009,7 +1009,7 @@ xmpp_display_elems(proto_tree *tree, xmpp_element_t *parent, packet_info *pinfo, else if(elems[i].type == ATTR) { gboolean loop = TRUE; - struct { + const struct { gchar *name; gchar *attr_name; gchar *attr_value; @@ -1025,7 +1025,7 @@ xmpp_display_elems(proto_tree *tree, xmpp_element_t *parent, packet_info *pinfo, } else if(elems[i].type == NAMES) { gboolean loop = TRUE; - xmpp_array_t *names = elems[i].data; + const xmpp_array_t *names = elems[i].data; while(loop && (elem = xmpp_steal_element_by_names(parent, (const gchar**)names->data, names->length))!=NULL) { @@ -1043,9 +1043,9 @@ xmpp_display_elems(proto_tree *tree, xmpp_element_t *parent, packet_info *pinfo, function checks that variable value is in array ((xmpp_array_t)data)->data */ void -xmpp_val_enum_list(packet_info *pinfo, proto_item *item, gchar *name, gchar *value, gpointer data) +xmpp_val_enum_list(packet_info *pinfo, proto_item *item, const gchar *name, const gchar *value, gconstpointer data) { - xmpp_array_t *enums_array = data; + const xmpp_array_t *enums_array = data; gint i; gboolean value_in_enums = FALSE; diff --git a/epan/dissectors/packet-xmpp-utils.h b/epan/dissectors/packet-xmpp-utils.h index 99e8079692..2addfe4509 100644 --- a/epan/dissectors/packet-xmpp-utils.h +++ b/epan/dissectors/packet-xmpp-utils.h @@ -36,8 +36,8 @@ typedef struct _xmpp_array_t } xmpp_array_t; typedef struct _xmpp_attr_t{ - gchar *value; - gchar *name; + const gchar *value; + const gchar *name; gint offset; gint length; @@ -72,19 +72,19 @@ typedef struct _xmpp_element_t{ /*informations about attributes that are displayed in proto tree*/ typedef struct _xmpp_attr_info{ - gchar *name; + const gchar *name; gint hf; gboolean is_required; gboolean in_short_list; /*function validates this attribute it may impose other restrictions (e.g. validating atribut's name, ...)*/ - void (*val_func)(packet_info *pinfo, proto_item *item, gchar *name, gchar *value, gpointer data); + void (*val_func)(packet_info *pinfo, proto_item *item, const gchar *name, const gchar *value, gconstpointer data); gpointer data; } xmpp_attr_info; typedef struct _xmpp_attr_info_ext{ - gchar* ns; + const gchar* ns; xmpp_attr_info info; } xmpp_attr_info_ext; @@ -103,7 +103,7 @@ typedef enum _xmpp_elem_info_occurrence /*informations about elements that are displayed in proto tree*/ typedef struct _xmpp_elem_info{ xmpp_elem_info_type type; - gpointer data; + gconstpointer data; /*function that displays element in tree*/ void (*elem_func)(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element); xmpp_elem_info_occurrence occurrence; @@ -181,7 +181,7 @@ extern void xmpp_element_t_tree_free(xmpp_element_t *root); extern xmpp_array_t* xmpp_ep_init_array_t(const gchar** array, gint len); /*Allocs ephemeral memory for xmpp_attr_t struct*/ -extern xmpp_attr_t* xmpp_ep_init_attr_t(gchar *value, gint offset, gint length); +extern xmpp_attr_t* xmpp_ep_init_attr_t(const gchar *value, gint offset, gint length); /*Allocs ephemeral memory for upcased string*/ extern gchar* xmpp_ep_string_upcase(const gchar* string); @@ -224,7 +224,7 @@ extern void xmpp_proto_tree_show_first_child(proto_tree *tree); extern gchar* proto_item_get_text(proto_item *item); /*Function returns struct that contains 3 strings. It is used to build xmpp_attr_info struct.*/ -extern gpointer xmpp_name_attr_struct(gchar *name, gchar *attr_name, gchar *attr_value); +extern gpointer xmpp_name_attr_struct(const gchar *name, const gchar *attr_name, const gchar *attr_value); /** Function displays attributes from element in way described in attrs. * Elements that doesn't exist in attrs are displayed as text. @@ -258,7 +258,7 @@ extern void xmpp_display_elems(proto_tree *tree, xmpp_element_t *parent, packet_ /* Validates attribute value. Takes string array(gchar**) in parameter data. * Is used in XMPP_ATTR_INFO struct. */ -extern void xmpp_val_enum_list(packet_info *pinfo, proto_item *item, gchar *name, gchar *value, gpointer data); +extern void xmpp_val_enum_list(packet_info *pinfo, proto_item *item, const gchar *name, const gchar *value, gconstpointer data); /** Function changes element to attribute. It searches element by name in parent element, * next it create attribute using transform_func and inserts it to parent attributes hash table diff --git a/epan/dissectors/packet-ypserv.c b/epan/dissectors/packet-ypserv.c index ef80ca3637..e7be63d432 100644 --- a/epan/dissectors/packet-ypserv.c +++ b/epan/dissectors/packet-ypserv.c @@ -187,7 +187,7 @@ dissect_domain_nonack_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, p static int dissect_match_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - char *str; + const char *str; proto_item_append_text(tree, " MATCH call"); @@ -219,7 +219,7 @@ static int dissect_match_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree) { gint32 status; - char *str; + const char *str; proto_item_append_text(tree, " MATCH reply"); @@ -392,7 +392,7 @@ dissect_xfr_reply(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree static int dissect_order_call(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree) { - char *str; + const char *str; proto_item_append_text(tree, " ORDER call"); diff --git a/epan/dissectors/packet-zbee-aps.c b/epan/dissectors/packet-zbee-aps.c index 2bb0c1549a..7f67873a72 100644 --- a/epan/dissectors/packet-zbee-aps.c +++ b/epan/dissectors/packet-zbee-aps.c @@ -1715,12 +1715,12 @@ zbee_apf_transaction_len(tvbuff_t *tvb, guint offset, guint8 type) switch (kvp_type) { case ZBEE_APP_KVP_ABS_TIME: case ZBEE_APP_KVP_REL_TIME: - kvp_len += sizeof(guint32); + kvp_len += 4; break; case ZBEE_APP_KVP_UINT16: case ZBEE_APP_KVP_INT16: case ZBEE_APP_KVP_FLOAT16: - kvp_len +=2; + kvp_len += 2; break; case ZBEE_APP_KVP_UINT8: case ZBEE_APP_KVP_INT8: diff --git a/epan/dissectors/packet-zbee-zcl.c b/epan/dissectors/packet-zbee-zcl.c index 2866e430e2..9917603da7 100644 --- a/epan/dissectors/packet-zbee-zcl.c +++ b/epan/dissectors/packet-zbee-zcl.c @@ -742,31 +742,31 @@ static void dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree proto_tree_add_boolean(sub_tree, hf_zbee_zcl_fcf_disable_default_resp, tvb, offset, sizeof(guint8), fcf & ZBEE_ZCL_FCF_DISABLE_DEFAULT_RESP); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* If the manufacturer code is present, get and display it. */ if (packet.mfr_spec) { packet.mfr_code = tvb_get_letohs(tvb, offset); if ( tree ) { - proto_tree_add_uint(zcl_tree, hf_zbee_zcl_mfr_code, tvb, offset, sizeof(guint16), + proto_tree_add_uint(zcl_tree, hf_zbee_zcl_mfr_code, tvb, offset, (int)sizeof(guint16), packet.mfr_code); proto_item_append_text(proto_root, ", Mfr: %s (0x%04x)", val_to_str_ext_const(packet.mfr_code, &zbee_mfr_code_names_ext, "Unknown"), packet.mfr_code); } - offset += sizeof(guint16); + offset += (int)sizeof(guint16); } /* Add the transaction sequence number to the tree */ packet.tran_seqno = tvb_get_guint8(tvb, offset); if ( zcl_tree ) { - proto_tree_add_uint(zcl_tree, hf_zbee_zcl_tran_seqno, tvb, offset, sizeof(guint8), + proto_tree_add_uint(zcl_tree, hf_zbee_zcl_tran_seqno, tvb, offset, (int)sizeof(guint8), packet.tran_seqno); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Display the command and sequence number on the proto root and info column. */ packet.cmd_id = tvb_get_guint8(tvb, offset); @@ -786,10 +786,10 @@ static void dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree } if ( zcl_tree ) { - proto_tree_add_uint(zcl_tree, hf_zbee_zcl_cmd_id, tvb, offset, sizeof(guint8), + proto_tree_add_uint(zcl_tree, hf_zbee_zcl_cmd_id, tvb, offset, (int)sizeof(guint8), packet.cmd_id); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } else { if ( tree ) { proto_item_append_text(proto_root, ", Cluster-specific Command: 0x%02x, Seq: %u", @@ -802,10 +802,10 @@ static void dissect_zbee_zcl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree } if ( zcl_tree ) { - proto_tree_add_uint(zcl_tree, hf_zbee_zcl_cs_cmd_id, tvb, offset, sizeof(guint8), + proto_tree_add_uint(zcl_tree, hf_zbee_zcl_cs_cmd_id, tvb, offset, (int)sizeof(guint8), packet.cmd_id); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); /* Don't decode cluster-specific commands */ zcl_dump_data(tvb, offset, pinfo, zcl_tree); @@ -1268,8 +1268,8 @@ static void dissect_zcl_default_resp(tvbuff_t *tvb, packet_info *pinfo _U_, prot /* Dissect the command identifier */ cmd_id = tvb_get_guint8(tvb, *offset); - proto_tree_add_uint(tree, hf_zbee_zcl_cmd_id, tvb, *offset, sizeof(guint8), cmd_id); - *offset += sizeof(guint8); + proto_tree_add_uint(tree, hf_zbee_zcl_cmd_id, tvb, *offset, (int)sizeof(guint8), cmd_id); + *offset += (int)sizeof(guint8); /* Dissect the status */ dissect_zcl_attr_uint8(tvb, tree, offset, &hf_zbee_zcl_attr_status); @@ -1368,10 +1368,10 @@ static guint dissect_zcl_attr_data_type(tvbuff_t *tvb, proto_tree *tree, guint * attr_data_type = tvb_get_guint8(tvb, *offset); if ( tree ) { - proto_tree_add_uint(tree, hf_zbee_zcl_attr_data_type, tvb, *offset, sizeof(guint8), + proto_tree_add_uint(tree, hf_zbee_zcl_attr_data_type, tvb, *offset, (int)sizeof(guint8), attr_data_type); } - *offset += sizeof(guint8); + *offset += (int)sizeof(guint8); return attr_data_type; } /* dissect_zcl_attr_data_type */ @@ -1399,9 +1399,9 @@ static void dissect_zcl_attr_id(tvbuff_t *tvb, proto_tree *tree, guint *offset) attr_id = tvb_get_letohs(tvb, *offset); /* Add the identifier */ - proto_tree_add_uint(tree, hf_zbee_zcl_attr_id, tvb, *offset, sizeof(guint16), + proto_tree_add_uint(tree, hf_zbee_zcl_attr_id, tvb, *offset, (int)sizeof(guint16), attr_id); - *offset += sizeof(guint16); + *offset += (int)sizeof(guint16); return; } /* dissect_zcl_attr_id */ @@ -1471,9 +1471,9 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset proto_item_append_text(tree, ", %s: %u", val_to_str_ext_const(data_type, &zbee_zcl_short_data_type_names_ext, "Reserved"), attr_uint); - proto_tree_add_uint(tree, hf_zbee_zcl_attr_uint8, tvb, *offset, sizeof(guint8), + proto_tree_add_uint(tree, hf_zbee_zcl_attr_uint8, tvb, *offset, (int)sizeof(guint8), attr_uint); - *offset += sizeof(guint8); + *offset += (int)sizeof(guint8); break; case ZBEE_ZCL_8_BIT_INT: @@ -1484,10 +1484,10 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset proto_item_append_text(tree, ", %s: %-d", val_to_str_ext_const(data_type, &zbee_zcl_short_data_type_names_ext, "Reserved"), attr_int); - proto_tree_add_int(tree, hf_zbee_zcl_attr_int8, tvb, *offset, sizeof(gint8), + proto_tree_add_int(tree, hf_zbee_zcl_attr_int8, tvb, *offset, (int)sizeof(gint8), (gint)attr_int); - *offset += sizeof(gint8); + *offset += (int)sizeof(gint8); break; case ZBEE_ZCL_BOOLEAN: @@ -1499,7 +1499,7 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset proto_tree_add_item(tree, hf_zbee_zcl_attr_boolean, tvb, *offset, 1, ENC_BIG_ENDIAN); - *offset += sizeof(guint8); + *offset += (int)sizeof(guint8); break; case ZBEE_ZCL_16_BIT_DATA: @@ -1516,10 +1516,10 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset proto_item_append_text(tree, ", %s: %u", val_to_str_ext_const(data_type, &zbee_zcl_short_data_type_names_ext, "Reserved"), attr_uint); - proto_tree_add_uint(tree, hf_zbee_zcl_attr_uint16, tvb, *offset, sizeof(guint16), + proto_tree_add_uint(tree, hf_zbee_zcl_attr_uint16, tvb, *offset, (int)sizeof(guint16), attr_uint); - *offset += sizeof(guint16); + *offset += (int)sizeof(guint16); break; case ZBEE_ZCL_16_BIT_INT: @@ -1530,10 +1530,10 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset proto_item_append_text(tree, ", %s: %-d", val_to_str_ext_const(data_type, &zbee_zcl_short_data_type_names_ext, "Reserved"), attr_int); - proto_tree_add_int(tree, hf_zbee_zcl_attr_int16, tvb, *offset, sizeof(gint16), + proto_tree_add_int(tree, hf_zbee_zcl_attr_int16, tvb, *offset, (int)sizeof(gint16), attr_int); - *offset += sizeof(gint16); + *offset += (int)sizeof(gint16); break; case ZBEE_ZCL_24_BIT_DATA: @@ -1584,10 +1584,10 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset proto_item_append_text(tree, ", %s: %u", val_to_str_ext_const(data_type, &zbee_zcl_short_data_type_names_ext, "Reserved"), attr_uint); - proto_tree_add_uint(tree, hf_zbee_zcl_attr_uint32, tvb, *offset, sizeof(guint), + proto_tree_add_uint(tree, hf_zbee_zcl_attr_uint32, tvb, *offset, (int)sizeof(guint), attr_uint); - *offset += sizeof(guint); + *offset += (int)sizeof(guint); break; case ZBEE_ZCL_32_BIT_INT: @@ -1598,10 +1598,10 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset proto_item_append_text(tree, ", %s: %-d", val_to_str_ext_const(data_type, &zbee_zcl_short_data_type_names_ext, "Reserved"), attr_int); - proto_tree_add_int(tree, hf_zbee_zcl_attr_int32, tvb, *offset, sizeof(gint), + proto_tree_add_int(tree, hf_zbee_zcl_attr_int32, tvb, *offset, (int)sizeof(gint), attr_int); - *offset += sizeof(gint); + *offset += (int)sizeof(gint); break; case ZBEE_ZCL_40_BIT_DATA: @@ -1688,10 +1688,10 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset attr_uint = tvb_get_guint8(tvb, *offset); /* string length */ if (attr_uint == ZBEE_ZCL_INVALID_STR_LENGTH) attr_uint = 0; - proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, sizeof(guint8), + proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, (int)sizeof(guint8), attr_uint); - *offset += sizeof(guint8); + *offset += (int)sizeof(guint8); attr_string = tvb_bytes_to_str_punct(tvb, *offset, attr_uint, ':'); proto_item_append_text(tree, ", Octets: %s", attr_string); @@ -1707,10 +1707,10 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset attr_uint = tvb_get_guint8(tvb, *offset); /* string length */ if (attr_uint == ZBEE_ZCL_INVALID_STR_LENGTH) attr_uint = 0; - proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, sizeof(guint8), + proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, (int)sizeof(guint8), attr_uint); - *offset += sizeof(guint8); + *offset += (int)sizeof(guint8); attr_string = tvb_get_ephemeral_string(tvb, *offset, attr_uint); @@ -1725,9 +1725,9 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset /* Display long octet string */ attr_uint = tvb_get_letohs(tvb, *offset); /* string length */ if (attr_uint == ZBEE_ZCL_INVALID_LONG_STR_LENGTH) attr_uint = 0; - proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, sizeof(guint16), attr_uint); + proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, (int)sizeof(guint16), attr_uint); - *offset += sizeof(guint16); + *offset += (int)sizeof(guint16); attr_string = tvb_bytes_to_str_punct(tvb, *offset, attr_uint, ':'); proto_item_append_text(tree, ", Octets: %s", attr_string); @@ -1742,9 +1742,9 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset attr_uint = tvb_get_letohs(tvb, *offset); /* string length */ if (attr_uint == ZBEE_ZCL_INVALID_LONG_STR_LENGTH) attr_uint = 0; - proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, sizeof(guint16), attr_uint); + proto_tree_add_uint(tree, hf_zbee_zcl_attr_str_len, tvb, *offset, (int)sizeof(guint16), attr_uint); - *offset += sizeof(guint16); + *offset += (int)sizeof(guint16); attr_string = tvb_get_ephemeral_string(tvb, *offset, attr_uint); proto_item_append_text(tree, ", String: %s", attr_string); @@ -1784,10 +1784,10 @@ static void dissect_zcl_attr_data(tvbuff_t *tvb, proto_tree *tree, guint *offset proto_item_append_text(tree, ", %s", val_to_str_ext_const(data_type, &zbee_zcl_short_data_type_names_ext, "Reserved") ); - proto_tree_add_time(tree, hf_zbee_zcl_attr_utc, tvb, *offset, sizeof(guint), + proto_tree_add_time(tree, hf_zbee_zcl_attr_utc, tvb, *offset, (int)sizeof(guint), &attr_time); - *offset += sizeof(guint32); + *offset += (int)sizeof(guint32); break; case ZBEE_ZCL_CLUSTER_ID: @@ -1877,7 +1877,7 @@ static guint dissect_zcl_attr_uint8(tvbuff_t *tvb, proto_tree *tree, guint *offs guint attr_uint; attr_uint = tvb_get_guint8(tvb, *offset); - proto_tree_add_uint(tree, *hf_zbee_zcl, tvb, *offset, sizeof(guint8), attr_uint); + proto_tree_add_uint(tree, *hf_zbee_zcl, tvb, *offset, (int)sizeof(guint8), attr_uint); (*offset)++; return attr_uint; @@ -1902,8 +1902,8 @@ static guint dissect_zcl_attr_uint16(tvbuff_t *tvb, proto_tree *tree, guint *off guint attr_uint; attr_uint = tvb_get_letohs(tvb, *offset); - proto_tree_add_uint(tree, *hf_zbee_zcl, tvb, *offset, sizeof(guint16), attr_uint); - *offset += sizeof(guint16); + proto_tree_add_uint(tree, *hf_zbee_zcl, tvb, *offset, (int)sizeof(guint16), attr_uint); + *offset += (int)sizeof(guint16); return attr_uint; } /* dissect_zcl_attr_uint16 */ @@ -1982,13 +1982,13 @@ static guint64 tvb_get_letohi(tvbuff_t *tvb, guint offset, guint length, gboolea /* build big int of length bytes */ while ( length-- ) { result += (guint64)tvb_get_guint8(tvb, offset) << shift; - offset += sizeof(guint8); + offset += (int)sizeof(guint8); shift += 8; } if ( signed_flag && (result >> (shift - 1)) ) { /* sign extend remaining bytes */ - while ( shift < (sizeof(guint64) * 8) ) { + while ( shift < ((int)sizeof(guint64) * 8) ) { result += (guint64)0xff << shift; shift += 8; } diff --git a/epan/dissectors/packet-zbee-zdp-binding.c b/epan/dissectors/packet-zbee-zdp-binding.c index 1802ec1565..5ae79ef356 100644 --- a/epan/dissectors/packet-zbee-zdp-binding.c +++ b/epan/dissectors/packet-zbee-zdp-binding.c @@ -70,28 +70,28 @@ zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, packe /* Add the source address. */ src64 = tvb_get_letoh64(tvb, *offset + len); if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "Bind {Src: %s", get_eui64_name(src64)); - len += sizeof(guint64); + len += (int)sizeof(guint64); /* Add the source endpoint. */ src_ep = tvb_get_guint8(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Src Endpoint: %d", src_ep); - len += sizeof(guint8); + len += (int)sizeof(guint8); /* Add the cluster ID. */ if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { cluster = tvb_get_letohs(tvb, *offset + len); - len += sizeof(guint16); + len += (int)sizeof(guint16); } else { cluster = tvb_get_guint8(tvb, *offset + len); - len += sizeof(guint8); + len += (int)sizeof(guint8); } if (tree) proto_item_append_text(ti, ", Cluster: %d", cluster); /* Get the destination address mode. */ if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { mode = tvb_get_guint8(tvb, *offset + len); - len += sizeof(guint8); + len += (int)sizeof(guint8); } else { /* Mode field doesn't exist and always uses unicast in 2003 & earlier. */ @@ -102,16 +102,16 @@ zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, packe if (mode == ZBEE_ZDP_ADDR_MODE_GROUP) { dst = tvb_get_letohs(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Dst: 0x%04x}", dst); - len += sizeof(guint16); + len += (int)sizeof(guint16); } else if (mode == ZBEE_ZDP_ADDR_MODE_UNICAST) { dst64 = tvb_get_letoh64(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Dst: %s", get_eui64_name(dst64)); - len += sizeof(guint64); + len += (int)sizeof(guint64); dst_ep = tvb_get_guint8(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Dst Endpoint: %d}", dst_ep); - len += sizeof(guint8); + len += (int)sizeof(guint8); } else { if (tree) proto_item_append_text(ti, "}"); @@ -144,7 +144,7 @@ zdp_parse_bind_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, packe void dissect_zbee_zdp_req_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - guint sizeof_cluster = (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?sizeof(guint16):sizeof(guint8); + guint sizeof_cluster = (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8); guint i; proto_item *ti; proto_tree *field_tree = NULL; @@ -157,24 +157,24 @@ dissect_zbee_zdp_req_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tr guint8 in_count; guint8 out_count; - target = zbee_parse_uint(tree, hf_zbee_zdp_target, tvb, &offset, sizeof(guint16), NULL); + target = zbee_parse_uint(tree, hf_zbee_zdp_target, tvb, &offset, (guint)sizeof(guint16), NULL); if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { /* Extended address present on ZigBee 2006 & later. */ - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (guint)sizeof(guint64), NULL); } - /*src_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, sizeof(guint8), NULL); - /*profile =*/ zbee_parse_uint(tree, hf_zbee_zdp_profile, tvb, &offset, sizeof(guint16), NULL); + /*src_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, (guint)sizeof(guint8), NULL); + /*profile =*/ zbee_parse_uint(tree, hf_zbee_zdp_profile, tvb, &offset, (guint)sizeof(guint16), NULL); - in_count = zbee_parse_uint(tree, hf_zbee_zdp_in_count, tvb, &offset, sizeof(guint8), NULL); + in_count = zbee_parse_uint(tree, hf_zbee_zdp_in_count, tvb, &offset, (guint)sizeof(guint8), NULL); if ((tree) && (in_count)){ - ti = proto_tree_add_text(tree, tvb, offset, in_count*sizeof_cluster, "Input Cluster List"); + ti = proto_tree_add_text(tree, tvb, offset, (int)(in_count*sizeof_cluster), "Input Cluster List"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind_end_in); } - for (i=0; izbee_stack_vers)?sizeof(guint16):sizeof(guint8), NULL); + src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL); + /*src_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, (int)sizeof(guint8), NULL); + /*cluster =*/ zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, ZBEE_HAS_2006(pinfo->zbee_stack_vers)?(int)sizeof(guint16):(int)sizeof(guint8), NULL); if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { - dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, sizeof(guint8), &ti); + dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, (int)sizeof(guint8), &ti); if (tree) { if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) proto_item_append_text(ti, " (Group)"); else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) proto_item_append_text(ti, " (Unicast)"); @@ -233,11 +233,11 @@ dissect_zbee_zdp_req_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) { - dst = zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, sizeof(guint16), NULL); + dst = zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, (int)sizeof(guint16), NULL); } else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) { - dst64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, sizeof(guint64), NULL); - /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, sizeof(guint8), NULL); + dst64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(guint64), NULL); + /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, (int)sizeof(guint8), NULL); } if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { @@ -282,11 +282,11 @@ dissect_zbee_zdp_req_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint64 dst64 = 0; /*guint8 dst_ep;*/ - src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, sizeof(guint64), NULL); - /*src_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, sizeof(guint8), NULL); - /*cluster =*/ zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?sizeof(guint16):sizeof(guint8), NULL); + src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL); + /*src_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, (int)sizeof(guint8), NULL); + /*cluster =*/ zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8), NULL); if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { - dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, sizeof(guint8), &ti); + dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, (int)sizeof(guint8), &ti); if (tree) { if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) proto_item_append_text(ti, " (Group)"); else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) proto_item_append_text(ti, " (Unicast)"); @@ -299,11 +299,11 @@ dissect_zbee_zdp_req_unbind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) { - dst = zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, sizeof(guint16), NULL); + dst = zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, (int)sizeof(guint16), NULL); } else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) { - dst64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, sizeof(guint64), NULL); - /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, sizeof(guint8), NULL); + dst64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(guint64), NULL); + /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, (int)sizeof(guint8), NULL); } if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { @@ -340,7 +340,7 @@ dissect_zbee_zdp_req_bind_register(tvbuff_t *tvb, packet_info *pinfo, proto_tree guint offset = 0; guint64 ext_addr; - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); @@ -371,10 +371,10 @@ dissect_zbee_zdp_req_replace_device(tvbuff_t *tvb, packet_info *pinfo, proto_tre guint64 new_addr; /*guint8 new_ep;*/ - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); - /*endpoint =*/ zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, sizeof(guint8), NULL); - new_addr = zbee_parse_eui64(tree, hf_zbee_zdp_replacement, tvb, &offset, sizeof(guint64), NULL); - /*new_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_replacement_ep, tvb, &offset, sizeof(guint8), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); + /*endpoint =*/ zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, (int)sizeof(guint8), NULL); + new_addr = zbee_parse_eui64(tree, hf_zbee_zdp_replacement, tvb, &offset, (int)sizeof(guint64), NULL); + /*new_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_replacement_ep, tvb, &offset, (int)sizeof(guint8), NULL); zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); zbee_append_info(tree, pinfo, ", Replacement: %s", get_eui64_name(new_addr)); @@ -408,22 +408,22 @@ dissect_zbee_zdp_req_store_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, pro guint16 cluster; guint8 dst_mode; - src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, sizeof(guint64), NULL); - src_ep = zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, sizeof(guint8), NULL); - cluster = zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?sizeof(guint16):sizeof(guint8), NULL); - dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, sizeof(guint8), &ti); + src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL); + src_ep = zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, (int)sizeof(guint8), NULL); + cluster = zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8), NULL); + dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, (int)sizeof(guint8), &ti); if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) { /*guint16 dst;*/ if (tree) proto_item_append_text(ti, " (Group)"); - /*dst =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, sizeof(guint16), NULL); + /*dst =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, (int)sizeof(guint16), NULL); } else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) { /*guint64 dst64;*/ /*guint8 dst_ep;*/ if (tree) proto_item_append_text(ti, " (Unicast)"); - /*dst64 =*/ zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, sizeof(guint64), NULL); - /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, sizeof(guint8), NULL); + /*dst64 =*/ zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(guint64), NULL); + /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, (int)sizeof(guint8), NULL); } else if (tree) proto_item_append_text(ti, " (Reserved)"); @@ -460,22 +460,22 @@ dissect_zbee_zdp_req_remove_bak_bind_entry(tvbuff_t *tvb, packet_info *pinfo, pr guint16 cluster; guint8 dst_mode; - src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, sizeof(guint64), NULL); - src_ep = zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, sizeof(guint8), NULL); - cluster = zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?sizeof(guint16):sizeof(guint8), NULL); - dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, sizeof(guint8), &ti); + src64 = zbee_parse_eui64(tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL); + src_ep = zbee_parse_uint(tree, hf_zbee_zdp_bind_src_ep, tvb, &offset, (int)sizeof(guint8), NULL); + cluster = zbee_parse_uint(tree, hf_zbee_zdp_cluster, tvb, &offset, (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8), NULL); + dst_mode = zbee_parse_uint(tree, hf_zbee_zdp_addr_mode, tvb, &offset, (int)sizeof(guint8), &ti); if (dst_mode == ZBEE_ZDP_ADDR_MODE_GROUP) { /*guint16 dst;*/ if (tree) proto_item_append_text(ti, " (Group)"); - /*dst =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, sizeof(guint16), NULL); + /*dst =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst, tvb, &offset, (int)sizeof(guint16), NULL); } else if (dst_mode == ZBEE_ZDP_ADDR_MODE_UNICAST) { /*guint64 dst64;*/ /*guint8 dst_ep;*/ if (tree) proto_item_append_text(ti, " (Unicast)"); - /*dst64 =*/ zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, sizeof(guint64), NULL); - /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, sizeof(guint8), NULL); + /*dst64 =*/ zbee_parse_eui64(tree, hf_zbee_zdp_bind_dst64, tvb, &offset, (int)sizeof(guint64), NULL); + /*dst_ep =*/ zbee_parse_uint(tree, hf_zbee_zdp_bind_dst_ep, tvb, &offset, (int)sizeof(guint8), NULL); } else if (tree) proto_item_append_text(ti, " (Reserved)"); @@ -513,9 +513,9 @@ dissect_zbee_zdp_req_backup_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_ /*guint16 idx;*/ guint16 table_count; - /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint16), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint16), NULL); - table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint16), NULL); + /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL); + table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint16), NULL); if (tree) { ti = proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Binding Table"); @@ -549,7 +549,7 @@ dissect_zbee_zdp_req_recover_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto guint offset = 0; /*guint16 idx;*/ - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint16), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL); /* Dump any leftover bytes. */ zdp_dump_excess(tvb, offset, pinfo, tree); @@ -581,15 +581,15 @@ dissect_zbee_zdp_req_backup_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto /*guint16 idx;*/ guint16 count; - /*entries =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint16), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint16), NULL); - count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint16), NULL); + /*entries =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL); + count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint16), NULL); if (tree) { - ti = proto_tree_add_text(tree, tvb, offset, count*sizeof(guint64), "Source Table"); + ti = proto_tree_add_text(tree, tvb, offset, count*(int)sizeof(guint64), "Source Table"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_bind_source); } - for (i=0; izbee_stack_vers >= ZBEE_VERSION_2007)?sizeof(guint16):sizeof(guint8); + guint sizeof_cluster = (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8); guint16 device; guint16 profile; guint8 in_count; guint8 out_count; - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - profile = zbee_parse_uint(tree, hf_zbee_zdp_profile, tvb, &offset, sizeof(guint16), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + profile = zbee_parse_uint(tree, hf_zbee_zdp_profile, tvb, &offset, (int)sizeof(guint16), NULL); /* Add the input cluster list. */ - in_count = zbee_parse_uint(tree, hf_zbee_zdp_in_count, tvb, &offset, sizeof(guint8), NULL); + in_count = zbee_parse_uint(tree, hf_zbee_zdp_in_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree && in_count) { ti = proto_tree_add_text(tree, tvb, offset, in_count*sizeof_cluster, "Input Cluster List"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_match_in); @@ -257,7 +257,7 @@ dissect_zbee_zdp_req_match_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t for (i=0; izbee_stack_vers >= ZBEE_VERSION_2007) { - user_length = zbee_parse_uint(tree, hf_zbee_zdp_user_length, tvb, &offset, sizeof(guint8), NULL); + user_length = zbee_parse_uint(tree, hf_zbee_zdp_user_length, tvb, &offset, (int)sizeof(guint8), NULL); } else { /* No Length field in ZigBee 2003 & earlier, uses a fixed length of 16. */ @@ -487,19 +487,19 @@ dissect_zbee_zdp_req_store_discovery(tvbuff_t *tvb, packet_info *pinfo, proto_tr /*guint8 ep_count;*/ guint8 simple_count; - /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); - /*node_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_disc_node_size, tvb, &offset, sizeof(guint8), NULL); - /*power_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_disc_power_size, tvb, &offset, sizeof(guint8), NULL); - /*ep_count =*/ zbee_parse_uint(tree, hf_zbee_zdp_disc_ep_count, tvb, &offset, sizeof(guint8), NULL); - simple_count= zbee_parse_uint(tree, hf_zbee_zdp_disc_simple_count, tvb, &offset, sizeof(guint8), NULL); + /*device =*/ zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); + /*node_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_disc_node_size, tvb, &offset, (int)sizeof(guint8), NULL); + /*power_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_disc_power_size, tvb, &offset, (int)sizeof(guint8), NULL); + /*ep_count =*/ zbee_parse_uint(tree, hf_zbee_zdp_disc_ep_count, tvb, &offset, (int)sizeof(guint8), NULL); + simple_count= zbee_parse_uint(tree, hf_zbee_zdp_disc_simple_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree) { ti = proto_tree_add_text(tree, tvb, offset, simple_count, "Simple Descriptor Sizes"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_simple_sizes); } for (i=0; izbee_stack_vers >= ZBEE_VERSION_2007) || (status == ZBEE_ZDP_STATUS_SUCCESS)) { /* In ZigBee 2003 & earlier, the length field is omitted if not successful. */ - user_length = zbee_parse_uint(tree, hf_zbee_zdp_user_length, tvb, &offset, sizeof(guint8), NULL); + user_length = zbee_parse_uint(tree, hf_zbee_zdp_user_length, tvb, &offset, (int)sizeof(guint8), NULL); } else user_length = 0; @@ -1188,7 +1188,7 @@ dissect_zbee_zdp_rsp_user_desc_conf(tvbuff_t *tvb, packet_info *pinfo, proto_tre status = zdp_parse_status(tree, tvb, &offset); if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { /* Device address present only on ZigBee 2006 & later. */ - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); } zbee_append_info(tree, pinfo, ", Device: 0x%04x", device); @@ -1455,9 +1455,9 @@ dissect_zbee_zdp_rsp_find_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tr guint16 device; /*guint64 ext_addr;*/ - cache = zbee_parse_uint(tree, hf_zbee_zdp_cache, tvb, &offset, sizeof(guint16), NULL); - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - /*ext_addr =*/ zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); + cache = zbee_parse_uint(tree, hf_zbee_zdp_cache, tvb, &offset, (int)sizeof(guint16), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + /*ext_addr =*/ zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); zbee_append_info(tree, pinfo, ", Cache: 0x%04x", cache); zbee_append_info(tree, pinfo, ", Device: 0x%04x", device); @@ -1485,7 +1485,7 @@ dissect_zbee_zdp_rsp_ext_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tr { guint offset = 0; guint i; - guint sizeof_cluster = sizeof(guint16); + guint sizeof_cluster = (int)sizeof(guint16); guint8 status; guint16 device; @@ -1495,11 +1495,11 @@ dissect_zbee_zdp_rsp_ext_simple_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tr guint8 idx; status = zdp_parse_status(tree, tvb, &offset); - device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, sizeof(guint16), NULL); - /*endpt =*/ zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, sizeof(guint8), NULL); - in_count = zbee_parse_uint(tree, hf_zbee_zdp_in_count, tvb, &offset, sizeof(guint8), NULL); - out_count = zbee_parse_uint(tree, hf_zbee_zdp_out_count, tvb, &offset, sizeof(guint8), NULL); - idx = zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); + device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); + /*endpt =*/ zbee_parse_uint(tree, hf_zbee_zdp_endpoint, tvb, &offset, (int)sizeof(guint8), NULL); + in_count = zbee_parse_uint(tree, hf_zbee_zdp_in_count, tvb, &offset, (int)sizeof(guint8), NULL); + out_count = zbee_parse_uint(tree, hf_zbee_zdp_out_count, tvb, &offset, (int)sizeof(guint8), NULL); + idx = zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); /* Display the input cluster list. */ for (i=idx; (i> 0; version = (tvb_get_guint8(tvb, *offset + len) & 0xf0) >> 4; if (tree) proto_item_append_text(ti, ", Profile: 0x%01x, Version: %d", profile, version); - len += sizeof(guint8); + len += (int)sizeof(guint8); beacon = (tvb_get_guint8(tvb, *offset + len) & 0x0f) >> 0; superframe = (tvb_get_guint8(tvb, *offset + len) & 0xf0) >> 4; @@ -97,11 +97,11 @@ zdp_parse_nwk_desc(proto_tree *tree, tvbuff_t *tvb, guint *offset, packet_info * else if (tree) { proto_item_append_text(ti, ", BeaconOrder: %d, SuperframeOrder: %d", beacon, superframe); } - len += sizeof(guint8); + len += (int)sizeof(guint8); permit = tvb_get_guint8(tvb, *offset) & 0x01; if (tree) proto_item_append_text(ti, ", PermitJoining: %s}", permit?"True":"False"); - len += sizeof(guint8); + len += (int)sizeof(guint8); if (tree) proto_item_set_len(ti, len); *offset += len; @@ -141,22 +141,22 @@ zdp_parse_neighbor_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, p /* ZigBee 2006 & later use an extended PAN Identifier. */ ext_pan = tvb_get_letoh64(tvb, *offset + len); if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "{Extended PAN: %s", eui64_to_str(ext_pan)); - len += sizeof(guint64); + len += (int)sizeof(guint64); } else { /* ZigBee 2003 & earlier use a short PAN Identifier. */ pan = tvb_get_letohs(tvb, *offset + len); if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 0, "{PAN: 0x%04x", pan); - len += sizeof(guint16); + len += (int)sizeof(guint16); } ext_addr = tvb_get_letoh64(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Extended Addr: %s", get_eui64_name(ext_addr)); - len += sizeof(guint64); + len += (int)sizeof(guint64); device = tvb_get_letohs(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Addr: 0x%04x", device); - len += sizeof(guint16); + len += (int)sizeof(guint16); if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { type = (tvb_get_guint8(tvb, *offset + len) & 0x03) >> 0; @@ -185,13 +185,13 @@ zdp_parse_neighbor_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, p else if (rel == 0x04) proto_item_append_text(ti, ", Relationship: Previous Child"); else proto_item_append_text(ti, ", Relationship: Unknown"); } - len += sizeof(guint8); + len += (int)sizeof(guint8); if (pinfo->zbee_stack_vers <= ZBEE_VERSION_2004) { /* In ZigBee 2003 & earlier, the depth field is before the permit joining field. */ depth = tvb_get_guint8(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Depth: %d", depth); - len += sizeof(guint8); + len += (int)sizeof(guint8); } permit_joining = (tvb_get_guint8(tvb, *offset + len) & 0x03) >> 0; @@ -200,18 +200,18 @@ zdp_parse_neighbor_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset, p else if (permit_joining == 0x01)proto_item_append_text(ti, ", Permit Joining: True"); else proto_item_append_text(ti, ", Permit Joining: Unknown"); } - len += sizeof(guint8); + len += (int)sizeof(guint8); if (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007) { /* In ZigBee 2006 & later, the depth field is after the permit joining field. */ depth = tvb_get_guint8(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", Depth: %d", depth); - len += sizeof(guint8); + len += (int)sizeof(guint8); } lqi = tvb_get_guint8(tvb, *offset + len); if (tree) proto_item_append_text(ti, ", LQI: %d}", lqi); - len += sizeof(guint8); + len += (int)sizeof(guint8); if (tree) proto_item_set_len(ti, len); *offset += len; @@ -240,11 +240,11 @@ zdp_parse_routing_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset) guint16 next; dest = tvb_get_letohs(tvb, *offset + len); - if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 2*sizeof(guint16) + sizeof(guint8), "{Destination: 0x%04x", dest); - len += sizeof(guint16); + if (tree) ti = proto_tree_add_text(tree, tvb, *offset, 2*(int)sizeof(guint16) + (int)sizeof(guint8), "{Destination: 0x%04x", dest); + len += (int)sizeof(guint16); status = tvb_get_guint8(tvb, *offset + len); - next = tvb_get_letohs(tvb, *offset + len + sizeof(guint8)); + next = tvb_get_letohs(tvb, *offset + len + (int)sizeof(guint8)); if (tree) { /* Display the next hop first, because it looks a lot cleaner that way. */ proto_item_append_text(ti, ", Next Hop: 0x%04x", next); @@ -255,7 +255,7 @@ zdp_parse_routing_table_entry(proto_tree *tree, tvbuff_t *tvb, guint *offset) else if (status == 0x03)proto_item_append_text(ti, ", Status: Inactive}"); else proto_item_append_text(ti, ", Status: Unknown}"); } - len += sizeof(guint8) + sizeof(guint16); + len += (int)sizeof(guint8) + (int)sizeof(guint16); *offset += len; } /* zdp_parse_routing_table_entry */ @@ -308,7 +308,7 @@ dissect_zbee_zdp_req_mgmt_nwk_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree channels = tvb_get_letohl(tvb, offset); if (tree) { gboolean first = 1; - ti = proto_tree_add_text(tree, tvb, offset, sizeof(guint32), "Scan Channels: "); + ti = proto_tree_add_text(tree, tvb, offset, (int)sizeof(guint32), "Scan Channels: "); for (i=0; i<27; i++) { if (channels & (1<zbee_stack_vers >= ZBEE_VERSION_2007) { /* Flags present on ZigBee 2006 & later. */ flags = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_boolean(tree, hf_zbee_zdp_leave_children, tvb, offset, sizeof(guint8), flags & ZBEE_ZDP_MGMT_LEAVE_CHILDREN); - proto_tree_add_boolean(tree, hf_zbee_zdp_leave_rejoin, tvb, offset, sizeof(guint8), flags & ZBEE_ZDP_MGMT_LEAVE_REJOIN); + proto_tree_add_boolean(tree, hf_zbee_zdp_leave_children, tvb, offset, (int)sizeof(guint8), flags & ZBEE_ZDP_MGMT_LEAVE_CHILDREN); + proto_tree_add_boolean(tree, hf_zbee_zdp_leave_rejoin, tvb, offset, (int)sizeof(guint8), flags & ZBEE_ZDP_MGMT_LEAVE_REJOIN); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); } zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); @@ -469,7 +469,7 @@ dissect_zbee_zdp_req_mgmt_direct_join(tvbuff_t *tvb, packet_info *pinfo, proto_t guint64 ext_addr; /*guint8 cinfo;*/ - ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, sizeof(guint64), NULL); + ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); /*cinfo =*/ zdp_parse_cinfo(tree, ett_zbee_zdp_cinfo, tvb, &offset); zbee_append_info(tree, pinfo, ", Device: %s", get_eui64_name(ext_addr)); @@ -499,8 +499,8 @@ dissect_zbee_zdp_req_mgmt_permit_join(tvbuff_t *tvb, packet_info *pinfo, proto_t /*guint8 duration;*/ /*guint8 significance;*/ - /*duration =*/ zbee_parse_uint(tree, hf_zbee_zdp_duration, tvb, &offset, sizeof(guint8), NULL); - /*significance =*/ zbee_parse_uint(tree, hf_zbee_zdp_significance, tvb, &offset, sizeof(guint8), NULL); + /*duration =*/ zbee_parse_uint(tree, hf_zbee_zdp_duration, tvb, &offset, (int)sizeof(guint8), NULL); + /*significance =*/ zbee_parse_uint(tree, hf_zbee_zdp_significance, tvb, &offset, (int)sizeof(guint8), NULL); /* Dump any leftover bytes. */ zdp_dump_excess(tvb, offset, pinfo, tree); @@ -526,7 +526,7 @@ dissect_zbee_zdp_req_mgmt_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t guint offset = 0; /*guint8 idx;*/ - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); /* Dump any leftover bytes. */ zdp_dump_excess(tvb, offset, pinfo, tree); @@ -557,16 +557,16 @@ dissect_zbee_zdp_req_mgmt_nwkupdate(tvbuff_t *tvb, packet_info *pinfo, proto_tre /*guint16 manager;*/ /*channels =*/ zdp_parse_chanmask(tree, tvb, &offset); - duration = zbee_parse_uint(tree, hf_zbee_zdp_duration, tvb, &offset, sizeof(guint8), NULL); + duration = zbee_parse_uint(tree, hf_zbee_zdp_duration, tvb, &offset, (int)sizeof(guint8), NULL); if (duration == ZBEE_ZDP_NWKUPDATE_PARAMETERS) { - /*update_id =*/ zbee_parse_uint(tree, hf_zbee_zdp_update_id, tvb, &offset, sizeof(guint8), NULL); - /*manager =*/ zbee_parse_uint(tree, hf_zbee_zdp_manager, tvb, &offset, sizeof(guint16), NULL); + /*update_id =*/ zbee_parse_uint(tree, hf_zbee_zdp_update_id, tvb, &offset, (int)sizeof(guint8), NULL); + /*manager =*/ zbee_parse_uint(tree, hf_zbee_zdp_manager, tvb, &offset, (int)sizeof(guint16), NULL); } else if (duration == ZBEE_ZDP_NWKUPDATE_CHANNEL_HOP) { - /*update_id =*/ zbee_parse_uint(tree, hf_zbee_zdp_update_id, tvb, &offset, sizeof(guint8), NULL); + /*update_id =*/ zbee_parse_uint(tree, hf_zbee_zdp_update_id, tvb, &offset, (int)sizeof(guint8), NULL); } else if (duration <= ZBEE_ZDP_NWKUPDATE_SCAN_MAX) { - /*count =*/ zbee_parse_uint(tree, hf_zbee_zdp_scan_count, tvb, &offset, sizeof(guint8), NULL); + /*count =*/ zbee_parse_uint(tree, hf_zbee_zdp_scan_count, tvb, &offset, (int)sizeof(guint8), NULL); } /* Dump any leftover bytes. */ @@ -605,9 +605,9 @@ dissect_zbee_zdp_rsp_mgmt_nwk_disc(tvbuff_t *tvb, packet_info *pinfo, proto_tree guint8 table_count; status = zdp_parse_status(tree, tvb, &offset); - /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint8), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); - table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint8), NULL); + /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); + table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree && table_count) { ti = proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Network List"); @@ -651,9 +651,9 @@ dissect_zbee_zdp_rsp_mgmt_lqi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre guint8 table_count; status = zdp_parse_status(tree, tvb, &offset); - /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint8), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); - table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint8), NULL); + /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); + table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree && table_count) { ti = proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Neighbor Table"); @@ -697,9 +697,9 @@ dissect_zbee_zdp_rsp_mgmt_rtg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre guint8 table_count; status = zdp_parse_status(tree, tvb, &offset); - /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint8), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); - table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint8), NULL); + /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); + table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree && table_count) { ti = proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Routing Table"); @@ -743,9 +743,9 @@ dissect_zbee_zdp_rsp_mgmt_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr guint8 table_count; status = zdp_parse_status(tree, tvb, &offset); - /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint8), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); - table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint8), NULL); + /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); + table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree && table_count) { ti = proto_tree_add_text(tree, tvb, offset, tvb_length_remaining(tvb, offset), "Binding Table"); @@ -873,24 +873,24 @@ dissect_zbee_zdp_rsp_mgmt_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t guint8 table_count; status = zdp_parse_status(tree, tvb, &offset); - /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, sizeof(guint8), NULL); - /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, sizeof(guint8), NULL); - table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, sizeof(guint8), NULL); + /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint8), NULL); + /*idx =*/ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint8), NULL); + table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint8), NULL); if (tree && table_count) { - ti = proto_tree_add_text(tree, tvb, offset, table_count*(sizeof(guint16)+sizeof(guint64)), "Discovery Cache"); + ti = proto_tree_add_text(tree, tvb, offset, table_count*((int)sizeof(guint16)+(int)sizeof(guint64)), "Discovery Cache"); field_tree = proto_item_add_subtree(ti, ett_zbee_zdp_cache); } else { field_tree = NULL; } for (i=0; izbee_stack_vers >= ZBEE_VERSION_2007) { @@ -866,7 +866,7 @@ zdp_parse_power_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offs guint16 level; if ((tree) && (ettindex != -1)) { - ti = proto_tree_add_text(tree, tvb, *offset, sizeof(guint16), "Power Descriptor"); + ti = proto_tree_add_text(tree, tvb, *offset, (int)sizeof(guint16), "Power Descriptor"); field_tree = proto_item_add_subtree(ti, ettindex); } else field_tree = tree; @@ -875,31 +875,31 @@ zdp_parse_power_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *offs mode = flags & ZBEE_ZDP_POWER_MODE; level = flags & ZBEE_ZDP_POWER_LEVEL; if (tree) { - ti = proto_tree_add_uint(field_tree, hf_zbee_zdp_power_mode, tvb, *offset, sizeof(guint16), mode); + ti = proto_tree_add_uint(field_tree, hf_zbee_zdp_power_mode, tvb, *offset, (int)sizeof(guint16), mode); if (mode == ZBEE_ZDP_POWER_MODE_RX_ON) proto_item_append_text(ti, " (Receiver Always On)"); else if (mode == ZBEE_ZDP_POWER_MODE_RX_PERIODIC) proto_item_append_text(ti, " (Receiver Periodically On)"); else if (mode == ZBEE_ZDP_POWER_MODE_RX_STIMULATE) proto_item_append_text(ti, " (Receiver On When Stimulated)"); else proto_item_append_text(ti, " (Reserved)"); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_avail_ac, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_POWER_AVAIL_AC); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_avail_recharge, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_POWER_AVAIL_RECHARGEABLE); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_avail_dispose, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_POWER_AVAIL_DISPOSEABLE); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_avail_ac, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_AVAIL_AC); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_avail_recharge, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_AVAIL_RECHARGEABLE); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_avail_dispose, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_AVAIL_DISPOSEABLE); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_source_ac, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_POWER_SOURCE_AC); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_source_recharge, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_POWER_SOURCE_RECHARGEABLE); - proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_source_dispose, tvb, *offset, sizeof(guint16), flags & ZBEE_ZDP_POWER_SOURCE_DISPOSEABLE); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_source_ac, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_SOURCE_AC); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_source_recharge, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_SOURCE_RECHARGEABLE); + proto_tree_add_boolean(field_tree, hf_zbee_zdp_power_source_dispose, tvb, *offset, (int)sizeof(guint16), flags & ZBEE_ZDP_POWER_SOURCE_DISPOSEABLE); if (level == ZBEE_ZDP_POWER_LEVEL_FULL) - proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, sizeof(guint16), level, "Full"); + proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, (int)sizeof(guint16), level, "Full"); else if (level == ZBEE_ZDP_POWER_LEVEL_OK) - proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, sizeof(guint16), level, "OK"); + proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, (int)sizeof(guint16), level, "OK"); else if (level == ZBEE_ZDP_POWER_LEVEL_LOW) - proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, sizeof(guint16), level, "Low"); + proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, (int)sizeof(guint16), level, "Low"); else if (level == ZBEE_ZDP_POWER_LEVEL_CRITICAL) - proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, sizeof(guint16), level, "Critical"); - else proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, sizeof(guint16), level, "Reserved"); + proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, (int)sizeof(guint16), level, "Critical"); + else proto_tree_add_uint_format_value(field_tree, hf_zbee_zdp_power_level, tvb, *offset, (int)sizeof(guint16), level, "Reserved"); } - *offset += sizeof(guint16); + *offset += (int)sizeof(guint16); } /* zdp_parse_power_desc */ /*FUNCTION:------------------------------------------------------ @@ -940,14 +940,14 @@ zdp_parse_simple_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *off } else field_tree = tree; - /*endpoint =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_endpoint, tvb, offset, sizeof(guint8), NULL); - /*profile =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_profile, tvb, offset, sizeof(guint16), NULL); - /*app_device =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_simple_app_device, tvb, offset, sizeof(guint16), NULL); - /*app_version =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_simple_app_version, tvb, offset, sizeof(guint8), NULL); + /*endpoint =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_endpoint, tvb, offset, (int)sizeof(guint8), NULL); + /*profile =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_profile, tvb, offset, (int)sizeof(guint16), NULL); + /*app_device =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_simple_app_device, tvb, offset, (int)sizeof(guint16), NULL); + /*app_version =*/ zbee_parse_uint(field_tree, hf_zbee_zdp_simple_app_version, tvb, offset, (int)sizeof(guint8), NULL); - sizeof_cluster = (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?sizeof(guint16):sizeof(guint8); + sizeof_cluster = (pinfo->zbee_stack_vers >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8); - in_count = zbee_parse_uint(field_tree, hf_zbee_zdp_in_count, tvb, offset, sizeof(guint8), NULL); + in_count = zbee_parse_uint(field_tree, hf_zbee_zdp_in_count, tvb, offset, (int)sizeof(guint8), NULL); if ((tree) && (in_count)) { ti = proto_tree_add_text(field_tree, tvb, *offset, in_count*sizeof_cluster, "Input Cluster List"); cluster_tree = proto_item_add_subtree(ti, ett_zbee_zdp_node_in); @@ -956,7 +956,7 @@ zdp_parse_simple_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *off zbee_parse_uint(cluster_tree, hf_zbee_zdp_in_cluster, tvb, offset, sizeof_cluster, NULL); } - out_count = zbee_parse_uint(field_tree, hf_zbee_zdp_out_count, tvb, offset, sizeof(guint8), NULL); + out_count = zbee_parse_uint(field_tree, hf_zbee_zdp_out_count, tvb, offset, (int)sizeof(guint8), NULL); if ((tree) && (out_count)) { ti = proto_tree_add_text(field_tree, tvb, *offset, in_count*sizeof_cluster, "Output Cluster List"); cluster_tree = proto_item_add_subtree(ti, ett_zbee_zdp_node_out); @@ -1031,7 +1031,7 @@ zdp_parse_complex_desc(proto_tree *tree, gint ettindex, tvbuff_t *tvb, guint *of if (tag == tag_charset) { gchar lang_str[3]; guint8 charset = tvb_get_guint8(tvb, *offset + 3); - gchar *charset_str; + const gchar *charset_str; if (charset == 0x00) charset_str = "ASCII"; else charset_str = "Unknown Character Set"; @@ -1099,9 +1099,9 @@ dissect_zbee_zdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Get and display the sequence number. */ seqno = tvb_get_guint8(tvb, offset); if (tree) { - proto_tree_add_uint(zdp_tree, hf_zbee_zdp_seqno, tvb, offset, sizeof(guint8), seqno); + proto_tree_add_uint(zdp_tree, hf_zbee_zdp_seqno, tvb, offset, (int)sizeof(guint8), seqno); } - offset += sizeof(guint8); + offset += (int)sizeof(guint8); if (pinfo->zbee_stack_vers <= ZBEE_VERSION_2004) { /* ZigBee 2004 and earlier had different cluster identifiers, need to convert diff --git a/epan/emem.c b/epan/emem.c index 987911f287..a3c9585c6d 100644 --- a/epan/emem.c +++ b/epan/emem.c @@ -215,7 +215,7 @@ emem_canary_next(guint8 *mem_canary, guint8 *canary, int *len) memcpy(&ptr, &canary[i+1], sizeof(void *)); if (len) - *len = i + 1 + sizeof(void *); + *len = i + 1 + (int)sizeof(void *); return ptr; } @@ -584,7 +584,7 @@ static void emem_scrub_memory(char *buf, size_t size, gboolean alloc) { guint scrubbed_value; - guint offset; + size_t offset; if (!debug_use_memory_scrubber) return; @@ -739,8 +739,8 @@ emem_create_chunk_gp(size_t size) ret = mprotect(prot2, pagesize, PROT_NONE); g_assert(ret != -1); - npc->amount_free_init = prot2 - prot1 - pagesize; - npc->free_offset_init = (prot1 - npc->buf) + pagesize; + npc->amount_free_init = (unsigned int)(prot2 - prot1 - pagesize); + npc->free_offset_init = (unsigned int)((prot1 - npc->buf) + pagesize); #else npc->amount_free_init = size; npc->free_offset_init = 0; @@ -966,7 +966,7 @@ emem_strdup(const gchar *src, void *allocator(size_t)) * have to bother checking it. */ if(!src) - return ""; + src = ""; len = (guint) strlen(src); dst = memcpy(allocator(len+1), src, len+1); diff --git a/epan/filesystem.c b/epan/filesystem.c index fbb7bd0c24..db48f0962b 100644 --- a/epan/filesystem.c +++ b/epan/filesystem.c @@ -1794,7 +1794,8 @@ files_identical(const char *fname1, const char *fname2) gboolean copy_file_binary_mode(const char *from_filename, const char *to_filename) { - int from_fd, to_fd, nread, nwritten, err; + int from_fd, to_fd, err; + ssize_t nread, nwritten; guint8 *pd = NULL; /* Copy the raw bytes of the file. */ diff --git a/epan/follow.c b/epan/follow.c index 859d5f4205..12b79d396c 100644 --- a/epan/follow.c +++ b/epan/follow.c @@ -43,9 +43,9 @@ #define MAX_IPADDR_LEN 16 typedef struct _tcp_frag { - gulong seq; - gulong len; - gulong data_len; + guint32 seq; + guint32 len; + guint32 data_len; gchar *data; struct _tcp_frag *next; } tcp_frag; @@ -61,7 +61,7 @@ static guint port[2]; static guint bytes_written[2]; static gboolean is_ipv6 = FALSE; -static int check_fragments( int, tcp_stream_chunk *, gulong ); +static int check_fragments( int, tcp_stream_chunk *, guint32 ); static void write_packet_data( int, tcp_stream_chunk *, const char * ); void @@ -202,18 +202,18 @@ follow_tcp_index(guint32 indx) of order packets in a smart way. */ static tcp_frag *frags[2] = { 0, 0 }; -static gulong seq[2]; +static guint32 seq[2]; static guint8 src_addr[2][MAX_IPADDR_LEN]; static guint src_port[2] = { 0, 0 }; void -reassemble_tcp( guint32 tcp_stream, gulong sequence, gulong acknowledgement, - gulong length, const char* data, gulong data_length, +reassemble_tcp( guint32 tcp_stream, guint32 sequence, guint32 acknowledgement, + guint32 length, const char* data, guint32 data_length, int synflag, address *net_src, address *net_dst, guint srcport, guint dstport) { guint8 srcx[MAX_IPADDR_LEN], dstx[MAX_IPADDR_LEN]; int src_index, j, first = 0, len; - gulong newseq; + guint32 newseq; tcp_frag *tmp_frag; tcp_stream_chunk sc; @@ -327,7 +327,7 @@ reassemble_tcp( guint32 tcp_stream, gulong sequence, gulong acknowledgement, info than we have already seen */ newseq = sequence + length; if( newseq > seq[src_index] ) { - gulong new_len; + guint32 new_len; /* this one has more than we have seen. let's get the payload that we have not seen. */ @@ -382,10 +382,10 @@ reassemble_tcp( guint32 tcp_stream, gulong sequence, gulong acknowledgement, /* here we search through all the frag we have collected to see if one fits */ static int -check_fragments( int idx, tcp_stream_chunk *sc, gulong acknowledged ) { +check_fragments( int idx, tcp_stream_chunk *sc, guint32 acknowledged ) { tcp_frag *prev = NULL; tcp_frag *current; - gulong lowest_seq; + guint32 lowest_seq; gchar *dummy_str; current = frags[idx]; @@ -397,13 +397,13 @@ check_fragments( int idx, tcp_stream_chunk *sc, gulong acknowledged ) { } if( current->seq < seq[idx] ) { - gulong newseq; + guint32 newseq; /* this sequence number seems dated, but check the end to make sure it has no more info than we have already seen */ newseq = current->seq + current->len; if( newseq > seq[idx] ) { - gulong new_pos; + guint32 new_pos; /* this one has more than we have seen. let's get the payload that we have not seen. This happens when diff --git a/epan/follow.h b/epan/follow.h index a0b9862657..46fe5c45cf 100644 --- a/epan/follow.h +++ b/epan/follow.h @@ -44,7 +44,7 @@ typedef struct _tcp_stream_chunk { char* build_follow_filter( packet_info * ); gboolean follow_tcp_addr( const address *, guint, const address *, guint ); gboolean follow_tcp_index( guint32 ); -void reassemble_tcp( guint32, gulong, gulong, gulong, const char*, gulong, +void reassemble_tcp( guint32, guint32, guint32, guint32, const char*, guint32, int, address *, address *, guint, guint ); void reset_tcp_reassembly( void ); diff --git a/epan/frame_data.h b/epan/frame_data.h index 66577952b6..cbb9ddb291 100644 --- a/epan/frame_data.h +++ b/epan/frame_data.h @@ -59,7 +59,7 @@ typedef struct _frame_data { struct { unsigned int passed_dfilter : 1; /**< 1 = display, 0 = no display */ unsigned int dependent_of_displayed : 1; /**< 1 if a displayed frame depends on this frame */ - packet_char_enc encoding : 1; /**< Character encoding (ASCII, EBCDIC...) */ + unsigned int encoding : 1; /**< Character encoding (ASCII, EBCDIC...) */ unsigned int visited : 1; /**< Has this packet been visited yet? 1=Yes,0=No*/ unsigned int marked : 1; /**< 1 = marked by user, 0 = normal */ unsigned int ref_time : 1; /**< 1 = marked as a reference time frame, 0 = normal */ diff --git a/epan/ftypes/ftype-ipv4.c b/epan/ftypes/ftype-ipv4.c index b73998a68c..f3d59c4bc8 100644 --- a/epan/ftypes/ftype-ipv4.c +++ b/epan/ftypes/ftype-ipv4.c @@ -49,25 +49,16 @@ val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFu guint32 addr; unsigned int nmask_bits; - char *has_slash, *s_copy = NULL; + char *has_slash; char *net_str, *addr_str; fvalue_t *nmask_fvalue; /* Look for CIDR: Is there a single slash in the string? */ has_slash = strchr(s, '/'); if (has_slash) { - /* Make a copy of the string and use strtok() to - * get the address portion. */ - s_copy = ep_strdup(s); - addr_str = strtok(s_copy, "/"); - - /* I just checked for slash! I shouldn't get NULL here. - * Double check just in case. */ - if (!addr_str) { - logfunc("Unexpected strtok() error parsing IP address: %s", - s_copy); - return FALSE; - } + /* Make a copy of the string up to but not including the + * slash; that's the address portion. */ + addr_str = ep_strndup(s, has_slash - s); } else { addr_str = s; @@ -83,14 +74,8 @@ val_from_unparsed(fvalue_t *fv, char *s, gboolean allow_partial_value _U_, LogFu /* If CIDR, get netmask bits. */ if (has_slash) { - net_str = strtok(NULL, "/"); - /* I checked for slash! I shouldn't get NULL here. - * Double check just in case. */ - if (!net_str) { - logfunc("Unexpected strtok() error parsing netmask: %s", - s_copy); - return FALSE; - } + /* Skip past the slash */ + net_str = has_slash + 1; /* XXX - this is inefficient */ nmask_fvalue = fvalue_from_unparsed(FT_UINT32, net_str, FALSE, logfunc); diff --git a/epan/gcp.c b/epan/gcp.c index 67a066ed11..a179399f14 100644 --- a/epan/gcp.c +++ b/epan/gcp.c @@ -523,8 +523,8 @@ gcp_term_t* gcp_cmd_add_term(gcp_msg_t* m, gcp_trx_t* tr, gcp_cmd_t* c, gcp_term } -gchar* gcp_cmd_to_str(gcp_cmd_t* c, gboolean persistent) { - gchar* s; +const gchar* gcp_cmd_to_str(gcp_cmd_t* c, gboolean persistent) { + const gchar* s; gcp_terms_t* term; if ( !c ) return "-"; @@ -620,7 +620,7 @@ gchar* gcp_cmd_to_str(gcp_cmd_t* c, gboolean persistent) { return s; } -static gchar* gcp_trx_to_str(gcp_msg_t* m, gcp_trx_t* t, gboolean persistent) { +static const gchar* gcp_trx_to_str(gcp_msg_t* m, gcp_trx_t* t, gboolean persistent) { gchar* s; gcp_cmd_msg_t* c; @@ -649,9 +649,9 @@ static gchar* gcp_trx_to_str(gcp_msg_t* m, gcp_trx_t* t, gboolean persistent) { return ep_strdup_printf("%s %s",s,"}"); } -gchar* gcp_msg_to_str(gcp_msg_t* m, gboolean persistent) { +const gchar* gcp_msg_to_str(gcp_msg_t* m, gboolean persistent) { gcp_trx_msg_t* t; - gchar* s = ""; + const gchar* s = ""; if ( !m ) return "-"; diff --git a/epan/gcp.h b/epan/gcp.h index 7e24101365..715d1dc733 100644 --- a/epan/gcp.h +++ b/epan/gcp.h @@ -168,7 +168,7 @@ typedef struct _gcp_terms_t { typedef struct _gcp_cmd_t { guint offset; - gchar* str; + const gchar* str; gcp_cmd_type_t type; gcp_terms_t terms; struct _gcp_msg_t* msg; @@ -197,8 +197,8 @@ extern gcp_cmd_t* gcp_cmd(gcp_msg_t* m, gcp_trx_t* t, gcp_ctx_t* c, gcp_cmd_type extern gcp_term_t* gcp_cmd_add_term(gcp_msg_t* m, gcp_trx_t* tr, gcp_cmd_t* c, gcp_term_t* t, gcp_wildcard_t wildcard, gboolean persistent); extern void gcp_analyze_msg(proto_tree* gcp_tree, tvbuff_t* gcp_tvb, gcp_msg_t* m, gcp_hf_ett_t* ids); -extern gchar* gcp_cmd_to_str(gcp_cmd_t* c, gboolean persistent); -extern gchar* gcp_msg_to_str(gcp_msg_t* m, gboolean persistent); +extern const gchar* gcp_cmd_to_str(gcp_cmd_t* c, gboolean persistent); +extern const gchar* gcp_msg_to_str(gcp_msg_t* m, gboolean persistent); #define gcp_cmd_set_error(c,e) (c->error = e) #define gcp_trx_set_error(t,e) (t->error = e) diff --git a/epan/oids.c b/epan/oids.c index 5f31a8692f..08980c926c 100644 --- a/epan/oids.c +++ b/epan/oids.c @@ -93,7 +93,7 @@ static oid_info_t* add_oid(const char* name, oid_kind_t kind, const oid_value_ty char* debug_env = getenv("WIRESHARK_DEBUG_MIBS"); guint32 subid; - debuglevel = debug_env ? strtoul(debug_env,NULL,10) : 0; + debuglevel = debug_env ? (int)strtoul(debug_env,NULL,10) : 0; oid_root.children = pe_tree_create(EMEM_TREE_TYPE_RED_BLACK,"oid_root"); @@ -367,7 +367,7 @@ static guint get_non_implicit_size(SmiType* sT) { for (sR = smiGetFirstRange(sT); sR ; sR = smiGetNextRange(sR)) { if (size == 0xffffffff) { if (sR->minValue.value.unsigned32 == sR->maxValue.value.unsigned32) { - size = sR->minValue.value.unsigned32; + size = (guint32)sR->minValue.value.unsigned32; } else { return 0; } @@ -639,7 +639,7 @@ static void register_mibs(void) { for(;smiEnum; smiEnum = smiGetNextNamedNumber(smiEnum)) { if (smiEnum->name) { - value_string val = {smiEnum->value.value.integer32,g_strdup(smiEnum->name)}; + value_string val = {(guint32)smiEnum->value.value.integer32,g_strdup(smiEnum->name)}; g_array_append_val(vals,val); } } diff --git a/epan/prefs-int.h b/epan/prefs-int.h index 3694332e40..ec91db175f 100644 --- a/epan/prefs-int.h +++ b/epan/prefs-int.h @@ -67,7 +67,7 @@ WS_VAR_IMPORT module_t *protocols_module; typedef void (*pref_custom_free_cb) (pref_t* pref); typedef void (*pref_custom_reset_cb) (pref_t* pref); -typedef prefs_set_pref_e (*pref_custom_set_cb) (pref_t* pref, gchar* value, gboolean* changed); +typedef prefs_set_pref_e (*pref_custom_set_cb) (pref_t* pref, const gchar* value, gboolean* changed); typedef void (*pref_custom_write_cb) (pref_t* pref, write_pref_arg_t* arg); /** Structure to hold callbacks for PREF_CUSTOM type */ @@ -155,7 +155,7 @@ struct preference { * @return an indication of whether it succeeded or failed * in some fashion. */ -typedef prefs_set_pref_e (*pref_set_pair_cb) (gchar *key, gchar *value, void *private_data, gboolean return_range_errors); +typedef prefs_set_pref_e (*pref_set_pair_cb) (gchar *key, const gchar *value, void *private_data, gboolean return_range_errors); /** read the preferences file (or similiar) and call the callback * function to set each key/value pair found diff --git a/epan/prefs.c b/epan/prefs.c index 8ac79023bf..040a0299c6 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -63,7 +63,7 @@ static module_t *find_subtree(module_t *parent, const char *tilte); static module_t *prefs_register_module_or_subtree(module_t *parent, const char *name, const char *title, const char *description, gboolean is_subtree, void (*apply_cb)(void), gboolean use_gui); -static prefs_set_pref_e set_pref(gchar*, gchar*, void *, gboolean); +static prefs_set_pref_e set_pref(gchar*, const gchar*, void *, gboolean); static void write_string_list(FILE *, GList *, gboolean is_default); static void free_col_info(GList *); static void pre_init_prefs(void); @@ -1216,11 +1216,11 @@ static void console_log_level_reset_cb(pref_t* pref) *pref->varp.uint = pref->default_val.uint; } -static prefs_set_pref_e console_log_level_set_cb(pref_t* pref, gchar* value, gboolean* changed) +static prefs_set_pref_e console_log_level_set_cb(pref_t* pref, const gchar* value, gboolean* changed) { guint uval; - uval = strtoul(value, NULL, 10); + uval = (guint)strtoul(value, NULL, 10); if (*pref->varp.uint != uval) { *changed = TRUE; @@ -1278,7 +1278,7 @@ static void column_hidden_reset_cb(pref_t* pref) *pref->varp.string = g_strdup(pref->default_val.string); } -static prefs_set_pref_e column_hidden_set_cb(pref_t* pref, gchar* value, gboolean* changed) +static prefs_set_pref_e column_hidden_set_cb(pref_t* pref, const gchar* value, gboolean* changed) { GList *clp; fmt_data *cfmt; @@ -1357,7 +1357,7 @@ static void column_num_reset_cb(pref_t* pref) *pref->varp.uint = pref->default_val.uint; } -static prefs_set_pref_e column_num_set_cb(pref_t* pref _U_, gchar* value _U_, gboolean* changed _U_) +static prefs_set_pref_e column_num_set_cb(pref_t* pref _U_, const gchar* value _U_, gboolean* changed _U_) { /* Don't write this to the preferences file */ return PREFS_SET_OK; @@ -1430,7 +1430,7 @@ static void column_format_reset_cb(pref_t* pref) column_num_reset_cb(col_num_pref); } -static prefs_set_pref_e column_format_set_cb(pref_t* pref, gchar* value, gboolean* changed _U_) +static prefs_set_pref_e column_format_set_cb(pref_t* pref, const gchar* value, gboolean* changed _U_) { GList *col_l, *col_l_elt; fmt_data *cfmt; @@ -1622,7 +1622,7 @@ static void capture_column_reset_cb(pref_t* pref) } } -static prefs_set_pref_e capture_column_set_cb(pref_t* pref, gchar* value, gboolean* changed _U_) +static prefs_set_pref_e capture_column_set_cb(pref_t* pref, const gchar* value, gboolean* changed _U_) { GList *col_l, *col_l_elt; gchar *col_name; @@ -1706,7 +1706,7 @@ static void colorized_frame_reset_cb(pref_t* pref) *pref->varp.string = g_strdup(pref->default_val.string); } -static prefs_set_pref_e colorized_frame_set_cb(pref_t* pref, gchar* value, gboolean* changed) +static prefs_set_pref_e colorized_frame_set_cb(pref_t* pref, const gchar* value, gboolean* changed) { if (strcmp(*pref->varp.string, value) != 0) { *changed = TRUE; @@ -2160,7 +2160,7 @@ prefs_register_modules(void) /* Parse through a list of comma-separated, possibly quoted strings. Return a list of the string data. */ GList * -prefs_get_string_list(gchar *str) +prefs_get_string_list(const gchar *str) { enum { PRE_STRING, IN_QUOT, NOT_IN_QUOT }; @@ -2514,57 +2514,12 @@ pre_init_prefs(void) prefs.filter_toolbar_show_in_statusbar = FALSE; prefs.gui_toolbar_main_style = TB_STYLE_ICONS; prefs.gui_toolbar_filter_style = TB_STYLE_TEXT; + /* This can be g_freed, so it must be g_mallocated. */ + /* XXX - are these the right font names for Qt? */ #ifdef _WIN32 - prefs.gui_font_name = "Lucida Console 10"; + prefs.gui_font_name = g_strdup("Lucida Console 10"); #else - /* - * XXX - for now, we make the initial font name a pattern that matches - * only ISO 8859/1 fonts, so that we don't match 2-byte fonts such - * as ISO 10646 fonts. - * - * Users in locales using other one-byte fonts will have to choose - * a different font from the preferences dialog - or put the font - * selection in the global preferences file to make that font the - * default for all users who don't explicitly specify a different - * font. - * - * Making this a font set rather than a font has two problems: - * - * 1) as far as I know, you can't select font sets with the - * font selection dialog; - * - * 2) if you use a font set, the text to be drawn must be a - * multi-byte string in the appropriate locale, but - * Wireshark does *NOT* guarantee that's the case - in - * the hex-dump window, each character in the text portion - * of the display must be a *single* byte, and in the - * packet-list and protocol-tree windows, text extracted - * from the packet is not necessarily in the right format. - * - * "Doing this right" may, for the packet-list and protocol-tree - * windows, require that dissectors know what the locale is - * *AND* know what locale and text representation is used in - * the packets they're dissecting, and may be impossible in - * the hex-dump window (except by punting and displaying only - * ASCII characters). - * - * GTK+ 2.0 may simplify part of the problem, as it will, as I - * understand it, use UTF-8-encoded Unicode as its internal - * character set; however, we'd still have to know whatever - * character set and encoding is used in the packet (which - * may differ for different protocols, e.g. SMB might use - * PC code pages for some strings and Unicode for others, whilst - * NFS might use some UNIX character set encoding, e.g. ISO 8859/x, - * or one of the EUC character sets for Asian languages, or one - * of the other multi-byte character sets, or UTF-8, or...). - * - * I.e., as far as I can tell, "internationalizing" the packet-list, - * protocol-tree, and hex-dump windows involves a lot more than, say, - * just using font sets rather than fonts. - */ - /* XXX - the above comment was about the GTK1 font stuff, just remove this comment now */ - /* XXX- is this the correct default font name for GTK2 none win32? */ - prefs.gui_font_name = "Monospace 10"; + prefs.gui_font_name = g_strdup("Monospace 10"); #endif prefs.gui_marked_fg.pixel = 65535; prefs.gui_marked_fg.red = 65535; @@ -2613,8 +2568,10 @@ pre_init_prefs(void) prefs.gui_ask_unsaved = TRUE; prefs.gui_find_wrap = TRUE; prefs.gui_use_pref_save = FALSE; - prefs.gui_webbrowser = HTML_VIEWER " %s"; - prefs.gui_window_title = ""; + /* This can be g_freed, so it must be g_mallocated. */ + prefs.gui_webbrowser = g_strdup(HTML_VIEWER " %s"); + /* This can be g_freed, so it must be g_mallocated. */ + prefs.gui_window_title = g_strdup(""); prefs.gui_start_title = "The World's Most Popular Network Protocol Analyzer"; prefs.gui_version_placement = version_both; prefs.gui_auto_scroll_on_expand = FALSE; @@ -3282,7 +3239,7 @@ prefs_capture_options_dialog_column_is_visible(const gchar *column) #define BLUE_COMPONENT(x) (guint16) ( (((x) & 0xff) * 65535 / 255)) char -string_to_name_resolve(char *string, e_addr_resolve *name_resolve) +string_to_name_resolve(const char *string, e_addr_resolve *name_resolve) { char c; @@ -3321,7 +3278,7 @@ try_convert_to_custom_column(gpointer *el_data) /* Array of columns that have been migrated to custom columns */ struct { gint el; - gchar *col_expr; + const gchar *col_expr; } migrated_columns[] = { { COL_COS_VALUE, "vlan.priority" }, { COL_CIRCUIT_ID, "iax2.call" }, @@ -3359,7 +3316,7 @@ try_convert_to_custom_column(gpointer *el_data) } static prefs_set_pref_e -set_pref(gchar *pref_name, gchar *value, void *private_data _U_, +set_pref(gchar *pref_name, const gchar *value, void *private_data _U_, gboolean return_range_errors) { unsigned long int cval; @@ -3772,7 +3729,8 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_, switch (pref->type) { case PREF_UINT: - uval = strtoul(value, &p, pref->info.base); + /* XXX - give an error if it doesn't fit in a guint? */ + uval = (guint)strtoul(value, &p, pref->info.base); if (p == value || *p != '\0') return PREFS_SET_SYNTAX_ERR; /* number was bad */ if (*pref->varp.uint != uval) { diff --git a/epan/prefs.h b/epan/prefs.h index 0b7b3762e4..9ca301c5d4 100644 --- a/epan/prefs.h +++ b/epan/prefs.h @@ -55,7 +55,7 @@ extern "C" { * Set "*name_resolve" to the bitmask, and return '\0', on success; * return the bad character in the string on error. */ -char string_to_name_resolve(char *string, e_addr_resolve *name_resolve); +char string_to_name_resolve(const char *string, e_addr_resolve *name_resolve); /* * Modes for the starting directory in File Open dialogs. @@ -115,70 +115,70 @@ typedef enum { typedef struct _e_prefs { - gint pr_format; - gint pr_dest; - gchar *pr_file; - gchar *pr_cmd; - GList *col_list; - gint num_cols; - color_t st_client_fg, st_client_bg, st_server_fg, st_server_bg; - gboolean gui_scrollbar_on_right; - gboolean gui_plist_sel_browse; - gboolean gui_ptree_sel_browse; - gboolean gui_altern_colors; - gboolean gui_expert_composite_eyecandy; - gboolean filter_toolbar_show_in_statusbar; - gint gui_ptree_line_style; - gint gui_ptree_expander_style; - gboolean gui_hex_dump_highlight_style; - gint gui_toolbar_main_style; - gint gui_toolbar_filter_style; - gchar *gui_font_name; - color_t gui_marked_fg; - color_t gui_marked_bg; - color_t gui_ignored_fg; - color_t gui_ignored_bg; - gchar *gui_colorized_fg; - gchar *gui_colorized_bg; - gboolean gui_geometry_save_position; - gboolean gui_geometry_save_size; - gboolean gui_geometry_save_maximized; - gboolean gui_macosx_style; + gint pr_format; + gint pr_dest; + const gchar *pr_file; + const gchar *pr_cmd; + GList *col_list; + gint num_cols; + color_t st_client_fg, st_client_bg, st_server_fg, st_server_bg; + gboolean gui_scrollbar_on_right; + gboolean gui_plist_sel_browse; + gboolean gui_ptree_sel_browse; + gboolean gui_altern_colors; + gboolean gui_expert_composite_eyecandy; + gboolean filter_toolbar_show_in_statusbar; + gint gui_ptree_line_style; + gint gui_ptree_expander_style; + gboolean gui_hex_dump_highlight_style; + gint gui_toolbar_main_style; + gint gui_toolbar_filter_style; + gchar *gui_font_name; + color_t gui_marked_fg; + color_t gui_marked_bg; + color_t gui_ignored_fg; + color_t gui_ignored_bg; + const gchar *gui_colorized_fg; + const gchar *gui_colorized_bg; + gboolean gui_geometry_save_position; + gboolean gui_geometry_save_size; + gboolean gui_geometry_save_maximized; + gboolean gui_macosx_style; console_open_e gui_console_open; - guint gui_recent_df_entries_max; - guint gui_recent_files_count_max; - guint gui_fileopen_style; - gchar *gui_fileopen_dir; - guint gui_fileopen_preview; - gboolean gui_ask_unsaved; - gboolean gui_find_wrap; - gboolean gui_use_pref_save; - gchar *gui_webbrowser; - gchar *gui_window_title; - gchar *gui_start_title; + guint gui_recent_df_entries_max; + guint gui_recent_files_count_max; + guint gui_fileopen_style; + gchar *gui_fileopen_dir; + guint gui_fileopen_preview; + gboolean gui_ask_unsaved; + gboolean gui_find_wrap; + gboolean gui_use_pref_save; + gchar *gui_webbrowser; + gchar *gui_window_title; + const gchar *gui_start_title; version_info_e gui_version_placement; - gboolean gui_auto_scroll_on_expand; - guint gui_auto_scroll_percentage; + gboolean gui_auto_scroll_on_expand; + guint gui_auto_scroll_percentage; layout_type_e gui_layout_type; layout_pane_content_e gui_layout_content_1; layout_pane_content_e gui_layout_content_2; layout_pane_content_e gui_layout_content_3; - gint console_log_level; - gchar *capture_device; - gchar *capture_devices_linktypes; - gchar *capture_devices_descr; - gchar *capture_devices_hide; - gchar *capture_devices_monitor_mode; - gboolean capture_prom_mode; - gboolean capture_pcap_ng; - gboolean capture_real_time; - gboolean capture_auto_scroll; - gboolean capture_show_info; - GList *capture_columns; - guint rtp_player_max_visible; - guint tap_update_interval; - gboolean display_hidden_proto_items; - gpointer filter_expressions; /* Actually points to &head */ + gint console_log_level; + gchar *capture_device; + gchar *capture_devices_linktypes; + gchar *capture_devices_descr; + gchar *capture_devices_hide; + gchar *capture_devices_monitor_mode; + gboolean capture_prom_mode; + gboolean capture_pcap_ng; + gboolean capture_real_time; + gboolean capture_auto_scroll; + gboolean capture_show_info; + GList *capture_columns; + guint rtp_player_max_visible; + guint tap_update_interval; + gboolean display_hidden_proto_items; + gpointer filter_expressions; /* Actually points to &head */ } e_prefs; WS_VAR_IMPORT e_prefs prefs; @@ -446,7 +446,7 @@ extern guint prefs_pref_foreach(module_t *module, pref_cb callback, /* Parse through a list of comma-separated, possibly quoted strings. * Return a list of the string data. */ -extern GList *prefs_get_string_list(gchar *str); +extern GList *prefs_get_string_list(const gchar *str); /* Clear the given list of string data. */ extern void prefs_clear_string_list(GList *sl); diff --git a/epan/range.c b/epan/range.c index 5db6cd45c6..81a1d0634e 100644 --- a/epan/range.c +++ b/epan/range.c @@ -169,7 +169,7 @@ range_convert_str_work(range_t **rangep, const gchar *es, guint32 max_value, } } p = endp; - range->ranges[range->nranges].low = val; + range->ranges[range->nranges].low = (guint32)val; /* Skip white space. */ while ((c = *p) == ' ' || c == '\t') @@ -215,7 +215,7 @@ range_convert_str_work(range_t **rangep, const gchar *es, guint32 max_value, } } p = endp; - range->ranges[range->nranges].high = val; + range->ranges[range->nranges].high = (guint32)val; /* Skip white space. */ while ((c = *p) == ' ' || c == '\t') diff --git a/epan/req_resp_hdrs.c b/epan/req_resp_hdrs.c index b7af5bd7e1..f6ae0a6303 100644 --- a/epan/req_resp_hdrs.c +++ b/epan/req_resp_hdrs.c @@ -44,9 +44,9 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo, gint next_offset; gint next_offset_sav; gint length_remaining, reported_length_remaining; - int linelen; + int linelen; gchar *header_val; - long int content_length; + int content_length; gboolean content_length_found = FALSE; gboolean content_type_found = FALSE; gboolean chunked_encoding = FALSE; @@ -153,7 +153,11 @@ req_resp_hdrs_do_reassembly(tvbuff_t *tvb, const int offset, packet_info *pinfo, */ line = tvb_get_ephemeral_string(tvb, next_offset_sav, linelen); if (g_ascii_strncasecmp(line, "Content-Length:", 15) == 0) { - if (sscanf(line+15,"%li", &content_length) == 1) + /* XXX - what if it doesn't fit in an int? + (Do not "fix" that by making this + a "long"; make it a gint64 or a + guint64.) */ + if (sscanf(line+15,"%i", &content_length) == 1) content_length_found = TRUE; } else if (g_ascii_strncasecmp(line, "Content-Type:", 13) == 0) { content_type_found = TRUE; diff --git a/epan/stats_tree.c b/epan/stats_tree.c index 77eacf64ab..3d8fadeaee 100644 --- a/epan/stats_tree.c +++ b/epan/stats_tree.c @@ -632,14 +632,14 @@ get_range(char *rngstr) /* string == "X-?" */ if (*(split[0]) != '\0') { - rng->floor = strtol(split[0],NULL,10); + rng->floor = (gint)strtol(split[0],NULL,10); } else /* string == "-?" */ rng->floor = G_MININT; /* string != "?-" */ if (*(split[1]) != '\0') { - rng->ceil = strtol(split[1],NULL,10); + rng->ceil = (gint)strtol(split[1],NULL,10); } else /* string == "?-" */ rng->ceil = G_MAXINT; diff --git a/epan/strutil.c b/epan/strutil.c index 4052211c95..36211a3bf9 100644 --- a/epan/strutil.c +++ b/epan/strutil.c @@ -528,7 +528,7 @@ uri_str_to_bytes(const char *uri_str, GByteArray *bytes) { * Given a GByteArray, generate a string from it that shows non-printable * characters as percent-style escapes, and return a pointer to it. */ -gchar * +const gchar * format_uri(const GByteArray *bytes, const gchar *reserved_chars) { static gchar *fmtbuf[3]; diff --git a/epan/strutil.h b/epan/strutil.h index f64316ed86..781ef4a5e2 100644 --- a/epan/strutil.h +++ b/epan/strutil.h @@ -139,7 +139,7 @@ gboolean uri_str_to_bytes(const char *uri_str, GByteArray *bytes); * with the % character itself are always reserved. * @see uri_str_to_bytes(), format_text(), isprint() */ -gchar* format_uri(const GByteArray *bytes, const gchar *reserved_chars); +const gchar* format_uri(const GByteArray *bytes, const gchar *reserved_chars); /** Turn a OID string representation (dot notation) into a byte array. * diff --git a/epan/to_str.c b/epan/to_str.c index 9e5d771a1b..e25675647b 100644 --- a/epan/to_str.c +++ b/epan/to_str.c @@ -152,7 +152,7 @@ bytes_to_hexstr_punct(char *out, const guint8 *ad, guint32 len, char punct) { * If punct is '\0', no punctuation is applied (and thus * the resulting string is (len-1) bytes shorter) */ -gchar * +const gchar * bytestring_to_str(const guint8 *ad, const guint32 len, const char punct) { gchar *buf; size_t buflen; diff --git a/epan/to_str.h b/epan/to_str.h index cf1dae30d8..c86e0b17b0 100644 --- a/epan/to_str.h +++ b/epan/to_str.h @@ -50,17 +50,17 @@ struct e_in6_addr; extern gchar* ep_address_to_str(const address *); extern gchar* se_address_to_str(const address *); extern void address_to_str_buf(const address *addr, gchar *buf, int buf_len); -extern gchar* bytestring_to_str(const guint8 *, const guint32, const char); -extern gchar* ether_to_str(const guint8 *); -extern gchar* tvb_ether_to_str(tvbuff_t *tvb, const gint offset); -extern gchar* ax25_to_str(const guint8 *); +extern const gchar* bytestring_to_str(const guint8 *, const guint32, const char); +extern const gchar* ether_to_str(const guint8 *); +extern const gchar* tvb_ether_to_str(tvbuff_t *tvb, const gint offset); +extern const gchar* ax25_to_str(const guint8 *); extern gchar* get_ax25_name(const guint8 *); extern const gchar* ip_to_str(const guint8 *); extern const gchar* tvb_ip_to_str(tvbuff_t *tvb, const gint offset); extern void ip_to_str_buf(const guint8 *ad, gchar *buf, const int buf_len); -extern gchar* fc_to_str(const guint8 *); +extern const gchar* fc_to_str(const guint8 *); extern gchar* fcwwn_to_str (const guint8 *); -extern gchar* tvb_fc_to_str(tvbuff_t *tvb, const gint offset); +extern const gchar* tvb_fc_to_str(tvbuff_t *tvb, const gint offset); extern gchar* tvb_fcwwn_to_str (tvbuff_t *tvb, const gint offset); extern gchar* ip6_to_str(const struct e_in6_addr *); extern gchar* tvb_ip6_to_str(tvbuff_t *tvb, const gint offset); diff --git a/epan/uat.h b/epan/uat.h index 7488ca61be..e401b8e1f0 100644 --- a/epan/uat.h +++ b/epan/uat.h @@ -439,7 +439,7 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out */ #define UAT_DEC_CB_DEF(basename,field_name,rec_t) \ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, const void* u1 _U_, const void* u2 _U_) {\ - ((rec_t*)rec)->field_name = strtol(ep_strndup(buf,len),NULL,10); } \ + ((rec_t*)rec)->field_name = (guint)strtol(ep_strndup(buf,len),NULL,10); } \ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, const void* u1 _U_, const void* u2 _U_) {\ *out_ptr = ep_strdup_printf("%d",((rec_t*)rec)->field_name); \ *out_len = (unsigned)strlen(*out_ptr); } @@ -454,7 +454,7 @@ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out */ #define UAT_HEX_CB_DEF(basename,field_name,rec_t) \ static void basename ## _ ## field_name ## _set_cb(void* rec, const char* buf, unsigned len, const void* u1 _U_, const void* u2 _U_) {\ - ((rec_t*)rec)->field_name = strtol(ep_strndup(buf,len),NULL,16); } \ + ((rec_t*)rec)->field_name = (guint)strtol(ep_strndup(buf,len),NULL,16); } \ static void basename ## _ ## field_name ## _tostr_cb(void* rec, const char** out_ptr, unsigned* out_len, const void* u1 _U_, const void* u2 _U_) {\ *out_ptr = ep_strdup_printf("%x",((rec_t*)rec)->field_name); \ *out_len = (unsigned)strlen(*out_ptr); } diff --git a/epan/value_string.c b/epan/value_string.c index cb439c3590..3d430c0957 100644 --- a/epan/value_string.c +++ b/epan/value_string.c @@ -131,7 +131,7 @@ match_strval(const guint32 val, const value_string *vs) { /* Note: The total number of entries should include the required {0, NULL} terminating entry of the array. */ /* Return: a pointer to a g_malloc'd and initialized value_string_ext struct. */ value_string_ext * -value_string_ext_new(value_string *vs, guint vs_tot_num_entries, gchar *vs_name) { +value_string_ext_new(value_string *vs, guint vs_tot_num_entries, const gchar *vs_name) { value_string_ext *vse; g_assert (vs_name != NULL); g_assert (vs_tot_num_entries > 0); diff --git a/epan/value_string.h b/epan/value_string.h index c94fad921b..82d398f3df 100644 --- a/epan/value_string.h +++ b/epan/value_string.h @@ -142,7 +142,7 @@ extern const value_string *_match_strval_ext_init(const guint32 val, const value /* Create a value_string_ext given a ptr to a value_string array and the total number of entries. */ /* Note: vs_tot_num_entries should include the required {0, NULL} terminating entry of the array. */ /* Return: a pointer to a gmalloc'd and initialized value_string_ext struct. */ -extern value_string_ext *value_string_ext_new(value_string *vs, guint vs_tot_num_entries, gchar *vs_name); +extern value_string_ext *value_string_ext_new(value_string *vs, guint vs_tot_num_entries, const gchar *vs_name); /* Looks up val in a value_string array using access method (direct, binary search * or linear) determined at rutime during the initial access); (see _match_strval_ext_init) diff --git a/epan/wmem/wmem_strutl.c b/epan/wmem/wmem_strutl.c index 18a193c75a..958c1ebc09 100644 --- a/epan/wmem/wmem_strutl.c +++ b/epan/wmem/wmem_strutl.c @@ -42,7 +42,7 @@ wmem_strdup(wmem_allocator_t *allocator, const gchar *src) /* If the string is NULL, just return the string "" so that the * callers don't have to bother checking it. */ if(!src) { - return ""; + src = ""; } len = strlen(src) + 1; /* +1 for the null-terminator */ diff --git a/epan/wslua/wslua_pinfo.c b/epan/wslua/wslua_pinfo.c index 7698ee7225..83601fc37b 100644 --- a/epan/wslua/wslua_pinfo.c +++ b/epan/wslua/wslua_pinfo.c @@ -179,7 +179,7 @@ WSLUA_METAMETHOD NSTime__lt(lua_State* L) { /* Compares two NSTimes */ } typedef struct { - gchar* name; + const gchar* name; lua_CFunction get; lua_CFunction set; } nstime_actions_t; diff --git a/epan/wslua/wslua_proto.c b/epan/wslua/wslua_proto.c index 0454bdc8e5..018e72b64c 100644 --- a/epan/wslua/wslua_proto.c +++ b/epan/wslua/wslua_proto.c @@ -1391,7 +1391,7 @@ static int Proto_set_fields(lua_State* L) { } typedef struct { - gchar* name; + const gchar* name; lua_CFunction get; lua_CFunction set; } proto_actions_t; @@ -1553,7 +1553,7 @@ WSLUA_METHOD Dissector_call(lua_State* L) { Tvb tvb = checkTvb(L,WSLUA_ARG_Dissector_call_TVB); Pinfo pinfo = checkPinfo(L,WSLUA_ARG_Dissector_call_PINFO); TreeItem ti = checkTreeItem(L,WSLUA_ARG_Dissector_call_TREE); - char *volatile error = NULL; + const char *volatile error = NULL; if (! ( d && tvb && pinfo) ) return 0; @@ -1752,7 +1752,7 @@ WSLUA_METHOD DissectorTable_try (lua_State *L) { TreeItem ti = checkTreeItem(L,5); ftenum_t type; gboolean handled = FALSE; - gchar *volatile error = NULL; + const gchar *volatile error = NULL; if (! (dt && tvb && tvb->ws_tvb && pinfo && ti) ) return 0; diff --git a/epan/wslua/wslua_util.c b/epan/wslua/wslua_util.c index 0b0bcdf266..502525297d 100644 --- a/epan/wslua/wslua_util.c +++ b/epan/wslua/wslua_util.c @@ -59,7 +59,7 @@ WSLUA_API const gchar* lua_shiftstring(lua_State* L, int i) { } WSLUA_FUNCTION wslua_get_version(lua_State* L) { /* Get Wireshark version */ - gchar* str = VERSION; + const gchar* str = VERSION; lua_pushstring(L,str); WSLUA_RETURN(1); /* version string */ } diff --git a/iface_monitor.c b/iface_monitor.c index 76db4938b1..57925010e6 100644 --- a/iface_monitor.c +++ b/iface_monitor.c @@ -243,7 +243,7 @@ iface_mon_event(void) ssize_t received; struct kern_event_msg *kem; struct net_event_data *evd; - int evd_len; + size_t evd_len; char ifr_name[IFNAMSIZ]; received = recv(s, msg, sizeof msg, 0); diff --git a/pcapio.c b/pcapio.c index d65ad84586..38d68eee3e 100644 --- a/pcapio.c +++ b/pcapio.c @@ -192,7 +192,7 @@ struct option { } \ return FALSE; \ } \ - written_length += (long)nwritten; \ + written_length += nwritten; \ } while (0); \ } @@ -200,7 +200,7 @@ struct option { Returns TRUE on success, FALSE on failure. Sets "*err" to an error code, or 0 for a short write, on failure*/ gboolean -libpcap_write_file_header(FILE *fp, int linktype, int snaplen, gboolean ts_nsecs, long *bytes_written, int *err) +libpcap_write_file_header(FILE *fp, int linktype, int snaplen, gboolean ts_nsecs, guint64 *bytes_written, int *err) { struct pcap_hdr file_hdr; size_t nwritten; @@ -230,15 +230,15 @@ libpcap_write_file_header(FILE *fp, int linktype, int snaplen, gboolean ts_nsecs Returns TRUE on success, FALSE on failure. */ gboolean libpcap_write_packet(FILE *fp, - guint32 sec, guint32 usec, + time_t sec, guint32 usec, guint32 caplen, guint32 len, - const unsigned char *pd, - long *bytes_written, int *err) + const guint8 *pd, + guint64 *bytes_written, int *err) { struct pcaprec_hdr rec_hdr; size_t nwritten; - rec_hdr.ts_sec = sec; + rec_hdr.ts_sec = (guint32)sec; /* Y2.038K issue in pcap format.... */ rec_hdr.ts_usec = usec; rec_hdr.incl_len = caplen; rec_hdr.orig_len = len; @@ -271,7 +271,7 @@ libpcap_write_session_header_block(FILE *fp, const char *os, const char *appname, guint64 section_length, - long *bytes_written, + guint64 *bytes_written, int *err) { struct shb shb; @@ -284,28 +284,28 @@ libpcap_write_session_header_block(FILE *fp, block_total_length = sizeof(struct shb) + sizeof(guint32); if ((comment != NULL) && (strlen(comment) > 0) && (strlen(comment) < G_MAXUINT16)) { - block_total_length += sizeof(struct option) + - (guint16)ADD_PADDING(strlen(comment)); + block_total_length += (guint32)(sizeof(struct option) + + (guint16)ADD_PADDING(strlen(comment))); have_options = TRUE; } if ((hw != NULL) && (strlen(hw) > 0) && (strlen(hw) < G_MAXUINT16)) { - block_total_length += sizeof(struct option) + - (guint16)ADD_PADDING(strlen(hw)); + block_total_length += (guint32)(sizeof(struct option) + + (guint16)ADD_PADDING(strlen(hw))); have_options = TRUE; } if ((os != NULL) && (strlen(os) > 0) && (strlen(os) < G_MAXUINT16)) { - block_total_length += sizeof(struct option) + - (guint16)ADD_PADDING(strlen(os)); + block_total_length += (guint32)(sizeof(struct option) + + (guint16)ADD_PADDING(strlen(os))); have_options = TRUE; } if ((appname != NULL) && (strlen(appname) > 0) && (strlen(appname) < G_MAXUINT16)) { - block_total_length += sizeof(struct option) + - (guint16)ADD_PADDING(strlen(appname)); + block_total_length += (guint32)(sizeof(struct option) + + (guint16)ADD_PADDING(strlen(appname))); have_options = TRUE; } /* If we have options add size of end-of-options */ if (have_options) { - block_total_length += sizeof(struct option); + block_total_length += (guint32)sizeof(struct option); } /* write shb header */ shb.block_type = SECTION_HEADER_BLOCK_TYPE; @@ -377,7 +377,7 @@ libpcap_write_interface_description_block(FILE *fp, const char *os, /* IDB_OS 12 */ int link_type, int snap_len, - long *bytes_written, + guint64 *bytes_written, guint64 if_speed, /* IDB_IF_SPEED 8 */ guint8 tsresol, /* IDB_TSRESOL 9 */ int *err) @@ -388,57 +388,59 @@ libpcap_write_interface_description_block(FILE *fp, const guint32 padding = 0; gboolean have_options = FALSE; - block_total_length = sizeof(struct idb) + sizeof(guint32); + block_total_length = (guint32)(sizeof(struct idb) + sizeof(guint32)); /* 01 - OPT_COMMENT */ if ((comment != NULL) && (strlen(comment) > 0) && (strlen(comment) < G_MAXUINT16)) { - block_total_length += sizeof(struct option) + - (guint16)ADD_PADDING(strlen(comment)); + block_total_length += (guint32)(sizeof(struct option) + + (guint16)ADD_PADDING(strlen(comment))); have_options = TRUE; } /* 02 - IDB_NAME */ if ((name != NULL) && (strlen(name) > 0) && (strlen(name) < G_MAXUINT16)) { - block_total_length += sizeof(struct option) + - (guint16)ADD_PADDING(strlen(name)); + block_total_length += (guint32)(sizeof(struct option) + + (guint16)ADD_PADDING(strlen(name))); have_options = TRUE; } /* 03 - IDB_DESCRIPTION */ if ((descr != NULL) && (strlen(descr) > 0) && (strlen(descr) < G_MAXUINT16)) { - block_total_length += sizeof(struct option) + - (guint16)ADD_PADDING(strlen(descr)); + block_total_length += (guint32)(sizeof(struct option) + + (guint16)ADD_PADDING(strlen(descr))); have_options = TRUE; } /* 08 - IDB_IF_SPEED */ if (if_speed != 0) { - block_total_length += sizeof(struct option) + sizeof(guint64); + block_total_length += (guint32)(sizeof(struct option) + + sizeof(guint64)); have_options = TRUE; } /* 09 - IDB_TSRESOL */ if (tsresol != 0) { - block_total_length += sizeof(struct option) + sizeof(struct option); + block_total_length += (guint32)(sizeof(struct option) + + sizeof(struct option)); have_options = TRUE; } /* 11 - IDB_FILTER */ if ((filter != NULL) && (strlen(filter) > 0) && (strlen(filter) < G_MAXUINT16)) { - block_total_length += sizeof(struct option) + - (guint16)(ADD_PADDING(strlen(filter)+ 1)); + block_total_length += (guint32)(sizeof(struct option) + + (guint16)(ADD_PADDING(strlen(filter)+ 1))); have_options = TRUE; } /* 12 - IDB_OS */ if ((os != NULL) && (strlen(os) > 0) && (strlen(os) < G_MAXUINT16)) { - block_total_length += sizeof(struct option) + - (guint16)ADD_PADDING(strlen(os)); + block_total_length += (guint32)(sizeof(struct option) + + (guint16)ADD_PADDING(strlen(os))); have_options = TRUE; } /* If we have options add size of end-of-options */ if (have_options) { - block_total_length += sizeof(struct option); + block_total_length += (guint32)sizeof(struct option); } /* write block header */ @@ -544,13 +546,13 @@ libpcap_write_interface_description_block(FILE *fp, gboolean libpcap_write_enhanced_packet_block(FILE *fp, const char *comment, - guint32 sec, guint32 usec, + time_t sec, guint32 usec, guint32 caplen, guint32 len, guint32 interface_id, guint ts_mul, - const unsigned char *pd, + const guint8 *pd, guint32 flags, - long *bytes_written, + guint64 *bytes_written, int *err) { struct epb epb; @@ -560,21 +562,22 @@ libpcap_write_enhanced_packet_block(FILE *fp, gboolean have_options = FALSE; const guint32 padding = 0; - block_total_length = sizeof(struct epb) + - ADD_PADDING(caplen) + - sizeof(guint32); + block_total_length = (guint32)(sizeof(struct epb) + + ADD_PADDING(caplen) + + sizeof(guint32)); if ((comment != NULL) && (strlen(comment) > 0) && (strlen(comment) < G_MAXUINT16)) { - block_total_length += sizeof(struct option) + - (guint16)ADD_PADDING(strlen(comment)); + block_total_length += (guint32)(sizeof(struct option) + + (guint16)ADD_PADDING(strlen(comment))); have_options = TRUE; } if (flags != 0) { have_options = TRUE; - block_total_length += sizeof(struct option) + sizeof(guint32); + block_total_length += (guint32)(sizeof(struct option) + + sizeof(guint32)); } /* If we have options add size of end-of-options */ if (have_options) { - block_total_length += sizeof(struct option); + block_total_length += (guint32)sizeof(struct option); } timestamp = (guint64)sec * ts_mul + (guint64)usec; epb.block_type = ENHANCED_PACKET_BLOCK_TYPE; @@ -617,7 +620,7 @@ libpcap_write_enhanced_packet_block(FILE *fp, gboolean libpcap_write_interface_statistics_block(FILE *fp, guint32 interface_id, - long *bytes_written, + guint64 *bytes_written, const char *comment, /* OPT_COMMENT 1 */ guint64 isb_starttime, /* ISB_STARTTIME 2 */ guint64 isb_endtime, /* ISB_ENDTIME 3 */ @@ -675,32 +678,36 @@ libpcap_write_interface_statistics_block(FILE *fp, timestamp = (guint64)(now.tv_sec) * 1000000 + (guint64)(now.tv_usec); #endif - block_total_length = sizeof(struct isb) + sizeof(guint32); + block_total_length = (guint32)(sizeof(struct isb) + sizeof(guint32)); if (isb_ifrecv != G_MAXUINT64) { - block_total_length += sizeof(struct option) + sizeof(guint64); + block_total_length += (guint32)(sizeof(struct option) + + sizeof(guint64)); have_options = TRUE; } if (isb_ifdrop != G_MAXUINT64) { - block_total_length += sizeof(struct option) + sizeof(guint64); + block_total_length += (guint32)(sizeof(struct option) + + sizeof(guint64)); have_options = TRUE; } /* OPT_COMMENT */ if ((comment != NULL) && (strlen(comment) > 0) && (strlen(comment) < G_MAXUINT16)) { - block_total_length += sizeof(struct option) + - (guint16)ADD_PADDING(strlen(comment)); + block_total_length += (guint32)(sizeof(struct option) + + (guint16)ADD_PADDING(strlen(comment))); have_options = TRUE; } if (isb_starttime !=0) { - block_total_length += sizeof(struct option) + sizeof(guint64); /* ISB_STARTTIME */ + block_total_length += (guint32)(sizeof(struct option) + + sizeof(guint64)); /* ISB_STARTTIME */ have_options = TRUE; } if (isb_endtime !=0) { - block_total_length += sizeof(struct option) + sizeof(guint64); /* ISB_ENDTIME */ + block_total_length += (guint32)(sizeof(struct option) + + sizeof(guint64)); /* ISB_ENDTIME */ have_options = TRUE; } /* If we have options add size of end-of-options */ if (have_options) { - block_total_length += sizeof(struct option); + block_total_length += (guint32)sizeof(struct option); } isb.block_type = INTERFACE_STATISTICS_BLOCK_TYPE; diff --git a/pcapio.h b/pcapio.h index e1ac38e477..16cee30d40 100644 --- a/pcapio.h +++ b/pcapio.h @@ -29,16 +29,16 @@ Returns TRUE on success, FALSE on failure. Sets "*err" to an error code, or 0 for a short write, on failure*/ extern gboolean -libpcap_write_file_header(FILE *fp, int linktype, int snaplen, gboolean ts_nsecs, long *bytes_written, int *err); +libpcap_write_file_header(FILE *fp, int linktype, int snaplen, gboolean ts_nsecs, guint64 *bytes_written, int *err); /** Write a record for a packet to a dump file. Returns TRUE on success, FALSE on failure. */ extern gboolean libpcap_write_packet(FILE *fp, - guint32 sec, guint32 usec, + time_t sec, guint32 usec, guint32 caplen, guint32 len, - const unsigned char *pd, - long *bytes_written, int *err); + const guint8 *pd, + guint64 *bytes_written, int *err); /** Write a section header block (SHB) * @@ -58,7 +58,7 @@ libpcap_write_session_header_block(FILE *fp, /**< File pointer */ * An UTF-8 string containing the name of the application used to create this section. */ guint64 section_length, - long *bytes_written, + guint64 *bytes_written, int *err); extern gboolean @@ -70,7 +70,7 @@ libpcap_write_interface_description_block(FILE *fp, const char *os, /* IDB_OS 12 */ int link_type, int snap_len, - long *bytes_written, + guint64 *bytes_written, guint64 if_speed, /* IDB_IF_SPEED 8 */ guint8 tsresol, /* IDB_TSRESOL 9 */ int *err); @@ -78,7 +78,7 @@ libpcap_write_interface_description_block(FILE *fp, extern gboolean libpcap_write_interface_statistics_block(FILE *fp, guint32 interface_id, - long *bytes_written, + guint64 *bytes_written, const char *comment, /* OPT_COMMENT 1 */ guint64 isb_starttime, /* ISB_STARTTIME 2 */ guint64 isb_endtime, /* ISB_ENDTIME 3 */ @@ -89,11 +89,11 @@ libpcap_write_interface_statistics_block(FILE *fp, extern gboolean libpcap_write_enhanced_packet_block(FILE *fp, const char *comment, - guint32 sec, guint32 usec, + time_t sec, guint32 usec, guint32 caplen, guint32 len, guint32 interface_id, guint ts_mul, - const unsigned char *pd, + const guint8 *pd, guint32 flags, - long *bytes_written, + guint64 *bytes_written, int *err); diff --git a/plugins/ethercat/packet-ams.c b/plugins/ethercat/packet-ams.c index 3e096f11d5..0740c98c06 100644 --- a/plugins/ethercat/packet-ams.c +++ b/plugins/ethercat/packet-ams.c @@ -431,43 +431,43 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi proto_tree_add_string(ams_tree, hf_ams_targetnetid, tvb, offset, AmsNetId_Len, szText); offset += AmsNetId_Len; - proto_tree_add_item(ams_tree, hf_ams_targetport, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - offset += sizeof(guint16); + proto_tree_add_item(ams_tree, hf_ams_targetport, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + offset += (int)sizeof(guint16); NetIdFormater(tvb, offset, szText, nMax); proto_tree_add_string(ams_tree, hf_ams_sendernetid, tvb, offset, AmsNetId_Len, szText); offset += AmsNetId_Len; - proto_tree_add_item(ams_tree, hf_ams_senderport, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - offset += sizeof(guint16); + proto_tree_add_item(ams_tree, hf_ams_senderport, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + offset += (int)sizeof(guint16); - proto_tree_add_item(ams_tree, hf_ams_cmdid, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_tree, hf_ams_cmdid, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); cmdId = tvb_get_letohs(tvb, offset); - offset+=sizeof(guint16); + offset+=(int)sizeof(guint16); - anItem = proto_tree_add_item(ams_tree, hf_ams_stateflags, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); + anItem = proto_tree_add_item(ams_tree, hf_ams_stateflags, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); ams_statetree = proto_item_add_subtree(anItem, ett_ams_stateflags); - proto_tree_add_item(ams_statetree, hf_ams_stateresponse,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_statenoreturn,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_stateadscmd,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_statesyscmd,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_statehighprio,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_statetimestampadded,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_stateudp,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_stateinitcmd,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_statetree, hf_ams_statebroadcast,tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_stateresponse,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_statenoreturn,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_stateadscmd,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_statesyscmd,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_statehighprio,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_statetimestampadded,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_stateudp,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_stateinitcmd,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_statetree, hf_ams_statebroadcast,tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); stateflags = tvb_get_letohs(tvb, offset); - offset+=sizeof(guint16); + offset+=(int)sizeof(guint16); - proto_tree_add_item(ams_tree, hf_ams_cbdata, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_tree, hf_ams_cbdata, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); cbdata = tvb_get_letohl(tvb,offset); - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_tree, hf_ams_errorcode, tvb, offset, sizeof(guint32),ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_tree, hf_ams_errorcode, tvb, offset, (int)sizeof(guint32),ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_tree, hf_ams_invokeid, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_tree, hf_ams_invokeid, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); } else { @@ -492,14 +492,14 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsReadReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadrequest); - proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); } } } @@ -511,17 +511,17 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( tree ) { anItem = proto_tree_add_item(ams_tree, hf_ams_adswriterequest, tvb, offset, ams_length-offset, ENC_NA); - if( ams_length-offset >= TAdsWriteReq_Len - sizeof(guint16) ) + if( ams_length-offset >= TAdsWriteReq_Len - (int)sizeof(guint16) ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adswriterequest); proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, 4, ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, 4, ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, 4, ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); proto_tree_add_item(ams_adstree, hf_ams_adsdata, tvb, offset, ams_length-offset, ENC_NA); } @@ -535,20 +535,20 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( tree ) { anItem = proto_tree_add_item(ams_tree, hf_ams_adsreadwriterequest, tvb, offset, ams_length-offset, ENC_NA); - if( ams_length-offset >= TAdsReadWriteReq_Len - sizeof(guint16)) + if( ams_length-offset >= TAdsReadWriteReq_Len - (int)sizeof(guint16)) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadwriterequest); - proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adscbreadlength, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscbreadlength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adscbwritelength, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscbwritelength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); proto_tree_add_item(ams_adstree, hf_ams_adsdata, tvb, offset+16, ams_length-offset, ENC_NA); } @@ -565,7 +565,7 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsReadStateReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadstaterequest); - proto_tree_add_item(ams_adstree, hf_ams_adsinvokeid, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsinvokeid, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); } } } @@ -577,17 +577,17 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( tree ) { anItem = proto_tree_add_item(ams_tree, hf_ams_adswritectrlrequest, tvb, offset, ams_length-offset, ENC_NA); - if( ams_length-offset >= TAdsWriteControlReq_Len - sizeof(guint16) ) + if( ams_length-offset >= TAdsWriteControlReq_Len - (int)sizeof(guint16) ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adswritectrlrequest); proto_tree_add_item(ams_adstree, hf_ams_adsstate, tvb, offset, 2, ENC_LITTLE_ENDIAN); - offset+=sizeof(guint16); + offset+=(int)sizeof(guint16); proto_tree_add_item(ams_adstree, hf_ams_adsdevicestate, tvb, offset, 2, ENC_LITTLE_ENDIAN); - offset+=sizeof(guint16); + offset+=(int)sizeof(guint16); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); proto_tree_add_item(ams_adstree, hf_ams_adsdata, tvb, offset, ams_length-offset, ENC_NA); } @@ -604,7 +604,7 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsReadDeviceInfoReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreaddinforequest); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); } } } @@ -619,23 +619,23 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsAddDeviceNotificationReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsadddnrequest); - proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexgroup, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsindexoffset, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adstransmode, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adstransmode, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsmaxdelay, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsmaxdelay, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adscycletime, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscycletime, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); } } } @@ -650,7 +650,7 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsDelDeviceNotificationReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsdeldnrequest); - proto_tree_add_item(ams_adstree, hf_ams_adsnotificationhandle, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsnotificationhandle, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); } } } @@ -668,13 +668,13 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsDeviceNotificationReq_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsdnrequest); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); /*cbLength = tvb_get_letohs(tvb, offset);*/ - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsnoteblocksstamps, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsnoteblocksstamps, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); /*nStamps = tvb_get_letohs(tvb, offset);*/ - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); /*ToDo: dissect noteblocks*/ } @@ -695,14 +695,14 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( tree ) { anItem = proto_tree_add_item(ams_tree, hf_ams_adsreadresponse, tvb, offset, ams_length-offset, ENC_NA); - if( ams_length-offset >= TAdsReadRes_Len - sizeof(guint16) ) + if( ams_length-offset >= TAdsReadRes_Len - (int)sizeof(guint16) ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); proto_tree_add_item(ams_adstree, hf_ams_adsdata, tvb, offset, ams_length-offset, ENC_NA); } @@ -719,7 +719,7 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsWriteRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adswriteresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); } } } @@ -731,14 +731,14 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( tree ) { anItem = proto_tree_add_item(ams_tree, hf_ams_adsreadwriteresponse, tvb, offset, ams_length-offset, ENC_NA); - if( ams_length-offset >= TAdsReadWriteRes_Len - sizeof(guint16) ) + if( ams_length-offset >= TAdsReadWriteRes_Len - (int)sizeof(guint16) ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadwriteresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adscblength, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); proto_tree_add_item(ams_adstree, hf_ams_adsdata, tvb, offset, ams_length-offset, ENC_NA); } @@ -755,13 +755,13 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsReadStateRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreadstateresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsstate, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsstate, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsdevicestate, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsdevicestate, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); } } } @@ -776,7 +776,7 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsWriteControlRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adswritectrlresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); } } } @@ -791,13 +791,13 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsReadDeviceInfoRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsreaddinforesponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsversionversion, tvb, offset++, sizeof(guint8), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_adstree, hf_ams_adsversionrevision, tvb, offset++, sizeof(guint8), ENC_LITTLE_ENDIAN); - proto_tree_add_item(ams_adstree, hf_ams_adsversionbuild, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint16); + proto_tree_add_item(ams_adstree, hf_ams_adsversionversion, tvb, offset++, (int)sizeof(guint8), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsversionrevision, tvb, offset++, (int)sizeof(guint8), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsversionbuild, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint16); proto_tree_add_item(ams_adstree, hf_ams_adsdevicename, tvb, offset, ams_length-offset, ENC_ASCII|ENC_NA); } @@ -814,10 +814,10 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsAddDeviceNotificationRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsadddnresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint32); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint32); - proto_tree_add_item(ams_adstree, hf_ams_adsnotificationhandle, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsnotificationhandle, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); } } } @@ -832,7 +832,7 @@ static gint dissect_ams(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi if( ams_length-offset >= TAdsDelDeviceNotificationRes_Len ) { ams_adstree = proto_item_add_subtree(anItem, ett_ams_adsdeldnresponse); - proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, sizeof(guint32), ENC_LITTLE_ENDIAN); + proto_tree_add_item(ams_adstree, hf_ams_adsresult, tvb, offset, (int)sizeof(guint32), ENC_LITTLE_ENDIAN); } } } diff --git a/plugins/ethercat/packet-ams.h b/plugins/ethercat/packet-ams.h index befa02b696..6ffc2315a7 100644 --- a/plugins/ethercat/packet-ams.h +++ b/plugins/ethercat/packet-ams.h @@ -675,7 +675,7 @@ typedef struct AmsNetId_ { guint8 b[6]; } AmsNetId; -#define AmsNetId_Len sizeof(AmsNetId) +#define AmsNetId_Len (int)sizeof(AmsNetId) typedef struct AmsAddr_ { @@ -710,7 +710,7 @@ typedef struct ErrCodeUnion anErrCodeUnion; UserUnion aUserUnion; } AmsHead; -#define AmsHead_Len sizeof(AmsHead) +#define AmsHead_Len (int)sizeof(AmsHead) /* State flags */ @@ -992,7 +992,7 @@ typedef struct guint32 invokeId; } TAdsReadDeviceInfoReq; -#define TAdsReadDeviceInfoReq_Len sizeof(TAdsReadDeviceInfoReq) +#define TAdsReadDeviceInfoReq_Len (int)sizeof(TAdsReadDeviceInfoReq) /*typedef struct { @@ -1007,7 +1007,7 @@ typedef struct { guint32 invokeId; } TAdsReadStateReq; -#define TAdsReadStateReq_Len sizeof(TAdsReadStateReq) +#define TAdsReadStateReq_Len (int)sizeof(TAdsReadStateReq) typedef struct { @@ -1015,7 +1015,7 @@ typedef struct guint32 indexOffset; guint32 cbLength; } TAdsReadReq; -#define TAdsReadReq_Len sizeof(TAdsReadReq) +#define TAdsReadReq_Len (int)sizeof(TAdsReadReq) /*typedef struct { @@ -1053,26 +1053,26 @@ typedef struct guint32 indexOffset; AdsNotificationAttrib noteAttrib; } TAdsAddDeviceNotificationReq; -#define TAdsAddDeviceNotificationReq_Len sizeof(TAdsAddDeviceNotificationReq) +#define TAdsAddDeviceNotificationReq_Len (int)sizeof(TAdsAddDeviceNotificationReq) typedef struct { guint32 hNotification; } TAdsDelDeviceNotificationReq; -#define TAdsDelDeviceNotificationReq_Len sizeof(TAdsDelDeviceNotificationReq) +#define TAdsDelDeviceNotificationReq_Len (int)sizeof(TAdsDelDeviceNotificationReq) typedef struct { guint32 cbLength; guint32 nStamps; } TAdsDeviceNotificationReq; -#define TAdsDeviceNotificationReq_Len sizeof(TAdsDeviceNotificationReq) +#define TAdsDeviceNotificationReq_Len (int)sizeof(TAdsDeviceNotificationReq) typedef struct { guint32 result; } TAdsRes; -#define TAdsRes_Len sizeof(TAdsRes) +#define TAdsRes_Len (int)sizeof(TAdsRes) typedef struct { @@ -1087,13 +1087,13 @@ typedef struct AdsVersion version; char sName[ADS_FIXEDNAMESIZE]; } TAdsReadDeviceInfoRes; -#define TAdsReadDeviceInfoRes_Len sizeof(TAdsReadDeviceInfoRes) +#define TAdsReadDeviceInfoRes_Len (int)sizeof(TAdsReadDeviceInfoRes) typedef struct { guint32 result; } TAdsWriteControlRes; -#define TAdsWriteControlRes_Len sizeof(TAdsWriteControlRes) +#define TAdsWriteControlRes_Len (int)sizeof(TAdsWriteControlRes) typedef struct { @@ -1101,7 +1101,7 @@ typedef struct guint16 adsState; guint16 deviceState; } TAdsReadStateRes; -#define TAdsReadStateRes_Len sizeof(TAdsReadStateRes) +#define TAdsReadStateRes_Len (int)sizeof(TAdsReadStateRes) typedef struct { @@ -1109,7 +1109,7 @@ typedef struct guint32 cbLength; guint16 firstDataWord; } TAdsReadRes; -#define TAdsReadRes_Len sizeof(TAdsReadRes) +#define TAdsReadRes_Len (int)sizeof(TAdsReadRes) typedef struct { @@ -1117,26 +1117,26 @@ typedef struct guint32 cbLength; guint16 firstDataWord; } TAdsReadWriteRes; -#define TAdsReadWriteRes_Len sizeof(TAdsReadWriteRes) +#define TAdsReadWriteRes_Len (int)sizeof(TAdsReadWriteRes) typedef struct { guint32 result; } TAdsWriteRes; -#define TAdsWriteRes_Len sizeof(TAdsWriteRes) +#define TAdsWriteRes_Len (int)sizeof(TAdsWriteRes) typedef struct { guint32 result; guint32 handle; } TAdsAddDeviceNotificationRes; -#define TAdsAddDeviceNotificationRes_Len sizeof(TAdsAddDeviceNotificationRes) +#define TAdsAddDeviceNotificationRes_Len (int)sizeof(TAdsAddDeviceNotificationRes) typedef struct { guint32 result; } TAdsDelDeviceNotificationRes; -#define TAdsDelDeviceNotificationRes_Len sizeof(TAdsDelDeviceNotificationRes) +#define TAdsDelDeviceNotificationRes_Len (int)sizeof(TAdsDelDeviceNotificationRes) /* structure for decoding the header -----------------------------------------*/ diff --git a/plugins/ethercat/packet-ecatmb.c b/plugins/ethercat/packet-ecatmb.c index 7620734ab4..3ab266c3f4 100644 --- a/plugins/ethercat/packet-ecatmb.c +++ b/plugins/ethercat/packet-ecatmb.c @@ -253,14 +253,14 @@ static const true_false_string tfs_complete = void init_mbx_header(PETHERCAT_MBOX_HEADER pMbox, tvbuff_t *tvb, gint offset) { - pMbox->Length = tvb_get_letohs(tvb, offset); offset+=sizeof(guint16); - pMbox->Address = tvb_get_letohs(tvb, offset); offset+=sizeof(guint16); + pMbox->Length = tvb_get_letohs(tvb, offset); offset+=(int)sizeof(guint16); + pMbox->Address = tvb_get_letohs(tvb, offset); offset+=(int)sizeof(guint16); pMbox->aControlUnion.Control = tvb_get_letohs(tvb, offset); } void init_eoe_header(PETHERCAT_EOE_HEADER pEoE, tvbuff_t *tvb, gint offset) { - pEoE->anEoeHeaderInfoUnion.Info = tvb_get_letohs(tvb, offset); offset+=sizeof(guint16); + pEoE->anEoeHeaderInfoUnion.Info = tvb_get_letohs(tvb, offset); offset+=(int)sizeof(guint16); pEoE->anEoeHeaderDataUnion.Result = tvb_get_letohs(tvb, offset); } @@ -286,7 +286,7 @@ void init_coe_header(PETHERCAT_COE_HEADER pCoE, tvbuff_t *tvb, gint offset) void init_sdo_header(PETHERCAT_SDO_HEADER pSdo, tvbuff_t *tvb, gint offset) { pSdo->anSdoHeaderUnion.CS = tvb_get_guint8(tvb, offset++); - pSdo->Index = tvb_get_letohs(tvb, offset);offset+=sizeof(guint16); + pSdo->Index = tvb_get_letohs(tvb, offset);offset+=(int)sizeof(guint16); pSdo->SubIndex = tvb_get_guint8(tvb, offset++); pSdo->Data = tvb_get_letohl(tvb, offset); } @@ -295,7 +295,7 @@ void init_sdo_info_header(PETHERCAT_SDO_INFO_HEADER pInfo, tvbuff_t *tvb, gint o { pInfo->anSdoControlUnion.Control = tvb_get_guint8(tvb, offset++); pInfo->Reserved = tvb_get_guint8(tvb, offset); - pInfo->FragmentsLeft = sizeof(guint16); + pInfo->FragmentsLeft = (int)sizeof(guint16); } @@ -435,7 +435,7 @@ static void CANopenSdoResFormatter(PETHERCAT_SDO_HEADER pSdo, char *szText, gint static void CANopenSdoInfoFormatter(PETHERCAT_SDO_INFO_HEADER pHead, char *szText, gint nMax) { guint8 opCode = pHead->anSdoControlUnion.v.OpCode & 0x7F; - char* txt2 = ""; + const char* txt2 = ""; if ( (pHead->anSdoControlUnion.v.OpCode & 0x80) != 0 ) txt2 = " - More Follows"; switch (opCode) @@ -1161,10 +1161,10 @@ static void dissect_ecat_eoe(tvbuff_t *tvb, gint offset, packet_info *pinfo, pro proto_tree_add_item(ecat_eoe_macfilter_filter_tree, hf_ecat_mailbox_eoe_macfilter_filters[nCnt], tvb, offset+nCnt*ETHERNET_ADDRESS_LEN, ETHERNET_ADDRESS_LEN, ENC_NA); offset+=16*ETHERNET_ADDRESS_LEN; - anItem = proto_tree_add_item(ecat_eoe_macfilter_tree, hf_ecat_mailbox_eoe_macfilter_filtermask, tvb, offset, 4*sizeof(guint32), ENC_NA); + anItem = proto_tree_add_item(ecat_eoe_macfilter_tree, hf_ecat_mailbox_eoe_macfilter_filtermask, tvb, offset, 4*(int)sizeof(guint32), ENC_NA); ecat_eoe_macfilter_filtermask_tree = proto_item_add_subtree(anItem, ett_ecat_mailbox_eoe_macfilter_filtermask); for( nCnt=0; nCntcmd = tvb_get_guint8(tvb, offset++); pHdr->idx = tvb_get_guint8(tvb, offset++); - pHdr->anAddrUnion.a.adp = tvb_get_letohs(tvb, offset); offset+=sizeof(guint16); - pHdr->anAddrUnion.a.ado = tvb_get_letohs(tvb, offset); offset+=sizeof(guint16); - pHdr->len = tvb_get_letohs(tvb, offset); offset+=sizeof(guint16); + pHdr->anAddrUnion.a.adp = tvb_get_letohs(tvb, offset); offset+=(int)sizeof(guint16); + pHdr->anAddrUnion.a.ado = tvb_get_letohs(tvb, offset); offset+=(int)sizeof(guint16); + pHdr->len = tvb_get_letohs(tvb, offset); offset+=(int)sizeof(guint16); pHdr->intr = tvb_get_letohs(tvb, offset); } @@ -303,7 +303,7 @@ static void init_dc_measure(guint32* pDC, tvbuff_t *tvb, gint offset) for ( i=0; i<4; i++ ) { pDC[i] = tvb_get_letohl(tvb, offset); - offset+=sizeof(guint32); + offset+=(int)sizeof(guint32); } } @@ -555,14 +555,14 @@ static void dissect_ecat_datagram(tvbuff_t *tvb, packet_info *pinfo, proto_tree PROTO_ITEM_SET_HIDDEN(aitem); } - suboffset+= sizeof(ecHdr.cmd); + suboffset+= (int)sizeof(ecHdr.cmd); proto_tree_add_item(ecat_header_tree, hf_ecat_idx, tvb, suboffset, sizeof(ecHdr.idx), ENC_LITTLE_ENDIAN); if( subCount < 10 ){ aitem = proto_tree_add_item(ecat_header_tree, hf_ecat_sub_idx[subCount], tvb, suboffset, sizeof(ecHdr.idx), ENC_LITTLE_ENDIAN); PROTO_ITEM_SET_HIDDEN(aitem); } - suboffset+= sizeof(ecHdr.idx); + suboffset+= (int)sizeof(ecHdr.idx); switch ( ecHdr.cmd ) { @@ -575,7 +575,7 @@ static void dissect_ecat_datagram(tvbuff_t *tvb, packet_info *pinfo, proto_tree PROTO_ITEM_SET_HIDDEN(aitem); } - suboffset += (sizeof(ecHdr.anAddrUnion.a.adp)+sizeof(ecHdr.anAddrUnion.a.ado)); + suboffset += (int)((sizeof(ecHdr.anAddrUnion.a.adp)+sizeof(ecHdr.anAddrUnion.a.ado))); break; default: proto_tree_add_item(ecat_header_tree, hf_ecat_adp, tvb, suboffset, sizeof(ecHdr.anAddrUnion.a.adp), ENC_LITTLE_ENDIAN); @@ -584,14 +584,14 @@ static void dissect_ecat_datagram(tvbuff_t *tvb, packet_info *pinfo, proto_tree PROTO_ITEM_SET_HIDDEN(aitem); } - suboffset+= sizeof(ecHdr.anAddrUnion.a.adp); + suboffset+= (int)sizeof(ecHdr.anAddrUnion.a.adp); proto_tree_add_item(ecat_header_tree, hf_ecat_ado, tvb, suboffset, sizeof(ecHdr.anAddrUnion.a.ado), ENC_LITTLE_ENDIAN); if( subCount < 10 ){ aitem = proto_tree_add_item(ecat_header_tree, hf_ecat_sub_ado[subCount], tvb, suboffset, sizeof(ecHdr.anAddrUnion.a.ado), ENC_LITTLE_ENDIAN); PROTO_ITEM_SET_HIDDEN(aitem); } - suboffset+= sizeof(ecHdr.anAddrUnion.a.ado); + suboffset+= (int)sizeof(ecHdr.anAddrUnion.a.ado); } { @@ -609,11 +609,11 @@ static void dissect_ecat_datagram(tvbuff_t *tvb, packet_info *pinfo, proto_tree proto_tree_add_item(length_sub_tree, hf_ecat_length_c, tvb, suboffset, sizeof(ecHdr.len), ENC_LITTLE_ENDIAN); proto_tree_add_item(length_sub_tree, hf_ecat_length_m, tvb, suboffset, sizeof(ecHdr.len), ENC_LITTLE_ENDIAN); - suboffset+= sizeof(ecHdr.len); + suboffset+= (int)sizeof(ecHdr.len); } proto_tree_add_item(ecat_header_tree, hf_ecat_int, tvb, suboffset, sizeof(ecHdr.intr), ENC_LITTLE_ENDIAN); - suboffset+= sizeof(ecHdr.intr); + suboffset+= (int)sizeof(ecHdr.intr); } else { diff --git a/plugins/ethercat/packet-ethercat-frame.h b/plugins/ethercat/packet-ethercat-frame.h index 94662a3acf..f552a2444a 100644 --- a/plugins/ethercat/packet-ethercat-frame.h +++ b/plugins/ethercat/packet-ethercat-frame.h @@ -38,6 +38,6 @@ typedef union _EtherCATFrameParser } EtherCATFrameParserHDR; typedef EtherCATFrameParserHDR *PEtherCATFrameParserHDR; -#define EtherCATFrameParserHDR_Len sizeof(EtherCATFrameParserHDR) +#define EtherCATFrameParserHDR_Len (int)sizeof(EtherCATFrameParserHDR) #endif diff --git a/plugins/ethercat/packet-ioraw.h b/plugins/ethercat/packet-ioraw.h index b67e0f2055..fbbc1ceafe 100644 --- a/plugins/ethercat/packet-ioraw.h +++ b/plugins/ethercat/packet-ioraw.h @@ -30,6 +30,6 @@ typedef struct _IoRawParser { guint32 head; } IoRawParserHDR, *PIoRawParserHDR; -#define IoRawParserHDR_Len sizeof(IoRawParserHDR) +#define IoRawParserHDR_Len (int)sizeof(IoRawParserHDR) #endif /* _PACKET_IORAW_H_*/ diff --git a/plugins/ethercat/packet-nv.c b/plugins/ethercat/packet-nv.c index 58bc9f1633..1ecaca676c 100644 --- a/plugins/ethercat/packet-nv.c +++ b/plugins/ethercat/packet-nv.c @@ -96,7 +96,7 @@ static void dissect_nv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree *nv_tree, *nv_header_tree, *nv_var_tree,*nv_varheader_tree; gint offset = 0; char szText[200]; - int nMax = sizeof(szText)-1; + int nMax = (int)sizeof(szText)-1; gint i; @@ -119,16 +119,16 @@ static void dissect_nv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) nv_header_tree = proto_item_add_subtree(ti, ett_nv_header); - ti= proto_tree_add_item(nv_header_tree, hf_nv_publisher, tvb, offset, sizeof(guint8)*6, ENC_NA); + ti= proto_tree_add_item(nv_header_tree, hf_nv_publisher, tvb, offset, (int)sizeof(guint8)*6, ENC_NA); NvPublisherFormater(tvb, offset, szText, nMax); proto_item_set_text(ti, "%s", szText); - offset+=(sizeof(guint8)*6); + offset+=((int)sizeof(guint8)*6); - proto_tree_add_item(nv_header_tree, hf_nv_count, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(nv_header_tree, hf_nv_count, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); nv_count = tvb_get_letohs(tvb, offset); - offset+=sizeof(guint16); + offset+=(int)sizeof(guint16); - proto_tree_add_item(nv_header_tree, hf_nv_cycleindex, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); + proto_tree_add_item(nv_header_tree, hf_nv_cycleindex, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); offset = NvParserHDR_Len; for ( i=0; i < nv_count; i++ ) @@ -143,17 +143,17 @@ static void dissect_nv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) ti = proto_tree_add_item(nv_var_tree, hf_nv_varheader, tvb, offset, ETYPE_88A4_NV_DATA_HEADER_Len, ENC_NA); nv_varheader_tree = proto_item_add_subtree(ti, ett_nv_varheader); - proto_tree_add_item(nv_varheader_tree, hf_nv_id, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint16); + proto_tree_add_item(nv_varheader_tree, hf_nv_id, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint16); - proto_tree_add_item(nv_varheader_tree, hf_nv_hash, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint16); + proto_tree_add_item(nv_varheader_tree, hf_nv_hash, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint16); - proto_tree_add_item(nv_varheader_tree, hf_nv_length, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint16); + proto_tree_add_item(nv_varheader_tree, hf_nv_length, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint16); - proto_tree_add_item(nv_varheader_tree, hf_nv_quality, tvb, offset, sizeof(guint16), ENC_LITTLE_ENDIAN); - offset+=sizeof(guint16); + proto_tree_add_item(nv_varheader_tree, hf_nv_quality, tvb, offset, (int)sizeof(guint16), ENC_LITTLE_ENDIAN); + offset+=(int)sizeof(guint16); proto_tree_add_item(nv_var_tree, hf_nv_data, tvb, offset, var_length, ENC_NA); offset+=var_length; diff --git a/plugins/ethercat/packet-nv.h b/plugins/ethercat/packet-nv.h index e1ad83d0bd..19fbe951e2 100644 --- a/plugins/ethercat/packet-nv.h +++ b/plugins/ethercat/packet-nv.h @@ -34,7 +34,7 @@ typedef struct _ETYPE_88A4_NV_DATA_HEADER guint16 Length; guint16 Quality; } ETYPE_88A4_NV_DATA_HEADER; -#define ETYPE_88A4_NV_DATA_HEADER_Len sizeof(ETYPE_88A4_NV_DATA_HEADER) +#define ETYPE_88A4_NV_DATA_HEADER_Len (int)sizeof(ETYPE_88A4_NV_DATA_HEADER) typedef struct _NvParserHDR { @@ -43,6 +43,6 @@ typedef struct _NvParserHDR guint16 CycleIndex; guint16 Reserved; } NvParserHDR; -#define NvParserHDR_Len sizeof(NvParserHDR) +#define NvParserHDR_Len (int)sizeof(NvParserHDR) #endif /* _PACKET_NV_H_*/ diff --git a/plugins/gryphon/packet-gryphon.c b/plugins/gryphon/packet-gryphon.c index 74f54ba50c..0f21d49346 100644 --- a/plugins/gryphon/packet-gryphon.c +++ b/plugins/gryphon/packet-gryphon.c @@ -1117,10 +1117,12 @@ eventnum(tvbuff_t *tvb, int offset, proto_tree *pt) static int resp_time(tvbuff_t *tvb, int offset, proto_tree *pt) { + guint64 val; nstime_t timestamp; - timestamp.secs = tvb_get_ntoh64(tvb, offset)/100000; - timestamp.nsecs = (tvb_get_ntoh64(tvb, offset)%100000)*1000; + val = tvb_get_ntoh64(tvb, offset); + timestamp.secs = val/100000; + timestamp.nsecs = (int)((val%100000)*1000); proto_tree_add_time(pt, hf_gryphon_resp_time, tvb, offset, 8, ×tamp); offset += 8; diff --git a/plugins/mate/mate_runtime.c b/plugins/mate/mate_runtime.c index 8b35b218fc..2425251be8 100644 --- a/plugins/mate/mate_runtime.c +++ b/plugins/mate/mate_runtime.c @@ -149,7 +149,7 @@ extern void initialize_mate_runtime(void) { } rd->current_items = 0; - rd->now = -1.0; + rd->now = -1.0f; rd->highest_analyzed_frame = 0; rd->frames = g_hash_table_new(g_direct_hash,g_direct_equal); @@ -189,10 +189,10 @@ static mate_gop* new_gop(mate_cfg_gop* cfg, mate_pdu* pdu, gchar* key) { gop->expiration = cfg->expiration > 0.0 ? cfg->expiration + rd->now : (float) -1.0 ; gop->idle_expiration = cfg->idle_timeout > 0.0 ? cfg->idle_timeout + rd->now : (float) -1.0 ; gop->time_to_die = cfg->lifetime > 0.0 ? cfg->lifetime + rd->now : (float) -1.0 ; - gop->time_to_timeout = 0.0; + gop->time_to_timeout = 0.0f; gop->last_time = gop->start_time = rd->now; - gop->release_time = 0.0; + gop->release_time = 0.0f; gop->num_of_pdus = 0; gop->num_of_after_release_pdus = 0; @@ -205,7 +205,7 @@ static mate_gop* new_gop(mate_cfg_gop* cfg, mate_pdu* pdu, gchar* key) { pdu->gop = gop; pdu->next = NULL; pdu->is_start = TRUE; - pdu->time_in_gop = 0.0; + pdu->time_in_gop = 0.0f; g_hash_table_insert(cfg->gop_index,gop->gop_key,gop); return gop; @@ -245,12 +245,12 @@ static mate_gog* new_gog(mate_cfg_gog* cfg, mate_gop* gop) { gog->avpl = new_avpl(cfg->name); gog->last_n = 0; - gog->expiration = 0.0; - gog->idle_expiration = 0.0; + gog->expiration = 0.0f; + gog->idle_expiration = 0.0f; gog->start_time = rd->now; - gog->release_time = 0.0; - gog->last_time = 0.0; + gog->release_time = 0.0f; + gog->last_time = 0.0f; gog->gops = NULL; gog->last_gop = NULL; @@ -734,7 +734,7 @@ static mate_pdu* new_pdu(mate_cfg_pdu* cfg, guint32 framenum, field_info* proto, pdu->gop = NULL; pdu->next = NULL; - pdu->time_in_gop = -1.0; + pdu->time_in_gop = -1.0f; pdu->first = FALSE; pdu->is_start = FALSE; diff --git a/plugins/mate/mate_setup.c b/plugins/mate/mate_setup.c index 093f8035b7..177df5a735 100644 --- a/plugins/mate/mate_setup.c +++ b/plugins/mate/mate_setup.c @@ -607,15 +607,15 @@ extern mate_config* mate_make_config(const gchar* filename, int mate_hfid) { matecfg->defaults.pdu.replace_mode = AVPL_INSERT; /* gop prefs */ - matecfg->defaults.gop.expiration = -1.0; - matecfg->defaults.gop.idle_timeout = -1.0; - matecfg->defaults.gop.lifetime = -1.0; + matecfg->defaults.gop.expiration = -1.0f; + matecfg->defaults.gop.idle_timeout = -1.0f; + matecfg->defaults.gop.lifetime = -1.0f; matecfg->defaults.gop.pdu_tree_mode = GOP_FRAME_TREE; matecfg->defaults.gop.show_times = TRUE; matecfg->defaults.gop.drop_unassigned = FALSE; /* gog prefs */ - matecfg->defaults.gog.expiration = 5.0; + matecfg->defaults.gog.expiration = 5.0f; matecfg->defaults.gog.show_times = TRUE; matecfg->defaults.gog.gop_tree_mode = GOP_BASIC_TREE; diff --git a/plugins/mate/mate_util.c b/plugins/mate/mate_util.c index 118ace70fd..fb141fe623 100644 --- a/plugins/mate/mate_util.c +++ b/plugins/mate/mate_util.c @@ -907,8 +907,8 @@ extern AVP* match_avp(AVP* src, AVP* op) { gchar* p; guint ls; guint lo; - float fs = 0.0; - float fo = 0.0; + float fs = 0.0f; + float fo = 0.0f; gboolean lower = FALSE; #ifdef _AVP_DEBUGGING diff --git a/plugins/opcua/opcua.c b/plugins/opcua/opcua.c index a577c44c1f..d42ace6c85 100644 --- a/plugins/opcua/opcua.c +++ b/plugins/opcua/opcua.c @@ -114,7 +114,7 @@ enum MessageType }; /** OpcUa Transport Message Type Names */ -static char* g_szMessageTypes[] = +static const char* g_szMessageTypes[] = { "Hello message", "Acknowledge message", diff --git a/plugins/opcua/opcua_simpletypes.c b/plugins/opcua/opcua_simpletypes.c index 3fee5ff66f..0bbcb6f928 100644 --- a/plugins/opcua/opcua_simpletypes.c +++ b/plugins/opcua/opcua_simpletypes.c @@ -450,14 +450,14 @@ void parseXmlElement(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex void parseFloat(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex) { - proto_tree_add_item(tree, hfIndex, tvb, *pOffset, sizeof(gfloat), ENC_LITTLE_ENDIAN); - *pOffset += sizeof(gfloat); + proto_tree_add_item(tree, hfIndex, tvb, *pOffset, (int)sizeof(gfloat), ENC_LITTLE_ENDIAN); + *pOffset += (int)sizeof(gfloat); } void parseDouble(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex) { - proto_tree_add_item(tree, hfIndex, tvb, *pOffset, sizeof(gdouble), ENC_LITTLE_ENDIAN); - *pOffset += sizeof(gdouble); + proto_tree_add_item(tree, hfIndex, tvb, *pOffset, (int)sizeof(gdouble), ENC_LITTLE_ENDIAN); + *pOffset += (int)sizeof(gdouble); } void parseDateTime(proto_tree *tree, tvbuff_t *tvb, gint *pOffset, int hfIndex) diff --git a/plugins/profinet/packet-dcerpc-pn-io.c b/plugins/profinet/packet-dcerpc-pn-io.c index a7eb546572..0497ec56b5 100644 --- a/plugins/profinet/packet-dcerpc-pn-io.c +++ b/plugins/profinet/packet-dcerpc-pn-io.c @@ -6737,7 +6737,7 @@ dissect_ARFSUDataAdjust_block(tvbuff_t *tvb, int offset, return offset; } -static char* decode_ARType_spezial(guint16 ARType, guint16 ARAccess) +static const char* decode_ARType_spezial(guint16 ARType, guint16 ARAccess) { if (ARType == 0x0001) return ("IO Controller AR"); diff --git a/plugins/profinet/packet-pn-mrp.c b/plugins/profinet/packet-pn-mrp.c index 46505cd281..ccc79ae4f9 100644 --- a/plugins/profinet/packet-pn-mrp.c +++ b/plugins/profinet/packet-pn-mrp.c @@ -232,7 +232,7 @@ dissect_PNMRP_LinkDown(tvbuff_t *tvb, int offset, return offset; } -static char * mrp_Prio2msg(guint16 prio) +static const char * mrp_Prio2msg(guint16 prio) { if (prio == 0x0000) diff --git a/plugins/wimax/crc.c b/plugins/wimax/crc.c index 7b92868333..b2dc4090dd 100644 --- a/plugins/wimax/crc.c +++ b/plugins/wimax/crc.c @@ -28,7 +28,7 @@ #include "crc.h" -#define WMAX_MAC_CRC32_POLYNOMIAL 0x04c11db7L /* polynomial used in calculating the CRC-32 checksum */ +#define WMAX_MAC_CRC32_POLYNOMIAL 0x04c11db7U /* polynomial used in calculating the CRC-32 checksum */ #define CCITT_X25_CRC16_POLYNOMIAL 0x1021 /* polynomial used in calculating the CRC-16 checksum */ #define WMAX_MAC_CRC8_POLYNOMIAL 0x07 /* polynomial used in calculating the CRC-8 checksum */ #define CRC32_INITIAL_VALUE 0xFFFFFFFF @@ -66,7 +66,7 @@ void wimax_mac_gen_crc32_table(void) crc = ( index << 24 ); for ( bit = 0; bit < 8; bit++ ) { - if ( crc & 0x80000000L ) + if ( crc & 0x80000000U ) crc = ( crc << 1 ) ^ WMAX_MAC_CRC32_POLYNOMIAL; else crc = ( crc << 1 ); diff --git a/plugins/wimax/mac_hd_generic_decoder.c b/plugins/wimax/mac_hd_generic_decoder.c index 1cc60fdfcb..c869c91417 100644 --- a/plugins/wimax/mac_hd_generic_decoder.c +++ b/plugins/wimax/mac_hd_generic_decoder.c @@ -703,9 +703,9 @@ void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, proto static guint8 frag_number[MAX_CID]; static guint cid_list[MAX_CID]; static guint cid_base; - static char *reassem_str = "Reassembled Data transport PDU (%u bytes)"; - static char *data_str = "Data transport PDU (%u bytes)"; - char *str_ptr; + static const char reassem_str[] = "Reassembled Data transport PDU (%u bytes)"; + static const char data_str[] = "Data transport PDU (%u bytes)"; + const char *str_ptr; gint length, i, cid_index; guint tvb_len, ret_length, ubyte, new_tvb_len; guint new_payload_len = 0; @@ -819,7 +819,7 @@ void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, proto { if (length >= (gint)sizeof(mac_crc)) { - length -= sizeof(mac_crc); + length -= (int)sizeof(mac_crc); } } generic_item = proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, length, "Encrypted PDU (%u bytes)", length); @@ -986,7 +986,7 @@ void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, proto proto_tree_add_protocol_format(tree, proto_mac_header_generic_decoder, tvb, offset, length, "Error - the frame is too short (%u bytes)", length); return; } - length -= sizeof(mac_crc); + length -= (int)sizeof(mac_crc); } while (length > 0) { @@ -1029,10 +1029,10 @@ void dissect_mac_header_generic_decoder(tvbuff_t *tvb, packet_info *pinfo, proto while (pinfo->fd->num > cid_adj_array_size) { cid_adj_array_size += 1024; - cid_adj_array = g_realloc(cid_adj_array, sizeof(guint) * cid_adj_array_size); - frag_num_array = g_realloc(frag_num_array, sizeof(guint8) * cid_adj_array_size); + cid_adj_array = g_realloc(cid_adj_array, (int)sizeof(guint) * cid_adj_array_size); + frag_num_array = g_realloc(frag_num_array, (int)sizeof(guint8) * cid_adj_array_size); /* Clear the added memory */ - memset(&cid_adj_array[cid_adj_array_size - 1024], 0, sizeof(guint) * 1024); + memset(&cid_adj_array[cid_adj_array_size - 1024], 0, (int)sizeof(guint) * 1024); } if (first_gmh) { @@ -1220,11 +1220,11 @@ check_crc: /* check the length */ if (MIN(tvb_len, tvb_reported_length(tvb)) >= mac_len) { /* get the CRC */ - mac_crc = tvb_get_ntohl(tvb, mac_len - sizeof(mac_crc)); + mac_crc = tvb_get_ntohl(tvb, mac_len - (int)sizeof(mac_crc)); /* calculate the CRC */ - calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, mac_len - sizeof(mac_crc)), mac_len - sizeof(mac_crc)); + calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, mac_len - (int)sizeof(mac_crc)), mac_len - (int)sizeof(mac_crc)); /* display the CRC */ - generic_item = proto_tree_add_item(tree, hf_mac_header_generic_crc, tvb, mac_len - sizeof(mac_crc), sizeof(mac_crc), ENC_BIG_ENDIAN); + generic_item = proto_tree_add_item(tree, hf_mac_header_generic_crc, tvb, mac_len - (int)sizeof(mac_crc), (int)sizeof(mac_crc), ENC_BIG_ENDIAN); if (mac_crc != calculated_crc) { proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); diff --git a/plugins/wimax/msg_dlmap.c b/plugins/wimax/msg_dlmap.c index 91ca190284..ba51129b0c 100644 --- a/plugins/wimax/msg_dlmap.c +++ b/plugins/wimax/msg_dlmap.c @@ -2180,7 +2180,7 @@ gint wimax_decode_dlmapc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *base_tre ti_dlmap_ies = proto_tree_add_text(tree, tvb, offset, length, "DL-MAP IEs (%d bytes)", length); ie_tree = proto_item_add_subtree(ti_dlmap_ies, ett_dlmap_ie); - /* length = BYTE_TO_NIB(mac_len - sizeof(mac_crc) - 1); */ /* convert length to nibbles */ + /* length = BYTE_TO_NIB(mac_len - (int)sizeof(mac_crc) - 1); */ /* convert length to nibbles */ while (dl_ie_count--) { nib += dissect_dlmap_ie(ie_tree, bufptr, nib, tvb_len * 2, tvb); @@ -2212,11 +2212,11 @@ gint wimax_decode_dlmapc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *base_tre /* check the length */ if (MIN(tvb_len, tvb_reported_length(tvb)) >= mac_len) { /* get the CRC */ - mac_crc = tvb_get_ntohl(tvb, mac_len - sizeof(mac_crc)); + mac_crc = tvb_get_ntohl(tvb, mac_len - (int)sizeof(mac_crc)); /* calculate the CRC */ - calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, mac_len - sizeof(mac_crc)), mac_len - sizeof(mac_crc)); + calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, mac_len - (int)sizeof(mac_crc)), mac_len - (int)sizeof(mac_crc)); /* display the CRC */ - generic_item = proto_tree_add_item(base_tree, hf_mac_header_compress_dlmap_crc, tvb, mac_len - sizeof(mac_crc), sizeof(mac_crc), ENC_BIG_ENDIAN); + generic_item = proto_tree_add_item(base_tree, hf_mac_header_compress_dlmap_crc, tvb, mac_len - (int)sizeof(mac_crc), (int)sizeof(mac_crc), ENC_BIG_ENDIAN); if (mac_crc != calculated_crc) { proto_item_append_text(generic_item, " - incorrect! (should be: 0x%x)", calculated_crc); diff --git a/plugins/wimax/packet-wmx.c b/plugins/wimax/packet-wmx.c index fbb4a7b540..d1574e2f34 100644 --- a/plugins/wimax/packet-wmx.c +++ b/plugins/wimax/packet-wmx.c @@ -597,11 +597,11 @@ static gint ett_wimax_cdma = -1; static gint ett_wimax_ffb = -1; #endif -static gchar *tlv_val_1byte = "TLV value: %s (0x%02x)"; -static gchar *tlv_val_2byte = "TLV value: %s (0x%04x)"; -static gchar *tlv_val_3byte = "TLV value: %s (0x%06x)"; -static gchar *tlv_val_4byte = "TLV value: %s (0x%08x)"; -static gchar *tlv_val_5byte = "TLV value: %s (0x%08x...)"; +static const gchar tlv_val_1byte[] = "TLV value: %s (0x%02x)"; +static const gchar tlv_val_2byte[] = "TLV value: %s (0x%04x)"; +static const gchar tlv_val_3byte[] = "TLV value: %s (0x%06x)"; +static const gchar tlv_val_4byte[] = "TLV value: %s (0x%08x)"; +static const gchar tlv_val_5byte[] = "TLV value: %s (0x%08x...)"; /*************************************************************/ /* add_tlv_subtree() */ @@ -627,7 +627,7 @@ proto_tree *add_tlv_subtree(tlv_info_t *this, gint idx, proto_tree *tree, int hf guint8 size_of_tlv_length_field; guint8 tlv_type; guint32 tlv_value; - gchar *hex_fmt; + const gchar *hex_fmt; /* Retrieve the necessary TLV information */ tlv_val_offset = get_tlv_value_offset(this); @@ -719,7 +719,7 @@ proto_tree *add_protocol_subtree(tlv_info_t *this, gint idx, proto_tree *tree, i guint32 tlv_value; va_list ap; /* points to each unnamed arg in turn */ gchar *message = NULL; - gchar *hex_fmt; + const gchar *hex_fmt; /* Retrieve the necessary TLV information */ tlv_val_offset = get_tlv_value_offset(this); diff --git a/plugins/wimax/wimax_harq_map_decoder.c b/plugins/wimax/wimax_harq_map_decoder.c index 3904e1d2d4..b601b76bef 100644 --- a/plugins/wimax/wimax_harq_map_decoder.c +++ b/plugins/wimax/wimax_harq_map_decoder.c @@ -140,7 +140,7 @@ void dissector_wimax_harq_map_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_t { /* add the UL-MAp IEs info */ proto_item_append_text(parent_item, ",UL-MAP IEs"); /* process the compact ul_map ies */ - while(offset < (length - sizeof(harq_map_msg_crc))) + while(offset < (length - (int)sizeof(harq_map_msg_crc))) { /* decode Compact UL-MAP IEs */ ie_length = wimax_compact_ulmap_ie_decoder(harq_map_tree, pinfo, tvb, offset, nibble_offset); /* Prevent endless loop with erroneous data. */ @@ -160,11 +160,11 @@ void dissector_wimax_harq_map_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_t /* add the CRC info */ proto_item_append_text(parent_item, ",CRC"); /* get the CRC */ - harq_map_msg_crc = tvb_get_ntohl(tvb, length - sizeof(harq_map_msg_crc)); + harq_map_msg_crc = tvb_get_ntohl(tvb, length - (int)sizeof(harq_map_msg_crc)); /* calculate the HARQ MAM Message CRC */ - calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, length - sizeof(harq_map_msg_crc)), length - sizeof(harq_map_msg_crc)); + calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, length - (int)sizeof(harq_map_msg_crc)), length - (int)sizeof(harq_map_msg_crc)); /* display the CRC */ - it = proto_tree_add_item(harq_map_tree, hf_harq_map_msg_crc, tvb, length - sizeof(harq_map_msg_crc), sizeof(harq_map_msg_crc), ENC_BIG_ENDIAN); + it = proto_tree_add_item(harq_map_tree, hf_harq_map_msg_crc, tvb, length - (int)sizeof(harq_map_msg_crc), (int)sizeof(harq_map_msg_crc), ENC_BIG_ENDIAN); /* verify the CRC */ if (harq_map_msg_crc != calculated_crc) { diff --git a/plugins/wimaxasncp/packet-wimaxasncp.c b/plugins/wimaxasncp/packet-wimaxasncp.c index b56102e571..f907b078c8 100644 --- a/plugins/wimaxasncp/packet-wimaxasncp.c +++ b/plugins/wimaxasncp/packet-wimaxasncp.c @@ -1972,7 +1972,7 @@ static guint dissect_wimaxasncp_backend( guint offset = 0; guint16 ui16; guint32 ui32; - guint8 *pmsid; + const guint8 *pmsid; guint16 tid = 0; gboolean dbit_show; @@ -2518,7 +2518,7 @@ static void add_tlv_reg_info( { char *name; char *abbrev; - char *blurb; + const char *blurb; /* ------------------------------------------------------------------------ * add root reg info @@ -2627,32 +2627,25 @@ static void add_tlv_reg_info( break; case WIMAXASNCP_TLV_ID: - g_free(name); g_free(abbrev); - name = "IPv4 Address"; - abbrev = alnumerize( g_strdup_printf("wimaxasncp.tlv.%s.ipv4_value", tlv->name)); add_reg_info( - &tlv->hf_ipv4, name, abbrev, FT_IPv4, BASE_NONE, blurb); - - name = "IPv6 Address"; + &tlv->hf_ipv4, "IPv4 Address", abbrev, FT_IPv4, BASE_NONE, blurb); abbrev = alnumerize( g_strdup_printf("wimaxasncp.tlv.%s.ipv6_value", tlv->name)); add_reg_info( - &tlv->hf_ipv6, name, abbrev, FT_IPv6, BASE_NONE, blurb); - - name = "BS ID"; + &tlv->hf_ipv6, "IPv6 Address", abbrev, FT_IPv6, BASE_NONE, blurb); abbrev = alnumerize( g_strdup_printf("wimaxasncp.tlv.%s.bsid_value", tlv->name)); add_reg_info( - &tlv->hf_bsid, name, abbrev, FT_ETHER, BASE_NONE, blurb); + &tlv->hf_bsid, "BS ID", abbrev, FT_ETHER, BASE_NONE, blurb); break; @@ -2687,24 +2680,19 @@ static void add_tlv_reg_info( break; case WIMAXASNCP_TLV_IP_ADDRESS: - g_free(name); g_free(abbrev); - name = "IPv4 Address"; - abbrev = alnumerize( g_strdup_printf("wimaxasncp.tlv.%s.ipv4_value", tlv->name)); add_reg_info( - &tlv->hf_ipv4, name, abbrev, FT_IPv4, BASE_NONE, blurb); - - name = "IPv6 Address"; + &tlv->hf_ipv4, "IPv4 Address", abbrev, FT_IPv4, BASE_NONE, blurb); abbrev = alnumerize( g_strdup_printf("wimaxasncp.tlv.%s.ipv6_value", tlv->name)); add_reg_info( - &tlv->hf_ipv6, name, abbrev, FT_IPv6, BASE_NONE, blurb); + &tlv->hf_ipv6, "IPv6 Address", abbrev, FT_IPv6, BASE_NONE, blurb); break; diff --git a/plugins/wimaxasncp/wimaxasncp_dict.l b/plugins/wimaxasncp/wimaxasncp_dict.l index 71259ef51c..9c55a79d97 100644 --- a/plugins/wimaxasncp/wimaxasncp_dict.l +++ b/plugins/wimaxasncp/wimaxasncp_dict.l @@ -85,7 +85,7 @@ typedef struct entity_t { #define MAX_INCLUDE_DEPTH 10 #define YY_INPUT(buf,result,max_size) { result = current_yyinput(buf,max_size); } #define ECHO -#define APPEND(txt,len) append_to_buffer(txt,len) +#define APPEND(txt,len) append_to_buffer(txt,(int)len) static entity_t ents; static YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; @@ -108,7 +108,7 @@ static gint16 *attr_uint16; static guint wimaxasncp_bits(guint bits, char *n); static gint wimaxasncp_decode_type(const gchar *name); static void wimaxasncp_dict_debug(const gchar *fmt, ...); -static void append_to_buffer(gchar *txt, int len); +static void append_to_buffer(const gchar *txt, int len); static FILE *wimaxasncp_dict_open(const gchar*, const gchar*); static GString *dict_error = NULL; @@ -313,7 +313,7 @@ since_attr since=\042 } {number} { - *attr_uint = strtoul(yytext,NULL,0); + *attr_uint = (guint)strtoul(yytext,NULL,0); D(("%s\n",yytext);); attr_uint = NULL; BEGIN END_ATTR; @@ -531,7 +531,7 @@ void wimaxasncp_dict_unused(void) { yy_top_state(); } -static void append_to_buffer(gchar *txt, int len) { +static void append_to_buffer(const gchar *txt, int len) { if (strbuf == NULL) { read_ptr = write_ptr = strbuf = g_malloc(size_strbuf); diff --git a/rawshark.c b/rawshark.c index e0eba8605b..186082da03 100644 --- a/rawshark.c +++ b/rawshark.c @@ -810,10 +810,10 @@ main(int argc, char *argv[]) /* Do we need to PCAP header and magic? */ if (skip_pcap_header) { - guint bytes_left = sizeof(struct pcap_hdr) + sizeof(guint32); + size_t bytes_left = sizeof(struct pcap_hdr) + sizeof(guint32); gchar buf[sizeof(struct pcap_hdr) + sizeof(guint32)]; - while (bytes_left > 0) { - guint bytes = read(fd, buf, bytes_left); + while (bytes_left != 0) { + ssize_t bytes = read(fd, buf, bytes_left); if (bytes <= 0) { cmdarg_err("Not enough bytes for pcap header."); exit(2); @@ -884,8 +884,8 @@ static gboolean raw_pipe_read(struct wtap_pkthdr *phdr, guchar * pd, int *err, const gchar **err_info, gint64 *data_offset) { struct pcap_pkthdr mem_hdr; struct pcaprec_hdr disk_hdr; - int bytes_read = 0; - int bytes_needed = sizeof(disk_hdr); + ssize_t bytes_read = 0; + size_t bytes_needed = sizeof(disk_hdr); guchar *ptr = (guchar*) &disk_hdr; static gchar err_str[100]; @@ -913,14 +913,15 @@ raw_pipe_read(struct wtap_pkthdr *phdr, guchar * pd, int *err, const gchar **err if (want_pcap_pkthdr) { phdr->ts.secs = mem_hdr.ts.tv_sec; phdr->ts.nsecs = mem_hdr.ts.tv_usec * 1000; - phdr->caplen = bytes_needed = mem_hdr.caplen; + phdr->caplen = mem_hdr.caplen; phdr->len = mem_hdr.len; } else { phdr->ts.secs = disk_hdr.ts_sec; phdr->ts.nsecs = disk_hdr.ts_usec * 1000; - phdr->caplen = bytes_needed = disk_hdr.incl_len; + phdr->caplen = disk_hdr.incl_len; phdr->len = disk_hdr.orig_len; } + bytes_needed = phdr->caplen; phdr->pkt_encap = encap; @@ -932,7 +933,8 @@ raw_pipe_read(struct wtap_pkthdr *phdr, guchar * pd, int *err, const gchar **err #endif if (bytes_needed > WTAP_MAX_PACKET_SIZE) { *err = WTAP_ERR_BAD_FILE; - g_snprintf(err_str, 100, "Bad packet length: %d (%04x)", bytes_needed, bytes_needed); + g_snprintf(err_str, 100, "Bad packet length: %lu\n", + (unsigned long) bytes_needed); *err_info = err_str; return FALSE; } diff --git a/recent.c b/recent.c index db40d9d169..d66759672f 100644 --- a/recent.c +++ b/recent.c @@ -424,7 +424,7 @@ write_recent_geom(gpointer key _U_, gpointer value, gpointer rf) /* set one user's recent common file key/value pair */ static prefs_set_pref_e -read_set_recent_common_pair_static(gchar *key, gchar *value, +read_set_recent_common_pair_static(gchar *key, const gchar *value, void *private_data _U_, gboolean return_range_errors _U_) { @@ -443,33 +443,33 @@ read_set_recent_common_pair_static(gchar *key, gchar *value, num = strtol(value, &p, 0); if (p == value || *p != '\0') return PREFS_SET_SYNTAX_ERR; /* number was bad */ - recent.gui_geometry_main_x = num; + recent.gui_geometry_main_x = (gint)num; } else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_Y) == 0) { num = strtol(value, &p, 0); if (p == value || *p != '\0') return PREFS_SET_SYNTAX_ERR; /* number was bad */ - recent.gui_geometry_main_y = num; + recent.gui_geometry_main_y = (gint)num; } else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_WIDTH) == 0) { num = strtol(value, &p, 0); if (p == value || *p != '\0') return PREFS_SET_SYNTAX_ERR; /* number was bad */ if (num <= 0) return PREFS_SET_SYNTAX_ERR; /* number must be positive */ - recent.gui_geometry_main_width = num; + recent.gui_geometry_main_width = (gint)num; } else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_HEIGHT) == 0) { num = strtol(value, &p, 0); if (p == value || *p != '\0') return PREFS_SET_SYNTAX_ERR; /* number was bad */ if (num <= 0) return PREFS_SET_SYNTAX_ERR; /* number must be positive */ - recent.gui_geometry_main_height = num; + recent.gui_geometry_main_height = (gint)num; } else if (strcmp(key, RECENT_GUI_GEOMETRY_STATUS_PANE_RIGHT) == 0) { num = strtol(value, &p, 0); if (p == value || *p != '\0') return PREFS_SET_SYNTAX_ERR; /* number was bad */ if (num <= 0) return PREFS_SET_SYNTAX_ERR; /* number must be positive */ - recent.gui_geometry_status_pane_right = num; + recent.gui_geometry_status_pane_right = (gint)num; recent.has_gui_geometry_status_pane = TRUE; } else if (strcmp(key, RECENT_GUI_GEOMETRY_STATUS_PANE_LEFT) == 0) { num = strtol(value, &p, 0); @@ -477,7 +477,7 @@ read_set_recent_common_pair_static(gchar *key, gchar *value, return PREFS_SET_SYNTAX_ERR; /* number was bad */ if (num <= 0) return PREFS_SET_SYNTAX_ERR; /* number must be positive */ - recent.gui_geometry_status_pane_left = num; + recent.gui_geometry_status_pane_left = (gint)num; recent.has_gui_geometry_status_pane = TRUE; } else if (strcmp(key, RECENT_LAST_USED_PROFILE) == 0) { if ((strcmp(value, DEFAULT_PROFILE) != 0) && profile_exists (value, FALSE)) { @@ -489,7 +489,7 @@ read_set_recent_common_pair_static(gchar *key, gchar *value, return PREFS_SET_SYNTAX_ERR; /* number was bad */ if (num <= 0) return PREFS_SET_SYNTAX_ERR; /* number must be positive */ - recent.gui_geometry_wlan_stats_pane = num; + recent.gui_geometry_wlan_stats_pane = (gint)num; } else if (strncmp(key, RECENT_GUI_GEOMETRY, sizeof(RECENT_GUI_GEOMETRY)-1) == 0) { /* now have something like "gui.geom.main.x", split it into win and sub_key */ char *win = &key[sizeof(RECENT_GUI_GEOMETRY)-1]; @@ -520,7 +520,8 @@ read_set_recent_common_pair_static(gchar *key, gchar *value, /* set one user's recent file key/value pair */ static prefs_set_pref_e -read_set_recent_pair_static(gchar *key, gchar *value, void *private_data _U_, +read_set_recent_pair_static(gchar *key, const gchar *value, + void *private_data _U_, gboolean return_range_errors _U_) { long num; @@ -607,12 +608,12 @@ read_set_recent_pair_static(gchar *key, gchar *value, void *private_data _U_, num = strtol(value, &p, 0); if (p == value || *p != '\0') return PREFS_SET_SYNTAX_ERR; /* number was bad */ - recent.gui_zoom_level = num; + recent.gui_zoom_level = (gint)num; } else if (strcmp(key, RECENT_GUI_BYTES_VIEW) == 0) { num = strtol(value, &p, 0); if (p == value || *p != '\0') return PREFS_SET_SYNTAX_ERR; /* number was bad */ - recent.gui_bytes_view = num; + recent.gui_bytes_view = (gint)num; } else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_MAXIMIZED) == 0) { if (g_ascii_strcasecmp(value, "true") == 0) { recent.gui_geometry_main_maximized = TRUE; @@ -627,7 +628,7 @@ read_set_recent_pair_static(gchar *key, gchar *value, void *private_data _U_, return PREFS_SET_SYNTAX_ERR; /* number was bad */ if (num <= 0) return PREFS_SET_SYNTAX_ERR; /* number must be positive */ - recent.gui_geometry_main_upper_pane = num; + recent.gui_geometry_main_upper_pane = (gint)num; recent.has_gui_geometry_main_upper_pane = TRUE; } else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_LOWER_PANE) == 0) { num = strtol(value, &p, 0); @@ -635,7 +636,7 @@ read_set_recent_pair_static(gchar *key, gchar *value, void *private_data _U_, return PREFS_SET_SYNTAX_ERR; /* number was bad */ if (num <= 0) return PREFS_SET_SYNTAX_ERR; /* number must be positive */ - recent.gui_geometry_main_lower_pane = num; + recent.gui_geometry_main_lower_pane = (gint)num; recent.has_gui_geometry_main_lower_pane = TRUE; } else if (strcmp(key, RECENT_KEY_COL_WIDTH) == 0) { @@ -693,7 +694,7 @@ read_set_recent_pair_static(gchar *key, gchar *value, void *private_data _U_, } col_l_elt = col_l_elt->next; - cfmt->width = strtol(col_l_elt->data, &p, 0); + cfmt->width = (gint)strtol(col_l_elt->data, &p, 0); if (p == col_l_elt->data || (*p != '\0' && *p != ':')) { g_free(cfmt->cfield); g_free(cfmt); @@ -723,7 +724,8 @@ read_set_recent_pair_static(gchar *key, gchar *value, void *private_data _U_, /* set one user's recent file key/value pair */ static prefs_set_pref_e -read_set_recent_pair_dynamic(gchar *key, gchar *value, void *private_data _U_, +read_set_recent_pair_dynamic(gchar *key, const gchar *value, + void *private_data _U_, gboolean return_range_errors _U_) { if (!isprint_string(value)) { diff --git a/summary.h b/summary.h index d467796a0d..a0f49c009a 100644 --- a/summary.h +++ b/summary.h @@ -77,7 +77,7 @@ typedef struct _summary_tally { gchar *opt_comment; /**< comment from SHB block */ gchar *shb_hardware; /**< Capture HW from SHB block */ gchar *shb_os; /**< The OS the capture was made on from SHB block */ - gchar *shb_user_appl; /**< The application that made the capture from SHB block */ + const gchar *shb_user_appl; /**< The application that made the capture from SHB block */ /* capture related, use summary_fill_in_capture() to get values */ GArray *ifaces; gboolean legacy; diff --git a/sync_pipe.h b/sync_pipe.h index 87045ea4e7..e35ee99dce 100644 --- a/sync_pipe.h +++ b/sync_pipe.h @@ -63,7 +63,7 @@ #define SP_QUIT 'Q' /* "gracefully" capture quit message (SIGUSR1) */ /* write a single message header to the recipient pipe */ -extern int +extern size_t pipe_write_header(int pipe_fd, char indicator, int length); /* write a message to the recipient pipe in the standard format diff --git a/sync_pipe_write.c b/sync_pipe_write.c index c301da7e5c..40bb2c1ce8 100644 --- a/sync_pipe_write.c +++ b/sync_pipe_write.c @@ -43,7 +43,7 @@ /* write a single message header to the recipient pipe */ -int +size_t pipe_write_header(int pipe_fd, char indicator, int length) { guchar header[1+3]; /* indicator + 3-byte len */ @@ -69,7 +69,7 @@ pipe_write_header(int pipe_fd, char indicator, int length) void pipe_write_block(int pipe_fd, char indicator, const char *msg) { - int ret; + ssize_t ret; int len; /*g_warning("write %d enter", pipe_fd);*/ @@ -89,7 +89,7 @@ pipe_write_block(int pipe_fd, char indicator, const char *msg) /* write value (if we have one) */ if(len) { /*g_warning("write %d indicator: %c value len: %u msg: %s", pipe_fd, indicator, len, msg);*/ - ret = (int) write(pipe_fd, msg, len); + ret = write(pipe_fd, msg, len); if(ret == -1) { return; } diff --git a/text2pcap.c b/text2pcap.c index e01c7ed6c0..39575e5c9b 100644 --- a/text2pcap.c +++ b/text2pcap.c @@ -153,7 +153,7 @@ static int quiet = FALSE; /* Dummy Ethernet header */ static int hdr_ethernet = FALSE; -static unsigned long hdr_ethernet_proto = 0; +static guint32 hdr_ethernet_proto = 0; /* Dummy IP header */ static int hdr_ip = FALSE; @@ -161,26 +161,26 @@ static long hdr_ip_proto = 0; /* Dummy UDP header */ static int hdr_udp = FALSE; -static unsigned long hdr_dest_port = 0; -static unsigned long hdr_src_port = 0; +static guint32 hdr_dest_port = 0; +static guint32 hdr_src_port = 0; /* Dummy TCP header */ static int hdr_tcp = FALSE; /* Dummy SCTP header */ static int hdr_sctp = FALSE; -static unsigned long hdr_sctp_src = 0; -static unsigned long hdr_sctp_dest = 0; -static unsigned long hdr_sctp_tag = 0; +static guint32 hdr_sctp_src = 0; +static guint32 hdr_sctp_dest = 0; +static guint32 hdr_sctp_tag = 0; /* Dummy DATA chunk header */ static int hdr_data_chunk = FALSE; -static unsigned char hdr_data_chunk_type = 0; -static unsigned char hdr_data_chunk_bits = 0; -static unsigned long hdr_data_chunk_tsn = 0; -static unsigned short hdr_data_chunk_sid = 0; -static unsigned short hdr_data_chunk_ssn = 0; -static unsigned long hdr_data_chunk_ppid = 0; +static guint8 hdr_data_chunk_type = 0; +static guint8 hdr_data_chunk_bits = 0; +static guint32 hdr_data_chunk_tsn = 0; +static guint16 hdr_data_chunk_sid = 0; +static guint16 hdr_data_chunk_ssn = 0; +static guint32 hdr_data_chunk_ppid = 0; /* ASCII text dump identification */ static int identify_ascii = FALSE; @@ -192,23 +192,23 @@ static guint32 direction = 0; /* This is where we store the packet currently being built */ #define MAX_PACKET 64000 -static unsigned char packet_buf[MAX_PACKET]; -static unsigned long header_length; -static unsigned long ip_offset; -static unsigned long curr_offset; -static unsigned long max_offset = MAX_PACKET; -static unsigned long packet_start = 0; +static guint8 packet_buf[MAX_PACKET]; +static guint32 header_length; +static guint32 ip_offset; +static guint32 curr_offset; +static guint32 max_offset = MAX_PACKET; +static guint32 packet_start = 0; static void start_new_packet(gboolean); /* This buffer contains strings present before the packet offset 0 */ #define PACKET_PREAMBLE_MAX_LEN 2048 -static unsigned char packet_preamble[PACKET_PREAMBLE_MAX_LEN+1]; +static guint8 packet_preamble[PACKET_PREAMBLE_MAX_LEN+1]; static int packet_preamble_len = 0; /* Number of packets read and written */ -static unsigned long num_packets_read = 0; -static unsigned long num_packets_written = 0; -static long bytes_written = 0; +static guint32 num_packets_read = 0; +static guint32 num_packets_written = 0; +static guint64 bytes_written = 0; /* Time code of packet, derived from packet_preamble */ static time_t ts_sec = 0; @@ -216,7 +216,7 @@ static guint32 ts_usec = 0; static char *ts_fmt = NULL; static struct tm timecode_default; -static unsigned char* pkt_lnstart; +static guint8* pkt_lnstart; /* Input file */ static const char *input_filename; @@ -226,7 +226,7 @@ static const char *output_filename; static FILE *output_file = NULL; /* Offset base to parse */ -static unsigned long offset_base = 16; +static guint32 offset_base = 16; extern FILE *yyin; @@ -371,20 +371,20 @@ struct pcaprec_hdr { }; /* Link-layer type; see net/bpf.h for details */ -static unsigned long pcap_link_type = 1; /* Default is DLT-EN10MB */ +static guint32 pcap_link_type = 1; /* Default is DLT-EN10MB */ /*---------------------------------------------------------------------- * Parse a single hex number * Will abort the program if it can't parse the number * Pass in TRUE if this is an offset, FALSE if not */ -static unsigned long +static guint32 parse_num (const char *str, int offset) { - unsigned long num; + guint32 num; char *c; - num = strtoul(str, &c, offset ? offset_base : 16); + num = (guint32)strtoul(str, &c, offset ? offset_base : 16); if (c==str) { fprintf(stderr, "FATAL ERROR: Bad hex number? [%s]\n", str); exit(-1); @@ -398,10 +398,10 @@ parse_num (const char *str, int offset) static void write_byte (const char *str) { - unsigned long num; + guint32 num; num = parse_num(str, FALSE); - packet_buf[curr_offset] = (unsigned char) num; + packet_buf[curr_offset] = (guint8) num; curr_offset ++; if (curr_offset - header_length >= max_offset) /* packet full */ start_new_packet(TRUE); @@ -412,9 +412,9 @@ write_byte (const char *str) */ static void -write_bytes(const char bytes[], unsigned long nbytes) +write_bytes(const char bytes[], guint32 nbytes) { - unsigned long i; + guint32 i; if (curr_offset + nbytes < MAX_PACKET) { for (i = 0; i < nbytes; i++) { @@ -428,7 +428,7 @@ write_bytes(const char bytes[], unsigned long nbytes) * Remove bytes from the current packet */ static void -unwrite_bytes (unsigned long nbytes) +unwrite_bytes (guint32 nbytes) { curr_offset -= nbytes; } @@ -437,9 +437,9 @@ unwrite_bytes (unsigned long nbytes) * Compute one's complement checksum (from RFC1071) */ static guint16 -in_checksum (void *buf, unsigned long count) +in_checksum (void *buf, guint32 count) { - unsigned long sum = 0; + guint32 sum = 0; guint16 *addr = buf; while (count > 1) { @@ -563,7 +563,7 @@ finalize_crc32c(guint32 crc32) } static guint16 -number_of_padding_bytes (unsigned long length) +number_of_padding_bytes (guint32 length) { guint16 remainder; @@ -581,7 +581,7 @@ number_of_padding_bytes (unsigned long length) static void write_current_packet(gboolean cont) { - unsigned long length = 0; + guint32 length = 0; guint16 padding_length = 0; int err; gboolean success; @@ -767,7 +767,7 @@ write_current_packet(gboolean cont) ts_usec++; } if (!quiet) { - fprintf(stderr, "Wrote packet of %lu bytes.\n", length); + fprintf(stderr, "Wrote packet of %u bytes.\n", length); } num_packets_written ++; } @@ -788,9 +788,9 @@ write_file_header (void) if (use_pcapng) { #ifdef SVNVERSION - char *appname = "text2pcap (" SVNVERSION " from " SVNPATH ")"; + const char *appname = "text2pcap (" SVNVERSION " from " SVNPATH ")"; #else - char *appname = "text2pcap"; + const char *appname = "text2pcap"; #endif char comment[100]; @@ -980,7 +980,7 @@ parse_preamble (void) ts_usec = 0; } else { /* Parse subseconds */ - ts_usec = strtol(subsecs, &p, 10); + ts_usec = (guint32)strtol(subsecs, &p, 10); if (subsecs == p) { /* Error */ ts_usec = 0; @@ -1053,7 +1053,7 @@ process_directive (char *str) void parse_token (token_t token, char *str) { - unsigned long num; + guint32 num; int by_eol; int rollback = 0; int line_size; @@ -1139,7 +1139,7 @@ parse_token (token_t token, char *str) } else { /* Bad offset; switch to INIT state */ if (debug >= 1) - fprintf(stderr, "Inconsistent offset. Expecting %0lX, got %0lX. Ignoring rest of packet\n", + fprintf(stderr, "Inconsistent offset. Expecting %0X, got %0X. Ignoring rest of packet\n", curr_offset, num); write_current_packet(FALSE); state = INIT; @@ -1379,8 +1379,8 @@ parse_options (int argc, char *argv[]) case 'd': if (!quiet) debug++; break; case 'D': has_direction = TRUE; break; case 'q': quiet = TRUE; debug = FALSE; break; - case 'l': pcap_link_type = strtol(optarg, NULL, 0); break; - case 'm': max_offset = strtol(optarg, NULL, 0); break; + case 'l': pcap_link_type = (guint32)strtol(optarg, NULL, 0); break; + case 'm': max_offset = (guint32)strtol(optarg, NULL, 0); break; case 'n': use_pcapng = TRUE; break; case 'o': if (optarg[0]!='h' && optarg[0] != 'o' && optarg[0] != 'd') { @@ -1395,7 +1395,7 @@ parse_options (int argc, char *argv[]) break; case 'e': hdr_ethernet = TRUE; - if (sscanf(optarg, "%lx", &hdr_ethernet_proto) < 1) { + if (sscanf(optarg, "%x", &hdr_ethernet_proto) < 1) { fprintf(stderr, "Bad argument for '-e': %s\n", optarg); usage(); } @@ -1418,7 +1418,7 @@ parse_options (int argc, char *argv[]) hdr_data_chunk = FALSE; hdr_tcp = FALSE; hdr_udp = FALSE; - hdr_sctp_src = strtol(optarg, &p, 10); + hdr_sctp_src = (guint32)strtol(optarg, &p, 10); if (p == optarg || (*p != ',' && *p != '\0')) { fprintf(stderr, "Bad src port for '-%c'\n", c); usage(); @@ -1429,7 +1429,7 @@ parse_options (int argc, char *argv[]) } p++; optarg = p; - hdr_sctp_dest = strtol(optarg, &p, 10); + hdr_sctp_dest = (guint32)strtol(optarg, &p, 10); if (p == optarg || (*p != ',' && *p != '\0')) { fprintf(stderr, "Bad dest port for '-s'\n"); usage(); @@ -1440,7 +1440,7 @@ parse_options (int argc, char *argv[]) } p++; optarg = p; - hdr_sctp_tag = strtol(optarg, &p, 10); + hdr_sctp_tag = (guint32)strtol(optarg, &p, 10); if (p == optarg || *p != '\0') { fprintf(stderr, "Bad tag for '-%c'\n", c); usage(); @@ -1456,7 +1456,7 @@ parse_options (int argc, char *argv[]) hdr_data_chunk = TRUE; hdr_tcp = FALSE; hdr_udp = FALSE; - hdr_sctp_src = strtol(optarg, &p, 10); + hdr_sctp_src = (guint32)strtol(optarg, &p, 10); if (p == optarg || (*p != ',' && *p != '\0')) { fprintf(stderr, "Bad src port for '-%c'\n", c); usage(); @@ -1467,7 +1467,7 @@ parse_options (int argc, char *argv[]) } p++; optarg = p; - hdr_sctp_dest = strtol(optarg, &p, 10); + hdr_sctp_dest = (guint32)strtol(optarg, &p, 10); if (p == optarg || (*p != ',' && *p != '\0')) { fprintf(stderr, "Bad dest port for '-s'\n"); usage(); @@ -1478,7 +1478,7 @@ parse_options (int argc, char *argv[]) } p++; optarg = p; - hdr_data_chunk_ppid = strtoul(optarg, &p, 10); + hdr_data_chunk_ppid = (guint32)strtoul(optarg, &p, 10); if (p == optarg || *p != '\0') { fprintf(stderr, "Bad ppi for '-%c'\n", c); usage(); @@ -1499,7 +1499,7 @@ parse_options (int argc, char *argv[]) hdr_tcp = FALSE; hdr_sctp = FALSE; hdr_data_chunk = FALSE; - hdr_src_port = strtol(optarg, &p, 10); + hdr_src_port = (guint32)strtol(optarg, &p, 10); if (p == optarg || (*p != ',' && *p != '\0')) { fprintf(stderr, "Bad src port for '-u'\n"); usage(); @@ -1510,7 +1510,7 @@ parse_options (int argc, char *argv[]) } p++; optarg = p; - hdr_dest_port = strtol(optarg, &p, 10); + hdr_dest_port = (guint32)strtol(optarg, &p, 10); if (p == optarg || *p != '\0') { fprintf(stderr, "Bad dest port for '-u'\n"); usage(); @@ -1526,7 +1526,7 @@ parse_options (int argc, char *argv[]) hdr_udp = FALSE; hdr_sctp = FALSE; hdr_data_chunk = FALSE; - hdr_src_port = strtol(optarg, &p, 10); + hdr_src_port = (guint32)strtol(optarg, &p, 10); if (p == optarg || (*p != ',' && *p != '\0')) { fprintf(stderr, "Bad src port for '-T'\n"); usage(); @@ -1537,7 +1537,7 @@ parse_options (int argc, char *argv[]) } p++; optarg = p; - hdr_dest_port = strtol(optarg, &p, 10); + hdr_dest_port = (guint32)strtol(optarg, &p, 10); if (p == optarg || *p != '\0') { fprintf(stderr, "Bad dest port for '-T'\n"); usage(); @@ -1614,17 +1614,17 @@ parse_options (int argc, char *argv[]) fprintf(stderr, "Output to: %s\n", output_filename); fprintf(stderr, "Output format: %s\n", use_pcapng ? "PCAP-NG" : "PCAP"); - if (hdr_ethernet) fprintf(stderr, "Generate dummy Ethernet header: Protocol: 0x%0lX\n", + if (hdr_ethernet) fprintf(stderr, "Generate dummy Ethernet header: Protocol: 0x%0X\n", hdr_ethernet_proto); if (hdr_ip) fprintf(stderr, "Generate dummy IP header: Protocol: %ld\n", hdr_ip_proto); - if (hdr_udp) fprintf(stderr, "Generate dummy UDP header: Source port: %ld. Dest port: %ld\n", + if (hdr_udp) fprintf(stderr, "Generate dummy UDP header: Source port: %u. Dest port: %u\n", hdr_src_port, hdr_dest_port); - if (hdr_tcp) fprintf(stderr, "Generate dummy TCP header: Source port: %ld. Dest port: %ld\n", + if (hdr_tcp) fprintf(stderr, "Generate dummy TCP header: Source port: %u. Dest port: %u\n", hdr_src_port, hdr_dest_port); - if (hdr_sctp) fprintf(stderr, "Generate dummy SCTP header: Source port: %ld. Dest port: %ld. Tag: %ld\n", + if (hdr_sctp) fprintf(stderr, "Generate dummy SCTP header: Source port: %u. Dest port: %u. Tag: %u\n", hdr_sctp_src, hdr_sctp_dest, hdr_sctp_tag); - if (hdr_data_chunk) fprintf(stderr, "Generate dummy DATA chunk header: TSN: %lu. SID: %d. SSN: %d. PPID: %lu\n", + if (hdr_data_chunk) fprintf(stderr, "Generate dummy DATA chunk header: TSN: %u. SID: %d. SSN: %d. PPID: %u\n", hdr_data_chunk_tsn, hdr_data_chunk_sid, hdr_data_chunk_ssn, hdr_data_chunk_ppid); } } @@ -1641,23 +1641,23 @@ main(int argc, char *argv[]) header_length = 0; if (hdr_ethernet) { - header_length += sizeof(HDR_ETHERNET); + header_length += (int)sizeof(HDR_ETHERNET); } if (hdr_ip) { ip_offset = header_length; - header_length += sizeof(HDR_IP); + header_length += (int)sizeof(HDR_IP); } if (hdr_sctp) { - header_length += sizeof(HDR_SCTP); + header_length += (int)sizeof(HDR_SCTP); } if (hdr_data_chunk) { - header_length += sizeof(HDR_DATA_CHUNK); + header_length += (int)sizeof(HDR_DATA_CHUNK); } if (hdr_tcp) { - header_length += sizeof(HDR_TCP); + header_length += (int)sizeof(HDR_TCP); } if (hdr_udp) { - header_length += sizeof(HDR_UDP); + header_length += (int)sizeof(HDR_UDP); } curr_offset = header_length; @@ -1671,7 +1671,7 @@ main(int argc, char *argv[]) if (debug) fprintf(stderr, "\n-------------------------\n"); if (!quiet) { - fprintf(stderr, "Read %ld potential packet%s, wrote %ld packet%s\n", + fprintf(stderr, "Read %u potential packet%s, wrote %u packet%s\n", num_packets_read, (num_packets_read == 1) ? "" : "s", num_packets_written, (num_packets_written == 1) ? "" : "s"); } diff --git a/tshark.c b/tshark.c index b50299d3f6..e5748ef217 100644 --- a/tshark.c +++ b/tshark.c @@ -137,7 +137,7 @@ static print_stream_t *print_stream; static output_fields_t* output_fields = NULL; /* The line separator used between packets, changeable via the -S option */ -static char *separator = ""; +static const char *separator = ""; #ifdef HAVE_LIBPCAP /* diff --git a/u3.c b/u3.c index 7dcf71226f..ace7c9ca2b 100644 --- a/u3.c +++ b/u3.c @@ -57,7 +57,7 @@ static char *pid_file = NULL; static char *u3devicepath = (char*)-1; static gchar *newpath = NULL; -static char *u3_change_path(char *path, const char *old, const char *new); +static const char *u3_change_path(const char *path, const char *old, const char *new); gboolean u3_active(void) { @@ -153,18 +153,18 @@ void u3_deregister_pid(void) } } -char *u3_expand_device_path(char *path) +const char *u3_expand_device_path(const char *path) { return u3_change_path(path, U3_DEVICE_PATH_VAR, NULL); } -char *u3_contract_device_path(char *path) +const char *u3_contract_device_path(char *path) { return u3_change_path(path, NULL, U3_DEVICE_PATH_VAR); } -static char *u3_change_path(char *path, const char *old, const char *new) +static const char *u3_change_path(const char *path, const char *old, const char *new) { if(u3devicepath == (char*)-1) { diff --git a/u3.h b/u3.h index 751d7d2ae6..a083e60bf6 100644 --- a/u3.h +++ b/u3.h @@ -36,8 +36,8 @@ void u3_runtime_info(GString *str); void u3_register_pid(void); void u3_deregister_pid(void); -char * u3_expand_device_path(char *path); -char * u3_contract_device_path(char *path); +const char * u3_expand_device_path(const char *path); +const char * u3_contract_device_path(char *path); #ifdef __cplusplus } diff --git a/ui/cli/tap-bootpstat.c b/ui/cli/tap-bootpstat.c index 00ffbbfff1..af1ed51f8a 100644 --- a/ui/cli/tap-bootpstat.c +++ b/ui/cli/tap-bootpstat.c @@ -123,7 +123,7 @@ dhcpstat_draw(void *psp) printf("BOOTP Option 53: DHCP Messages Types:\n"); printf("DHCP Message Type Packets nb\n" ); g_hash_table_foreach( sp->hash, (GHFunc) dhcp_draw_message_type, - "%23s %-9d\n" ); + (gpointer)"%23s %-9d\n" ); printf("===================================================================\n"); } diff --git a/ui/cli/tap-follow.c b/ui/cli/tap-follow.c index 27720f2153..2ffdc02d0a 100644 --- a/ui/cli/tap-follow.c +++ b/ui/cli/tap-follow.c @@ -519,7 +519,7 @@ followDraw( { while (sc.dlen > 0) { - len = sc.dlen < sizeof bin ? sc.dlen : sizeof bin; + len = sc.dlen < sizeof bin ? sc.dlen : (guint32)sizeof bin; sc.dlen -= len; if (fread(bin, 1, len, fp->filep) != len) { @@ -549,7 +549,7 @@ followDraw( while (sc.dlen > 0) { - len = sc.dlen < sizeof bin ? sc.dlen : sizeof bin; + len = sc.dlen < sizeof bin ? sc.dlen : (guint32)sizeof bin; sc.dlen -= len; if (fread(bin, 1, len, fp->filep) != len) { diff --git a/ui/cli/tap-httpstat.c b/ui/cli/tap-httpstat.c index d10291292a..b2911ed5ec 100644 --- a/ui/cli/tap-httpstat.c +++ b/ui/cli/tap-httpstat.c @@ -266,10 +266,10 @@ httpstat_draw(void *psp ) printf( "* HTTP Status Codes in reply packets\n"); g_hash_table_foreach( sp->hash_responses, (GHFunc)http_draw_hash_responses, - " HTTP %3d %s\n"); + (gpointer)" HTTP %3d %s\n"); printf("* List of HTTP Request methods\n"); g_hash_table_foreach( sp->hash_requests, (GHFunc)http_draw_hash_requests, - " %9s %d \n"); + (gpointer)" %9s %d \n"); printf("===================================================================\n"); } diff --git a/ui/cli/tap-macltestat.c b/ui/cli/tap-macltestat.c index 1f290484aa..79b3170bb9 100644 --- a/ui/cli/tap-macltestat.c +++ b/ui/cli/tap-macltestat.c @@ -412,12 +412,12 @@ static float calculate_bw(nstime_t *start_time, nstime_t *stop_time, guint32 byt /* Only really meaningful if have a few frames spread over time... For now at least avoid dividing by something very close to 0.0 */ if (elapsed_ms < 2.0) { - return 0.0; + return 0.0f; } return ((bytes * 8) / elapsed_ms) / 1000; } else { - return 0.0; + return 0.0f; } } diff --git a/ui/cli/tap-rlcltestat.c b/ui/cli/tap-rlcltestat.c index b9a6ec8f8c..b3d2e3c71d 100644 --- a/ui/cli/tap-rlcltestat.c +++ b/ui/cli/tap-rlcltestat.c @@ -290,12 +290,12 @@ static float calculate_bw(nstime_t *start_time, nstime_t *stop_time, guint32 byt /* Only really meaningful if have a few frames spread over time... For now at least avoid dividing by something very close to 0.0 */ if (elapsed_ms < 2.0) { - return 0.0; + return 0.0f; } return ((bytes * 8) / elapsed_ms) / 1000; } else { - return 0.0; + return 0.0f; } } diff --git a/ui/cli/tap-rtspstat.c b/ui/cli/tap-rtspstat.c index e0de4b8ec6..8e470c7e14 100644 --- a/ui/cli/tap-rtspstat.c +++ b/ui/cli/tap-rtspstat.c @@ -219,10 +219,10 @@ rtspstat_draw(void *psp ) printf( "* RTSP Status Codes in reply packets\n"); g_hash_table_foreach( sp->hash_responses, (GHFunc)rtsp_draw_hash_responses, - " RTSP %3d %s\n"); + (gpointer)" RTSP %3d %s\n"); printf("* List of RTSP Request methods\n"); g_hash_table_foreach( sp->hash_requests, (GHFunc)rtsp_draw_hash_requests, - " %9s %d \n"); + (gpointer)" %9s %d \n"); printf("===================================================================\n"); } diff --git a/ui/cli/tap-sipstat.c b/ui/cli/tap-sipstat.c index cd794aa030..f2dc0d5024 100644 --- a/ui/cli/tap-sipstat.c +++ b/ui/cli/tap-sipstat.c @@ -377,10 +377,10 @@ sipstat_draw(void *psp ) printf("\nNumber of resent SIP messages: %d\n", sp->resent_packets); printf( "\n* SIP Status Codes in reply packets\n"); g_hash_table_foreach( sp->hash_responses, (GHFunc)sip_draw_hash_responses, - " SIP %3d %-15s : %5d Packets\n"); + (gpointer)" SIP %3d %-15s : %5d Packets\n"); printf("\n* List of SIP Request methods\n"); g_hash_table_foreach( sp->hash_requests, (GHFunc)sip_draw_hash_requests, - " %-15s : %5d Packets\n"); + (gpointer)" %-15s : %5d Packets\n"); printf( "\n* Average setup time %d ms\n Min %d ms\n Max %d ms\n", sp->average_setup_time, sp->min_setup_time, sp->max_setup_time); printf("===================================================================\n"); } diff --git a/ui/cli/tap-wspstat.c b/ui/cli/tap-wspstat.c index 82895ec063..e47bb7ba6e 100644 --- a/ui/cli/tap-wspstat.c +++ b/ui/cli/tap-wspstat.c @@ -195,7 +195,7 @@ wspstat_draw(void *psp) printf("\nStatus code in reply packets\n"); printf( "Status Code Packets Description\n"); g_hash_table_foreach( sp->hash, (GHFunc) wsp_print_statuscode, - " 0x%02X %9d %s\n" ) ; + (gpointer)" 0x%02X %9d %s\n" ) ; printf("===================================================================\n"); } diff --git a/ui/export_object_smb.c b/ui/export_object_smb.c index 07d7385079..9153b70787 100644 --- a/ui/export_object_smb.c +++ b/ui/export_object_smb.c @@ -336,9 +336,9 @@ eo_smb_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const match_strval(contains, smb_eo_contains_string)); } else { if (new_file->file_length > 0) { - percent = (gfloat) 100*new_file->data_gathered/new_file->file_length; + percent = (gfloat) (100*new_file->data_gathered/new_file->file_length); } else { - percent = 0.0; + percent = 0.0f; } entry->content_type = @@ -371,7 +371,7 @@ eo_smb_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_, const current_file->file_length, match_strval(current_file->flag_contains, smb_eo_contains_string)); } else { - percent = (gfloat) 100*current_file->data_gathered/current_file->file_length; + percent = (gfloat) (100*current_file->data_gathered/current_file->file_length); current_entry->content_type = g_strdup_printf("%s (%"G_GUINT64_FORMAT"/%"G_GUINT64_FORMAT") %s [%5.2f%%]", match_strval(eo_info->fid_type, smb_fid_types), diff --git a/ui/gtk/airpcap_dlg.c b/ui/gtk/airpcap_dlg.c index 7425364fb4..aea28a8f2f 100644 --- a/ui/gtk/airpcap_dlg.c +++ b/ui/gtk/airpcap_dlg.c @@ -1010,7 +1010,7 @@ on_add_new_key_bt_clicked(GtkWidget *button _U_, gpointer data) gtk_widget_show (add_frame); gtk_box_pack_start (GTK_BOX (main_v_box), add_frame, TRUE, TRUE, 0); - add_frame_al = gtk_alignment_new (0.5, 0.5, 1, 1); + add_frame_al = gtk_alignment_new (0.5f, 0.5f, 1, 1); gtk_widget_set_name (add_frame_al, "add_frame_al"); gtk_widget_show (add_frame_al); gtk_container_add (GTK_CONTAINER (add_frame), add_frame_al); @@ -1228,7 +1228,7 @@ on_edit_key_bt_clicked(GtkWidget *button _U_, gpointer data) gchar *row_type, *row_key, - *row_ssid = ""; + *row_ssid = NULL; airpcap_advanced_w = GTK_WIDGET(data); @@ -1265,7 +1265,7 @@ on_edit_key_bt_clicked(GtkWidget *button _U_, gpointer data) gtk_widget_show (edit_frame); gtk_box_pack_start (GTK_BOX (main_v_box), edit_frame, TRUE, TRUE, 0); - edit_frame_al = gtk_alignment_new (0.5, 0.5, 1, 1); + edit_frame_al = gtk_alignment_new (0.5f, 0.5f, 1, 1); gtk_widget_set_name (edit_frame_al, "edit_frame_al"); gtk_widget_show (edit_frame_al); gtk_container_add (GTK_CONTAINER (edit_frame), edit_frame_al); @@ -1371,7 +1371,7 @@ on_edit_key_bt_clicked(GtkWidget *button _U_, gpointer data) else { gtk_widget_set_sensitive(edit_ssid_te,TRUE); - gtk_entry_set_text(GTK_ENTRY(edit_ssid_te),row_ssid); + gtk_entry_set_text(GTK_ENTRY(edit_ssid_te),row_ssid?row_ssid:""); } /* XXX - Decomment only when WPA and WPA@ will be ready */ @@ -1768,7 +1768,7 @@ display_airpcap_advanced_cb(GtkWidget *w _U_, gpointer data) 0); gtk_container_set_border_width (GTK_CONTAINER (interface_fr), 10); - interface_al = gtk_alignment_new (0.5, 0.5, 1, 1); + interface_al = gtk_alignment_new (0.5f, 0.5f, 1, 1); gtk_widget_set_name (interface_al, "interface_al"); gtk_widget_show (interface_al); gtk_container_add (GTK_CONTAINER (interface_fr), interface_al); @@ -1821,7 +1821,7 @@ display_airpcap_advanced_cb(GtkWidget *w _U_, gpointer data) gtk_box_pack_start (GTK_BOX (settings_sub_box), basic_parameters_fr, TRUE,FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (basic_parameters_fr), 10); - basic_parameters_al = gtk_alignment_new (0.5, 0.5, 1, 1); + basic_parameters_al = gtk_alignment_new (0.5f, 0.5f, 1, 1); gtk_widget_set_name (basic_parameters_al, "basic_parameters_al"); gtk_widget_show (basic_parameters_al); gtk_container_add (GTK_CONTAINER (basic_parameters_fr),basic_parameters_al); @@ -1841,7 +1841,7 @@ display_airpcap_advanced_cb(GtkWidget *w _U_, gpointer data) gtk_table_attach (GTK_TABLE (basic_parameters_tb), channel_lb, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_misc_set_alignment (GTK_MISC (channel_lb), 0, 0.5); + gtk_misc_set_alignment (GTK_MISC (channel_lb), 0, 0.5f); capture_type_lb = gtk_label_new ("Capture Type:"); gtk_widget_set_name (capture_type_lb, "capture_type_lb"); @@ -1849,7 +1849,7 @@ display_airpcap_advanced_cb(GtkWidget *w _U_, gpointer data) gtk_table_attach (GTK_TABLE (basic_parameters_tb), capture_type_lb, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_misc_set_alignment (GTK_MISC (capture_type_lb), 0, 0.5); + gtk_misc_set_alignment (GTK_MISC (capture_type_lb), 0, 0.5f); /* Start: Channel offset label */ channel_offset_lb = gtk_label_new ("Channel Offset:"); @@ -1858,7 +1858,7 @@ display_airpcap_advanced_cb(GtkWidget *w _U_, gpointer data) gtk_table_attach (GTK_TABLE (basic_parameters_tb), channel_offset_lb, 0, 1, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_misc_set_alignment (GTK_MISC (channel_offset_lb), 0, 0.5); + gtk_misc_set_alignment (GTK_MISC (channel_offset_lb), 0, 0.5f); /* End: Channel offset label */ /* Start: Channel offset combo box */ @@ -2151,7 +2151,7 @@ display_airpcap_key_management_cb(GtkWidget *w _U_, gpointer data) gtk_box_pack_start (GTK_BOX (main_box), keys_fr, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (keys_fr), 10); - keys_al = gtk_alignment_new (0.5, 0.5, 1, 1); + keys_al = gtk_alignment_new (0.5f, 0.5f, 1, 1); gtk_widget_set_name (keys_al, "keys_al"); gtk_widget_show (keys_al); gtk_container_add (GTK_CONTAINER (keys_fr), keys_al); @@ -2177,7 +2177,7 @@ display_airpcap_key_management_cb(GtkWidget *w _U_, gpointer data) gtk_table_attach (GTK_TABLE (decryption_mode_tb), decryption_mode_lb, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_misc_set_alignment (GTK_MISC (decryption_mode_lb), 0, 0.5); + gtk_misc_set_alignment (GTK_MISC (decryption_mode_lb), 0, 0.5f); decryption_mode_cb = gtk_combo_box_text_new(); update_decryption_mode_list(decryption_mode_cb); @@ -2753,7 +2753,7 @@ airpcap_keys_check_w(GtkWidget *w, gpointer data _U_) gtk_table_attach (GTK_TABLE (radio_tb), keep_lb, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_misc_set_alignment (GTK_MISC (keep_lb), 0, 0.5); + gtk_misc_set_alignment (GTK_MISC (keep_lb), 0, 0.5f); merge_lb = gtk_label_new ("Merge Wireshark and AirPcap adapter(s) keys."); gtk_widget_set_name (merge_lb, "merge_lb"); @@ -2761,7 +2761,7 @@ airpcap_keys_check_w(GtkWidget *w, gpointer data _U_) gtk_table_attach (GTK_TABLE (radio_tb), merge_lb, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_misc_set_alignment (GTK_MISC (merge_lb), 0, 0.5); + gtk_misc_set_alignment (GTK_MISC (merge_lb), 0, 0.5f); import_lb = gtk_label_new @@ -2771,7 +2771,7 @@ airpcap_keys_check_w(GtkWidget *w, gpointer data _U_) gtk_table_attach (GTK_TABLE (radio_tb), import_lb, 1, 2, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_misc_set_alignment (GTK_MISC (import_lb), 0, 0.5); + gtk_misc_set_alignment (GTK_MISC (import_lb), 0, 0.5f); ignore_lb = gtk_label_new @@ -2782,7 +2782,7 @@ airpcap_keys_check_w(GtkWidget *w, gpointer data _U_) (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_line_wrap (GTK_LABEL (ignore_lb), TRUE); - gtk_misc_set_alignment (GTK_MISC (ignore_lb), 0, 0.5); + gtk_misc_set_alignment (GTK_MISC (ignore_lb), 0, 0.5f); low_h_button_box = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); gtk_widget_set_name (low_h_button_box, "low_h_button_box"); diff --git a/ui/gtk/airpcap_gui_utils.c b/ui/gtk/airpcap_gui_utils.c index 8b10adf949..c33308cde5 100644 --- a/ui/gtk/airpcap_gui_utils.c +++ b/ui/gtk/airpcap_gui_utils.c @@ -269,7 +269,7 @@ airpcap_add_key_to_list(GtkListStore *key_list_store, gchar* type, gchar* key, g void airpcap_fill_key_list(GtkListStore *key_list_store) { - gchar* s = NULL; + const gchar* s = NULL; unsigned int i,n; airpcap_if_info_t* fake_if_info; GList* wireshark_key_list=NULL; @@ -411,7 +411,7 @@ airpcap_get_link_type(const gchar* name) * Returns the string name corresponding to the given AirpcapLinkType, or * NULL in case of error. */ -gchar* +const gchar* airpcap_get_link_name(AirpcapLinkType lt) { if(lt == AIRPCAP_LT_802_11){ @@ -715,7 +715,7 @@ airpcap_add_keys_to_driver_from_list(GtkListStore *key_list_store, airpcap_if_in /* * Calculate the size of the keys collection */ - KeysCollectionSize = sizeof(AirpcapKeysCollection) + keys_in_list * sizeof(AirpcapKey); + KeysCollectionSize = (guint) (sizeof(AirpcapKeysCollection) + keys_in_list * sizeof(AirpcapKey)); /* * Allocate the collection @@ -798,7 +798,7 @@ airpcap_read_and_save_decryption_keys_from_list_store(GtkListStore* key_list_sto char* tmp_type = NULL; char* tmp_key = NULL; - char* tmp_ssid = ""; + char* tmp_ssid = NULL; decryption_key_t* tmp_dk=NULL; @@ -831,7 +831,7 @@ airpcap_read_and_save_decryption_keys_from_list_store(GtkListStore* key_list_sto tmp_dk = (decryption_key_t*)g_malloc(sizeof(decryption_key_t)); tmp_dk->key = g_string_new(tmp_key); tmp_dk->ssid = g_byte_array_new(); - uri_str_to_bytes(tmp_ssid, tmp_dk->ssid); + uri_str_to_bytes(tmp_ssid?tmp_ssid:"", tmp_dk->ssid); tmp_dk->type = AIRPDCAP_KEY_TYPE_WPA_PWD; tmp_dk->bits = 256; key_list = g_list_append(key_list,tmp_dk); diff --git a/ui/gtk/airpcap_gui_utils.h b/ui/gtk/airpcap_gui_utils.h index db04d33df1..8de78e56b8 100644 --- a/ui/gtk/airpcap_gui_utils.h +++ b/ui/gtk/airpcap_gui_utils.h @@ -110,7 +110,7 @@ airpcap_get_link_type(const gchar* name); /* * Returns the string name corresponding to the given AirpcapLinkType. */ -gchar* +const gchar* airpcap_get_link_name(AirpcapLinkType lt); /* diff --git a/ui/gtk/capture_dlg.c b/ui/gtk/capture_dlg.c index ac6a8829cf..e0b56b9403 100644 --- a/ui/gtk/capture_dlg.c +++ b/ui/gtk/capture_dlg.c @@ -1841,7 +1841,7 @@ options_remote_cb(GtkWidget *w _U_, gpointer d _U_) gtk_table_attach_defaults(GTK_TABLE(sampling_tb), samp_count_sb, 1, 2, 1, 2); sampling_lb = gtk_label_new("packets"); - gtk_misc_set_alignment(GTK_MISC(sampling_lb), 0, 0.5); + gtk_misc_set_alignment(GTK_MISC(sampling_lb), 0, 0.5f); gtk_table_attach_defaults(GTK_TABLE(sampling_tb), sampling_lb, 2, 3, 1, 2); /* "Sampling by timer" row */ @@ -1861,7 +1861,7 @@ options_remote_cb(GtkWidget *w _U_, gpointer d _U_) gtk_table_attach_defaults(GTK_TABLE(sampling_tb), samp_timer_sb, 1, 2, 2, 3); sampling_lb = gtk_label_new("milliseconds"); - gtk_misc_set_alignment(GTK_MISC(sampling_lb), 0, 0.5); + gtk_misc_set_alignment(GTK_MISC(sampling_lb), 0, 0.5f); gtk_table_attach_defaults(GTK_TABLE(sampling_tb), sampling_lb, 2, 3, 2, 3); #endif @@ -2353,7 +2353,7 @@ update_options_table(gint indx) GtkTreeView *if_cb; GtkTreeModel *model; GtkTreeIter iter; - gchar *temp, *path_str, *snaplen_string, *linkname = ""; + gchar *temp, *path_str, *snaplen_string, *linkname; GList *list; link_row *linkr = NULL; gboolean enabled; @@ -2366,11 +2366,12 @@ update_options_table(gint indx) } else { temp = g_strdup_printf("%s\n%s", device.display_name, device.addresses); } + linkname = NULL; for (list=device.links; list!=NULL; list=g_list_next(list)) { linkr = (link_row*)(list->data); - linkname = g_strdup(linkr->name); if (linkr->dlt == device.active_dlt) { + linkname = g_strdup(linkr->name); break; } } @@ -2393,11 +2394,11 @@ update_options_table(gint indx) g_array_insert_val(global_capture_opts.all_ifaces, marked_interface, device); } #if defined(HAVE_PCAP_CREATE) - gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, linkname, PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, MONITOR, device.monitor_mode_supported?(device.monitor_mode_enabled?"enabled":"disabled"):"n/a", FILTER, device.cfilter, -1); + gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, linkname?linkname:"This should not happen", PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, MONITOR, device.monitor_mode_supported?(device.monitor_mode_enabled?"enabled":"disabled"):"n/a", FILTER, device.cfilter, -1); #elif defined(_WIN32) && !defined(HAVE_PCAP_CREATE) - gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp,LINK, linkname, PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, FILTER, device.cfilter, -1); + gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp,LINK, linkname?linkname:"This should not happen", PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, FILTER, device.cfilter, -1); #else - gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp,LINK, linkname, PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, FILTER, device.cfilter, -1); + gtk_list_store_set (GTK_LIST_STORE(model), &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp,LINK, linkname?linkname:"This should not happen", PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, FILTER, device.cfilter, -1); #endif if (global_capture_opts.num_selected > 0) { gtk_widget_set_sensitive(ok_bt, TRUE); @@ -3455,7 +3456,7 @@ pipe_del_bt_clicked_cb(GtkWidget *w _U_, gpointer data _U_) GtkTreeModel *model, *optmodel; GtkTreeIter iter, optiter; GtkTreeView *if_cb; - gchar *name, *optname = ""; + gchar *name, *optname = NULL; guint i; sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(pipe_l)); @@ -3477,7 +3478,7 @@ pipe_del_bt_clicked_cb(GtkWidget *w _U_, gpointer data _U_) if (gtk_tree_model_get_iter_first (optmodel, &optiter)) { do { gtk_tree_model_get(optmodel, &optiter, IFACE_HIDDEN_NAME, &optname, -1); - if (strcmp(optname, name) == 0) { + if (optname != NULL && strcmp(optname, name) == 0) { gtk_list_store_remove(GTK_LIST_STORE(gtk_tree_view_get_model(if_cb)), &optiter); break; } @@ -4485,7 +4486,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_) column = gtk_tree_view_get_column(GTK_TREE_VIEW (view), INTERFACE); gtk_tree_view_column_set_min_width(column, 200); gtk_tree_view_column_set_resizable(column, TRUE ); - gtk_tree_view_column_set_alignment(column, 0.5); + gtk_tree_view_column_set_alignment(column, 0.5f); g_object_set_data(G_OBJECT(column), E_MCAPTURE_COLUMNS_COL_KEY, GINT_TO_POINTER(INTERFACE)); gtk_tree_view_column_set_clickable(column, TRUE); gtk_tree_view_column_set_reorderable(column, TRUE); @@ -4510,12 +4511,12 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_) gtk_tree_view_column_set_visible(column, TRUE); else gtk_tree_view_column_set_visible(column, FALSE); - gtk_tree_view_column_set_alignment(column, 0.5); + gtk_tree_view_column_set_alignment(column, 0.5f); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes("Prom. Mode", renderer, "text", PMODE, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); - g_object_set(renderer, "xalign", 0.5, NULL); + g_object_set(renderer, "xalign", 0.5f, NULL); gtk_tree_view_column_set_clickable(column, TRUE); gtk_tree_view_column_set_reorderable(column, TRUE); g_object_set_data(G_OBJECT(column), E_MCAPTURE_COLUMNS_COL_KEY, GINT_TO_POINTER(PMODE)); @@ -4525,7 +4526,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_) gtk_tree_view_column_set_visible(column, TRUE); else gtk_tree_view_column_set_visible(column, FALSE); - gtk_tree_view_column_set_alignment(column, 0.5); + gtk_tree_view_column_set_alignment(column, 0.5f); renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes("Snaplen [B]", renderer, "text", SNAPLEN, NULL); @@ -4539,7 +4540,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_) gtk_tree_view_column_set_visible(column, TRUE); else gtk_tree_view_column_set_visible(column, FALSE); - g_object_set(renderer, "xalign", 0.5, NULL); + g_object_set(renderer, "xalign", 0.5f, NULL); #if defined(_WIN32) || defined(HAVE_PCAP_CREATE) renderer = gtk_cell_renderer_text_new(); @@ -4554,7 +4555,7 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_) gtk_tree_view_column_set_visible(column, TRUE); else gtk_tree_view_column_set_visible(column, FALSE); - g_object_set(renderer, "xalign", 0.5, NULL); + g_object_set(renderer, "xalign", 0.5f, NULL); #endif #if defined (HAVE_PCAP_CREATE) @@ -4571,13 +4572,13 @@ capture_prep_cb(GtkWidget *w _U_, gpointer d _U_) gtk_tree_view_column_set_visible(column, TRUE); else gtk_tree_view_column_set_visible(column, FALSE); - g_object_set(renderer, "xalign", 0.5, NULL); + g_object_set(renderer, "xalign", 0.5f, NULL); #endif renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes("Capture Filter", renderer, "text", FILTER, NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(view), column); - gtk_tree_view_column_set_alignment(column, 0.5); + gtk_tree_view_column_set_alignment(column, 0.5f); create_and_fill_model(GTK_TREE_VIEW(view)); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(view)); gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); @@ -5429,7 +5430,7 @@ create_and_fill_model(GtkTreeView *view) GtkListStore *store; GtkTreeIter iter; GList *list; - char *temp = "", *snaplen_string, *linkname=""; + char *temp, *snaplen_string, *linkname; guint i; link_row *linkr = NULL; interface_t device; @@ -5450,11 +5451,12 @@ create_and_fill_model(GtkTreeView *view) } else { temp = g_strdup_printf("%s\n%s", device.display_name, device.addresses); } + linkname = NULL; for (list = device.links; list != NULL; list = g_list_next(list)) { linkr = (link_row*)(list->data); - linkname = g_strdup(linkr->name); if (linkr->dlt == device.active_dlt) { - break; + linkname = g_strdup(linkr->name); + break; } } if (device.has_snaplen) { @@ -5464,11 +5466,11 @@ create_and_fill_model(GtkTreeView *view) } gtk_list_store_append (store, &iter); #if defined(HAVE_PCAP_CREATE) - gtk_list_store_set (store, &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, linkname, PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, MONITOR, device.monitor_mode_supported?(device.monitor_mode_enabled?"enabled":"disabled"):"n/a", FILTER, device.cfilter, -1); + gtk_list_store_set (store, &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, linkname?linkname:"This should not happen", PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, MONITOR, device.monitor_mode_supported?(device.monitor_mode_enabled?"enabled":"disabled"):"n/a", FILTER, device.cfilter, -1); #elif defined(_WIN32) && !defined(HAVE_PCAP_CREATE) - gtk_list_store_set (store, &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, linkname, PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, FILTER, device.cfilter, -1); + gtk_list_store_set (store, &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, linkname?linkname:"This should not happen", PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, BUFFER, (guint) device.buffer, FILTER, device.cfilter, -1); #else - gtk_list_store_set (store, &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, linkname, PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, FILTER, device.cfilter, -1); + gtk_list_store_set (store, &iter, CAPTURE, device.selected, IFACE_HIDDEN_NAME, device.name, INTERFACE, temp, LINK, linkname?linkname:"This should not happen", PMODE, device.pmode?"enabled":"disabled", SNAPLEN, snaplen_string, FILTER, device.cfilter, -1); #endif } } diff --git a/ui/gtk/cfilter_combo_utils.c b/ui/gtk/cfilter_combo_utils.c index 1b1b1a09c9..b04a706a2b 100644 --- a/ui/gtk/cfilter_combo_utils.c +++ b/ui/gtk/cfilter_combo_utils.c @@ -81,7 +81,7 @@ void /* add a capture filter coming from the user's recent file to the cfilter combo box */ gboolean - cfilter_combo_add_recent(gchar *s) { + cfilter_combo_add_recent(const gchar *s) { gchar *dupstr; if (s) { diff --git a/ui/gtk/conversations_table.c b/ui/gtk/conversations_table.c index 2e57a63654..f003a2591c 100644 --- a/ui/gtk/conversations_table.c +++ b/ui/gtk/conversations_table.c @@ -1962,7 +1962,7 @@ ct_create_popup_menu(conversations_table *ct) /* Draw/refresh the address fields of a single entry at the specified index */ static void -get_ct_table_address(conversations_table *ct, conv_t *conv, char **entries) +get_ct_table_address(conversations_table *ct, conv_t *conv, const char **entries) { char *port; guint32 pt; @@ -2017,7 +2017,7 @@ static void draw_ct_table_addresses(conversations_table *ct) { guint32 i; - char *entries[4]; + const char *entries[4]; GtkListStore *store; if (!ct->num_conversations) @@ -2074,7 +2074,7 @@ draw_ct_table_data(conversations_table *ct) for(i=0;inum_conversations;i++){ char start_time[COL_STR_LEN], duration[COL_STR_LEN], txbps[COL_STR_LEN], rxbps[COL_STR_LEN]; - char *tx_ptr, *rx_ptr; + const char *tx_ptr, *rx_ptr; double duration_s; conv_t *conversation = &g_array_index(ct->conversations, conv_t, i); @@ -2105,7 +2105,7 @@ draw_ct_table_data(conversations_table *ct) } conversation->modified = FALSE; if (!conversation->iter_valid) { - char *entries[4]; + const char *entries[4]; get_ct_table_address(ct, conversation, entries); conversation->iter_valid = TRUE; diff --git a/ui/gtk/decode_as_ber.c b/ui/gtk/decode_as_ber.c index 8cf86aef2c..2a2c322c56 100644 --- a/ui/gtk/decode_as_ber.c +++ b/ui/gtk/decode_as_ber.c @@ -121,8 +121,8 @@ decode_ber_add_page (packet_info *pinfo _U_) /* create page content */ page_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5, FALSE); g_object_set_data(G_OBJECT(page_hb), E_PAGE_ACTION, decode_ber); - g_object_set_data(G_OBJECT(page_hb), E_PAGE_TABLE, "ASN.1"); - g_object_set_data(G_OBJECT(page_hb), E_PAGE_TITLE, "ASN.1"); + g_object_set_data(G_OBJECT(page_hb), E_PAGE_TABLE, (gpointer)"ASN.1"); + g_object_set_data(G_OBJECT(page_hb), E_PAGE_TITLE, (gpointer)"ASN.1"); info_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 5, FALSE); gtk_box_pack_start(GTK_BOX(page_hb), info_vb, TRUE, TRUE, 0); diff --git a/ui/gtk/decode_as_dcerpc.c b/ui/gtk/decode_as_dcerpc.c index 09d68ba098..6b77506e70 100644 --- a/ui/gtk/decode_as_dcerpc.c +++ b/ui/gtk/decode_as_dcerpc.c @@ -358,8 +358,8 @@ decode_dcerpc_add_page (packet_info *pinfo) /* create page content */ page_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5, FALSE); g_object_set_data(G_OBJECT(page_hb), E_PAGE_ACTION, decode_dcerpc); - g_object_set_data(G_OBJECT(page_hb), E_PAGE_TABLE, "DCE-RPC"); - g_object_set_data(G_OBJECT(page_hb), E_PAGE_TITLE, "DCE-RPC"); + g_object_set_data(G_OBJECT(page_hb), E_PAGE_TABLE, (gpointer)"DCE-RPC"); + g_object_set_data(G_OBJECT(page_hb), E_PAGE_TITLE, (gpointer)"DCE-RPC"); g_object_set_data(G_OBJECT(page_hb), E_PAGE_BINDING, binding); info_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 5, FALSE); diff --git a/ui/gtk/decode_as_dlg.c b/ui/gtk/decode_as_dlg.c index 338acabf83..6c1f31cff2 100644 --- a/ui/gtk/decode_as_dlg.c +++ b/ui/gtk/decode_as_dlg.c @@ -289,7 +289,7 @@ void change_dissector_if_matched(gpointer item, gpointer user_data) { * A callback function to parse each "decode as" entry in the file and apply the change */ prefs_set_pref_e -read_set_decode_as_entries(gchar *key, gchar *value, +read_set_decode_as_entries(gchar *key, const gchar *value, void *user_data _U_, gboolean return_range_errors _U_) { @@ -1638,7 +1638,7 @@ decode_add_tcpudp_page (const gchar *prompt, const gchar *table_name) page = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5, FALSE); g_object_set_data(G_OBJECT(page), E_PAGE_ACTION, decode_transport); g_object_set_data(G_OBJECT(page), E_PAGE_TABLE, (gchar *) table_name); - g_object_set_data(G_OBJECT(page), E_PAGE_TITLE, "Transport"); + g_object_set_data(G_OBJECT(page), E_PAGE_TITLE, (gpointer)"Transport"); /* Always enabled */ label = gtk_label_new(prompt); @@ -1717,7 +1717,7 @@ decode_sctp_update_ppid_combo_box(GtkWidget *w _U_, GtkWidget *page) if (number_of_ppid) ws_combo_box_set_active(GTK_COMBO_BOX(sctp_combo_box), 0); /* default */ - g_object_set_data(G_OBJECT(page), E_PAGE_TABLE, "sctp.ppi"); + g_object_set_data(G_OBJECT(page), E_PAGE_TABLE, (gpointer)"sctp.ppi"); sctp_store = g_object_get_data(G_OBJECT(G_OBJECT(decode_w)), "sctp_data"); gtk_list_store_clear(sctp_store); @@ -1745,7 +1745,7 @@ decode_sctp_update_srcdst_combo_box(GtkWidget *w _U_, GtkWidget *page) ws_combo_box_append_text_and_pointer(GTK_COMBO_BOX(sctp_combo_box), "both", GINT_TO_POINTER(E_DECODE_BPORT)); ws_combo_box_set_active(GTK_COMBO_BOX(sctp_combo_box), 0); - g_object_set_data(G_OBJECT(page), E_PAGE_TABLE, "sctp.port"); + g_object_set_data(G_OBJECT(page), E_PAGE_TABLE, (gpointer)"sctp.port"); g_object_set_data(G_OBJECT(page), E_PAGE_SPORT, GINT_TO_POINTER(cfile.edt->pi.srcport)); g_object_set_data(G_OBJECT(page), E_PAGE_DPORT, GINT_TO_POINTER(cfile.edt->pi.destport)); sctp_store = g_object_get_data(G_OBJECT(G_OBJECT(decode_w)), "sctp_data"); @@ -1789,7 +1789,7 @@ decode_add_sctp_page (const gchar *prompt, const gchar *table_name) page = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5, FALSE); g_object_set_data(G_OBJECT(page), E_PAGE_ACTION, decode_transport); g_object_set_data(G_OBJECT(page), E_PAGE_TABLE, (gchar *) table_name); - g_object_set_data(G_OBJECT(page), E_PAGE_TITLE, "Transport"); + g_object_set_data(G_OBJECT(page), E_PAGE_TITLE, (gpointer)"Transport"); vbox = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 5, FALSE); radio = decode_sctp_add_port_ppid(page); @@ -1855,7 +1855,7 @@ decode_bluetooth(GtkWidget *notebook_pg) E_LIST_S_TABLE+1, &handle, -1); } - value = strtol(gtk_entry_get_text((GtkEntry *) g_hash_table_lookup(value_entry_table, table_name)), NULL, 0); + value = (guint)strtol(gtk_entry_get_text((GtkEntry *) g_hash_table_lookup(value_entry_table, table_name)), NULL, 0); if (abbrev != NULL && strcmp(abbrev, "(default)") == 0) { dissector_reset_uint(table_name, value); diff --git a/ui/gtk/drag_and_drop.c b/ui/gtk/drag_and_drop.c index 81453a0e9c..eab579c675 100644 --- a/ui/gtk/drag_and_drop.c +++ b/ui/gtk/drag_and_drop.c @@ -375,7 +375,7 @@ dnd_init(GtkWidget *w) static GtkTargetEntry target_entry[] = { /*{"STRING", 0, DND_TARGET_STRING},*/ /*{"text/plain", 0, DND_TARGET_STRING},*/ - {"text/uri-list", 0, DND_TARGET_URL} + {(gchar *)"text/uri-list", 0, DND_TARGET_URL} }; /* set this window as a dnd destination */ diff --git a/ui/gtk/file_import_dlg.c b/ui/gtk/file_import_dlg.c index 05135b2565..24d2841bb1 100644 --- a/ui/gtk/file_import_dlg.c +++ b/ui/gtk/file_import_dlg.c @@ -672,7 +672,7 @@ setup_file_import(GtkWidget *main_w) switch (text_import_info->dummy_header_type) { case HEADER_ETH: - text_import_info->pid = strtol(gtk_entry_get_text(GTK_ENTRY(etype_te)), NULL, 16); + text_import_info->pid = (guint) strtol(gtk_entry_get_text(GTK_ENTRY(etype_te)), NULL, 16); if (text_import_info->pid > 0xffff) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The Ethertype (%x) is too large.", @@ -686,7 +686,7 @@ setup_file_import(GtkWidget *main_w) break; case HEADER_IPV4: - text_import_info->protocol = strtol(gtk_entry_get_text(GTK_ENTRY(protocol_te)), NULL, 10); + text_import_info->protocol = (guint) strtol(gtk_entry_get_text(GTK_ENTRY(protocol_te)), NULL, 10); if (text_import_info->protocol > 0xff) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The IPv4 protocol (%u) is too large.", @@ -701,7 +701,7 @@ setup_file_import(GtkWidget *main_w) case HEADER_UDP: case HEADER_TCP: - text_import_info->src_port = strtol(gtk_entry_get_text(GTK_ENTRY(src_port_te)), NULL, 10); + text_import_info->src_port = (guint) strtol(gtk_entry_get_text(GTK_ENTRY(src_port_te)), NULL, 10); if (text_import_info->src_port > 0xffff) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The source port (%u) is too large.", @@ -712,7 +712,7 @@ setup_file_import(GtkWidget *main_w) g_free(text_import_info); return NULL; } - text_import_info->dst_port = strtol(gtk_entry_get_text(GTK_ENTRY(dst_port_te)), NULL, 10); + text_import_info->dst_port = (guint) strtol(gtk_entry_get_text(GTK_ENTRY(dst_port_te)), NULL, 10); if (text_import_info->dst_port > 0xffff) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The destination port (%u) is too large.", @@ -726,7 +726,7 @@ setup_file_import(GtkWidget *main_w) break; case HEADER_SCTP: - text_import_info->src_port = strtol(gtk_entry_get_text(GTK_ENTRY(src_port_te)), NULL, 10); + text_import_info->src_port = (guint) strtol(gtk_entry_get_text(GTK_ENTRY(src_port_te)), NULL, 10); if (text_import_info->src_port > 0xffff) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The source port (%u) is too large.", @@ -737,7 +737,7 @@ setup_file_import(GtkWidget *main_w) g_free(text_import_info); return NULL; } - text_import_info->dst_port = strtol(gtk_entry_get_text(GTK_ENTRY(dst_port_te)), NULL, 10); + text_import_info->dst_port = (guint) strtol(gtk_entry_get_text(GTK_ENTRY(dst_port_te)), NULL, 10); if (text_import_info->dst_port > 0xffff) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The destination port (%u) is too large.", @@ -748,11 +748,11 @@ setup_file_import(GtkWidget *main_w) g_free(text_import_info); return NULL; } - text_import_info->tag = strtol(gtk_entry_get_text(GTK_ENTRY(tag_te)), NULL, 10); + text_import_info->tag = (guint) strtol(gtk_entry_get_text(GTK_ENTRY(tag_te)), NULL, 10); break; case HEADER_SCTP_DATA: - text_import_info->src_port = strtol(gtk_entry_get_text(GTK_ENTRY(src_port_te)), NULL, 10); + text_import_info->src_port = (guint) strtol(gtk_entry_get_text(GTK_ENTRY(src_port_te)), NULL, 10); if (text_import_info->src_port > 0xffff) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The source port (%u) is too large.", @@ -763,7 +763,7 @@ setup_file_import(GtkWidget *main_w) g_free(text_import_info); return NULL; } - text_import_info->dst_port = strtol(gtk_entry_get_text(GTK_ENTRY(dst_port_te)), NULL, 10); + text_import_info->dst_port = (guint) strtol(gtk_entry_get_text(GTK_ENTRY(dst_port_te)), NULL, 10); if (text_import_info->dst_port > 0xffff) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The destination port (%u) is too large.", @@ -774,7 +774,7 @@ setup_file_import(GtkWidget *main_w) g_free(text_import_info); return NULL; } - text_import_info->ppi = strtol(gtk_entry_get_text(GTK_ENTRY(ppi_te)), NULL, 10); + text_import_info->ppi = (guint) strtol(gtk_entry_get_text(GTK_ENTRY(ppi_te)), NULL, 10); break; default: @@ -784,7 +784,7 @@ setup_file_import(GtkWidget *main_w) text_import_info->dummy_header_type = HEADER_NONE; } - text_import_info->max_frame_length = strtol(gtk_entry_get_text(GTK_ENTRY(framelen_te)), NULL, 10); + text_import_info->max_frame_length = (guint)strtol(gtk_entry_get_text(GTK_ENTRY(framelen_te)), NULL, 10); if (text_import_info->max_frame_length == 0) { text_import_info->max_frame_length = IMPORT_MAX_PACKET; } diff --git a/ui/gtk/filter_dlg.c b/ui/gtk/filter_dlg.c index 02b02d3abd..8799d7a123 100644 --- a/ui/gtk/filter_dlg.c +++ b/ui/gtk/filter_dlg.c @@ -379,7 +379,7 @@ filter_dialog_new(GtkWidget *button, GtkWidget *parent_filter_te, GtkTreeViewColumn *column; GtkTreeSelection *sel; GtkTreeIter *l_select; - gchar *list_name = NULL; + const gchar *list_name = NULL; /* Get a pointer to a static variable holding the type of filter on which we're working, so we can pass that pointer to callback @@ -489,7 +489,7 @@ filter_dialog_new(GtkWidget *button, GtkWidget *parent_filter_te, /* This is a Boolean, but we make it a non-null pointer for TRUE and a null pointer for FALSE, as object data is a pointer. */ g_object_set_data(G_OBJECT(filter_l), E_FILT_DBLACTIVATE_KEY, - construct_args->activate_on_ok ? "" : NULL); + construct_args->activate_on_ok ? (gpointer)"" : NULL); /* fill in data */ l_select = fill_list(main_w, list_type, filter_te_str); diff --git a/ui/gtk/follow_stream.c b/ui/gtk/follow_stream.c index 401a3e304d..46d38e83f1 100644 --- a/ui/gtk/follow_stream.c +++ b/ui/gtk/follow_stream.c @@ -390,7 +390,7 @@ follow_print_stream(GtkWidget * w _U_, gpointer data) { print_stream_t *stream; gboolean to_file; - char *print_dest; + const char *print_dest; follow_info_t *follow_info = data; #ifdef _WIN32 gboolean win_printer = FALSE; @@ -711,7 +711,7 @@ forget_follow_info(follow_info_t *follow_info) } void -follow_stream(gchar *title, follow_info_t *follow_info, +follow_stream(const gchar *title, follow_info_t *follow_info, gchar *both_directions_string, gchar *server_to_client_string, gchar *client_to_server_string) { diff --git a/ui/gtk/follow_stream.h b/ui/gtk/follow_stream.h index 1d4fef6362..f41ea2405a 100644 --- a/ui/gtk/follow_stream.h +++ b/ui/gtk/follow_stream.h @@ -94,7 +94,7 @@ extern GList *follow_infos; void follow_load_text(follow_info_t *follow_info); void follow_filter_out_stream(GtkWidget * w, gpointer parent_w); -void follow_stream(gchar *title, follow_info_t *follow_info, +void follow_stream(const gchar *title, follow_info_t *follow_info, gchar *both_directions_string, gchar *server_to_client_string, gchar *client_to_server_string); diff --git a/ui/gtk/goto_dlg.c b/ui/gtk/goto_dlg.c index 45a0d9acf7..5f646af4c1 100644 --- a/ui/gtk/goto_dlg.c +++ b/ui/gtk/goto_dlg.c @@ -118,12 +118,13 @@ goto_frame_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) fnumber_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_GOTO_FNUMBER_KEY); fnumber_text = gtk_entry_get_text(GTK_ENTRY(fnumber_te)); - fnumber = strtoul(fnumber_text, &p, 10); + fnumber = (guint) strtoul(fnumber_text, &p, 10); if (p == fnumber_text || *p != '\0') { /* Illegal number. XXX - what about negative numbers (which "strtoul()" allows)? Can we hack up signal handlers for the widget to make it - reject attempts to type in characters other than digits? */ + reject attempts to type in characters other than digits? + What about numbers > the maximum possible guint? */ simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The packet number you entered isn't a valid number."); return; diff --git a/ui/gtk/graph_analysis.c b/ui/gtk/graph_analysis.c index a0d50762c2..7bc4ac127b 100644 --- a/ui/gtk/graph_analysis.c +++ b/ui/gtk/graph_analysis.c @@ -304,7 +304,7 @@ static gboolean dialog_graph_dump_to_file(graph_analysis_data_t *user_data) gboolean first_packet = TRUE; GString *label_string, *empty_line,*separator_line, *tmp_str, *tmp_str2; - char *empty_header; + const char *empty_header; char src_port[8],dst_port[8]; gchar *time_str; GList *list; diff --git a/ui/gtk/hostlist_table.c b/ui/gtk/hostlist_table.c index c852edc717..9c7ed95246 100644 --- a/ui/gtk/hostlist_table.c +++ b/ui/gtk/hostlist_table.c @@ -618,7 +618,7 @@ hostlist_create_popup_menu(hostlist_table *hl) /* Draw/refresh the address field of a single entry at the specified index */ static void -get_hostlist_table_address(hostlist_table *hl, hostlist_talker_t *host, char **entries) +get_hostlist_table_address(hostlist_table *hl, hostlist_talker_t *host, const char **entries) { char *port; guint32 pt; @@ -651,7 +651,7 @@ static void draw_hostlist_table_addresses(hostlist_table *hl) { guint32 i; - char *entries[2]; + const char *entries[2]; GtkListStore *store; store = GTK_LIST_STORE(gtk_tree_view_get_model(hl->table)); @@ -711,7 +711,7 @@ draw_hostlist_table_data(hostlist_table *hl) } host->modified = FALSE; if (!host->iter_valid) { - char *entries[2]; + const char *entries[2]; #ifdef HAVE_GEOIP char *geoip[NUM_GEOIP_COLS]; guint j; @@ -930,7 +930,7 @@ typedef struct { hostlist_table *talkers; } map_t; -static char *map_endpoint_opener; +static const char *map_endpoint_opener; static void map_init(void) diff --git a/ui/gtk/iax2_analysis.c b/ui/gtk/iax2_analysis.c index d284c71ca4..82eb46ddc9 100644 --- a/ui/gtk/iax2_analysis.c +++ b/ui/gtk/iax2_analysis.c @@ -181,7 +181,7 @@ typedef struct _dialog_data_t { GtkWidget *notebook; GtkWidget *save_voice_as_w; GtkWidget *save_csv_as_w; - gint notebook_signal_id; + gulong notebook_signal_id; dialog_graph_t dialog_graph; } dialog_data_t; @@ -2279,7 +2279,8 @@ static void save_voice_as_destroy_cb(GtkWidget *win _U_, gpointer data) /* XXX what about endians here? could go something wrong? */ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t *user_data) { - int to_fd, forw_fd, rev_fd, fread_cnt = 0, rread = 0, fwritten, rwritten; + int to_fd, forw_fd, rev_fd; + size_t fread_cnt = 0, rread = 0, fwritten, rwritten; gchar f_pd[1] = {0}; gchar r_pd[1] = {0}; gint16 sample; @@ -2317,7 +2318,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t * /* XXX: Should we be checking for write errors below ? */ phtonl(pd, 0x2e736e64); fwritten = ws_write(to_fd, pd, 4); - if ((fwritten < 4) || (fread_cnt < 0)) { + if ((fwritten < 4) || (fread_cnt == (size_t)-1)) { ws_close(forw_fd); ws_close(rev_fd); ws_close(to_fd); @@ -2327,7 +2328,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t * /* header offset == 24 bytes */ phtonl(pd, 24); fwritten = ws_write(to_fd, pd, 4); - if ((fwritten < 4) || (fread_cnt < 0)) { + if ((fwritten < 4) || (fread_cnt == (size_t)-1)) { ws_close(forw_fd); ws_close(rev_fd); ws_close(to_fd); @@ -2337,7 +2338,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t * /* total length, it is permited to set this to 0xffffffff */ phtonl(pd, -1); fwritten = ws_write(to_fd, pd, 4); - if ((fwritten < 4) || (fread_cnt < 0)) { + if ((fwritten < 4) || (fread_cnt == (size_t)-1)) { ws_close(forw_fd); ws_close(rev_fd); ws_close(to_fd); @@ -2347,7 +2348,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t * /* encoding format == 16-bit linear PCM */ phtonl(pd, 3); fwritten = ws_write(to_fd, pd, 4); - if ((fwritten < 4) || (fread_cnt < 0)) { + if ((fwritten < 4) || (fread_cnt == (size_t)-1)) { ws_close(forw_fd); ws_close(rev_fd); ws_close(to_fd); @@ -2357,7 +2358,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t * /* sample rate == 8000 Hz */ phtonl(pd, 8000); fwritten = ws_write(to_fd, pd, 4); - if ((fwritten < 4) || (fread_cnt < 0)) { + if ((fwritten < 4) || (fread_cnt == (size_t)-1)) { ws_close(forw_fd); ws_close(rev_fd); ws_close(to_fd); @@ -2367,7 +2368,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t * /* channels == 1 */ phtonl(pd, 1); fwritten = ws_write(to_fd, pd, 4); - if ((fwritten < 4) || (fread_cnt < 0)) { + if ((fwritten < 4) || (fread_cnt == (size_t)-1)) { ws_close(forw_fd); ws_close(rev_fd); ws_close(to_fd); @@ -2407,7 +2408,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t * } fwritten = ws_write(to_fd, pd, 2); - if ((fwritten < 2) || (fread_cnt < 0)) { + if ((fwritten < 2) || (fread_cnt == (size_t)-1)) { ws_close(forw_fd); ws_close(rev_fd); ws_close(to_fd); @@ -2448,7 +2449,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t * } rwritten = ws_write(to_fd, pd, 2); - if ((rwritten < 2) || (rread < 0)) { + if ((rwritten < 2) || (rread == (size_t)-1)) { ws_close(forw_fd); ws_close(rev_fd); ws_close(to_fd); @@ -2534,7 +2535,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t * rwritten = ws_write(to_fd, pd, 2); - if ((rwritten < 2) || (rread < 0) || (fread_cnt < 0)) { + if ((rwritten < 2) || (rread == (size_t)-1) || (fread_cnt == (size_t)-1)) { ws_close(forw_fd); ws_close(rev_fd); ws_close(to_fd); @@ -2587,7 +2588,7 @@ static gboolean copy_file(gchar *dest, gint channels, gint format, user_data_t * rwritten = ws_write(to_fd, pd, 1); - if ((rwritten < rread) || (rwritten < 0) || (rread < 0)) { + if ((rwritten < rread) || (rwritten == (size_t)-1) || (rread == (size_t)-1)) { ws_close(forw_fd); ws_close(rev_fd); ws_close(to_fd); diff --git a/ui/gtk/io_stat.c b/ui/gtk/io_stat.c index 3a706e2d75..f6f499444a 100644 --- a/ui/gtk/io_stat.c +++ b/ui/gtk/io_stat.c @@ -2151,7 +2151,7 @@ create_advanced_field(io_stat_graph_t *gio, GtkWidget *box) gtk_box_pack_start(GTK_BOX(box), gio->calc_field, TRUE, TRUE, 0); gtk_widget_show(gio->calc_field); g_signal_connect(gio->calc_field, "activate", G_CALLBACK(filter_callback), gio); - g_object_set_data (G_OBJECT(gio->calc_field), E_FILT_FIELD_NAME_ONLY_KEY, ""); + g_object_set_data (G_OBJECT(gio->calc_field), E_FILT_FIELD_NAME_ONLY_KEY, (gpointer)""); g_signal_connect(gio->calc_field, "changed", G_CALLBACK(filter_te_syntax_check_cb), NULL); g_object_set_data(G_OBJECT(box), E_FILT_AUTOCOMP_PTR_KEY, NULL); g_signal_connect(gio->calc_field, "key-press-event", G_CALLBACK (filter_string_te_key_pressed_cb), NULL); diff --git a/ui/gtk/mac_lte_stat_dlg.c b/ui/gtk/mac_lte_stat_dlg.c index 3ca5a08fa7..337ce40538 100644 --- a/ui/gtk/mac_lte_stat_dlg.c +++ b/ui/gtk/mac_lte_stat_dlg.c @@ -638,12 +638,12 @@ static float calculate_bw(nstime_t *start_time, nstime_t *stop_time, guint32 byt /* Only really meaningful if have a few frames spread over time... For now at least avoid dividing by something very close to 0.0 */ if (elapsed_ms < 2.0) { - return 0.0; + return 0.0f; } return ((bytes * 8) / elapsed_ms) / 1000; } else { - return 0.0; + return 0.0f; } } diff --git a/ui/gtk/main_80211_toolbar.c b/ui/gtk/main_80211_toolbar.c index 67fe847bb5..713f105f86 100644 --- a/ui/gtk/main_80211_toolbar.c +++ b/ui/gtk/main_80211_toolbar.c @@ -57,13 +57,13 @@ static gint32 tb80211_current_type = -1; static gboolean tb80211_dont_set_chan; static gboolean tb80211_dont_set_iface; -static void tb80211_set_info(char *errstr) +static void tb80211_set_info(const char *errstr) { gtk_label_set_markup(GTK_LABEL(tb80211_info_label), errstr); } static -void add_channel_type(char *type, int oldtype, int indx ) +void add_channel_type(const char *type, int oldtype, int indx ) { gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(tb80211_chan_type_box), type); @@ -332,7 +332,7 @@ out_free: } static void -tb80211_add_label(gchar *text, GtkWidget *tb) +tb80211_add_label(const gchar *text, GtkWidget *tb) { GtkWidget *label; GtkToolItem *label_ti; diff --git a/ui/gtk/main_filter_toolbar.c b/ui/gtk/main_filter_toolbar.c index 19e991850b..733376c386 100644 --- a/ui/gtk/main_filter_toolbar.c +++ b/ui/gtk/main_filter_toolbar.c @@ -162,7 +162,7 @@ filter_toolbar_new(void) g_signal_connect(filter_te, "changed", G_CALLBACK(filter_changed_cb), filter_cm); g_signal_connect(filter_te, "changed", G_CALLBACK(filter_te_syntax_check_cb), NULL); g_object_set_data(G_OBJECT(filter_tb), E_FILT_AUTOCOMP_PTR_KEY, NULL); - g_object_set_data(G_OBJECT(filter_te), E_FILT_FIELD_USE_STATUSBAR_KEY, ""); + g_object_set_data(G_OBJECT(filter_te), E_FILT_FIELD_USE_STATUSBAR_KEY, (gpointer)""); g_signal_connect(filter_te, "key-press-event", G_CALLBACK (filter_string_te_key_pressed_cb), NULL); g_signal_connect(filter_tb, "key-press-event", G_CALLBACK (filter_parent_dlg_key_pressed_cb), NULL); @@ -356,7 +356,7 @@ dfilter_recent_combo_write_all(FILE *rf) { /* add a display filter coming from the user's recent file to the dfilter combo box */ gboolean -dfilter_combo_add_recent(gchar *s) { +dfilter_combo_add_recent(const gchar *s) { GtkWidget *filter_cm = g_object_get_data(G_OBJECT(top_level), E_DFILTER_CM_KEY); char *dupstr; diff --git a/ui/gtk/main_menubar.c b/ui/gtk/main_menubar.c index da345b10aa..511ae29d2c 100644 --- a/ui/gtk/main_menubar.c +++ b/ui/gtk/main_menubar.c @@ -157,7 +157,7 @@ static void menu_name_resolution_update_cb(GtkAction *action, gpointer data); static void name_resolution_cb(GtkWidget *w, gpointer d, gboolean* res_flag); static void colorize_cb(GtkWidget *w, gpointer d); static void rebuild_protocol_prefs_menu (module_t *prefs_module_p, gboolean preferences, - GtkUIManager *ui_menu, char *path); + GtkUIManager *ui_menu, const char *path); /* As a general GUI guideline, we try to follow the Gnome Human Interface Guidelines, which can be found at: @@ -4307,7 +4307,7 @@ menu_open_recent_file_cmd_cb(GtkAction *action, gpointer data _U_) } static void -add_menu_recent_capture_file_absolute(gchar *cf_name) +add_menu_recent_capture_file_absolute(const gchar *cf_name) { GtkWidget *submenu_recent_files; GList *li; @@ -5186,7 +5186,7 @@ menu_prefs_change_ok (GtkWidget *w, gpointer parent_w) switch (pref->type) { case PREF_UINT: - uval = strtoul(new_value, &p, pref->info.base); + uval = (guint)strtoul(new_value, &p, pref->info.base); if (p == new_value || *p != '\0') { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The value \"%s\" isn't a valid number.", @@ -5328,7 +5328,7 @@ menu_prefs_edit_dlg (GtkWidget *w, gpointer data) } static guint -add_protocol_prefs_generic_menu(pref_t *pref, gpointer data, GtkUIManager *ui_menu, char *path) +add_protocol_prefs_generic_menu(pref_t *pref, gpointer data, GtkUIManager *ui_menu, const char *path) { GtkWidget *menu_preferences; GtkWidget *menu_item, *menu_sub_item, *sub_menu; @@ -5440,7 +5440,7 @@ add_protocol_prefs_packet_list_menu(pref_t *pref, gpointer data) static void rebuild_protocol_prefs_menu(module_t *prefs_module_p, gboolean preferences, - GtkUIManager *ui_menu, char *path) + GtkUIManager *ui_menu, const char *path) { GtkWidget *menu_preferences, *menu_item; GtkWidget *sub_menu; diff --git a/ui/gtk/main_toolbar.c b/ui/gtk/main_toolbar.c index ddb2bb5fc4..061f79672b 100644 --- a/ui/gtk/main_toolbar.c +++ b/ui/gtk/main_toolbar.c @@ -408,7 +408,7 @@ toolbar_new(void) } void -set_toolbar_object_data(gchar *key, gpointer data) +set_toolbar_object_data(const gchar *key, gpointer data) { g_object_set_data(G_OBJECT(open_button), key, data); g_object_set_data(G_OBJECT(reload_button), key, data); diff --git a/ui/gtk/main_toolbar.h b/ui/gtk/main_toolbar.h index f83daa043c..4a9725364b 100644 --- a/ui/gtk/main_toolbar.h +++ b/ui/gtk/main_toolbar.h @@ -42,6 +42,6 @@ void toolbar_redraw_all(void); * @param key the key * @param data the data to set */ -void set_toolbar_object_data(gchar *key, gpointer data); +void set_toolbar_object_data(const gchar *key, gpointer data); #endif /* __TOOLBAR_H__ */ diff --git a/ui/gtk/mcast_stream.c b/ui/gtk/mcast_stream.c index 0439177734..dc9193a32f 100644 --- a/ui/gtk/mcast_stream.c +++ b/ui/gtk/mcast_stream.c @@ -371,7 +371,8 @@ comparetimes(struct timeval *t1, struct timeval *t2, guint16 burstint_lcl) static void buffusagecalc(mcast_stream_info_t *strinfo, packet_info *pinfo, double emptyspeed_lcl) { - gint32 sec=0, usec=0, cur, prev; + time_t sec=0; + gint32 usec=0, cur, prev; struct timeval *buffer; double timeelapsed; diff --git a/ui/gtk/mcast_stream_dlg.c b/ui/gtk/mcast_stream_dlg.c index e7d3329a89..ef7445f246 100644 --- a/ui/gtk/mcast_stream_dlg.c +++ b/ui/gtk/mcast_stream_dlg.c @@ -212,7 +212,7 @@ mcast_params_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) fnumber_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_MCAST_ENTRY_1); fnumber_text = gtk_entry_get_text(GTK_ENTRY(fnumber_te)); - fnumber = strtoul(fnumber_text, &p, 10); + fnumber = (gint)strtol(fnumber_text, &p, 10); if ( (p == fnumber_text || *p != '\0') || (fnumber <= 0) || (fnumber > 1000) ) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The burst interval should be between 1 and 1000 ms."); return; @@ -221,7 +221,7 @@ mcast_params_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) fnumber_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_MCAST_ENTRY_2); fnumber_text = gtk_entry_get_text(GTK_ENTRY(fnumber_te)); - fnumber = strtoul(fnumber_text, &p, 10); + fnumber = (gint)strtol(fnumber_text, &p, 10); if ( (p == fnumber_text || *p != '\0') || (fnumber <= 0) ) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The burst alarm threshold you entered isn't valid."); return; @@ -230,7 +230,7 @@ mcast_params_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) fnumber_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_MCAST_ENTRY_3); fnumber_text = gtk_entry_get_text(GTK_ENTRY(fnumber_te)); - fnumber = strtoul(fnumber_text, &p, 10); + fnumber = (gint)strtol(fnumber_text, &p, 10); if ( (p == fnumber_text || *p != '\0') || (fnumber <= 0) ) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The buffer alarm threshold you entered isn't valid."); return; @@ -239,7 +239,7 @@ mcast_params_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) fnumber_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_MCAST_ENTRY_4); fnumber_text = gtk_entry_get_text(GTK_ENTRY(fnumber_te)); - fnumber = strtoul(fnumber_text, &p, 10); + fnumber = (gint)strtol(fnumber_text, &p, 10); if ( (p == fnumber_text || *p != '\0') || (fnumber <= 0) || (fnumber > 10000000) ) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The stream empty speed should be between 1 and 10000000"); return; @@ -248,7 +248,7 @@ mcast_params_ok_cb(GtkWidget *ok_bt _U_, gpointer parent_w) fnumber_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_MCAST_ENTRY_5); fnumber_text = gtk_entry_get_text(GTK_ENTRY(fnumber_te)); - fnumber = strtoul(fnumber_text, &p, 10); + fnumber = (gint)strtol(fnumber_text, &p, 10); if ( (p == fnumber_text || *p != '\0') || (fnumber <= 0) || (fnumber > 10000000) ) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "The total empty speed should be between 1 and 10000000"); return; diff --git a/ui/gtk/packet_list.c b/ui/gtk/packet_list.c index f3f3407ba7..9740886ff1 100644 --- a/ui/gtk/packet_list.c +++ b/ui/gtk/packet_list.c @@ -385,7 +385,7 @@ col_details_edit_dlg (gint col_id, GtkTreeViewColumn *col) "This string has the same syntax as a display filter string."); field_te = gtk_entry_new(); gtk_table_attach_defaults(GTK_TABLE(main_tb), field_te, 1, 2, 2, 3); - g_object_set_data (G_OBJECT(field_te), E_FILT_FIELD_NAME_ONLY_KEY, ""); + g_object_set_data (G_OBJECT(field_te), E_FILT_FIELD_NAME_ONLY_KEY, (gpointer)""); g_signal_connect(field_te, "changed", G_CALLBACK(filter_te_syntax_check_cb), NULL); g_signal_connect(field_te, "key-press-event", G_CALLBACK (filter_string_te_key_pressed_cb), NULL); g_signal_connect(win, "key-press-event", G_CALLBACK (filter_parent_dlg_key_pressed_cb), NULL); @@ -1039,7 +1039,7 @@ scroll_to_and_select_iter(GtkTreeModel *model, GtkTreeSelection *selection, GtkT path, NULL, TRUE, /* use_align */ - 0.5, /* row_align determines where the row is placed, 0.5 means center */ + 0.5f, /* row_align determines where the row is placed, 0.5 means center */ 0); /* The horizontal alignment of the column */ /* "cursor-changed" signal triggers packet_list_select_cb() */ @@ -1105,7 +1105,7 @@ packet_list_moveto_end(void) path, NULL, TRUE, /* use_align */ - 0.5, /* row_align determines where the row is placed, 0.5 means center */ + 0.5f, /* row_align determines where the row is placed, 0.5 means center */ 0); /* The horizontal alignment of the column */ gtk_tree_path_free(path); diff --git a/ui/gtk/packet_list_store.c b/ui/gtk/packet_list_store.c index d10e7fb356..c804be8cc0 100644 --- a/ui/gtk/packet_list_store.c +++ b/ui/gtk/packet_list_store.c @@ -57,7 +57,7 @@ /** PacketListRecord: represents a row */ typedef struct _PacketListRecord { /** The column text for some columns */ - gchar **col_text; + const gchar **col_text; /**< The length of the column text strings in 'col_text' */ gushort *col_text_len; @@ -1281,7 +1281,7 @@ packet_list_get_widest_column_string(PacketList *packet_list, gint col) PacketListRecord *record; guint vis_idx; - gchar *widest_column_str = NULL; + const gchar *widest_column_str = NULL; guint widest_column_len = 0; if (!packet_list->columnized) diff --git a/ui/gtk/prefs_column.c b/ui/gtk/prefs_column.c index b6259cd71d..27007d9d8f 100644 --- a/ui/gtk/prefs_column.c +++ b/ui/gtk/prefs_column.c @@ -262,7 +262,7 @@ column_prefs_show(GtkWidget *prefs_window) { gtk_widget_show(field_lb); field_te = gtk_entry_new(); - g_object_set_data (G_OBJECT(field_te), E_FILT_FIELD_NAME_ONLY_KEY, ""); + g_object_set_data (G_OBJECT(field_te), E_FILT_FIELD_NAME_ONLY_KEY, (gpointer)""); g_signal_connect(field_te, "changed", G_CALLBACK(filter_te_syntax_check_cb), NULL); /* XXX: column_field_changed_cb will be called for every character entered in the entry box. */ @@ -293,7 +293,7 @@ column_prefs_show(GtkWidget *prefs_window) { occurrence_te = gtk_entry_new(); gtk_entry_set_max_length (GTK_ENTRY(occurrence_te),4); - g_object_set_data (G_OBJECT(occurrence_te), "occurrence", ""); + g_object_set_data (G_OBJECT(occurrence_te), "occurrence", (gpointer)""); /* XXX: column_occurrence_changed_cb will be called for every character entered in the entry box. */ /* Consider Changing logic so that the field is "accepted" only when a return is entered ?? */ diff --git a/ui/gtk/prefs_dlg.c b/ui/gtk/prefs_dlg.c index 51f74b71d0..9e1789f5ad 100644 --- a/ui/gtk/prefs_dlg.c +++ b/ui/gtk/prefs_dlg.c @@ -1061,7 +1061,7 @@ pref_fetch(pref_t *pref, gpointer user_data) case PREF_UINT: str_val = gtk_entry_get_text(GTK_ENTRY(pref->control)); - uval = strtoul(str_val, &p, pref->info.base); + uval = (guint)strtoul(str_val, &p, pref->info.base); #if 0 if (p == value || *p != '\0') return PREFS_SET_SYNTAX_ERR; /* number was bad */ diff --git a/ui/gtk/prefs_gui.c b/ui/gtk/prefs_gui.c index 34ba81a323..eafb5a9963 100644 --- a/ui/gtk/prefs_gui.c +++ b/ui/gtk/prefs_gui.c @@ -594,7 +594,7 @@ recent_df_entries_changed_cb(GtkWidget *recent_df_entry _U_, * filed ... */ - newval = strtol(gtk_entry_get_text (GTK_ENTRY(recent_df_entries_count_te)), NULL, 10); + newval = (guint)strtol(gtk_entry_get_text (GTK_ENTRY(recent_df_entries_count_te)), NULL, 10); if (newval > 0) { prefs.gui_recent_df_entries_max = newval; @@ -619,7 +619,7 @@ recent_files_count_changed_cb(GtkWidget *recent_files_entry _U_, * filed ... */ - newval = strtol(gtk_entry_get_text (GTK_ENTRY(recent_files_count_te)), NULL, 10); + newval = (guint)strtol(gtk_entry_get_text (GTK_ENTRY(recent_files_count_te)), NULL, 10); if (newval > 0) { prefs.gui_recent_files_count_max = newval; @@ -644,7 +644,7 @@ fileopen_preview_changed_cb(GtkWidget *recent_files_entry _U_, * filed ... */ - newval = strtol(gtk_entry_get_text (GTK_ENTRY(fileopen_preview_te)), NULL, 10); + newval = (guint)strtol(gtk_entry_get_text (GTK_ENTRY(fileopen_preview_te)), NULL, 10); if (newval > 0) { prefs.gui_fileopen_preview = newval; @@ -705,7 +705,7 @@ scroll_percent_changed_cb(GtkWidget *recent_files_entry _U_, * Now, just convert the string to a number and store it in the prefs field ... */ - newval = strtol(gtk_entry_get_text(GTK_ENTRY(scroll_percent_te)), NULL, 10); + newval = (guint)strtol(gtk_entry_get_text(GTK_ENTRY(scroll_percent_te)), NULL, 10); if (newval <= 100) { prefs.gui_auto_scroll_percentage = newval; diff --git a/ui/gtk/proto_hier_stats_dlg.c b/ui/gtk/proto_hier_stats_dlg.c index c75ffbed9d..c51118f9f7 100644 --- a/ui/gtk/proto_hier_stats_dlg.c +++ b/ui/gtk/proto_hier_stats_dlg.c @@ -313,7 +313,7 @@ fill_in_tree_node(GNode *node, gpointer data) ph_stats_t *ps = di->ps; draw_info_t child_di; double seconds; - gchar *text[NUM_STAT_COLUMNS]; + gchar *text[NUM_STAT_COLUMNS]; float percent_packets, percent_bytes; GtkTreeView *tree_view = di->tree_view; GtkTreeIter *iter = di->iter; @@ -333,7 +333,7 @@ fill_in_tree_node(GNode *node, gpointer data) text[BANDWIDTH_COLUMN] = g_strdup_printf("%.3f", BANDWIDTH(stats->num_bytes_total, seconds)); } else { - text[BANDWIDTH_COLUMN] = "n.c."; + text[BANDWIDTH_COLUMN] = g_strdup("n.c."); } text[END_PKTS_COLUMN] = g_strdup_printf("%u", stats->num_pkts_last); text[END_BYTES_COLUMN] = g_strdup_printf("%u", stats->num_bytes_last); @@ -341,7 +341,7 @@ fill_in_tree_node(GNode *node, gpointer data) text[END_BANDWIDTH_COLUMN] = g_strdup_printf("%.3f", BANDWIDTH(stats->num_bytes_last, seconds)); } else { - text[END_BANDWIDTH_COLUMN] = "n.c."; + text[END_BANDWIDTH_COLUMN] = g_strdup("n.c."); } store = GTK_TREE_STORE(gtk_tree_view_get_model(tree_view)); diff --git a/ui/gtk/rlc_lte_stat_dlg.c b/ui/gtk/rlc_lte_stat_dlg.c index 8dce4f45b0..a320b7663a 100644 --- a/ui/gtk/rlc_lte_stat_dlg.c +++ b/ui/gtk/rlc_lte_stat_dlg.c @@ -584,12 +584,12 @@ static float calculate_bw(nstime_t *start_time, nstime_t *stop_time, guint32 byt /* Only really meaningful if have a few frames spread over time... For now at least avoid dividing by something very close to 0.0 */ if (elapsed_ms < 2.0) { - return 0.0; + return 0.0f; } return ((bytes * 8) / elapsed_ms) / 1000; } else { - return 0.0; + return 0.0f; } } diff --git a/ui/gtk/rtp_analysis.c b/ui/gtk/rtp_analysis.c index 54b6c2e29d..6526e07ec6 100644 --- a/ui/gtk/rtp_analysis.c +++ b/ui/gtk/rtp_analysis.c @@ -192,7 +192,7 @@ typedef struct _dialog_data_t { GtkWidget *notebook; GtkWidget *save_voice_as_w; GtkWidget *save_csv_as_w; - gint notebook_signal_id; + gulong notebook_signal_id; dialog_graph_t dialog_graph; } dialog_data_t; diff --git a/ui/gtk/sctp_byte_graph_dlg.c b/ui/gtk/sctp_byte_graph_dlg.c index 0e89d5f39c..8596aea262 100644 --- a/ui/gtk/sctp_byte_graph_dlg.c +++ b/ui/gtk/sctp_byte_graph_dlg.c @@ -970,8 +970,8 @@ on_button_press_event (GtkWidget *widget _U_, GdkEventButton *event, gpointer us cairo_rectangle (cr, floor(MIN(u_data->io->x_old,u_data->io->x_new)), floor(MIN(u_data->io->y_old,u_data->io->y_new)), - abs((long)(u_data->io->x_new-u_data->io->x_old)), - abs((long)(u_data->io->y_new-u_data->io->y_old))); + abs((int)(u_data->io->x_new-u_data->io->x_old)), + abs((int)(u_data->io->y_new-u_data->io->y_old))); cairo_set_source_rgb (cr, 1, 1, 1); cairo_stroke (cr); cairo_destroy (cr); @@ -987,7 +987,7 @@ on_button_press_event (GtkWidget *widget _U_, GdkEventButton *event, gpointer us #else gdk_cairo_set_source_pixmap (cr, ios->pixmap, 0, 0); #endif - cairo_rectangle (cr, 0, 0, abs((long)(u_data->io->x_new-u_data->io->x_old)), abs((long)(u_data->io->y_new-u_data->io->y_old))); + cairo_rectangle (cr, 0, 0, abs((int)(u_data->io->x_new-u_data->io->x_old)), abs((int)(u_data->io->y_new-u_data->io->y_old))); cairo_fill (cr); cairo_destroy (cr); @@ -1033,7 +1033,7 @@ on_button_release_event (GtkWidget *widget _U_, GdkEventButton *event, gpointer if (event->x < LEFT_BORDER+u_data->io->offset) event->x = LEFT_BORDER+u_data->io->offset; - if (abs((long)(event->x-u_data->io->x_old))>10 || abs((long)(event->y-u_data->io->y_old))>10) + if (abs((int)(event->x-u_data->io->x_old))>10 || abs((int)(event->y-u_data->io->y_old))>10) { u_data->io->rect_x_min = (guint32) floor(MIN(u_data->io->x_old,event->x)); u_data->io->rect_x_max = (guint32) ceil(MAX(u_data->io->x_old,event->x)); diff --git a/ui/gtk/sctp_graph_dlg.c b/ui/gtk/sctp_graph_dlg.c index 566b320791..99ed64c59d 100644 --- a/ui/gtk/sctp_graph_dlg.c +++ b/ui/gtk/sctp_graph_dlg.c @@ -1360,8 +1360,8 @@ on_button_press_event (GtkWidget *widget _U_, GdkEventButton *event, gpointer us cairo_rectangle (cr, floor(MIN(u_data->io->x_old,u_data->io->x_new)), floor(MIN(u_data->io->y_old,u_data->io->y_new)), - floor(abs((long)(u_data->io->x_new-u_data->io->x_old))), - floor(abs((long)(u_data->io->y_new-u_data->io->y_old)))); + floor(abs((int)(u_data->io->x_new-u_data->io->x_old))), + floor(abs((int)(u_data->io->y_new-u_data->io->y_old)))); cairo_set_source_rgb (cr, 1, 1, 1); cairo_stroke (cr); cairo_destroy (cr); @@ -1377,7 +1377,7 @@ on_button_press_event (GtkWidget *widget _U_, GdkEventButton *event, gpointer us #else gdk_cairo_set_source_pixmap (cr, ios->pixmap, 0, 0); #endif - cairo_rectangle (cr, 0, 0, abs((long)(u_data->io->x_new-u_data->io->x_old)), abs((long)(u_data->io->y_new-u_data->io->y_old))); + cairo_rectangle (cr, 0, 0, abs((int)(u_data->io->x_new-u_data->io->x_old)), abs((int)(u_data->io->y_new-u_data->io->y_old))); cairo_fill (cr); cairo_destroy (cr); @@ -1422,7 +1422,7 @@ on_button_release_event (GtkWidget *widget _U_, GdkEventButton *event, gpointer event->y = u_data->io->surface_height-BOTTOM_BORDER-u_data->io->offset; if (event->x < LEFT_BORDER+u_data->io->offset) event->x = LEFT_BORDER+u_data->io->offset; - if (abs((long)(event->x-u_data->io->x_old))>10 || abs((long)(event->y-u_data->io->y_old))>10) + if (abs((int)(event->x-u_data->io->x_old))>10 || abs((int)(event->y-u_data->io->y_old))>10) { u_data->io->rect_x_min = (gint)floor(MIN(u_data->io->x_old,event->x)); u_data->io->rect_x_max = (gint)ceil(MAX(u_data->io->x_old,event->x)); diff --git a/ui/gtk/simple_dialog.c b/ui/gtk/simple_dialog.c index 513dacc5b5..9f3b8ea954 100644 --- a/ui/gtk/simple_dialog.c +++ b/ui/gtk/simple_dialog.c @@ -375,7 +375,7 @@ void simple_dialog_set_cb(gpointer dialog, simple_dialog_cb_t callback_fct, gpoi g_object_set_data(G_OBJECT(GTK_WIDGET(dialog)), CALLBACK_DATA_KEY, data); } -void simple_dialog_check_set(gpointer dialog, gchar *text _U_) { +void simple_dialog_check_set(gpointer dialog, const gchar *text) { GtkWidget *ask_cb = g_object_get_data(G_OBJECT(dialog), CHECK_BUTTON); gtk_button_set_label(GTK_BUTTON(ask_cb), text); @@ -388,12 +388,12 @@ gboolean simple_dialog_check_get(gpointer dialog) { return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ask_cb)); } -char * +const char * simple_dialog_primary_start(void) { return ""; } -char * +const char * simple_dialog_primary_end(void) { return ""; } diff --git a/ui/gtk/sip_stat.c b/ui/gtk/sip_stat.c index 3ccfcd7acc..a5b08ec61d 100644 --- a/ui/gtk/sip_stat.c +++ b/ui/gtk/sip_stat.c @@ -538,7 +538,7 @@ win_destroy_cb(GtkWindow *win _U_, gpointer data) static void -init_table(GtkWidget *main_vb, gchar *title, tbl_info_t *tbl_info) +init_table(GtkWidget *main_vb, const gchar *title, tbl_info_t *tbl_info) { GtkWidget *fr; diff --git a/ui/gtk/stock_icons.c b/ui/gtk/stock_icons.c index 0d2908a1d6..691af12483 100644 --- a/ui/gtk/stock_icons.c +++ b/ui/gtk/stock_icons.c @@ -95,75 +95,75 @@ void stock_icons_init(void) { /* register non-standard pixmaps with the gtk-stock engine */ static const GtkStockItem stock_items[] = { - { WIRESHARK_STOCK_CAPTURE_INTERFACES, "_Interfaces", 0, 0, NULL }, - { WIRESHARK_STOCK_CAPTURE_OPTIONS, "_Options", 0, 0, NULL }, - { WIRESHARK_STOCK_CAPTURE_START, "_Start", 0, 0, NULL }, - { WIRESHARK_STOCK_CAPTURE_STOP, "S_top", 0, 0, NULL }, - { WIRESHARK_STOCK_CAPTURE_RESTART, "_Restart", 0, 0, NULL }, - { WIRESHARK_STOCK_CAPTURE_FILTER, "_Capture Filter", 0, 0, NULL }, - { WIRESHARK_STOCK_CAPTURE_FILTER_ENTRY, "_Capture Filter:", 0, 0, NULL }, - { WIRESHARK_STOCK_CAPTURE_DETAILS, "_Details", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_CAPTURE_INTERFACES, (char *)"_Interfaces", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_CAPTURE_OPTIONS, (char *)"_Options", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_CAPTURE_START, (char *)"_Start", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_CAPTURE_STOP, (char *)"S_top", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_CAPTURE_RESTART, (char *)"_Restart", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_CAPTURE_FILTER, (char *)"_Capture Filter", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_CAPTURE_FILTER_ENTRY, (char *)"_Capture Filter:", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_CAPTURE_DETAILS, (char *)"_Details", 0, 0, NULL }, #ifdef HAVE_GEOIP - { WIRESHARK_STOCK_MAP, "Map", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_MAP, (char *)"Map", 0, 0, NULL }, #endif - { WIRESHARK_STOCK_GRAPH_A_B, "Graph A->B", 0, 0, NULL }, - { WIRESHARK_STOCK_GRAPH_B_A, "Graph B->A", 0, 0, NULL }, - { WIRESHARK_STOCK_FOLLOW_STREAM, "Follow Stream", 0, 0, NULL }, - { WIRESHARK_STOCK_DISPLAY_FILTER, "Display _Filter", 0, 0, NULL }, - { WIRESHARK_STOCK_DISPLAY_FILTER_ENTRY, "F_ilter:", 0, 0, NULL }, - { WIRESHARK_STOCK_BROWSE, "_Browse...", 0, 0, NULL }, - { WIRESHARK_STOCK_CREATE_STAT, "Create _Stat", 0, 0, NULL }, - { WIRESHARK_STOCK_EXPORT, "_Export...", 0, 0, NULL }, - { WIRESHARK_STOCK_IMPORT, "_Import...", 0, 0, NULL }, - { WIRESHARK_STOCK_EDIT, "_Edit...", 0, 0, NULL }, - { WIRESHARK_STOCK_ADD_EXPRESSION, "E_xpression..." , 0, 0, NULL }, /* plus sign coming from icon */ - { WIRESHARK_STOCK_CLEAR_EXPRESSION, "Clea_r" , 0, 0, NULL }, - { WIRESHARK_STOCK_APPLY_EXPRESSION, "App_ly" , 0, 0, NULL }, - { WIRESHARK_STOCK_SAVE_ALL, "Save A_ll", 0, 0, NULL }, - { WIRESHARK_STOCK_DONT_SAVE, "Continue _without Saving", 0, 0, NULL }, - { WIRESHARK_STOCK_QUIT_DONT_SAVE, "Quit _without Saving", 0, 0, NULL }, - { WIRESHARK_STOCK_STOP_DONT_SAVE, "Stop and Continue _without Saving", 0, 0, NULL }, - { WIRESHARK_STOCK_STOP_QUIT_DONT_SAVE, "Stop and Quit _without Saving", 0, 0, NULL }, - { WIRESHARK_STOCK_STOP_SAVE, "Stop and Save", 0, 0, NULL }, - { WIRESHARK_STOCK_ABOUT, "_About", 0, 0, NULL }, - { WIRESHARK_STOCK_COLORIZE, "_Colorize", 0, 0, NULL }, - { WIRESHARK_STOCK_AUTOSCROLL, "_Auto Scroll", 0, 0, NULL }, - { WIRESHARK_STOCK_RESIZE_COLUMNS, "Resize Columns", 0, 0, NULL }, - { WIRESHARK_STOCK_TIME, "Time", 0, 0, NULL }, - { WIRESHARK_STOCK_INTERNET, "Internet", 0, 0, NULL }, - { WIRESHARK_STOCK_WEB_SUPPORT, "Web Support", 0, 0, NULL }, - { WIRESHARK_STOCK_WIKI, "Wiki", 0, 0, NULL }, - { WIRESHARK_STOCK_CONVERSATIONS, "Conversations", 0, 0, NULL }, - { WIRESHARK_STOCK_ENDPOINTS, "Endpoints", 0, 0, NULL }, - { WIRESHARK_STOCK_EXPERT_INFO, "Expert Info", 0, 0, NULL }, - { WIRESHARK_STOCK_GRAPHS, "Graphs", 0, 0, NULL }, - { WIRESHARK_STOCK_FLOW_GRAPH, "Flow Graph", 0, 0, NULL }, - { WIRESHARK_STOCK_TELEPHONY, "Telephony", 0, 0, NULL }, - { WIRESHARK_STOCK_DECODE_AS, "Decode As", 0, 0, NULL }, - { WIRESHARK_STOCK_CHECKBOX, "Checkbox", 0, 0, NULL }, - { WIRESHARK_STOCK_FILE_SET_LIST, "List Files", 0, 0, NULL }, - { WIRESHARK_STOCK_FILE_SET_NEXT, "Next File", 0, 0, NULL }, - { WIRESHARK_STOCK_FILE_SET_PREVIOUS, "Previous File", 0, 0, NULL }, - { WIRESHARK_STOCK_FILTER_OUT_STREAM, "Filter Out This Stream", 0, 0, NULL }, - { WIRESHARK_STOCK_ENABLE, "Enable", 0, 0, NULL }, - { WIRESHARK_STOCK_DISABLE, "Disable", 0, 0, NULL }, - { WIRESHARK_STOCK_COLOR1, "Color 1", 0, 0, NULL }, - { WIRESHARK_STOCK_COLOR2, "Color 2", 0, 0, NULL }, - { WIRESHARK_STOCK_COLOR3, "Color 3", 0, 0, NULL }, - { WIRESHARK_STOCK_COLOR4, "Color 4", 0, 0, NULL }, - { WIRESHARK_STOCK_COLOR5, "Color 5", 0, 0, NULL }, - { WIRESHARK_STOCK_COLOR6, "Color 6", 0, 0, NULL }, - { WIRESHARK_STOCK_COLOR7, "Color 7", 0, 0, NULL }, - { WIRESHARK_STOCK_COLOR8, "Color 8", 0, 0, NULL }, - { WIRESHARK_STOCK_COLOR9, "Color 9", 0, 0, NULL }, - { WIRESHARK_STOCK_COLOR0, "Color 10", 0, 0, NULL }, - { WIRESHARK_STOCK_DECODE, "Decode", 0, 0, NULL }, - { WIRESHARK_STOCK_AUDIO_PLAYER, "Player", 0, 0, NULL }, - { WIRESHARK_STOCK_VOIP_FLOW, "Flow", 0, 0, NULL }, - { WIRESHARK_STOCK_TELEPHONE, "Telephone", 0, 0, NULL }, - { WIRESHARK_STOCK_PREPARE_FILTER, "Prepare Filter", 0, 0, NULL }, - { WIRESHARK_STOCK_ANALYZE, "Analyze", 0, 0, NULL }, - { WIRESHARK_STOCK_SAVE, "Save", 0, 0, NULL } + { (char *)WIRESHARK_STOCK_GRAPH_A_B, (char *)"Graph A->B", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_GRAPH_B_A, (char *)"Graph B->A", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_FOLLOW_STREAM, (char *)"Follow Stream", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_DISPLAY_FILTER, (char *)"Display _Filter", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_DISPLAY_FILTER_ENTRY, (char *)"F_ilter:", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_BROWSE, (char *)"_Browse...", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_CREATE_STAT, (char *)"Create _Stat", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_EXPORT, (char *)"_Export...", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_IMPORT, (char *)"_Import...", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_EDIT, (char *)"_Edit...", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_ADD_EXPRESSION, (char *)"E_xpression..." , 0, 0, NULL }, /* plus sign coming from icon */ + { (char *)WIRESHARK_STOCK_CLEAR_EXPRESSION, (char *)"Clea_r" , 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_APPLY_EXPRESSION, (char *)"App_ly" , 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_SAVE_ALL, (char *)"Save A_ll", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_DONT_SAVE, (char *)"Continue _without Saving", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_QUIT_DONT_SAVE, (char *)"Quit _without Saving", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_STOP_DONT_SAVE, (char *)"Stop and Continue _without Saving", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_STOP_QUIT_DONT_SAVE, (char *)"Stop and Quit _without Saving", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_STOP_SAVE, (char *)"Stop and Save", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_ABOUT, (char *)"_About", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_COLORIZE, (char *)"_Colorize", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_AUTOSCROLL, (char *)"_Auto Scroll", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_RESIZE_COLUMNS, (char *)"Resize Columns", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_TIME, (char *)"Time", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_INTERNET, (char *)"Internet", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_WEB_SUPPORT, (char *)"Web Support", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_WIKI, (char *)"Wiki", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_CONVERSATIONS, (char *)"Conversations", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_ENDPOINTS, (char *)"Endpoints", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_EXPERT_INFO, (char *)"Expert Info", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_GRAPHS, (char *)"Graphs", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_FLOW_GRAPH, (char *)"Flow Graph", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_TELEPHONY, (char *)"Telephony", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_DECODE_AS, (char *)"Decode As", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_CHECKBOX, (char *)"Checkbox", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_FILE_SET_LIST, (char *)"List Files", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_FILE_SET_NEXT, (char *)"Next File", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_FILE_SET_PREVIOUS, (char *)"Previous File", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_FILTER_OUT_STREAM, (char *)"Filter Out This Stream", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_ENABLE, (char *)"Enable", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_DISABLE, (char *)"Disable", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_COLOR1, (char *)"Color 1", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_COLOR2, (char *)"Color 2", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_COLOR3, (char *)"Color 3", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_COLOR4, (char *)"Color 4", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_COLOR5, (char *)"Color 5", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_COLOR6, (char *)"Color 6", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_COLOR7, (char *)"Color 7", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_COLOR8, (char *)"Color 8", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_COLOR9, (char *)"Color 9", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_COLOR0, (char *)"Color 10", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_DECODE, (char *)"Decode", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_AUDIO_PLAYER, (char *)"Player", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_VOIP_FLOW, (char *)"Flow", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_TELEPHONE, (char *)"Telephone", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_PREPARE_FILTER, (char *)"Prepare Filter", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_ANALYZE, (char *)"Analyze", 0, 0, NULL }, + { (char *)WIRESHARK_STOCK_SAVE, (char *)"Save", 0, 0, NULL } }; static const stock_pixmap_t pixmaps[] = { diff --git a/ui/gtk/time_shift_dlg.c b/ui/gtk/time_shift_dlg.c index 0ce0db04fb..976aab4756 100644 --- a/ui/gtk/time_shift_dlg.c +++ b/ui/gtk/time_shift_dlg.c @@ -429,7 +429,7 @@ time_shift_apply_cb(GtkWidget *ok_bt _U_, GtkWindow *parent_w) if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(flag_rb)) == TRUE) { packetnumber_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_SETTIME_PACKETNUMBER_KEY); - packet_num = strtol((char *)gtk_entry_get_text(GTK_ENTRY(packetnumber_te)), NULL, 10); + packet_num = (guint)strtol((char *)gtk_entry_get_text(GTK_ENTRY(packetnumber_te)), NULL, 10); time_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_SETTIME_TIME_KEY); time_text = gtk_entry_get_text(GTK_ENTRY(time_te)); @@ -442,14 +442,14 @@ time_shift_apply_cb(GtkWidget *ok_bt _U_, GtkWindow *parent_w) if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(flag_rb)) == TRUE) { packetnumber_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_ADJTIME_PACKETNUMBER1_KEY); - packet_num = strtol((char *)gtk_entry_get_text(GTK_ENTRY(packetnumber_te)), NULL, 10); + packet_num = (guint)strtol((char *)gtk_entry_get_text(GTK_ENTRY(packetnumber_te)), NULL, 10); time_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_ADJTIME_TIME1_KEY); time_text = gtk_entry_get_text(GTK_ENTRY(time_te)); packetnumber_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_ADJTIME_PACKETNUMBER2_KEY); - packet2_num = strtol((char *)gtk_entry_get_text(GTK_ENTRY(packetnumber_te)), NULL, 10); + packet2_num = (guint)strtol((char *)gtk_entry_get_text(GTK_ENTRY(packetnumber_te)), NULL, 10); time_te = (GtkWidget *)g_object_get_data(G_OBJECT(parent_w), E_ADJTIME_TIME2_KEY); time2_text = gtk_entry_get_text(GTK_ENTRY(time_te)); diff --git a/ui/gtk/voip_calls.c b/ui/gtk/voip_calls.c index 84c1308037..53ee9b1da7 100644 --- a/ui/gtk/voip_calls.c +++ b/ui/gtk/voip_calls.c @@ -3815,7 +3815,6 @@ iax2_calls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, c address* phone; const iax2_info_t *ii = iax2_info; iax2_info_t *tmp_iax2info; - gchar * comment; if (ii == NULL || ii->ptype != IAX2_FULL_PACKET || (ii->scallno == 0 && ii->dcallno == 0)) return 0; @@ -3874,9 +3873,7 @@ iax2_calls_packet( void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, c ++(callsinfo->npackets); } - comment = ""; - - add_to_graph(tapinfo, pinfo, ii->messageName, comment, + add_to_graph(tapinfo, pinfo, ii->messageName, "", callsinfo->call_num, &(pinfo->src), &(pinfo->dst), 1); return 1; diff --git a/ui/qt/display_filter_combo.cpp b/ui/qt/display_filter_combo.cpp index 3303e4cdda..1d6b121b80 100644 --- a/ui/qt/display_filter_combo.cpp +++ b/ui/qt/display_filter_combo.cpp @@ -110,7 +110,7 @@ void DisplayFilterCombo::updateMaxCount() setMaxCount(prefs.gui_recent_df_entries_max); } -extern "C" gboolean dfilter_combo_add_recent(gchar *filter) { +extern "C" gboolean dfilter_combo_add_recent(const gchar *filter) { if (!cur_display_filter_combo) return FALSE; @@ -123,7 +123,7 @@ extern "C" gboolean dfilter_combo_add_recent(gchar *filter) { // xxx - Move to an as-yet-to-be-written capture filter module along with ::addRecentCapture and ::writeRecentCapture QList cfilters; -extern "C" gboolean cfilter_combo_add_recent(gchar *filter) { +extern "C" gboolean cfilter_combo_add_recent(const gchar *filter) { cfilters.append(filter); return TRUE; } diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp index 667ed35751..02de38bdb0 100644 --- a/ui/qt/wireshark_application.cpp +++ b/ui/qt/wireshark_application.cpp @@ -79,7 +79,7 @@ set_last_open_dir(const char *dirname) * http://stackoverflow.com/questions/437212/how-do-you-register-a-most-recently-used-list-with-windows-in-preparation-for-win */ extern "C" void -add_menu_recent_capture_file(gchar *cf_name) { +add_menu_recent_capture_file(const gchar *cf_name) { QString normalized_cf_name = QString::fromUtf8(cf_name); // QDir cf_path; diff --git a/ui/recent_utils.h b/ui/recent_utils.h index 7d0b3f4d5b..298c27da82 100644 --- a/ui/recent_utils.h +++ b/ui/recent_utils.h @@ -32,7 +32,7 @@ extern "C" { /* Add a new recent capture filename to the "Recent Files" submenu (duplicates will be ignored) */ -extern void add_menu_recent_capture_file(gchar *cf_name); +extern void add_menu_recent_capture_file(const gchar *cf_name); /** Write all recent capture filenames to the user's recent file. * @param rf recent file @@ -43,7 +43,7 @@ extern void menu_recent_file_write_all(FILE *rf); * * @param dftext the filter string */ -extern gboolean cfilter_combo_add_recent(gchar *s); +extern gboolean cfilter_combo_add_recent(const gchar *s); /** Write all non-empty capture filters (until maximum count) * of the combo box GList to the user's recent file. @@ -56,7 +56,7 @@ extern void cfilter_combo_recent_write_all(FILE *rf); * * @param dftext the filter string */ -extern gboolean dfilter_combo_add_recent(gchar *dftext); +extern gboolean dfilter_combo_add_recent(const gchar *dftext); /** Write all non-empty display filters (until maximum count) * of the combo box GList to the user's recent file. diff --git a/ui/simple_dialog.h b/ui/simple_dialog.h index 2445c09804..377b49a716 100644 --- a/ui/simple_dialog.h +++ b/ui/simple_dialog.h @@ -124,7 +124,7 @@ extern void simple_dialog_close(gpointer dialog); * @param dialog the dialog from simple_dialog() * @param text the text to display */ -extern void simple_dialog_check_set(gpointer dialog, gchar *text); +extern void simple_dialog_check_set(gpointer dialog, const gchar *text); /** Get the check buttons state. * @@ -137,12 +137,12 @@ extern gboolean simple_dialog_check_get(gpointer dialog); * simple_dialog_primary_start() and simple_dialog_primary_end(). * To highlight the first sentence (will take effect on GTK2 only). */ -extern char *simple_dialog_primary_start(void); +extern const char *simple_dialog_primary_start(void); /** Surround the primary dialog message text by * simple_dialog_primary_start() and simple_dialog_primary_end(). * To highlight the first sentence (will take effect on GTK2 only). */ -extern char *simple_dialog_primary_end(void); +extern const char *simple_dialog_primary_end(void); /** Escape the message text, if it probably contains Pango escape sequences. * For example html like tags starting with a <. diff --git a/ui/ssl_key_export.h b/ui/ssl_key_export.h index ee5feb8122..82a18c3e49 100644 --- a/ui/ssl_key_export.h +++ b/ui/ssl_key_export.h @@ -35,14 +35,14 @@ extern "C" { * * @return The number of available SSL session keys. */ -extern int ssl_session_key_count(); +extern int ssl_session_key_count(void); /** Dump our SSL Session Keys to a string * * @return A string containing all the SSL Session Keys. Must be freed with * g_free(). */ -extern gchar* ssl_export_sessions(); +extern gchar* ssl_export_sessions(void); #ifdef __cplusplus } diff --git a/ui/text_import.c b/ui/text_import.c index 690e6e8f00..0d38e5c4b7 100644 --- a/ui/text_import.c +++ b/ui/text_import.c @@ -141,7 +141,7 @@ static int debug = 0; /* Dummy Ethernet header */ static int hdr_ethernet = FALSE; -static unsigned long hdr_ethernet_proto = 0; +static guint32 hdr_ethernet_proto = 0; /* Dummy IP header */ static int hdr_ip = FALSE; @@ -149,40 +149,40 @@ static long hdr_ip_proto = 0; /* Dummy UDP header */ static int hdr_udp = FALSE; -static unsigned long hdr_dest_port = 0; -static unsigned long hdr_src_port = 0; +static guint32 hdr_dest_port = 0; +static guint32 hdr_src_port = 0; /* Dummy TCP header */ static int hdr_tcp = FALSE; /* Dummy SCTP header */ static int hdr_sctp = FALSE; -static unsigned long hdr_sctp_src = 0; -static unsigned long hdr_sctp_dest = 0; -static unsigned long hdr_sctp_tag = 0; +static guint32 hdr_sctp_src = 0; +static guint32 hdr_sctp_dest = 0; +static guint32 hdr_sctp_tag = 0; /* Dummy DATA chunk header */ static int hdr_data_chunk = FALSE; -static unsigned char hdr_data_chunk_type = 0; -static unsigned char hdr_data_chunk_bits = 3; -static unsigned long hdr_data_chunk_tsn = 0; -static unsigned short hdr_data_chunk_sid = 0; -static unsigned short hdr_data_chunk_ssn = 0; -static unsigned long hdr_data_chunk_ppid = 0; +static guint8 hdr_data_chunk_type = 0; +static guint8 hdr_data_chunk_bits = 3; +static guint32 hdr_data_chunk_tsn = 0; +static guint16 hdr_data_chunk_sid = 0; +static guint16 hdr_data_chunk_ssn = 0; +static guint32 hdr_data_chunk_ppid = 0; /*--- Local data -----------------------------------------------------------------*/ /* This is where we store the packet currently being built */ -static unsigned char *packet_buf; -static unsigned long curr_offset = 0; -static unsigned long max_offset = IMPORT_MAX_PACKET; -static unsigned long packet_start = 0; +static guint8 *packet_buf; +static guint32 curr_offset = 0; +static guint32 max_offset = IMPORT_MAX_PACKET; +static guint32 packet_start = 0; static void start_new_packet (void); /* This buffer contains strings present before the packet offset 0 */ #define PACKET_PREAMBLE_MAX_LEN 2048 -static unsigned char packet_preamble[PACKET_PREAMBLE_MAX_LEN+1]; +static guint8 packet_preamble[PACKET_PREAMBLE_MAX_LEN+1]; static int packet_preamble_len = 0; /* Time code of packet, derived from packet_preamble */ @@ -194,7 +194,7 @@ static struct tm timecode_default; static wtap_dumper* wdh; /* HDR_ETH Offset base to parse */ -static unsigned long offset_base = 16; +static guint32 offset_base = 16; /* ----- State machine -----------------------------------------------------------*/ @@ -306,14 +306,14 @@ typedef struct { static hdr_data_chunk_t HDR_DATA_CHUNK = {0, 0, 0, 0, 0, 0, 0}; /* Link-layer type; see net/bpf.h for details */ -static unsigned long pcap_link_type = 1; /* Default is DLT-EN10MB */ +static guint pcap_link_type = 1; /* Default is DLT_EN10MB */ /*---------------------------------------------------------------------- * Parse a single hex number * Will abort the program if it can't parse the number * Pass in TRUE if this is an offset, FALSE if not */ -static unsigned long +static guint32 parse_num (const char *str, int offset) { unsigned long num; @@ -323,7 +323,7 @@ parse_num (const char *str, int offset) if (c==str) { fprintf(stderr, "FATAL ERROR: Bad hex number? [%s]\n", str); } - return num; + return (guint32)num; } /*---------------------------------------------------------------------- @@ -332,10 +332,10 @@ parse_num (const char *str, int offset) static void write_byte (const char *str) { - unsigned long num; + guint32 num; num = parse_num(str, FALSE); - packet_buf[curr_offset] = (unsigned char) num; + packet_buf[curr_offset] = (guint8) num; curr_offset ++; if (curr_offset >= max_offset) /* packet full */ start_new_packet(); @@ -345,7 +345,7 @@ write_byte (const char *str) * Remove bytes from the current packet */ static void -unwrite_bytes (unsigned long nbytes) +unwrite_bytes (guint32 nbytes) { curr_offset -= nbytes; } @@ -353,10 +353,10 @@ unwrite_bytes (unsigned long nbytes) /*---------------------------------------------------------------------- * Determin SCTP chunk padding length */ -static unsigned long -number_of_padding_bytes (unsigned long length) +static guint32 +number_of_padding_bytes (guint32 length) { - unsigned long remainder; + guint32 remainder; remainder = length % 4; @@ -384,15 +384,15 @@ write_current_packet (void) /* Compute packet length */ prefix_length = 0; - if (hdr_data_chunk) { prefix_length += sizeof(HDR_DATA_CHUNK); } - if (hdr_sctp) { prefix_length += sizeof(HDR_SCTP); } - if (hdr_udp) { prefix_length += sizeof(HDR_UDP); proto_length = prefix_length + curr_offset; } - if (hdr_tcp) { prefix_length += sizeof(HDR_TCP); proto_length = prefix_length + curr_offset; } + if (hdr_data_chunk) { prefix_length += (int)sizeof(HDR_DATA_CHUNK); } + if (hdr_sctp) { prefix_length += (int)sizeof(HDR_SCTP); } + if (hdr_udp) { prefix_length += (int)sizeof(HDR_UDP); proto_length = prefix_length + curr_offset; } + if (hdr_tcp) { prefix_length += (int)sizeof(HDR_TCP); proto_length = prefix_length + curr_offset; } if (hdr_ip) { - prefix_length += sizeof(HDR_IP); + prefix_length += (int)sizeof(HDR_IP); ip_length = prefix_length + curr_offset + ((hdr_data_chunk) ? number_of_padding_bytes(curr_offset) : 0); } - if (hdr_ethernet) { prefix_length += sizeof(HDR_ETHERNET); } + if (hdr_ethernet) { prefix_length += (int)sizeof(HDR_ETHERNET); } /* Make room for dummy header */ memmove(&packet_buf[prefix_length], packet_buf, curr_offset); @@ -408,7 +408,7 @@ write_current_packet (void) if (hdr_ethernet) { HDR_ETHERNET.l3pid = g_htons(hdr_ethernet_proto); memcpy(&packet_buf[prefix_index], &HDR_ETHERNET, sizeof(HDR_ETHERNET)); - prefix_index += sizeof(HDR_ETHERNET); + prefix_index += (int)sizeof(HDR_ETHERNET); } /* Write IP header */ @@ -422,7 +422,7 @@ write_current_packet (void) HDR_IP.hdr_checksum = in_cksum(cksum_vector, 1); memcpy(&packet_buf[prefix_index], &HDR_IP, sizeof(HDR_IP)); - prefix_index += sizeof(HDR_IP); + prefix_index += (int)sizeof(HDR_IP); } /* initialize pseudo header for checksum calculation */ @@ -447,7 +447,7 @@ write_current_packet (void) HDR_UDP.checksum = in_cksum(cksum_vector, 3); memcpy(&packet_buf[prefix_index], &HDR_UDP, sizeof(HDR_UDP)); - prefix_index += sizeof(HDR_UDP); + prefix_index += (int)sizeof(HDR_UDP); } /* Write TCP header */ @@ -466,7 +466,7 @@ write_current_packet (void) HDR_TCP.checksum = in_cksum(cksum_vector, 3); memcpy(&packet_buf[prefix_index], &HDR_TCP, sizeof(HDR_TCP)); - prefix_index += sizeof(HDR_TCP); + prefix_index += (int)sizeof(HDR_TCP); } /* Compute DATA chunk header and append padding */ @@ -498,13 +498,13 @@ write_current_packet (void) HDR_SCTP.checksum = g_htonl(~crc32c_calculate(&packet_buf[prefix_length], curr_offset, HDR_SCTP.checksum)); memcpy(&packet_buf[prefix_index], &HDR_SCTP, sizeof(HDR_SCTP)); - prefix_index += sizeof(HDR_SCTP); + prefix_index += (int)sizeof(HDR_SCTP); } /* Write DATA chunk header */ if (hdr_data_chunk) { memcpy(&packet_buf[prefix_index], &HDR_DATA_CHUNK, sizeof(HDR_DATA_CHUNK)); - prefix_index += sizeof(HDR_DATA_CHUNK); + prefix_index += (int)sizeof(HDR_DATA_CHUNK); } /* Write Ethernet trailer */ @@ -636,7 +636,7 @@ parse_preamble (void) else { /* Parse subseconds */ - ts_usec = strtol(subsecs, &p, 10); + ts_usec = (guint32)strtol(subsecs, &p, 10); if (subsecs == p) { /* Error */ ts_usec = 0; @@ -709,7 +709,7 @@ process_directive (char *str) void parse_token (token_t token, char *str) { - unsigned long num; + guint32 num; /* * This is implemented as a simple state machine of five states. @@ -782,7 +782,7 @@ parse_token (token_t token, char *str) } else { /* Bad offset; switch to INIT state */ if (debug>=1) - fprintf(stderr, "Inconsistent offset. Expecting %0lX, got %0lX. Ignoring rest of packet\n", + fprintf(stderr, "Inconsistent offset. Expecting %0X, got %0X. Ignoring rest of packet\n", curr_offset, num); write_current_packet(); state = INIT; @@ -863,9 +863,9 @@ parse_token (token_t token, char *str) void text_import_setup(text_import_info_t *info) { - packet_buf = (unsigned char *)g_malloc(sizeof(HDR_ETHERNET) + sizeof(HDR_IP) + - sizeof(HDR_SCTP) + sizeof(HDR_DATA_CHUNK) + - IMPORT_MAX_PACKET); + packet_buf = (guint8 *)g_malloc(sizeof(HDR_ETHERNET) + sizeof(HDR_IP) + + sizeof(HDR_SCTP) + sizeof(HDR_DATA_CHUNK) + + IMPORT_MAX_PACKET); if (!packet_buf) { diff --git a/wiretap/wtap.h b/wiretap/wtap.h index 8936a52347..eb421fce1c 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -911,7 +911,7 @@ typedef struct wtapng_section_s { gchar *opt_comment; /**< NULL if not available */ gchar *shb_hardware; /**< NULL if not available, UTF-8 string containing the description of the hardware used to create this section. */ gchar *shb_os; /**< NULL if not available, UTF-8 string containing the name of the operating system used to create this section. */ - gchar *shb_user_appl; /**< NULL if not available, UTF-8 string containing the name of the application used to create this section. */ + const gchar *shb_user_appl; /**< NULL if not available, UTF-8 string containing the name of the application used to create this section. */ } wtapng_section_t; diff --git a/ws80211_utils.c b/ws80211_utils.c index 577009c67b..6e26f557a8 100644 --- a/ws80211_utils.c +++ b/ws80211_utils.c @@ -633,7 +633,7 @@ int ws80211_frequency_to_channel(int freq) } int -ws80211_str_to_chan_type(gchar *s) +ws80211_str_to_chan_type(const gchar *s) { int ret = -1; if (!s) @@ -696,7 +696,7 @@ int ws80211_set_freq(const char *name _U_, int freq _U_, int chan_type _U_) return -1; } -int ws80211_str_to_chan_type(gchar *s _U_) +int ws80211_str_to_chan_type(const gchar *s _U_) { return -1; } diff --git a/ws80211_utils.h b/ws80211_utils.h index c03589cf5a..9271b3ae04 100644 --- a/ws80211_utils.h +++ b/ws80211_utils.h @@ -59,7 +59,7 @@ int ws80211_get_iface_info(const char *name, struct ws80211_iface_info *iface_in void ws80211_free_interfaces(GArray *interfaces); int ws80211_frequency_to_channel(int freq); int ws80211_set_freq(const char *name, int freq, int chan_type); -int ws80211_str_to_chan_type(gchar *s); +int ws80211_str_to_chan_type(const gchar *s); gchar *ws80211_chan_type_to_str(int type); #endif /* __WS80211_UTILS_H__ */ diff --git a/wsutil/str_util.c b/wsutil/str_util.c index 2bd7041fb6..42934597e3 100644 --- a/wsutil/str_util.c +++ b/wsutil/str_util.c @@ -55,7 +55,7 @@ ascii_strup_inplace(gchar *str) /* Check if an entire string is printable. */ gboolean -isprint_string(guchar *str) +isprint_string(const guchar *str) { guint pos; diff --git a/wsutil/str_util.h b/wsutil/str_util.h index 40ca44ed02..10d7e9025c 100644 --- a/wsutil/str_util.h +++ b/wsutil/str_util.h @@ -68,7 +68,7 @@ gchar *ascii_strup_inplace(gchar *str); * @param str The string to be checked * @return TRUE if the entire string is printable, otherwise FALSE */ -gboolean isprint_string(guchar *string); +gboolean isprint_string(const guchar *string); /** Check if an entire string consists of digits *