diff --git a/msvc/config.h b/msvc/config.h index c476c07..c3ff561 100644 --- a/msvc/config.h +++ b/msvc/config.h @@ -35,7 +35,7 @@ typedef unsigned short uint16_t; typedef signed char int8_t; typedef unsigned char uint8_t; -typedef unsigned long int uintptr_t; +#include /* Has uintptr_t etc. */ typedef int pid_t; #define inline /* undefined */ diff --git a/src/fuzz.c b/src/fuzz.c index acd4ebf..3a48386 100644 --- a/src/fuzz.c +++ b/src/fuzz.c @@ -115,7 +115,8 @@ void _zz_fuzz(int fd, volatile uint8_t *buf, int64_t len) int64_t pos = _zz_getpos(fd); struct fuzz *fuzz; volatile uint8_t *aligned_buf; - int i, j, todo; + int64_t i, j; + int todo; #if 0 debug("fuzz(%i, %lli@%lli)", fd, (long long int)len, @@ -132,7 +133,7 @@ void _zz_fuzz(int fd, volatile uint8_t *buf, int64_t len) /* Cache bitmask array */ if(fuzz->cur != (int)i) { - uint32_t chunkseed = (i + (int)(fuzz->ratio * MAGIC1)) ^ MAGIC2; + uint32_t chunkseed = ((int)i + (int)(fuzz->ratio * MAGIC1)) ^ MAGIC2; _zz_srand(fuzz->seed ^ chunkseed); memset(fuzz->data, 0, CHUNKBYTES); @@ -246,8 +247,8 @@ static void readchars(int *table, char const *list) && tmp[1] && strchr(hex, tmp[1]) && tmp[2] && strchr(hex, tmp[2])) { - new = ((strchr(hex, tmp[1]) - hex) & 0xf) << 4; - new |= (strchr(hex, tmp[2]) - hex) & 0xf; + new = ((int)(strchr(hex, tmp[1]) - hex) & 0xf) << 4; + new |= (int)(strchr(hex, tmp[2]) - hex) & 0xf; tmp += 2; } else diff --git a/src/libzzuf.h b/src/libzzuf.h index 53072d9..3824cf7 100644 --- a/src/libzzuf.h +++ b/src/libzzuf.h @@ -34,7 +34,7 @@ struct fuzz { uint32_t seed; double ratio; - int cur; + int64_t cur; #ifdef HAVE_FGETLN char *tmp; #endif diff --git a/src/mygetopt.c b/src/mygetopt.c index ed9f696..90408f1 100644 --- a/src/mygetopt.c +++ b/src/mygetopt.c @@ -86,7 +86,7 @@ int mygetopt(int argc, char * const _argv[], const char *optstring, for(i = 0; longopts[i].name; i++) { - int l = strlen(longopts[i].name); + size_t l = strlen(longopts[i].name); if(strncmp(flag + 2, longopts[i].name, l)) continue; diff --git a/src/zzuf.c b/src/zzuf.c index 1d3a3f2..59dc522 100644 --- a/src/zzuf.c +++ b/src/zzuf.c @@ -428,7 +428,7 @@ static void loop_stdin(struct opts *opts) _zz_md5_add(ctx, buf, ret); else while(ret) { - if((nw = write(1, buf + off, (size_t)ret)) < 0) + if((nw = write(1, buf + off, (unsigned int)ret)) < 0) break; ret -= nw; off += nw; @@ -1032,8 +1032,8 @@ static void *get_entry(char const *name) return NULL; } - return (char *)nt->OptionalHeader.ImageBase + - nt->OptionalHeader.AddressOfEntryPoint; + return (void *)(uintptr_t)(nt->OptionalHeader.ImageBase + + nt->OptionalHeader.AddressOfEntryPoint); } #endif