diff --git a/modules/juce_core/juce_core.cpp b/modules/juce_core/juce_core.cpp index 8382283f91..eb58eec26a 100644 --- a/modules/juce_core/juce_core.cpp +++ b/modules/juce_core/juce_core.cpp @@ -161,6 +161,7 @@ #include "native/juce_Files_windows.cpp" #endif +#include "zip/juce_zlib.h" #include "network/juce_NamedPipe.cpp" #include "network/juce_Socket.cpp" #include "network/juce_IPAddress.cpp" diff --git a/modules/juce_core/zip/juce_GZIPDecompressorInputStream.cpp b/modules/juce_core/zip/juce_GZIPDecompressorInputStream.cpp index 509295e52d..24d2a2dc14 100644 --- a/modules/juce_core/zip/juce_GZIPDecompressorInputStream.cpp +++ b/modules/juce_core/zip/juce_GZIPDecompressorInputStream.cpp @@ -35,7 +35,7 @@ namespace juce { -JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4309 4305 4365 6385 6326 6340) +JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4127 4244 4309 4305 4365 6385 6326 6340) namespace zlibNamespace { @@ -49,13 +49,26 @@ namespace zlibNamespace "-Wredundant-decls", "-Wimplicit-fallthrough", "-Wzero-as-null-pointer-constant", - "-Wcomma") + "-Wcomma", + "-Wcast-align", + "-Wkeyword-macro", + "-Wmissing-prototypes") + + #pragma push_macro ("register") + #define register + + #pragma push_macro ("MIN") + #undef MIN + + #pragma push_macro ("read") + #pragma push_macro ("write") + #pragma push_macro ("open") + #pragma push_macro ("close") #undef OS_CODE #undef fdopen #define ZLIB_INTERNAL #define NO_DUMMY_DECL - #include "zlib/zlib.h" #include "zlib/adler32.c" #include "zlib/compress.c" #undef DO1 @@ -70,6 +83,7 @@ namespace zlibNamespace #undef NEEDBITS #undef DROPBITS #undef BYTEBITS + #undef GZIP #include "zlib/inflate.c" #include "zlib/inftrees.c" #include "zlib/trees.c" @@ -82,19 +96,26 @@ namespace zlibNamespace #undef Dad #undef Len + #pragma pop_macro ("close") + #pragma pop_macro ("open") + #pragma pop_macro ("write") + #pragma pop_macro ("read") + #pragma pop_macro ("MIN") + #pragma pop_macro ("register") + JUCE_END_IGNORE_WARNINGS_GCC_LIKE #else #include JUCE_ZLIB_INCLUDE_PATH - - #ifndef z_uInt - #ifdef uInt - #define z_uInt uInt - #else - #define z_uInt unsigned int - #endif - #endif - #endif + +#ifndef z_uInt + #ifdef uInt + #define z_uInt uInt + #else + #define z_uInt unsigned int + #endif +#endif + } JUCE_END_IGNORE_WARNINGS_MSVC diff --git a/modules/juce_core/zip/juce_zlib.h b/modules/juce_core/zip/juce_zlib.h new file mode 100644 index 0000000000..8aefb73728 --- /dev/null +++ b/modules/juce_core/zip/juce_zlib.h @@ -0,0 +1,55 @@ +/* + ============================================================================== + + This file is part of the JUCE framework. + Copyright (c) Raw Material Software Limited + + JUCE is an open source framework subject to commercial or open source + licensing. + + By downloading, installing, or using the JUCE framework, or combining the + JUCE framework with any other source code, object code, content or any other + copyrightable work, you agree to the terms of the JUCE End User Licence + Agreement, and all incorporated terms including the JUCE Privacy Policy and + the JUCE Website Terms of Service, as applicable, which will bind you. If you + do not agree to the terms of these agreements, we will not license the JUCE + framework to you, and you must discontinue the installation or download + process and cease use of the JUCE framework. + + JUCE End User Licence Agreement: https://juce.com/legal/juce-8-licence/ + JUCE Privacy Policy: https://juce.com/juce-privacy-policy + JUCE Website Terms of Service: https://juce.com/juce-website-terms-of-service/ + + Or: + + You may also use this code under the terms of the AGPLv3: + https://www.gnu.org/licenses/agpl-3.0.en.html + + THE JUCE FRAMEWORK IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL + WARRANTIES, WHETHER EXPRESSED OR IMPLIED, INCLUDING WARRANTY OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. + + ============================================================================== +*/ + +// The purpose of this internal header, included by juce_core and juce_graphics, +// is to place the zlib symbols in a common namespace with consistent preprocessor +// definitions. + +#pragma once + +namespace juce::zlibNamespace +{ +#define ZLIB_CONST 1 + +#if JUCE_INCLUDE_ZLIB_CODE + + #define HAVE_MEMCPY 1 + + #include "juce_core/zip/zlib/zlib.h" + +#else + #include JUCE_ZLIB_INCLUDE_PATH +#endif + +} // namespace juce::zlibNamespace diff --git a/modules/juce_graphics/image_formats/juce_PNGLoader.cpp b/modules/juce_graphics/image_formats/juce_PNGLoader.cpp index b885a66125..f718533fb6 100644 --- a/modules/juce_graphics/image_formats/juce_PNGLoader.cpp +++ b/modules/juce_graphics/image_formats/juce_PNGLoader.cpp @@ -37,20 +37,6 @@ namespace juce JUCE_BEGIN_IGNORE_WARNINGS_MSVC (4390 4611 4365 4267 4616 2544 2545 6297) -namespace zlibNamespace -{ -#if JUCE_INCLUDE_ZLIB_CODE - #undef OS_CODE - #undef fdopen - #define ZLIB_INTERNAL - #define NO_DUMMY_DECL - #include - #undef OS_CODE -#else - #include JUCE_ZLIB_INCLUDE_PATH -#endif -} - #if ! defined (jmp_buf) || ! defined (longjmp) #include #endif diff --git a/modules/juce_graphics/juce_graphics.cpp b/modules/juce_graphics/juce_graphics.cpp index 37e43a6855..2d06470bb1 100644 --- a/modules/juce_graphics/juce_graphics.cpp +++ b/modules/juce_graphics/juce_graphics.cpp @@ -159,6 +159,8 @@ extern "C" #endif //============================================================================== +#include "juce_core/zip/juce_zlib.h" + #include "fonts/juce_FunctionPointerDestructor.h" #include "native/juce_EventTracing.h"