[gs-cvs] rev 8372 - trunk/gs/src

leonardo at ghostscript.com leonardo at ghostscript.com
Fri Nov 16 00:11:05 PST 2007


Author: leonardo
Date: 2007-11-16 00:11:05 -0800 (Fri, 16 Nov 2007)
New Revision: 8372

Modified:
   trunk/gs/src/gxclread.c
   trunk/gs/src/gxht.c
Log:
Fix (clist) : Providing clist instruction ids and offsets to debug trace (continued 2).

DETAILS :

The last patch (rev 8365) appears incorrect and causes crashes with halftoning devices.

The problem happens due to gx_device_clist_reader::offset_map 
has been initialized too early in clist_reader_init. 
At that moment the device is still a clist writer, 
but the field offset_map belongs to clist reader. 
Due to gx_device_clist_s is a union, the field overlaps band_range_list.head,
and the letter was prematurely reset. It caused some commands were not written
to clist file while the page closes. With the test case (pbmraw -r300 012-01.ps)
it missed cmd_opv_ext_put_halftone and did not miss cmd_opv_ext_put_drawing_color
with color index type == ht_binary. It caused the crash in gx_dc_ht_binary_readdue to 
pis->dev_ht was not set. (cmd_opv_ext_put_halftone does set, but it was missed).

The log message of the revision 8365 reads :
"This change is algorithmically equivalent for release build."
This statement is false due to the premature initialization of 
gx_device_clist_reader::offset_map.
This patch fixes that with removing its initialization from 
clist_reader_init. A subsequent call to clist_render_init initializes it.

The last patch was made buggy due to the function name 
clist_reader_init does not properly reflects its finction.
This patch fixes the naming.

Also provided more stability in gxht.c with a check for NULL pointer.

EXPECTED DIFFERENCES :

Should fix revision 8365 regressions.


Modified: trunk/gs/src/gxclread.c
===================================================================
--- trunk/gs/src/gxclread.c	2007-11-16 02:10:56 UTC (rev 8371)
+++ trunk/gs/src/gxclread.c	2007-11-16 08:11:05 UTC (rev 8372)
@@ -339,7 +339,7 @@
 }
 
 static int 
-clist_reader_init(gx_device_clist *cldev)
+clist_close_writer_and_init_reader(gx_device_clist *cldev)
 {
     gx_device_clist_reader * const crdev = &cldev->reader;
     
@@ -347,7 +347,6 @@
 
     /* Initialize for rendering if we haven't done so yet. */
     if (crdev->ymin < 0) {
-	crdev->offset_map = NULL;
 	code = clist_end_page(&cldev->writer);
 	if (code < 0)
 	    return code;
@@ -422,7 +421,7 @@
 	    }
     }
 
-    if (0 > (code = clist_reader_init(cldev)))
+    if (0 > (code = clist_close_writer_and_init_reader(cldev)))
 	return code;
 
     clist_select_render_plane(dev, y, line_count, &render_plane, plane_index);

Modified: trunk/gs/src/gxht.c
===================================================================
--- trunk/gs/src/gxht.c	2007-11-16 02:10:56 UTC (rev 8371)
+++ trunk/gs/src/gxht.c	2007-11-16 08:11:05 UTC (rev 8372)
@@ -645,8 +645,9 @@
         devc.colors.binary.b_index = *pdata++;
     }
 
+    if (pis->dev_ht == NULL)
+	return_error(gs_error_unregistered); /* Must not happen. */
     /* set the phase as required (select value is arbitrary) */
-    /* set the phase as required (select value is arbitrary) */
     color_set_phase_mod( &devc,
                          pis->screen_phase[0].x,
                          pis->screen_phase[0].y,



More information about the gs-cvs mailing list