More MINGW compatibility changes

(cherry picked from commit ec84b475)
7 jobs for master in 65 minutes and 38 seconds (queued for 1 second)
Status Job ID Name Coverage
  Test
passed clang-c++11 #5926
Linux

00:21:17

passed clang-c++98 #5928
Linux

00:17:05

passed cppcheck #5931
Linux

00:00:31

passed gcc-c++11 #5925
Linux

00:04:32

passed gcc-c++98 #5927
Linux

00:04:25

passed macos-c++11 #5929
Apple

00:09:15

passed macos-c++98 #5930
Apple

00:08:30