Skip to content

Commit

Permalink
Various minor TDM GCC 4.6.1 and MinGW32 compilation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed May 20, 2012
1 parent aba9ad1 commit 2a8a458
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions miniz.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
MINIZ_NO_ARCHIVE_APIS, or to get rid of all stdio usage define MINIZ_NO_STDIO (see the list below for more macros).
* Change History
5/20/12 v1.14 - MinGW32/64 GCC 4.6.1 compiler fixes: added MZ_FORCEINLINE, #include <time.h> (thanks fermtect).
5/19/12 v1.13 - From [email protected] and [email protected] - Fix mz_crc32() so it doesn't compute the wrong CRC-32's when mz_ulong is 64-bit.
Temporarily/locally slammed in "typedef unsigned long mz_ulong" and re-ran a randomized regression test on ~500k files.
Eliminated a bunch of warnings when compiling with GCC 32-bit/64.
Expand Down Expand Up @@ -135,6 +136,10 @@

#include <stdlib.h>

#if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_ARCHIVE_APIS)
#include <time.h>
#endif

// Defines to completely disable specific portions of miniz.c:
// If all macros here are defined the only functionality remaining will be CRC-32, adler-32, tinfl, and tdefl.

Expand Down Expand Up @@ -214,11 +219,11 @@ enum { MZ_DEFAULT_STRATEGY = 0, MZ_FILTERED = 1, MZ_HUFFMAN_ONLY = 2, MZ_RLE = 3

#ifndef MINIZ_NO_ZLIB_APIS

#define MZ_VERSION "9.1.13"
#define MZ_VERNUM 0x91D0
#define MZ_VERSION "9.1.14"
#define MZ_VERNUM 0x91E0
#define MZ_VER_MAJOR 9
#define MZ_VER_MINOR 1
#define MZ_VER_REVISION 13
#define MZ_VER_REVISION 14
#define MZ_VER_SUBREVISION 0

// Flush values. For typical usage you only need MZ_NO_FLUSH and MZ_FINISH. The other values are for advanced use (refer to the zlib docs).
Expand Down Expand Up @@ -2793,7 +2798,7 @@ void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h,
#else
#include <stdio.h>
#include <sys/stat.h>
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
#if defined(_MSC_VER) || defined(__MINGW64__)
#include <sys/utime.h>
#define MZ_FILE FILE
#define MZ_FOPEN fopen
Expand All @@ -2807,6 +2812,20 @@ void *tdefl_write_image_to_png_file_in_memory(const void *pImage, int w, int h,
#define MZ_FFLUSH fflush
#define MZ_FREOPEN freopen
#define MZ_DELETE_FILE remove
#elif defined(__MINGW32__)
#include <sys/utime.h>
#define MZ_FILE FILE
#define MZ_FOPEN fopen
#define MZ_FCLOSE fclose
#define MZ_FREAD fread
#define MZ_FWRITE fwrite
#define MZ_FTELL64 ftello64
#define MZ_FSEEK64 fseeko64
#define MZ_FILE_STAT_STRUCT _stat
#define MZ_FILE_STAT _stat
#define MZ_FFLUSH fflush
#define MZ_FREOPEN freopen
#define MZ_DELETE_FILE remove
#else
#include <utime.h>
#define MZ_FILE FILE
Expand Down

0 comments on commit 2a8a458

Please sign in to comment.