diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2020-01-31 14:50:41 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2020-01-31 15:18:35 +0100 |
commit | 2020f1f2e748beb3f919cd0818a32673b39aecbc (patch) | |
tree | a5e8770092e0ea2c0baf2a302d05c132d7e0073d | |
parent | 11f04851cefe6553d2f12ad7ec6fdef892f7275a (diff) |
port-serial-qcdm: rewrite condition to make it more readable
The logic is the same.
-rw-r--r-- | src/mm-port-serial-qcdm.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mm-port-serial-qcdm.c b/src/mm-port-serial-qcdm.c index d343df91..e723204b 100644 --- a/src/mm-port-serial-qcdm.c +++ b/src/mm-port-serial-qcdm.c @@ -50,8 +50,13 @@ find_qcdm_start (GByteArray *response, gsize *start) * uses HDLC framing (like Sierra CnS) that starts and ends with 0x7E. */ for (i = 0; i < response->len; i++) { + /* Marker found */ if (response->data[i] == 0x7E) { - if (i > (guint)(last + 3)) { + /* If we didn't get an initial marker, count at least 3 bytes since + * origin; if we did get an initial marker, count at least 3 bytes + * since the marker. + */ + if (((last == -1) && (i >= 3)) || ((last >= 0) && (i > (guint)(last + 3)))) { /* Got a full QCDM frame; 3 non-0x7E bytes and a terminator */ if (start) *start = last + 1; |