diff --git a/app-pda/libplist/libplist-1.12.recipe b/app-pda/libplist/libplist-1.12.recipe new file mode 100644 index 000000000..0b8215e9f --- /dev/null +++ b/app-pda/libplist/libplist-1.12.recipe @@ -0,0 +1,100 @@ +SUMMARY="A library to handle Apple Property Lists in binary or XML" +DESCRIPTION="libplist is a library for reading and writing the Apple binary \ +and XML property list format. It is part of the libimobiledevice stack \ +providing access to iDevices." +HOMEPAGE="http://www.libimobiledevice.org/" +COPYRIGHT="2008-2010 Jonathan Beck + 2009-2014 Nikias Bassen + 2009-2014 Martin Szulecki + 2008 Matt Colyer" +LICENSE="GNU GPL v2 + GNU LGPL v2.1" +REVISION="1" +SOURCE_URI="http://www.libimobiledevice.org/downloads/libplist-$portVersion.tar.bz2" +CHECKSUM_SHA256="0effdedcb3de128c4930d8c03a3854c74c426c16728b8ab5f0a5b6bdc0b644be" +PATCHES="libplist-$portVersion.patchset" + +ARCHITECTURES="x86_gcc2 x86 x86_64" +SECONDARY_ARCHITECTURES="x86_gcc2 x86" + +PROVIDES=" + libplist$secondaryArchSuffix = $portVersion compat >= 1 + lib:libplist$secondaryArchSuffix = 3.0.0 compat >= 3 + lib:libplist++$secondaryArchSuffix = 3.0.0 compat >= 3 + " +if [ -z "$secondaryArchSuffix" ]; then + PROVIDES="$PROVIDES + cmd:plistutil = $portVersion compat >= 1 + " +fi + +REQUIRES=" + haiku$secondaryArchSuffix + lib:libxml2$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " + +PROVIDES_devel=" + libplist${secondaryArchSuffix}_devel = $portVersion compat >= 1 + devel:libplist$secondaryArchSuffix = 3.0.0 compat >= 3 + devel:libplist++$secondaryArchSuffix = 3.0.0 compat >= 3 + " +REQUIRES_devel=" + libplist$secondaryArchSuffix == $portVersion base + devel:libxml2$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libxml2$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:aclocal + cmd:autoconf + cmd:automake + cmd:cmake + cmd:gcc$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + cmd:libtoolize$secondaryArchSuffix + cmd:make + cmd:pkg_config$secondaryArchSuffix + cmd:python + " + +BUILD() +{ + if [ -n "$secondaryArchSuffix" ]; then + maybe_without_cython=--without-cython + else + maybe_without_cython= + fi + + runConfigure ./configure $maybe_without_cython + + make $jobArgs +} + +INSTALL() +{ + make install + + # remove libtool files + rm $libDir/lib*.la + + if [ -n "$secondaryArchSuffix" ]; then + rm -rf $binDir + fi + + prepareInstalledDevelLibs libplist libplist++ + fixPkgconfig + + # devel package + packageEntries devel \ + $developDir \ + +} + +TEST() +{ + make check +} diff --git a/app-pda/libplist/patches/libplist-1.12.patchset b/app-pda/libplist/patches/libplist-1.12.patchset new file mode 100644 index 000000000..98b836a98 --- /dev/null +++ b/app-pda/libplist/patches/libplist-1.12.patchset @@ -0,0 +1,496 @@ +From 0f98ae0857511c656383d823778eebb4f6460119 Mon Sep 17 00:00:00 2001 +From: fbrosson +Date: Wed, 31 Aug 2016 06:10:22 +0000 +Subject: gcc2 + + +diff --git a/libcnary/node.c b/libcnary/node.c +index fadc9de..64a33e4 100644 +--- a/libcnary/node.c ++++ b/libcnary/node.c +@@ -87,20 +87,24 @@ int node_attach(node_t* parent, node_t* child) { + if(parent->isLeaf == TRUE) { + parent->isLeaf = FALSE; + } ++ { + int res = node_list_add(parent->children, child); + if (res == 0) { + parent->count++; + } + return res; ++ } + } + + int node_detach(node_t* parent, node_t* child) { + if (!parent || !child) return -1; ++ { + int node_index = node_list_remove(parent->children, child); + if (node_index >= 0) { + parent->count--; + } + return node_index; ++ } + } + + int node_insert(node_t* parent, unsigned int node_index, node_t* child) +@@ -113,11 +117,13 @@ int node_insert(node_t* parent, unsigned int node_index, node_t* child) + if(parent->isLeaf == TRUE) { + parent->isLeaf = FALSE; + } ++ { + int res = node_list_insert(parent->children, node_index, child); + if (res == 0) { + parent->count++; + } + return res; ++ } + } + + void node_debug(node_t* node) { +@@ -155,6 +161,7 @@ unsigned int node_n_children(struct node_t* node) + node_t* node_nth_child(struct node_t* node, unsigned int n) + { + if (!node || !node->children || !node->children->begin) return NULL; ++ { + unsigned int node_index = 0; + int found = 0; + node_t *ch; +@@ -168,6 +175,7 @@ node_t* node_nth_child(struct node_t* node, unsigned int n) + return NULL; + } + return ch; ++ } + } + + node_t* node_first_child(struct node_t* node) +@@ -191,6 +199,7 @@ node_t* node_next_sibling(struct node_t* node) + int node_child_position(struct node_t* parent, node_t* child) + { + if (!parent || !parent->children || !parent->children->begin || !child) return -1; ++ { + int node_index = 0; + int found = 0; + node_t *ch; +@@ -205,15 +214,18 @@ int node_child_position(struct node_t* parent, node_t* child) + return -1; + } + return node_index; ++ } + } + + node_t* node_copy_deep(node_t* node, copy_func_t copy_func) + { + if (!node) return NULL; ++ { + void *data = NULL; + if (copy_func) { + data = copy_func(node->data); + } ++ { + node_t* copy = node_create(NULL, data); + node_t* ch; + for (ch = node_first_child(node); ch; ch = node_next_sibling(ch)) { +@@ -221,4 +233,6 @@ node_t* node_copy_deep(node_t* node, copy_func_t copy_func) + node_attach(copy, cc); + } + return copy; ++ } ++ } + } +diff --git a/libcnary/node_list.c b/libcnary/node_list.c +index 4b268e0..51cc5cf 100644 +--- a/libcnary/node_list.c ++++ b/libcnary/node_list.c +@@ -51,6 +51,7 @@ node_list_t* node_list_create(node_t* node) { + int node_list_add(node_list_t* list, node_t* node) { + if (!list || !node) return -1; + ++ { + // Find the last element in the list + node_t* last = list->end; + +@@ -66,7 +67,7 @@ int node_list_add(node_list_t* list, node_t* node) { + + // Set the lists prev to the new last element + list->end = node; +- ++ } + // Increment our node count for this list + list->count++; + return 0; +@@ -77,7 +78,7 @@ int node_list_insert(node_list_t* list, unsigned int node_index, node_t* node) { + if (node_index >= list->count) { + return node_list_add(list, node); + } +- ++ { + // Get the first element in the list + node_t* cur = list->begin; + +@@ -114,7 +115,7 @@ int node_list_insert(node_list_t* list, unsigned int node_index, node_t* node) { + // set prev of the new next element to our node + node->next->prev = node; + } +- ++ } + // Increment our node count for this list + list->count++; + return 0; +@@ -123,7 +124,7 @@ int node_list_insert(node_list_t* list, unsigned int node_index, node_t* node) { + int node_list_remove(node_list_t* list, node_t* node) { + if (!list || !node) return -1; + if (list->count == 0) return -1; +- ++ { + int node_index = 0; + node_t* n; + for (n = list->begin; n; n = n->next) { +@@ -149,6 +150,7 @@ int node_list_remove(node_list_t* list, node_t* node) { + } + node_index++; + } ++ } + return -1; + } + +diff --git a/src/base64.c b/src/base64.c +index 7128a5a..2c1c581 100644 +--- a/src/base64.c ++++ b/src/base64.c +@@ -46,6 +46,7 @@ static const signed char base64_table[256] = { + char *base64encode(const unsigned char *buf, size_t *size) + { + if (!buf || !size || !(*size > 0)) return NULL; ++ { + int outlen = (*size / 3) * 4; + char *outbuf = (char*)malloc(outlen+5); // 4 spare bytes + 1 for '\0' + size_t n = 0; +@@ -69,6 +70,7 @@ char *base64encode(const unsigned char *buf, size_t *size) + outbuf[m] = 0; // 0-termination! + *size = m; + return outbuf; ++ } + } + + static int base64decode_block(unsigned char *target, const char *data, size_t data_size) +@@ -106,8 +108,10 @@ static int base64decode_block(unsigned char *target, const char *data, size_t da + unsigned char *base64decode(const char *buf, size_t *size) + { + if (!buf) return NULL; ++ { + size_t len = strlen(buf); + if (len <= 0) return NULL; ++ { + unsigned char *outbuf = (unsigned char*)malloc((len/4)*3+3); + const char *ptr = buf; + int p = 0; +@@ -129,4 +133,6 @@ unsigned char *base64decode(const char *buf, size_t *size) + outbuf[p] = 0; + *size = p; + return outbuf; ++ } ++ } + } +diff --git a/src/bplist.c b/src/bplist.c +index 40b453b..2e9021a 100644 +--- a/src/bplist.c ++++ b/src/bplist.c +@@ -295,6 +295,7 @@ static plist_t parse_string_node(char *bnode, uint64_t size) + static char *plist_utf16_to_utf8(uint16_t *unistr, long len, long *items_read, long *items_written) + { + if (!unistr || (len <= 0)) return NULL; ++ { + char *outbuf = (char*)malloc(4*(len+1)); + int p = 0; + int i = 0; +@@ -346,6 +347,7 @@ static char *plist_utf16_to_utf8(uint16_t *unistr, long len, long *items_read, l + outbuf[p] = 0; + + return outbuf; ++ } + } + + static plist_t parse_unicode_node(char *bnode, uint64_t size) +@@ -750,10 +752,12 @@ PLIST_API void plist_from_bin(const char *plist_bin, uint32_t length, plist_t * + // free unreferenced nodes that would otherwise leak memory + for (i = 0; i < num_objects; i++) { + if (i == root_object) continue; ++ { + node_t* node = (node_t*)nodeslist[i]; + if (node && NODE_IS_ROOT(node)) { + plist_free(node); + } ++ } + } + free(nodeslist); + } +@@ -831,6 +835,7 @@ static void serialize_plist(node_t* node, void* data) + //now append current node to object array + ptr_array_add(ser->objects, node); + ++ { + //now recurse on children + node_iterator_t *ni = node_iterator_create(node->children); + node_t *ch; +@@ -838,7 +843,7 @@ static void serialize_plist(node_t* node, void* data) + serialize_plist(ch, data); + } + node_iterator_destroy(ni); +- ++ } + return; + } + +diff --git a/src/bytearray.c b/src/bytearray.c +index 2c6ce4a..66cf59e 100644 +--- a/src/bytearray.c ++++ b/src/bytearray.c +@@ -42,11 +42,13 @@ void byte_array_free(bytearray_t *ba) + void byte_array_append(bytearray_t *ba, void *buf, size_t len) + { + if (!ba || !ba->data || (len <= 0)) return; ++ { + size_t remaining = ba->capacity-ba->len; + if (len > remaining) { + ba->data = realloc(ba->data, ba->capacity + (len - remaining)); + ba->capacity += (len - remaining); + } ++ } + memcpy(((char*)ba->data) + ba->len, buf, len); + ba->len += len; + } +diff --git a/src/hashtable.c b/src/hashtable.c +index 08ff934..d993ba5 100644 +--- a/src/hashtable.c ++++ b/src/hashtable.c +@@ -36,26 +36,29 @@ hashtable_t* hash_table_new(hash_func_t hash_func, compare_func_t compare_func) + void hash_table_destroy(hashtable_t *ht) + { + if (!ht) return; +- ++ { + int i = 0; + for (i = 0; i < 256; i++) { + if (ht->entries[i]) { + hashentry_t* e = ht->entries[i]; + while (e) { + free(e->value); ++ { + hashentry_t* old = e; + e = e->next; + free(old); ++ } + } + } + } ++ } + free(ht); + } + + void hash_table_insert(hashtable_t* ht, void *key, void *value) + { + if (!ht || !key) return; +- ++ { + unsigned int hash = ht->hash_func(key); + + int idx0 = hash & 0xFF; +@@ -72,7 +75,7 @@ void hash_table_insert(hashtable_t* ht, void *key, void *value) + } + + // if we get here, the element is not yet in the list. +- ++ { + // make a new entry. + hashentry_t* entry = (hashentry_t*)malloc(sizeof(hashentry_t)); + entry->key = key; +@@ -85,12 +88,15 @@ void hash_table_insert(hashtable_t* ht, void *key, void *value) + entry->next = ht->entries[idx0]; + } + ht->entries[idx0] = entry; ++ } ++ } + ht->count++; + } + + void* hash_table_lookup(hashtable_t* ht, void *key) + { + if (!ht || !key) return NULL; ++ { + unsigned int hash = ht->hash_func(key); + + int idx0 = hash & 0xFF; +@@ -102,5 +108,6 @@ void* hash_table_lookup(hashtable_t* ht, void *key) + } + e = e->next; + } ++ } + return NULL; + } +diff --git a/src/plist.c b/src/plist.c +index c38b6eb..ca1bf27 100644 +--- a/src/plist.c ++++ b/src/plist.c +@@ -75,12 +75,14 @@ static int plist_free_node(node_t* node) + plist_free_data(data); + node->data = NULL; + ++ { + node_iterator_t *ni = node_iterator_create(node->children); + node_t *ch; + while ((ch = node_iterator_next(ni))) { + plist_free_node(ch); + } + node_iterator_destroy(ni); ++ } + + node_destroy(node); + +@@ -223,12 +225,14 @@ static void plist_copy_node(node_t *node, void *parent_node_ptr) + *(plist_t*)parent_node_ptr = newnode; + } + ++ { + node_iterator_t *ni = node_iterator_create(node->children); + node_t *ch; + while ((ch = node_iterator_next(ni))) { + plist_copy_node(ch, &newnode); + } + node_iterator_destroy(ni); ++ } + } + + PLIST_API plist_t plist_copy(plist_t node) +@@ -446,7 +450,7 @@ PLIST_API void plist_dict_merge(plist_t *target, plist_t source) + { + if (!target || !*target || (plist_get_node_type(*target) != PLIST_DICT) || !source || (plist_get_node_type(source) != PLIST_DICT)) + return; +- ++ { + char* key = NULL; + plist_dict_iter it = NULL; + plist_t subnode = NULL; +@@ -464,6 +468,7 @@ PLIST_API void plist_dict_merge(plist_t *target, plist_t source) + key = NULL; + } while (1); + free(it); ++ } + } + + PLIST_API plist_t plist_access_pathv(plist_t plist, uint32_t length, va_list v) +diff --git a/src/ptrarray.c b/src/ptrarray.c +index 56d28cb..773888a 100644 +--- a/src/ptrarray.c ++++ b/src/ptrarray.c +@@ -42,11 +42,13 @@ void ptr_array_free(ptrarray_t *pa) + void ptr_array_add(ptrarray_t *pa, void *data) + { + if (!pa || !pa->pdata || !data) return; ++ { + size_t remaining = pa->capacity-pa->len; + if (remaining == 0) { + pa->pdata = realloc(pa->pdata, sizeof(void*) * (pa->capacity + pa->capacity_step)); + pa->capacity += pa->capacity_step; + } ++ } + pa->pdata[pa->len] = data; + pa->len++; + } +diff --git a/src/xplist.c b/src/xplist.c +index 4c106aa..ea3446c 100644 +--- a/src/xplist.c ++++ b/src/xplist.c +@@ -72,6 +72,7 @@ static const char *plist_base = "\n\ + static char *format_string(const char *buf, size_t len, int cols, int depth) + { + if (!buf || !(len > 0)) return NULL; ++ { + int colw = depth + cols + 1; + int nlines = len / cols + 1; + char *new_buf = NULL; +@@ -101,6 +102,7 @@ static char *format_string(const char *buf, size_t len, int cols, int depth) + new_buf[len + (1 + depth) * nlines + depth + 1] = '\0'; + + return new_buf; ++ } + } + + +@@ -129,9 +131,11 @@ static struct node_t* new_key_node(const char* name) + { + plist_data_t data = plist_new_plist_data(); + data->type = PLIST_KEY; ++ { + int size = strlen(name); + data->strval = strdup(name); + data->length = size; ++ } + return node_create(NULL, data); + } + +@@ -386,6 +390,7 @@ static void xml_to_node(xmlNodePtr xml_node, plist_t * plist_node) + } + str++; + } ++ { + char* endp = NULL; + data->intval = strtoull((char*)str, &endp, 0); + if ((endp != NULL) && (strlen(endp) > 0)) { +@@ -404,6 +409,7 @@ static void xml_to_node(xmlNodePtr xml_node, plist_t * plist_node) + data->type = PLIST_UINT; + xmlFree(strval); + continue; ++ } + } + + if (!xmlStrcmp(node->name, XPLIST_REAL)) +@@ -500,11 +506,13 @@ static void xml_to_node(xmlNodePtr xml_node, plist_t * plist_node) + uint64_t val = 0; + plist_get_uint_val(uid, &val); + plist_dict_remove_item(subnode, "CF$UID"); ++ { + plist_data_t nodedata = plist_get_data((node_t*)subnode); + free(nodedata->buff); + nodedata->type = PLIST_UID; + nodedata->length = sizeof(uint64_t); + nodedata->intval = val; ++ } + } + } + } +@@ -525,7 +533,7 @@ PLIST_API void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length) + plist_doc = new_xml_plist(); + root_node = xmlDocGetRootElement(plist_doc); + root.xml = root_node; +- ++ { + char *current_locale = setlocale(LC_NUMERIC, NULL); + char *saved_locale = NULL; + if (current_locale) { +@@ -535,7 +543,7 @@ PLIST_API void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length) + setlocale(LC_NUMERIC, "POSIX"); + } + node_to_xml(plist, &root); +- ++ { + xmlChar* tmp = NULL; + xmlDocDumpMemory(plist_doc, &tmp, &size); + if (size >= 0 && tmp) +@@ -547,12 +555,14 @@ PLIST_API void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length) + xmlFree(tmp); + tmp = NULL; + } ++ } + xmlFreeDoc(plist_doc); + + if (saved_locale) { + setlocale(LC_NUMERIC, saved_locale); + free(saved_locale); + } ++ } + } + + PLIST_API void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist) +-- +2.9.3 +