summaryrefslogtreecommitdiff
path: root/platform/x11
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-08-17 15:01:09 +0200
committerTor Andersson <tor.andersson@artifex.com>2017-11-01 13:08:56 +0100
commitf595e889b91a674eb94db7ca4d832da54f5194cd (patch)
tree273b4a7cc465477e428d0c628a19a61301baaae0 /platform/x11
parent2910531c99e80bede06d2f1460459e8f6ce79961 (diff)
downloadmupdf-f595e889b91a674eb94db7ca4d832da54f5194cd.tar.xz
Use int64_t for public file API offsets.
Don't mess with conditional compilation with LARGEFILE -- always expose 64-bit file offsets in our public API.
Diffstat (limited to 'platform/x11')
-rw-r--r--platform/x11/curl_stream.c14
-rw-r--r--platform/x11/pdfapp.c8
-rw-r--r--platform/x11/win_main.c4
3 files changed, 15 insertions, 11 deletions
diff --git a/platform/x11/curl_stream.c b/platform/x11/curl_stream.c
index db5a1413..e70607d5 100644
--- a/platform/x11/curl_stream.c
+++ b/platform/x11/curl_stream.c
@@ -324,7 +324,7 @@ stream_next(fz_context *ctx, fz_stream *stream, size_t len)
{
curl_stream_state *state = (curl_stream_state *)stream->state;
size_t len_read = 0;
- fz_off_t read_point = stream->pos;
+ int64_t read_point = stream->pos;
int block = read_point>>BLOCK_SHIFT;
size_t left_over = (-read_point) & (BLOCK_SIZE-1);
unsigned char *buf = state->public_buffer;
@@ -336,7 +336,7 @@ stream_next(fz_context *ctx, fz_stream *stream, size_t len)
len = sizeof(state->public_buffer);
if (state->content_length == 0)
- fz_throw(ctx, FZ_ERROR_TRYLATER, "read of a block we don't have (A) (offset=%d)", read_point);
+ fz_throw(ctx, FZ_ERROR_TRYLATER, "read of a block we don't have (A) (offset=%ld)", read_point);
if (state->map == NULL)
{
@@ -345,7 +345,7 @@ stream_next(fz_context *ctx, fz_stream *stream, size_t len)
if (read_point + len > state->current_fill_point)
{
stream->rp = stream->wp;
- fz_throw(ctx, FZ_ERROR_TRYLATER, "read of a block we don't have (B) (offset=%d)", read_point);
+ fz_throw(ctx, FZ_ERROR_TRYLATER, "read of a block we don't have (B) (offset=%ld)", read_point);
}
memcpy(buf, state->buffer + read_point, len);
stream->rp = buf;
@@ -370,7 +370,7 @@ stream_next(fz_context *ctx, fz_stream *stream, size_t len)
state->fill_point = block;
unlock(state);
stream->rp = stream->wp;
- fz_throw(ctx, FZ_ERROR_TRYLATER, "read of a block we don't have (C) (offset=%d)", read_point);
+ fz_throw(ctx, FZ_ERROR_TRYLATER, "read of a block we don't have (C) (offset=%ld)", read_point);
}
block++;
if (left_over > len)
@@ -391,7 +391,7 @@ stream_next(fz_context *ctx, fz_stream *stream, size_t len)
state->fill_point = block;
unlock(state);
stream->rp = stream->wp;
- fz_throw(ctx, FZ_ERROR_TRYLATER, "read of a block we don't have (D) (offset=%d)", read_point);
+ fz_throw(ctx, FZ_ERROR_TRYLATER, "read of a block we don't have (D) (offset=%ld)", read_point);
}
block++;
memcpy(buf, state->buffer + read_point, BLOCK_SIZE);
@@ -410,7 +410,7 @@ stream_next(fz_context *ctx, fz_stream *stream, size_t len)
state->fill_point = block;
unlock(state);
stream->rp = stream->wp;
- fz_throw(ctx, FZ_ERROR_TRYLATER, "read of a block we don't have (E) (offset=%d)", read_point);
+ fz_throw(ctx, FZ_ERROR_TRYLATER, "read of a block we don't have (E) (offset=%ld)", read_point);
}
memcpy(buf, state->buffer + read_point, len);
len_read += len;
@@ -456,7 +456,7 @@ static curl_stream_state hack;
static int hack_pos;
static void
-stream_seek(fz_context *ctx, fz_stream *stream, fz_off_t offset, int whence)
+stream_seek(fz_context *ctx, fz_stream *stream, int64_t offset, int whence)
{
curl_stream_state *state = (curl_stream_state *)stream->state;
diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c
index 3fffd4ef..a5c524b4 100644
--- a/platform/x11/pdfapp.c
+++ b/platform/x11/pdfapp.c
@@ -520,7 +520,7 @@ static int gen_tmp_file(char *buf, int len)
for (i = 0; i < 10000; i++)
{
FILE *f;
- snprintf(name, buf+len-name, "tmp%04d", i);
+ sprintf(name, "tmp%04d", i);
f = fopen(buf, "r");
if (f == NULL)
return 1;
@@ -903,9 +903,9 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai
len = MAX_TITLE-strlen(buf2);
if (strlen(app->doctitle) > len)
{
- snprintf(buf, len-3, "%s", app->doctitle);
- strcat(buf, "...");
- strcat(buf, buf2);
+ fz_strlcpy(buf, app->doctitle, len-3);
+ fz_strlcat(buf, "...", MAX_TITLE);
+ fz_strlcat(buf, buf2, MAX_TITLE);
}
else
sprintf(buf, "%s%s", app->doctitle, buf2);
diff --git a/platform/x11/win_main.c b/platform/x11/win_main.c
index 67efdb9d..877f8c73 100644
--- a/platform/x11/win_main.c
+++ b/platform/x11/win_main.c
@@ -12,6 +12,10 @@
/* Include pdfapp.h *AFTER* the UNICODE defines */
#include "pdfapp.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020A
#endif