]> git.pld-linux.org Git - packages/crossmingw32-jasper.git/blame - jasper-mingw32.patch
- set CMAKE_CROSSCOMPILING
[packages/crossmingw32-jasper.git] / jasper-mingw32.patch
CommitLineData
8cf7fbcf
JB
1Current mingw32 doesn't provide <sysinfoapi.h>, so use older API.
2--- jasper-3.0.6/src/libjasper/base/jas_malloc.c.orig 2023-03-13 13:16:49.488682893 +0100
3+++ jasper-3.0.6/src/libjasper/base/jas_malloc.c 2023-03-13 18:13:28.802255734 +0100
4@@ -94,7 +94,6 @@
5 # include <unistd.h>
6 #elif defined(_WIN32)
7 # include <windows.h>
8-# include <sysinfoapi.h>
9 #endif
10
11 /******************************************************************************\
12@@ -649,15 +648,14 @@ size_t jas_get_total_mem_size()
13 long page_size = sysconf(_SC_PAGE_SIZE);
14 return pages * page_size;
15 #elif defined(_WIN32)
16- /*
17- Reference:
18- https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getphysicallyinstalledsystemmemory
19- */
20- ULONGLONG size;
21- if (!GetPhysicallyInstalledSystemMemory(&size)) {
22+ MEMORYSTATUSEX memStatusEx = {0};
23+ memStatusEx.dwLength = sizeof(MEMORYSTATUSEX);
24+ BOOL bRet = GlobalMemoryStatusEx(&memStatusEx);
25+ return memStatusEx.ullTotalPhys;
26+ if (!GlobalMemoryStatusEx(&memStatusEx)) {
27 return 0;
28 }
29- return 1024 * size;
30+ return memStatusEx.ullTotalPhys;
31 #else
32 return 0;
33 #endif
This page took 0.099666 seconds and 4 git commands to generate.