diff options
| author | 2017-01-25 02:41:38 +0100 | |
|---|---|---|
| committer | 2017-01-25 02:41:38 +0100 | |
| commit | 4c072d015193af74719d07897c0a0b4396b4a866 (patch) | |
| tree | 7a59420d5e03e5da7b07912dd4e0bef2bf308ea8 /src | |
| parent | 6a44dfb72f1cb5c82c10feed95ff9428eec49d0a (diff) | |
| download | libplist-4c072d015193af74719d07897c0a0b4396b4a866.tar.gz libplist-4c072d015193af74719d07897c0a0b4396b4a866.tar.bz2 | |
bplist: Improve integer node parsing, remove unnecessary memcpy()
Diffstat (limited to 'src')
| -rw-r--r-- | src/bplist.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/bplist.c b/src/bplist.c index 7cc8a03..ad8e753 100644 --- a/src/bplist.c +++ b/src/bplist.c | |||
| @@ -214,13 +214,9 @@ static plist_t parse_uint_node(const char **bnode, uint8_t size) | |||
| 214 | case sizeof(uint16_t): | 214 | case sizeof(uint16_t): |
| 215 | case sizeof(uint32_t): | 215 | case sizeof(uint32_t): |
| 216 | case sizeof(uint64_t): | 216 | case sizeof(uint64_t): |
| 217 | memcpy(&data->intval, *bnode, size); | ||
| 218 | data->intval = UINT_TO_HOST(&data->intval, size); | ||
| 219 | data->length = sizeof(uint64_t); | 217 | data->length = sizeof(uint64_t); |
| 220 | break; | 218 | break; |
| 221 | case 16: | 219 | case 16: |
| 222 | memcpy(&data->intval, (*bnode)+8, sizeof(uint64_t)); | ||
| 223 | data->intval = UINT_TO_HOST(&data->intval, sizeof(uint64_t)); | ||
| 224 | data->length = size; | 220 | data->length = size; |
| 225 | break; | 221 | break; |
| 226 | default: | 222 | default: |
| @@ -228,6 +224,8 @@ static plist_t parse_uint_node(const char **bnode, uint8_t size) | |||
| 228 | return NULL; | 224 | return NULL; |
| 229 | }; | 225 | }; |
| 230 | 226 | ||
| 227 | data->intval = UINT_TO_HOST(*bnode, size); | ||
| 228 | |||
| 231 | (*bnode) += size; | 229 | (*bnode) += size; |
| 232 | data->type = PLIST_UINT; | 230 | data->type = PLIST_UINT; |
| 233 | 231 | ||
