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:
parent
359c251b4d
commit
d5993c256b
@ -1,5 +1,10 @@
|
|||||||
2003-04-25 Marcus Brinkmann <marcus@g10code.de>
|
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
|
* export.c: Do not include <stdlib.h>, "debug.h" and "util.h", but
|
||||||
"gpgme.h".
|
"gpgme.h".
|
||||||
(export_status_handler): Change type of first argument to void *.
|
(export_status_handler): Change type of first argument to void *.
|
||||||
|
18
gpgme/data.c
18
gpgme/data.c
@ -22,11 +22,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gpgme.h"
|
||||||
#include "data.h"
|
#include "data.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "ops.h"
|
#include "ops.h"
|
||||||
@ -164,10 +164,9 @@ _gpgme_data_inbound_handler (void *opaque, int fd)
|
|||||||
{
|
{
|
||||||
GpgmeData dh = (GpgmeData) opaque;
|
GpgmeData dh = (GpgmeData) opaque;
|
||||||
char buffer[BUFFER_SIZE];
|
char buffer[BUFFER_SIZE];
|
||||||
|
char *bufp = buffer;
|
||||||
ssize_t buflen;
|
ssize_t buflen;
|
||||||
|
|
||||||
assert (dh);
|
|
||||||
|
|
||||||
buflen = read (fd, buffer, BUFFER_SIZE);
|
buflen = read (fd, buffer, BUFFER_SIZE);
|
||||||
if (buflen < 0)
|
if (buflen < 0)
|
||||||
return GPGME_File_Error;
|
return GPGME_File_Error;
|
||||||
@ -177,7 +176,16 @@ _gpgme_data_inbound_handler (void *opaque, int fd)
|
|||||||
return 0;
|
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;
|
GpgmeData dh = (GpgmeData) opaque;
|
||||||
ssize_t nwritten;
|
ssize_t nwritten;
|
||||||
|
|
||||||
assert (dh);
|
|
||||||
|
|
||||||
if (!dh->pending_len)
|
if (!dh->pending_len)
|
||||||
{
|
{
|
||||||
ssize_t amt = gpgme_data_read (dh, dh->pending, BUFFER_SIZE);
|
ssize_t amt = gpgme_data_read (dh, dh->pending, BUFFER_SIZE);
|
||||||
|
Loading…
Reference in New Issue
Block a user