Avoid the need for ssize_t.

Limit read() and write() requests to sizes that fit in an int.
This allows storing the return value in an int, and avoiding the
need to use or construct an ssize_t type. This is required for
Microsoft C, whose _read and _write functions take an unsigned
request and return an int.
This commit is contained in:
Mark Adler
2016-12-31 10:03:09 -08:00
parent b7fbee2156
commit cca27e95cf
6 changed files with 19 additions and 67 deletions

22
configure vendored
View File

@@ -465,23 +465,8 @@ fi
echo >> configure.log
# check for ssize_t
cat > $test.c <<EOF
#include <sys/types.h>
ssize_t dummy = 0;
EOF
if try $CC -c $CFLAGS $test.c; then
echo "Checking for ssize_t... Yes." | tee -a configure.log
need_ssizet=0
else
echo "Checking for ssize_t... No." | tee -a configure.log
need_ssizet=1
fi
echo >> configure.log
# find the size_t integer type, if needed
if test $need_sizet -eq 1 -o $need_ssizet -eq 1; then
if test $need_sizet -eq 1; then
cat > $test.c <<EOF
long long dummy = 0;
EOF
@@ -521,11 +506,6 @@ if test $need_sizet -eq 1; then
SFLAGS="${SFLAGS} -DNO_SIZE_T=${sizet}"
fi
if test $need_ssizet -eq 1; then
CFLAGS="${CFLAGS} -DNO_SSIZE_T=${sizet}"
SFLAGS="${SFLAGS} -DNO_SSIZE_T=${sizet}"
fi
echo >> configure.log
# check for large file support, and if none, check for fseeko()