Update of /cvsroot/pywin32/pywin32/win32/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7519/win32/src
Modified Files:
win32file.i
Log Message:
In FindFilesW, pass unicode unmodified and also accept char args
Index: win32file.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32file.i,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** win32file.i 26 Jan 2004 23:34:56 -0000 1.35
--- win32file.i 28 Feb 2004 19:15:52 -0000 1.36
***************
*** 347,365 ****
PyFindFilesW(PyObject *self, PyObject *args)
{
! char *fileSpec;
// @pyparm string|fileSpec||A string that specifies a valid directory or path and filename, which can contain wildcard characters (* and ?).
!
! if (!PyArg_ParseTuple (args, "s:FindFilesW", &fileSpec))
return NULL;
WIN32_FIND_DATAW findData;
// @pyseeapi FindFirstFile
HANDLE hFind;
- int len=strlen(fileSpec);
- WCHAR *pBuf = new WCHAR[len+1];
- if (0==MultiByteToWideChar( CP_ACP, 0, fileSpec, len+1, pBuf, sizeof(WCHAR)*(len+1)))
- return PyWin_SetAPIError("MultiByteToWideChar");
- hFind = ::FindFirstFileW(pBuf, &findData);
- delete [] pBuf;
if (hFind==INVALID_HANDLE_VALUE) {
if (::GetLastError()==ERROR_FILE_NOT_FOUND) { // this is OK
--- 347,363 ----
PyFindFilesW(PyObject *self, PyObject *args)
{
! WCHAR *fileSpec;
// @pyparm string|fileSpec||A string that specifies a valid directory or path and filename, which can contain wildcard characters (* and ?).
! PyObject *obfileSpec=NULL;
! if (!PyArg_ParseTuple (args, "O:FindFilesW", &obfileSpec))
! return NULL;
! if (!PyWinObject_AsWCHAR(obfileSpec,&fileSpec,FALSE))
return NULL;
WIN32_FIND_DATAW findData;
// @pyseeapi FindFirstFile
HANDLE hFind;
+ hFind = ::FindFirstFileW(fileSpec, &findData);
+ PyWinObject_FreeWCHAR(fileSpec);
if (hFind==INVALID_HANDLE_VALUE) {
if (::GetLastError()==ERROR_FILE_NOT_FOUND) { // this is OK
|