Skip to content

Commit

Permalink
[win10] update libxml2 uwp patch
Browse files Browse the repository at this point in the history
  • Loading branch information
afedchin committed May 3, 2018
1 parent da6f0f8 commit ee409be
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions depends/windowsstore/libxml2/02-fix-uwp-api.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 913da3e..07cbec1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -147,7 +147,12 @@ target_include_directories(
target_compile_definitions(libxml2
PRIVATE
_CRT_SECURE_NO_WARNINGS
- _CRT_STDC_NO_DEPRECATE)
+ _CRT_SECURE_NO_DEPRECATE
+ _CRT_STDC_NO_DEPRECATE
+ _CRT_NONSTDC_NO_DEPRECATE
+ HAVE_WIN32_THREADS
+ _WINSOCK_DEPRECATED_NO_WARNINGS
+)

if(BUILD_SHARED_LIBS AND MSVC)
target_link_libraries(libxml2 PRIVATE ws2_32.lib)
diff --git a/catalog.c b/catalog.c
index 6dfdfbb..a5655f0 100644
--- a/catalog.c
Expand Down Expand Up @@ -107,19 +125,15 @@ index 1a79c09..9d8bd15 100644
xmlWrapStat = xmlWrapStatUtf8;
xmlWrapOpen = xmlWrapOpenUtf8;
#ifdef HAVE_ZLIB_H
@@ -3841,10 +3849,12 @@ xmlParserGetDirectory(const char *filename) {
@@ -3841,7 +3849,7 @@ xmlParserGetDirectory(const char *filename) {
else *cur = 0;
ret = xmlMemStrdup(dir);
} else {
+#if defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP
if (getcwd(dir, 1024) != NULL) {
dir[1023] = 0;
ret = xmlMemStrdup(dir);
}
+#endif
}
return(ret);
#undef IS_XMLPGD_SEP
- if (getcwd(dir, 1024) != NULL) {
+ if (_getcwd(dir, 1024) != NULL) {
dir[1023] = 0;
ret = xmlMemStrdup(dir);
}
diff --git a/xmlmemory.c b/xmlmemory.c
index f08c8c3..8b9c35e 100644
--- a/xmlmemory.c
Expand All @@ -139,15 +153,18 @@ diff --git a/xmlmodule.c b/xmlmodule.c
index 50ed666..be21bcc 100644
--- a/xmlmodule.c
+++ b/xmlmodule.c
@@ -308,7 +308,11 @@ xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
@@ -308,7 +308,14 @@ xmlModulePlatformSymbol(void *handle, const char *name, void **symbol)
static void *
xmlModulePlatformOpen(const char *name)
{
- return LoadLibraryA(name);
+#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
+ return LoadLibraryA(name);
+#else
+ return LoadPackagedLibrary(name, 0);
+ wchar_t* nameW = (wchar_t*)malloc(strlen(name)+1);
+ mbstowcs(nameW, name, strlen(name));
+ return LoadPackagedLibrary(nameW, 0);
+ free(nameW);
+#endif
}

Expand Down

0 comments on commit ee409be

Please sign in to comment.