+2005-05-05 Marcus Brinkmann <marcus@g10code.de>
+
+ * data-user.c (user_release): Only call user hook if provided.
+ (user_seek): Return EBADF if no user hook is provided.
+ (user_read): Likewise.
+ (user_write): Likewise.
+
2005-04-28 Marcus Brinkmann <marcus@g10code.de>
* gpgme.h (GPGME_INCLUDE_CERTS_DEFAULT): New macro.
static ssize_t
user_read (gpgme_data_t dh, void *buffer, size_t size)
{
+ if (!dh->data.user.cbs->read)
+ return EBADF;
+
return (*dh->data.user.cbs->read) (dh->data.user.handle, buffer, size);
}
static ssize_t
user_write (gpgme_data_t dh, const void *buffer, size_t size)
{
+ if (!dh->data.user.cbs->write)
+ return EBADF;
+
return (*dh->data.user.cbs->write) (dh->data.user.handle, buffer, size);
}
static off_t
user_seek (gpgme_data_t dh, off_t offset, int whence)
{
+ if (!dh->data.user.cbs->seek)
+ return EBADF;
+
return (*dh->data.user.cbs->seek) (dh->data.user.handle, offset, whence);
}
static void
user_release (gpgme_data_t dh)
{
- (*dh->data.user.cbs->release) (dh->data.user.handle);
+ if (dh->data.user.cbs->release)
+ (*dh->data.user.cbs->release) (dh->data.user.handle);
}