File libparsifal-1.1.0-fix-64bit-portability-issue.patch of Package libparsifal
diff -urN libparsifal-1.1.0-orig/src/xmlhash.c libparsifal-1.1.0/src/xmlhash.c
--- libparsifal-1.1.0-orig/src/xmlhash.c 2008-09-24 20:40:39.000000000 +0200
+++ libparsifal-1.1.0/src/xmlhash.c 2012-08-14 10:14:30.630431649 +0200
@@ -218,7 +218,8 @@
void XMLAPI *XMLHTable_Lookup(LPXMLHTABLE table, XMLCH *key)
{
- unsigned val = hash(key, table->size, (size_t)NULL);
+ size_t a = NULL;
+ unsigned val = hash(key, table->size, &a);
if (!(table->table)[val]) return NULL;
for (table->bucket = (table->table)[val]; table->bucket; table->bucket = BUCK3T->next) {
@@ -232,7 +233,8 @@
void XMLAPI *XMLHTable_Remove(LPXMLHTABLE table, XMLCH *key)
{
- unsigned val = hash(key, table->size, (size_t)NULL);
+ size_t a = NULL;
+ unsigned val = hash(key, table->size, &a);
XMLHTABLEBUCKET *last = NULL;
if (!(table->table)[val]) return NULL;
@@ -273,51 +275,51 @@
}
/* If we get here, it means we didn't find the item in the table. */
return NULL;
-}
+}
int XMLAPI XMLHTable_Destroy(LPXMLHTABLE table, int (*func)(XMLCH *, void *, void *), int dflags)
{
- int ret=0;
- size_t i=0; /* i also marks 'already enumerated' for FORREUSE */
-
+ int ret=0;
+ size_t i=0; /* i also marks 'already enumerated' for FORREUSE */
+
if (!(dflags&XMLHTABLEDFLAG_NOENUM)) {
if (!func) {
if (!(table->flags&XMLHTABLEFLAG_NOCOPYKEY)) {
for (i=0; i<table->size; i++) /* we have to enumerate and free the keys */
if ((table->table)[i]) {
- for (table->bucket = (table->table)[i]; table->bucket;
- table->bucket = BUCK3T->next) free(BUCK3T->key);
- (table->table)[i] = NULL; /* clear the table for possible reuse */
+ for (table->bucket = (table->table)[i]; table->bucket;
+ table->bucket = BUCK3T->next) free(BUCK3T->key);
+ (table->table)[i] = NULL; /* clear the table for possible reuse */
}
}
}
- else {
+ else {
if (dflags&XMLHTABLEDFLAG_DEFUSERDATA) table->userdata = table;
- ret = XMLHTable_Enumerate(table, func);
- }
+ ret = XMLHTable_Enumerate(table, func);
+ }
}
- if (dflags&XMLHTABLEDFLAG_FORREUSE) {
- if (table->nodes && table->cnodepools && table->freenode != table->nodes[0]) {
- if (!i) { /* already enumerated? */
- for (i=0; i<table->size; i++)
- if ((table->table)[i]) (table->table)[i] = NULL;
- }
- /* cnodepools=1 will resize array accordingly on next realloc */
- while (table->cnodepools>1) free(table->nodes[--table->cnodepools]);
- table->freenode = table->nodes[0];
- ((XMLHTABLEBUCKET*)table->freenode)->next = NOD3MARK;
- }
- return ret;
- }
- else {
- if (table->nodes && table->cnodepools) {
- do {
- free(table->nodes[--table->cnodepools]);
- } while (table->cnodepools);
- }
+ if (dflags&XMLHTABLEDFLAG_FORREUSE) {
+ if (table->nodes && table->cnodepools && table->freenode != table->nodes[0]) {
+ if (!i) { /* already enumerated? */
+ for (i=0; i<table->size; i++)
+ if ((table->table)[i]) (table->table)[i] = NULL;
+ }
+ /* cnodepools=1 will resize array accordingly on next realloc */
+ while (table->cnodepools>1) free(table->nodes[--table->cnodepools]);
+ table->freenode = table->nodes[0];
+ ((XMLHTABLEBUCKET*)table->freenode)->next = NOD3MARK;
+ }
+ return ret;
+ }
+ else {
+ if (table->nodes && table->cnodepools) {
+ do {
+ free(table->nodes[--table->cnodepools]);
+ } while (table->cnodepools);
+ }
free(table->nodes);
free(table->table);
- free(table);
+ free(table);
}
return ret;
}