summaryrefslogtreecommitdiff
path: root/source/pdf
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-05-06 19:25:45 +0100
committerRobin Watts <robin.watts@artifex.com>2016-05-06 19:26:36 +0100
commit336a0ba8fb31a674e9b2bb7e25aa672a603bb925 (patch)
tree49165becadc6134eaa3b2b2550379249850d0a4e /source/pdf
parent53d94f4c7142c496858f913f248cf5e1b685d50f (diff)
downloadmupdf-336a0ba8fb31a674e9b2bb7e25aa672a603bb925.tar.xz
Fix pdf_delete_page_range.
And improve the header file commenting.
Diffstat (limited to 'source/pdf')
-rw-r--r--source/pdf/pdf-page.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/pdf/pdf-page.c b/source/pdf/pdf-page.c
index 088cf0d2..9fa96261 100644
--- a/source/pdf/pdf-page.c
+++ b/source/pdf/pdf-page.c
@@ -623,8 +623,17 @@ pdf_delete_page(fz_context *ctx, pdf_document *doc, int at)
void
pdf_delete_page_range(fz_context *ctx, pdf_document *doc, int start, int end)
{
+ int count = pdf_count_pages(ctx, doc);
+
+ if (end < 0 || end > count)
+ end = count+1;
+ if (start < 0)
+ start = 0;
while (start < end)
- pdf_delete_page(ctx, doc, start++);
+ {
+ pdf_delete_page(ctx, doc, start);
+ end--;
+ }
}
pdf_obj *