diff options
| -rw-r--r-- | src/plist.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/plist.c b/src/plist.c index 9f3c8f4..78e71da 100644 --- a/src/plist.c +++ b/src/plist.c | |||
| @@ -199,10 +199,15 @@ PLIST_API plist_err_t plist_from_memory(const char *plist_data, uint32_t length, | |||
| 199 | } | 199 | } |
| 200 | if (plist_is_binary(plist_data, length)) { | 200 | if (plist_is_binary(plist_data, length)) { |
| 201 | res = plist_from_bin(plist_data, length, plist); | 201 | res = plist_from_bin(plist_data, length, plist); |
| 202 | } else if (plist_data[0] == '[' || plist_data[0] == '{') { | ||
| 203 | res = plist_from_json(plist_data, length, plist); | ||
| 204 | } else { | 202 | } else { |
| 205 | res = plist_from_xml(plist_data, length, plist); | 203 | /* skip whitespace before checking */ |
| 204 | uint32_t pos = 0; | ||
| 205 | while (pos < length && ((plist_data[pos] == ' ') || (plist_data[pos] == '\t') || (plist_data[pos] == '\r') || (plist_data[pos] == '\n'))) pos++; | ||
| 206 | if (plist_data[pos] == '[' || plist_data[pos] == '{') { | ||
| 207 | res = plist_from_json(plist_data, length, plist); | ||
| 208 | } else { | ||
| 209 | res = plist_from_xml(plist_data, length, plist); | ||
| 210 | } | ||
| 206 | } | 211 | } |
| 207 | return res; | 212 | return res; |
| 208 | } | 213 | } |
