diff options
author | Sebastian Rasmussen <sebras@gmail.com> | 2018-09-02 19:32:02 +0800 |
---|---|---|
committer | Sebastian Rasmussen <sebras@gmail.com> | 2018-09-04 18:23:31 +0800 |
commit | 302f4e412703333fa02618ca119efc1f0a35142e (patch) | |
tree | 8416ade949ce3e87d149c80916b1d5fd8ce47e07 /source/gprf | |
parent | 8cd5b5203eb4468071d2be89d8bdd3dc71de14dd (diff) | |
download | mupdf-302f4e412703333fa02618ca119efc1f0a35142e.tar.xz |
Fix string handling when using gproof files.
Diffstat (limited to 'source/gprf')
-rw-r--r-- | source/gprf/gprf-doc.c | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/source/gprf/gprf-doc.c b/source/gprf/gprf-doc.c index 18aea342..eda94041 100644 --- a/source/gprf/gprf-doc.c +++ b/source/gprf/gprf-doc.c @@ -607,30 +607,14 @@ generate_page(fz_context *ctx, gprf_page *page) /* Set up the icc profiles */ if (strlen(doc->display_profile) == 0) - { - len = sizeof("-sPostRenderProfile=srgb.icc"); - disp_profile = (char*)fz_malloc(ctx, len + 1); - fz_snprintf(disp_profile, sizeof(disp_profile), "-sPostRenderProfile=srgb.icc"); - } + disp_profile = fz_asprintf(ctx, "-sPostRenderProfile=srgb.icc"); else - { - len = sizeof("-sPostRenderProfile=" QUOTE QUOTE); /* with quotes */ - disp_profile = (char*)fz_malloc(ctx, len + strlen(doc->display_profile) + 1); - fz_snprintf(disp_profile, sizeof(disp_profile), "-sPostRenderProfile=" QUOTE "%s" QUOTE, doc->display_profile); - } + disp_profile = fz_asprintf(ctx, "-sPostRenderProfile=" QUOTE "%s" QUOTE, doc->display_profile); if (strlen(doc->print_profile) == 0) - { - len = sizeof("-sOutputICCProfile=default_cmyk.icc"); - print_profile = (char*)fz_malloc(ctx, len + 1); - fz_snprintf(print_profile, sizeof(print_profile), "-sOutputICCProfile=default_cmyk.icc"); - } + print_profile = fz_asprintf(ctx, "-sOutputICCProfile=default_cmyk.icc"); else if (strcmp(doc->print_profile, "<EMBEDDED>") != 0) - { - len = sizeof("-sOutputICCProfile=" QUOTE QUOTE); /* with quotes */ - print_profile = (char*)fz_malloc(ctx, len + strlen(doc->print_profile) + 1); - fz_snprintf(print_profile, sizeof(print_profile), "-sOutputICCProfile=" QUOTE "%s" QUOTE, doc->print_profile); - } + print_profile = fz_asprintf(ctx, "-sOutputICCProfile=" QUOTE "%s" QUOTE, doc->print_profile); fz_try(ctx) { |