ithewei 6 роки тому
батько
коміт
7630f30e96
5 змінених файлів з 13 додано та 7 видалено
  1. 2 2
      base/hlog.c
  2. 1 1
      base/hmutex.h
  3. 6 1
      base/hplatform.h
  4. 2 2
      base/hsysinfo.h
  5. 2 1
      utils/hframe.h

+ 2 - 2
base/hlog.c

@@ -20,12 +20,12 @@ static char     s_logbuf[LOG_BUFSIZE];
 #ifdef _MSC_VER
 static hmutex_t  s_mutex;
 static honce_t   s_once = HONCE_INIT;
-static void __mutex_init() {
+static void WINAPI __mutex_init() {
     hmutex_init(&s_mutex);
 }
 #define HLOG_LOCK\
     honce(&s_once, __mutex_init);\
-    hmutex_lock(%s_mutex);
+    hmutex_lock(&s_mutex);
 
 #else
 static hmutex_t s_mutex = PTHREAD_MUTEX_INITIALIZER;

+ 1 - 1
base/hmutex.h

@@ -12,7 +12,7 @@
 
 #define honce_t             INIT_ONCE
 #define HONCE_INIT          INIT_ONCE_STATIC_INIT
-typedef void (*honce_fn)(void);
+typedef void (WINAPI *honce_fn)();
 static inline BOOL WINAPI s_once_func(INIT_ONCE* once, PVOID arg, PVOID* _) {
     honce_fn fn = (honce_fn)arg;
     fn();

+ 6 - 1
base/hplatform.h

@@ -90,7 +90,9 @@
 
 // header files
 #ifdef OS_WIN
+    #ifndef WIN32_LEAN_AND_MEAN
     #define WIN32_LEAN_AND_MEAN
+    #endif
     #define _CRT_SECURE_NO_WARNINGS
     #define _CRT_NONSTDC_NO_DEPRECATE
     #include <winsock2.h>
@@ -153,7 +155,10 @@ typedef unsigned __int64    uint64_t;
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#ifndef _MSC_VER
+#ifdef _MSC_VER
+#pragma warning (disable: 4100) // unused param
+#pragma warning (disable: 4819) // Unicode
+#else
 #include <pthread.h>
 #endif
 

+ 2 - 2
base/hsysinfo.h

@@ -31,8 +31,8 @@ static inline int get_meminfo(meminfo_t* mem) {
     memset(&memstat, 0, sizeof(memstat));
     memstat.dwLength = sizeof(memstat);
     GlobalMemoryStatusEx(&memstat);
-    mem->total = memstat.ullTotalPhys >> 10;
-    mem->free = memstat.ullAvailPhys >> 10;
+    mem->total = (unsigned long)(memstat.ullTotalPhys >> 10);
+    mem->free = (unsigned long)(memstat.ullAvailPhys >> 10);
     return 0;
 #elif defined(OS_LINUX)
     struct sysinfo info;

+ 2 - 1
utils/hframe.h

@@ -18,7 +18,8 @@ public:
     void* userdata;
 
     HFrame() {
-        w = h = bpp = type = ts = 0;
+        w = h = bpp = type = 0;
+        ts = 0;
         useridx = -1;
         userdata = NULL;
     }