diff options
author | Andrzej Zaborowski <andrew.zaborowski@intel.com> | 2010-06-11 12:39:49 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-06-15 12:06:52 -0500 |
commit | fb39e0efed316923aead2ff1bb41abdda6d12818 (patch) | |
tree | fafb37aeeca735641a67c4bb69363539c13755b7 /src | |
parent | 6e4277eef879079ba6e5d2042924fc31a8cea650 (diff) | |
download | ofono-fb39e0efed316923aead2ff1bb41abdda6d12818.tar.bz2 |
stkutil: Refactor struct stk_frames_info
Diffstat (limited to 'src')
-rw-r--r-- | src/stkutil.c | 11 | ||||
-rw-r--r-- | src/stkutil.h | 4 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/stkutil.c b/src/stkutil.c index 9012234f..56c57b1a 100644 --- a/src/stkutil.c +++ b/src/stkutil.c @@ -1628,6 +1628,7 @@ static gboolean parse_dataobj_frames_info(struct comprehension_tlv_iter *iter, struct stk_frames_info *fi = user; const unsigned char *data; unsigned char len = comprehension_tlv_iter_get_length(iter); + unsigned int i; if (len < 1) return FALSE; @@ -1640,12 +1641,18 @@ static gboolean parse_dataobj_frames_info(struct comprehension_tlv_iter *iter, if ((len == 1 && data[0] != 0) || (len > 1 && data[0] == 0)) return FALSE; + if (len % 2 == 0) + return FALSE; + if (len == 1) return TRUE; fi->id = data[0]; - fi->len = len - 1; - memcpy(fi->list, data + 1, fi->len); + fi->len = (len - 1) / 2; + for (i = 0; i < len; i++) { + fi->list[i].height = data[i * 2 + 1] & 0x1f; + fi->list[i].width = data[i * 2 + 2] & 0x7f; + } return TRUE; } diff --git a/src/stkutil.h b/src/stkutil.h index d5b3c029..d349cca3 100644 --- a/src/stkutil.h +++ b/src/stkutil.h @@ -813,7 +813,9 @@ struct stk_frame_layout { */ struct stk_frames_info { unsigned char id; - unsigned char list[126]; + struct { + unsigned char width, height; + } list[63]; unsigned int len; }; |