summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-banana.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:26 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:26 +0000
commitc4e8a3222648fcf22ca207f1815ebbf7cd144eeb (patch)
tree93d5c6aa93d9987680dd1adad5685e2ad698f223 /epan/dissectors/packet-banana.c
parentAdding upstream version 4.2.6. (diff)
downloadwireshark-c4e8a3222648fcf22ca207f1815ebbf7cd144eeb.tar.xz
wireshark-c4e8a3222648fcf22ca207f1815ebbf7cd144eeb.zip
Adding upstream version 4.4.0.upstream/4.4.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/packet-banana.c')
-rw-r--r--epan/dissectors/packet-banana.c59
1 files changed, 29 insertions, 30 deletions
diff --git a/epan/dissectors/packet-banana.c b/epan/dissectors/packet-banana.c
index 5a629c37..5bbd9b7f 100644
--- a/epan/dissectors/packet-banana.c
+++ b/epan/dissectors/packet-banana.c
@@ -23,25 +23,25 @@ void proto_register_banana(void);
void proto_reg_handoff_banana(void);
/* Initialize the protocol and registered fields */
-static int proto_banana = -1;
-static int hf_banana_list = -1;
-static int hf_banana_int = -1;
-static int hf_banana_string = -1;
-static int hf_banana_neg_int = -1;
-static int hf_banana_float = -1;
-static int hf_banana_lg_int = -1;
-static int hf_banana_lg_neg_int = -1;
-static int hf_banana_pb = -1;
+static int proto_banana;
+static int hf_banana_list;
+static int hf_banana_int;
+static int hf_banana_string;
+static int hf_banana_neg_int;
+static int hf_banana_float;
+static int hf_banana_lg_int;
+static int hf_banana_lg_neg_int;
+static int hf_banana_pb;
/* Initialize the subtree pointers */
-static gint ett_banana = -1;
-static gint ett_list = -1;
+static int ett_banana;
+static int ett_list;
-static expert_field ei_banana_unknown_type = EI_INIT;
-static expert_field ei_banana_too_many_value_bytes = EI_INIT;
-static expert_field ei_banana_length_too_long = EI_INIT;
-static expert_field ei_banana_value_too_large = EI_INIT;
-static expert_field ei_banana_pb_error = EI_INIT;
+static expert_field ei_banana_unknown_type;
+static expert_field ei_banana_too_many_value_bytes;
+static expert_field ei_banana_length_too_long;
+static expert_field ei_banana_value_too_large;
+static expert_field ei_banana_pb_error;
static dissector_handle_t banana_handle;
@@ -114,16 +114,16 @@ static int
dissect_banana_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset) {
proto_item *ti;
proto_tree *list_tree;
- guint8 byte = 0;
- gint64 val = 0;
- gint val_len = 0;
+ uint8_t byte = 0;
+ int64_t val = 0;
+ int val_len = 0;
int start_offset = offset;
int old_offset;
int i;
/* Accumulate our value/length 'til we hit a valid type */
while (tvb_reported_length_remaining(tvb, offset) > 0) {
- byte = tvb_get_guint8(tvb, offset);
+ byte = tvb_get_uint8(tvb, offset);
offset++;
if (byte & 0x80) {
@@ -147,7 +147,7 @@ dissect_banana_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
if (val > MAX_ELEMENT_VAL) {
expert_add_info_format(pinfo, NULL, &ei_banana_length_too_long, "List length %" PRId64 " longer than we can handle", val);
}
- ti = proto_tree_add_uint_format_value(tree, hf_banana_list, tvb, start_offset, offset - start_offset - 1, (guint32) val, "(%d items)", (gint) val);
+ ti = proto_tree_add_uint_format_value(tree, hf_banana_list, tvb, start_offset, offset - start_offset - 1, (uint32_t) val, "(%d items)", (int) val);
list_tree = proto_item_add_subtree(ti, ett_list);
for (i = 0; i < val; i++) {
old_offset = offset;
@@ -163,20 +163,20 @@ dissect_banana_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
if (val > MAX_ELEMENT_VAL) {
expert_add_info_format(pinfo, NULL, &ei_banana_value_too_large, "Integer value %" PRId64 " too large", val);
}
- proto_tree_add_uint(tree, hf_banana_int, tvb, start_offset, offset - start_offset, (guint32) val);
+ proto_tree_add_uint(tree, hf_banana_int, tvb, start_offset, offset - start_offset, (uint32_t) val);
break;
case BE_STRING:
if (val > MAX_ELEMENT_VAL) {
expert_add_info_format(pinfo, NULL, &ei_banana_length_too_long, "String length %" PRId64 " longer than we can handle", val);
}
- proto_tree_add_item(tree, hf_banana_string, tvb, offset, (guint32) val, ENC_ASCII);
- offset += (gint) val;
+ proto_tree_add_item(tree, hf_banana_string, tvb, offset, (uint32_t) val, ENC_ASCII);
+ offset += (int) val;
break;
case BE_NEG_INT:
if (val > MAX_ELEMENT_VAL) {
expert_add_info_format(pinfo, NULL, &ei_banana_value_too_large, "Integer value -%" PRId64 " too large", val);
}
- proto_tree_add_int(tree, hf_banana_neg_int, tvb, start_offset, offset - start_offset, (gint32) val * -1);
+ proto_tree_add_int(tree, hf_banana_neg_int, tvb, start_offset, offset - start_offset, (int32_t) val * -1);
break;
case BE_FLOAT:
proto_tree_add_item(tree, hf_banana_float, tvb, offset, 8, ENC_BIG_ENDIAN);
@@ -200,15 +200,14 @@ dissect_banana_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
break;
default:
return 0;
- break;
}
return offset - start_offset;
}
static int
dissect_banana(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) {
- guint8 byte = 0;
- gint offset = 0, old_offset;
+ uint8_t byte = 0;
+ int offset = 0, old_offset;
proto_item *ti;
proto_tree *banana_tree;
@@ -220,7 +219,7 @@ dissect_banana(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Banana");
while (tvb_reported_length_remaining(tvb, offset) > 0 && offset < MAX_ELEMENT_VAL_LEN) {
- byte = tvb_get_guint8(tvb, offset);
+ byte = tvb_get_uint8(tvb, offset);
if (is_element(byte))
break;
offset++;
@@ -294,7 +293,7 @@ proto_register_banana(void)
expert_module_t* expert_banana;
/* Setup protocol subtree array */
- static gint *ett[] = {
+ static int *ett[] = {
&ett_banana,
&ett_list
};