summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-10-05 15:45:15 +0100
committerRobin Watts <robin.watts@artifex.com>2012-10-05 16:01:31 +0100
commita69de004951ca1e8157497c550ec41989a3cc72e (patch)
treee7b56a781d49b6a1bdea101f10858772c40d9038
parent5c6a6b95b45c10d399fa26f7fbc474d5f5052668 (diff)
downloadmupdf-a69de004951ca1e8157497c550ec41989a3cc72e.tar.xz
Bug 693346: Fix calculation of progress_max
As zeniko points out, pointer arithmetic is pointless on a linked list. Keep a count of the length in the list header.
-rw-r--r--fitz/dev_list.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fitz/dev_list.c b/fitz/dev_list.c
index 560fb5c6..e49f694b 100644
--- a/fitz/dev_list.c
+++ b/fitz/dev_list.c
@@ -52,6 +52,7 @@ struct fz_display_list_s
{
fz_display_node *first;
fz_display_node *last;
+ int len;
int top;
struct {
@@ -173,6 +174,7 @@ fz_append_display_node(fz_display_list *list, fz_display_node *node)
list->last->next = node;
list->last = node;
}
+ list->len++;
}
static void
@@ -562,6 +564,7 @@ fz_new_display_list(fz_context *ctx)
fz_display_list *list = fz_malloc_struct(ctx, fz_display_list);
list->first = NULL;
list->last = NULL;
+ list->len = 0;
list->top = 0;
list->tiled = 0;
return list;
@@ -599,7 +602,7 @@ fz_run_display_list(fz_display_list *list, fz_device *dev, fz_matrix top_ctm, fz
if (cookie)
{
- cookie->progress_max = list->last - list->first;
+ cookie->progress_max = list->len;
cookie->progress = 0;
}