[cups.bugs] [MOD] STR #1193: Byte swapping issue in

Michael R Sweet mike at easysw.com
Tue Jun 7 12:35:43 PDT 2005


Helge Blischke wrote:
> "jlovell.apple" wrote:
> 
>>[STR New]
>>
>>The big-endian/little-endian swapping code in cups_raster_read_header is
>>broken; the attached patch fixes it.
>>
>>Thanks!
>>
>>Link: http://www.cups.org/str.php?L1193
>>Version: 1.2-current
>>
>>  ------------------------------------------------------------------------
>>
>>   raster.c.patchName: raster.c.patch
>>                 Type: Plain Text (text/plain)
> 
> 
> Just a footnote:
> a couple of years ago I wrote a set of preprocessor macros that hide the
> details
> of byte swapping from the user in a very convenient way: once you have
> set an
> indicator if to swap bytes or not, you simply use macros like SHORT,
> USHORT, LONG,
> ULONG, INT, etc, like
> 	long a,b;
> 	short s;
> /*...*/
> 	if (s == SHORT(0x00fe))
> 		a = LONG(LONG(b) + 5;
> 
> etc.
> 
> If there is interest, I may post that stuff.

We already have an indicator in the raster file format and
cups_raster_t structure, and the code in question is used to
byte-swap the page header structure in memory, *after* we
read it from disk.

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com
Internet Printing and Publishing Software        http://www.easysw.com




More information about the cups-devel mailing list