Skip to content

Commit df82525

Browse files
author
Teemu Kultala
committed
sms gt tests: rebase and astyle fix
1 parent 2b82746 commit df82525

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

features/cellular/framework/AT/AT_CellularSMS.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -641,10 +641,10 @@ nsapi_size_or_error_t AT_CellularSMS::read_sms_from_index(int msg_index, char *b
641641
_at.skip_param(); // <alpha>
642642
if (time_stamp) {
643643
int len = _at.read_string(time_stamp, SMS_MAX_TIME_STAMP_SIZE);
644-
if (len < SMS_MAX_TIME_STAMP_SIZE-2) {
644+
if (len < (SMS_MAX_TIME_STAMP_SIZE - 2)) {
645645
time_stamp[len++] = ',';
646646
_at.read_string(&time_stamp[len], SMS_MAX_TIME_STAMP_SIZE-len);
647-
}
647+
}
648648
}
649649
(void)_at.consume_to_stop_tag(); // consume until <CR><LF>
650650
if (buf) {
@@ -804,10 +804,10 @@ nsapi_size_or_error_t AT_CellularSMS::get_data_from_pdu(const char *pdu, sms_inf
804804

805805
index += 2; // we just read the high bits of first octet so move +2
806806
// originating address length
807-
oaLength = hex_str_to_int(pdu+index, 2);
808-
index +=2; // add index over address length
809-
int type = hex_str_to_int(pdu+index, 1);
810-
index +=2; // add index over type
807+
oaLength = hex_str_to_int(pdu + index, 2);
808+
index += 2; // add index over address length
809+
int type = hex_str_to_int(pdu + index, 1);
810+
index += 2; // add index over type
811811
if (phone_number) {
812812
// phone number as reverse nibble encoded
813813
int a = 0, field_length = oaLength;
@@ -818,13 +818,13 @@ nsapi_size_or_error_t AT_CellularSMS::get_data_from_pdu(const char *pdu, sms_inf
818818
field_length++;
819819
}
820820

821-
for (; a < field_length; a +=2) {
822-
if (a+1 == field_length) {
823-
phone_number[a] = pdu[index+1];
821+
for (; a < field_length; a += 2) {
822+
if ((a + 1) == field_length) {
823+
phone_number[a] = pdu[index + 1];
824824
index++;
825825
} else {
826-
phone_number[a] = pdu[index+1];
827-
phone_number[a+1] = pdu[index];
826+
phone_number[a] = pdu[index + 1];
827+
phone_number[a + 1] = pdu[index];
828828
index += 2;
829829
}
830830
}
@@ -834,7 +834,6 @@ nsapi_size_or_error_t AT_CellularSMS::get_data_from_pdu(const char *pdu, sms_inf
834834
}
835835

836836

837-
index += oaLength;
838837
if (oaLength & 0x01) { // if phone number length is odd then it has padded F so skip that
839838
index++;
840839
}

0 commit comments

Comments
 (0)