You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2011/04/22 11:44:02 UTC

svn commit: r1095904 - in /commons/sandbox/runtime/trunk/src/main: java/org/apache/commons/runtime/platform/windows/ native/include/acr/ native/os/win32/ native/shared/

Author: mturk
Date: Fri Apr 22 09:44:02 2011
New Revision: 1095904

URL: http://svn.apache.org/viewvc?rev=1095904&view=rev
Log:
Windows might just work with 32-bit integers

Modified:
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Win32.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsMutex.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsSemaphore.java
    commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsShm.java
    commons/sandbox/runtime/trunk/src/main/native/include/acr/iofd.h
    commons/sandbox/runtime/trunk/src/main/native/include/acr/jnidefs.h
    commons/sandbox/runtime/trunk/src/main/native/include/acr/jnimacros.h
    commons/sandbox/runtime/trunk/src/main/native/os/win32/arch_defs.h
    commons/sandbox/runtime/trunk/src/main/native/os/win32/procmutex.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/semaphore.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/winapi.c
    commons/sandbox/runtime/trunk/src/main/native/shared/iofd.c

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Win32.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Win32.java?rev=1095904&r1=1095903&r2=1095904&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Win32.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/Win32.java Fri Apr 22 09:44:02 2011
@@ -123,16 +123,16 @@ final class Win32
     public static final int         PAGE_NOCACHE            = 0x00000200;
     public static final int         PAGE_WRITECOMBINE       = 0x00000400;
 
-    public static final long        INVALID_HANDLE_VALUE    = -1L;
+    public static final int         INVALID_HANDLE_VALUE    = 0xFFFFFFFF;
 
-    public static native int        CloseHandle(long handle);
+    public static native int        CloseHandle(int handle);
     public static native int        LocalFree(long ptr);
-    public static native int        WaitForSingleObject(long handle, int timeout);
-    public static native long       CreateMutex(long sa, boolean initialOwner, String name);
-    public static native long       OpenMutex(int access, boolean inheritHandle, String name);
-    public static native long       CreateFileMapping(long file, long sa, int protect, long size, String name);
-    public static native long       OpenFileMapping(int acc, boolean inherit, String name);
-    public static native long       MapViewOfFile(long handle, int acc, long offset, long size);
+    public static native int        WaitForSingleObject(int handle, int timeout);
+    public static native int        CreateMutex(long sa, boolean initialOwner, String name);
+    public static native int        OpenMutex(int access, boolean inheritHandle, String name);
+    public static native int        CreateFileMapping(int file, long sa, int protect, long size, String name);
+    public static native int        OpenFileMapping(int acc, boolean inherit, String name);
+    public static native long       MapViewOfFile(int handle, int acc, long offset, long size);
     public static native int        FlushViewOfFile(long address, long size);
     public static native int        UnmapViewOfFile(long address);
     public static native long       VirtualAlloc(long base, long size, int type, int protect);

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsMutex.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsMutex.java?rev=1095904&r1=1095903&r2=1095904&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsMutex.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsMutex.java Fri Apr 22 09:44:02 2011
@@ -38,17 +38,17 @@ final class WindowsMutex extends Mutex
         // No Instance
     }
     // Mutex HANDLE
-    private long    handle;
+    private int    handle;
 
-    private static native long create0(String name, long sd)
+    private static native int create0(String name, long sd)
         throws IllegalAccessException,
                AlreadyExistsException,
                SystemException;
-    private static native long open0(String name)
+    private static native int open0(String name)
         throws IllegalAccessException,
                NoSuchObjectException,
                SystemException;
-    private static native int  release0(long mtx);
+    private static native int release0(int mtx);
 
     public WindowsMutex(final String name, boolean owner)
         throws IllegalAccessException,
@@ -75,7 +75,7 @@ final class WindowsMutex extends Mutex
     public void acquire()
         throws SystemException
     {
-        if (handle == 0L)
+        if (handle == 0)
             throw new ClosedDescriptorException();
         int rc = Win32.WaitForSingleObject(handle, Win32.INFINITE);
         if (rc != 0)
@@ -85,7 +85,7 @@ final class WindowsMutex extends Mutex
     public boolean tryAcquire()
         throws SystemException
     {
-        if (handle == 0L)
+        if (handle == 0)
             throw new ClosedDescriptorException();
         int rc = Win32.WaitForSingleObject(handle, 0);
         if (rc == 0)
@@ -98,7 +98,7 @@ final class WindowsMutex extends Mutex
     public void release()
         throws SystemException
     {
-        if (handle == 0L)
+        if (handle == 0)
             throw new ClosedDescriptorException();
         int rc = release0(handle);
         if (rc != 0)
@@ -108,12 +108,12 @@ final class WindowsMutex extends Mutex
     public void close()
         throws SystemException
     {
-        if (handle == 0L)
+        if (handle == 0)
             throw new ClosedDescriptorException();
         int rc = Win32.CloseHandle(handle);
         if (rc != 0)
             throw new SystemException(Status.describe(rc));
-        handle = 0L;
+        handle = 0;
     }
 
     /**
@@ -126,7 +126,7 @@ final class WindowsMutex extends Mutex
     protected final void finalize()
         throws Throwable
     {
-        if (handle != 0L)
+        if (handle != 0)
             Win32.CloseHandle(handle);
     }
 

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsSemaphore.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsSemaphore.java?rev=1095904&r1=1095903&r2=1095904&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsSemaphore.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsSemaphore.java Fri Apr 22 09:44:02 2011
@@ -39,17 +39,17 @@ final class WindowsSemaphore extends Sem
     }
 
     // Semaphore HANDLE
-    private long    handle;
+    private int    handle;
 
-    private static native long create0(String name, int value, long sd)
+    private static native int create0(String name, int value, long sd)
         throws IllegalAccessException,
                AlreadyExistsException,
                SystemException;
-    private static native long open0(String name)
+    private static native int open0(String name)
         throws IllegalAccessException,
                NoSuchObjectException,
                SystemException;
-    private static native int  release0(long sema);
+    private static native int release0(int sema);
 
     public WindowsSemaphore(final String name, int value)
         throws IllegalAccessException,
@@ -83,7 +83,7 @@ final class WindowsSemaphore extends Sem
     public void acquire()
         throws SystemException
     {
-        if (handle == 0L)
+        if (handle == 0)
             throw new ClosedDescriptorException();
         int rc = Win32.WaitForSingleObject(handle, Win32.INFINITE);
         if (rc != 0)
@@ -93,7 +93,7 @@ final class WindowsSemaphore extends Sem
     public boolean tryAcquire()
         throws SystemException
     {
-        if (handle == 0L)
+        if (handle == 0)
             throw new ClosedDescriptorException();
         int rc = Win32.WaitForSingleObject(handle, 0);
         if (rc == 0)
@@ -106,7 +106,7 @@ final class WindowsSemaphore extends Sem
     public void release()
         throws SystemException
     {
-        if (handle == 0L)
+        if (handle == 0)
             throw new ClosedDescriptorException();
         int rc = release0(handle);
         if (rc != 0)
@@ -118,7 +118,7 @@ final class WindowsSemaphore extends Sem
     {
         boolean once = false;
 
-        if (handle == 0L)
+        if (handle == 0)
             throw new ClosedDescriptorException();
         while (true) {
             int rc = Win32.WaitForSingleObject(handle, 0);
@@ -141,12 +141,12 @@ final class WindowsSemaphore extends Sem
     public void close()
         throws SystemException
     {
-        if (handle == 0L)
+        if (handle == 0)
             throw new ClosedDescriptorException();
         int rc = Win32.CloseHandle(handle);
         if (rc != 0)
             throw new SystemException(Status.describe(rc));
-        handle = 0L;
+        handle = 0;
     }
 
     /**
@@ -159,7 +159,7 @@ final class WindowsSemaphore extends Sem
     protected final void finalize()
         throws Throwable
     {
-        if (handle != 0L)
+        if (handle != 0)
             Win32.CloseHandle(handle);
     }
 

Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsShm.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsShm.java?rev=1095904&r1=1095903&r2=1095904&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsShm.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/platform/windows/WindowsShm.java Fri Apr 22 09:44:02 2011
@@ -44,7 +44,7 @@ final class WindowsShm extends Shm
     private static native long hdrlen0(long addr);
 
     // OS shmem descriptor
-    private long    handle;
+    private int     handle;
     private long    base;
     private Pointer bptr;
 
@@ -63,7 +63,7 @@ final class WindowsShm extends Shm
                                          Win32.PAGE_READWRITE,
                                          this.size + 16,
                                          this.name);
-        if (handle == 0L) {
+        if (handle == 0) {
             int rc = Errno.get();
             if (rc == Errno.EEXIST)
                 throw new AlreadyExistsException();
@@ -93,7 +93,7 @@ final class WindowsShm extends Shm
         handle = Win32.OpenFileMapping(Win32.FILE_MAP_READ | Win32.FILE_MAP_WRITE,
                                        false,
                                        this.name);
-        if (handle == 0L) {
+        if (handle == 0) {
             int rc = Errno.get();
             if (Status.IS_ENOENT(rc))
                 throw new NoSuchObjectException();
@@ -125,7 +125,7 @@ final class WindowsShm extends Shm
     public final Pointer attach(long addr, boolean readOnly)
         throws SystemException
     {
-        if (handle == 0L)
+        if (handle == 0)
             throw new ClosedDescriptorException();
         synchronized (this) {
             if (bptr != null) {
@@ -144,7 +144,7 @@ final class WindowsShm extends Shm
     public final void detach()
         throws SystemException
     {
-        if (handle == 0L)
+        if (handle == 0)
             throw new ClosedDescriptorException();
         synchronized (this) {
             if (base != 0L) {
@@ -161,7 +161,7 @@ final class WindowsShm extends Shm
     public final void flush()
         throws SystemException
     {
-        if (handle == 0L)
+        if (handle == 0)
             throw new ClosedDescriptorException();
         int rc = Win32.FlushViewOfFile(base, 0L);
         if (rc != 0)
@@ -172,7 +172,7 @@ final class WindowsShm extends Shm
     public final void sync()
         throws SystemException
     {
-        if (handle == 0L)
+        if (handle == 0)
             throw new ClosedDescriptorException();
         int rc = Win32.FlushViewOfFile(base, 0L);
         if (rc != 0)
@@ -183,10 +183,10 @@ final class WindowsShm extends Shm
     public final void close()
         throws SystemException
     {
-        if (handle == 0L)
+        if (handle == 0)
             throw new ClosedDescriptorException();
         detach();
-        handle = 0L;
+        handle = 0;
     }
 
     /**
@@ -199,7 +199,7 @@ final class WindowsShm extends Shm
     protected final void finalize()
         throws Throwable
     {
-        if (handle != 0L) {
+        if (handle != 0) {
             if (base != 0L)
                 Win32.UnmapViewOfFile(base);
             Win32.CloseHandle(handle);

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr/iofd.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr/iofd.h?rev=1095904&r1=1095903&r2=1095904&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr/iofd.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr/iofd.h Fri Apr 22 09:44:02 2011
@@ -46,7 +46,7 @@ AcrSetFileDescriptorHandle(JNI_STDARGS, 
 #endif
 
 jobject
-AcrNewFileDescriptor(JNI_STDENV, int fd, acr_osd_t fh);
+AcrNewFileDescriptor(JNI_STDENV, int fd, void *fh);
 
 #ifdef __cplusplus
 }

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr/jnidefs.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr/jnidefs.h?rev=1095904&r1=1095903&r2=1095904&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr/jnidefs.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr/jnidefs.h Fri Apr 22 09:44:02 2011
@@ -50,22 +50,25 @@
 
 #define JNI_STDARGS             JNIEnv *env, jobject obj
 #define JNI_STDENV              JNIEnv *env
-#define UNREFERENCED_STDARGS    env = env; obj = obj
-#define UNREFERENCED_OBJECT     obj = obj
+#define UNREFERENCED_STDARGS    (void)env; (void)obj
+#define UNREFERENCED_OBJECT     (void)obj
 
-#define LLT(X)                  ((acr_intptr_t)(X))
+#define IPTR(X)                 ((intptr_t)(X))
 #if CC_SIZEOF_VOIDP == 8
-#define P2J(P)                  ((jlong)LLT(P))
-#define J2P(P, T)               ((T)LLT(P))
-#define I2P(P, T)               ((T)LLT((jlong)(P) & ACR_I64_C(0x00000000FFFFFFFF)))
+#define P2J(P)                  ((jlong)IPTR(P))
+#define J2P(P, T)               ((T)IPTR(P))
+#define J2V(P)                  ((void *)IPTR(P))
+#define I2P(P, T)               ((T)(IPTR(P)      & ACR_I64_C(0x00000000FFFFFFFF)))
+#define I2V(P)                  ((void *)(IPTR(P) & ACR_I64_C(0x00000000FFFFFFFF)))
 #else
-#define P2J(P)                  ((jlong)LLT(P)     & ACR_I64_C(0x00000000FFFFFFFF))
-#define J2P(P, T)               ((T)LLT((jlong)(P) & ACR_I64_C(0x00000000FFFFFFFF)))
-#define I2P(P, T)               ((T)LLT((jint)(P)))
+#define P2J(P)                  ((jlong)IPTR(P)   & ACR_I64_C(0x00000000FFFFFFFF))
+#define J2P(P, T)               ((T)(IPTR(P)      & ACR_I64_C(0x00000000FFFFFFFF)))
+#define J2V(P)                  ((void *)(IPTR(P) & ACR_I64_C(0x00000000FFFFFFFF)))
+#define I2P(P, T)               ((T)(IPTR(P))
+#define I2V(I)                  ((void *)IPTR(I))
 #endif
-#define I2V(I)                  ((void *)(acr_intptr_t)(I))
-#define V2I(P)                  ((int)(acr_intptr_t)(P))
-#define V2U(P)                  ((unsigned int)(acr_uintptr_t)(P))
+#define V2I(P)                  ((int)IPTR(P))
+#define V2U(P)                  ((unsigned int)IPTR(P))
 #define V2Z(X)                  ((X) ? JNI_TRUE : JNI_FALSE)
 #define INVALID_FIELD_OFFSET    (-1)
 #define INVALID_FIELD_BASE      (-1)

Modified: commons/sandbox/runtime/trunk/src/main/native/include/acr/jnimacros.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/acr/jnimacros.h?rev=1095904&r1=1095903&r2=1095904&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/acr/jnimacros.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/acr/jnimacros.h Fri Apr 22 09:44:02 2011
@@ -138,7 +138,7 @@
     (*env)->SetStaticBooleanField(env, _clazzn.i, _f##I##n.i, (V) ? JNI_TRUE : JNI_FALSE)
 
 #define GET_IFIELD_P(I, O, T)  \
-    (T)((ptrdiff_t)(*env)->GetLongField(env, (O), _f##I##n.i))
+    J2P((*env)->GetLongField(env, (O), _f##I##n.i), T)
 
 #define SET_IFIELD_P(I, O, V)  \
     (*env)->SetLongField(env, (O), _f##I##n.i, P2J(V))

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/arch_defs.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/arch_defs.h?rev=1095904&r1=1095903&r2=1095904&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/arch_defs.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/arch_defs.h Fri Apr 22 09:44:02 2011
@@ -30,6 +30,12 @@
 # define ACR_SSIZE_T_FMT        "d"
 #endif
 
+#if CC_SIZEOF_VOIDP == 8
+#define I2H(P)                  ((HANDLE)(IPTR(P) & ACR_I64_C(0x00000000FFFFFFFF)))
+#else
+#define I2H(I)                  ((HANDLE)IPTR(I))
+#endif
+
 #define ACR_CRLF                "\r\n"
 #define ACR__THREAD(pg)         _cr__thread(pg)
 #define RESOURCE_NAME_LEN       64

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/procmutex.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/procmutex.c?rev=1095904&r1=1095903&r2=1095904&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/procmutex.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/procmutex.c Fri Apr 22 09:44:02 2011
@@ -53,9 +53,9 @@ ACR_JNI_EXPORT(jboolean, Mutex, unlink0)
     return JNI_FALSE;
 }
 
-ACR_WIN_EXPORT(jlong, WindowsMutex, create0)(JNI_STDARGS,
-                                             jstring name,
-                                             jlong sd)
+ACR_WIN_EXPORT(jint, WindowsMutex, create0)(JNI_STDARGS,
+                                            jstring name,
+                                            jlong sd)
 {
     HANDLE h  = 0;
     SECURITY_ATTRIBUTES sa;
@@ -74,10 +74,10 @@ ACR_WIN_EXPORT(jlong, WindowsMutex, crea
         }
     } DONE_WITH_STR(name);
 
-    return P2J(h);
+    return V2I(h);
 }
 
-ACR_WIN_EXPORT(jlong, WindowsMutex, open0)(JNI_STDARGS, jstring name)
+ACR_WIN_EXPORT(jint, WindowsMutex, open0)(JNI_STDARGS, jstring name)
 {
     HANDLE h  = 0;
 
@@ -88,12 +88,12 @@ ACR_WIN_EXPORT(jlong, WindowsMutex, open
         }
     } DONE_WITH_STR(name);
 
-    return P2J(h);
+    return V2I(h);
 }
 
-ACR_WIN_EXPORT(jint, WindowsMutex, release0)(JNI_STDARGS, jlong mtx)
+ACR_WIN_EXPORT(jint, WindowsMutex, release0)(JNI_STDARGS, jint mtx)
 {
-    if (ReleaseMutex(J2P(mtx, HANDLE)))
+    if (ReleaseMutex(I2H(mtx)))
         return 0;
     else
         return ACR_GET_OS_ERROR();

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/semaphore.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/semaphore.c?rev=1095904&r1=1095903&r2=1095904&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/semaphore.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/semaphore.c Fri Apr 22 09:44:02 2011
@@ -53,9 +53,9 @@ ACR_JNI_EXPORT(jboolean, Semaphore, unli
     return JNI_FALSE;
 }
 
-ACR_WIN_EXPORT(jlong, WindowsSemaphore, create0)(JNI_STDARGS,
-                                                 jstring name,
-                                                 jint value, jlong sd)
+ACR_WIN_EXPORT(jint, WindowsSemaphore, create0)(JNI_STDARGS,
+                                                jstring name,
+                                                jint value, jlong sd)
 {
     HANDLE h  = 0;
     int maxval = 32767;
@@ -77,11 +77,10 @@ ACR_WIN_EXPORT(jlong, WindowsSemaphore, 
         }
     } DONE_WITH_STR(name);
 
-    return P2J(h);
+    return V2I(h);
 }
 
-ACR_WIN_EXPORT(jlong, WindowsSemaphore, open0)(JNI_STDARGS,
-                                               jstring name)
+ACR_WIN_EXPORT(jint, WindowsSemaphore, open0)(JNI_STDARGS, jstring name)
 {
     HANDLE h  = 0;
 
@@ -92,12 +91,12 @@ ACR_WIN_EXPORT(jlong, WindowsSemaphore, 
         }
     } DONE_WITH_STR(name);
 
-    return P2J(h);
+    return V2I(h);
 }
 
-ACR_WIN_EXPORT(jint, WindowsSemaphore, release0)(JNI_STDARGS, jlong sem)
+ACR_WIN_EXPORT(jint, WindowsSemaphore, release0)(JNI_STDARGS, jint sem)
 {
-    if (ReleaseSemaphore(J2P(sem, HANDLE), 1, 0))
+    if (ReleaseSemaphore(I2H(sem), 1, 0))
         return 0;
     else
         return ACR_GET_OS_ERROR();

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/winapi.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/winapi.c?rev=1095904&r1=1095903&r2=1095904&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/winapi.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/winapi.c Fri Apr 22 09:44:02 2011
@@ -30,9 +30,9 @@
 
 volatile LONG acr_signal_waiters = 0;
 
-ACR_WIN_EXPORT(jint, Win32, CloseHandle)(JNI_STDARGS, jlong handle)
+ACR_WIN_EXPORT(jint, Win32, CloseHandle)(JNI_STDARGS, jint handle)
 {
-    if (CloseHandle(J2P(handle, HANDLE)))
+    if (CloseHandle(I2H(handle)))
         return 0;
     else
         return ACR_GET_OS_ERROR();
@@ -41,12 +41,12 @@ ACR_WIN_EXPORT(jint, Win32, CloseHandle)
 ACR_WIN_EXPORT(void, Win32, LocalFree)(JNI_STDARGS, jlong ptr)
 {
     if (ptr != 0LL)
-        LocalFree(J2P(ptr, LPVOID));
+        LocalFree(J2V(ptr));
 }
 
-ACR_WIN_EXPORT(jint, Win32, WaitForSingleObject)(JNI_STDARGS, jlong handle, jint timeout)
+ACR_WIN_EXPORT(jint, Win32, WaitForSingleObject)(JNI_STDARGS, jint handle, jint timeout)
 {
-    DWORD ws = WaitForSingleObject(J2P(handle, HANDLE), (DWORD)timeout);
+    DWORD ws = WaitForSingleObject(I2H(handle), (DWORD)timeout);
     if (ws == WAIT_OBJECT_0 || ws == WAIT_ABANDONED)
         return 0;
     else if (ws == WAIT_TIMEOUT)
@@ -55,8 +55,8 @@ ACR_WIN_EXPORT(jint, Win32, WaitForSingl
         return ACR_GET_OS_ERROR();
 }
 
-ACR_WIN_EXPORT(jlong, Win32, CreateFileMapping)(JNI_STDARGS, jlong file, jlong sa,
-                                                jint protect, jlong size, jstring name)
+ACR_WIN_EXPORT(jint, Win32, CreateFileMapping)(JNI_STDARGS, jint file, jlong sa,
+                                               jint protect, jlong size, jstring name)
 {
     HANDLE h = 0;
     DWORD  sizelo, sizehi;
@@ -65,7 +65,7 @@ ACR_WIN_EXPORT(jlong, Win32, CreateFileM
     sizehi = (DWORD)(size >> 32);
 
     WITH_WSTR(name) {
-        h = CreateFileMappingW(J2P(file, HANDLE), J2P(sa, LPSECURITY_ATTRIBUTES),
+        h = CreateFileMappingW(I2H(file), J2P(sa, LPSECURITY_ATTRIBUTES),
                                protect, sizehi, sizelo, J2S(name));
         if (h == 0) {
             ACR_SAVE_OS_ERROR();
@@ -77,11 +77,11 @@ ACR_WIN_EXPORT(jlong, Win32, CreateFileM
         }
     } DONE_WITH_STR(name);
 
-    return P2J(h);
+    return V2I(h);
 }
 
-ACR_WIN_EXPORT(jlong, Win32, OpenFileMapping)(JNI_STDARGS, jint acc, jboolean inherit,
-                                              jstring name)
+ACR_WIN_EXPORT(jint, Win32, OpenFileMapping)(JNI_STDARGS, jint acc, jboolean inherit,
+                                             jstring name)
 {
     HANDLE h = 0;
 
@@ -91,10 +91,10 @@ ACR_WIN_EXPORT(jlong, Win32, OpenFileMap
             ACR_SAVE_OS_ERROR();
     } DONE_WITH_STR(name);
 
-    return P2J(h);
+    return V2I(h);
 }
 
-ACR_WIN_EXPORT(jlong, Win32, MapViewOfFile)(JNI_STDARGS, jlong map, jint acc,
+ACR_WIN_EXPORT(jlong, Win32, MapViewOfFile)(JNI_STDARGS, jint map, jint acc,
                                             jlong offset, jlong size)
 {
     LPVOID m;
@@ -103,7 +103,7 @@ ACR_WIN_EXPORT(jlong, Win32, MapViewOfFi
     offlo = (DWORD)(offset);
     offhi = (DWORD)(offset >> 32);
 
-    m = MapViewOfFile(J2P(map, HANDLE), acc, offhi, offlo, (SIZE_T)size);
+    m = MapViewOfFile(I2H(map), acc, offhi, offlo, (SIZE_T)size);
     if (m == 0)
         ACR_SAVE_OS_ERROR();
 
@@ -112,7 +112,7 @@ ACR_WIN_EXPORT(jlong, Win32, MapViewOfFi
 
 ACR_WIN_EXPORT(jint, Win32, FlushViewOfFile)(JNI_STDARGS, jlong addr, jlong size)
 {
-    if (FlushViewOfFile(J2P(addr, LPVOID), (SIZE_T)size))
+    if (FlushViewOfFile(J2V(addr), (SIZE_T)size))
         return 0;
     else
         return ACR_GET_OS_ERROR();
@@ -120,13 +120,13 @@ ACR_WIN_EXPORT(jint, Win32, FlushViewOfF
 
 ACR_WIN_EXPORT(jint, Win32, UnmapViewOfFile)(JNI_STDARGS, jlong addr)
 {
-    if (UnmapViewOfFile(J2P(addr, LPVOID)))
+    if (UnmapViewOfFile(J2V(addr)))
         return 0;
     else
         return ACR_GET_OS_ERROR();
 }
 
-ACR_WIN_EXPORT(jlong, Win32, CreateMutex)(JNI_STDARGS, jlong sa, jboolean owner, jstring name)
+ACR_WIN_EXPORT(jint, Win32, CreateMutex)(JNI_STDARGS, jlong sa, jboolean owner, jstring name)
 {
     HANDLE h = 0;
 
@@ -137,10 +137,10 @@ ACR_WIN_EXPORT(jlong, Win32, CreateMutex
             ACR_SAVE_OS_ERROR();
     } DONE_WITH_STR(name);
 
-    return P2J(h);
+    return V2I(h);
 }
 
-ACR_WIN_EXPORT(jlong, Win32, OpenMutex)(JNI_STDARGS, jint access, jboolean inherit, jstring name)
+ACR_WIN_EXPORT(jint, Win32, OpenMutex)(JNI_STDARGS, jint access, jboolean inherit, jstring name)
 {
     HANDLE h = 0;
 
@@ -150,14 +150,14 @@ ACR_WIN_EXPORT(jlong, Win32, OpenMutex)(
             ACR_SAVE_OS_ERROR();
     } DONE_WITH_STR(name);
 
-    return P2J(h);
+    return V2I(h);
 }
 
 ACR_WIN_EXPORT(jlong, Win32, VirtualAlloc)(JNI_STDARGS, jlong base, jlong size, jint type, jint protect)
 {
     LPVOID mem = 0;
 
-    mem = VirtualAlloc(J2P(base, LPVOID), (SIZE_T)size, type, protect);
+    mem = VirtualAlloc(J2V(base), (SIZE_T)size, type, protect);
     if (mem == 0)
         ACR_SAVE_OS_ERROR();
     return P2J(mem);
@@ -165,7 +165,7 @@ ACR_WIN_EXPORT(jlong, Win32, VirtualAllo
 
 ACR_WIN_EXPORT(jint, Win32, VirtualProtect)(JNI_STDARGS, jlong addr, jlong size, jint protect)
 {
-    if (VirtualProtect(J2P(addr, LPVOID), (SIZE_T)size, protect, 0))
+    if (VirtualProtect(J2V(addr), (SIZE_T)size, protect, 0))
         return 0;
     else
         return ACR_GET_OS_ERROR();
@@ -173,7 +173,7 @@ ACR_WIN_EXPORT(jint, Win32, VirtualProte
 
 ACR_WIN_EXPORT(jint, Win32, VirtualFree)(JNI_STDARGS, jlong addr, jlong size, jint type)
 {
-    if (VirtualFree(J2P(addr, LPVOID), (SIZE_T)size, type))
+    if (VirtualFree(J2V(addr), (SIZE_T)size, type))
         return 0;
     else
         return ACR_GET_OS_ERROR();

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/iofd.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/iofd.c?rev=1095904&r1=1095903&r2=1095904&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/iofd.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/iofd.c Fri Apr 22 09:44:02 2011
@@ -166,7 +166,7 @@ AcrSetFileDescriptorHandle(JNI_STDARGS, 
 #endif
 
 jobject
-AcrNewFileDescriptor(JNI_STDENV, int fd, acr_osd_t fh)
+AcrNewFileDescriptor(JNI_STDENV, int fd, void *fh)
 {
     jobject fo;
 
@@ -190,7 +190,7 @@ AcrNewFileDescriptor(JNI_STDENV, int fd,
 
 ACR_IO_EXPORT(jobject, FileDescriptorFactory, new0)(JNI_STDARGS, jint fd, jlong fh)
 {
-    return AcrNewFileDescriptor(env, fd, (acr_osd_t)LLT(fh));
+    return AcrNewFileDescriptor(env, fd, J2V(fh));
 }
 
 ACR_IO_EXPORT(jint, Utils, getFd0)(JNI_STDARGS, jobject fd)