2003-04-25 Marcus Brinkmann <marcus@g10code.de>

* data.c: Do not include <assert.h>, but "gpgme.h".
	(_gpgme_data_inbound_handler): Expand _gpgme_data_append, because
	it will go.  Do not assert DH.
	(_gpgme_data_outbound_handler): Do not assert DH.
This commit is contained in:
Marcus Brinkmann 2003-04-25 13:23:27 +00:00
parent 359c251b4d
commit d5993c256b
2 changed files with 17 additions and 6 deletions

View File

@ -1,5 +1,10 @@
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
* data.c: Do not include <assert.h>, but "gpgme.h".
(_gpgme_data_inbound_handler): Expand _gpgme_data_append, because
it will go. Do not assert DH.
(_gpgme_data_outbound_handler): Do not assert DH.
* export.c: Do not include <stdlib.h>, "debug.h" and "util.h", but
"gpgme.h".
(export_status_handler): Change type of first argument to void *.

View File

@ -22,11 +22,11 @@
#endif
#include <stdlib.h>
#include <assert.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include "gpgme.h"
#include "data.h"
#include "util.h"
#include "ops.h"
@ -164,10 +164,9 @@ _gpgme_data_inbound_handler (void *opaque, int fd)
{
GpgmeData dh = (GpgmeData) opaque;
char buffer[BUFFER_SIZE];
char *bufp = buffer;
ssize_t buflen;
assert (dh);
buflen = read (fd, buffer, BUFFER_SIZE);
if (buflen < 0)
return GPGME_File_Error;
@ -177,7 +176,16 @@ _gpgme_data_inbound_handler (void *opaque, int fd)
return 0;
}
return _gpgme_data_append (dh, buffer, buflen);
do
{
ssize_t amt = gpgme_data_write (dh, bufp, buflen);
if (amt == 0 || (amt < 0 && errno != EINTR))
return GPGME_File_Error;
bufp += amt;
buflen -= amt;
}
while (buflen > 0);
return 0;
}
@ -187,8 +195,6 @@ _gpgme_data_outbound_handler (void *opaque, int fd)
GpgmeData dh = (GpgmeData) opaque;
ssize_t nwritten;
assert (dh);
if (!dh->pending_len)
{
ssize_t amt = gpgme_data_read (dh, dh->pending, BUFFER_SIZE);