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 *.
#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"
{
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;
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;
}
GpgmeData dh = (GpgmeData) opaque;
ssize_t nwritten;
- assert (dh);
-
if (!dh->pending_len)
{
ssize_t amt = gpgme_data_read (dh, dh->pending, BUFFER_SIZE);