X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fserv_func.c;h=50dd83b52b9212bfc6bce34ce01b4793b26fe8bf;hb=3395b2dbe9d460d5381497850ed833c60befb746;hp=63d77171724d506af5dd98c4286fba023f1f763e;hpb=7109f3a6da882a149b19e88050153fefca7052b2;p=citadel.git diff --git a/webcit/serv_func.c b/webcit/serv_func.c index 63d771717..50dd83b52 100644 --- a/webcit/serv_func.c +++ b/webcit/serv_func.c @@ -438,14 +438,12 @@ void server_to_text() * server READ commands. * \return the read content as StrBuf */ -int read_server_binary(StrBuf *Ret, size_t total_len) +int read_server_binary(StrBuf *Ret, size_t total_len, StrBuf *Buf) { char buf[SIZ]; size_t bytes = 0; size_t thisblock = 0; - StrBuf *Buf; - Buf = NewStrBuf(); if (Ret == NULL) return -1; @@ -460,18 +458,18 @@ int read_server_binary(StrBuf *Ret, size_t total_len) } } serv_printf("READ %d|%d", (int)bytes, (int)thisblock); - if (StrBuf_ServGetln(Buf) > 0) + if (StrBuf_ServGetlnBuffered(Buf) > 0) { if (GetServerStatus(Buf, NULL) == 6) { - StrBufCutLeft(Buf, 4); /*/ TODO : thisblock = (size_t)atoi(&buf[4]); */ + StrBufCutLeft(Buf, 4); thisblock = StrTol(Buf); if (!WC->connected) { FlushStrBuf(Ret); FreeStrBuf(&Buf); return -1; } - StrBuf_ServGetBLOB(Ret, thisblock); + StrBuf_ServGetBLOBBuffered(Ret, thisblock); bytes += thisblock; } else { @@ -481,7 +479,6 @@ int read_server_binary(StrBuf *Ret, size_t total_len) } } } - FreeStrBuf(&Buf); return StrLength(Ret); }