summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2022-02-16 12:52:46 +0000
committerRobin Watts <Robin.Watts@artifex.com>2022-02-16 14:20:50 +0000
commit7873a87d97958e77f478110cd8ce6dcc1cd0f50c (patch)
treef7cc56d66ff0b482b3df9e917690977b7223beca /contrib
parented2ac2264e1e0dd75f3570b5de6f2de3919313fd (diff)
downloadghostpdl-7873a87d97958e77f478110cd8ce6dcc1cd0f50c.tar.gz
Move contrib from gs_sprintf to gs_snprintf.
Diffstat (limited to 'contrib')
-rw-r--r--contrib/eplaser/gdevescv.c98
-rw-r--r--contrib/gdevcd8.c4
-rw-r--r--contrib/gdevdj9.c2
-rw-r--r--contrib/gdevhl12.c2
-rw-r--r--contrib/gdevxes.c6
-rw-r--r--contrib/japanese/gdevfmlbp.c8
-rw-r--r--contrib/japanese/gdevfmpr.c4
-rw-r--r--contrib/japanese/gdevj100.c8
-rw-r--r--contrib/japanese/gdevlbp3.c4
-rw-r--r--contrib/japanese/gdevnpdl.c18
-rw-r--r--contrib/lips4/gdevl4r.c10
-rw-r--r--contrib/lips4/gdevl4v.c88
-rw-r--r--contrib/pcl3/src/gdevpcl3.c2
13 files changed, 127 insertions, 127 deletions
diff --git a/contrib/eplaser/gdevescv.c b/contrib/eplaser/gdevescv.c
index 4150e81fb..d69f64195 100644
--- a/contrib/eplaser/gdevescv.c
+++ b/contrib/eplaser/gdevescv.c
@@ -473,7 +473,7 @@ escv_vector_dopath(gx_device_vector * vdev, const gx_path * ppath,
y = fixed2float(vs[1]) / scale.y;
/* サブパス開始命令 p1 */
- (void)gs_sprintf(obuf, ESC_GS "0;%d;%dmvpG", (int)x, (int)y);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "0;%d;%dmvpG", (int)x, (int)y);
lputs(s, obuf);
if (first)
@@ -484,13 +484,13 @@ escv_vector_dopath(gx_device_vector * vdev, const gx_path * ppath,
cnt = 1;
for (pseg = cenum.pseg; pseg != 0 && pseg->type == s_line; cnt++, pseg = pseg->next);
- (void)gs_sprintf(obuf, ESC_GS "0;%d", cnt);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "0;%d", cnt);
lputs(s, obuf);
do {
- (void)gs_sprintf(obuf, ";%d;%d",
- (int)(fixed2float(vs[0]) / scale.x),
- (int)(fixed2float(vs[1]) / scale.y));
+ (void)gs_snprintf(obuf, sizeof(obuf), ";%d;%d",
+ (int)(fixed2float(vs[0]) / scale.x),
+ (int)(fixed2float(vs[1]) / scale.y));
lputs(s, obuf);
pe_op = gx_path_enum_next(&cenum, (gs_fixed_point *) vs);
@@ -505,11 +505,11 @@ escv_vector_dopath(gx_device_vector * vdev, const gx_path * ppath,
case gs_pe_curveto:
cnt = 1;
for (pseg = cenum.pseg; pseg != 0 && pseg->type == s_curve; cnt++, pseg = pseg->next);
- (void)gs_sprintf(obuf, ESC_GS "0;%d", cnt * 3);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "0;%d", cnt * 3);
lputs(s, obuf);
do {
- (void)gs_sprintf(obuf, ";%d;%d;%d;%d;%d;%d",
+ (void)gs_snprintf(obuf, sizeof(obuf), ";%d;%d;%d;%d;%d;%d",
(int)(fixed2float(vs[0]) / scale.x), (int)(fixed2float(vs[1]) / scale.y),
(int)(fixed2float(vs[2]) / scale.x), (int)(fixed2float(vs[3]) / scale.y),
(int)(fixed2float(vs[4]) / scale.x), (int)(fixed2float(vs[5]) / scale.y));
@@ -564,7 +564,7 @@ escv_vector_dorect(gx_device_vector * vdev, fixed x0, fixed y0, fixed x1,
scale = vdev->scale;
- (void)gs_sprintf(obuf, ESC_GS "0;%d;%d;%d;%d;0;0rrpG",
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "0;%d;%d;%d;%d;0;0rrpG",
(int)(fixed2float(x0) / scale.x),
(int)(fixed2float(y0) / scale.y),
(int)(fixed2float(x1) / scale.x),
@@ -1057,7 +1057,7 @@ escv_beginpage(gx_device_vector * vdev)
lputs(s, " PU=15");
}
} else if (pdev->cassetFeed) {
- (void)gs_sprintf(ebuf, " PU=%d", pdev->cassetFeed);
+ (void)gs_snprintf(ebuf, sizeof(ebuf), " PU=%d", pdev->cassetFeed);
lputs(s, ebuf);
} else {
lputs(s, " PU=AU");
@@ -1087,14 +1087,14 @@ escv_beginpage(gx_device_vector * vdev)
/* lp8000c not have QT */
if (strcmp(pdev->dname, "lp8000c") == 0) {
- (void)gs_sprintf(ebuf, " QT=1 CO=%d", pdev->NumCopies);
+ (void)gs_snprintf(ebuf, sizeof(ebuf), " QT=1 CO=%d", pdev->NumCopies);
} else {
if (pdev->Collate) {
/* CO is 1, when set QT */
- (void)gs_sprintf(ebuf, " QT=%d CO=1", pdev->NumCopies);
+ (void)gs_snprintf(ebuf, sizeof(ebuf), " QT=%d CO=1", pdev->NumCopies);
} else {
/* QT is 1, when not specified QT */
- (void)gs_sprintf(ebuf, " QT=1 CO=%d", pdev->NumCopies);
+ (void)gs_snprintf(ebuf, sizeof(ebuf), " QT=1 CO=%d", pdev->NumCopies);
}
}
lputs(s, ebuf);
@@ -1103,7 +1103,7 @@ escv_beginpage(gx_device_vector * vdev)
}
if (pdev->toner_density) {
- (void)gs_sprintf(ebuf, " DL=%d", pdev->toner_density);
+ (void)gs_snprintf(ebuf, sizeof(ebuf), " DL=%d", pdev->toner_density);
lputs(s, ebuf);
}
@@ -1248,7 +1248,7 @@ escv_setlinewidth(gx_device_vector * vdev, double width)
/* ESC/Page では線幅/終端/接合部の設定は1つのコマンドになっているため保持しておく。 */
pdev -> lwidth = width;
- (void)gs_sprintf(obuf, ESC_GS "%d;%d;%dlwG",
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "%d;%d;%dlwG",
(int)(pdev -> lwidth),
(int)(pdev -> cap),
(int)(pdev -> join));
@@ -1269,7 +1269,7 @@ escv_setlinecap(gx_device_vector * vdev, gs_line_cap cap)
if (pdev -> cap >= 3) return -1;
- (void)gs_sprintf(obuf, ESC_GS "%d;%d;%dlwG",
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "%d;%d;%dlwG",
(int)(pdev -> lwidth),
(int)(pdev -> cap),
(int)(pdev -> join));
@@ -1300,7 +1300,7 @@ escv_setlinejoin(gx_device_vector * vdev, gs_line_join join)
return -1;
}
- (void)gs_sprintf(obuf, ESC_GS "%d;%d;%dlwG",
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "%d;%d;%dlwG",
(int)(pdev -> lwidth),
(int)(pdev -> cap),
(int)(pdev -> join));
@@ -1322,14 +1322,14 @@ escv_setmiterlimit(gx_device_vector * vdev, double limit)
if (pdev -> join != 3) {
/* 強制的に接合部指定を行う */
pdev -> join = 3;
- (void)gs_sprintf(obuf, ESC_GS "%d;%d;%dlwG",
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "%d;%d;%dlwG",
(int)(pdev -> lwidth),
(int)(pdev -> cap),
(int)(pdev -> join));
lputs(s, obuf);
}
- (void)gs_sprintf(obuf, ESC_GS "1;%dmlG", (int)limit);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "1;%dmlG", (int)limit);
lputs(s, obuf);
return 0;
@@ -1357,7 +1357,7 @@ escv_setfillcolor(gx_device_vector * vdev,
if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
- (void)gs_sprintf(obuf, /*ESC_GS "1owE"*/ ESC_GS "0;0;100spE" ESC_GS "1;0;%ldccE" ,color);
+ (void)gs_snprintf(obuf, sizeof(obuf), /*ESC_GS "1owE"*/ ESC_GS "0;0;100spE" ESC_GS "1;0;%ldccE" ,color);
lputs(s, obuf);
if (vdev->x_pixels_per_inch == 1200) {
@@ -1371,7 +1371,7 @@ escv_setfillcolor(gx_device_vector * vdev,
} else { /* ESC/Page-Color */
/* パターンON指定/ソリッドパターン指定 */
- (void)gs_sprintf(obuf, ESC_GS "1;2;3;%d;%d;%dfpE",
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "1;2;3;%d;%d;%dfpE",
(unsigned char)(color >> 16 & 0xff),
(unsigned char)(color >> 8 & 0xff),
(unsigned char)(color & 0xff));
@@ -1399,7 +1399,7 @@ escv_setstrokecolor(gx_device_vector * vdev,
pdev->current_color = color;
- (void)gs_sprintf(obuf, /*ESC_GS "1owE"*/ ESC_GS "0;0;100spE" ESC_GS "1;1;%ldccE" , color);
+ (void)gs_snprintf(obuf, sizeof(obuf), /*ESC_GS "1owE"*/ ESC_GS "0;0;100spE" ESC_GS "1;1;%ldccE" , color);
lputs(s, obuf);
if (vdev->x_pixels_per_inch == 1200) {
@@ -1416,7 +1416,7 @@ escv_setstrokecolor(gx_device_vector * vdev,
pdev->current_color = color;
/* パターンON色指定/ソリッドパターン指定 */
- (void)gs_sprintf(obuf, ESC_GS "1;2;3;%d;%d;%dfpE" ESC_GS "2;2;1;0;0cpE",
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "1;2;3;%d;%d;%dfpE" ESC_GS "2;2;1;0;0cpE",
(unsigned char)(color >> 16 & 0xff),
(unsigned char)(color >> 8 & 0xff),
(unsigned char)(color & 0xff));
@@ -1447,7 +1447,7 @@ escv_setdash(gx_device_vector * vdev, const float *pattern, uint count, double o
if (count) {
if (count == 1) {
- (void)gs_sprintf(obuf, ESC_GS "1;%d;%ddlG", (int) pattern[0], (int) pattern[0]);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "1;%d;%ddlG", (int) pattern[0], (int) pattern[0]);
lputs(s, obuf);
} else {
/* pattern に0があった場合は描画不可として返却 */
@@ -1457,7 +1457,7 @@ escv_setdash(gx_device_vector * vdev, const float *pattern, uint count, double o
lputs(s, ESC_GS "1");
for (i = 0; i < count; ++i) {
- (void)gs_sprintf(obuf, ";%d", (int) pattern[i]);
+ (void)gs_snprintf(obuf, sizeof(obuf), ";%d", (int) pattern[i]);
lputs(s, obuf);
}
lputs(s, "dlG");
@@ -1507,7 +1507,7 @@ escv_moveto(gx_device_vector * vdev,
char obuf[64];
/* サブパス開始命令 */
- (void)gs_sprintf(obuf, ESC_GS "0;%d;%dmvpG", (int)x1, (int)y1);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "0;%d;%dmvpG", (int)x1, (int)y1);
lputs(s, obuf);
return 0;
@@ -1521,7 +1521,7 @@ escv_lineto(gx_device_vector * vdev,
gx_device_escv *pdev = (gx_device_escv *) vdev;
char obuf[64];
- (void)gs_sprintf(obuf, ESC_GS "0;1;%d;%dlnpG", (int)x1, (int)y1);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "0;1;%d;%dlnpG", (int)x1, (int)y1);
lputs(s, obuf);
pdev->ispath = 1;
@@ -1538,7 +1538,7 @@ escv_curveto(gx_device_vector * vdev, double x0, double y0,
char obuf[128];
/* ベジェ曲線 */
- (void)gs_sprintf(obuf, ESC_GS "0;3;%d;%d;%d;%d;%d;%dbzpG",
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "0;3;%d;%d;%d;%d;%d;%dbzpG",
(int)x1, (int)y1, (int)x2, (int)y2, (int)x3, (int)y3);
lputs(s, obuf);
pdev->ispath = 1;
@@ -2071,7 +2071,7 @@ escv_copy_mono(gx_device * dev, const byte * data,
if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
/* lputs(s, ESC_GS "1owE");*/
- (void)gs_sprintf(obuf, ESC_GS "1;1;%ldccE", c_color);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "1;1;%ldccE", c_color);
lputs(s, obuf);
if (vdev->x_pixels_per_inch == 1200) {
@@ -2156,7 +2156,7 @@ escv_copy_mono(gx_device * dev, const byte * data,
} else { /* ESC/Page-Color */
/* パターンON指定/ソリッドパターン指定 */
- (void)gs_sprintf(obuf, ESC_GS "1;2;3;%d;%d;%dfpE",
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "1;2;3;%d;%d;%dfpE",
(unsigned char)(c_color >> 16 & 0xff),
(unsigned char)(c_color >> 8 & 0xff),
(unsigned char)(c_color & 0xff));
@@ -2276,7 +2276,7 @@ escv_fill_mask(gx_device * dev,
if (!gx_dc_is_pure(pdcolor)) return_error(gs_error_rangecheck);
pdev->current_color = color;
- (void)gs_sprintf(obuf, ESC_GS "0;0;100spE" ESC_GS "1;1;%ldccE" ,color);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "0;0;100spE" ESC_GS "1;1;%ldccE" ,color);
lputs(s, obuf);
if (vdev->x_pixels_per_inch == 1200) {
@@ -2316,7 +2316,7 @@ escv_fill_mask(gx_device * dev,
memcpy(buf + i * width_bytes, data + (data_x >> 3) + i * raster, width_bytes);
}
- (void)gs_sprintf(obuf, ESC_GS "%d;%d;%d;%d;0db{F", num_bytes, (int)(id & VCACHE), w, h);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "%d;%d;%d;%d;0db{F", num_bytes, (int)(id & VCACHE), w, h);
lputs(s, obuf);
put_bytes(s, buf, num_bytes);
@@ -2324,9 +2324,9 @@ escv_fill_mask(gx_device * dev,
pdev -> id_cache[id & VCACHE] = id;
}
- (void)gs_sprintf(obuf, ESC_GS "%dX" ESC_GS "%dY", x, y);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "%dX" ESC_GS "%dY", x, y);
lputs(s, obuf);
- (void)gs_sprintf(obuf, ESC_GS "%lddbF", id & VCACHE);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "%lddbF", id & VCACHE);
lputs(s, obuf);
return 0;
@@ -2511,7 +2511,7 @@ fallback:
gx_color_index color = gx_dc_pure_color(pdcolor);
/* lputs(s, ESC_GS "1owE");*/
- (void)gs_sprintf(obuf, ESC_GS "1;1;%ldccE", color);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "1;1;%ldccE", color);
lputs(s, obuf);
if (vdev->x_pixels_per_inch == 1200) {
@@ -2803,7 +2803,7 @@ static void escv_write_begin(gx_device *dev, int bits, int x, int y, int sw, int
if( 0 == pdev->colormode ) { /* ESC/Page (Monochrome) */
- (void)gs_sprintf(obuf, ESC_GS "%dX" ESC_GS "%dY", x, y);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "%dX" ESC_GS "%dY", x, y);
lputs(s, obuf);
comp = 10;
@@ -2811,34 +2811,34 @@ static void escv_write_begin(gx_device *dev, int bits, int x, int y, int sw, int
if (bits == 1) {
if (strcmp(pdev->dname, "lp1800") == 0 ||
strcmp(pdev->dname, "lp9600") == 0) {
- (void)gs_sprintf(obuf, ESC_GS "0bcI");
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "0bcI");
}else{
- (void)gs_sprintf(obuf, ESC_GS "5;%d;%d;%d;%d;%dsrI", sw, sh, dw, dh, roll);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "5;%d;%d;%d;%d;%dsrI", sw, sh, dw, dh, roll);
}
} else if (bits == 4) {
if (pdev -> c4map) {
pdev -> c4map = FALSE;
}
- (void)gs_sprintf(obuf, ESC_GS "1;1;1;0;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "1;1;1;0;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
} else if (bits == 8) {
if (pdev -> c8map) {
pdev -> c8map = FALSE;
}
- (void)gs_sprintf(obuf, ESC_GS "1;1;1;0;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "1;1;1;0;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
} else {
/* 24 bit */
- (void)gs_sprintf(obuf, ESC_GS "1;1;1;0;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "1;1;1;0;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
}
} else { /* ESC/Page-Color */
- (void)gs_sprintf(obuf, ESC_GS "%dX" ESC_GS "%dY", x, y);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "%dX" ESC_GS "%dY", x, y);
lputs(s, obuf);
comp = 0;
if (bits == 1) {
- (void)gs_sprintf(obuf, ESC_GS "2;201;1;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "2;201;1;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
} else if (bits == 4) {
if (pdev -> c4map) {
/* カラーマップ登録 */
@@ -2854,7 +2854,7 @@ static void escv_write_begin(gx_device *dev, int bits, int x, int y, int sw, int
gs_free_object(vdev->memory, tmp, "escv_write_begin(tmp4)");
pdev -> c4map = FALSE;
}
- (void)gs_sprintf(obuf, ESC_GS "2;203;2;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "2;203;2;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
} else if (bits == 8) {
if (pdev -> c8map) {
/* カラーマップ登録 */
@@ -2870,10 +2870,10 @@ static void escv_write_begin(gx_device *dev, int bits, int x, int y, int sw, int
gs_free_object(vdev->memory, tmp, "escv_write_begin(tmp)");
pdev -> c8map = FALSE;
}
- (void)gs_sprintf(obuf, ESC_GS "2;204;4;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "2;204;4;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
} else {
/* 24 bit */
- (void)gs_sprintf(obuf, ESC_GS "2;102;0;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "2;102;0;%d;%d;%d;%d;%d;%dscrI", comp, sw, sh, dw, dh, roll);
}
} /* ESC/Page-Color */
@@ -2940,12 +2940,12 @@ static void escv_write_data(gx_device *dev, int bits, byte *buf, int bsize, int
if(bits == 1){
if (strcmp(pdev->dname, "lp1800") == 0 || \
strcmp(pdev->dname, "lp9600") == 0) {
- (void)gs_sprintf(obuf, ESC_GS "%d;1;%d;%d;0db{I", bsize, w, ras);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "%d;1;%d;%d;0db{I", bsize, w, ras);
}else{
- (void)gs_sprintf(obuf, ESC_GS "%d;%du{I", bsize, ras);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "%d;%du{I", bsize, ras);
}
}else{
- (void)gs_sprintf(obuf, ESC_GS "%d;%dcu{I", bsize, ras);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "%d;%dcu{I", bsize, ras);
}
lputs(s, obuf);
@@ -2972,7 +2972,7 @@ static void escv_write_data(gx_device *dev, int bits, byte *buf, int bsize, int
buf = tmps;
}
- (void)gs_sprintf(obuf, ESC_GS "%d;%dcu{I", bsize, ras);
+ (void)gs_snprintf(obuf, sizeof(obuf), ESC_GS "%d;%dcu{I", bsize, ras);
lputs(s, obuf);
put_bytes(s, buf, bsize);
diff --git a/contrib/gdevcd8.c b/contrib/gdevcd8.c
index e6e9a9420..bb1d26448 100644
--- a/contrib/gdevcd8.c
+++ b/contrib/gdevcd8.c
@@ -2461,7 +2461,7 @@ do_gcr(int bytecount, byte * inbyte, const byte kvalues[256],
if ((*cyan > 0) && (*magenta > 0) && (*yellow > 0))
{
char output[255];
- gs_sprintf(output, "%3d %3d %3d %3d - ", *cyan, *magenta, *yellow, *black);
+ gs_snprintf(output, sizeof(output), "%3d %3d %3d %3d - ", *cyan, *magenta, *yellow, *black);
debug_print_string(output, strlen(output));
}
#endif /* 0 */
@@ -2509,7 +2509,7 @@ do_gcr(int bytecount, byte * inbyte, const byte kvalues[256],
if (ucr > 0)
{
char output[255];
- gs_sprintf(output, "%3d %3d %3d %3d - %5d\n", *cyan, *magenta, *yellow, *black, ucr);
+ gs_snprintf(output, sizeof(output), "%3d %3d %3d %3d - %5d\n", *cyan, *magenta, *yellow, *black, ucr);
debug_print_string(output, strlen(output));
}
#endif /* 0 */
diff --git a/contrib/gdevdj9.c b/contrib/gdevdj9.c
index 29e668247..86f9fea26 100644
--- a/contrib/gdevdj9.c
+++ b/contrib/gdevdj9.c
@@ -2663,7 +2663,7 @@ cdj970_write_header(gx_device * pdev, gp_file * prn_stream)
memset(startbuffer, 0, 1260);
- gs_sprintf(&(startbuffer[600]),
+ gs_snprintf(&(startbuffer[600]), sizeof(startbuffer)- 600,
"\033E\033%%-12345X@PJL JOB NAME = \"GHOST BY RENE HARSCH\"\n@PJL ENTER LANGUAGE=PCL3GUI\n");
gp_fwrite(startbuffer, sizeof(char), 678, prn_stream);
diff --git a/contrib/gdevhl12.c b/contrib/gdevhl12.c
index 860d365a8..566d29f4a 100644
--- a/contrib/gdevhl12.c
+++ b/contrib/gdevhl12.c
@@ -670,7 +670,7 @@ hl1250_print_page_copies(gx_device_printer * pdev, gp_file * prn_stream,
(-120, 0) compared to the one in the ljet4 driver (-180, 36)
(X, Y coordinates here are specified in 1/720-inch units). */
- gs_sprintf(page_init, "\033&l-120U\033*r0F\033&u%dD%s", y_dpi, tray_pcl);
+ gs_snprintf(page_init, sizeof(page_init), "\033&l-120U\033*r0F\033&u%dD%s", y_dpi, tray_pcl);
return dljet_mono_print_page_copies(pdev, prn_stream, num_copies,
y_dpi, PCL_LJ4_FEATURES,
page_init, page_init, false);
diff --git a/contrib/gdevxes.c b/contrib/gdevxes.c
index 0f2db969a..6f2a9d5f5 100644
--- a/contrib/gdevxes.c
+++ b/contrib/gdevxes.c
@@ -180,7 +180,7 @@ sixel_print_page(gx_device_printer *pdev, gp_file *prn_stream, const char *init)
if ( tmp[l] == last ) {
count++;
if (count==32767) {
- run[gs_sprintf(run, "%d", count)]='\0';
+ run[gs_snprintf(run, sizeof(run), "%d", count)]='\0';
for (t=run; *t; t++) gp_fputc( *t, prn_stream );
gp_fputc( last, prn_stream );
last = '\0';
@@ -193,7 +193,7 @@ sixel_print_page(gx_device_printer *pdev, gp_file *prn_stream, const char *init)
case 0: break;
case 1: gp_fputc( last, prn_stream );
break;
- default:run[gs_sprintf(run, "%d", count)]='\0';
+ default:run[gs_snprintf(run, sizeof(run), "%d", count)]='\0';
for (t=run; *t; t++) gp_fputc( *t, prn_stream );
gp_fputc( last, prn_stream );
break;
@@ -210,7 +210,7 @@ sixel_print_page(gx_device_printer *pdev, gp_file *prn_stream, const char *init)
case 0: break;
case 1: gp_fputc( last, prn_stream );
break;
- default:run[gs_sprintf(run, "%d", count)]='\0';
+ default:run[gs_snprintf(run, sizeof(run), "%d", count)]='\0';
for (t=run; *t; t++) gp_fputc( *t, prn_stream );
gp_fputc( last, prn_stream );
break;
diff --git a/contrib/japanese/gdevfmlbp.c b/contrib/japanese/gdevfmlbp.c
index 2de50e40b..7c88126da 100644
--- a/contrib/japanese/gdevfmlbp.c
+++ b/contrib/japanese/gdevfmlbp.c
@@ -108,7 +108,7 @@ static char can_inits[] ={ ESC, 'c', /* Software reset */
/* Get the paper size code, based on width and height. */
/* modified from gdevpcl.c, gdevmjc.c and gdevnpdl.c. */
static char *
-gdev_fmlbp_paper_size(gx_device_printer *dev, char *paper)
+gdev_fmlbp_paper_size(gx_device_printer *dev, char paper[16])
{
int landscape = 0; /* portrait */
float height_inches = dev->height / dev->y_pixels_per_inch;
@@ -120,7 +120,7 @@ gdev_fmlbp_paper_size(gx_device_printer *dev, char *paper)
height_inches = t;
landscape = 1;
}
- gs_sprintf(paper, "%s;%d",
+ gs_snprintf(paper, 16, "%s;%d",
(height_inches >= 15.9 ? PAPER_SIZE_A3 :
height_inches >= 11.8 ?
(width_inches >= 9.2 ? PAPER_SIZE_B4 : PAPER_SIZE_LEGAL) :
@@ -144,7 +144,7 @@ static void goto_xy(gp_file *prn_stream,int x,int y)
gp_fputc(CEX,prn_stream);
gp_fputc('"',prn_stream);
- gs_sprintf((char *)buff,"%d",x);
+ gs_snprintf((char *)buff,sizeof(buff),"%d",x);
while (*p)
{
if (!*(p+1)) gp_fputc((*p)+0x30,prn_stream);
@@ -154,7 +154,7 @@ static void goto_xy(gp_file *prn_stream,int x,int y)
}
p=buff;
- gs_sprintf((char *)buff,"%d",y);
+ gs_snprintf((char *)buff,sizeof(buff),"%d",y);
while (*p)
{
if (!*(p+1)) gp_fputc((*p)+0x40,prn_stream);
diff --git a/contrib/japanese/gdevfmpr.c b/contrib/japanese/gdevfmpr.c
index 3e4aaefdc..1912b026a 100644
--- a/contrib/japanese/gdevfmpr.c
+++ b/contrib/japanese/gdevfmpr.c
@@ -184,13 +184,13 @@ fmpr_print_page(gx_device_printer *pdev, gp_file *prn_stream)
}
out_beg -= (out_beg - out) % bytes_per_column;
- gs_sprintf(prn_buf, "\033[%da",
+ gs_snprintf(prn_buf, sizeof(prn_buf), "\033[%da",
(out_beg - out) / bytes_per_column);
prn_puts(pdev, prn_buf);
/* Dot graphics */
size = out_end - out_beg + 1;
- gs_sprintf(prn_buf, "\033Q%d W", size / bytes_per_column);
+ gs_snprintf(prn_buf, sizeof(prn_buf), "\033Q%d W", size / bytes_per_column);
prn_puts(pdev, prn_buf);
prn_write(pdev, (const char *)out_beg, size);
diff --git a/contrib/japanese/gdevj100.c b/contrib/japanese/gdevj100.c
index 8305e1c46..22e2c2d73 100644
--- a/contrib/japanese/gdevj100.c
+++ b/contrib/japanese/gdevj100.c
@@ -128,12 +128,12 @@ jj100_print_page(gx_device_printer *pdev, gp_file *prn_stream)
/* Vertical tab to the appropriate position. */
while(skip > 15) {
- gs_sprintf(prn_buf, "\037%c", 16 + 15);
+ gs_snprintf(prn_buf, sizeof(prn_buf), "\037%c", 16 + 15);
gp_fputs(prn_buf, pdev->file);
skip -= 15;
}
if(skip > 0) {
- gs_sprintf(prn_buf, "\037%c", 16 + skip);
+ gs_snprintf(prn_buf, sizeof(prn_buf), "\037%c", 16 + skip);
gp_fputs(prn_buf, pdev->file);
}
@@ -170,13 +170,13 @@ jj100_print_page(gx_device_printer *pdev, gp_file *prn_stream)
out_beg -= (out_beg - out) % (bytes_per_column * 2);
/* Dot addressing */
- gs_sprintf(prn_buf, "\033F%04d",
+ gs_snprintf(prn_buf, sizeof(prn_buf), "\033F%04d",
(out_beg - out) / bytes_per_column / 2);
gp_fputs(prn_buf, pdev->file);
/* Dot graphics */
size = out_end - out_beg + 1;
- gs_sprintf(prn_buf, "\034bP,48,%04d.", size / bytes_per_column);
+ gs_snprintf(prn_buf, sizeof(prn_buf), "\034bP,48,%04d.", size / bytes_per_column);
gp_fputs(prn_buf, pdev->file);
gp_fwrite(out_beg, 1, size, pdev->file);
diff --git a/contrib/japanese/gdevlbp3.c b/contrib/japanese/gdevlbp3.c
index 8042d4db0..e4664e05e 100644
--- a/contrib/japanese/gdevlbp3.c
+++ b/contrib/japanese/gdevlbp3.c
@@ -81,7 +81,7 @@ lbp310PrintPage(gx_device_printer *pDev, gp_file *fp)
DataSize = CompressImage(pDev, &Box, fp, "\x1b[1;%d;%d;11;%d;.r");
/* ----==== Set size ====---- */
- gs_sprintf(Buf, "0%ld", DataSize);
+ gs_snprintf(Buf, sizeof(Buf), "0%ld", DataSize);
i = (DataSize+strlen(Buf)+1)&1;
/* ----==== escape to LIPS ====---- */
gp_fprintf(fp, "\x80%s\x80\x80\x80\x80\x0c",Buf+i);
@@ -110,7 +110,7 @@ lbp320PrintPage(gx_device_printer *pDev, gp_file *fp)
DataSize = CompressImage(pDev, &Box, fp, "\x1b[1;%d;%d;11;%d;.&r");
/* ----==== Set size ====---- */
- gs_sprintf(Buf, "000%ld", DataSize);
+ gs_snprintf(Buf, sizeof(Buf), "000%ld", DataSize);
i = (DataSize+strlen(Buf)+1)&3;
/* ----==== escape to LIPS ====---- */
gp_fprintf(fp, "\x80%s\x80\x80\x80\x80\x0c",Buf+i);
diff --git a/contrib/japanese/gdevnpdl.c b/contrib/japanese/gdevnpdl.c
index 9c6d6bbac..00a3a7fdf 100644
--- a/contrib/japanese/gdevnpdl.c
+++ b/contrib/japanese/gdevnpdl.c
@@ -600,31 +600,31 @@ npdl_print_page_copies(gx_device_printer * pdev, gp_file * prn_stream, int num_c
/* Check paper size */
switch (npdl_get_paper_size((gx_device *) pdev)) {
case PAPER_SIZE_POSTCARD:
- gs_sprintf(paper_command, "PC");
+ gs_snprintf(paper_command, sizeof(paper_command), "PC");
break;
case PAPER_SIZE_A5:
- gs_sprintf(paper_command, "A5");
+ gs_snprintf(paper_command, sizeof(paper_command), "A5");
break;
case PAPER_SIZE_A4:
- gs_sprintf(paper_command, "A4");
+ gs_snprintf(paper_command, sizeof(paper_command), "A4");
break;
case PAPER_SIZE_A3:
- gs_sprintf(paper_command, "A3");
+ gs_snprintf(paper_command, sizeof(paper_command), "A3");
break;
case PAPER_SIZE_B5:
- gs_sprintf(paper_command, "B5");
+ gs_snprintf(paper_command, sizeof(paper_command), "B5");
break;
case PAPER_SIZE_B4:
- gs_sprintf(paper_command, "B4");
+ gs_snprintf(paper_command, sizeof(paper_command), "B4");
break;
case PAPER_SIZE_LETTER:
- gs_sprintf(paper_command, "LT");
+ gs_snprintf(paper_command, sizeof(paper_command), "LT");
break;
case PAPER_SIZE_ENV4:
- gs_sprintf(paper_command, "ENV4");
+ gs_snprintf(paper_command, sizeof(paper_command), "ENV4");
break;
case PAPER_SIZE_BPOSTCARD:
- gs_sprintf(paper_command, "UPPC");
+ gs_snprintf(paper_command, sizeof(paper_command), "UPPC");
break;
}
diff --git a/contrib/lips4/gdevl4r.c b/contrib/lips4/gdevl4r.c
index 3b5100c4c..8c909452a 100644
--- a/contrib/lips4/gdevl4r.c
+++ b/contrib/lips4/gdevl4r.c
@@ -804,9 +804,9 @@ lips2p_image_out(gx_device_printer * pdev, gp_file * prn_stream, int x, int y, i
move_cap(pdev, prn_stream, x, y);
Len = lips_mode3format_encode(lprn->TmpBuf, lprn->CompBuf, width / 8 * height);
- gs_sprintf(raw_str, "%c%d;%d;%d.r", LIPS_CSI,
+ gs_snprintf(raw_str, sizeof(raw_str), "%c%d;%d;%d.r", LIPS_CSI,
width / 8 * height, width / 8, (int)pdev->x_pixels_per_inch);
- gs_sprintf(comp_str, "%c%d;%d;%d;9;%d.r", LIPS_CSI,
+ gs_snprintf(comp_str, sizeof(comp_str), "%c%d;%d;%d;9;%d.r", LIPS_CSI,
Len, width / 8, (int)pdev->x_pixels_per_inch, height);
if (Len < width / 8 * height - strlen(comp_str) + strlen(raw_str)) {
@@ -835,11 +835,11 @@ lips4_image_out(gx_device_printer * pdev, gp_file * prn_stream, int x, int y, in
Len = lips_packbits_encode(lprn->TmpBuf, lprn->CompBuf, width / 8 * height);
Len_rle = lips_rle_encode(lprn->TmpBuf, lprn->CompBuf2, width / 8 * height);
- gs_sprintf(raw_str, "%c%d;%d;%d.r", LIPS_CSI,
+ gs_snprintf(raw_str, sizeof(raw_str), "%c%d;%d;%d.r", LIPS_CSI,
width / 8 * height, width / 8, (int)pdev->x_pixels_per_inch);
if (Len < Len_rle) {
- gs_sprintf(comp_str, "%c%d;%d;%d;11;%d.r", LIPS_CSI,
+ gs_snprintf(comp_str, sizeof(comp_str), "%c%d;%d;%d;11;%d.r", LIPS_CSI,
Len, width / 8, (int)pdev->x_pixels_per_inch, height);
if (Len < width / 8 * height - strlen(comp_str) + strlen(raw_str)) {
gp_fprintf(prn_stream, "%s", comp_str);
@@ -852,7 +852,7 @@ lips4_image_out(gx_device_printer * pdev, gp_file * prn_stream, int x, int y, in
} else {
/* 2019-11-28: changed two occurrencies of 'Len' to 'Len_rle' here, but
unable to test. */
- gs_sprintf(comp_str, "%c%d;%d;%d;10;%d.r", LIPS_CSI,
+ gs_snprintf(comp_str, sizeof(comp_str), "%c%d;%d;%d;10;%d.r", LIPS_CSI,
Len_rle, width / 8, (int)pdev->x_pixels_per_inch, height);
if (Len_rle < width / 8 * height - strlen(comp_str) + strlen(raw_str)) {
gp_fprintf(prn_stream, "%s", comp_str);
diff --git a/contrib/lips4/gdevl4v.c b/contrib/lips4/gdevl4v.c
index 1cdc17c41..05cfb2fd8 100644
--- a/contrib/lips4/gdevl4v.c
+++ b/contrib/lips4/gdevl4v.c
@@ -405,17 +405,17 @@ lips4v_set_cap(gx_device * dev, int x, int y)
int dy = y - pdev->prev_y;
if (dx > 0) {
- gs_sprintf(cap, "%c%da", LIPS_CSI, dx);
+ gs_snprintf(cap, sizeof(cap), "%c%da", LIPS_CSI, dx);
lputs(s, cap);
} else if (dx < 0) {
- gs_sprintf(cap, "%c%dj", LIPS_CSI, -dx);
+ gs_snprintf(cap, sizeof(cap), "%c%dj", LIPS_CSI, -dx);
lputs(s, cap);
}
if (dy > 0) {
- gs_sprintf(cap, "%c%dk", LIPS_CSI, dy);
+ gs_snprintf(cap, sizeof(cap), "%c%dk", LIPS_CSI, dy);
lputs(s, cap);
} else if (dy < 0) {
- gs_sprintf(cap, "%c%de", LIPS_CSI, -dy);
+ gs_snprintf(cap, sizeof(cap), "%c%de", LIPS_CSI, -dy);
lputs(s, cap);
}
pdev->prev_x = x;
@@ -490,10 +490,10 @@ lips4v_copy_text_char(gx_device * dev, const byte * data,
if (download) {
if (ccode % 128 == 0 && ccode == pdev->count) {
/* 文字セット登録補助命令 */
- gs_sprintf(cset_sub, "%c%dx%c", LIPS_DCS, ccode / 128, LIPS_ST);
+ gs_snprintf(cset_sub, sizeof(cset_sub), "%c%dx%c", LIPS_DCS, ccode / 128, LIPS_ST);
lputs(s, cset_sub);
/* 文字セット登録命令 */
- gs_sprintf(cset,
+ gs_snprintf(cset,sizeof(cset),
"%c%d;1;0;0;3840;8;400;100;0;0;200;%d;%d;0;0;;;;;%d.p",
LIPS_CSI,
size + 9, cell_length, /* Cell Width */
@@ -502,7 +502,7 @@ lips4v_copy_text_char(gx_device * dev, const byte * data,
lputs(s, cset);
} else {
/* 1文字登録命令 */
- gs_sprintf(cset,
+ gs_snprintf(cset,sizeof(cset),
"%c%d;%d;8;%d.q", LIPS_CSI,
size + 9, ccode / 128, (int)dev->x_pixels_per_inch);
lputs(s, cset);
@@ -520,7 +520,7 @@ lips4v_copy_text_char(gx_device * dev, const byte * data,
}
/* 文字セット・アサイン番号選択命令2 */
if (pdev->current_font != ccode / 128) {
- gs_sprintf(cset_number, "%c%d%%v", LIPS_CSI, ccode / 128);
+ gs_snprintf(cset_number, sizeof(cset_number), "%c%d%%v", LIPS_CSI, ccode / 128);
lputs(s, cset_number);
pdev->current_font = ccode / 128;
}
@@ -530,7 +530,7 @@ lips4v_copy_text_char(gx_device * dev, const byte * data,
if (pdev->color_info.depth == 8) {
sputc(s, LIPS_CSI);
lputs(s, "?10;2;");
- gs_sprintf(text_color, "%d",
+ gs_snprintf(text_color, sizeof(text_color), "%d",
(int)(pdev->color_info.max_gray - pdev->current_color));
} else {
int r = (pdev->current_color >> 16) * 1000.0 / 255.0;
@@ -539,7 +539,7 @@ lips4v_copy_text_char(gx_device * dev, const byte * data,
sputc(s, LIPS_CSI);
lputs(s, "?10;;");
- gs_sprintf(text_color, "%d;%d;%d", r, g, b);
+ gs_snprintf(text_color, sizeof(text_color), "%d;%d;%d", r, g, b);
}
lputs(s, text_color);
lputs(s, "%p");
@@ -655,16 +655,16 @@ lips4v_beginpage(gx_device_vector * vdev)
lputs(s, "@PJL SET RESOLUTION = QUICK\n");
lputs(s, l4v_file_header2);
if (pdev->toner_density) {
- gs_sprintf(toner_d, "@PJL SET TONER-DENSITY=%d\n",
+ gs_snprintf(toner_d, sizeof(toner_d), "@PJL SET TONER-DENSITY=%d\n",
pdev->toner_density);
lputs(s, toner_d);
}
if (pdev->toner_saving_set) {
lputs(s, "@PJL SET TONER-SAVING=");
if (pdev->toner_saving)
- gs_sprintf(toner_s, "ON\n");
+ gs_snprintf(toner_s, sizeof(toner_s), "ON\n");
else
- gs_sprintf(toner_s, "OFF\n");
+ gs_snprintf(toner_s, sizeof(toner_s), "OFF\n");
lputs(s, toner_s);
}
lputs(s, l4v_file_header3);
@@ -674,8 +674,8 @@ lips4v_beginpage(gx_device_vector * vdev)
if (dpi > 9999)
return_error(gs_error_rangecheck);
- /* set reaolution (dpi) */
- gs_sprintf(dpi_char, "%d", dpi);
+ /* set resolution (dpi) */
+ gs_snprintf(dpi_char, sizeof(dpi_char), "%d", dpi);
lputs(s, dpi_char);
if (pdev->color_info.depth == 8)
@@ -684,7 +684,7 @@ lips4v_beginpage(gx_device_vector * vdev)
lputs(s, l4vcolor_file_header);
/* username */
- gs_sprintf(username, "%c2y%s%c", LIPS_DCS, pdev->Username, LIPS_ST);
+ gs_snprintf(username, sizeof(username), "%c2y%s%c", LIPS_DCS, pdev->Username, LIPS_ST);
lputs(s, username);
}
if (strcmp(pdev->mediaType, "PlainPaper") == 0) {
@@ -711,13 +711,13 @@ lips4v_beginpage(gx_device_vector * vdev)
&& strcmp(pdev->mediaType, LIPS_MEDIATYPE_DEFAULT) != 0)) {
/* Use ManualFeed */
if (pdev->prev_feed_mode != 10) {
- gs_sprintf(feedmode, "%c10q", LIPS_CSI);
+ gs_snprintf(feedmode, sizeof(feedmode), "%c10q", LIPS_CSI);
lputs(s, feedmode);
pdev->prev_feed_mode = 10;
}
} else {
if (pdev->prev_feed_mode != pdev->cassetFeed) {
- gs_sprintf(feedmode, "%c%dq", LIPS_CSI, pdev->cassetFeed);
+ gs_snprintf(feedmode, sizeof(feedmode), "%c%dq", LIPS_CSI, pdev->cassetFeed);
lputs(s, feedmode);
pdev->prev_feed_mode = pdev->cassetFeed;
}
@@ -729,10 +729,10 @@ lips4v_beginpage(gx_device_vector * vdev)
if (pdev->prev_paper_size != paper_size) {
if (paper_size == USER_SIZE) {
/* modified by shige 06/27 2003
- gs_sprintf(paper, "%c80;%d;%dp", LIPS_CSI, width * 10, height * 10); */
+ gs_snprintf(paper, sizeof(paper), "%c80;%d;%dp", LIPS_CSI, width * 10, height * 10); */
/* modified by shige 11/09 2003
- gs_sprintf(paper, "%c80;%d;%dp", LIPS_CSI, height * 10, width * 10); */
- gs_sprintf(paper, "%c80;%d;%dp", LIPS_CSI,
+ gs_snprintf(paper, sizeof(paper), "%c80;%d;%dp", LIPS_CSI, height * 10, width * 10); */
+ gs_snprintf(paper,sizeof(paper), "%c80;%d;%dp", LIPS_CSI,
(height * 10 > LIPS_HEIGHT_MAX_720)?
LIPS_HEIGHT_MAX_720 : (height * 10),
(width * 10 > LIPS_WIDTH_MAX_720)?
@@ -740,27 +740,27 @@ lips4v_beginpage(gx_device_vector * vdev)
lputs(s, paper);
} else if (paper_size == USER_SIZE + LANDSCAPE) {
/* modified by shige 06/27 2003
- gs_sprintf(paper, "%c81;%d;%dp", LIPS_CSI, height * 10, width * 10); */
+ gs_snprintf(paper, sizeof(paper), "%c81;%d;%dp", LIPS_CSI, height * 10, width * 10); */
/* modified by shige 11/09 2003
- gs_sprintf(paper, "%c81;%d;%dp", LIPS_CSI, width * 10, height * 10); */
- gs_sprintf(paper, "%c80;%d;%dp", LIPS_CSI,
+ gs_snprintf(paper, sizeof(paper), "%c81;%d;%dp", LIPS_CSI, width * 10, height * 10); */
+ gs_snprintf(paper,sizeof(paper), "%c80;%d;%dp", LIPS_CSI,
(width * 10 > LIPS_HEIGHT_MAX_720)?
LIPS_HEIGHT_MAX_720 : (width * 10),
(height * 10 > LIPS_WIDTH_MAX_720)?
LIPS_WIDTH_MAX_720 : (height * 10));
lputs(s, paper);
} else {
- gs_sprintf(paper, "%c%dp", LIPS_CSI, paper_size);
+ gs_snprintf(paper, sizeof(paper), "%c%dp", LIPS_CSI, paper_size);
lputs(s, paper);
}
} else if (paper_size == USER_SIZE) {
if (pdev->prev_paper_width != width ||
pdev->prev_paper_height != height)
/* modified by shige 06/27 2003
- gs_sprintf(paper, "%c80;%d;%dp", LIPS_CSI, width * 10, height * 10); */
+ gs_snprintf(paper, sizeof(paper), "%c80;%d;%dp", LIPS_CSI, width * 10, height * 10); */
/* modified by shige 11/09 2003
- gs_sprintf(paper, "%c80;%d;%dp", LIPS_CSI, height * 10, width * 10); */
- gs_sprintf(paper, "%c80;%d;%dp", LIPS_CSI,
+ gs_snprintf(paper, sizeof(paper), "%c80;%d;%dp", LIPS_CSI, height * 10, width * 10); */
+ gs_snprintf(paper, sizeof(paper), "%c80;%d;%dp", LIPS_CSI,
(height * 10 > LIPS_HEIGHT_MAX_720)?
LIPS_HEIGHT_MAX_720 : (height * 10),
(width * 10 > LIPS_WIDTH_MAX_720)?
@@ -770,10 +770,10 @@ lips4v_beginpage(gx_device_vector * vdev)
if (pdev->prev_paper_width != width ||
pdev->prev_paper_height != height)
/* modified by shige 06/27 2003
- gs_sprintf(paper, "%c81;%d;%dp", LIPS_CSI, height * 10, width * 10); */
+ gs_snprintf(paper, sizeof(paper), "%c81;%d;%dp", LIPS_CSI, height * 10, width * 10); */
/* modified by shige 11/09 2003
- gs_sprintf(paper, "%c81;%d;%dp", LIPS_CSI, width * 10, height * 10); */
- gs_sprintf(paper, "%c80;%d;%dp", LIPS_CSI,
+ gs_snprintf(paper, sizeof(paper), "%c81;%d;%dp", LIPS_CSI, width * 10, height * 10); */
+ gs_snprintf(paper, sizeof(paper), "%c80;%d;%dp", LIPS_CSI,
(width * 10 > LIPS_HEIGHT_MAX_720)?
LIPS_HEIGHT_MAX_720 : (width * 10),
(height * 10 > LIPS_WIDTH_MAX_720)?
@@ -785,32 +785,32 @@ lips4v_beginpage(gx_device_vector * vdev)
pdev->prev_paper_height = height;
if (pdev->faceup) {
- gs_sprintf(faceup_char, "%c11;12;12~", LIPS_CSI);
+ gs_snprintf(faceup_char, sizeof(faceup_char), "%c11;12;12~", LIPS_CSI);
lputs(s, faceup_char);
}
/* N-up Printing Setting */
if (pdev->first_page) {
if (pdev->nup != 1) {
- gs_sprintf(nup_char, "%c%d1;;%do", LIPS_CSI, pdev->nup, paper_size);
+ gs_snprintf(nup_char, sizeof(nup_char), "%c%d1;;%do", LIPS_CSI, pdev->nup, paper_size);
lputs(s, nup_char);
}
}
/* Duplex Setting */
if (dupset && dup) {
if (pdev->prev_duplex_mode == 0 || pdev->prev_duplex_mode == 1) {
- gs_sprintf(duplex_char, "%c2;#x", LIPS_CSI); /* duplex */
+ gs_snprintf(duplex_char, sizeof(duplex_char), "%c2;#x", LIPS_CSI); /* duplex */
lputs(s, duplex_char);
if (!tum) {
/* long edge binding */
if (pdev->prev_duplex_mode != 2) {
- gs_sprintf(tumble_char, "%c0;#w", LIPS_CSI);
+ gs_snprintf(tumble_char, sizeof(tumble_char), "%c0;#w", LIPS_CSI);
lputs(s, tumble_char);
}
pdev->prev_duplex_mode = 2;
} else {
/* short edge binding */
if (pdev->prev_duplex_mode != 3) {
- gs_sprintf(tumble_char, "%c2;#w", LIPS_CSI);
+ gs_snprintf(tumble_char, sizeof(tumble_char), "%c2;#w", LIPS_CSI);
lputs(s, tumble_char);
}
pdev->prev_duplex_mode = 3;
@@ -818,7 +818,7 @@ lips4v_beginpage(gx_device_vector * vdev)
}
} else if (dupset && !dup) {
if (pdev->prev_duplex_mode != 1) {
- gs_sprintf(duplex_char, "%c0;#x", LIPS_CSI); /* simplex */
+ gs_snprintf(duplex_char, sizeof(duplex_char), "%c0;#x", LIPS_CSI); /* simplex */
lputs(s, duplex_char);
}
pdev->prev_duplex_mode = 1;
@@ -831,9 +831,9 @@ lips4v_beginpage(gx_device_vector * vdev)
/* size unit (dpi) */
sputc(s, LIPS_CSI);
lputs(s, "11h");
- gs_sprintf(unit, "%c?7;%d I", LIPS_CSI, (int)pdev->x_pixels_per_inch);
+ gs_snprintf(unit, sizeof(unit), "%c?7;%d I", LIPS_CSI, (int)pdev->x_pixels_per_inch);
lputs(s, unit);
- gs_sprintf(page_header, "%c[0&}#%c", LIPS_ESC, LIPS_IS2);
+ gs_snprintf(page_header, sizeof(page_header), "%c[0&}#%c", LIPS_ESC, LIPS_IS2);
lputs(s, page_header); /* vector mode */
lputs(s, "!0"); /* size unit (dpi) */
@@ -842,10 +842,10 @@ lips4v_beginpage(gx_device_vector * vdev)
sputc(s, LIPS_IS2);
if (pdev->color_info.depth == 8) {
- gs_sprintf(l4vmono_page_header, "!13%c$%c", LIPS_IS2, LIPS_IS2);
+ gs_snprintf(l4vmono_page_header, sizeof(l4vmono_page_header), "!13%c$%c", LIPS_IS2, LIPS_IS2);
lputs(s, l4vmono_page_header);
} else {
- gs_sprintf(l4vcolor_page_header, "!11%c$%c", LIPS_IS2, LIPS_IS2);
+ gs_snprintf(l4vcolor_page_header, sizeof(l4vcolor_page_header), "!11%c$%c", LIPS_IS2, LIPS_IS2);
lputs(s, l4vcolor_page_header);
}
@@ -949,7 +949,7 @@ lips4v_setlinecap(gx_device_vector * vdev, gs_line_cap cap)
break;
}
/* 線端形状指定命令 */
- gs_sprintf(c, "}E%d%c", line_cap, LIPS_IS2);
+ gs_snprintf(c, sizeof(c), "}E%d%c", line_cap, LIPS_IS2);
lputs(s, c);
pdev->linecap = cap;
@@ -990,7 +990,7 @@ lips4v_setlinejoin(gx_device_vector * vdev, gs_line_join join)
break;
}
- gs_sprintf(c, "}F%d%c", lips_join, LIPS_IS2);
+ gs_snprintf(c, sizeof(c), "}F%d%c", lips_join, LIPS_IS2);
lputs(s, c);
return 0;
@@ -1411,7 +1411,7 @@ lips4v_output_page(gx_device * dev, int num_copies, int flush)
if (num_copies > 255)
num_copies = 255;
if (pdev->prev_num_copies != num_copies) {
- gs_sprintf(str, "%c%dv", LIPS_CSI, num_copies);
+ gs_snprintf(str, sizeof(str), "%c%dv", LIPS_CSI, num_copies);
lputs(s, str);
pdev->prev_num_copies = num_copies;
}
diff --git a/contrib/pcl3/src/gdevpcl3.c b/contrib/pcl3/src/gdevpcl3.c
index eaf603c14..d43525406 100644
--- a/contrib/pcl3/src/gdevpcl3.c
+++ b/contrib/pcl3/src/gdevpcl3.c
@@ -308,7 +308,7 @@ static void get_string_for_int(int in_value, const eprn_StringAndInt *table,
else {
char buffer[22]; /* Must be sufficient for an 'int' */
- gs_sprintf(buffer, "%d", in_value);
+ gs_snprintf(buffer, sizeof(buffer), "%d", in_value);
assert(strlen(buffer) < sizeof(buffer));
out_value->data = (const byte *)buffer;
out_value->size = strlen(buffer);