summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenry Stiles <henry.stiles@artifex.com>2018-09-12 15:34:50 -0600
committerHenry Stiles <henry.stiles@artifex.com>2018-09-13 17:12:43 -0600
commit96ab2635885c40a81d6146d1f3363a019d8af93a (patch)
tree4d38e3e40ef907580df3d3c520030baca78b79b1
parent687e9a482e40d5e2fc6ac7aa66fb4791afccb949 (diff)
downloadghostpdl-96ab2635885c40a81d6146d1f3363a019d8af93a.tar.gz
Fix bug #699564 - pageside different from HP.
The pageside should be updated only if the page is marked. Also refactor and simplify the Page Side Select routine. Thanks to Norbert Janssen for identifying and analyzing this problem.
-rw-r--r--pcl/pcl/pcjob.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/pcl/pcl/pcjob.c b/pcl/pcl/pcjob.c
index 792b43b1d..8d2792671 100644
--- a/pcl/pcl/pcjob.c
+++ b/pcl/pcl/pcjob.c
@@ -167,37 +167,37 @@ pcl_duplex_page_side_select(pcl_args_t * pargs, pcl_state_t * pcs)
{
uint i = uint_arg(pargs);
int code = 0;
- /* save : because pcl_end_page() messes with it,
- or not if it was an unmarked page, so do it yourself */
- bool back_side = pcs->back_side;
/* oddly the command goes to the next page irrespective of
arguments */
code = pcl_end_page_if_marked(pcs);
- if (code < 0)
- return code;
- pcl_home_cursor(pcs);
-
if (i > 2)
return 0;
- /* restore */
- pcs->back_side = back_side;
- if (pcs->duplex)
- {
+ /* home the cursor even if the command has no effect */
+ pcl_home_cursor(pcs);
+
+ /* if there is an error (code < 0) or the page is unmarked (code
+ == 0) then nothing to update */
+ if (code <= 0)
+ return code;
+
+
+ if (pcs->duplex) {
switch (i) {
- case 0:
- pcs->back_side = !pcs->back_side;
- break;
- case 1:
- pcs->back_side = false;
- break;
- case 2:
- pcs->back_side = true;
- break;
- default:
- pcs->back_side = false; /* default front */
- break;
+ case 0:
+ /* do nothing, back_side was updated by
+ pcl_end_page_if_marked() above */
+ break;
+ case 1:
+ pcs->back_side = false;
+ break;
+ case 2:
+ pcs->back_side = true;
+ break;
+ default:
+ /* can't happen */
+ break;
}
code = put_param1_bool(pcs, "FirstSide", !pcs->back_side);
}