summaryrefslogtreecommitdiff
path: root/content/fetchers/file.c
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/file.c
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/file.c')
-rw-r--r--content/fetchers/file.c21
1 files changed, 14 insertions, 7 deletions
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) {