sms-part-3gpp: coding style fixes

This commit is contained in:
Aleksander Morgado
2022-10-06 09:18:38 +00:00
parent 795103cf3a
commit 1db9cf4689

View File

@@ -422,23 +422,22 @@ mm_sms_part_3gpp_new_from_binary_pdu (guint index,
PDU_SIZE_CHECK (1, "cannot read SMSC address length"); PDU_SIZE_CHECK (1, "cannot read SMSC address length");
smsc_addr_size_bytes = pdu[offset++]; smsc_addr_size_bytes = pdu[offset++];
if (smsc_addr_size_bytes > 0) { if (smsc_addr_size_bytes > 0) {
PDU_SIZE_CHECK (offset + smsc_addr_size_bytes, "cannot read SMSC address"); PDU_SIZE_CHECK (offset + smsc_addr_size_bytes, "cannot read SMSC address");
/* SMSC may not be given in DELIVER PDUs */ /* SMSC may not be given in DELIVER PDUs */
address = sms_decode_address (&pdu[1], 2 * (smsc_addr_size_bytes - 1), error); address = sms_decode_address (&pdu[1], 2 * (smsc_addr_size_bytes - 1), error);
if (!address) { if (!address) {
g_prefix_error (error, "Couldn't read SMSC address: "); g_prefix_error (error, "Couldn't read SMSC address: ");
mm_sms_part_free (sms_part); mm_sms_part_free (sms_part);
return NULL; return NULL;
} }
mm_sms_part_take_smsc (sms_part, g_steal_pointer (&address)); mm_sms_part_take_smsc (sms_part, g_steal_pointer (&address));
mm_obj_dbg (log_object, " SMSC address parsed: '%s'", mm_sms_part_get_smsc (sms_part)); mm_obj_dbg (log_object, " SMSC address parsed: '%s'", mm_sms_part_get_smsc (sms_part));
offset += smsc_addr_size_bytes; offset += smsc_addr_size_bytes;
} else } else
mm_obj_dbg (log_object, " no SMSC address given"); mm_obj_dbg (log_object, " no SMSC address given");
} else } else
mm_obj_dbg (log_object, " This is a transfer-route message"); mm_obj_dbg (log_object, " This is a transfer-route message");
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* TP-MTI (1 byte) */ /* TP-MTI (1 byte) */
PDU_SIZE_CHECK (offset + 1, "cannot read TP-MTI"); PDU_SIZE_CHECK (offset + 1, "cannot read TP-MTI");
@@ -492,7 +491,6 @@ mm_sms_part_3gpp_new_from_binary_pdu (guint index,
offset++; offset++;
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/* TP-DA or TP-OA or TP-RA /* TP-DA or TP-OA or TP-RA
* First byte represents the number of DIGITS in the number. * First byte represents the number of DIGITS in the number.
@@ -519,6 +517,7 @@ mm_sms_part_3gpp_new_from_binary_pdu (guint index,
if (pdu_type == SMS_TP_MTI_SMS_DELIVER) { if (pdu_type == SMS_TP_MTI_SMS_DELIVER) {
gchar *str = NULL; gchar *str = NULL;
PDU_SIZE_CHECK (offset + 9, PDU_SIZE_CHECK (offset + 9,
"cannot read PID/DCS/Timestamp"); /* 1+1+7=9 */ "cannot read PID/DCS/Timestamp"); /* 1+1+7=9 */
@@ -534,8 +533,7 @@ mm_sms_part_3gpp_new_from_binary_pdu (guint index,
mm_sms_part_free (sms_part); mm_sms_part_free (sms_part);
return NULL; return NULL;
} }
mm_sms_part_take_timestamp (sms_part, mm_sms_part_take_timestamp (sms_part, str);
str);
offset += 7; offset += 7;
tp_user_data_len_offset = offset; tp_user_data_len_offset = offset;
@@ -577,9 +575,9 @@ mm_sms_part_3gpp_new_from_binary_pdu (guint index,
} }
tp_user_data_len_offset = offset; tp_user_data_len_offset = offset;
} } else if (pdu_type == SMS_TP_MTI_SMS_STATUS_REPORT) {
else if (pdu_type == SMS_TP_MTI_SMS_STATUS_REPORT) {
gchar *str = NULL; gchar *str = NULL;
/* We have 2 timestamps in status report PDUs: /* We have 2 timestamps in status report PDUs:
* first, the timestamp for when the PDU was received in the SMSC * first, the timestamp for when the PDU was received in the SMSC
* second, the timestamp for when the PDU was forwarded by the SMSC * second, the timestamp for when the PDU was forwarded by the SMSC