Make definition of off_t robust against misbehaving w32 toolchains.

* configure.ac (NEED__FILE_OFFSET_BITS): Change to define gpgme_off_t
and gpgme_ssize_t.
(API__OFF_T, API__SSIZE_T): New ac_subst.
* src/gpgme.h.in: Replace all ssize_t and off_t by ac_subst macros.
* src/assuan-support.c, src/ath-pthread.c, src/ath.c, src/ath.h
* src/data-compat.c, src/data-fd.c, src/data-mem.c, src/data-stream.c
* src/data-user.c, src/data.c, src/data.h, src/engine-gpgsm.c
* src/engine-uiserver.c, src/gpgme-tool.c, src/gpgme.c: Replace off_t
by gpgme_off_t and sszie_t by gpgme_ssize_t.
* src/ath-pthread.c, src/ath.h: Include gpgme.h.
--

For a detailed description, see the gpgme.texi diff.
This commit is contained in:
Werner Koch 2013-04-25 12:00:16 +01:00
parent 9e7df9aa6d
commit 6d0d8e7ba0
19 changed files with 152 additions and 98 deletions

5
NEWS
View File

@ -1,6 +1,11 @@
Noteworthy changes in version 1.4.2 (unreleased)
------------------------------------------------
* Interface changes relative to the 1.4.1 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gpgme_off_t NEW.
gpgme_size_t NEW.
Noteworthy changes in version 1.4.1 (2013-05-01)
------------------------------------------------

View File

@ -282,25 +282,31 @@ AC_SUBST(NEED__FILE_OFFSET_BITS)
# Figure out platform dependent typedefs for gpgme.h
if test "$have_w32_system" = yes; then
if test "$have_w64_system" = yes; then
INSERT__TYPEDEFS_FOR_GPGME_H="/* Typedefs for the 64 bit W32 API. */
#include <basetsd.h>
typedef long off_t;
typedef __int64 ssize_t;"
else
INSERT__TYPEDEFS_FOR_GPGME_H="/* Typedefs for the 32 bit W32 API. */
#ifndef _OFF_T_DEFINED /* Defined by newer mingw32 toolkits. */
typedef long off_t;
#endif
#ifndef _SSIZE_T_DEFINED /* Defined by newer mingw32 toolkits. */
typedef long ssize_t;
#endif"
fi
INSERT__TYPEDEFS_FOR_GPGME_H="
#ifdef _WIN64
# include <stdint.h>
typedef int64_t gpgme_off_t;
typedef int64_t gpgme_ssize_t;
#else /* _WIN32 */
typedef long gpgme_off_t;
typedef long gpgme_ssize_t;
#endif /* _WIN32 */"
API__OFF_T="gpgme_off_t"
API__SSIZE_T="gpgme_ssize_t"
else
INSERT__TYPEDEFS_FOR_GPGME_H="#include <sys/types.h>"
INSERT__TYPEDEFS_FOR_GPGME_H="
#include <sys/types.h>
typedef off_t gpgme_off_t;
typedef ssize_t gpgme_ssize_t;"
API__OFF_T="off_t"
API__SSIZE_T="ssize_t"
fi
AC_SUBST(INSERT__TYPEDEFS_FOR_GPGME_H)
AM_SUBST_NOTMAKE(INSERT__TYPEDEFS_FOR_GPGME_H)
AC_SUBST(API__OFF_T)
AM_SUBST_NOTMAKE(API__OFF_T)
AC_SUBST(API__SSIZE_T)
AM_SUBST_NOTMAKE(API__SSIZE_T)
# Checks for compiler features.
if test "$GCC" = yes; then

View File

@ -493,18 +493,42 @@ support by default and just use that. The compatibility modes (small
file sizes or dual mode) can be considered an historic artefact, only
useful to allow for a transitional period.
@acronym{GPGME} is compiled using largefile support by default. This
means that your application must do the same, at least as far as it is
relevant for using the @file{gpgme.h} header file. All types in this
header files refer to their largefile counterparts, if they are
different from any default types on the system.
On POSIX platforms @acronym{GPGME} is compiled using largefile support
by default. This means that your application must do the same, at
least as far as it is relevant for using the @file{gpgme.h} header
file. All types in this header files refer to their largefile
counterparts, if they are different from any default types on the
system.
You can enable largefile support, if it is different from the default
on the system the application is compiled on, by using the Autoconf
macro @code{AC_SYS_LARGEFILE}. If you do this, then you don't need to
worry about anything else: It will just work. In this case you might
also want to use @code{AC_FUNC_FSEEKO} to take advantage of some new
interfaces, and @code{AC_TYPE_OFF_T} (just in case).
On 32 and 64 bit Windows platforms @code{off_t} is declared as 32 bit
signed integer. There is no specific support for LFS in the C
library. The recommendation from Microsoft is to use the native
interface (@code{CreateFile} et al.) for large files. Released binary
versions of @acronym{GPGME} (libgpgme-11.dll) have always been build
with a 32 bit @code{off_t}. To avoid an ABI break we stick to this
convention for 32 bit Windows by using @code{long} there.
@acronym{GPGME} versions for 64 bit Windows have never been released
and thus we are able to use @code{int64_t} instead of @code{off_t}
there. For easier migration the typedef @code{gpgme_off_t} has been
defined. The reason we cannot use @code{off_t} directly is that some
toolchains (e.g. mingw64) introduce a POSIX compatible hack for
@code{off_t}. Some widely used toolkits make use of this hack and in
turn @acronym{GPGME} would need to use it also. However, this would
introduce an ABI break and existing software making use of libgpgme
might suffer from a severe break. Thus with version 1.4.2 we
redefined all functions using @code{off_t} to use @code{gpgme_off_t}
which is defined as explained above. This way we keep the ABI well
defined and independent of any toolchain hacks. The bottom line is
that LFS support in @acronym{GPGME} is only available on 64 bit
versions of Windows.
On POSIX platforms you can enable largefile support, if it is
different from the default on the system the application is compiled
on, by using the Autoconf macro @code{AC_SYS_LARGEFILE}. If you do
this, then you don't need to worry about anything else: It will just
work. In this case you might also want to use @code{AC_FUNC_FSEEKO}
to take advantage of some new interfaces, and @code{AC_TYPE_OFF_T}
(just in case).
If you do not use Autoconf, you can define the preprocessor symbol
@code{_FILE_OFFSET_BITS} to 64 @emph{before} including any header
@ -1538,6 +1562,20 @@ by using memory buffers or files rather than pipes or sockets. This
might be relevant, for example, if the external event loop mechanism
is used.
@deftp {Data type} {gpgme_off_t}
On POSIX platforms the @code{gpgme_off_t} type is an alias for
@code{off_t}; it may be used interchangeable. On Windows platforms
@code{gpgme_off_t} is defined as a long (i.e. 32 bit) for 32 bit
Windows and as a 64 bit signed integer for 64 bit Windows.
@end deftp
@deftp {Data type} {gpgme_ssize_t}
The @code{gpgme_ssize_t} type is an alias for @code{ssize_t}. It has
only been introduced to overcome portability problems pertaining to
the declaration of @code{ssize_t} by different toolchains.
@end deftp
@menu
* Creating Data Buffers:: Creating new data buffers.
* Destroying Data Buffers:: Releasing data buffers.

View File

@ -68,14 +68,14 @@ my_close (assuan_context_t ctx, assuan_fd_t fd)
}
static ssize_t
static gpgme_ssize_t
my_read (assuan_context_t ctx, assuan_fd_t fd, void *buffer, size_t size)
{
return _gpgme_io_read ((int) fd, buffer, size);
}
static ssize_t
static gpgme_ssize_t
my_write (assuan_context_t ctx, assuan_fd_t fd, const void *buffer, size_t size)
{
return _gpgme_io_write ((int) fd, buffer, size);

View File

@ -39,6 +39,8 @@
#include <pthread.h>
#include "gpgme.h"
#include "ath.h"
@ -130,21 +132,21 @@ ath_mutex_unlock (ath_mutex_t *lock)
}
ssize_t
gpgme_ssize_t
ath_read (int fd, void *buf, size_t nbytes)
{
return read (fd, buf, nbytes);
}
ssize_t
gpgme_ssize_t
ath_write (int fd, const void *buf, size_t nbytes)
{
return write (fd, buf, nbytes);
}
ssize_t
gpgme_ssize_t
ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
struct timeval *timeout)
{
@ -152,7 +154,7 @@ ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
}
ssize_t
gpgme_ssize_t
ath_waitpid (pid_t pid, int *status, int options)
{
return waitpid (pid, status, options);

View File

@ -40,8 +40,9 @@
#include <sys/wait.h>
#endif
#include "gpgme.h"
#ifdef _MSC_VER
typedef long ssize_t;
typedef int pid_t;
#endif
@ -125,7 +126,7 @@ ath_mutex_unlock (ath_mutex_t *lock)
}
ssize_t
gpgme_ssize_t
ath_read (int fd, void *buf, size_t nbytes)
{
#if defined(HAVE_W32CE_SYSTEM) && defined(_MSC_VER)
@ -136,7 +137,7 @@ ath_read (int fd, void *buf, size_t nbytes)
}
ssize_t
gpgme_ssize_t
ath_write (int fd, const void *buf, size_t nbytes)
{
#if defined(HAVE_W32CE_SYSTEM) && defined(_MSC_VER)
@ -147,7 +148,7 @@ ath_write (int fd, const void *buf, size_t nbytes)
}
ssize_t
gpgme_ssize_t
ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
struct timeval *timeout)
{
@ -159,7 +160,7 @@ ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
}
ssize_t
gpgme_ssize_t
ath_waitpid (pid_t pid, int *status, int options)
{
#ifdef HAVE_W32_SYSTEM

View File

@ -88,11 +88,11 @@ int ath_mutex_unlock (ath_mutex_t *mutex);
/* Replacement for the POSIX functions, which can be used to allow
other (user-level) threads to run. */
ssize_t ath_read (int fd, void *buf, size_t nbytes);
ssize_t ath_write (int fd, const void *buf, size_t nbytes);
ssize_t ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
struct timeval *timeout);
ssize_t ath_waitpid (pid_t pid, int *status, int options);
gpgme_ssize_t ath_read (int fd, void *buf, size_t nbytes);
gpgme_ssize_t ath_write (int fd, const void *buf, size_t nbytes);
gpgme_ssize_t ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset,
struct timeval *timeout);
gpgme_ssize_t ath_waitpid (pid_t pid, int *status, int options);
int ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr);
int ath_connect (int s, const struct sockaddr *addr, socklen_t length);
int ath_sendmsg (int s, const struct msghdr *msg, int flags);

View File

@ -41,7 +41,7 @@
non-zero). */
gpgme_error_t
gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname,
FILE *stream, off_t offset, size_t length)
FILE *stream, gpgme_off_t offset, size_t length)
{
#if defined (HAVE_W32CE_SYSTEM) && defined (_MSC_VER)
return gpgme_error (GPG_ERR_NOT_IMPLEMENTED);
@ -175,7 +175,7 @@ gpgme_error_to_errno (gpgme_error_t err)
}
static ssize_t
static gpgme_ssize_t
old_user_read (gpgme_data_t dh, void *buffer, size_t size)
{
gpgme_error_t err;
@ -191,8 +191,8 @@ old_user_read (gpgme_data_t dh, void *buffer, size_t size)
}
static off_t
old_user_seek (gpgme_data_t dh, off_t offset, int whence)
static gpgme_off_t
old_user_seek (gpgme_data_t dh, gpgme_off_t offset, int whence)
{
gpgme_error_t err;
TRACE_BEG2 (DEBUG_DATA, "gpgme:old_user_seek", dh,

View File

@ -89,22 +89,22 @@ lseek (int fildes, long offset, int whence)
static ssize_t
static gpgme_ssize_t
fd_read (gpgme_data_t dh, void *buffer, size_t size)
{
return read (dh->data.fd, buffer, size);
}
static ssize_t
static gpgme_ssize_t
fd_write (gpgme_data_t dh, const void *buffer, size_t size)
{
return write (dh->data.fd, buffer, size);
}
static off_t
fd_seek (gpgme_data_t dh, off_t offset, int whence)
static gpgme_off_t
fd_seek (gpgme_data_t dh, gpgme_off_t offset, int whence)
{
return lseek (dh->data.fd, offset, whence);
}

View File

@ -35,7 +35,7 @@
#include "debug.h"
static ssize_t
static gpgme_ssize_t
mem_read (gpgme_data_t dh, void *buffer, size_t size)
{
size_t amt = dh->data.mem.length - dh->data.mem.offset;
@ -54,7 +54,7 @@ mem_read (gpgme_data_t dh, void *buffer, size_t size)
}
static ssize_t
static gpgme_ssize_t
mem_write (gpgme_data_t dh, const void *buffer, size_t size)
{
size_t unused;
@ -109,8 +109,8 @@ mem_write (gpgme_data_t dh, const void *buffer, size_t size)
}
static off_t
mem_seek (gpgme_data_t dh, off_t offset, int whence)
static gpgme_off_t
mem_seek (gpgme_data_t dh, gpgme_off_t offset, int whence)
{
switch (whence)
{

View File

@ -31,7 +31,7 @@
#include "data.h"
static ssize_t
static gpgme_ssize_t
stream_read (gpgme_data_t dh, void *buffer, size_t size)
{
size_t amt = fread (buffer, 1, size, dh->data.stream);
@ -41,7 +41,7 @@ stream_read (gpgme_data_t dh, void *buffer, size_t size)
}
static ssize_t
static gpgme_ssize_t
stream_write (gpgme_data_t dh, const void *buffer, size_t size)
{
size_t amt = fwrite (buffer, 1, size, dh->data.stream);
@ -51,8 +51,8 @@ stream_write (gpgme_data_t dh, const void *buffer, size_t size)
}
static off_t
stream_seek (gpgme_data_t dh, off_t offset, int whence)
static gpgme_off_t
stream_seek (gpgme_data_t dh, gpgme_off_t offset, int whence)
{
int err;

View File

@ -31,7 +31,7 @@
#include "data.h"
static ssize_t
static gpgme_ssize_t
user_read (gpgme_data_t dh, void *buffer, size_t size)
{
if (!dh->data.user.cbs->read)
@ -44,7 +44,7 @@ user_read (gpgme_data_t dh, void *buffer, size_t size)
}
static ssize_t
static gpgme_ssize_t
user_write (gpgme_data_t dh, const void *buffer, size_t size)
{
if (!dh->data.user.cbs->write)
@ -57,8 +57,8 @@ user_write (gpgme_data_t dh, const void *buffer, size_t size)
}
static off_t
user_seek (gpgme_data_t dh, off_t offset, int whence)
static gpgme_off_t
user_seek (gpgme_data_t dh, gpgme_off_t offset, int whence)
{
if (!dh->data.user.cbs->seek)
{

View File

@ -72,10 +72,10 @@ _gpgme_data_release (gpgme_data_t dh)
/* Read up to SIZE bytes into buffer BUFFER from the data object with
the handle DH. Return the number of characters read, 0 on EOF and
-1 on error. If an error occurs, errno is set. */
ssize_t
gpgme_ssize_t
gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size)
{
ssize_t res;
gpgme_ssize_t res;
TRACE_BEG2 (DEBUG_DATA, "gpgme_data_read", dh,
"buffer=%p, size=%u", buffer, size);
@ -100,10 +100,10 @@ gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size)
/* Write up to SIZE bytes from buffer BUFFER to the data object with
the handle DH. Return the number of characters written, or -1 on
error. If an error occurs, errno is set. */
ssize_t
gpgme_ssize_t
gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size)
{
ssize_t res;
gpgme_ssize_t res;
TRACE_BEG2 (DEBUG_DATA, "gpgme_data_write", dh,
"buffer=%p, size=%u", buffer, size);
@ -128,8 +128,8 @@ gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size)
/* Set the current position from where the next read or write starts
in the data object with the handle DH to OFFSET, relativ to
WHENCE. */
off_t
gpgme_data_seek (gpgme_data_t dh, off_t offset, int whence)
gpgme_off_t
gpgme_data_seek (gpgme_data_t dh, gpgme_off_t offset, int whence)
{
TRACE_BEG2 (DEBUG_DATA, "gpgme_data_seek", dh,
"offset=%lli, whence=%i", offset, whence);
@ -253,7 +253,7 @@ _gpgme_data_inbound_handler (void *opaque, int fd)
gpgme_data_t dh = (gpgme_data_t) data->handler_value;
char buffer[BUFFER_SIZE];
char *bufp = buffer;
ssize_t buflen;
gpgme_ssize_t buflen;
TRACE_BEG1 (DEBUG_CTX, "_gpgme_data_inbound_handler", dh,
"fd=0x%x", fd);
@ -268,7 +268,7 @@ _gpgme_data_inbound_handler (void *opaque, int fd)
do
{
ssize_t amt = gpgme_data_write (dh, bufp, buflen);
gpgme_ssize_t amt = gpgme_data_write (dh, bufp, buflen);
if (amt == 0 || (amt < 0 && errno != EINTR))
return TRACE_ERR (gpg_error_from_syserror ());
bufp += amt;
@ -284,13 +284,13 @@ _gpgme_data_outbound_handler (void *opaque, int fd)
{
struct io_cb_data *data = (struct io_cb_data *) opaque;
gpgme_data_t dh = (gpgme_data_t) data->handler_value;
ssize_t nwritten;
gpgme_ssize_t nwritten;
TRACE_BEG1 (DEBUG_CTX, "_gpgme_data_outbound_handler", dh,
"fd=0x%x", fd);
if (!dh->pending_len)
{
ssize_t amt = gpgme_data_read (dh, dh->pending, BUFFER_SIZE);
gpgme_ssize_t amt = gpgme_data_read (dh, dh->pending, BUFFER_SIZE);
if (amt < 0)
return TRACE_ERR (gpg_error_from_syserror ());
if (amt == 0)

View File

@ -36,20 +36,23 @@
/* Read up to SIZE bytes into buffer BUFFER from the data object with
the handle DH. Return the number of characters read, 0 on EOF and
-1 on error. If an error occurs, errno is set. */
typedef ssize_t (*gpgme_data_read_cb) (gpgme_data_t dh, void *buffer,
size_t size);
typedef gpgme_ssize_t (*gpgme_data_read_cb) (gpgme_data_t dh,
void *buffer,
size_t size);
/* Write up to SIZE bytes from buffer BUFFER to the data object with
the handle DH. Return the number of characters written, or -1 on
error. If an error occurs, errno is set. */
typedef ssize_t (*gpgme_data_write_cb) (gpgme_data_t dh, const void *buffer,
size_t size);
typedef gpgme_ssize_t (*gpgme_data_write_cb) (gpgme_data_t dh,
const void *buffer,
size_t size);
/* Set the current position from where the next read or write starts
in the data object with the handle DH to OFFSET, relativ to
WHENCE. */
typedef off_t (*gpgme_data_seek_cb) (gpgme_data_t dh, off_t offset,
int whence);
typedef gpgme_off_t (*gpgme_data_seek_cb) (gpgme_data_t dh,
gpgme_off_t offset,
int whence);
/* Release the data object with the handle DH. */
typedef void (*gpgme_data_release_cb) (gpgme_data_t dh);
@ -109,7 +112,7 @@ struct gpgme_data
/* Allocated size of BUFFER. */
size_t size;
size_t length;
off_t offset;
gpgme_off_t offset;
} mem;
/* For gpgme_data_new_from_read_cb. */

View File

@ -891,7 +891,7 @@ status_handler (void *opaque, int fd)
char *src = line + 2;
char *end = line + linelen;
char *dst = src;
ssize_t nwritten;
gpgme_ssize_t nwritten;
linelen = 0;
while (src < end)

View File

@ -754,7 +754,7 @@ status_handler (void *opaque, int fd)
char *src = line + 2;
char *end = line + linelen;
char *dst = src;
ssize_t nwritten;
gpgme_ssize_t nwritten;
linelen = 0;
while (src < end)

View File

@ -3056,7 +3056,7 @@ _cmd_genkey_write (gpgme_data_t data, const void *buf, size_t size)
{
while (size > 0)
{
ssize_t writen = gpgme_data_write (data, buf, size);
gpgme_ssize_t writen = gpgme_data_write (data, buf, size);
if (writen < 0 && errno != EAGAIN)
return gpg_error_from_syserror ();
else if (writen > 0)
@ -3112,7 +3112,7 @@ cmd_genkey (assuan_context_t ctx, char *line)
do
{
char buf[512];
ssize_t readn = gpgme_data_read (inp_data, buf, sizeof (buf));
gpgme_ssize_t readn = gpgme_data_read (inp_data, buf, sizeof (buf));
if (readn < 0)
{
err = gpg_error_from_syserror ();

View File

@ -643,7 +643,7 @@ gpgme_set_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs)
/* This function provides access to the internal read function; it is
normally not used. */
ssize_t
gpgme_ssize_t
gpgme_io_read (int fd, void *buffer, size_t count)
{
int ret;
@ -659,7 +659,7 @@ gpgme_io_read (int fd, void *buffer, size_t count)
/* This function provides access to the internal write function. It
is to be used by user callbacks to return data to gpgme. See
gpgme_passphrase_cb_t and gpgme_edit_cb_t. */
ssize_t
gpgme_ssize_t
gpgme_io_write (int fd, const void *buffer, size_t count)
{
int ret;

View File

@ -18,7 +18,7 @@
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, see <http://www.gnu.org/licenses/>.
File: @configure_input@ */
Generated from gpgme.h.in for @GPGME_CONFIG_HOST@. */
#ifndef GPGME_H
#define GPGME_H
@ -33,10 +33,8 @@
/* Include stdio.h for the FILE type definition. */
#include <stdio.h>
@INSERT__TYPEDEFS_FOR_GPGME_H@
#include <time.h>
@INSERT__TYPEDEFS_FOR_GPGME_H@
#include <gpg-error.h>
@ -1043,8 +1041,8 @@ void gpgme_get_io_cbs (gpgme_ctx_t ctx, gpgme_io_cbs_t io_cbs);
/* Wrappers around the internal I/O functions for use with
gpgme_passphrase_cb_t and gpgme_edit_cb_t. */
ssize_t gpgme_io_read (int fd, void *buffer, size_t count);
ssize_t gpgme_io_write (int fd, const void *buffer, size_t count);
@API__SSIZE_T@ gpgme_io_read (int fd, void *buffer, size_t count);
@API__SSIZE_T@ gpgme_io_write (int fd, const void *buffer, size_t count);
int gpgme_io_writen (int fd, const void *buffer, size_t count);
/* Process the pending operation and, if HANG is non-zero, wait for
@ -1060,19 +1058,20 @@ gpgme_ctx_t gpgme_wait_ext (gpgme_ctx_t ctx, gpgme_error_t *status,
/* Read up to SIZE bytes into buffer BUFFER from the data object with
the handle HANDLE. Return the number of characters read, 0 on EOF
and -1 on error. If an error occurs, errno is set. */
typedef ssize_t (*gpgme_data_read_cb_t) (void *handle, void *buffer,
typedef @API__SSIZE_T@ (*gpgme_data_read_cb_t) (void *handle, void *buffer,
size_t size);
/* Write up to SIZE bytes from buffer BUFFER to the data object with
the handle HANDLE. Return the number of characters written, or -1
on error. If an error occurs, errno is set. */
typedef ssize_t (*gpgme_data_write_cb_t) (void *handle, const void *buffer,
typedef @API__SSIZE_T@ (*gpgme_data_write_cb_t) (void *handle, const void *buffer,
size_t size);
/* Set the current position from where the next read or write starts
in the data object with the handle HANDLE to OFFSET, relativ to
WHENCE. */
typedef off_t (*gpgme_data_seek_cb_t) (void *handle, off_t offset, int whence);
typedef @API__OFF_T@ (*gpgme_data_seek_cb_t) (void *handle,
@API__OFF_T@ offset, int whence);
/* Close the data object with the handle DL. */
typedef void (*gpgme_data_release_cb_t) (void *handle);
@ -1089,17 +1088,17 @@ typedef struct gpgme_data_cbs *gpgme_data_cbs_t;
/* Read up to SIZE bytes into buffer BUFFER from the data object with
the handle DH. Return the number of characters read, 0 on EOF and
-1 on error. If an error occurs, errno is set. */
ssize_t gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size);
@API__SSIZE_T@ gpgme_data_read (gpgme_data_t dh, void *buffer, size_t size);
/* Write up to SIZE bytes from buffer BUFFER to the data object with
the handle DH. Return the number of characters written, or -1 on
error. If an error occurs, errno is set. */
ssize_t gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size);
@API__SSIZE_T@ gpgme_data_write (gpgme_data_t dh, const void *buffer, size_t size);
/* Set the current position from where the next read or write starts
in the data object with the handle DH to OFFSET, relativ to
WHENCE. */
off_t gpgme_data_seek (gpgme_data_t dh, off_t offset, int whence);
@API__OFF_T@ gpgme_data_seek (gpgme_data_t dh, @API__OFF_T@ offset, int whence);
/* Create a new data buffer and return it in R_DH. */
gpgme_error_t gpgme_data_new (gpgme_data_t *r_dh);
@ -1168,7 +1167,7 @@ gpgme_error_t gpgme_data_new_from_file (gpgme_data_t *r_dh,
non-zero). */
gpgme_error_t gpgme_data_new_from_filepart (gpgme_data_t *r_dh,
const char *fname, FILE *fp,
off_t offset, size_t length);
@API__OFF_T@ offset, size_t length);
/* Reset the read pointer in DH. Deprecated, please use
gpgme_data_seek instead. */