X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=www%2Fwproto.c;fp=www%2Fwproto.c;h=62448aad0e079f7d6dfec26daa149131bc83fb31;hb=5e3100c03c68fd3192bbcef8de7c3b9488b4d3c3;hp=5d3fc3713e9969709dca6393ec52b21896bd549f;hpb=644da8e5a840d868f7b31cf94fea111d0fa43a4a;p=egate.git diff --git a/www/wproto.c b/www/wproto.c index 5d3fc37..62448aa 100644 --- a/www/wproto.c +++ b/www/wproto.c @@ -41,6 +41,11 @@ * USE OR PERFORMANCE OF THIS SOFTWARE. * * $Log: wproto.c,v $ + * Revision 1.22 1997/01/24 13:13:11 adam + * Implemnted egw_source and added a "raw" option to the URL. + * Fixed a bug in the buffering system of wproto; the macro wo_putc could + * override memory if it was the first HTML generating function called. + * * Revision 1.21 1996/05/23 15:53:11 adam * Bug fix: egw_enc failed on 8-bit chars. * New command: egw_parms. @@ -137,6 +142,7 @@ #include #include #include +#include #include "wproto.h" @@ -150,12 +156,9 @@ void wo_write (WCLIENT wc, const char *s, size_t len) { if (wc->outbuffer_offset + len >= wc->outbuffer_size) { - if (!wc->outbuffer) - wc->outbuffer = malloc (wc->outbuffer_size += - ((len >= OUTBUFFER_CHUNK) ? len*2 : OUTBUFFER_CHUNK)); - else - wc->outbuffer = realloc(wc->outbuffer, wc->outbuffer_size += - ((len >= OUTBUFFER_CHUNK) ? len*2 : OUTBUFFER_CHUNK)); + assert (wc->outbuffer); + wc->outbuffer = realloc(wc->outbuffer, wc->outbuffer_size += + ((len >= OUTBUFFER_CHUNK) ? len*2 : OUTBUFFER_CHUNK)); } memcpy(wc->outbuffer + wc->outbuffer_offset, s, len); wc->outbuffer_offset += len; @@ -179,6 +182,8 @@ void wo_printf (WCLIENT wc, const char *fmt, ...) void wo_clear (WCLIENT wc, const char *type) { + if (!wc->outbuffer) + wc->outbuffer = malloc (wc->outbuffer_size = OUTBUFFER_CHUNK); wc->outbuffer_offset = 0; if (type) wo_printf(wc, "Content-type: %s\n\n", type);