Added conditional macro definition to prevent MSVC compiler warning C5105 when compiling for Windows in straight C mode
Details:
Since version 3.0.0 miniz_zip.c includes windows.h header file when compiling for Windows using MSVC. However, when compiling miniz_zip.c using MSVC17 in straight-C mode (no C++), this inclusion causes warning C5105:
winbase.h(9531,5): warning C5105: macro expansion producing 'defined' has undefined behavior
This warning is not produced when compiling in C++ mode (by either forcing the compiler to treat all source input as C++ or by renaming the file into miniz_zip.cpp).
In order to prevent the warning, any straight-C code that wants to include windows.h should make an additional define before including:
This simple change eliminates the warning in straight-C mode and still compiles fine in C++ mode without loss of additional functionality that winbase.h affords in C++ mode. Also tested and proven to work on amalgamated version.
Summary:
Added conditional macro definition to prevent MSVC compiler warning C5105 when compiling for Windows in straight C mode
Details:
Since version 3.0.0 miniz_zip.c includes windows.h header file when compiling for Windows using MSVC. However, when compiling miniz_zip.c using MSVC17 in straight-C mode (no C++), this inclusion causes warning C5105:
This warning is not produced when compiling in C++ mode (by either forcing the compiler to treat all source input as C++ or by renaming the file into miniz_zip.cpp).
In order to prevent the warning, any straight-C code that wants to include windows.h should make an additional define before including:
This simple change eliminates the warning in straight-C mode and still compiles fine in C++ mode without loss of additional functionality that winbase.h affords in C++ mode. Also tested and proven to work on amalgamated version.