aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2024-07-04 07:51:21 +0200
committerAndersBroman <a.broman58@gmail.com>2024-07-04 12:17:48 +0000
commit6ff41d0dd8e7911efb7da50e47a29452c4b2c0ef (patch)
tree3b98865fd3da94830ca64f250511ceb244c27f7e
parent19f7deabc8c4117a26fbcbc0d2e817f02a7507dd (diff)
mpeg-pes: Fix return type for dissect_mpeg_pes
Use int as return type for dissect_mpeg_pes().
-rw-r--r--epan/dissectors/asn1/mpeg-pes/packet-mpeg-pes-template.c12
-rw-r--r--epan/dissectors/packet-mpeg-pes.c12
2 files changed, 8 insertions, 16 deletions
diff --git a/epan/dissectors/asn1/mpeg-pes/packet-mpeg-pes-template.c b/epan/dissectors/asn1/mpeg-pes/packet-mpeg-pes-template.c
index dc395d841e..a66b19cdf5 100644
--- a/epan/dissectors/asn1/mpeg-pes/packet-mpeg-pes-template.c
+++ b/epan/dissectors/asn1/mpeg-pes/packet-mpeg-pes-template.c
@@ -398,7 +398,7 @@ dissect_mpeg_pes_pack_header(tvbuff_t *tvb, gint offset,
static int
dissect_mpeg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data);
-static gboolean
+static int
// NOLINTNEXTLINE(misc-no-recursion)
dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
@@ -409,11 +409,11 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
guint8 stream_type;
if (!tvb_bytes_exist(tvb, 0, 3))
- return FALSE; /* not enough bytes for a PES prefix */
+ return 0; /* not enough bytes for a PES prefix */
prefix = tvb_get_ntoh24(tvb, 0);
if (prefix != PES_PREFIX)
- return FALSE;
+ return 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPEG PES");
col_clear(pinfo->cinfo, COL_INFO);
@@ -427,10 +427,6 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
* to PMT but maps stream_ids to stream_types instead of PIDs.)
*/
-#if 0
- if (tree == NULL)
- return TRUE;
-#endif
asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
offset = dissect_mpeg_pes_PES(tvb, offset, &asn1_ctx,
tree, proto_mpeg_pes);
@@ -601,7 +597,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
offset / 8, -1, ENC_NA);
}
decrement_dissection_depth(pinfo);
- return TRUE;
+ return tvb_reported_length(tvb);
}
static heur_dissector_list_t heur_subdissector_list;
diff --git a/epan/dissectors/packet-mpeg-pes.c b/epan/dissectors/packet-mpeg-pes.c
index dbc60aec18..6fbb03089e 100644
--- a/epan/dissectors/packet-mpeg-pes.c
+++ b/epan/dissectors/packet-mpeg-pes.c
@@ -818,7 +818,7 @@ dissect_mpeg_pes_pack_header(tvbuff_t *tvb, gint offset,
static int
dissect_mpeg(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data);
-static gboolean
+static int
// NOLINTNEXTLINE(misc-no-recursion)
dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
@@ -829,11 +829,11 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
guint8 stream_type;
if (!tvb_bytes_exist(tvb, 0, 3))
- return FALSE; /* not enough bytes for a PES prefix */
+ return 0; /* not enough bytes for a PES prefix */
prefix = tvb_get_ntoh24(tvb, 0);
if (prefix != PES_PREFIX)
- return FALSE;
+ return 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "MPEG PES");
col_clear(pinfo->cinfo, COL_INFO);
@@ -847,10 +847,6 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
* to PMT but maps stream_ids to stream_types instead of PIDs.)
*/
-#if 0
- if (tree == NULL)
- return TRUE;
-#endif
asn1_ctx_init(&asn1_ctx, ASN1_ENC_PER, TRUE, pinfo);
offset = dissect_mpeg_pes_PES(tvb, offset, &asn1_ctx,
tree, proto_mpeg_pes);
@@ -1021,7 +1017,7 @@ dissect_mpeg_pes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
offset / 8, -1, ENC_NA);
}
decrement_dissection_depth(pinfo);
- return TRUE;
+ return tvb_reported_length(tvb);
}
static heur_dissector_list_t heur_subdissector_list;