summaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/mpeg-audio
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:14:33 +0000
commit9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9 (patch)
tree2784370cda9bbf2da9114d70f05399c0b229d28c /epan/dissectors/asn1/mpeg-audio
parentAdding debian version 4.2.6-1. (diff)
downloadwireshark-9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9.tar.xz
wireshark-9f153fbfec0fb9c9ce38e749a7c6f4a5e115d4e9.zip
Merging upstream version 4.4.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'epan/dissectors/asn1/mpeg-audio')
-rw-r--r--epan/dissectors/asn1/mpeg-audio/packet-mpeg-audio-template.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/epan/dissectors/asn1/mpeg-audio/packet-mpeg-audio-template.c b/epan/dissectors/asn1/mpeg-audio/packet-mpeg-audio-template.c
index 29e42ae2..8b1c0c37 100644
--- a/epan/dissectors/asn1/mpeg-audio/packet-mpeg-audio-template.c
+++ b/epan/dissectors/asn1/mpeg-audio/packet-mpeg-audio-template.c
@@ -14,6 +14,7 @@
#include <epan/asn1.h>
#include <wsutil/mpeg-audio.h>
+#include <wsutil/array.h>
#include "packet-per.h"
@@ -26,30 +27,30 @@ void proto_reg_handoff_mpeg_audio(void);
dissector_handle_t mpeg_audio_handle;
-static int proto_mpeg_audio = -1;
+static int proto_mpeg_audio;
static dissector_handle_t id3v2_handle;
-static int hf_mpeg_audio_header = -1;
-static int hf_mpeg_audio_data = -1;
-static int hf_mpeg_audio_padbytes = -1;
-static int hf_id3v1 = -1;
+static int hf_mpeg_audio_header;
+static int hf_mpeg_audio_data;
+static int hf_mpeg_audio_padbytes;
+static int hf_id3v1;
-static int ett_mpeg_audio = -1;
+static int ett_mpeg_audio;
-static gboolean
+static bool
test_mpeg_audio(tvbuff_t *tvb, int offset)
{
- guint32 hdr;
+ uint32_t hdr;
struct mpa mpa;
if (!tvb_bytes_exist(tvb, offset, 4))
- return FALSE;
+ return false;
if (tvb_strneql(tvb, offset, "TAG", 3) == 0)
- return TRUE;
+ return true;
if (tvb_strneql(tvb, offset, "ID3", 3) == 0)
- return TRUE;
+ return true;
- hdr = tvb_get_guint32(tvb, offset, ENC_BIG_ENDIAN);
+ hdr = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
MPA_UNMARSHAL(&mpa, hdr);
return MPA_VALID(&mpa);
}
@@ -57,20 +58,20 @@ test_mpeg_audio(tvbuff_t *tvb, int offset)
static int
mpeg_resync(tvbuff_t *tvb, int offset)
{
- guint32 hdr;
+ uint32_t hdr;
struct mpa mpa;
/* This only looks to resync on another frame; it doesn't
* look for an ID3 tag.
*/
- offset = tvb_find_guint8(tvb, offset, -1, '\xff');
+ offset = tvb_find_uint8(tvb, offset, -1, '\xff');
while (offset != -1 && tvb_bytes_exist(tvb, offset, 4)) {
- hdr = tvb_get_guint32(tvb, offset, ENC_BIG_ENDIAN);
+ hdr = tvb_get_uint32(tvb, offset, ENC_BIG_ENDIAN);
MPA_UNMARSHAL(&mpa, hdr);
if (MPA_VALID(&mpa)) {
return offset;
}
- offset = tvb_find_guint8(tvb, offset + 1, -1, '\xff');
+ offset = tvb_find_uint8(tvb, offset + 1, -1, '\xff');
}
return tvb_reported_length(tvb);
}
@@ -78,7 +79,7 @@ mpeg_resync(tvbuff_t *tvb, int offset)
static int
dissect_mpeg_audio_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
- guint32 h;
+ uint32_t h;
struct mpa mpa;
int data_size = 0;
asn1_ctx_t asn1_ctx;
@@ -106,7 +107,7 @@ dissect_mpeg_audio_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
mpa_frequency(&mpa) / (float)1000);
}
- asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
+ asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, true, pinfo);
offset = dissect_mpeg_audio_Audio(tvb, offset, &asn1_ctx,
tree, hf_mpeg_audio_header);
if (data_size > 0) {
@@ -132,7 +133,7 @@ dissect_id3v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ID3v1");
col_clear(pinfo->cinfo, COL_INFO);
- asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
+ asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, true, pinfo);
return dissect_mpeg_audio_ID3v1(tvb, 0, &asn1_ctx,
tree, hf_id3v1);
}
@@ -144,7 +145,7 @@ dissect_mpeg_audio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
proto_tree *mpeg_audio_tree;
int magic, offset = 0;
- guint32 frame_len;
+ uint32_t frame_len;
tvbuff_t *next_tvb;
ti = proto_tree_add_item(tree, proto_mpeg_audio, tvb, offset, -1, ENC_NA);
@@ -170,14 +171,14 @@ dissect_mpeg_audio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
return tvb_reported_length(tvb);
}
-static gboolean
+static bool
dissect_mpeg_audio_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
if (!test_mpeg_audio(tvb, 0)) {
- return FALSE;
+ return false;
}
dissect_mpeg_audio(tvb, pinfo, tree, data);
- return TRUE;
+ return true;
}
void
@@ -200,7 +201,7 @@ proto_register_mpeg_audio(void)
FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }},
};
- static gint *ett[] = {
+ static int *ett[] = {
&ett_mpeg_audio,
#include "packet-mpeg-audio-ettarr.c"
};