]> git.tdb.fi Git - libs/core.git/commitdiff
Add a wrapper header for windows.h
authorMikko Rasa <tdb@tdb.fi>
Tue, 3 Jan 2023 14:29:47 +0000 (16:29 +0200)
committerMikko Rasa <tdb@tdb.fi>
Tue, 3 Jan 2023 15:12:05 +0000 (17:12 +0200)
Since Time::min is now defined in the header, it runs afoul of the min()
macro defined in windows.h unless the latter is disabled.

23 files changed:
source/core/windows/main.cpp
source/core/windows/module_platform.h
source/core/windows/mutex.cpp
source/core/windows/mutex_platform.h
source/core/windows/process.cpp
source/core/windows/process_platform.h
source/core/windows/semaphore.cpp
source/core/windows/systemerror.cpp
source/core/windows/thread.cpp
source/core/windows/thread_platform.h
source/core/windows/winapi.h [new file with mode: 0644]
source/fs/windows/dir.cpp
source/fs/windows/stat.cpp
source/fs/windows/stat_platform.h
source/fs/windows/utils.cpp
source/io/windows/eventreader.cpp
source/io/windows/handle_platform.h
source/io/windows/poll_platform.h
source/io/windows/seekable.cpp
source/io/windows/serial_platform.h
source/time/windows/rawtime_platform.h
source/time/windows/timezone.cpp
source/time/windows/utils.cpp

index 11da64b8a3dc61d427e952ba7c897162f945989f..df17020977f83a800d0ca8daace76326bda09023 100644 (file)
@@ -1,4 +1,5 @@
-#include <windows.h>
+#include "winapi.h"
+#include <shellapi.h>
 #include <msp/stringcodec/utf16.h>
 #include <msp/stringcodec/utf8.h>
 #include "application.h"
index 81dfd0fecf292ed0313c42711e54a341e162c7a2..eb0b633a4f8f9e86144da4efbf16ee033c232da6 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef MSP_CORE_MODULE_PLATFORM_H_
 #define MSP_CORE_MODULE_PLATFORM_H_
 
-#include <windows.h>
+#include "winapi.h"
 
 namespace Msp {
 
index e51fda407b8a9beead0b3ce35040697ed7e54bcf..6d3963521249102a08de75316cce25bd2ec7a398 100644 (file)
@@ -1,4 +1,4 @@
-#include <windows.h>
+#include "winapi.h"
 #include "mutex.h"
 #include "mutex_private.h"
 
index fae5e853dc16db8579d5c0f6d2b16556d9e8f79e..1d5c1c0ebe30cf63fd9afb3d11f327af878586c9 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef MSP_CORE_MUTEX_PLATFORM_H_
 #define MSP_CORE_MUTEX_PLATFORM_H_
 
-#include <windows.h>
+#include "winapi.h"
 
 namespace Msp {
 
index e19fd6b8f996fd78109880a2c0f59e9bee90b119..0eae33bdab07eb4169d441ff865ac23aadd28b30 100644 (file)
@@ -1,4 +1,4 @@
-#include <windows.h>
+#include "winapi.h"
 #include <msp/core/systemerror.h>
 #include <msp/io/handle_private.h>
 #include <msp/strings/utils.h>
index 4cb793ad947747090219e4648f075966b3c8ded3..d55678ecb87c6820e20f376ed4ea3a547022310b 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef MSP_CORE_PROCESS_PLATFORM_H_
 #define MSP_CORE_PROCESS_PLATFORM_H_
 
-#include <windows.h>
+#include "winapi.h"
 
 namespace Msp {
 
index c81f815a2ad4bbcb50897f1bb1a327fdd6ef1df5..e45e4b9f70f921c02166a79be99fdc5dd21e05ce 100644 (file)
@@ -1,4 +1,4 @@
-#include <windows.h>
+#include "winapi.h"
 #include <msp/core/systemerror.h>
 #include <msp/time/timedelta.h>
 #include "semaphore.h"
index 93aa7bd5e89fa63fd96c6b303a1ea6b5aa1ce51c..754c90b9c25f13c420210d2c8290b5a99eb69452 100644 (file)
@@ -1,4 +1,4 @@
-#include <windows.h>
+#include "winapi.h"
 #include <msp/strings/lexicalcast.h>
 #include "systemerror.h"
 
index 8890a70fb1cbd0eaff8cf32cdea008950c92e43b..3231896c7a7d7283c01f4d863a6cc9a05175ed08 100644 (file)
@@ -1,4 +1,4 @@
-#include <windows.h>
+#include "winapi.h"
 #include "thread.h"
 #include "thread_private.h"
 
index 50b1a5e4f4c1e331d0ac048a86afb9e7fb135d08..d88bd8bff032248c65a90f431b77bd73b5376321 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef MSP_CORE_THREAD_PLATFORM_H_
 #define MSP_CORE_THREAD_PLATFORM_H_
 
-#include <windows.h>
+#include "winapi.h"
 
 namespace Msp {
 
diff --git a/source/core/windows/winapi.h b/source/core/windows/winapi.h
new file mode 100644 (file)
index 0000000..dca0880
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef MSP_CORE_WINAPI_H_
+#define MSP_CORE_WINAPI_H_
+
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif
+#include <windows.h>
+
+#endif
index fde0200d029708eccd7476911e5d8dd3fa18c285..2ba2f1e110f8e8f3aaf7dcbec38d50f052160578 100644 (file)
@@ -1,4 +1,4 @@
-#include <windows.h>
+#include <msp/core/winapi.h>
 #include <msp/core/mutex.h>
 #include <msp/core/systemerror.h>
 #include <msp/strings/regex.h>
index 8331e6068c5e28606226e0a26e2d456591c9920c..ee794767f7eaded5f9f7071e6434d07d4fc64e7a 100644 (file)
@@ -1,4 +1,4 @@
-#include <windows.h>
+#include <msp/core/winapi.h>
 #include <aclapi.h>
 #include <msp/core/systemerror.h>
 #include <msp/strings/format.h>
index 6440aca8bae7d06bf298493077cebea2f5b7dc26..89961c6794bf598d48079223153aac40acf2eb95 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef MSP_FS_STAT_PLATFORM_H_
 #define MSP_FS_STAT_PLATFORM_H_
 
-#include <windows.h>
+#include <msp/core/winapi.h>
 
 namespace Msp {
 namespace FS {
index f38d1921146686f4f3db2296e9b37b905ca8d2aa..a1c25136908d11a3248084fdce59f794490a5dcf 100644 (file)
@@ -1,4 +1,4 @@
-#include <windows.h>
+#include <msp/core/winapi.h>
 #include <msp/core/except.h>
 #include <msp/core/systemerror.h>
 #include "dir.h"
index 33a095ae5d0f11f7a015eb0b1cf795667db4d1e9..8f208c20dda864c711ad5584697083c3df9b4ade 100644 (file)
@@ -1,4 +1,4 @@
-#include <windows.h>
+#include <msp/core/winapi.h>
 #include <algorithm>
 #include <msp/core/systemerror.h>
 #include "eventreader.h"
index f12e5f74771a044326688b439f9c645d4b0f456a..776e8f3cc328dd940bee7f7cfc0038b36ca0f846 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef MSP_IO_HANDLE_PLATFORM_H_
 #define MSP_IO_HANDLE_PLATFORM_H_
 
-#include <windows.h>
+#include <msp/core/winapi.h>
 
 namespace Msp {
 namespace IO {
index ec778aecf030f6c0abfb97f7787e4d1e5315829c..62a000f5a748bab027f073df389e30a427f67407 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef MSP_IO_POLL_PLATFORM_H_
 #define MSP_IO_POLL_PLATFORM_H_
 
-#include <windows.h>
+#include <msp/core/winapi.h>
 #include <vector>
 #include "poll.h"
 
index c33a798fcf2c6c0eb71b44386b1bc2e43263c578..3756cf1a7d44c937755158167d95ed616ef6712b 100644 (file)
@@ -1,4 +1,4 @@
-#include <windows.h>
+#include <msp/core/winapi.h>
 #include <msp/core/systemerror.h>
 #include "handle.h"
 #include "handle_private.h"
index dd7dd5004920b53e2d9f8ebeb18e9cd7aea98b85..317373605cf0f1d6562e70a71e613d36ef75b374 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef MSP_IO_SERIAL_PLATFORM_H_
 #define MSP_IO_SERIAL_PLATFORM_H_
 
-#include <windows.h>
+#include <msp/core/winapi.h>
 
 namespace Msp {
 namespace IO {
index 60a9a59595c19a92f72218dd54516dc67cd148fb..bd57889d2de63de699b6b30b6ff1d769905e5cf7 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef MSP_TIME_RAWTIME_PLATFORM_H_
 #define MSP_TIME_RAWTIME_PLATFORM_H_
 
-#include <windows.h>
+#include <msp/core/winapi.h>
 #include "rawtime.h"
 
 namespace Msp {
index 570c6791d52e155759c12a2239946c5949b118a3..1b526440167ec03f842cd645fcaec2eedbeb3c0e 100644 (file)
@@ -1,4 +1,4 @@
-#include <windows.h>
+#include <msp/core/winapi.h>
 #include <msp/core/systemerror.h>
 #include "timezone.h"
 
index 2150a105b1b40dcc690f2d4c320fc690ddc66ff9..4d295a91b690ad9877be6181a90f3c86fee82080 100644 (file)
@@ -1,4 +1,4 @@
-#include <windows.h>
+#include <msp/core/winapi.h>
 #include "rawtime_private.h"
 #include "timedelta.h"
 #include "timestamp.h"