diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2012-05-09 22:42:27 +0200 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-05-10 13:38:25 +0100 |
commit | b0beab3eecdb1681f5fb8a163278803aad852b81 (patch) | |
tree | 3edb033c6d7e92e38e4c31d6394d9a357fac6ea6 /apps/mudraw.c | |
parent | 2d6f26cd8b09523fa29d97436801c27bec1832f4 (diff) | |
download | mupdf-b0beab3eecdb1681f5fb8a163278803aad852b81.tar.xz |
Clamp page numbers given to mupdfclean.
Also make page specification parsing in all tools look similar.
Diffstat (limited to 'apps/mudraw.c')
-rw-r--r-- | apps/mudraw.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/mudraw.c b/apps/mudraw.c index 8a9ae97f..147e9181 100644 --- a/apps/mudraw.c +++ b/apps/mudraw.c @@ -368,17 +368,17 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum) static void drawrange(fz_context *ctx, fz_document *doc, char *range) { - int page, spage, epage, final; + int page, spage, epage, pagecount; char *spec, *dash; - final = fz_count_pages(doc); + pagecount = fz_count_pages(doc); spec = fz_strsep(&range, ","); while (spec) { dash = strchr(spec, '-'); if (dash == spec) - spage = epage = final; + spage = epage = pagecount; else spage = epage = atoi(spec); @@ -387,11 +387,11 @@ static void drawrange(fz_context *ctx, fz_document *doc, char *range) if (strlen(dash) > 1) epage = atoi(dash + 1); else - epage = final; + epage = pagecount; } - spage = CLAMP(spage, 1, final); - epage = CLAMP(epage, 1, final); + spage = CLAMP(spage, 1, pagecount); + epage = CLAMP(epage, 1, pagecount); if (spage < epage) for (page = spage; page <= epage; page++) |