Update of /cvsroot/pywin32/pywin32/com/win32comext/shell/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17590
Modified Files:
Tag: py3k
PyIExtractIcon.cpp PyIShellLink.cpp shell.cpp
Log Message:
Allow to build with UNICODE defined
Index: PyIShellLink.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIShellLink.cpp,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -C2 -d -r1.9 -r1.9.2.1
*** PyIShellLink.cpp 3 Jun 2007 14:53:07 -0000 1.9
--- PyIShellLink.cpp 13 Sep 2008 15:48:31 -0000 1.9.2.1
***************
*** 61,67 ****
return OleSetOleError(hr);
}
! PyObject *obFD = PyObject_FromWIN32_FIND_DATAA(&fd);
! PyObject *obFile = PyWinObject_FromTCHAR(pszFile);
! PyObject *ret = Py_BuildValue("NN", obFile, obFD);
free(pszFile);
return ret;
--- 61,67 ----
return OleSetOleError(hr);
}
! PyObject *ret = Py_BuildValue("NN",
! PyWinObject_FromTCHAR(pszFile),
! PyObject_FromWIN32_FIND_DATA(&fd));
free(pszFile);
return ret;
Index: PyIExtractIcon.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/PyIExtractIcon.cpp,v
retrieving revision 1.5
retrieving revision 1.5.2.1
diff -C2 -d -r1.5 -r1.5.2.1
*** PyIExtractIcon.cpp 26 Jul 2008 02:31:48 -0000 1.5
--- PyIExtractIcon.cpp 13 Sep 2008 15:48:31 -0000 1.5.2.1
***************
*** 114,118 ****
PY_GATEWAY_METHOD;
PyObject *obpszFile;
! obpszFile = PyString_FromString((LPTSTR)pszFile);
PyObject *result;
HRESULT hr=InvokeViaPolicy("Extract", &result, "Oii", obpszFile, nIconIndex, nIconSize);
--- 114,118 ----
PY_GATEWAY_METHOD;
PyObject *obpszFile;
! obpszFile = PyWinObject_FromTCHAR(pszFile);
PyObject *result;
HRESULT hr=InvokeViaPolicy("Extract", &result, "Oii", obpszFile, nIconIndex, nIconSize);
***************
*** 156,163 ****
else {
if (PyArg_ParseTuple(result, "Oii", &obFileName, piIndex, pflags)) {
! char *filename;
! if (PyWinObject_AsString(obFileName, &filename)) {
! strncpy(szIconFile, filename, cchMax);
! PyWinObject_FreeString(filename);
}
}
--- 156,163 ----
else {
if (PyArg_ParseTuple(result, "Oii", &obFileName, piIndex, pflags)) {
! TCHAR *filename;
! if (PyWinObject_AsTCHAR(obFileName, &filename)) {
! _tcsncpy(szIconFile, filename, cchMax);
! PyWinObject_FreeTCHAR(filename);
}
}
Index: shell.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/com/win32comext/shell/src/shell.cpp,v
retrieving revision 1.68.2.1
retrieving revision 1.68.2.2
diff -C2 -d -r1.68.2.1 -r1.68.2.2
*** shell.cpp 29 Aug 2008 08:33:13 -0000 1.68.2.1
--- shell.cpp 13 Sep 2008 15:48:31 -0000 1.68.2.2
***************
*** 1769,1773 ****
return PyErr_NoMemory();
nchars = ::DragQueryFile(hglobal, index, sz, nchars);
! PyObject *ret = PyString_FromStringAndSize(sz, nchars);
free(sz);
return ret;
--- 1769,1773 ----
return PyErr_NoMemory();
nchars = ::DragQueryFile(hglobal, index, sz, nchars);
! PyObject *ret = PyWinObject_FromTCHAR(sz, nchars);
free(sz);
return ret;
***************
*** 1968,1972 ****
--- 1968,1976 ----
// on what other attributes exist.
// @pyparm bool|make_unicode|False|If true, a FILEDESCRIPTORW object is created
+ #ifdef UNICODE
+ int make_unicode = TRUE;
+ #else
int make_unicode = FALSE;
+ #endif
if (!PyArg_ParseTuple(args, "O|i", &ob, &make_unicode))
return NULL;
|