Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mac and compatibility fixes #6

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ case "$cc" in
esac
case `$cc -v 2>&1` in
*gcc*) gcc=1 ;;
*clang*) gcc=1 ;;
esac

show $cc -c $test.c
Expand Down
13 changes: 13 additions & 0 deletions contrib/amd64/crc32-pclmul_asm.S
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
* - prepend '$' to some immediate operands to make assembler happy.
*/

#if !defined(__APPLE__)

#define ENTRY(name) \
.globl name; \
.hidden name; \
Expand All @@ -53,6 +55,17 @@ name:
#define ENDPROC(name) \
.size name, .-name

#else // __APPLE__

#define ENTRY(name) \
.globl _ ## name; \
.private_extern _ ## name; \
_ ## name:

#define ENDPROC(name) /**/

#endif

.align 16
/*
* [x4*128+32 mod P(x) << 32)]' << 1 = 0x154442bd4
Expand Down
4 changes: 2 additions & 2 deletions deflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,9 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
* upper bound of about 14% expansion does not seem onerous for output buffer
* allocation.
*/
uint64_t ZEXPORT deflateBound(strm, sourceLen)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would really rather keep the uintN_t instead.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not used/required in the updated PR#11.

uLong ZEXPORT deflateBound(strm, sourceLen)
z_streamp strm;
uint64_t sourceLen;
uLong sourceLen;
{
deflate_state *s;
uint64_t complen, wraplen;
Expand Down
4 changes: 2 additions & 2 deletions test/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ void test_large_inflate(compr, comprLen, uncompr, uncomprLen)
CHECK_ERR(err, "inflateEnd");

if (d_stream.total_out != 2*uncomprLen + comprLen/2) {
fprintf(stderr, "bad large inflate: %lld\n", d_stream.total_out);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want to support gcc and clang have to use PRId64 from inttypes.h.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be happy with:

#include <stdint.h>
#include <inttypes.h>
...
fprintf(stderr, "bad large inflate: %10" PRId64 "\n", d_stream.total_out);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer simply % instead %10

fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out);
exit(1);
} else {
printf("large_inflate(): OK\n");
Expand Down Expand Up @@ -559,7 +559,7 @@ int main(argc, argv)
fprintf(stderr, "warning: different zlib version\n");
}

printf("zlib version %s = 0x%04x, compile flags = 0x%llx\n",
printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n",
ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags());

compr = (Byte*)calloc((uInt)comprLen, 1);
Expand Down
10 changes: 5 additions & 5 deletions zconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,10 @@
#endif

#if !defined(__MACTYPES__)
typedef uint8_t Byte; /* 8 bits */
typedef unsigned char Byte; /* 8 bits */
#endif
typedef uint32_t uInt; /* 32 bits */
typedef uint64_t uLong; /* 64 bits */
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */

#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
Expand Down Expand Up @@ -408,11 +408,11 @@ typedef uLong FAR uLongf;
typedef unsigned long z_crc_t;
#endif

#if 1 /* was set to #if 1 by ./configure */
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_UNISTD_H
#endif

#if 1 /* was set to #if 1 by ./configure */
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
# define Z_HAVE_STDARG_H
#endif

Expand Down
6 changes: 3 additions & 3 deletions zconf.h.cmakein
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,10 @@
#endif

#if !defined(__MACTYPES__)
typedef uint8_t Byte; /* 8 bits */
typedef unsigned char Byte; /* 8 bits */
#endif
typedef uint32_t uInt;
typedef uint64_t uLong;
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */

#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
Expand Down
6 changes: 3 additions & 3 deletions zconf.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,10 @@
#endif

#if !defined(__MACTYPES__)
typedef uint8_t Byte; /* 8 bits */
typedef unsigned char Byte; /* 8 bits */
#endif
typedef uint32_t uInt; /* 32 bits */
typedef uint64_t uLong; /* 64 bits */
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */

#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
Expand Down