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.
This commit is contained in:
Marcus Brinkmann 2005-05-05 12:00:11 +00:00
parent 02a1dbee30
commit 1184d349cd
2 changed files with 18 additions and 1 deletions

View File

@ -1,3 +1,10 @@
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.

View File

@ -30,6 +30,9 @@
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);
}
@ -37,6 +40,9 @@ user_read (gpgme_data_t dh, void *buffer, size_t 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);
}
@ -44,6 +50,9 @@ 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)
{
if (!dh->data.user.cbs->seek)
return EBADF;
return (*dh->data.user.cbs->seek) (dh->data.user.handle, offset, whence);
}
@ -51,6 +60,7 @@ user_seek (gpgme_data_t dh, off_t offset, int whence)
static void
user_release (gpgme_data_t dh)
{
if (dh->data.user.cbs->release)
(*dh->data.user.cbs->release) (dh->data.user.handle);
}