summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--libxslt/extensions.c20
-rw-r--r--libxslt/functions.c3
-rw-r--r--libxslt/numbers.c2
-rw-r--r--libxslt/pattern.c59
-rw-r--r--libxslt/transform.c2
-rw-r--r--libxslt/xslt.c4
-rw-r--r--libxslt/xsltInternals.h24
8 files changed, 78 insertions, 46 deletions
diff --git a/ChangeLog b/ChangeLog
index 5eaff3ea..64e1f137 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Wed Dec 1 22:37:55 HKT 2004 William Brack <wbrack@mmm.com.hk>
+
+ * libxslt/extensions.c, libxslt/functions.c, libxslt/numbers.c,
+ libxslt/pattern.c, libxslt/transform.c, libxslt/xslt.c,
+ libxslt/xsltInternals.h: minor changes to get rid of gcc
+ warnings, especially on 64-bit system. Implemented
+ XML_CAST_FPTR macro to cast between function pointer <->
+ object pointer while avoiding gcc warnings (a hack).
+ No change to the logic.
+
Wed Dec 1 10:47:15 CET 2004 Daniel Veillard <daniel@veillard.com>
* libxslt/security.c xsltproc/xsltproc.c: applied patch from
diff --git a/libxslt/extensions.c b/libxslt/extensions.c
index aae6fdc3..da6b087d 100644
--- a/libxslt/extensions.c
+++ b/libxslt/extensions.c
@@ -367,7 +367,7 @@ xsltRegisterExtFunction(xsltTransformContextPtr ctxt, const xmlChar *name,
ctxt->extFunctions = xmlHashCreate(10);
if (ctxt->extFunctions == NULL)
return(-1);
- return(xmlHashAddEntry2(ctxt->extFunctions, name, URI, (void *) function));
+ return(xmlHashAddEntry2(ctxt->extFunctions, name, URI, XML_CAST_FPTR(function)));
}
/**
@@ -391,7 +391,7 @@ xsltRegisterExtElement(xsltTransformContextPtr ctxt, const xmlChar *name,
ctxt->extElements = xmlHashCreate(10);
if (ctxt->extElements == NULL)
return(-1);
- return(xmlHashAddEntry2(ctxt->extElements, name, URI, (void *) function));
+ return(xmlHashAddEntry2(ctxt->extElements, name, URI, XML_CAST_FPTR(function)));
}
/**
@@ -938,7 +938,7 @@ xsltRegisterExtModuleFunction (const xmlChar *name, const xmlChar *URI,
return(-1);
xmlHashUpdateEntry2(xsltFunctionsHash, name, URI,
- (void *) function, NULL);
+ XML_CAST_FPTR(function), NULL);
return(0);
}
@@ -954,10 +954,12 @@ xsltRegisterExtModuleFunction (const xmlChar *name, const xmlChar *URI,
*/
xmlXPathFunction
xsltExtModuleFunctionLookup (const xmlChar *name, const xmlChar *URI) {
+ xmlXPathFunction ret;
if ((xsltFunctionsHash == NULL) || (name == NULL) || (URI == NULL))
return(NULL);
- return (xmlXPathFunction) xmlHashLookup2(xsltFunctionsHash, name, URI);
+ XML_CAST_FPTR(ret) = xmlHashLookup2(xsltFunctionsHash, name, URI);
+ return ret;
}
/**
@@ -1133,8 +1135,7 @@ xsltExtElementLookup (xsltTransformContextPtr ctxt,
return(NULL);
if ((ctxt != NULL) && (ctxt->extElements != NULL)) {
- ret = (xsltTransformFunction)
- xmlHashLookup2(ctxt->extElements, name, URI);
+ XML_CAST_FPTR(ret) = xmlHashLookup2(ctxt->extElements, name, URI);
if (ret != NULL)
return(ret);
}
@@ -1240,7 +1241,7 @@ xsltRegisterExtModuleTopLevel (const xmlChar *name, const xmlChar *URI,
return(-1);
xmlHashUpdateEntry2(xsltTopLevelsHash, name, URI,
- (void *) function, NULL);
+ XML_CAST_FPTR(function), NULL);
return(0);
}
@@ -1256,11 +1257,12 @@ xsltRegisterExtModuleTopLevel (const xmlChar *name, const xmlChar *URI,
*/
xsltTopLevelFunction
xsltExtModuleTopLevelLookup (const xmlChar *name, const xmlChar *URI) {
+ xsltTopLevelFunction ret;
if ((xsltTopLevelsHash == NULL) || (name == NULL) || (URI == NULL))
return(NULL);
- return((xsltTopLevelFunction)
- xmlHashLookup2(xsltTopLevelsHash, name, URI));
+ XML_CAST_FPTR(ret) = xmlHashLookup2(xsltTopLevelsHash, name, URI);
+ return(ret);
}
/**
diff --git a/libxslt/functions.c b/libxslt/functions.c
index aa1a236d..871c8b9f 100644
--- a/libxslt/functions.c
+++ b/libxslt/functions.c
@@ -78,7 +78,10 @@ xsltXPathFunctionLookup (xmlXPathContextPtr ctxt,
#endif
/* give priority to context-level functions */
+ /*
ret = (xmlXPathFunction) xmlHashLookup2(ctxt->funcHash, name, ns_uri);
+ */
+ XML_CAST_FPTR(ret) = xmlHashLookup2(ctxt->funcHash, name, ns_uri);
if (ret == NULL)
ret = xsltExtModuleFunctionLookup(name, ns_uri);
diff --git a/libxslt/numbers.c b/libxslt/numbers.c
index 62df43cd..c13430fb 100644
--- a/libxslt/numbers.c
+++ b/libxslt/numbers.c
@@ -1187,7 +1187,7 @@ xsltFormatNumberConversion(xsltDecimalFormatPtr self,
}
else {
/* Skip over pattern separator (accounting for UTF8) */
- the_format = xmlUTF8Strpos(format, j + 1);
+ the_format = (xmlChar *)xmlUTF8Strpos(format, j + 1);
/*
* Flag changes interpretation of percent/permille
* in -ve pattern
diff --git a/libxslt/pattern.c b/libxslt/pattern.c
index f50cf468..4908335b 100644
--- a/libxslt/pattern.c
+++ b/libxslt/pattern.c
@@ -634,9 +634,8 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
int nocache = 0;
prevdoc = (xmlDocPtr)
- XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra);
- ix = (int)
- XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra);
+ XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr);
+ ix = XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival);
list = (xmlXPathObjectPtr)
XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra);
@@ -679,9 +678,9 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
XSLT_RUNTIME_EXTRA_LST(ctxt, sel->lenExtra) =
(void *) list;
- XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra) =
+ XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr) =
(void *) doc;
- XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra) =
+ XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) =
0;
XSLT_RUNTIME_EXTRA_FREE(ctxt, sel->lenExtra) =
(xmlFreeFunc) xmlXPathFreeObject;
@@ -726,9 +725,8 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
int ix, nocache = 0;
previous = (xmlNodePtr)
- XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra);
- ix = (int)
- XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra);
+ XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr);
+ ix = XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival);
if ((previous != NULL) &&
(previous->parent == node->parent)) {
/*
@@ -776,13 +774,13 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
* (bugs 153137 and 158840)
*/
if (node->doc != NULL) {
- len = (int)
- XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra);
+ len = XSLT_RUNTIME_EXTRA(ctxt,
+ sel->lenExtra, ival);
if (!isRVT) {
XSLT_RUNTIME_EXTRA(ctxt,
- sel->previousExtra) = node;
- XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra) =
- (void *) pos;
+ sel->previousExtra, ptr) = node;
+ XSLT_RUNTIME_EXTRA(ctxt,
+ sel->indexExtra, ival) = pos;
}
}
ix = pos;
@@ -833,12 +831,12 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
*/
if ((!isRVT) && (node->doc != NULL) &&
(nocache == 0)) {
- XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra) =
+ XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr) =
node;
- XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra) =
- (void *) pos;
- XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra) =
- (void *) len;
+ XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) =
+ pos;
+ XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra, ival) =
+ len;
}
}
} else if ((sel != NULL) && (sel->op == XSLT_OP_ALL) &&
@@ -847,9 +845,8 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
int ix, nocache = 0;
previous = (xmlNodePtr)
- XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra);
- ix = (int)
- XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra);
+ XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr);
+ ix = XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival);
if ((previous != NULL) &&
(previous->parent == node->parent)) {
/*
@@ -884,12 +881,12 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
* cache it !
*/
if ((node->doc != NULL) && !isRVT) {
- len = (int)
- XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra);
+ len = XSLT_RUNTIME_EXTRA(ctxt,
+ sel->lenExtra, ival);
+ XSLT_RUNTIME_EXTRA(ctxt,
+ sel->previousExtra, ptr) = node;
XSLT_RUNTIME_EXTRA(ctxt,
- sel->previousExtra) = node;
- XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra) =
- (void *) pos;
+ sel->indexExtra, ival) = pos;
}
} else
pos = 0;
@@ -928,12 +925,12 @@ xsltTestCompMatch(xsltTransformContextPtr ctxt, xsltCompMatchPtr comp,
* cache it !
*/
if ((node->doc != NULL) && (nocache == 0) && !isRVT) {
- XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra) =
+ XSLT_RUNTIME_EXTRA(ctxt, sel->previousExtra, ptr) =
node;
- XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra) =
- (void *) pos;
- XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra) =
- (void *) len;
+ XSLT_RUNTIME_EXTRA(ctxt, sel->indexExtra, ival) =
+ pos;
+ XSLT_RUNTIME_EXTRA(ctxt, sel->lenExtra, ival) =
+ len;
}
}
}
diff --git a/libxslt/transform.c b/libxslt/transform.c
index f519fac5..d4bcc974 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -421,7 +421,7 @@ xsltNewTransformContext(xsltStylesheetPtr style, xmlDocPtr doc) {
for (i = 0;i < cur->extrasMax;i++) {
cur->extras[i].info = NULL;
cur->extras[i].deallocate = NULL;
- cur->extras[i].val = NULL;
+ cur->extras[i].val.ptr = NULL;
}
} else {
cur->extras = NULL;
diff --git a/libxslt/xslt.c b/libxslt/xslt.c
index 733afb7a..e8dc26c9 100644
--- a/libxslt/xslt.c
+++ b/libxslt/xslt.c
@@ -426,7 +426,7 @@ xsltAllocateExtraCtxt(xsltTransformContextPtr ctxt)
for (i = 0;i < ctxt->extrasMax;i++) {
ctxt->extras[i].info = NULL;
ctxt->extras[i].deallocate = NULL;
- ctxt->extras[i].val = NULL;
+ ctxt->extras[i].val.ptr = NULL;
}
} else {
@@ -445,7 +445,7 @@ xsltAllocateExtraCtxt(xsltTransformContextPtr ctxt)
for (i = ctxt->extrasNr;i < ctxt->extrasMax;i++) {
ctxt->extras[i].info = NULL;
ctxt->extras[i].deallocate = NULL;
- ctxt->extras[i].val = NULL;
+ ctxt->extras[i].val.ptr = NULL;
}
}
}
diff --git a/libxslt/xsltInternals.h b/libxslt/xsltInternals.h
index 1378c73b..0af0eb96 100644
--- a/libxslt/xsltInternals.h
+++ b/libxslt/xsltInternals.h
@@ -50,7 +50,10 @@ typedef xsltRuntimeExtra *xsltRuntimeExtraPtr;
struct _xsltRuntimeExtra {
void *info; /* pointer to the extra data */
xmlFreeFunc deallocate; /* pointer to the deallocation routine */
- void *val; /* data not needing deallocation */
+ union { /* dual-purpose field */
+ void *ptr; /* data not needing deallocation */
+ int ival; /* integer value storage */
+ } val;
};
/**
@@ -76,7 +79,7 @@ struct _xsltRuntimeExtra {
*
* Macro used to define extra information stored in the context
*/
-#define XSLT_RUNTIME_EXTRA(ctxt, nr) (ctxt)->extras[(nr)].val
+#define XSLT_RUNTIME_EXTRA(ctxt, nr, typ) (ctxt)->extras[(nr)].val.typ
/**
* xsltTemplate:
@@ -583,6 +586,23 @@ struct _xsltTransformContext {
#define CHECK_STOPPED0 if (ctxt->state == XSLT_STATE_STOPPED) return(0);
/*
+ * The macro XML_CAST_FPTR is a hack to avoid a gcc warning about
+ * possible incompatibilities between function pointers and object
+ * pointers. It is defined in libxml/hash.h within recent versions
+ * of libxml2, but is put here for compatibility.
+ */
+#ifndef XML_CAST_FPTR
+/**
+ * XML_CAST_FPTR:
+ * @fptr: pointer to a function
+ *
+ * Macro to do a casting from an object pointer to a
+ * function pointer without encountering a warning from
+ * gcc
+ */
+#define XML_CAST_FPTR(fptr) (*(void **)(&fptr))
+#endif
+/*
* Functions associated to the internal types
xsltDecimalFormatPtr xsltDecimalFormatGetByName(xsltStylesheetPtr sheet,
xmlChar *name);