[gs-commits] ghostpdl branch, master, updated. jbig2dec-0.14-1665-g29f3e8d
[email protected] (Shailesh Mistry)
| Newsgroups | gmane.comp.printing.ghostscript.cvs |
|---|---|
| Message-ID | <[email protected]> |
The ghostpdl branch, master has been updated
via 29f3e8d45595f443170bf13290404be4d34b5a2e (commit)
from afe11ca136aa173541ed0df09b8c189d2344f381 (commit)
----------------------------------------------------------------------
commit 29f3e8d45595f443170bf13290404be4d34b5a2e
Author: Shailesh Mistry <[email protected]>
Date: Thu Sep 12 07:59:03 2019 +0100
Bug 697545 : Propagate error codes from pcl_do_CR and pcl_do_LF correctly.
The code has been updated to correctly propagate error codes from all instances
of pcl_do_CR and pcl_do_LF.
diff --git a/pcl/pcl/pcfontpg.c b/pcl/pcl/pcfontpg.c
index 7396f04..bef6cb3 100644
--- a/pcl/pcl/pcfontpg.c
+++ b/pcl/pcl/pcfontpg.c
@@ -31,13 +31,21 @@
#include "pllfont.h"
/* utility procedure to print n blank lines */
-static inline void
+static int
print_blank_lines(pcl_state_t * pcs, int count)
{
+ int code = 0;
+
while (count--) {
- pcl_do_CR(pcs);
- pcl_do_LF(pcs);
+ code = pcl_do_CR(pcs);
+ if (code < 0)
+ return code;
+ code = pcl_do_LF(pcs);
+ if (code < 0)
+ return code;
}
+
+ return code;
}
static int
@@ -93,7 +101,9 @@ process_font(pcl_state_t * pcs, pl_font_t * fp)
if (code < 0)
return gs_rethrow(code, "failed to display font number");
}
- print_blank_lines(pcs, 2);
+ code = print_blank_lines(pcs, 2);
+ if (code < 0)
+ return gs_rethrow(code, "failed to print blank lines");
return 0;
}
@@ -126,7 +136,9 @@ pcl_print_font_page(pcl_args_t * pargs, pcl_state_t * pcs)
code = pcl_text((byte *) header_str, hlen, pcs, false);
if (code < 0)
return gs_rethrow(code, "printing PCL Font List failed\n");
- print_blank_lines(pcs, 2);
+ code = print_blank_lines(pcs, 2);
+ if (code < 0)
+ return gs_rethrow(code, "failed to print blank lines");
code = pcl_text((byte *) sample_str, strlen(sample_str), pcs, false);
if (code < 0)
return gs_rethrow(code, "printing Sample failed\n");
@@ -134,7 +146,9 @@ pcl_print_font_page(pcl_args_t * pargs, pcl_state_t * pcs)
code = pcl_text((byte *) select_str, strlen(select_str), pcs, false);
if (code < 0)
return gs_rethrow(code, "printing Font Selection Command failed\n");
- print_blank_lines(pcs, 2);
+ code = print_blank_lines(pcs, 2);
+ if (code < 0)
+ return gs_rethrow(code, "failed to print blank lines");
}
/* enumerate all non-resident fonts. */
diff --git a/pcl/pcl/pcparse.c b/pcl/pcl/pcparse.c
index 68ef78a..0b8eb03 100644
--- a/pcl/pcl/pcparse.c
+++ b/pcl/pcl/pcparse.c
@@ -377,8 +377,9 @@ pcl_process(pcl_parser_state_t * pst, pcl_state_t * pcs,
}
if (do_display_functions()) {
if (chr == CR) {
- pcl_do_CR(pcs);
- code = pcl_do_LF(pcs);
+ code = pcl_do_CR(pcs);
+ if (code >= 0)
+ code = pcl_do_LF(pcs);
} else {
pst->args.command = chr;
code = pcl_plain_char(&pst->args, pcs);
diff --git a/pcl/pcl/pctext.c b/pcl/pcl/pctext.c
index f8a38a8..15dadce 100644
--- a/pcl/pcl/pctext.c
+++ b/pcl/pcl/pctext.c
@@ -874,8 +874,12 @@ pcl_show_chars_slow(pcl_state_t * pcs,
function. */
pcs->cap.x = (coord) cpt.x;
pcs->cap.y = (coord) cpt.y;
- pcl_do_CR(pcs);
- pcl_do_LF(pcs);
+ code = pcl_do_CR(pcs);
+ if (code < 0)
+ return code;
+ code = pcl_do_LF(pcs);
+ if (code < 0)
+ return code;
cpt.x = pcs->cap.x;
cpt.y = pcs->cap.y;
use_rmargin = true;
diff --git a/pcl/pcl/pcursor.c b/pcl/pcl/pcursor.c
index 1011dbf..508f5c4 100644
--- a/pcl/pcl/pcursor.c
+++ b/pcl/pcl/pcursor.c
@@ -329,13 +329,17 @@ do_vertical_move(pcl_state_t * pcs, pcl_args_t * pargs, float mul,
*
* Note: CR always "breaks" an underline, even if it is a movement to the right.
*/
-void
+int
pcl_do_CR(pcl_state_t * pcs)
{
+ int code = 0;
+
pcl_break_underline(pcs);
pcl_set_cap_x(pcs, pcs->margins.left, false, false);
pcl_continue_underline(pcs);
pcs->cursor_moved = true;
+
+ return code;
}
int
@@ -549,7 +553,9 @@ static int
cmd_CR(pcl_args_t * pargs, /* ignored */
pcl_state_t * pcs)
{
- pcl_do_CR(pcs);
+ int code = pcl_do_CR(pcs);
+ if (code < 0)
+ return code;
return ((pcs->line_termination & 1) != 0 ? pcl_do_LF(pcs) : 0);
}
@@ -645,8 +651,11 @@ static int
cmd_LF(pcl_args_t * pargs, /* ignored */
pcl_state_t * pcs)
{
- if ((pcs->line_termination & 2) != 0)
- pcl_do_CR(pcs);
+ if ((pcs->line_termination & 2) != 0) {
+ int code = pcl_do_CR(pcs);
+ if (code < 0)
+ return code;
+ }
return pcl_do_LF(pcs);
}
@@ -657,8 +666,11 @@ static int
cmd_FF(pcl_args_t * pargs, /* ignored */
pcl_state_t * pcs)
{
- if ((pcs->line_termination & 2) != 0)
- pcl_do_CR(pcs);
+ if ((pcs->line_termination & 2) != 0) {
+ int code = pcl_do_CR(pcs);
+ if (code < 0)
+ return code;
+ }
return pcl_do_FF(pcs);
}
diff --git a/pcl/pcl/pcursor.h b/pcl/pcl/pcursor.h
index 8cfe443..660cd25 100644
--- a/pcl/pcl/pcursor.h
+++ b/pcl/pcl/pcursor.h
@@ -53,7 +53,7 @@ int pcl_set_cap_y(pcl_state_t * pcs, coord y, /* position or distance */
bool by_row_command /* ESC & a <rows> R special case. */
);
-void pcl_do_CR(pcl_state_t * pcs);
+int pcl_do_CR(pcl_state_t * pcs);
int pcl_do_FF(pcl_state_t * pcs);
Summary of changes:
pcl/pcl/pcfontpg.c | 26 ++++++++++++++++++++------
pcl/pcl/pcparse.c | 5 +++--
pcl/pcl/pctext.c | 8 ++++++--
pcl/pcl/pcursor.c | 24 ++++++++++++++++++------
pcl/pcl/pcursor.h | 2 +-
5 files changed, 48 insertions(+), 17 deletions(-)