summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Christophe Fergeau2016-05-12 02:52:50 +0200
committerGravatar Nikias Bassen2016-05-12 02:52:50 +0200
commit449e27bf754f903f856a741e163a9e4a0c8037b0 (patch)
tree209201532a9ba1c255c412a9f3257fd078d17091 /src
parent19735fbd32ddbc9874f8aca12ac6e86239441dcd (diff)
downloadlibplist-449e27bf754f903f856a741e163a9e4a0c8037b0.tar.gz
libplist-449e27bf754f903f856a741e163a9e4a0c8037b0.tar.bz2
Add plist_is_binary()
It can be useful if one needs to know what type of plist a memory buffer contains.
Diffstat (limited to 'src')
-rw-r--r--src/plist.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/plist.c b/src/plist.c
index 569251b..3e69e2a 100644
--- a/src/plist.c
+++ b/src/plist.c
@@ -49,6 +49,15 @@ void plist_cleanup(void)
xmlCleanupMemory();
}
+PLIST_API int plist_is_binary(const char *plist_data, uint32_t length)
+{
+ if (length < 8) {
+ return 0;
+ }
+
+ return (memcmp(plist_data, "bplist00", 8) == 0);
+}
+
plist_t plist_new_node(plist_data_t data)
{
return (plist_t) node_create(NULL, data);