[libxml2] Fix a couple of warnings in dict.c and threads.c



commit 6472dfe337f8cc81c68ce903b81d7ec8a321369d
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Mon Oct 9 16:50:57 2017 +0200

    Fix a couple of warnings in dict.c and threads.c
    
    Only visible on Windows.

 dict.c    |    4 ++--
 threads.c |   11 +++++++----
 2 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/dict.c b/dict.c
index bcfc8bd..5590217 100644
--- a/dict.c
+++ b/dict.c
@@ -249,7 +249,7 @@ xmlDictAddString(xmlDictPtr dict, const xmlChar *name, unsigned int namelen) {
 #endif
     pool = dict->strings;
     while (pool != NULL) {
-       if (pool->end - pool->free > namelen)
+       if ((size_t)(pool->end - pool->free) > namelen)
            goto found_pool;
        if (pool->size > size) size = pool->size;
         limit += pool->size;
@@ -317,7 +317,7 @@ xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, unsigned int plen,
 #endif
     pool = dict->strings;
     while (pool != NULL) {
-       if (pool->end - pool->free > namelen + plen + 1)
+       if ((size_t)(pool->end - pool->free) > namelen + plen + 1)
            goto found_pool;
        if (pool->size > size) size = pool->size;
         limit += pool->size;
diff --git a/threads.c b/threads.c
index 8860697..191f134 100644
--- a/threads.c
+++ b/threads.c
@@ -139,7 +139,7 @@ static DWORD globalkey = TLS_OUT_OF_INDEXES;
 static DWORD mainthread;
 static struct {
     DWORD done;
-    DWORD control;
+    LONG control;
 } run_once = { 0, 0};
 static volatile LPCRITICAL_SECTION global_init_lock = NULL;
 
@@ -439,7 +439,8 @@ __xmlGlobalInitMutexLock(void)
 
         /* Swap it into the global_init_lock */
 #ifdef InterlockedCompareExchangePointer
-        InterlockedCompareExchangePointer(&global_init_lock, cs, NULL);
+        InterlockedCompareExchangePointer((void **) &global_init_lock,
+                                          cs, NULL);
 #else /* Use older void* version */
         InterlockedCompareExchange((void **) &global_init_lock,
                                    (void *) cs, NULL);
@@ -981,10 +982,12 @@ xmlOnceInit(void)
 #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || 
defined(LIBXML_STATIC_FOR_DLL))
 #if defined(LIBXML_STATIC_FOR_DLL)
 BOOL XMLCALL
-xmlDllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+xmlDllMain(ATTRIBUTE_UNUSED HINSTANCE hinstDLL, DWORD fdwReason,
+           ATTRIBUTE_UNUSED LPVOID lpvReserved)
 #else
 BOOL WINAPI
-DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
+DllMain(ATTRIBUTE_UNUSED HINSTANCE hinstDLL, DWORD fdwReason,
+        ATTRIBUTE_UNUSED LPVOID lpvReserved)
 #endif
 {
     switch (fdwReason) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]