From 5a4684f3b0db4cd5c13f94b1319c245ef96ce91d Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 11 Sep 2014 14:33:46 +0200 Subject: Fix problems with ssize_t and off_t. * configure.ac (AC_SYS_LARGEFILE): New. (AC_CHECK_HEADERS): Check for stdint.h. (AC_CHECK_SIZEOF): Add for int, long and long long. (REPLACEMENT_FOR_OFF_T): New ac_define. * src/mkheader.c (have_stdint_h, have_w32_system, have_w64_system) (replacement_for_off_type, stdint_h_included): New. (xfree, xstrdup): New. (parse_config_h): New. (write_special): Support "define:gpgrt_off_t", "define:gpgrt_ssize_t", "api_ssize_t" tags. (main): Add config.h arg. Call parse_config_h. Fix substitute code. * src/Makefile.am (gpg-error.h): Pass config.h to mkheader. * src/gpg-error.h.in: Include definitions for gpgrt_ssize_t and gpgrt_off_t. Let mkheader insert ssize_t keywords. Chnage all off_t to gpgrt_off_t. * src/estream.c: Change all off_t to gpgrt_off_t. Chnage all ssize_t to gpgrt_ssize_t. * src/visibility.c (gpgrt_fseeko): Use gpgrt_off_t. (gpgrt_ftello): Ditto. (gpgrt_getline): Use gpgrt_ssize_t. (gpgrt_read_line): Ditto. --- src/visibility.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/visibility.c') diff --git a/src/visibility.c b/src/visibility.c index f1bbca6..f0d7fd1 100644 --- a/src/visibility.c +++ b/src/visibility.c @@ -346,7 +346,7 @@ gpgrt_fseek (estream_t stream, long int offset, int whence) } int -gpgrt_fseeko (estream_t stream, off_t offset, int whence) +gpgrt_fseeko (estream_t stream, gpgrt_off_t offset, int whence) { return _gpgrt_fseeko (stream, offset, whence); } @@ -357,7 +357,7 @@ gpgrt_ftell (estream_t stream) return _gpgrt_ftell (stream); } -off_t +gpgrt_off_t gpgrt_ftello (estream_t stream) { return _gpgrt_ftello (stream); @@ -468,14 +468,14 @@ gpgrt_fputs_unlocked (const char *_GPGRT__RESTRICT s, return _gpgrt_fputs_unlocked (s, stream); } -ssize_t +gpgrt_ssize_t gpgrt_getline (char *_GPGRT__RESTRICT *_GPGRT__RESTRICT lineptr, size_t *_GPGRT__RESTRICT n, estream_t _GPGRT__RESTRICT stream) { return _gpgrt_getline (lineptr, n, stream); } -ssize_t +gpgrt_ssize_t gpgrt_read_line (estream_t stream, char **addr_of_buffer, size_t *length_of_buffer, size_t *max_length) -- cgit v1.2.3