summaryrefslogtreecommitdiff
path: root/pcl
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2022-02-16 14:55:26 +0000
committerChris Liddell <chris.liddell@artifex.com>2022-02-16 15:17:24 +0000
commit34ad543a8b1cb407b222777582ca5793fd822fd2 (patch)
treeefe5805d11b46b0c115ed3224295cfe706c283d9 /pcl
parente1138358702082567ee04fabb8645cb0a69e5a93 (diff)
downloadghostpdl-34ad543a8b1cb407b222777582ca5793fd822fd2.tar.gz
Move pcl/ sources away from gs_sprintf to gs_snprintf
Diffstat (limited to 'pcl')
-rw-r--r--pcl/pcl/pcfontpg.c6
-rw-r--r--pcl/pcl/pcht.c4
-rw-r--r--pcl/pcl/pcstatus.c10
-rw-r--r--pcl/pl/pjparse.c2
-rw-r--r--pcl/pl/plmain.c4
-rw-r--r--pcl/pxl/pxerrors.c16
-rw-r--r--pcl/pxl/pxfont.c4
-rw-r--r--pcl/pxl/pxpthr.c6
8 files changed, 26 insertions, 26 deletions
diff --git a/pcl/pcl/pcfontpg.c b/pcl/pcl/pcfontpg.c
index e16275dc1..d583ed05c 100644
--- a/pcl/pcl/pcfontpg.c
+++ b/pcl/pcl/pcfontpg.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2021 Artifex Software, Inc.
+/* Copyright (C) 2001-2022 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -78,7 +78,7 @@ process_font(pcl_state_t * pcs, pl_font_t * fp)
/* reset to default font and print the select font string and pjl number */
/* create the string command for font selection */
- gs_sprintf(buff, "<esc>(%u<esc>(s%dp%uv%us%db%dT\n",
+ gs_snprintf(buff, sizeof(buff), "<esc>(%u<esc>(s%dp%uv%us%db%dT\n",
pfp->symbol_set, (pfp->proportional_spacing ? 1 : 0),
pfp->height_4ths / 10, pfp->style, pfp->stroke_weight,
pfp->typeface_family);
@@ -95,7 +95,7 @@ process_font(pcl_state_t * pcs, pl_font_t * fp)
false, false);
if (code < 0)
return gs_rethrow(code, "failed to set cap x\n");
- gs_sprintf(buff, "%d", fp->params.pjl_font_number);
+ gs_snprintf(buff, sizeof(buff), "%d", fp->params.pjl_font_number);
code = pcl_text((byte *) buff, strlen(buff), pcs, false);
if (code < 0)
diff --git a/pcl/pcl/pcht.c b/pcl/pcl/pcht.c
index 474fef548..e9b486894 100644
--- a/pcl/pcl/pcht.c
+++ b/pcl/pcl/pcht.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2021 Artifex Software, Inc.
+/* Copyright (C) 2001-2022 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -1512,7 +1512,7 @@ pcl_ht_init_render_methods(pcl_state_t * pcs, gs_memory_t * pmem)
if ((pcs->rendering_info[i].flags & HT_FIXED) != 0)
continue;
gs_c_param_list_write(&list, pmem);
- gs_sprintf(nbuff, "Dither_%d", i);
+ gs_snprintf(nbuff, sizeof(nbuff), "Dither_%d", i);
if ((param_request((gs_param_list *) & list, nbuff) >= 0) &&
(gs_getdeviceparams(pcur_dev, (gs_param_list *) & list) >= 0)) {
gs_param_dict dict;
diff --git a/pcl/pcl/pcstatus.c b/pcl/pcl/pcstatus.c
index 75b020364..0bc9ba345 100644
--- a/pcl/pcl/pcstatus.c
+++ b/pcl/pcl/pcstatus.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2021 Artifex Software, Inc.
+/* Copyright (C) 2001-2022 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -141,7 +141,7 @@ status_print_idlist(stream * s, const ushort * idlist, int nid,
n = idlist[i] >> 6;
l = (idlist[i] & 077) + 'A' - 1;
- gs_sprintf(idstr, "%d%c", n, l);
+ gs_snprintf(idstr, sizeof(idstr), "%d%c", n, l);
status_put_id(s, title, idstr);
}
status_end_id_list(s);
@@ -377,7 +377,7 @@ status_macros(stream * s, pcl_state_t * pcs, pcl_data_storage_t storage)
if (((pcl_macro_t *) value)->storage & storage) {
char id_string[6];
- gs_sprintf(id_string, "%u", (key.data[0] << 8) + key.data[1]);
+ gs_snprintf(id_string, sizeof(id_string), "%u", (key.data[0] << 8) + key.data[1]);
status_put_id(s, "IDLIST", id_string);
}
status_end_id_list(s);
@@ -399,7 +399,7 @@ status_patterns(stream * s, pcl_state_t * pcs, pcl_data_storage_t storage)
if ((pptrn != 0) && (pcs->pattern_type == pcl_pattern_user_defined)) {
char id_string[6];
- gs_sprintf(id_string, "%u", id);
+ gs_snprintf(id_string, sizeof(id_string), "%u", id);
status_put_id(s, "IDLIST", id_string);
}
} else {
@@ -411,7 +411,7 @@ status_patterns(stream * s, pcl_state_t * pcs, pcl_data_storage_t storage)
if (pptrn != 0) {
char id_string[6];
- gs_sprintf(id_string, "%u", id);
+ gs_snprintf(id_string, sizeof(id_string), "%u", id);
status_put_id(s, "IDLIST", id_string);
}
}
diff --git a/pcl/pl/pjparse.c b/pcl/pl/pjparse.c
index 287c13d0e..fd35361f4 100644
--- a/pcl/pl/pjparse.c
+++ b/pcl/pl/pjparse.c
@@ -326,7 +326,7 @@ pjl_side_effects(pjl_parser_state_t * pst, char *variable, char *value,
int formlines = pjl_calc_formlines_new_page_size(page_length);
char text[32];
- gs_sprintf(text, "%d", formlines);
+ gs_snprintf(text, sizeof(text), "%d", formlines);
pjl_set(pst, (char *)"FORMLINES", text, defaults);
}
/* fill in other side effects here */
diff --git a/pcl/pl/plmain.c b/pcl/pl/plmain.c
index ae33903a8..12a85fa9b 100644
--- a/pcl/pl/plmain.c
+++ b/pcl/pl/plmain.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2021 Artifex Software, Inc.
+/* Copyright (C) 2001-2022 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -3093,7 +3093,7 @@ pl_finish_page(pl_main_instance_t * pmi, gs_gstate * pgs, int num_copies, int fl
if (pmi->pause) {
char strbuf[256];
- gs_sprintf(strbuf, "End of page %d, press <enter> to continue.\n",
+ gs_snprintf(strbuf, sizeof(strbuf), "End of page %d, press <enter> to continue.\n",
pdev->PageCount);
pl_log_string(pmi->memory, strbuf, 1);
} else if (gs_debug_c(':'))
diff --git a/pcl/pxl/pxerrors.c b/pcl/pxl/pxerrors.c
index 8594a1c4f..f6d597961 100644
--- a/pcl/pxl/pxerrors.c
+++ b/pcl/pxl/pxerrors.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2021 Artifex Software, Inc.
+/* Copyright (C) 2001-2022 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -167,7 +167,7 @@ px_error_message_line(char message[px_max_error_line + 1], int N,
switch (N) {
case 1:
- gs_sprintf(message, " Subsystem: %s\n", subsystem);
+ gs_snprintf(message, px_max_error_line, " Subsystem: %s\n", subsystem);
break;
case 2:
strcpy(message, " Error: ");
@@ -187,10 +187,10 @@ px_error_message_line(char message[px_max_error_line + 1], int N,
}
strcat(end, "\n");
} else if (code >= px_error_first && code < px_error_next)
- gs_sprintf(end, "%s\n",
+ gs_snprintf(end, px_max_error_line - strlen(message), "%s\n",
px_error_names[code - px_error_first]);
else
- gs_sprintf(end, "Internal error 0x%x\n", code);
+ gs_snprintf(end, px_max_error_line - strlen(message), "Internal error 0x%x\n", code);
}
break;
case 3:
@@ -204,19 +204,19 @@ px_error_message_line(char message[px_max_error_line + 1], int N,
if (last_operator >= 0x40 && last_operator < 0xc0 &&
(oname =
px_operator_names[last_operator - 0x40]) != 0)
- gs_sprintf(end, "%s\n", oname);
+ gs_snprintf(end, px_max_error_line - strlen(message), "%s\n", oname);
else
- gs_sprintf(end, "0x%02x\n", last_operator);
+ gs_snprintf(end, px_max_error_line - strlen(message), "0x%02x\n", last_operator);
}
break;
case 4:
strcpy(message, " Position: ");
end = message + strlen(message);
if (st->parent_operator_count)
- gs_sprintf(end, "%ld;%ld\n", st->parent_operator_count,
+ gs_snprintf(end, px_max_error_line - strlen(message), "%ld;%ld\n", st->parent_operator_count,
st->operator_count);
else
- gs_sprintf(end, "%ld\n", st->operator_count);
+ gs_snprintf(end, px_max_error_line - strlen(message), "%ld\n", st->operator_count);
break;
default:
return -1;
diff --git a/pcl/pxl/pxfont.c b/pcl/pxl/pxfont.c
index b7e4013bf..6e3079fac 100644
--- a/pcl/pxl/pxfont.c
+++ b/pcl/pxl/pxfont.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2021 Artifex Software, Inc.
+/* Copyright (C) 2001-2022 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -512,7 +512,7 @@ pxSetFont(px_args_t * par, px_state_t * pxs)
{
char setstr[26]; /* 64-bit value plus message */
- gs_sprintf(setstr, " : %d", symbol_set);
+ gs_snprintf(setstr, sizeof(setstr), " : %d", symbol_set);
strncat(pxs->error_line, setstr,
px_max_error_line - strlen(pxs->error_line));
pxs->error_line[px_max_error_line] = 0;
diff --git a/pcl/pxl/pxpthr.c b/pcl/pxl/pxpthr.c
index a6f1d8235..805a1149a 100644
--- a/pcl/pxl/pxpthr.c
+++ b/pcl/pxl/pxpthr.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2021 Artifex Software, Inc.
+/* Copyright (C) 2001-2022 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -143,12 +143,12 @@ pxPassthrough_init(px_state_t * pxs)
stream_cursor_read r;
ret =
- gs_sprintf(buf,
+ gs_snprintf(buf, sizeof(buf),
"@PJL SET PAPERLENGTH = %d\n@PJL SET PAPERWIDTH = %d\n",
(int)(pxs->media_dims.y * 10 + .5),
(int)(pxs->media_dims.x * 10 + .5));
- /* There is no reason gs_sprintf should fail, but to shut coverity up... */
+ /* There is no reason gs_snprintf should fail, but to shut coverity up... */
if (ret > 0) {
stream_cursor_read_init(&r, (const byte *)buf, ret);
pjl_proc_process(pxs->pjls, &r);