* Fixed a few 64-bit issues reported by MSVC.
* More Win32 portability fixes.
This commit is contained in:
parent
9ceac7d6b3
commit
16d1d7fa48
166
configure.ac
166
configure.ac
@ -1,83 +1,83 @@
|
||||
# $Id: configure.ac 98 2006-09-22 16:27:37Z sam $
|
||||
|
||||
AC_INIT(zzuf, 0.7)
|
||||
|
||||
AC_PREREQ(2.50)
|
||||
AC_CONFIG_SRCDIR(src/zzuf.c)
|
||||
AC_CONFIG_AUX_DIR(autotools)
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
AM_INIT_AUTOMAKE(zzuf, 0.7)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_CPP
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
case "${host_os}" in
|
||||
*mingw32*)
|
||||
DLL_LDFLAGS="-Wl,-l,imagehlp" # Trick libtool here
|
||||
WINSOCK2_LIBS="-lws2_32"
|
||||
ac_cv_func_recv=yes
|
||||
ac_cv_func_recvfrom=yes
|
||||
ac_cv_func_socket=yes
|
||||
ac_cv_func_accept=yes
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(WINSOCK2_LIBS)
|
||||
AC_SUBST(DLL_LDFLAGS)
|
||||
|
||||
AC_CHECK_HEADERS(windows.h winsock2.h io.h unistd.h inttypes.h stdint.h getopt.h libc.h malloc.h dlfcn.h regex.h sys/socket.h sys/uio.h aio.h sys/mman.h sys/wait.h sys/resource.h sys/time.h)
|
||||
|
||||
AC_CHECK_FUNCS(setenv waitpid setrlimit gettimeofday fork kill pipe _pipe)
|
||||
AC_CHECK_FUNCS(open64 lseek64 mmap64 fopen64 fseeko _IO_getc getline getdelim __getdelim fgetln __srefill map_fd memalign posix_memalign aio_read accept socket readv pread recv recvfrom recvmsg mmap valloc sigaction)
|
||||
|
||||
AC_CHECK_TYPES(sighandler_t, [], [],
|
||||
[#define _GNU_SOURCE
|
||||
#include <signal.h>])
|
||||
AC_CHECK_TYPES(sig_t, [], [],
|
||||
[#include <signal.h>])
|
||||
AC_CHECK_TYPES(socklen_t, [], [],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>])
|
||||
|
||||
AC_MSG_CHECKING(for read() prototype)
|
||||
AC_TRY_COMPILE([#include <unistd.h>],
|
||||
[ssize_t read(int fd, void *buf, size_t count);],
|
||||
[AC_MSG_RESULT(ssize_t read(... size_t);)
|
||||
AC_DEFINE(READ_USES_SSIZE_T, 1, [Define to 1 if read() uses ssize_t.])],
|
||||
[AC_MSG_RESULT(int read(... unsigned int);)])
|
||||
|
||||
AC_MSG_CHECKING(for recv() return value)
|
||||
ac_v_recv_t="int"
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/socket.h>],
|
||||
[ssize_t recv(int s, void *buf, size_t len, int flags);],
|
||||
[ac_v_recv_t="ssize_t"])
|
||||
AC_MSG_RESULT($ac_v_recv_t)
|
||||
AC_DEFINE_UNQUOTED(RECV_T, $ac_v_recv_t, [Define to the recv() return type])
|
||||
|
||||
AC_CHECK_FUNCS(getopt_long,
|
||||
[AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)],
|
||||
[AC_CHECK_LIB(gnugetopt, getopt_long,
|
||||
[AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)
|
||||
GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
|
||||
AC_SUBST(GETOPT_LIBS)
|
||||
|
||||
AC_CHECK_LIB(m, log, [MATH_LIBS="-lm"])
|
||||
AC_SUBST(MATH_LIBS)
|
||||
AC_CHECK_LIB(dl, dlopen, [DL_LIBS="-ldl"])
|
||||
AC_SUBST(DL_LIBS)
|
||||
|
||||
# Optimizations
|
||||
CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
|
||||
# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
|
||||
CFLAGS="${CFLAGS} -Wall -W -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
src/Makefile
|
||||
doc/Makefile
|
||||
test/Makefile
|
||||
])
|
||||
|
||||
# $Id: configure.ac 98 2006-09-22 16:27:37Z sam $
|
||||
|
||||
AC_INIT(zzuf, 0.7)
|
||||
|
||||
AC_PREREQ(2.50)
|
||||
AC_CONFIG_SRCDIR(src/zzuf.c)
|
||||
AC_CONFIG_AUX_DIR(autotools)
|
||||
AC_CANONICAL_SYSTEM
|
||||
|
||||
AM_INIT_AUTOMAKE(zzuf, 0.7)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_CPP
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
case "${host_os}" in
|
||||
*mingw32*)
|
||||
DLL_LDFLAGS="-Wl,-l,imagehlp" # Trick libtool here
|
||||
WINSOCK2_LIBS="-lws2_32"
|
||||
ac_cv_func_recv=yes
|
||||
ac_cv_func_recvfrom=yes
|
||||
ac_cv_func_socket=yes
|
||||
ac_cv_func_accept=yes
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(WINSOCK2_LIBS)
|
||||
AC_SUBST(DLL_LDFLAGS)
|
||||
|
||||
AC_CHECK_HEADERS(windows.h winsock2.h io.h process.h unistd.h inttypes.h stdint.h getopt.h libc.h malloc.h dlfcn.h regex.h sys/socket.h sys/uio.h aio.h sys/mman.h sys/wait.h sys/resource.h sys/time.h)
|
||||
|
||||
AC_CHECK_FUNCS(setenv waitpid setrlimit gettimeofday fork kill pipe _pipe)
|
||||
AC_CHECK_FUNCS(open64 lseek64 mmap64 fopen64 fseeko _IO_getc getline getdelim __getdelim fgetln __srefill map_fd memalign posix_memalign aio_read accept socket readv pread recv recvfrom recvmsg mmap valloc sigaction)
|
||||
|
||||
AC_CHECK_TYPES(sighandler_t, [], [],
|
||||
[#define _GNU_SOURCE
|
||||
#include <signal.h>])
|
||||
AC_CHECK_TYPES(sig_t, [], [],
|
||||
[#include <signal.h>])
|
||||
AC_CHECK_TYPES(socklen_t, [], [],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>])
|
||||
|
||||
AC_MSG_CHECKING(for read() prototype)
|
||||
AC_TRY_COMPILE([#include <unistd.h>],
|
||||
[ssize_t read(int fd, void *buf, size_t count);],
|
||||
[AC_MSG_RESULT(ssize_t read(... size_t);)
|
||||
AC_DEFINE(READ_USES_SSIZE_T, 1, [Define to 1 if read() uses ssize_t.])],
|
||||
[AC_MSG_RESULT(int read(... unsigned int);)])
|
||||
|
||||
AC_MSG_CHECKING(for recv() return value)
|
||||
ac_v_recv_t="int"
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <sys/socket.h>],
|
||||
[ssize_t recv(int s, void *buf, size_t len, int flags);],
|
||||
[ac_v_recv_t="ssize_t"])
|
||||
AC_MSG_RESULT($ac_v_recv_t)
|
||||
AC_DEFINE_UNQUOTED(RECV_T, $ac_v_recv_t, [Define to the recv() return type])
|
||||
|
||||
AC_CHECK_FUNCS(getopt_long,
|
||||
[AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)],
|
||||
[AC_CHECK_LIB(gnugetopt, getopt_long,
|
||||
[AC_DEFINE(HAVE_GETOPT_LONG, 1, Define to 1 if you have the `getopt_long' function.)
|
||||
GETOPT_LIBS="${GETOPT_LIBS} -lgnugetopt"])])
|
||||
AC_SUBST(GETOPT_LIBS)
|
||||
|
||||
AC_CHECK_LIB(m, log, [MATH_LIBS="-lm"])
|
||||
AC_SUBST(MATH_LIBS)
|
||||
AC_CHECK_LIB(dl, dlopen, [DL_LIBS="-ldl"])
|
||||
AC_SUBST(DL_LIBS)
|
||||
|
||||
# Optimizations
|
||||
CFLAGS="${CFLAGS} -g -O2 -fno-strength-reduce -fomit-frame-pointer"
|
||||
# Code qui fait des warnings == code de porc == deux baffes dans ta gueule
|
||||
CFLAGS="${CFLAGS} -Wall -W -Wpointer-arith -Wcast-align -Wcast-qual -Wstrict-prototypes -Wshadow -Waggregate-return -Wmissing-prototypes -Wnested-externs -Wsign-compare"
|
||||
|
||||
AC_OUTPUT([
|
||||
Makefile
|
||||
src/Makefile
|
||||
doc/Makefile
|
||||
test/Makefile
|
||||
])
|
||||
|
||||
|
||||
@ -21,6 +21,9 @@
|
||||
#define HAVE_WINDOWS_H 1
|
||||
#define HAVE_WINSOCK2_H 1
|
||||
#define HAVE_IO_H 1
|
||||
#define HAVE_PROCESS_H 1
|
||||
|
||||
#define HAVE__PIPE
|
||||
|
||||
/* Win32-specific, of course. */
|
||||
typedef signed long long int int64_t;
|
||||
@ -33,7 +36,6 @@ typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
|
||||
typedef unsigned long int uintptr_t;
|
||||
typedef long int intptr_t;
|
||||
typedef int pid_t;
|
||||
|
||||
#define inline /* undefined */
|
||||
|
||||
@ -30,6 +30,9 @@
|
||||
#if defined HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#if defined HAVE_IO_H
|
||||
# include <io.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
8
src/fd.c
8
src/fd.c
@ -50,7 +50,7 @@ static int has_include = 0, has_exclude = 0;
|
||||
static struct files
|
||||
{
|
||||
int managed, locked;
|
||||
uint64_t pos;
|
||||
int64_t pos;
|
||||
/* Public stuff */
|
||||
struct fuzz fuzz;
|
||||
}
|
||||
@ -311,7 +311,7 @@ int _zz_islocked(int fd)
|
||||
return files[fds[fd]].locked;
|
||||
}
|
||||
|
||||
long int _zz_getpos(int fd)
|
||||
int64_t _zz_getpos(int fd)
|
||||
{
|
||||
if(fd < 0 || fd >= maxfd || fds[fd] == -1)
|
||||
return 0;
|
||||
@ -319,7 +319,7 @@ long int _zz_getpos(int fd)
|
||||
return files[fds[fd]].pos;
|
||||
}
|
||||
|
||||
void _zz_setpos(int fd, long int pos)
|
||||
void _zz_setpos(int fd, int64_t pos)
|
||||
{
|
||||
if(fd < 0 || fd >= maxfd || fds[fd] == -1)
|
||||
return;
|
||||
@ -327,7 +327,7 @@ void _zz_setpos(int fd, long int pos)
|
||||
files[fds[fd]].pos = pos;
|
||||
}
|
||||
|
||||
void _zz_addpos(int fd, long int off)
|
||||
void _zz_addpos(int fd, int64_t off)
|
||||
{
|
||||
if(fd < 0 || fd >= maxfd || fds[fd] == -1)
|
||||
return;
|
||||
|
||||
6
src/fd.h
6
src/fd.h
@ -32,8 +32,8 @@ extern void _zz_unregister(int);
|
||||
extern void _zz_lock(int);
|
||||
extern void _zz_unlock(int);
|
||||
extern int _zz_islocked(int);
|
||||
extern long int _zz_getpos(int);
|
||||
extern void _zz_setpos(int, long int);
|
||||
extern void _zz_addpos(int, long int);
|
||||
extern int64_t _zz_getpos(int);
|
||||
extern void _zz_setpos(int, int64_t);
|
||||
extern void _zz_addpos(int, int64_t);
|
||||
extern struct fuzz *_zz_getfuzz(int);
|
||||
|
||||
|
||||
12
src/fuzz.c
12
src/fuzz.c
@ -111,15 +111,15 @@ void _zz_refuse(char const *list)
|
||||
|
||||
void _zz_fuzz(int fd, volatile uint8_t *buf, uint64_t len)
|
||||
{
|
||||
uint64_t start, stop;
|
||||
int64_t start, stop;
|
||||
int64_t pos = _zz_getpos(fd);
|
||||
struct fuzz *fuzz;
|
||||
volatile uint8_t *aligned_buf;
|
||||
unsigned long int pos = _zz_getpos(fd);
|
||||
unsigned int i, j, todo;
|
||||
int i, j, todo;
|
||||
|
||||
#if 0
|
||||
debug("fuzz(%i, %lli@%li)", fd, (unsigned long long int)len,
|
||||
(unsigned long int)pos);
|
||||
debug("fuzz(%i, %lli@%lli)", fd, (long long int)len,
|
||||
(long long int)pos);
|
||||
#endif
|
||||
|
||||
aligned_buf = buf - pos;
|
||||
@ -159,7 +159,7 @@ void _zz_fuzz(int fd, volatile uint8_t *buf, uint64_t len)
|
||||
|
||||
for(j = start; j < stop; j++)
|
||||
{
|
||||
unsigned int *r;
|
||||
int *r;
|
||||
uint8_t byte, fuzzbyte;
|
||||
|
||||
if(!ranges)
|
||||
|
||||
@ -100,7 +100,7 @@ static kern_return_t (*ORIG(map_fd)) (int fd, vm_offset_t offset,
|
||||
* calls calloc(), so we need to do something about it */
|
||||
#define DUMMY_BYTES 655360 /* 640 kB ought to be enough for anybody */
|
||||
static uint64_t dummy_buffer[DUMMY_BYTES / 8];
|
||||
static int dummy_offset = 0;
|
||||
static int64_t dummy_offset = 0;
|
||||
#define DUMMY_START ((uintptr_t)dummy_buffer)
|
||||
#define DUMMY_STOP ((uintptr_t)dummy_buffer + DUMMY_BYTES)
|
||||
|
||||
|
||||
@ -223,10 +223,10 @@ void NEW(rewind)(FILE *stream)
|
||||
|
||||
size_t NEW(fread)(void *ptr, size_t size, size_t nmemb, FILE *stream)
|
||||
{
|
||||
long int pos;
|
||||
int64_t pos;
|
||||
#if defined HAVE___SREFILL /* Don't fuzz or seek if we have __srefill() */
|
||||
#else
|
||||
long int newpos;
|
||||
int64_t newpos;
|
||||
#endif
|
||||
size_t ret;
|
||||
int fd;
|
||||
|
||||
@ -27,6 +27,9 @@
|
||||
#if defined HAVE_WINDOWS_H
|
||||
# include <windows.h>
|
||||
#endif
|
||||
#if defined HAVE_PROCESS_H
|
||||
# include <process.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#if defined HAVE_UNISTD_H
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user