summaryrefslogtreecommitdiff
path: root/source/gprf
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2017-10-04 21:11:05 +0200
committerTor Andersson <tor.andersson@artifex.com>2017-11-22 23:09:51 +0100
commit5f215d6a077ddfd796740a7db4e725de3ae1bcff (patch)
treef7ce2c055810960048334e4710bd16576e53f834 /source/gprf
parent65996a1ffa6937ae5fa1825ef9cac09927163c1c (diff)
downloadmupdf-5f215d6a077ddfd796740a7db4e725de3ae1bcff.tar.xz
Prefer using fz_snprintf over snprintf.
This way the MuPDF library itself only uses fz_snprintf for consistent formatting.
Diffstat (limited to 'source/gprf')
-rw-r--r--source/gprf/gprf-doc.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/source/gprf/gprf-doc.c b/source/gprf/gprf-doc.c
index 44e5d817..2c508139 100644
--- a/source/gprf/gprf-doc.c
+++ b/source/gprf/gprf-doc.c
@@ -582,7 +582,7 @@ generate_page(fz_context *ctx, gprf_page *page)
int len;
/* put the page file in the same directory as the gproof file */
- sprintf(nameroot, "gprf_%d_", page->number);
+ fz_snprintf(nameroot, sizeof(nameroot), "gprf_%d_", page->number);
filename = fz_tempfilename(ctx, nameroot, doc->gprf_filename);
/*
@@ -601,26 +601,26 @@ generate_page(fz_context *ctx, gprf_page *page)
{
len = sizeof("-sPostRenderProfile=srgb.icc");
disp_profile = (char*)fz_malloc(ctx, len + 1);
- sprintf(disp_profile, "-sPostRenderProfile=srgb.icc");
+ fz_snprintf(disp_profile, sizeof(disp_profile), "-sPostRenderProfile=srgb.icc");
}
else
{
len = sizeof("-sPostRenderProfile=" QUOTE QUOTE); /* with quotes */
disp_profile = (char*)fz_malloc(ctx, len + strlen(doc->display_profile) + 1);
- sprintf(disp_profile, "-sPostRenderProfile=" QUOTE "%s" QUOTE, doc->display_profile);
+ fz_snprintf(disp_profile, sizeof(disp_profile), "-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);
- sprintf(print_profile, "-sOutputICCProfile=default_cmyk.icc");
+ fz_snprintf(print_profile, sizeof(print_profile), "-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);
- sprintf(print_profile, "-sOutputICCProfile=" QUOTE "%s" QUOTE, doc->print_profile);
+ fz_snprintf(print_profile, sizeof(print_profile), "-sOutputICCProfile=" QUOTE "%s" QUOTE, doc->print_profile);
}
fz_try(ctx)
@@ -644,12 +644,12 @@ generate_page(fz_context *ctx, gprf_page *page)
argv[argc++] = "-dFitPage";
argv[argc++] = "-o";
argv[argc++] = filename;
- sprintf(arg_fp, "-dFirstPage=%d", page->number+1);
+ fz_snprintf(arg_fp, sizeof(arg_fp), "-dFirstPage=%d", page->number+1);
argv[argc++] = arg_fp;
- sprintf(arg_lp, "-dLastPage=%d", page->number+1);
+ fz_snprintf(arg_lp, sizeof(arg_lp), "-dLastPage=%d", page->number+1);
argv[argc++] = arg_lp;
argv[argc++] = "-I%rom%Resource/Init/";
- sprintf(arg_g, "-g%dx%d", page->width, page->height);
+ fz_snprintf(arg_g, sizeof(arg_g), "-g%dx%d", page->width, page->height);
argv[argc++] = arg_g;
argv[argc++] = doc->pdf_filename;
assert(argc <= sizeof(argv)/sizeof(*argv));
@@ -676,7 +676,7 @@ generate_page(fz_context *ctx, gprf_page *page)
#else
char gs_command[1024];
/* Invoke gs to convert to a temp file. */
- sprintf(gs_command, "gswin32c.exe -sDEVICE=gprf %s %s -dFitPage -o \"%s\" -dFirstPage=%d -dLastPage=%d -I%%rom%%Resource/Init/ -g%dx%d \"%s\"",
+ fz_snprintf(gs_command, sizeof(gs_command), "gswin32c.exe -sDEVICE=gprf %s %s -dFitPage -o \"%s\" -dFirstPage=%d -dLastPage=%d -I%%rom%%Resource/Init/ -g%dx%d \"%s\"",
print_profile == NULL ? "-dUsePDFX3Profile" : print_profile, disp_profile,
filename, page->number+1, page->number+1, page->width, page->height, doc->pdf_filename);
fz_system(ctx, gs_command);