mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
g10: Fix iobuf API of filter function for alignment.
* include/iobuf.h (struct iobuf_struct): Remove DESC. * util/iobuf.c (iobuf_desc): New. (print_chain, iobuf_close, iobuf_open, iobuf_fdopen, iobuf_sockopen) (iobuf_create, iobuf_append, iobuf_openrw, iobuf_ioctl) (iobuf_push_filter2, pop_filter, underflow): Use iobuf_desc. (file_filter, sock_filter, block_filter): Fill the description. * g10/armor.c, g10/cipher.c, g10/compress-bz2.c, g10/compress.c, g10/encode.c, g10/encr-data.c, g10/mdfilter.c, g10/pipemode.c, g10/progress.c, g10/textfilter.c: Likewise. -- Newer GCC warns against possible alignment difference of pointers. This change can silence those warnings. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org> (backported from 2.1 commit 3f52c7da3940ec06572270d511000dc7fe9c27d2)
This commit is contained in:
parent
a38dffde7b
commit
aa4a3aa3e7
@ -1300,7 +1300,7 @@ armor_filter( void *opaque, int control,
|
|||||||
release_armor_context (afx);
|
release_armor_context (afx);
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_DESC )
|
else if( control == IOBUFCTRL_DESC )
|
||||||
*(char**)buf = "armor_filter";
|
mem2str (buf, "armor_filter", *ret_len);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ cipher_filter( void *opaque, int control,
|
|||||||
cipher_close(cfx->cipher_hd);
|
cipher_close(cfx->cipher_hd);
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_DESC ) {
|
else if( control == IOBUFCTRL_DESC ) {
|
||||||
*(char**)buf = "cipher_filter";
|
mem2str (buf, "cipher_filter", *ret_len);
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -247,6 +247,6 @@ compress_filter_bz2( void *opaque, int control,
|
|||||||
zfx->release (zfx);
|
zfx->release (zfx);
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_DESC )
|
else if( control == IOBUFCTRL_DESC )
|
||||||
*(char**)buf = "compress_filter";
|
mem2str (buf, "compress_filter", *ret_len);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ compress_filter( void *opaque, int control,
|
|||||||
zfx->release (zfx);
|
zfx->release (zfx);
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_DESC )
|
else if( control == IOBUFCTRL_DESC )
|
||||||
*(char**)buf = "compress_filter";
|
mem2str (buf, "compress_filter", *ret_len);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -736,7 +736,7 @@ encrypt_filter( void *opaque, int control,
|
|||||||
xfree(efx->symkey_s2k);
|
xfree(efx->symkey_s2k);
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_DESC ) {
|
else if( control == IOBUFCTRL_DESC ) {
|
||||||
*(char**)buf = "encrypt_filter";
|
mem2str (buf, "encrypt_filter", *ret_len);
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ mdc_decode_filter( void *opaque, int control, IOBUF a,
|
|||||||
release_dfx_context (dfx);
|
release_dfx_context (dfx);
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_DESC ) {
|
else if( control == IOBUFCTRL_DESC ) {
|
||||||
*(char**)buf = "mdc_decode_filter";
|
mem2str (buf, "mdc_decode_filter", *ret_len);
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -329,7 +329,7 @@ decode_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len)
|
|||||||
release_dfx_context (fc);
|
release_dfx_context (fc);
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_DESC ) {
|
else if( control == IOBUFCTRL_DESC ) {
|
||||||
*(char**)buf = "decode_filter";
|
mem2str (buf, "decode_filter", *ret_len);
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ md_filter( void *opaque, int control,
|
|||||||
*ret_len = i;
|
*ret_len = i;
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_DESC )
|
else if( control == IOBUFCTRL_DESC )
|
||||||
*(char**)buf = "md_filter";
|
mem2str (buf, "md_filter", *ret_len);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ pipemode_filter( void *opaque, int control,
|
|||||||
*ret_len = n;
|
*ret_len = n;
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_DESC )
|
else if( control == IOBUFCTRL_DESC )
|
||||||
*(char**)buf = "pipemode_filter";
|
mem2str (buf, "pipemode_filter", *ret_len);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ progress_filter (void *opaque, int control,
|
|||||||
pfx->what = NULL;
|
pfx->what = NULL;
|
||||||
}
|
}
|
||||||
else if (control == IOBUFCTRL_DESC)
|
else if (control == IOBUFCTRL_DESC)
|
||||||
*(char**)buf = "progress_filter";
|
mem2str (buf, "progress_filter", *ret_len);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ text_filter( void *opaque, int control,
|
|||||||
tfx->buffer = NULL;
|
tfx->buffer = NULL;
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_DESC )
|
else if( control == IOBUFCTRL_DESC )
|
||||||
*(char**)buf = "text_filter";
|
mem2str (buf, "text_filter", *ret_len);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,6 @@ struct iobuf_struct {
|
|||||||
char *real_fname;
|
char *real_fname;
|
||||||
IOBUF chain; /* next iobuf used for i/o if any (passed to filter) */
|
IOBUF chain; /* next iobuf used for i/o if any (passed to filter) */
|
||||||
int no, subno;
|
int no, subno;
|
||||||
const char *desc;
|
|
||||||
void *opaque; /* can be used to hold any information */
|
void *opaque; /* can be used to hold any information */
|
||||||
/* this value is copied to all instances */
|
/* this value is copied to all instances */
|
||||||
struct {
|
struct {
|
||||||
|
74
util/iobuf.c
74
util/iobuf.c
@ -459,7 +459,7 @@ file_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
|
|||||||
a->keep_open = a->no_cache = 0;
|
a->keep_open = a->no_cache = 0;
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_DESC ) {
|
else if( control == IOBUFCTRL_DESC ) {
|
||||||
*(char**)buf = "file_filter";
|
mem2str (buf, "file_filter", *ret_len);
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_FREE ) {
|
else if( control == IOBUFCTRL_FREE ) {
|
||||||
if( f != stdin && f != stdout ) {
|
if( f != stdin && f != stdout ) {
|
||||||
@ -572,7 +572,7 @@ file_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
|
|||||||
a->no_cache = 0;
|
a->no_cache = 0;
|
||||||
}
|
}
|
||||||
else if ( control == IOBUFCTRL_DESC ) {
|
else if ( control == IOBUFCTRL_DESC ) {
|
||||||
*(char**)buf = "file_filter(fd)";
|
mem2str (buf, "file_filter(fd)", *ret_len);
|
||||||
}
|
}
|
||||||
else if ( control == IOBUFCTRL_FREE ) {
|
else if ( control == IOBUFCTRL_FREE ) {
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
@ -660,7 +660,7 @@ sock_filter (void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
|
|||||||
a->no_cache = 0;
|
a->no_cache = 0;
|
||||||
}
|
}
|
||||||
else if ( control == IOBUFCTRL_DESC ) {
|
else if ( control == IOBUFCTRL_DESC ) {
|
||||||
*(char**)buf = "sock_filter";
|
mem2str (buf, "sock_filter", *ret_len);
|
||||||
}
|
}
|
||||||
else if ( control == IOBUFCTRL_FREE ) {
|
else if ( control == IOBUFCTRL_FREE ) {
|
||||||
if (!a->keep_open)
|
if (!a->keep_open)
|
||||||
@ -852,7 +852,7 @@ block_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
|
|||||||
a->buflen = 0;
|
a->buflen = 0;
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_DESC ) {
|
else if( control == IOBUFCTRL_DESC ) {
|
||||||
*(char**)buf = "block_filter";
|
mem2str (buf, "block_filter", *ret_len);
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_FREE ) {
|
else if( control == IOBUFCTRL_FREE ) {
|
||||||
if( a->use == 2 ) { /* write the end markers */
|
if( a->use == 2 ) { /* write the end markers */
|
||||||
@ -906,6 +906,24 @@ block_filter(void *opaque, int control, IOBUF chain, byte *buf, size_t *ret_len)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MAX_IOBUF_DESC 32
|
||||||
|
/*
|
||||||
|
* Fill the buffer by the description of iobuf A.
|
||||||
|
* The buffer size should be MAX_IOBUF_DESC (or larger).
|
||||||
|
* Returns BUF as (const char *).
|
||||||
|
*/
|
||||||
|
static const char *
|
||||||
|
iobuf_desc (iobuf_t a, byte *buf)
|
||||||
|
{
|
||||||
|
size_t len = MAX_IOBUF_DESC;
|
||||||
|
|
||||||
|
if (! a || ! a->filter)
|
||||||
|
memcpy (buf, "?", 2);
|
||||||
|
else
|
||||||
|
a->filter (a->filter_ov, IOBUFCTRL_DESC, NULL, buf, &len);
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_chain( IOBUF a )
|
print_chain( IOBUF a )
|
||||||
@ -913,16 +931,11 @@ print_chain( IOBUF a )
|
|||||||
if( !DBG_IOBUF )
|
if( !DBG_IOBUF )
|
||||||
return;
|
return;
|
||||||
for(; a; a = a->chain ) {
|
for(; a; a = a->chain ) {
|
||||||
size_t dummy_len = 0;
|
byte desc[MAX_IOBUF_DESC];
|
||||||
const char *desc = "[none]";
|
|
||||||
|
|
||||||
if( a->filter )
|
|
||||||
a->filter( a->filter_ov, IOBUFCTRL_DESC, NULL,
|
|
||||||
(byte*)&desc, &dummy_len );
|
|
||||||
|
|
||||||
log_debug("iobuf chain: %d.%d `%s' filter_eof=%d start=%d len=%d\n",
|
log_debug("iobuf chain: %d.%d `%s' filter_eof=%d start=%d len=%d\n",
|
||||||
a->no, a->subno, desc?desc:"?", a->filter_eof,
|
a->no, a->subno, iobuf_desc (a, desc), a->filter_eof,
|
||||||
(int)a->d.start, (int)a->d.len );
|
(int)a->d.start, (int)a->d.len );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -971,13 +984,14 @@ iobuf_close ( IOBUF a )
|
|||||||
}
|
}
|
||||||
|
|
||||||
for( ; a && !rc ; a = a2 ) {
|
for( ; a && !rc ; a = a2 ) {
|
||||||
|
byte desc[MAX_IOBUF_DESC];
|
||||||
a2 = a->chain;
|
a2 = a->chain;
|
||||||
if( a->use == 2 && (rc=iobuf_flush(a)) )
|
if( a->use == 2 && (rc=iobuf_flush(a)) )
|
||||||
log_error("iobuf_flush failed on close: %s\n", g10_errstr(rc));
|
log_error("iobuf_flush failed on close: %s\n", g10_errstr(rc));
|
||||||
|
|
||||||
if( DBG_IOBUF )
|
if( DBG_IOBUF )
|
||||||
log_debug("iobuf-%d.%d: close `%s'\n", a->no, a->subno,
|
log_debug("iobuf-%d.%d: close `%s'\n", a->no, a->subno,
|
||||||
a->desc?a->desc:"?");
|
iobuf_desc (a, desc));
|
||||||
if( a->filter && (rc = a->filter(a->filter_ov, IOBUFCTRL_FREE,
|
if( a->filter && (rc = a->filter(a->filter_ov, IOBUFCTRL_FREE,
|
||||||
a->chain, NULL, &dummy_len)) )
|
a->chain, NULL, &dummy_len)) )
|
||||||
log_error("IOBUFCTRL_FREE failed on close: %s\n", g10_errstr(rc) );
|
log_error("IOBUFCTRL_FREE failed on close: %s\n", g10_errstr(rc) );
|
||||||
@ -1132,7 +1146,6 @@ iobuf_open( const char *fname )
|
|||||||
a->real_fname = xstrdup( fname );
|
a->real_fname = xstrdup( fname );
|
||||||
a->filter = file_filter;
|
a->filter = file_filter;
|
||||||
a->filter_ov = fcx;
|
a->filter_ov = fcx;
|
||||||
file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len );
|
|
||||||
file_filter( fcx, IOBUFCTRL_INIT, NULL, NULL, &len );
|
file_filter( fcx, IOBUFCTRL_INIT, NULL, NULL, &len );
|
||||||
if( DBG_IOBUF )
|
if( DBG_IOBUF )
|
||||||
log_debug("iobuf-%d.%d: open `%s' fd=%d\n",
|
log_debug("iobuf-%d.%d: open `%s' fd=%d\n",
|
||||||
@ -1166,7 +1179,6 @@ iobuf_fdopen( int fd, const char *mode )
|
|||||||
sprintf(fcx->fname, "[fd %d]", fd );
|
sprintf(fcx->fname, "[fd %d]", fd );
|
||||||
a->filter = file_filter;
|
a->filter = file_filter;
|
||||||
a->filter_ov = fcx;
|
a->filter_ov = fcx;
|
||||||
file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len );
|
|
||||||
file_filter( fcx, IOBUFCTRL_INIT, NULL, NULL, &len );
|
file_filter( fcx, IOBUFCTRL_INIT, NULL, NULL, &len );
|
||||||
if( DBG_IOBUF )
|
if( DBG_IOBUF )
|
||||||
log_debug("iobuf-%d.%d: fdopen `%s'\n", a->no, a->subno, fcx->fname );
|
log_debug("iobuf-%d.%d: fdopen `%s'\n", a->no, a->subno, fcx->fname );
|
||||||
@ -1190,7 +1202,6 @@ iobuf_sockopen ( int fd, const char *mode )
|
|||||||
sprintf(scx->fname, "[sock %d]", fd );
|
sprintf(scx->fname, "[sock %d]", fd );
|
||||||
a->filter = sock_filter;
|
a->filter = sock_filter;
|
||||||
a->filter_ov = scx;
|
a->filter_ov = scx;
|
||||||
sock_filter( scx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len );
|
|
||||||
sock_filter( scx, IOBUFCTRL_INIT, NULL, NULL, &len );
|
sock_filter( scx, IOBUFCTRL_INIT, NULL, NULL, &len );
|
||||||
if( DBG_IOBUF )
|
if( DBG_IOBUF )
|
||||||
log_debug("iobuf-%d.%d: sockopen `%s'\n", a->no, a->subno, scx->fname);
|
log_debug("iobuf-%d.%d: sockopen `%s'\n", a->no, a->subno, scx->fname);
|
||||||
@ -1213,6 +1224,7 @@ iobuf_create( const char *fname )
|
|||||||
size_t len;
|
size_t len;
|
||||||
int print_only = 0;
|
int print_only = 0;
|
||||||
int fd;
|
int fd;
|
||||||
|
byte desc[MAX_IOBUF_DESC];
|
||||||
|
|
||||||
if( !fname || (*fname=='-' && !fname[1]) ) {
|
if( !fname || (*fname=='-' && !fname[1]) ) {
|
||||||
fp = FILEP_OR_FD_FOR_STDOUT;
|
fp = FILEP_OR_FD_FOR_STDOUT;
|
||||||
@ -1235,11 +1247,10 @@ iobuf_create( const char *fname )
|
|||||||
a->real_fname = xstrdup( fname );
|
a->real_fname = xstrdup( fname );
|
||||||
a->filter = file_filter;
|
a->filter = file_filter;
|
||||||
a->filter_ov = fcx;
|
a->filter_ov = fcx;
|
||||||
file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len );
|
|
||||||
file_filter( fcx, IOBUFCTRL_INIT, NULL, NULL, &len );
|
file_filter( fcx, IOBUFCTRL_INIT, NULL, NULL, &len );
|
||||||
if( DBG_IOBUF )
|
if( DBG_IOBUF )
|
||||||
log_debug("iobuf-%d.%d: create `%s'\n", a->no, a->subno,
|
log_debug("iobuf-%d.%d: create `%s'\n", a->no, a->subno,
|
||||||
a->desc?a->desc:"?" );
|
iobuf_desc (a, desc));
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
@ -1257,6 +1268,7 @@ iobuf_append( const char *fname )
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
file_filter_ctx_t *fcx;
|
file_filter_ctx_t *fcx;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
byte desc[MAX_IOBUF_DESC];
|
||||||
|
|
||||||
if( !fname )
|
if( !fname )
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1269,11 +1281,10 @@ iobuf_append( const char *fname )
|
|||||||
a->real_fname = xstrdup( fname );
|
a->real_fname = xstrdup( fname );
|
||||||
a->filter = file_filter;
|
a->filter = file_filter;
|
||||||
a->filter_ov = fcx;
|
a->filter_ov = fcx;
|
||||||
file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len );
|
|
||||||
file_filter( fcx, IOBUFCTRL_INIT, NULL, NULL, &len );
|
file_filter( fcx, IOBUFCTRL_INIT, NULL, NULL, &len );
|
||||||
if( DBG_IOBUF )
|
if( DBG_IOBUF )
|
||||||
log_debug("iobuf-%d.%d: append `%s'\n", a->no, a->subno,
|
log_debug("iobuf-%d.%d: append `%s'\n", a->no, a->subno,
|
||||||
a->desc?a->desc:"?" );
|
iobuf_desc (a, desc));
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
@ -1286,6 +1297,7 @@ iobuf_openrw( const char *fname )
|
|||||||
FILEP_OR_FD fp;
|
FILEP_OR_FD fp;
|
||||||
file_filter_ctx_t *fcx;
|
file_filter_ctx_t *fcx;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
byte desc[MAX_IOBUF_DESC];
|
||||||
|
|
||||||
if( !fname )
|
if( !fname )
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1298,11 +1310,10 @@ iobuf_openrw( const char *fname )
|
|||||||
a->real_fname = xstrdup( fname );
|
a->real_fname = xstrdup( fname );
|
||||||
a->filter = file_filter;
|
a->filter = file_filter;
|
||||||
a->filter_ov = fcx;
|
a->filter_ov = fcx;
|
||||||
file_filter( fcx, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &len );
|
|
||||||
file_filter( fcx, IOBUFCTRL_INIT, NULL, NULL, &len );
|
file_filter( fcx, IOBUFCTRL_INIT, NULL, NULL, &len );
|
||||||
if( DBG_IOBUF )
|
if( DBG_IOBUF )
|
||||||
log_debug("iobuf-%d.%d: openrw `%s'\n", a->no, a->subno,
|
log_debug("iobuf-%d.%d: openrw `%s'\n", a->no, a->subno,
|
||||||
a->desc?a->desc:"?");
|
iobuf_desc (a, desc));
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
@ -1311,11 +1322,13 @@ iobuf_openrw( const char *fname )
|
|||||||
int
|
int
|
||||||
iobuf_ioctl ( IOBUF a, int cmd, int intval, void *ptrval )
|
iobuf_ioctl ( IOBUF a, int cmd, int intval, void *ptrval )
|
||||||
{
|
{
|
||||||
|
byte desc[MAX_IOBUF_DESC];
|
||||||
|
|
||||||
if ( cmd == 1 ) { /* keep system filepointer/descriptor open */
|
if ( cmd == 1 ) { /* keep system filepointer/descriptor open */
|
||||||
if( DBG_IOBUF )
|
if( DBG_IOBUF )
|
||||||
log_debug("iobuf-%d.%d: ioctl `%s' keep=%d\n",
|
log_debug("iobuf-%d.%d: ioctl `%s' keep=%d\n",
|
||||||
a? a->no:-1, a?a->subno:-1,
|
a? a->no:-1, a?a->subno:-1,
|
||||||
a&&a->desc?a->desc:"?", intval );
|
iobuf_desc (a, desc), intval );
|
||||||
for( ; a; a = a->chain )
|
for( ; a; a = a->chain )
|
||||||
if( !a->chain && a->filter == file_filter ) {
|
if( !a->chain && a->filter == file_filter ) {
|
||||||
file_filter_ctx_t *b = a->filter_ov;
|
file_filter_ctx_t *b = a->filter_ov;
|
||||||
@ -1345,7 +1358,7 @@ iobuf_ioctl ( IOBUF a, int cmd, int intval, void *ptrval )
|
|||||||
if( DBG_IOBUF )
|
if( DBG_IOBUF )
|
||||||
log_debug("iobuf-%d.%d: ioctl `%s' no_cache=%d\n",
|
log_debug("iobuf-%d.%d: ioctl `%s' no_cache=%d\n",
|
||||||
a? a->no:-1, a?a->subno:-1,
|
a? a->no:-1, a?a->subno:-1,
|
||||||
a&&a->desc?a->desc:"?", intval );
|
iobuf_desc (a, desc), intval );
|
||||||
for( ; a; a = a->chain )
|
for( ; a; a = a->chain )
|
||||||
if( !a->chain && a->filter == file_filter ) {
|
if( !a->chain && a->filter == file_filter ) {
|
||||||
file_filter_ctx_t *b = a->filter_ov;
|
file_filter_ctx_t *b = a->filter_ov;
|
||||||
@ -1457,11 +1470,12 @@ iobuf_push_filter2( IOBUF a,
|
|||||||
a->filter_ov_owner = rel_ov;
|
a->filter_ov_owner = rel_ov;
|
||||||
|
|
||||||
a->subno = b->subno + 1;
|
a->subno = b->subno + 1;
|
||||||
f( ov, IOBUFCTRL_DESC, NULL, (byte*)&a->desc, &dummy_len );
|
|
||||||
|
|
||||||
if( DBG_IOBUF ) {
|
if( DBG_IOBUF ) {
|
||||||
|
byte desc[MAX_IOBUF_DESC];
|
||||||
|
|
||||||
log_debug("iobuf-%d.%d: push `%s'\n", a->no, a->subno,
|
log_debug("iobuf-%d.%d: push `%s'\n", a->no, a->subno,
|
||||||
a->desc?a->desc:"?" );
|
iobuf_desc (a, desc));
|
||||||
print_chain( a );
|
print_chain( a );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1482,13 +1496,14 @@ pop_filter( IOBUF a, int (*f)(void *opaque, int control,
|
|||||||
IOBUF b;
|
IOBUF b;
|
||||||
size_t dummy_len=0;
|
size_t dummy_len=0;
|
||||||
int rc=0;
|
int rc=0;
|
||||||
|
byte desc[MAX_IOBUF_DESC];
|
||||||
|
|
||||||
if( a->directfp )
|
if( a->directfp )
|
||||||
BUG();
|
BUG();
|
||||||
|
|
||||||
if( DBG_IOBUF )
|
if( DBG_IOBUF )
|
||||||
log_debug("iobuf-%d.%d: pop `%s'\n", a->no, a->subno,
|
log_debug("iobuf-%d.%d: pop `%s'\n", a->no, a->subno,
|
||||||
a->desc?a->desc:"?" );
|
iobuf_desc (a, desc));
|
||||||
if( !a->filter ) { /* this is simple */
|
if( !a->filter ) { /* this is simple */
|
||||||
b = a->chain;
|
b = a->chain;
|
||||||
assert(b);
|
assert(b);
|
||||||
@ -1563,10 +1578,12 @@ underflow(IOBUF a)
|
|||||||
|
|
||||||
if( a->filter_eof ) {
|
if( a->filter_eof ) {
|
||||||
if( a->chain ) {
|
if( a->chain ) {
|
||||||
|
byte desc[MAX_IOBUF_DESC];
|
||||||
|
|
||||||
IOBUF b = a->chain;
|
IOBUF b = a->chain;
|
||||||
if( DBG_IOBUF )
|
if( DBG_IOBUF )
|
||||||
log_debug("iobuf-%d.%d: pop `%s' in underflow\n",
|
log_debug("iobuf-%d.%d: pop `%s' in underflow\n",
|
||||||
a->no, a->subno, a->desc?a->desc:"?" );
|
a->no, a->subno, iobuf_desc (a, desc) );
|
||||||
xfree(a->d.buf);
|
xfree(a->d.buf);
|
||||||
xfree(a->real_fname);
|
xfree(a->real_fname);
|
||||||
memcpy(a, b, sizeof *a);
|
memcpy(a, b, sizeof *a);
|
||||||
@ -1625,7 +1642,6 @@ underflow(IOBUF a)
|
|||||||
a->filter_ov = NULL;
|
a->filter_ov = NULL;
|
||||||
}
|
}
|
||||||
a->filter = NULL;
|
a->filter = NULL;
|
||||||
a->desc = NULL;
|
|
||||||
a->filter_ov = NULL;
|
a->filter_ov = NULL;
|
||||||
a->filter_eof = 1;
|
a->filter_eof = 1;
|
||||||
if( !len && a->chain ) {
|
if( !len && a->chain ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user