Improved performance of message part extraction when using a PHP-space

callback.
This commit is contained in:
Wez Furlong 2001-05-28 10:57:23 +00:00
parent 7d52787a96
commit 2bdef9c83f
2 changed files with 16 additions and 3 deletions

View File

@ -195,6 +195,12 @@ char *rfc2045_content_base(struct rfc2045 *p);
char *rfc2045_append_url(const char *, const char *);
/* Do this with two arbitrary URLs */
void rfc2045_add_workbuf(struct rfc2045 *h, const char *p, size_t len);
void rfc2045_add_workbufch(struct rfc2045 *h, int c);
#ifdef __cplusplus
}
#endif

View File

@ -10,10 +10,15 @@
static int op_func(int c, void *dat)
{
unsigned char C = (unsigned char)c;
struct rfc2045 * p = (struct rfc2045*)dat;
(*p->udecode_func)(&C, 1, p->misc_decode_ptr);
rfc2045_add_workbufch(p, c);
/* drain buffer */
if (p->workbuflen >= 4096) {
(*p->udecode_func)(p->workbuf, p->workbuflen, p->misc_decode_ptr);
p->workbuflen = 0;
}
return c;
}
@ -57,6 +62,8 @@ int rfc2045_cdecode_end(struct rfc2045 *p)
mbfl_convert_filter_flush(p->decode_filter);
mbfl_convert_filter_delete(p->decode_filter);
p->decode_filter = NULL;
if (p->workbuflen > 0)
(*p->udecode_func)(p->workbuf, p->workbuflen, p->misc_decode_ptr);
}
return 0;
}