[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 03/04: http_chunked_compression example: cl
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 03/04: http_chunked_compression example: clarify and improve readability |
Date: |
Sat, 18 May 2019 12:45:44 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 84905a4df0448257e846e97eeed8a4d4f3e275bc
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Sat May 18 13:30:07 2019 +0300
http_chunked_compression example: clarify and improve readability
---
src/examples/http_chunked_compression.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/examples/http_chunked_compression.c
b/src/examples/http_chunked_compression.c
index 7ccd535e..6c55ef5f 100644
--- a/src/examples/http_chunked_compression.c
+++ b/src/examples/http_chunked_compression.c
@@ -88,30 +88,32 @@ read_cb (void *cls, uint64_t pos, char *mem, size_t size)
struct Holder *holder = cls;
void *src;
void *buf;
+ ssize_t ret;
src = malloc (size);
if (NULL == src)
return MHD_CONTENT_READER_END_WITH_ERROR;
- size = fread (src, 1, size, holder->file);
- if ((ssize_t) size < 0)
+ ret = fread (src, 1, size, holder->file);
+ if (ret < 0)
{
- size = MHD_CONTENT_READER_END_WITH_ERROR;
+ ret = MHD_CONTENT_READER_END_WITH_ERROR;
goto done;
}
if (0 == size)
{
- size = MHD_CONTENT_READER_END_OF_STREAM;
+ ret = MHD_CONTENT_READER_END_OF_STREAM;
goto done;
}
- if (MHD_YES != compress_buf (&holder->stream, src, size, &pos, &buf, &size,
holder->buf))
- size = MHD_CONTENT_READER_END_WITH_ERROR;
+ if (MHD_YES != compress_buf (&holder->stream, src, ret, &pos, &buf, &size,
holder->buf))
+ ret = MHD_CONTENT_READER_END_WITH_ERROR;
else
{
memcpy (mem, buf, size);
+ ret = size;
}
free (buf); /* Buf may be set even on error return. */
done:
free (src);
- return size;
+ return ret;
}
static void
--
To stop receiving notification emails like this one, please contact
address@hidden