summaryrefslogtreecommitdiff
path: root/source/tools
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-04-01 12:34:30 +0200
committerTor Andersson <tor.andersson@artifex.com>2015-04-01 12:51:32 +0200
commit1977a47d0a72f470539be8e6bb6d6e321ce44770 (patch)
tree3c49a2976bd9f5af88b49cb47339afd7fa0c9203 /source/tools
parent485058dbc22c2b181bd044bae9721224f016d568 (diff)
downloadmupdf-1977a47d0a72f470539be8e6bb6d6e321ce44770.tar.xz
Fix scan for %d in mudraw.
Diffstat (limited to 'source/tools')
-rw-r--r--source/tools/mudraw.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c
index 03e7d404..60d4223b 100644
--- a/source/tools/mudraw.c
+++ b/source/tools/mudraw.c
@@ -212,6 +212,22 @@ static int isrange(char *s)
return 1;
}
+static int has_percent_d(char *s)
+{
+ /* find '%[0-9]*d' */
+ while (*s)
+ {
+ if (*s++ == '%')
+ {
+ while (*s >= '0' && *s <= '9')
+ ++s;
+ if (*s == 'd')
+ return 1;
+ }
+ }
+ return 0;
+}
+
static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
{
fz_page *page;
@@ -590,7 +606,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
fz_output_png_band(ctx, output_file, pix->w, totalheight, pix->n, band, drawheight, pix->samples, savealpha, poc);
else if (output_format == OUT_PWG)
{
- if (strstr(output, "%d") != NULL)
+ if (has_percent_d(output))
append = 0;
if (out_cs == CS_MONO)
{
@@ -608,7 +624,7 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
fz_pcl_preset(ctx, &options, "ljet4");
- if (strstr(output, "%d") != NULL)
+ if (has_percent_d(output))
append = 0;
if (out_cs == CS_MONO)
{