[libxslt] Fix various compiler warnings
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxslt] Fix various compiler warnings
- Date: Thu, 1 Sep 2022 12:43:01 +0000 (UTC)
commit a0623d9f7ae577c3575191b4b7a44a7547a14061
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Thu Sep 1 07:48:38 2022 +0200
Fix various compiler warnings
libxslt/attributes.c | 2 +-
libxslt/variables.c | 6 ++++--
libxslt/xsltlocale.c | 9 ++++++---
python/libxslt-python-api.xml | 2 +-
python/libxslt.c | 11 ++++++++---
tests/fuzz/testTargets.c | 4 ++--
xsltproc/testThreads.c | 4 ++--
7 files changed, 24 insertions(+), 14 deletions(-)
---
diff --git a/libxslt/attributes.c b/libxslt/attributes.c
index 8a64f3e7..28a08418 100644
--- a/libxslt/attributes.c
+++ b/libxslt/attributes.c
@@ -274,7 +274,7 @@ xsltAddUseAttrSetList(xsltUseAttrSetPtr list, const xmlChar *ncname,
* Returns the newly allocated xsltAttrSetPtr or NULL in case of error.
*/
static xsltAttrSetPtr
-xsltNewAttrSet() {
+xsltNewAttrSet(void) {
xsltAttrSetPtr cur;
cur = (xsltAttrSetPtr) xmlMalloc(sizeof(xsltAttrSet));
diff --git a/libxslt/variables.c b/libxslt/variables.c
index d7315eea..c4adc1d3 100644
--- a/libxslt/variables.c
+++ b/libxslt/variables.c
@@ -310,8 +310,10 @@ xsltFlagRVTs(xsltTransformContextPtr ctxt, xmlXPathObjectPtr obj, int val) {
* document() function?
*/
#ifdef WITH_XSLT_DEBUG_VARIABLE
- XSLT_TRACE(ctxt,XSLT_TRACE_VARIABLES,xsltGenericDebug(xsltGenericDebugContext,
- "Flagging RVT %p: %d -> %d\n", doc, doc->compression, val));
+ XSLT_TRACE(ctxt, XSLT_TRACE_VARIABLES,
+ xsltGenericDebug(xsltGenericDebugContext,
+ "Flagging RVT %p: %d -> %d\n",
+ (void *) doc, doc->compression, val));
#endif
if (val == XSLT_RVT_LOCAL) {
diff --git a/libxslt/xsltlocale.c b/libxslt/xsltlocale.c
index 39980f8d..76740987 100644
--- a/libxslt/xsltlocale.c
+++ b/libxslt/xsltlocale.c
@@ -348,6 +348,8 @@ xsltFreeLocale(xsltLocale locale) {
#ifdef XSLT_LOCALE_POSIX
if (locale != NULL)
freelocale(locale);
+#else
+ (void) locale;
#endif
}
@@ -383,6 +385,7 @@ xsltStrxfrm(xsltLocale locale, const xmlChar *string)
#endif
#ifdef XSLT_LOCALE_WINAPI
+ (void) locale;
xstrlen = MultiByteToWideChar(CP_UTF8, 0, (char *) string, -1, NULL, 0);
if (xstrlen == 0) {
xsltTransformError(NULL, NULL, NULL, "xsltStrxfrm : MultiByteToWideChar check failed\n");
@@ -454,7 +457,7 @@ xsltLocaleStrcmp(xsltLocale locale, const xsltLocaleChar *str1, const xsltLocale
*
* Returns TRUE
*/
-BOOL CALLBACK
+static BOOL CALLBACK
xsltCountSupportedLocales(LPSTR lcid) {
(void) lcid;
++xsltLocaleListSize;
@@ -469,7 +472,7 @@ xsltCountSupportedLocales(LPSTR lcid) {
*
* Returns TRUE if not at the end of the array
*/
-BOOL CALLBACK
+static BOOL CALLBACK
xsltIterateSupportedLocales(LPSTR lcid) {
static int count = 0;
xmlChar iso639lang [XSLTMAX_ISO639LANGLEN +1];
@@ -477,7 +480,7 @@ xsltIterateSupportedLocales(LPSTR lcid) {
int k, l;
xsltRFC1766Info *p = xsltLocaleList + count;
- k = sscanf(lcid, "%lx", (long*)&p->lcid);
+ k = sscanf(lcid, "%lx", (unsigned long*)&p->lcid);
if (k < 1) goto end;
/*don't count terminating null character*/
k = GetLocaleInfoA(p->lcid, LOCALE_SISO639LANGNAME,
diff --git a/python/libxslt-python-api.xml b/python/libxslt-python-api.xml
index 49491f39..fbf6ecec 100644
--- a/python/libxslt-python-api.xml
+++ b/python/libxslt-python-api.xml
@@ -18,7 +18,7 @@
</function>
<function name='xsltGetLoaderFunc' file='python'>
<info>Get the function for controlling document loading</info>
- <return type='pythonObject *' info='the function'/>
+ <return type='pythonObject' info='the function'/>
</function>
<function name='xsltNewTransformContext' file='python'>
<info>Create a new XSLT TransformContext</info>
diff --git a/python/libxslt.c b/python/libxslt.c
index 0e2786ce..0cf146d2 100644
--- a/python/libxslt.c
+++ b/python/libxslt.c
@@ -58,7 +58,11 @@ __inline int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_lis
/* #define DEBUG_EXTENSIONS */
/* #define DEBUG_EXTENSIONS */
+#if PY_MAJOR_VERSION >= 3
+PyObject* PyInit_libxsltmod(void);
+#else
void initlibxsltmod(void);
+#endif
/************************************************************************
* *
@@ -623,7 +627,8 @@ libxslt_xsltSetLoaderFunc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
}
PyObject *
-libxslt_xsltGetLoaderFunc(void) {
+libxslt_xsltGetLoaderFunc(PyObject *self ATTRIBUTE_UNUSED,
+ PyObject *args ATTRIBUTE_UNUSED) {
PyObject *py_retval;
py_retval = pythonDocLoaderObject;
@@ -1229,9 +1234,9 @@ static PyMethodDef libxsltMethods[] = {
#ifdef MERGED_MODULES
#if PY_MAJOR_VERSION >= 3
-extern PyObject* PyInit_libxml2mod(void);
+PyObject* PyInit_libxml2mod(void);
#else
-extern void initlibxml2mod(void);
+void initlibxml2mod(void);
#endif
#endif
diff --git a/tests/fuzz/testTargets.c b/tests/fuzz/testTargets.c
index de17d555..3c5fdf8b 100644
--- a/tests/fuzz/testTargets.c
+++ b/tests/fuzz/testTargets.c
@@ -9,7 +9,7 @@
#include "fuzz.h"
#include <libxml/globals.h>
-int
+static int
testXPath(int argc, char **argv) {
xmlXPathObjectPtr obj;
const char expr[] = "count(//node())";
@@ -36,7 +36,7 @@ testXPath(int argc, char **argv) {
return ret;
}
-int
+static int
testXslt(int argc, char **argv) {
xmlChar *result;
const char styleBuf[] =
diff --git a/xsltproc/testThreads.c b/xsltproc/testThreads.c
index 7c226446..ba04c0e1 100644
--- a/xsltproc/testThreads.c
+++ b/xsltproc/testThreads.c
@@ -100,7 +100,7 @@ threadRoutine1(void *data)
xmlChar *result;
int len;
xsltStylesheetPtr cur;
- int id = (int)(unsigned long) data;
+ int id = (int) (size_t) data;
input = xmlReadMemory(doc, strlen(doc), "doc.xml", NULL, 0);
if (input == NULL) {
@@ -205,7 +205,7 @@ main(void)
for (i = 0; i < num_threads; i++) {
ret = pthread_create(&tid[i], NULL, threadRoutine1,
- (void *) (unsigned long) i);
+ (void *) (size_t) i);
if (ret != 0) {
perror("pthread_create");
exit(1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]