summaryrefslogtreecommitdiff
path: root/content/fetchers
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2016-03-17 21:55:12 +0000
committerVincent Sanders <vince@kyllikki.org>2016-03-17 22:00:54 +0000
commitd15ab96a51287469082e8d9068e2608a386f9e5f (patch)
tree346fb22044567be929d9f0dc47f62732f4633815 /content/fetchers
parent232cda5317ae39d54852f741fbbd09c9618143cd (diff)
downloadnetsurf-d15ab96a51287469082e8d9068e2608a386f9e5f.tar.gz
netsurf-d15ab96a51287469082e8d9068e2608a386f9e5f.tar.bz2
Fix size_t printf formatting
The printf formatting for size_t is set in c99 as %zu but in windows it is %Iu this is solved by adding and inttypes style PRI macro for size_t This also uses this macro everywhere size_t is formatted.
Diffstat (limited to 'content/fetchers')
-rw-r--r--content/fetchers/data.c7
-rw-r--r--content/fetchers/file.c21
-rw-r--r--content/fetchers/resource.c20
3 files changed, 30 insertions, 18 deletions
diff --git a/content/fetchers/data.c b/content/fetchers/data.c
index 00494ccc7..6c18911e2 100644
--- a/content/fetchers/data.c
+++ b/content/fetchers/data.c
@@ -263,7 +263,8 @@ static void fetch_data_poll(lwc_string *scheme)
char header[64];
fetch_set_http_code(c->parent_fetch, 200);
- LOG("setting data: MIME type to %s, length to %zd", c->mimetype, c->datalen);
+ LOG("setting data: MIME type to %s, length to %" PRIsizet,
+ c->mimetype, c->datalen);
/* Any callback can result in the fetch being aborted.
* Therefore, we _must_ check for this after _every_
* call to fetch_data_send_callback().
@@ -277,8 +278,8 @@ static void fetch_data_poll(lwc_string *scheme)
if (c->aborted == false) {
snprintf(header, sizeof header,
- "Content-Length: %"SSIZET_FMT,
- c->datalen);
+ "Content-Length: %" PRIsizet,
+ c->datalen);
msg.type = FETCH_HEADER;
msg.data.header_or_data.buf =
(const uint8_t *) header;
diff --git a/content/fetchers/file.c b/content/fetchers/file.c
index d42e92a5b..c2f8bed2f 100644
--- a/content/fetchers/file.c
+++ b/content/fetchers/file.c
@@ -313,18 +313,21 @@ static void fetch_file_process_plain(struct fetch_file_context *ctx,
/* content type */
if (fetch_file_send_header(ctx, "Content-Type: %s",
- guit->fetch->filetype(ctx->path)))
+ guit->fetch->filetype(ctx->path))) {
goto fetch_file_process_aborted;
+ }
/* content length */
- if (fetch_file_send_header(ctx, "Content-Length: %"SSIZET_FMT, fdstat->st_size))
+ if (fetch_file_send_header(ctx, "Content-Length: %" PRIsizet,
+ fdstat->st_size)) {
goto fetch_file_process_aborted;
+ }
/* create etag */
if (fetch_file_send_header(ctx, "ETag: \"%10" PRId64 "\"",
- (int64_t) fdstat->st_mtime))
+ (int64_t) fdstat->st_mtime)) {
goto fetch_file_process_aborted;
-
+ }
msg.type = FETCH_DATA;
msg.data.header_or_data.buf = (const uint8_t *) buf;
@@ -393,17 +396,21 @@ fetch_file_process_aborted:
/* content type */
if (fetch_file_send_header(ctx, "Content-Type: %s",
- guit->fetch->filetype(ctx->path)))
+ guit->fetch->filetype(ctx->path))) {
goto fetch_file_process_aborted;
+ }
/* content length */
- if (fetch_file_send_header(ctx, "Content-Length: %"SSIZET_FMT, fdstat->st_size))
+ if (fetch_file_send_header(ctx, "Content-Length: %" PRIsizet,
+ fdstat->st_size)) {
goto fetch_file_process_aborted;
+ }
/* create etag */
if (fetch_file_send_header(ctx, "ETag: \"%10" PRId64 "\"",
- (int64_t) fdstat->st_mtime))
+ (int64_t) fdstat->st_mtime)) {
goto fetch_file_process_aborted;
+ }
/* main data loop */
while (tot_read < fdstat->st_size) {
diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c
index 6472dc506..7a55b54ed 100644
--- a/content/fetchers/resource.c
+++ b/content/fetchers/resource.c
@@ -16,7 +16,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/* resource: URL handling. Based on the data fetcher by Rob Kendrick */
+/**
+ * \file
+ * resource scheme URL handling. Based on the data fetcher by Rob Kendrick
+ */
#include <sys/types.h>
#include <sys/stat.h>
@@ -187,20 +190,21 @@ static bool fetch_resource_data_handler(struct fetch_resource_context *ctx)
/* content type */
if (fetch_resource_send_header(ctx, "Content-Type: %s",
- guit->fetch->filetype(lwc_string_data(ctx->entry->path))))
+ guit->fetch->filetype(lwc_string_data(ctx->entry->path)))) {
goto fetch_resource_data_aborted;
+ }
/* content length */
- if (fetch_resource_send_header(ctx,
- "Content-Length: %"SSIZET_FMT,
- ctx->entry->data_len))
+ if (fetch_resource_send_header(ctx, "Content-Length: %" PRIsizet,
+ ctx->entry->data_len)) {
goto fetch_resource_data_aborted;
+ }
/* create etag */
- if (fetch_resource_send_header(ctx,
- "ETag: \"%10" PRId64 "\"",
- (int64_t) DIRECT_ETAG_VALUE))
+ if (fetch_resource_send_header(ctx, "ETag: \"%10" PRId64 "\"",
+ (int64_t) DIRECT_ETAG_VALUE)) {
goto fetch_resource_data_aborted;
+ }
msg.type = FETCH_DATA;