summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-04-24 13:45:29 +0200
committerTor Andersson <tor.andersson@artifex.com>2017-04-27 15:11:37 +0200
commit4fe64a86f24b4aa5cb92f35fe025200cf42144ea (patch)
tree2c9abd8613df7ca07f669f71168bb6b9d60bacbe /source
parent99278e762603380638ad037094a955312013e94c (diff)
downloadmupdf-4fe64a86f24b4aa5cb92f35fe025200cf42144ea.tar.xz
Use fz_snprintf.
Diffstat (limited to 'source')
-rw-r--r--source/fitz/output-pcl.c4
-rw-r--r--source/pdf/pdf-annot-edit.c2
-rw-r--r--source/pdf/pdf-cmap-load.c5
-rw-r--r--source/pdf/pdf-portfolio.c2
-rw-r--r--source/xps/xps-zip.c8
5 files changed, 12 insertions, 9 deletions
diff --git a/source/fitz/output-pcl.c b/source/fitz/output-pcl.c
index e26b8c34..99cc819f 100644
--- a/source/fitz/output-pcl.c
+++ b/source/fitz/output-pcl.c
@@ -345,7 +345,7 @@ make_init(fz_pcl_options *pcl, char *buf, unsigned long len, const char *str, in
{
int paper_source = -1;
- snprintf(buf, len, str, res);
+ fz_snprintf(buf, len, str, res);
if (pcl->manual_feed_set && pcl->manual_feed)
paper_source = 2;
@@ -354,7 +354,7 @@ make_init(fz_pcl_options *pcl, char *buf, unsigned long len, const char *str, in
if (paper_source >= 0)
{
char buf2[40];
- snprintf(buf2, sizeof(buf2), "\033&l%dH", paper_source);
+ fz_snprintf(buf2, sizeof(buf2), "\033&l%dH", paper_source);
strncat(buf, buf2, len);
}
}
diff --git a/source/pdf/pdf-annot-edit.c b/source/pdf/pdf-annot-edit.c
index c1351d7c..1dc14ac2 100644
--- a/source/pdf/pdf-annot-edit.c
+++ b/source/pdf/pdf-annot-edit.c
@@ -689,7 +689,7 @@ static void find_free_font_name(fz_context *ctx, pdf_obj *fdict, char *buf, int
/* Find a number X such that /FX doesn't occur as a key in fdict */
for (i = 0; 1; i++)
{
- snprintf(buf, buf_size, "F%d", i);
+ fz_snprintf(buf, buf_size, "F%d", i);
if (!pdf_dict_gets(ctx, fdict, buf))
break;
diff --git a/source/pdf/pdf-cmap-load.c b/source/pdf/pdf-cmap-load.c
index 87b1c282..d73749cd 100644
--- a/source/pdf/pdf-cmap-load.c
+++ b/source/pdf/pdf-cmap-load.c
@@ -89,7 +89,10 @@ pdf_new_identity_cmap(fz_context *ctx, int wmode, int bytes)
fz_try(ctx)
{
unsigned int high = (1 << (bytes * 8)) - 1;
- sprintf(cmap->cmap_name, "Identity-%c", wmode ? 'V' : 'H');
+ if (wmode)
+ fz_strlcpy(cmap->cmap_name, "Identity-V", sizeof cmap->cmap_name);
+ else
+ fz_strlcpy(cmap->cmap_name, "Identity-H", sizeof cmap->cmap_name);
pdf_add_codespace(ctx, cmap, 0, high, bytes);
pdf_map_range_to_range(ctx, cmap, 0, high, 0);
pdf_sort_cmap(ctx, cmap);
diff --git a/source/pdf/pdf-portfolio.c b/source/pdf/pdf-portfolio.c
index 44201b41..9235880c 100644
--- a/source/pdf/pdf-portfolio.c
+++ b/source/pdf/pdf-portfolio.c
@@ -311,7 +311,7 @@ void pdf_add_portfolio_schema(fz_context *ctx, pdf_document *doc, int entry, con
pdf_drop_obj(ctx, num_name);
num_name = NULL;
num++;
- sprintf(str_name, "%d", num);
+ fz_snprintf(str_name, sizeof str_name, "%d", num);
num_name = pdf_new_name(ctx, doc, str_name);
p = doc->portfolio;
for (p = doc->portfolio; p; p = p->next)
diff --git a/source/xps/xps-zip.c b/source/xps/xps-zip.c
index fe363b34..0e8d8edc 100644
--- a/source/xps/xps-zip.c
+++ b/source/xps/xps-zip.c
@@ -62,7 +62,7 @@ xps_read_part(fz_context *ctx, xps_document *doc, char *partname)
seen_last = 0;
for (count = 0; !seen_last; ++count)
{
- sprintf(path, "%s/[%d].piece", name, count);
+ fz_snprintf(path, sizeof path, "%s/[%d].piece", name, count);
if (fz_has_archive_entry(ctx, zip, path))
{
tmp = fz_read_archive_entry(ctx, zip, path);
@@ -71,7 +71,7 @@ xps_read_part(fz_context *ctx, xps_document *doc, char *partname)
}
else
{
- sprintf(path, "%s/[%d].last.piece", name, count);
+ fz_snprintf(path, sizeof path, "%s/[%d].last.piece", name, count);
if (fz_has_archive_entry(ctx, zip, path))
{
tmp = fz_read_archive_entry(ctx, zip, path);
@@ -99,10 +99,10 @@ xps_has_part(fz_context *ctx, xps_document *doc, char *name)
name++;
if (fz_has_archive_entry(ctx, doc->zip, name))
return 1;
- sprintf(buf, "%s/[0].piece", name);
+ fz_snprintf(buf, sizeof buf, "%s/[0].piece", name);
if (fz_has_archive_entry(ctx, doc->zip, buf))
return 1;
- sprintf(buf, "%s/[0].last.piece", name);
+ fz_snprintf(buf, sizeof buf, "%s/[0].last.piece", name);
if (fz_has_archive_entry(ctx, doc->zip, buf))
return 1;
return 0;