commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r805889 - in /commons/sandbox/runtime/trunk/src/main/native: include/arch/unix/acr_arch.h include/arch/windows/acr_arch.h os/unix/psema.c shared/memory.c
Date Wed, 19 Aug 2009 17:13:26 GMT
Author: mturk
Date: Wed Aug 19 17:13:26 2009
New Revision: 805889

URL: http://svn.apache.org/viewvc?rev=805889&view=rev
Log:
Add VALID_HANDLE macro

Modified:
    commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/acr_arch.h
    commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h
    commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c
    commons/sandbox/runtime/trunk/src/main/native/shared/memory.c

Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/acr_arch.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/acr_arch.h?rev=805889&r1=805888&r2=805889&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/acr_arch.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/unix/acr_arch.h Wed Aug 19
17:13:26 2009
@@ -39,6 +39,7 @@
 #define ACR_MAX_FREAD_LEN    65536
 #define INVALID_HANDLE_VALUE ((void *)(ptrdiff_t)-1)
 #define IS_INVALID_HANDLE(h) (((h) == NULL || (h) == INVALID_HANDLE_VALUE))
+#define IS_VALID_HANDLE(h)   (((h) != NULL && (h) != INVALID_HANDLE_VALUE))
 
 typedef struct acr_ioh acr_ioh;
 typedef int (acr_ioh_cleanup_fn_t)(void *, int, unsigned int);

Modified: commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h?rev=805889&r1=805888&r2=805889&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h (original)
+++ commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h Wed Aug
19 17:13:26 2009
@@ -692,6 +692,7 @@
 #endif /* ACR_WANT_LATE_DLL */
 
 #define IS_INVALID_HANDLE(h) (((h) == NULL || (h) == INVALID_HANDLE_VALUE))
+#define IS_VALID_HANDLE(h)   (((h) != NULL && (h) != INVALID_HANDLE_VALUE))
 #define ACR_REGS_CPU  "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\"
 #define ACR_REGS_CPU0 ACR_REGS_CPU "0\\"
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c?rev=805889&r1=805888&r2=805889&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/psema.c Wed Aug 19 17:13:26 2009
@@ -122,7 +122,7 @@
 finally:
     if (rc) {
         free(s);
-        if (!IS_INVALID_HANDLE(_E)) {
+        if (IS_VALID_HANDLE(_E)) {
             if (ACR_STATUS_IS_EACCES(rc))
                 ACR_ThrowException(_E, THROW_NMARK, ACR_EX_ESECURITY, 0);
             else
@@ -162,7 +162,7 @@
 finally:
     if (rc) {
         x_free(s);
-        if (!IS_INVALID_HANDLE(_E)) {
+        if (IS_VALID_HANDLE(_E)) {
             if (ACR_STATUS_IS_EACCES(rc))
                 ACR_ThrowException(_E, THROW_NMARK, ACR_EX_ESECURITY, 0);
             else

Modified: commons/sandbox/runtime/trunk/src/main/native/shared/memory.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/shared/memory.c?rev=805889&r1=805888&r2=805889&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/shared/memory.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/shared/memory.c Wed Aug 19 17:13:26 2009
@@ -42,7 +42,7 @@
         int err = ACR_GET_OS_ERROR();
         if (_E == NULL)
             _E = ACR_GetJNIEnv();
-        if (!IS_INVALID_HANDLE(_E))
+        if (IS_VALID_HANDLE(_E))
             ACR_ThrowException(_E, file, line, ACR_EX_ENOMEM, err);
     }
     return mem;
@@ -57,7 +57,7 @@
         int err = ACR_GET_OS_ERROR();
         if (_E == NULL)
             _E = ACR_GetJNIEnv();
-        if (!IS_INVALID_HANDLE(_E))
+        if (IS_VALID_HANDLE(_E))
             ACR_ThrowException(_E, file, line, ACR_EX_ENOMEM, err);
     }
     return mem;
@@ -72,7 +72,7 @@
         int err = ACR_GET_OS_ERROR();
         if (_E == NULL)
             _E = ACR_GetJNIEnv();
-        if (!IS_INVALID_HANDLE(_E))
+        if (IS_VALID_HANDLE(_E))
             ACR_ThrowException(_E, file, line, ACR_EX_ENOMEM, err);
     }
     return mem;
@@ -84,7 +84,7 @@
     if (IS_INVALID_HANDLE(mem)) {
         if (_E == NULL)
             _E = ACR_GetJNIEnv();
-        if (!IS_INVALID_HANDLE(_E))
+        if (IS_VALID_HANDLE(_E))
             ACR_ThrowException(_E, file, line, ACR_EX_ENULL,
                                ACR_EISNULL);
     }
@@ -117,7 +117,7 @@
             if (size > ACR_SIZE_T_MAX) {
                 /* We should fall lot before that.
                  */
-                if (!IS_INVALID_HANDLE(_E))
+                if (IS_VALID_HANDLE(_E))
                     ACR_ThrowException(_E, file, line, ACR_EX_EINVAL,
                                        ACR_EINVAL);
                 return NULL;
@@ -177,7 +177,7 @@
     if (!sbh) {
         if (_E == NULL)
             _E = ACR_GetJNIEnv();
-        if (!IS_INVALID_HANDLE(_E))
+        if (IS_VALID_HANDLE(_E))
             ACR_ThrowException(_E, file, line, ACR_EX_ENULL,
                                ACR_EISNULL);
         return NULL;
@@ -185,7 +185,7 @@
     if (size > ACR_SIZE_T_MAX) {
         /* We should fail lot before that.
          */
-        if (!IS_INVALID_HANDLE(_E))
+        if (IS_VALID_HANDLE(_E))
             ACR_ThrowException(_E, file, line, ACR_EX_EINVAL,
                                ACR_EINVAL);
         return NULL;
@@ -220,9 +220,9 @@
     if (!sbh) {
         if (_E == NULL)
             _E = ACR_GetJNIEnv();
-        if (!IS_INVALID_HANDLE(_E))
-        ACR_ThrowException(_E, file, line, ACR_EX_ENULL,
-                           ACR_EISNULL);
+        if (IS_VALID_HANDLE(_E))
+            ACR_ThrowException(_E, file, line, ACR_EX_ENULL,
+                               ACR_EISNULL);
         return;
     }
     if (sbh->dyn_ppos && sbh->dyn_buff) {
@@ -242,7 +242,7 @@
     if (!sbh) {
         if (_E == NULL)
             _E = ACR_GetJNIEnv();
-        if (!IS_INVALID_HANDLE(_E))
+        if (IS_VALID_HANDLE(_E))
             ACR_ThrowException(_E, file, line, ACR_EX_ENULL,
                                ACR_EISNULL);
         return;



Mime
View raw message