Fix a bunch of warnings.

Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
sizeof.

Cast away some implicit 64-bit-to-32-bit conversion errors due to use of
strtol() and strtoul().

Change some data types to avoid those implicit conversion warnings.

When assigning a constant to a float, make sure the constant isn't a
double, by appending "f" to the constant.

Constify a bunch of variables, parameters, and return values to
eliminate warnings due to strings being given const qualifiers.  Cast
away those warnings in some cases where an API we don't control forces
us to do so.

Enable a bunch of additional warnings by default.  Note why at least
some of the other warnings aren't enabled.

randpkt.c and text2pcap.c are used to build programs, so they don't need
to be in EXTRA_DIST.

If the user specifies --enable-warnings-as-errors, add -Werror *even if
the user specified --enable-extra-gcc-flags; assume they know what
they're doing and are willing to have the compile fail due to the extra
GCC warnings being treated as errors.

svn path=/trunk/; revision=46748
This commit is contained in:
Guy Harris 2012-12-26 05:57:06 +00:00
parent 8ede6b7dc0
commit 8ed7a73e22
289 changed files with 2354 additions and 2466 deletions

View File

@ -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 \

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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)

View File

@ -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);

View File

@ -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);

View File

@ -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 */

View File

@ -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);

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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")

View File

@ -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;

View File

@ -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);

View File

@ -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 */

View File

@ -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, ':');

View File

@ -26,16 +26,18 @@
#include <string.h>
#include <glib.h>
#include <epan/adler32.h>
#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));
}
/*---------------------------------------------------------------------------*/

View File

@ -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
}

View File

@ -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;

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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 */

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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,

View File

@ -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;

View File

@ -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__ */

View File

@ -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);
}

View File

@ -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;

View File

@ -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;

View File

@ -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) {

View File

@ -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;
};

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -111,7 +111,7 @@ typedef struct {
guint32 body_len;
guint32 fields_len;
char *body_sig;
const char *body_sig;
} dbus_info_t;
typedef union {

View File

@ -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,

View File

@ -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;
}

View File

@ -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");

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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: "<prefix>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;

View File

@ -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;
}
/*****************************************************************/

View File

@ -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[] = {

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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*/

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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;
}

View File

@ -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: ");

View File

@ -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);

View File

@ -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 = "<NAMELESS DICT STRUCTURE>";
@ -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;

View File

@ -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;
}

View File

@ -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
{

View File

@ -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"

View File

@ -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[];

View File

@ -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);
}

View File

@ -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:

View File

@ -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;

View File

@ -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,

View File

@ -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;

View File

@ -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;

View File

@ -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:

View File

@ -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 */

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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

View File

@ -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 {

View File

@ -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))
{

View File

@ -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);

View File

@ -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;
}

View File

@ -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 */

View File

@ -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;
}

View File

@ -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);

View File

@ -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; i<nrec; i++)
{
curr = offset + ((sizeof(guint32)+sizeof(guint16)) * i);
curr = offset + (int)((sizeof(guint32)+sizeof(guint16)) * i);
len = tvb_get_ntohs(tvb,curr);
@ -575,7 +575,7 @@ static void dissect_srv_records(tvbuff_t* tvb, proto_tree* tree,guint32 nrec,int
dlen,
"DNAME: %s", dname);
curr+=((sizeof(short)*4) + dlen);
curr+=(int)((sizeof(short)*4) + dlen);
}
@ -631,7 +631,7 @@ static void dissect_mx_records(tvbuff_t* tvb, proto_tree* tree, guint32 nrec, in
dlen,
"name: %s", dname);
curr+=((sizeof(short)*2) + dlen);
curr+=(int)((sizeof(short)*2) + dlen);
}
@ -675,7 +675,7 @@ static void dissect_ns_records(tvbuff_t* tvb, proto_tree* tree, guint32 nrec, in
curr + 2,
dlen,
"Name: %s", dname);
curr+=(sizeof(short) + dlen);
curr+=(int)(sizeof(short) + dlen);
}

View File

@ -644,8 +644,8 @@ dissect_megaco_text(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
if (check_col(pinfo->cinfo, 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;

View File

@ -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)
{

View File

@ -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)

View File

@ -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,

View File

@ -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) {

View File

@ -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);

Some files were not shown because too many files have changed in this diff Show More