From a86c5f7cae7ec9a3398300555a0b644689d946a1 Mon Sep 17 00:00:00 2001
From: Daniel Baumann <daniel.baumann@progress-linux.org>
Date: Thu, 19 Sep 2024 06:14:53 +0200
Subject: Merging upstream version 4.4.0.

Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
---
 epan/dissectors/packet-gsm_cbch.c | 118 +++++++++++++++++++-------------------
 1 file changed, 59 insertions(+), 59 deletions(-)

(limited to 'epan/dissectors/packet-gsm_cbch.c')

diff --git a/epan/dissectors/packet-gsm_cbch.c b/epan/dissectors/packet-gsm_cbch.c
index 46d16ec5..19c0492d 100644
--- a/epan/dissectors/packet-gsm_cbch.c
+++ b/epan/dissectors/packet-gsm_cbch.c
@@ -45,45 +45,45 @@ static const value_string sched_type_values[] = {
 };
 
 /* Initialize the protocol and registered fields */
-static int proto_cbch = -1;
-
-static int hf_gsm_cbch_spare_bit = -1;
-static int hf_gsm_cbch_lpd = -1;
-static int hf_gsm_cbch_lb = -1;
-static int hf_gsm_cbch_seq_num = -1;
-static int hf_gsm_cbch_sched_type = -1;
-static int hf_gsm_cbch_sched_begin_slot = -1;
-static int hf_gsm_cbch_sched_spare = -1;
-static int hf_gsm_cbch_sched_end_slot = -1;
-static int hf_gsm_cbch_slot = -1;
-/* static int hf_gsm_cbch_sched_msg_id = -1; */
-static int hf_gsm_cbch_padding = -1;
-static int hf_gsm_cbch_block = -1;
+static int proto_cbch;
+
+static int hf_gsm_cbch_spare_bit;
+static int hf_gsm_cbch_lpd;
+static int hf_gsm_cbch_lb;
+static int hf_gsm_cbch_seq_num;
+static int hf_gsm_cbch_sched_type;
+static int hf_gsm_cbch_sched_begin_slot;
+static int hf_gsm_cbch_sched_spare;
+static int hf_gsm_cbch_sched_end_slot;
+static int hf_gsm_cbch_slot;
+/* static int hf_gsm_cbch_sched_msg_id; */
+static int hf_gsm_cbch_padding;
+static int hf_gsm_cbch_block;
 
 /* These fields are used when reassembling cbch fragments
  */
-static int hf_cbch_fragments = -1;
-static int hf_cbch_fragment = -1;
-static int hf_cbch_fragment_overlap = -1;
-static int hf_cbch_fragment_overlap_conflict = -1;
-static int hf_cbch_fragment_multiple_tails = -1;
-static int hf_cbch_fragment_too_long_fragment = -1;
-static int hf_cbch_fragment_error = -1;
-static int hf_cbch_fragment_count = -1;
-static int hf_cbch_reassembled_in = -1;
-static int hf_cbch_reassembled_length = -1;
+static int hf_cbch_fragments;
+static int hf_cbch_fragment;
+static int hf_cbch_fragment_overlap;
+static int hf_cbch_fragment_overlap_conflict;
+static int hf_cbch_fragment_multiple_tails;
+static int hf_cbch_fragment_too_long_fragment;
+static int hf_cbch_fragment_error;
+static int hf_cbch_fragment_count;
+static int hf_cbch_reassembled_in;
+static int hf_cbch_reassembled_length;
 
 /* Initialize the subtree pointers */
-static gint ett_cbch_msg = -1;
-static gint ett_schedule_msg = -1;
-static gint ett_schedule_new_msg = -1;
-static gint ett_cbch_fragment = -1;
-static gint ett_cbch_fragments = -1;
+static int ett_cbch_msg;
+static int ett_schedule_msg;
+static int ett_schedule_new_msg;
+static int ett_cbch_fragment;
+static int ett_cbch_fragments;
 
-static expert_field ei_gsm_cbch_sched_end_slot = EI_INIT;
-static expert_field ei_gsm_cbch_seq_num_null = EI_INIT;
-static expert_field ei_gsm_cbch_seq_num_reserved = EI_INIT;
-static expert_field ei_gsm_cbch_lpd = EI_INIT;
+static expert_field ei_gsm_cbch_sched_end_slot;
+static expert_field ei_gsm_cbch_seq_num_null;
+static expert_field ei_gsm_cbch_seq_num_reserved;
+static expert_field ei_gsm_cbch_lpd;
 
 static dissector_handle_t cbs_handle;
 
@@ -122,11 +122,11 @@ static const range_string gsm_cbch_sched_begin_slot_rvals[] = {
 static void
 dissect_schedule_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree)
 {
-    guint       len, offset  = 0;
-    guint8      octet1, i, k = 0;
-    guint8      sched_begin, sched_end, new_slots[48];
-    gboolean    valid_message   = TRUE;
-    guint16     other_slots[48];
+    unsigned    len, offset  = 0;
+    uint8_t     octet1, i, k = 0;
+    uint8_t     sched_begin, sched_end, new_slots[48];
+    bool        valid_message   = true;
+    uint16_t    other_slots[48];
     proto_item *item            = NULL, *schedule_item = NULL;
     proto_tree *sched_tree      = NULL, *sched_subtree = NULL;
 
@@ -140,7 +140,7 @@ dissect_schedule_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree
     sched_tree = proto_item_add_subtree(schedule_item, ett_schedule_msg);
 
     proto_tree_add_item(sched_tree, hf_gsm_cbch_sched_type, tvb, offset, 1, ENC_BIG_ENDIAN);
-    octet1 = tvb_get_guint8(tvb, offset);
+    octet1 = tvb_get_uint8(tvb, offset);
     if (0 == (octet1 & 0xC0))
     {
         proto_item* slot_item;
@@ -148,15 +148,15 @@ dissect_schedule_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree
         proto_tree_add_item(sched_tree, hf_gsm_cbch_sched_begin_slot, tvb, offset++, 1, ENC_BIG_ENDIAN);
         if ((sched_begin < 1) || (sched_begin > 48))
         {
-            valid_message = FALSE;
+            valid_message = false;
         }
         proto_tree_add_item(sched_tree, hf_gsm_cbch_sched_spare, tvb, offset, 1, ENC_BIG_ENDIAN);
-        sched_end = tvb_get_guint8(tvb, offset);
+        sched_end = tvb_get_uint8(tvb, offset);
         slot_item = proto_tree_add_item(sched_tree, hf_gsm_cbch_sched_end_slot, tvb, offset++, 1, ENC_BIG_ENDIAN);
         if (sched_end < sched_begin)
         {
             expert_add_info(pinfo, slot_item, &ei_gsm_cbch_sched_end_slot);
-            valid_message = FALSE;
+            valid_message = false;
         }
 
         if (valid_message)
@@ -168,8 +168,8 @@ dissect_schedule_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree
             /* iterate over the octets */
             for (i=0; i<6; i++)
             {
-                guint8 j;
-                octet1 = tvb_get_guint8(tvb, offset++);
+                uint8_t j;
+                octet1 = tvb_get_uint8(tvb, offset++);
 
                 /* iterate over the bits */
                 for (j=0; j<8; j++)
@@ -186,14 +186,14 @@ dissect_schedule_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree
             for (i=0; i<k; i++)
             {
                 DISSECTOR_ASSERT(new_slots[i] <= 48);
-                octet1 = tvb_get_guint8(tvb, offset);
+                octet1 = tvb_get_uint8(tvb, offset);
                 if ((octet1 & 0x80) == 0x80)
                 {
                     /* MDT 1 */
-                    guint8 octet2;
-                    guint16 msg_id;
+                    uint8_t octet2;
+                    uint16_t msg_id;
 
-                    octet2 = tvb_get_guint8(tvb, offset + 1);
+                    octet2 = tvb_get_uint8(tvb, offset + 1);
                     msg_id = ((octet1 &0x7F) << 8) + octet2;
                     proto_tree_add_uint_format_value(sched_subtree, hf_gsm_cbch_slot, tvb, offset, 2, new_slots[i],
                                         "%d, Message ID: %d, First transmission of an SMSCB within the Schedule Period",
@@ -266,16 +266,16 @@ dissect_schedule_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree
                 if (k >= sched_end)
                     break;
 
-                octet1 = tvb_get_guint8(tvb, offset);
+                octet1 = tvb_get_uint8(tvb, offset);
                 if ((octet1 & 0x80) == 0x80)
                 {
                     if ((offset+1)<len)
                     {
                         /* MDT 1 */
-                        guint8  octet2;
-                        guint16 msg_id;
+                        uint8_t octet2;
+                        uint16_t msg_id;
 
-                        octet2 = tvb_get_guint8(tvb, offset + 1);
+                        octet2 = tvb_get_uint8(tvb, offset + 1);
                         msg_id = ((octet1 &0x7F) << 8) + octet2;
                         other_slots[k] = msg_id;
                         k++;
@@ -346,14 +346,14 @@ static int
 dissect_cbch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data  _U_)
 {
     fragment_head *frag_data = NULL;
-    guint8         octet, lb, lpd, seq_num;
-    guint32        offset;
+    uint8_t        octet, lb, lpd, seq_num;
+    uint32_t       offset;
     proto_item    *cbch_item, *lpd_item, *seq_item;
     proto_tree    *cbch_tree;
     tvbuff_t      *reass_tvb = NULL, *msg_tvb = NULL;
 
     offset = 0;
-    octet  = tvb_get_guint8(tvb, offset);
+    octet  = tvb_get_uint8(tvb, offset);
 
     /*
      * create the protocol tree
@@ -381,7 +381,7 @@ dissect_cbch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data  _U
         {
         case 0x00:
         case 0x08:
-            pinfo->fragmented = TRUE;
+            pinfo->fragmented = true;
             /* we should have a unique ID for the reassembled page, but we don't really have anything from the protocol...
                The GSM frame number div 4 might be used for this, but it has not been passed to this layer and does not
                exist at all if the message is being passed over the RSL interface.
@@ -401,7 +401,7 @@ dissect_cbch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data  _U
         case 0x01:
         case 0x02:
         case 0x03:
-            pinfo->fragmented = TRUE;
+            pinfo->fragmented = true;
             offset++; /* step to beginning of payload */
             frag_data = fragment_add_seq_check(&cbch_block_reassembly_table,
                                                tvb, offset, pinfo, 0, NULL,
@@ -428,7 +428,7 @@ dissect_cbch(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data  _U
                We use this to determine whether this is a normal message or a scheduling message */
             offset = 0;
 
-            octet = tvb_get_guint8(reass_tvb, offset++);
+            octet = tvb_get_uint8(reass_tvb, offset++);
             msg_tvb = tvb_new_subset_remaining(reass_tvb, offset);
 
             if (octet & 0x08)
@@ -594,7 +594,7 @@ proto_register_gsm_cbch(void)
         };
 
 /* Setup protocol subtree array */
-    static gint *ett[] = {
+    static int *ett[] = {
         &ett_cbch_msg,
         &ett_schedule_msg,
         &ett_schedule_new_msg,
-- 
cgit v1.2.3