Re: 64-bit support for display device
"Russell Lang" <[email protected]>
| Newsgroups | gmane.comp.printing.ghostscript.patches |
|---|---|
| Message-ID | <402BE93F.22069.76F9EABE@localhost> |
Ray, Kim suggested a variation on this patch. Instead of parsing the pointer value in a string ourselves, let the caller do sprintf(buf, "%p", handle); and ghostscript do sscanf(buf, "%p", &handle); Is %p portable enough for this? Russell On 11 Feb 2004 at 19:38, Russell Lang wrote: > Ray, > > Please review the following patch. I have not tested it on a 64- > bit platform (I don't have one). I would like this added to > 8.14. If all goes well it should be harmless. Worst case is > probably some compiler warnings when compiled on a 64-bit > platform. For HEAD, GS_8_1X and GS_8_0X. > > Log message: > > Change display device parameter DisplayHandle from an integer > to a string, to add support for 64-bit platforms. > > DETAILS: > > The display device passes a (void *) handle to callback > functions. The handle is set before the device is opened, and > attempting to change it afterwards is an error. The handle may > be used by the caller to identify an instance of the display > device, for example it may point to the display instance object > in the caller. This handle was set using a PostScript integer > which is 32-bits long, typically with -dDisplayHandle. The > existing code will not work correctly on 64-bit architectures. > > > The display device is changed to return a string as the > DisplayHandle parameter. > Previously the handle would be set using -dDisplayHandle=1234. > The changed code allows it to be passed as > -dDisplayHandle=1234 > -dDisplayHandle=(1234) > -sDisplayHandle=1234 > -sDisplayHandle=10#1234 > -sDisplayHandle=16#04d2 > This should be backward compatible, since users of the > display device will most likely only set the DisplayHandle, > not read its value. > > The ghostscript example code in dw*.c, dx*.c and dp*.c > does not use DisplayHandle, so is unaffected by this change. > GSview does use DisplayHandle and will require this > change for operation on 64-bit platforms. > > It is assumed that size_t is an integer with the same size > as a pointer. > > > Russell Lang [email protected] > Ghostgum Software Pty Ltd http://www.ghostgum.com.au/ > > > > Russell Lang [email protected] Ghostgum Software Pty Ltd http://www.ghostgum.com.au/