From: Marcus Brinkmann Date: Fri, 25 Apr 2003 13:23:27 +0000 (+0000) Subject: 2003-04-25 Marcus Brinkmann X-Git-Tag: gpgme-1.2.0@1385~672 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b229dd2bf1c2197e8286af4e39811d5d04bb6905;p=gpgme.git 2003-04-25 Marcus Brinkmann * data.c: Do not include , 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. --- diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index ba6e296..4fed18e 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,5 +1,10 @@ 2003-04-25 Marcus Brinkmann + * data.c: Do not include , 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 , "debug.h" and "util.h", but "gpgme.h". (export_status_handler): Change type of first argument to void *. diff --git a/trunk/gpgme/data.c b/trunk/gpgme/data.c index 038307e..cd606aa 100644 --- a/trunk/gpgme/data.c +++ b/trunk/gpgme/data.c @@ -22,11 +22,11 @@ #endif #include -#include #include #include #include +#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);