You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by le...@apache.org on 2007/07/27 03:49:53 UTC

svn commit: r560057 - /harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c

Author: leoli
Date: Thu Jul 26 18:49:52 2007
New Revision: 560057

URL: http://svn.apache.org/viewvc?view=rev&rev=560057
Log:
Apply patch for HARMONY-4493([classlib][EUT] jdtcoremodel suite is blocked because ClasspathTests.testEncoding cannot remove unicode dir).

Modified:
    harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c

Modified: harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c?view=diff&rev=560057&r1=560056&r2=560057
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c (original)
+++ harmony/enhanced/classlib/trunk/modules/portlib/src/main/native/port/windows/hyfile.c Thu Jul 26 18:49:52 2007
@@ -197,14 +197,17 @@
 hyfile_findfirst (struct HyPortLibrary *portLibrary, const char *path,
 		  char *resultbuf)
 {
-  WIN32_FIND_DATA lpFindFileData;
+  WIN32_FIND_DATAW lpFindFileDataW;
   char newPath[HyMaxPath];
   HANDLE result;
-
+  wchar_t *pathW;  
+  
   strcpy (newPath, path);
   strcat (newPath, "*");
+  
+  convert_path_to_unicode(portLibrary, newPath, &pathW);
 
-  result = FindFirstFile ((LPCTSTR) newPath, &lpFindFileData);
+  result = FindFirstFileW ((LPCWSTR) pathW, &lpFindFileDataW);
   if (result == INVALID_HANDLE_VALUE)
     {
       I_32 error = GetLastError ();
@@ -212,8 +215,7 @@
 					 findError (error));
       return (UDATA) - 1;
     }
-
-  lstrcpy (resultbuf, lpFindFileData.cFileName);
+  WideCharToMultiByte(CP_UTF8, 0, lpFindFileDataW.cFileName, -1, resultbuf, HyMaxPath, NULL, NULL);  
   return (UDATA) result;
 }
 
@@ -234,16 +236,15 @@
 hyfile_findnext (struct HyPortLibrary * portLibrary, UDATA findhandle,
 		 char *resultbuf)
 {
-  WIN32_FIND_DATA lpFindFileData;
-  if (!FindNextFile ((HANDLE) findhandle, &lpFindFileData))
+  WIN32_FIND_DATAW lpFindFileDataW;  
+  if (!FindNextFileW ((HANDLE) findhandle, &lpFindFileDataW))
     {
       I_32 error = GetLastError ();
       portLibrary->error_set_last_error (portLibrary, error,
 					 findError (error));
       return -1;
     }
-
-  lstrcpy (resultbuf, lpFindFileData.cFileName);
+  WideCharToMultiByte(CP_UTF8, 0, lpFindFileDataW.cFileName, -1, resultbuf, HyMaxPath, NULL, NULL); 
   return 0;
 }