commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r828328 - in /commons/sandbox/runtime/trunk/src/main/native/os/win32: mmap.c shm.c wutil.c
Date Thu, 22 Oct 2009 06:48:25 GMT
Author: mturk
Date: Thu Oct 22 06:48:25 2009
New Revision: 828328

URL: http://svn.apache.org/viewvc?rev=828328&view=rev
Log:
Always use path macros for ARC<->Win32 path conversion

Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c
    commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c?rev=828328&r1=828327&r2=828328&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/mmap.c Thu Oct 22 06:48:25 2009
@@ -389,14 +389,14 @@
     int     imap;
 
     UNREFERENCED_O;
-    WITH_WSTR(fname) {
+    WITH_WPATH(fname) {
         imap = ACR_MMapOpen(_E, J2W(fname), flags);
         if (imap > 0) {
             /* Create Descriptor Object */
             mapd = ACR_DescriptorCreate(_E, ACR_DT_MMAP, imap, NULL,
                                         mmap_descriptor_cleanup);
         }
-    } END_WITH_WSTR(fname);
+    } END_WITH_WPATH(fname);
     return mapd;
 }
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c?rev=828328&r1=828327&r2=828328&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/shm.c Thu Oct 22 06:48:25 2009
@@ -483,9 +483,9 @@
     jobject shm = NULL;
     UNREFERENCED_O;
 
-    WITH_WSTR(name) {
+    WITH_WPATH(name) {
         shm = ACR_SharedMemoryObjectCreate(_E, J2W(name), (size_t)size);
-    } END_WITH_WSTR(name);
+    } END_WITH_WPATH(name);
     return shm;
 }
 
@@ -496,9 +496,9 @@
     jobject shm = NULL;
     UNREFERENCED_O;
 
-    WITH_WSTR(name) {
+    WITH_WPATH(name) {
         shm = ACR_SharedMemoryObjectAttach(_E, J2W(name));
-    } END_WITH_WSTR(name);
+    } END_WITH_WPATH(name);
     return shm;
 }
 
@@ -509,9 +509,9 @@
     int rc = ACR_SUCCESS;
     UNREFERENCED_O;
 
-    WITH_WSTR(name) {
+    WITH_WPATH(name) {
         rc = ACR_ShmRemove(_E, J2W(name));
-    } END_WITH_WSTR(name);
+    } END_WITH_WPATH(name);
     return rc;
 }
 

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c?rev=828328&r1=828327&r2=828328&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c Thu Oct 22 06:48:25 2009
@@ -521,41 +521,44 @@
 
 wchar_t *acr_GetAbsolutePath(JNIEnv *_E, HANDLE fh, const wchar_t *path)
 {
-    wchar_t *fname = NULL;
-    int rc = 0;
+    wchar_t buff[ACR_HBUFF_SIZ];
+    wchar_t name[ACR_HBUFF_SIZ] = L"";
+    DWORD   nl;
+    int     rc = 0;
 
     if (ACR_HAVE_LATE_DLL_FUNC(GetFinalPathNameByHandleW)) {
-        DWORD nl;
-        nl = GetFinalPathNameByHandleW(fh, NULL, 0, FILE_NAME_NORMALIZED);
+        nl = GetFinalPathNameByHandleW(fh, buff, ACR_HBUFF_LEN, FILE_NAME_NORMALIZED);
         if (nl == 0) {
             rc = ACR_GET_OS_ERROR();
             goto finally;
         }
-        fname = ACR_MALLOC(wchar_t, nl + 1);
-        if (!fname) {
-            rc = ACR_ENOMEM;
+        if (nl >= ACR_HBUFF_SIZ) {
+            rc = ACR_EOVERFLOW;
             goto finally;
         }
-        GetFinalPathNameByHandleW(fh, fname, nl, FILE_NAME_NORMALIZED);
+        if ((rc = unicode_to_acr_path(name, ACR_HBUFF_LEN, buff)))
+            goto finally;
     }
     else {
-        DWORD nl;
-
-        nl = GetFullPathNameW(path, 0, NULL, NULL);
+        nl = GetFullPathNameW(path, ACR_HBUFF_LEN, buff, NULL);
         if (nl == 0) {
             rc = ACR_GET_OS_ERROR();
             goto finally;
         }
-        fname = ACR_MALLOC(wchar_t, nl + 1);
-        if (!fname) {
-            rc = ACR_ENOMEM;
+        if (nl >= ACR_HBUFF_SIZ) {
+            rc = ACR_EOVERFLOW;
             goto finally;
         }
-        GetFullPathNameW(path, nl, fname, NULL);
+        if ((rc = unicode_to_acr_path(name, ACR_HBUFF_LEN, buff)))
+            goto finally;
     }
 
 finally:
-    if (rc)
+    if (rc) {
         SetLastError(rc);
-    return fname;
+        return NULL;
+    }
+    else {
+        return ACR_StrdupW(_E, THROW_FMARK, name);
+    }
 }



Mime
View raw message