Signed-off-by: Thomas Faber thomas.faber@reactos.org
On 2019-01-09 12:33, Thomas Faber wrote:
v2.9.8 adds 'const' to the callback function signatures, which causes warnings such as:
schema.c: In function ‘cache_add_entry’: schema.c:1008:47: error: passing argument 3 of ‘xmlHashRemoveEntry’ from incompatible pointer type [-Werror=incompatible-pointer-types] if (xmlHashRemoveEntry(cache->cache, uri, cache_free)) ^~~~~~~~~~ In file included from /usr/include/libxml2/libxml/parser.h:18, from /usr/include/libxml2/libxml/xmlerror.h:10, from schema.c:29: /usr/include/libxml2/libxml/hash.h:160:47: note: expected ‘xmlHashDeallocator’ {aka ‘void (*)(void *, const unsigned char *)’} but argument is of type ‘void (*)(void *, xmlChar *)’ {aka ‘void (*)(void *, unsigned char *)’} xmlHashDeallocator f); ~~~~~~~~~~~~~~~~~~~^
This isn't the prettiest solution, but I think it's better than casting the function pointers. Happy to take ideas to make it nicer.
dlls/msxml3/schema.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/msxml3/schema.c b/dlls/msxml3/schema.c index 80879852041a..e385b9b56357 100644 --- a/dlls/msxml3/schema.c +++ b/dlls/msxml3/schema.c @@ -52,6 +52,12 @@
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
+#if LIBXML_VERSION >= 20908 +#define XMLHASH_CONST const +#else +#define XMLHASH_CONST +#endif
- /* We use a chained hashtable, which can hold any number of schemas
- TODO: grow/shrink hashtable depending on load factor
- TODO: implement read-only where appropriate
@@ -980,7 +986,7 @@ static cache_entry* cache_entry_from_url(VARIANT url, xmlChar const* nsURI, MSXM return entry; }
-static void cache_free(void* data, xmlChar* name /* ignored */) +static void cache_free(void* data, XMLHASH_CONST xmlChar* name /* ignored */) { cache_entry_release((cache_entry*)data); } @@ -1397,7 +1403,7 @@ static HRESULT WINAPI schema_cache_get_namespaceURI(IXMLDOMSchemaCollection2* if return S_OK; }
-static void cache_copy(void* data, void* dest, xmlChar* name) +static void cache_copy(void* data, void* dest, XMLHASH_CONST xmlChar* name) { schema_cache* This = (schema_cache*) dest; cache_entry* entry = (cache_entry*) data;