diff options
author | Robin Watts <robin.watts@artifex.com> | 2016-09-21 17:12:52 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-09-21 17:17:40 +0100 |
commit | 9dbd14a92f8dd67c2851bccd6fcccb63b1ad1f6e (patch) | |
tree | 10e6d5df1b3b3a0bf72e712a91790bf02612593c /source | |
parent | 33e49c430dc0c14409b5a14fc8df03c2b8e02246 (diff) | |
download | mupdf-9dbd14a92f8dd67c2851bccd6fcccb63b1ad1f6e.tar.xz |
Gproof GS invocation: Only quote profile names if required.
We need to quote profile names if we use system, but not if we
use the GS_API. Update the code to cope.
Diffstat (limited to 'source')
-rw-r--r-- | source/gprf/gprf-doc.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source/gprf/gprf-doc.c b/source/gprf/gprf-doc.c index b6eb2b07..27dd773e 100644 --- a/source/gprf/gprf-doc.c +++ b/source/gprf/gprf-doc.c @@ -546,6 +546,17 @@ generate_page(fz_context *ctx, gprf_page *page) sprintf(nameroot, "gprf_%d_", page->number); filename = fz_tempfilename(ctx, nameroot, doc->gprf_filename); +/* + When invoking gs via the GS API, we need to give the profile + names unquoted. When invoking via system, we need to quote them. + Use a #define to keep the code simple. +*/ +#ifdef USE_GS_API +#define QUOTE +#else +#define QUOTE "\"" +#endif + /* Set up the icc profiles */ if (strlen(doc->display_profile) == 0) { @@ -555,9 +566,9 @@ generate_page(fz_context *ctx, gprf_page *page) } else { - len = sizeof("-sPostRenderProfile=\"\""); /* with quotes */ + len = sizeof("-sPostRenderProfile=" QUOTE QUOTE); /* with quotes */ disp_profile = (char*)fz_malloc(ctx, len + strlen(doc->display_profile) + 1); - sprintf(disp_profile, "-sPostRenderProfile=\"%s\"", doc->display_profile); + sprintf(disp_profile, "-sPostRenderProfile=" QUOTE "%s " QUOTE, doc->display_profile); } if (strlen(doc->print_profile) == 0) @@ -570,7 +581,7 @@ generate_page(fz_context *ctx, gprf_page *page) { len = sizeof("-sOutputICCProfile=\"\""); /* with quotes */ print_profile = (char*)fz_malloc(ctx, len + strlen(doc->print_profile) + 1); - sprintf(print_profile, "-sOutputICCProfile=\"%s\"", doc->print_profile); + sprintf(print_profile, "-sOutputICCProfile=" QUOTE "%s" QUOTE, doc->print_profile); } fz_try(ctx) |