diff options
| author | 2021-12-19 16:13:07 +0100 | |
|---|---|---|
| committer | 2021-12-19 16:13:07 +0100 | |
| commit | 810e1a5936867a9f2c9f07df3a33a9d02fc03466 (patch) | |
| tree | c561f0301b98a95fddc32259978345eed8eb5cc5 /src/bplist.c | |
| parent | c81471ce6e8821ba03427824217612dcab8e091b (diff) | |
| download | libplist-810e1a5936867a9f2c9f07df3a33a9d02fc03466.tar.gz libplist-810e1a5936867a9f2c9f07df3a33a9d02fc03466.tar.bz2 | |
Add support for PLIST_NULL type
Diffstat (limited to 'src/bplist.c')
| -rw-r--r-- | src/bplist.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/bplist.c b/src/bplist.c index a41ce1a..a6e6ded 100644 --- a/src/bplist.c +++ b/src/bplist.c | |||
| @@ -630,6 +630,13 @@ static plist_t parse_bin_node(struct bplist_data *bplist, const char** object) | |||
| 630 | } | 630 | } |
| 631 | 631 | ||
| 632 | case BPLIST_NULL: | 632 | case BPLIST_NULL: |
| 633 | { | ||
| 634 | plist_data_t data = plist_new_plist_data(); | ||
| 635 | data->type = PLIST_NULL; | ||
| 636 | data->length = 0; | ||
| 637 | return node_create(NULL, data); | ||
| 638 | } | ||
| 639 | |||
| 633 | default: | 640 | default: |
| 634 | return NULL; | 641 | return NULL; |
| 635 | } | 642 | } |
| @@ -1295,6 +1302,11 @@ PLIST_API void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length) | |||
| 1295 | 1302 | ||
| 1296 | switch (data->type) | 1303 | switch (data->type) |
| 1297 | { | 1304 | { |
| 1305 | case PLIST_NULL: { | ||
| 1306 | uint8_t b = 0; | ||
| 1307 | byte_array_append(bplist_buff, &b, 1); | ||
| 1308 | break; | ||
| 1309 | } | ||
| 1298 | case PLIST_BOOLEAN: { | 1310 | case PLIST_BOOLEAN: { |
| 1299 | uint8_t b = data->boolval ? BPLIST_TRUE : BPLIST_FALSE; | 1311 | uint8_t b = data->boolval ? BPLIST_TRUE : BPLIST_FALSE; |
| 1300 | byte_array_append(bplist_buff, &b, 1); | 1312 | byte_array_append(bplist_buff, &b, 1); |
