Create dummy inttypes.h if it doesn't exist in compatibility mode. #344

This commit is contained in:
Nathan Moinvaziri 2018-11-13 17:55:33 -08:00
parent a93a2ad678
commit 4d4c9db5b0
3 changed files with 17 additions and 2 deletions

View File

@ -282,6 +282,21 @@ if(USE_COMPAT)
string(REPLACE "MZ_COMPAT_FILE" "MZ_COMPAT_UNZIP" UNZIP_COMPAT_HEADER ${UNZIP_COMPAT_HEADER})
file(WRITE "unzip.h" ${UNZIP_COMPAT_HEADER})
list(APPEND MINIZIP_PUBLIC_HEADERS "unzip.h")
include(CheckIncludeFile)
check_include_file(inttypes.h HAVE_INTTYPES_H)
if(NOT HAVE_INTTYPES_H)
set(COMPAT_INTTYPES "\
#define PRId16 \"hd\"
#define PRId32 \"d\"
#define PRIu32 \"u\"
#define PRIx32 \"x\"
#define PRId64 \"lld\"
#define PRIu64 \"llu\"
#define PRIx64 \"llx\"
")
file(WRITE "inttypes.h" ${COMPAT_INTTYPES})
endif()
endif()
# Include PKCRYPT

View File

@ -14,6 +14,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <errno.h>
#include "mz.h"
@ -60,7 +61,6 @@ typedef struct mz_stream_buffered_s {
#if 0
# define mz_stream_buffered_print printf
#else
# include <inttypes.h>
# define mz_stream_buffered_print(fmt,...)
#endif

View File

@ -15,6 +15,7 @@
*/
#include <stdlib.h>
#include <inttypes.h>
#include <windows.h>
@ -70,7 +71,6 @@ typedef struct mz_stream_win32_s
#if 0
# define mz_stream_os_print printf
#else
# include <inttypes.h>
# define mz_stream_os_print(fmt,...)
#endif