diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/plist.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/plist.c b/src/plist.c index eb0160c..87be488 100644 --- a/src/plist.c +++ b/src/plist.c | |||
| @@ -868,6 +868,19 @@ PLIST_API void plist_get_string_val(plist_t node, char **val) | |||
| 868 | assert(length == strlen(*val)); | 868 | assert(length == strlen(*val)); |
| 869 | } | 869 | } |
| 870 | 870 | ||
| 871 | PLIST_API const char* plist_get_string_ptr(plist_t node, uint64_t* length) | ||
| 872 | { | ||
| 873 | if (!node) | ||
| 874 | return NULL; | ||
| 875 | plist_type type = plist_get_node_type(node); | ||
| 876 | if (PLIST_STRING != type) | ||
| 877 | return NULL; | ||
| 878 | plist_data_t data = plist_get_data(node); | ||
| 879 | if (length) | ||
| 880 | *length = data->length; | ||
| 881 | return (const char*)data->strval; | ||
| 882 | } | ||
| 883 | |||
| 871 | PLIST_API void plist_get_bool_val(plist_t node, uint8_t * val) | 884 | PLIST_API void plist_get_bool_val(plist_t node, uint8_t * val) |
| 872 | { | 885 | { |
| 873 | if (!node || !val) | 886 | if (!node || !val) |
| @@ -926,6 +939,18 @@ PLIST_API void plist_get_data_val(plist_t node, char **val, uint64_t * length) | |||
| 926 | plist_get_type_and_value(node, &type, (void *) val, length); | 939 | plist_get_type_and_value(node, &type, (void *) val, length); |
| 927 | } | 940 | } |
| 928 | 941 | ||
| 942 | PLIST_API const char* plist_get_data_ptr(plist_t node, uint64_t* length) | ||
| 943 | { | ||
| 944 | if (!node || !length) | ||
| 945 | return NULL; | ||
| 946 | plist_type type = plist_get_node_type(node); | ||
| 947 | if (PLIST_DATA != type) | ||
| 948 | return NULL; | ||
| 949 | plist_data_t data = plist_get_data(node); | ||
| 950 | *length = data->length; | ||
| 951 | return (const char*)data->buff; | ||
| 952 | } | ||
| 953 | |||
| 929 | PLIST_API void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec) | 954 | PLIST_API void plist_get_date_val(plist_t node, int32_t * sec, int32_t * usec) |
| 930 | { | 955 | { |
| 931 | if (!node) | 956 | if (!node) |
