@@ -641,10 +641,10 @@ nsapi_size_or_error_t AT_CellularSMS::read_sms_from_index(int msg_index, char *b
641
641
_at.skip_param (); // <alpha>
642
642
if (time_stamp) {
643
643
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 ) ) {
645
645
time_stamp[len++] = ' ,' ;
646
646
_at.read_string (&time_stamp[len], SMS_MAX_TIME_STAMP_SIZE-len);
647
- }
647
+ }
648
648
}
649
649
(void )_at.consume_to_stop_tag (); // consume until <CR><LF>
650
650
if (buf) {
@@ -804,10 +804,10 @@ nsapi_size_or_error_t AT_CellularSMS::get_data_from_pdu(const char *pdu, sms_inf
804
804
805
805
index += 2 ; // we just read the high bits of first octet so move +2
806
806
// 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
811
811
if (phone_number) {
812
812
// phone number as reverse nibble encoded
813
813
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
818
818
field_length++;
819
819
}
820
820
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 ];
824
824
index++;
825
825
} 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];
828
828
index += 2 ;
829
829
}
830
830
}
@@ -834,7 +834,6 @@ nsapi_size_or_error_t AT_CellularSMS::get_data_from_pdu(const char *pdu, sms_inf
834
834
}
835
835
836
836
837
- index += oaLength;
838
837
if (oaLength & 0x01 ) { // if phone number length is odd then it has padded F so skip that
839
838
index++;
840
839
}
0 commit comments