RE: Fix for 688018 (PreserveHalftones in pdfwrite)
"Dan Coby" <[email protected]> Wed, 13 Apr 2005 00:17:43 -0700
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <[email protected]> |
Ray, Peter is the culprit for the code in gdevpdfj.c Dan -----Original Message----- From: Ray Johnston [mailto:[email protected]] Sent: Tuesday, April 12, 2005 9:34 PM To: [email protected] Cc: GS Code Review List Subject: Re: [gs-code-review] Fix for 688018 (PreserveHalftones in pdfwrite) (xefitra) Dan, Abject apology. I didn't create this -- I copied it from another file -- gdevpdfj.c. Since it is really localized and in the 'style' created by someone else, I just 'followed'. I guess I've mucked around in ghostscript code to have my tolerance to objectionable coding styles reduced. Besides, as a father of five year olds, I've learned the value of the expression "do what I say, not what I do". ;-) If someone objects strenusously, I my feelings won't be hurt if the macro is replaced with code (but only if they do it in gdevpdfj.c as well as gdevpdfg.c -- and all the other places where control flow is embedded in a macro). Regards, Ray _________________________________________________________________________ Dan Coby wrote: > Ray, > > + #define CHECK(expr)\ > + BEGIN if ((code = (expr)) < 0) return code; END > > I remember a long discussion in which we (including you) specifically > told Igor not to create a macro like this one which hides the control > flow. > > > Dan > > > -----Original Message----- > From: [email protected] > [mailto:[email protected]]On Behalf Of Ray Johnston > Sent: Tuesday, April 12, 2005 2:20 PM > To: GS Code Review List > Cc: Raph Levien > Subject: [gs-code-review] Fix for 688018 (PreserveHalftones in pdfwrite) > | > > > All, > > I know this is usually Igor's area, but he's busy right now and > rather than divert his attention, I decided to look into this > SEGV in pdfwrite. Good learning oppurtunity for me :-) > > The patch is attached. > > Log message: > > Fix for SEGV when PreserveHalftoneInfo=true is given as a > pdfwrite option. Bug 688018. > > DETAILS: > > The initial problem was that the num_comp was not being looked at > when HalftoneType 5 was written and if num_comp was 3, the 4th > element of ht_ids[] was being used (UMR-wise). The solution to > this was to only write the three halftones and to use the 'Green' > halftone (arbitrarily) for Default. > > After fixing the SEGV, another problem surfaced because the object > dictionary was not being terminated with the ">>". > > Since I suspected that the threshold_halftone writers were also > broken I tested with 258-01.ps and found more problems. This > code was also quite broken. Since the Threshold array is the > stream data for HalftoneType 6 and 16, I changed this a lot to > emit valid PDF. > > EXPECTED DIFFERENCES: > > None, since we don't set PreserveHalftoneInfo.