commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r805028 - in /commons/sandbox/runtime/trunk/src/main/native: include/arch/windows/acr_arch.h os/win32/dirent.c
Date Mon, 17 Aug 2009 16:18:07 GMT
Author: mturk
Date: Mon Aug 17 16:18:07 2009
New Revision: 805028

URL: http://svn.apache.org/viewvc?rev=805028&view=rev
Log:
Append star only on find itself and revert immediately after

Modified:
    commons/sandbox/runtime/trunk/src/main/native/include/arch/windows/acr_arch.h
    commons/sandbox/runtime/trunk/src/main/native/os/win32/dirent.c

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=805028&r1=805027&r2=805028&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 Mon Aug
17 16:18:07 2009
@@ -382,6 +382,9 @@
 
     struct dirent    d_dir;
     wchar_t          d_name[8192];
+    size_t           d_star;       /* internal position where star is
+                                    * inserted during readdir
+                                    */
 } DIR;
 
 #define _NSIG       32  /* counting 0; could be 33 (mask is 1-32) */

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/dirent.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/dirent.c?rev=805028&r1=805027&r2=805028&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/dirent.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/dirent.c Mon Aug 17 16:18:07 2009
@@ -69,7 +69,8 @@
     len = wcslen(dir->d_name);
     if (dir->d_name[len-1] != L'\\')
         dir->d_name[len++]  = L'\\';
-    dir->d_name[len++] = L'*';
+    dir->d_star        = len;
+    dir->d_name[len++] = 0;
     dir->d_name[len++] = 0;
 
     dir->d_find = INVALID_HANDLE_VALUE;
@@ -140,7 +141,9 @@
     else if (dir->d_stat == 0) {
         /* Start the search
          */
+        dir->d_name[dir->d_star] = L'*';
         dir->d_find = FindFirstFileW(dir->d_name, &wfind);
+        dir->d_name[dir->d_star] = 0;
         if (dir->d_find == INVALID_HANDLE_VALUE) {
             /* No files in the dir?
              */
@@ -174,8 +177,8 @@
         /* Fill in the dirent structure
          */
         mblen = WideCharToMultiByte(CP_UTF8, 0, wfind.cFileName, -1,
-                                    entry->d_name, 1023, NULL, 0);
-        if (mblen == 0 || mblen > 1023)
+                                    entry->d_name, 1024, NULL, 0);
+        if (mblen == 0 || mblen > 1024)
             return GetLastError();
         entry->d_ino    = 0;
         entry->d_type   = 0;
@@ -277,3 +280,4 @@
 }
 
 #endif
+



Mime
View raw message