Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Oct 13, 2023
1 parent 6a12b9b commit e449cbc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
/minigzipsh
/zlib.pc
/zconf.h.included
/configure.log

.DS_Store

Expand Down
14 changes: 7 additions & 7 deletions adler32.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

#include "zutil.h"

#define local static

local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2);

#define BASE 65521U /* largest prime smaller than 65536 */
#define NMAX 5552
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
Expand Down Expand Up @@ -66,8 +62,7 @@ local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2);
#endif

/* ========================================================================= */
uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len)
{
uLong ZEXPORT adler32_z(uLong adler, const Bytef *buf, z_size_t len) {
unsigned long sum2;
unsigned n;

Expand Down Expand Up @@ -139,7 +134,12 @@ uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len)
}

/* ========================================================================= */
static uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2) {
uLong ZEXPORT adler32(uLong adler, const Bytef *buf, uInt len) {
return adler32_z(adler, buf, len);
}

/* ========================================================================= */
local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2) {
unsigned long sum1;
unsigned long sum2;
unsigned rem;
Expand Down
2 changes: 1 addition & 1 deletion compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
uLong sourceLen, int level) {
z_stream stream;
int err;
const uInt max = -1;
const uInt max = (uInt)-1;
uLong left;

left = *destLen;
Expand Down
2 changes: 2 additions & 0 deletions examples/gzlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -756,12 +756,14 @@ local int log_recover(struct log *log, int op)
return -2;
}
if ((fd = open(log->path, O_RDONLY, 0)) < 0) {
free(data);
log_log(log, op, ".add file read failure");
return -1;
}
ret = (size_t)read(fd, data, len) != len;
close(fd);
if (ret) {
free(data);
log_log(log, op, ".add file read failure");
return -1;
}
Expand Down
4 changes: 4 additions & 0 deletions gzguts.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
# include <io.h>
#endif

#if defined(_WIN32)
# define WIDECHAR
#endif

#ifdef WINAPI_FAMILY
# define open _open
# define read _read
Expand Down

0 comments on commit e449cbc

Please sign in to comment.