aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-rtps.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2009-04-06 23:06:35 +0000
committerGerald Combs <gerald@wireshark.org>2009-04-06 23:06:35 +0000
commitc1e3c91b8f9887d44d58b791aeffd1d94b2b6715 (patch)
treec15f86523450fcc7a7a5a583b51cc048b9dc5b9e /epan/dissectors/packet-rtps.c
parent664ab35c79223ff81f14e2a6ba5792f5fa3617e3 (diff)
The last of the size_t fixes in epan/dissectors.
svn path=/trunk/; revision=27980
Diffstat (limited to 'epan/dissectors/packet-rtps.c')
-rw-r--r--epan/dissectors/packet-rtps.c67
1 files changed, 25 insertions, 42 deletions
diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c
index 141e6a3dd4..be964d0921 100644
--- a/epan/dissectors/packet-rtps.c
+++ b/epan/dissectors/packet-rtps.c
@@ -77,7 +77,6 @@
#define MAX_NTP_TIME_SIZE (128)
#define MAX_PORT_SIZE (32)
#define MAX_PARAM_SIZE (256)
-#define MAX_SUMMARY_SIZE (500)
#define MAX_LOCATOR_SIZE (200)
#define MAX_IPV6_SIZE (100)
#define MAX_BITMAP_SIZE (200)
@@ -581,20 +580,20 @@ static guint64 rtps_util_add_seq_number(proto_tree *, tvbuff_t *,
static void rtps_util_add_ntp_time(proto_tree *, tvbuff_t *,
gint, int, const char *, guint8 *, gint);
static gint rtps_util_add_string(proto_tree *, tvbuff_t *,
- gint, int, int, const guint8 *, guint8 *, gint);
+ gint, int, int, const guint8 *, guint8 *, size_t);
static void rtps_util_add_long(proto_tree *, tvbuff_t *,
gint, int, int, gboolean, gboolean, const char *,
- guint8 *, gint);
+ guint8 *, size_t);
static void rtps_util_add_port(proto_tree *, tvbuff_t *,
gint, int, char *, guint8 *, gint);
static void rtps_util_add_boolean(proto_tree *, tvbuff_t *,
- gint, char *, guint8 *, gint);
+ gint, char *, guint8 *, size_t);
static void rtps_util_add_durability_service_qos(proto_tree *, tvbuff_t *,
gint, int, guint8 *, gint);
static void rtps_util_add_liveliness_qos(proto_tree *, tvbuff_t *,
gint, int, guint8 *, gint);
static void rtps_util_add_kind_qos(proto_tree *, tvbuff_t *,
- gint, int, char *, const value_string *, guint8 *, gint);
+ gint, int, char *, const value_string *, guint8 *, size_t);
static gint rtps_util_add_seq_string(proto_tree *, tvbuff_t *,
gint, int, int, char *, guint8 *, gint);
static void rtps_util_add_seq_octets(proto_tree *, tvbuff_t *,
@@ -1543,7 +1542,7 @@ static gint rtps_util_add_string(proto_tree *tree, /* Can be NULL */
int little_endian,
const guint8 * label, /* Can be NULL (if hf_item!=-1) */
guint8 * buffer, /* Can be NULL */
- gint buffer_size) {
+ size_t buffer_size) {
guint8 * retVal = NULL;
guint32 size = NEXT_guint32(tvb, offset, little_endian);
@@ -1574,7 +1573,7 @@ static gint rtps_util_add_string(proto_tree *tree, /* Can be NULL */
if (size == 0) {
buffer[0] = '\0';
} else {
- g_snprintf(buffer, buffer_size, "%s", retVal);
+ g_snprintf(buffer, (gulong) buffer_size, "%s", retVal);
}
}
g_free(retVal);
@@ -1603,7 +1602,7 @@ static void rtps_util_add_long(proto_tree *tree, /* Can be NULL */
gboolean is_signed, /* Signed/Unsigned */
const char *label, /* Can be NULL */
guint8 * buffer,
- gint buffer_size) {
+ size_t buffer_size) {
char temp_buff[16];
@@ -1629,7 +1628,7 @@ static void rtps_util_add_long(proto_tree *tree, /* Can be NULL */
}
}
if (buffer != NULL) {
- g_strlcpy(buffer, temp_buff, buffer_size);
+ g_strlcpy(buffer, temp_buff, (gulong) buffer_size);
}
}
@@ -1678,14 +1677,14 @@ static void rtps_util_add_boolean(proto_tree *tree, /* Can be NULL */
gint offset,
char * label,
guint8 * buffer, /* Can be NULL */
- gint buffer_size) {
+ size_t buffer_size) {
const char *str;
guint8 value = tvb_get_guint8(tvb, offset);
str = value ? "TRUE" : "FALSE";
if (buffer) {
- g_strlcpy(buffer, str, buffer_size);
+ g_strlcpy(buffer, str, (gulong) buffer_size);
}
if (tree) {
@@ -1827,12 +1826,12 @@ static void rtps_util_add_kind_qos(proto_tree *tree, /* Can be NULL */
char * label,
const value_string *vals,
guint8 * buffer, /* Can be NULL */
- gint buffer_size) {
+ size_t buffer_size) {
guint32 kind = NEXT_guint32(tvb, offset, little_endian);
if (buffer) {
g_strlcpy(buffer, val_to_str(kind, vals, "0x%08x"),
- buffer_size);
+ (gulong) buffer_size);
}
if (tree) {
@@ -2620,13 +2619,10 @@ static gint rtps_util_add_typecode(proto_tree *tree,
/* Array print */
if (arr_dimension != NULL) {
/* Printing an array */
- char dim_str[40];
- dim_str[0] = '\0';
+ emem_strbuf_t *dim_str = ep_strbuf_new_label("");
for (i = 0; i < MAX_ARRAY_DIMENSION; ++i) {
if (arr_dimension[i] != 0) {
- g_snprintf(dim_str+strlen(dim_str),
- 40-strlen(dim_str),
- "[%d]", arr_dimension[i]);
+ ep_strbuf_append_printf(dim_str, "[%d]", arr_dimension[i]);
} else {
break;
}
@@ -2639,7 +2635,7 @@ static gint rtps_util_add_typecode(proto_tree *tree,
indent_string,
type_name,
name ? name : "",
- dim_str,
+ dim_str->str,
is_key ? KEY_COMMENT : "");
return retVal;
}
@@ -2806,7 +2802,7 @@ static int rtps_util_add_bitmap(proto_tree *tree,
temp_buff[idx] = '\0';
/* removes all the ending '0' */
- for (i = strlen(temp_buff) - 1; (i>0 && temp_buff[i] == '0'); --i) {
+ for (i = (int) strlen(temp_buff) - 1; (i>0 && temp_buff[i] == '0'); --i) {
temp_buff[i] = '\0';
}
@@ -4240,7 +4236,7 @@ static gint dissect_parameter_sequence(proto_tree *tree,
while (param_length >= 4) {
manager_key = NEXT_guint32(tvb, offset, little_endian);
g_snprintf(buffer+strlen(buffer),
- MAX_PARAM_SIZE-strlen(buffer),
+ MAX_PARAM_SIZE-(gulong) strlen(buffer),
"%c 0x%08x",
sep,
manager_key);
@@ -5897,53 +5893,40 @@ static gboolean dissect_rtps(tvbuff_t *tvb,
/* Compose the content of the 'summary' column */
if ((pinfo != NULL) && (pinfo->cinfo != NULL) &&
(check_col(pinfo->cinfo, COL_INFO))) {
- char info_buf[MAX_SUMMARY_SIZE];
- int is_first = 1; /* Used to control the ', ' between submessages */
+ emem_strbuf_t *info_buf = ep_strbuf_new_label("");
struct SMCounterRecord *smcr_ptr = smcr_head;
if (is_ping) {
- g_strlcpy(info_buf, "PING", MAX_SUMMARY_SIZE);
+ ep_strbuf_append(info_buf, "PING");
} else {
- info_buf[0] = '\0';
/* Counts of submessages - for Information Frame */
while (smcr_ptr != NULL) {
- if (!is_first) {
- g_strlcat(info_buf, ", ", MAX_SUMMARY_SIZE);
- } else {
- is_first = 0;
+ if (info_buf->len > 0) {
+ ep_strbuf_append(info_buf, ", ");
}
/*
if (smcr_ptr->counter > 1) {
- g_snprintf(info_buf+strlen(info_buf),
- MAX_SUMMARY_SIZE-strlen(info_buf),
- "%s(%d)",
+ ep_strbuf_append_printf(info_buf, "%s(%d)",
val_to_str(smcr_ptr->id,
submessage_id_vals,
"Unknown[%02x]"),
smcr_ptr->counter);
} else {
*/
- g_snprintf(info_buf+strlen(info_buf),
- MAX_SUMMARY_SIZE-strlen(info_buf),
- "%s%s",
+ ep_strbuf_append_printf(info_buf, "%s%s",
val_to_str(smcr_ptr->id,
submessage_id_vals,
"Unknown[%02x]"),
smcr_ptr->extra ? smcr_ptr->extra : "");
- if (strlen(info_buf) > (MAX_SUMMARY_SIZE - 20)) {
- g_snprintf(info_buf+strlen(info_buf),
- MAX_SUMMARY_SIZE-strlen(info_buf),
- "...");
- break;
- }
+ /* XXX - Ellipsis code removed when we converted to a strbuf. */
/*
}
*/
smcr_ptr = smcr_ptr->next;
}
}
- col_add_str(pinfo->cinfo, COL_INFO, info_buf);
+ col_add_str(pinfo->cinfo, COL_INFO, info_buf->str);
}
sm_counter_free(smcr_head);