From 22385dccfa68b77119c93544f3d782f52eda5492 Mon Sep 17 00:00:00 2001 From: nicolas-cellier-aka-nice Date: Sat, 12 Nov 2016 03:09:33 +0100 Subject: [PATCH] Third wave of Surface x64 fixes: agree on surfaceID,x,y,w,h,pitch,isMSB types They were declared either long or int depending on files. This is not 64bits compatible. Since all those values will fit into an int, use int. --- .../Cross/plugins/SqueakFFIPrims/sqFFI.h | 8 ++-- .../plugins/SqueakFFIPrims/sqManualSurface.c | 26 ++++++------ .../plugins/SurfacePlugin/SurfacePlugin.c | 34 ++++++++-------- .../plugins/SurfacePlugin/SurfacePlugin.h | 40 +++++++++---------- .../QuicktimePlugin/sqMacQuicktimeInteface.c | 4 +- .../QuicktimePlugin/sqMacQuicktimeInteface.c | 4 +- 6 files changed, 58 insertions(+), 58 deletions(-) diff --git a/platforms/Cross/plugins/SqueakFFIPrims/sqFFI.h b/platforms/Cross/plugins/SqueakFFIPrims/sqFFI.h index d7f965ba21..3752c4cae2 100755 --- a/platforms/Cross/plugins/SqueakFFIPrims/sqFFI.h +++ b/platforms/Cross/plugins/SqueakFFIPrims/sqFFI.h @@ -157,9 +157,9 @@ int ffiLogCallOfLength(void *nameIndex, int nameLength); void initSurfacePluginFunctionPointers(); void initManualSurfaceFunctionPointers (fn_ioRegisterSurface, fn_ioUnregisterSurface, fn_ioFindSurface); -long createManualSurface - (long width, long height, long rowPitch, long depth, long isMSB); -long destroyManualSurface(long surfaceID); -long setManualSurfacePointer(long surfaceID, void* ptr); +int createManualSurface + (int width, int height, int rowPitch, int depth, int isMSB); +int destroyManualSurface(int surfaceID); +int setManualSurfacePointer(int surfaceID, void* ptr); #endif /* SQ_FFI_H */ diff --git a/platforms/Cross/plugins/SqueakFFIPrims/sqManualSurface.c b/platforms/Cross/plugins/SqueakFFIPrims/sqManualSurface.c index a967142cdb..5707c092d5 100644 --- a/platforms/Cross/plugins/SqueakFFIPrims/sqManualSurface.c +++ b/platforms/Cross/plugins/SqueakFFIPrims/sqManualSurface.c @@ -53,10 +53,10 @@ typedef struct { /* Create the dispatch-table that SurfacePlugin will use to interact with instances of "struct ManualSurface" */ -static long manualSurfaceGetFormat(sqIntptr_t, long*, long*, long*, long*); -static sqIntptr_t manualSurfaceLock(sqIntptr_t, long *, long, long, long, long); -static long manualSurfaceUnlock(sqIntptr_t, long, long, long, long); -static long manualSurfaceShow(sqIntptr_t, long, long, long, long); +static int manualSurfaceGetFormat(sqIntptr_t, int*, int*, int*, int*); +static sqIntptr_t manualSurfaceLock(sqIntptr_t, int *, int, int, int, int); +static int manualSurfaceUnlock(sqIntptr_t, int, int, int, int); +static int manualSurfaceShow(sqIntptr_t, int, int, int, int); static sqSurfaceDispatch manualSurfaceDispatch = { 1, 0, @@ -68,7 +68,7 @@ static sqSurfaceDispatch manualSurfaceDispatch = { /* sqSurfaceDispatch functions *****************************************************************************/ -long manualSurfaceGetFormat(sqIntptr_t surfaceArg, long* width, long* height, long* depth, long* isMSB) { +int manualSurfaceGetFormat(sqIntptr_t surfaceArg, int* width, int* height, int* depth, int* isMSB) { ManualSurface* surface = (ManualSurface *)surfaceArg; *width = surface->width; *height = surface->height; @@ -78,7 +78,7 @@ long manualSurfaceGetFormat(sqIntptr_t surfaceArg, long* width, long* height, lo return 1; } -sqIntptr_t manualSurfaceLock(sqIntptr_t surfaceArg, long *pitch, long x, long y, long w, long h) { +sqIntptr_t manualSurfaceLock(sqIntptr_t surfaceArg, int *pitch, int x, int y, int w, int h) { ManualSurface* surface = (ManualSurface *)surfaceArg; /* Ideally, would be atomic. But it doens't matter for the forseeable future, since it is only called via BitBlt primitives. */ @@ -100,14 +100,14 @@ sqIntptr_t manualSurfaceLock(sqIntptr_t surfaceArg, long *pitch, long x, long y, return (sqIntptr_t)(surface->ptr); } -long manualSurfaceUnlock(sqIntptr_t surfaceArg, long x, long y, long w, long h) { +int manualSurfaceUnlock(sqIntptr_t surfaceArg, int x, int y, int w, int h) { ManualSurface* surface = (ManualSurface *)surfaceArg; surface->isLocked = 0; DPRINTF(("Unlocked Surface: %" PRIxSQPTR " Rect: %ld %ld %ld %ld\n", (sqIntptr_t) surface, x, y, w, h)); return 1; } -long manualSurfaceShow(sqIntptr_t surfaceArg, long x, long y, long w, long h) { +int manualSurfaceShow(sqIntptr_t surfaceArg, int x, int y, int w, int h) { /* Unsupported */ return 0; } @@ -115,9 +115,9 @@ long manualSurfaceShow(sqIntptr_t surfaceArg, long x, long y, long w, long h) { /* primitive interface functions (i.e. called from Squeak) *********************************************/ /* Answer non-negative surfaceID if successful, and -1 for failure. */ -long createManualSurface(long width, long height, long rowPitch, long depth, long isMSB) { +int createManualSurface(int width, int height, int rowPitch, int depth, int isMSB) { ManualSurface* newSurface; - long surfaceID, result; + int surfaceID, result; if (width < 0) return -1; if (height < 0) return -1; @@ -144,15 +144,15 @@ long createManualSurface(long width, long height, long rowPitch, long depth, lon return surfaceID; } -long destroyManualSurface(long surfaceID) { +int destroyManualSurface(int surfaceID) { if (!unregisterSurface) return 0; /* failure... couldn't init function-pointer */ return unregisterSurface(surfaceID); } -long setManualSurfacePointer(long surfaceID, void* ptr) { +int setManualSurfacePointer(int surfaceID, void* ptr) { sqIntptr_t surfaceHandle; ManualSurface *surface; - long result; + int result; if (!findSurface) return FALSE; /* failure... couldn't init function-pointer */ result = findSurface(surfaceID, NULL, &surfaceHandle); if (!result) return FALSE; /* failed to find surface */ diff --git a/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.c b/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.c index a617b404aa..14fb947d74 100644 --- a/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.c +++ b/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.c @@ -37,8 +37,8 @@ typedef struct SqueakSurface { } SqueakSurface; static SqueakSurface *surfaceArray = NULL; -static long numSurfaces = 0; -static long maxSurfaces = 0; +static int numSurfaces = 0; +static int maxSurfaces = 0; #ifdef SQUEAK_BUILTIN_PLUGIN static const char *moduleName = "SurfacePlugin "__DATE__" (i)"; @@ -57,23 +57,23 @@ EXPORT(long) initialiseModule(void); EXPORT(long) shutdownModule(void); /* critical FXBlt entry points */ -EXPORT(long) ioGetSurfaceFormat (long surfaceID, long* width, long* height, long* depth, long* isMSB); -EXPORT(sqIntptr_t) ioLockSurface (long surfaceID, long *pitch, long x, long y, long w, long h); -EXPORT(long) ioUnlockSurface(long surfaceID, long x, long y, long w, long h); +EXPORT(int) ioGetSurfaceFormat (int surfaceID, int* width, int* height, int* depth, int* isMSB); +EXPORT(sqIntptr_t) ioLockSurface (int surfaceID, int *pitch, int x, int y, int w, int h); +EXPORT(int) ioUnlockSurface(int surfaceID, int x, int y, int w, int h); /* interpreter entry point */ -EXPORT(long) ioShowSurface(long surfaceID, long x, long y, long w, long h); +EXPORT(int) ioShowSurface(int surfaceID, int x, int y, int w, int h); /* client entry points */ -EXPORT(long) ioRegisterSurface(sqIntptr_t surfaceHandle, sqSurfaceDispatch *fn, long *surfaceID); -EXPORT(long) ioUnregisterSurface(long surfaceID); -EXPORT(long) ioFindSurface(long surfaceID, sqSurfaceDispatch *fn, sqIntptr_t *surfaceHandle); +EXPORT(int) ioRegisterSurface(sqIntptr_t surfaceHandle, sqSurfaceDispatch *fn, int *surfaceID); +EXPORT(int) ioUnregisterSurface(int surfaceID); +EXPORT(int) ioFindSurface(int surfaceID, sqSurfaceDispatch *fn, sqIntptr_t *surfaceHandle); #pragma export off /* ioGetSurfaceFormat: Return information describing the given surface. Return true if successful, false otherwise. */ -EXPORT(long) ioGetSurfaceFormat (long surfaceID, long* width, long* height, long* depth, long* isMSB) +EXPORT(int) ioGetSurfaceFormat (int surfaceID, int* width, int* height, int* depth, int* isMSB) { SqueakSurface *surface; if(surfaceID < 0 || surfaceID >= maxSurfaces) FAIL; @@ -87,7 +87,7 @@ EXPORT(long) ioGetSurfaceFormat (long surfaceID, long* width, long* height, long Lock the bits of the surface. Return a pointer to the actual surface bits, or NULL on failure. */ -EXPORT(sqIntptr_t) ioLockSurface (long surfaceID, long *pitch, long x, long y, long w, long h) +EXPORT(sqIntptr_t) ioLockSurface (int surfaceID, int *pitch, int x, int y, int w, int h) { SqueakSurface *surface; if(surfaceID < 0 || surfaceID >= maxSurfaces) FAIL; @@ -100,7 +100,7 @@ EXPORT(sqIntptr_t) ioLockSurface (long surfaceID, long *pitch, long x, long y, l /* ioUnlockSurface: Unlock the bits of the surface. The return value is ignored. */ -EXPORT(long) ioUnlockSurface(long surfaceID, long x, long y, long w, long h) +EXPORT(int) ioUnlockSurface(int surfaceID, int x, int y, int w, int h) { SqueakSurface *surface; if(surfaceID < 0 || surfaceID >= maxSurfaces) FAIL; @@ -112,7 +112,7 @@ EXPORT(long) ioUnlockSurface(long surfaceID, long x, long y, long w, long h) /* ioShowSurface: Transfer the bits of a surface to the screen. */ -EXPORT(long) ioShowSurface(long surfaceID, long x, long y, long w, long h) +EXPORT(int) ioShowSurface(int surfaceID, int x, int y, int w, int h) { SqueakSurface *surface; if(surfaceID < 0 || surfaceID >= maxSurfaces) FAIL; @@ -127,9 +127,9 @@ EXPORT(long) ioShowSurface(long surfaceID, long x, long y, long w, long h) the set of surface functions. The new ID is returned in surfaceID. Returns true if successful, false otherwise. */ -EXPORT(long) ioRegisterSurface(sqIntptr_t surfaceHandle, sqSurfaceDispatch *fn, long *surfaceID) +EXPORT(int) ioRegisterSurface(sqIntptr_t surfaceHandle, sqSurfaceDispatch *fn, int *surfaceID) { - long index; + int index; if(!fn) return 0; if(fn->majorVersion != 1 && fn->minorVersion != 0) return 0; @@ -157,7 +157,7 @@ EXPORT(long) ioRegisterSurface(sqIntptr_t surfaceHandle, sqSurfaceDispatch *fn, /* ioUnregisterSurface: Unregister the surface with the given ID. Returns true if successful, false otherwise. */ -EXPORT(long) ioUnregisterSurface(long surfaceID) +EXPORT(int) ioUnregisterSurface(int surfaceID) { SqueakSurface *surface; if(surfaceID < 0 || surfaceID >= maxSurfaces) return 0; @@ -174,7 +174,7 @@ EXPORT(long) ioUnregisterSurface(long surfaceID) the given set of surface functions. The registered handle is returned in surfaceHandle. Return true if successful (e.g., the surface has been found), false otherwise. */ -EXPORT(long) ioFindSurface(long surfaceID, sqSurfaceDispatch *fn, sqIntptr_t *surfaceHandle) +EXPORT(int) ioFindSurface(int surfaceID, sqSurfaceDispatch *fn, sqIntptr_t *surfaceHandle) { SqueakSurface *surface; if(surfaceID < 0 || surfaceID >= maxSurfaces) return 0; diff --git a/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.h b/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.h index 39f859fd38..128ad3fd6e 100644 --- a/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.h +++ b/platforms/Cross/plugins/SurfacePlugin/SurfacePlugin.h @@ -8,17 +8,17 @@ /* Plugins creating their own surfaces must register these using the following set of functions. The typedefs are for easier casts. */ -typedef long (*fn_getSurfaceFormat)(sqIntptr_t surfaceHandle, long* width, long* height, long* depth, long* isMSB); -typedef sqIntptr_t (*fn_lockSurface)(sqIntptr_t surfaceHandle, long *pitch, long x, long y, long w, long h); -typedef long (*fn_unlockSurface)(sqIntptr_t surfaceHandle, long x, long y, long w, long h); -typedef long (*fn_showSurface)(sqIntptr_t surfaceHandle, long x, long y, long w, long h); +typedef int (*fn_getSurfaceFormat)(sqIntptr_t surfaceHandle, int* width, int* height, int* depth, int* isMSB); +typedef sqIntptr_t (*fn_lockSurface)(sqIntptr_t surfaceHandle, int *pitch, int x, int y, int w, int h); +typedef int (*fn_unlockSurface)(sqIntptr_t surfaceHandle, int x, int y, int w, int h); +typedef int (*fn_showSurface)(sqIntptr_t surfaceHandle, int x, int y, int w, int h); typedef struct sqSurfaceDispatch { /* Version information. Must be provided by the client so the surface manager can check if certain operations are supported. */ - long majorVersion; - long minorVersion; + int majorVersion; + int minorVersion; /* Version 1.0 */ fn_getSurfaceFormat getSurfaceFormat; @@ -29,14 +29,14 @@ typedef struct sqSurfaceDispatch { /* The functions for sqSurfaceDispatch are: - long getSurfaceFormat(sqIntptr_t handle, long* width, long* height, long* depth, long* isMSB); + int getSurfaceFormat(sqIntptr_t handle, int* width, int* height, int* depth, int* isMSB); Return general information about the OS drawing surface. Return true if successful, false otherwise. The returned values describe the basic properties such as width, height, depth and LSB vs. MSB pixels. - sqIntptr_t lockSurface(sqIntptr_t handle, long *pitch, long x, long y, long w, long h); + sqIntptr_t lockSurface(sqIntptr_t handle, int *pitch, int x, int y, int w, int h); Lock the bits of the surface. Return a pointer to the actual surface bits, or NULL on failure. If successful, store the pitch of the surface (e.g., the bytes @@ -67,14 +67,14 @@ typedef struct sqSurfaceDispatch { be inside the source and dest boundingBox) but it is not aligned to word boundaries yet. It is up to the support code to compute accurate alignment if necessary. - long unlockSurface(sqIntptr_t handle, long x, long y, long w, long h); + int unlockSurface(sqIntptr_t handle, int x, int y, int w, int h); Unlock the bits of a (possibly modified) surface after BitBlt completed. The return value is ignored. The arguments provided specify the dirty region of the surface. If the surface is unmodified all arguments are set to zero. - long showSurface(sqIntptr_t handle, long x, long y, long w, long h); + int showSurface(sqIntptr_t handle, int x, int y, int w, int h); Display the contents of the surface on the actual screen. If ioShowSurface() is called the surface in question represents @@ -83,9 +83,9 @@ typedef struct sqSurfaceDispatch { FXBlt uses a variant of the above functions which are exported from the surface plugin: - long ioGetSurfaceFormat(long surfaceID, long* width, long* height, long* depth, long* isMSB); - sqIntptr_t ioLockSurface(long surfaceID, long *pitch, long x, long y, long w, long h); - long ioUnlockSurface(long surfaceID, long x, long y, long w, long h); + int ioGetSurfaceFormat(int surfaceID, int* width, int* height, int* depth, int* isMSB); + sqIntptr_t ioLockSurface(int surfaceID, int *pitch, int x, int y, int w, int h); + int ioUnlockSurface(int surfaceID, int x, int y, int w, int h); These functions are looked up in the registered surfaces and invoked as appropriate. The meaning of all values is exactly the same as for @@ -95,7 +95,7 @@ typedef struct sqSurfaceDispatch { Interpreter itself uses a separate entry point for updating the display - long ioShowSurface(long surfaceID, long x, long y, long w, long h); + int ioShowSurface(int surfaceID, int x, int y, int w, int h); since the management of deferred updates is currently an intrinsic property of the VM (which is bad - deferred updates should be a @@ -106,17 +106,17 @@ typedef struct sqSurfaceDispatch { /* The following are the entry points for the surface manager: - long ioRegisterSurface(sqIntptr_t surfaceHandle, sqSurfaceDispatch *fn, long *surfaceID); + int ioRegisterSurface(sqIntptr_t surfaceHandle, sqSurfaceDispatch *fn, int *surfaceID); Register a new surface with the given handle and the set of surface functions. The new ID is returned in surfaceID. Returns true if successful, false otherwise. - long ioUnregisterSurface(long surfaceID); + int ioUnregisterSurface(int surfaceID); Unregister the surface with the given ID. Returns true if successful, false otherwise. - long ioFindSurface(long surfaceID, sqSurfaceDispatch *fn, sqIntptr_t *surfaceHandle); + int ioFindSurface(int surfaceID, sqSurfaceDispatch *fn, sqIntptr_t *surfaceHandle); Find the surface with the given ID, and, optionally, the given set of surface functions. The registered handle is returned in surfaceHandle. Return true if successful @@ -126,8 +126,8 @@ typedef struct sqSurfaceDispatch { interpreterProxy->ioLoadFunctionFrom("ioRegisterSurface","SurfacePlugin"); The typedefs below are for easier casts. */ -typedef long (*fn_ioRegisterSurface)(sqIntptr_t surfaceHandle, sqSurfaceDispatch *fn, long *surfaceID); -typedef long (*fn_ioUnregisterSurface)(long surfaceID); -typedef long (*fn_ioFindSurface)(long surfaceID, sqSurfaceDispatch *fn, sqIntptr_t *surfaceHandle); +typedef int (*fn_ioRegisterSurface)(sqIntptr_t surfaceHandle, sqSurfaceDispatch *fn, int *surfaceID); +typedef int (*fn_ioUnregisterSurface)(int surfaceID); +typedef int (*fn_ioFindSurface)(int surfaceID, sqSurfaceDispatch *fn, sqIntptr_t *surfaceHandle); #endif /* __SQ_DRAW_SURFACE_H */ diff --git a/platforms/Mac OS/plugins/QuicktimePlugin/sqMacQuicktimeInteface.c b/platforms/Mac OS/plugins/QuicktimePlugin/sqMacQuicktimeInteface.c index e5f950e6ad..2f4cca9ce1 100644 --- a/platforms/Mac OS/plugins/QuicktimePlugin/sqMacQuicktimeInteface.c +++ b/platforms/Mac OS/plugins/QuicktimePlugin/sqMacQuicktimeInteface.c @@ -64,7 +64,7 @@ sqInt sqQuicktimeShutdown() { return true; } -long stQuicktimeSetSurfacewidthheightrowBytesdepthmovie(char * buffer, int width, int height, int rowBytes, int depth, void *movie) +int stQuicktimeSetSurfacewidthheightrowBytesdepthmovie(char * buffer, int width, int height, int rowBytes, int depth, void *movie) { QuickTimeBitMapForSqueak *bitMap; int sqHandle; @@ -81,7 +81,7 @@ long stQuicktimeSetSurfacewidthheightrowBytesdepthmovie(char * buffer, int width return sqHandle; } -long stQuicktimeSetToExistingSurfacegworldwidthheightrowBytesdepthmovie +int stQuicktimeSetToExistingSurfacegworldwidthheightrowBytesdepthmovie (int sqHandle, char * buffer, int width, int height, int rowBytes, int depth, void *movie) { QuickTimeBitMapForSqueak *bitMap; diff --git a/platforms/iOS/plugins/QuicktimePlugin/sqMacQuicktimeInteface.c b/platforms/iOS/plugins/QuicktimePlugin/sqMacQuicktimeInteface.c index e5f950e6ad..2f4cca9ce1 100644 --- a/platforms/iOS/plugins/QuicktimePlugin/sqMacQuicktimeInteface.c +++ b/platforms/iOS/plugins/QuicktimePlugin/sqMacQuicktimeInteface.c @@ -64,7 +64,7 @@ sqInt sqQuicktimeShutdown() { return true; } -long stQuicktimeSetSurfacewidthheightrowBytesdepthmovie(char * buffer, int width, int height, int rowBytes, int depth, void *movie) +int stQuicktimeSetSurfacewidthheightrowBytesdepthmovie(char * buffer, int width, int height, int rowBytes, int depth, void *movie) { QuickTimeBitMapForSqueak *bitMap; int sqHandle; @@ -81,7 +81,7 @@ long stQuicktimeSetSurfacewidthheightrowBytesdepthmovie(char * buffer, int width return sqHandle; } -long stQuicktimeSetToExistingSurfacegworldwidthheightrowBytesdepthmovie +int stQuicktimeSetToExistingSurfacegworldwidthheightrowBytesdepthmovie (int sqHandle, char * buffer, int width, int height, int rowBytes, int depth, void *movie) { QuickTimeBitMapForSqueak *bitMap;