<div dir="ltr"><div><div><div><div><div>Hi,<br></div>I'm looking at various surface plugins... It's a mess.<br><br></div>There is a mix of int/long/void * in the various declarations.<br></div>What is very nice, is that they are all of equal size in ILP32 convention, so we can be very careless and ignore all the compiler warnings.<br></div>Well, until we try to port to LP64 or LLP64...<br><br>When trying to untangle that mess, I see there is the handle/pointer/ID confusion.<br><br></div><div>SurfacePlugin.h expects a surfaceHandle to be a void *, and declare that it will pass that type to the four functions (getSurfaceFormat,lockSurface,unlockSurface,showSurface).<br><br></div><div>Of course, the comment a few lines below does not quite agrees, it says it's rather a long.<br><br></div><div>The functions defined in end of same file and which are used by interpreterProxy interface declare the surfaceHandle as long...<br><br></div><div>And sqMacWindow.c uses an int handle!!! It's used as an ID.<br></div><div>I would have thought that the conversion SurfaceID -> SurfaceHandle would have occured a bit sooner, but here no.<br><br></div><div>Same mess for the other parameters, x,y,w,h,pitch,isMSB, they are either declared int or long... It may work by pure luck on little endian machines when we pass args by registers, and SYSV X64 convention uses a lot of these, or when each arg passed thru stack is 8-bytes aligned, and when the caller has the longer type. But that's dramatically wrong when we pass a pointer to such data, we'll then get pure UB related to uninitialized MSB...<br><br></div><div>I'm going to fix that, don't be amazed if you see a bit of traffic in the next hours.<br></div></div>