Update of /cvsroot/pywin32/pywin32/win32/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12369/win32/src
Modified Files:
Tag: py3k
PyHANDLE.cpp PyTime.cpp PyWinTypesmodule.cpp
win32clipboardmodule.cpp win32consolemodule.cpp
win32rasmodule.cpp
Log Message:
merge minor consolidations from the trunk
Index: win32rasmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32rasmodule.cpp,v
retrieving revision 1.10.2.2
retrieving revision 1.10.2.3
diff -C2 -d -r1.10.2.2 -r1.10.2.3
*** win32rasmodule.cpp 2 Sep 2008 09:39:31 -0000 1.10.2.2
--- win32rasmodule.cpp 4 Dec 2008 00:07:22 -0000 1.10.2.3
***************
*** 64,81 ****
_tcscpy(buf, _T("No error message is available"));
/* strip trailing cr/lf */
! /* Too much of a pain for unicode, it's just an error msg
! size_t end = strlen(buf)-1;
! if (end>1 && (buf[end-1]=='\n' || buf[end-1]=='\r'))
! buf[end-1] = '\0';
else
! if (end>0 && (buf[end]=='\n' || buf[end]=='\r'))
! buf[end]='\0';
! */
PyObject *v = Py_BuildValue("(iNN)", errorCode,
! #if (PY_VERSION_HEX >= 0x03000000)
! PyUnicode_FromString(fnName),
! #else
! PyString_FromString(fnName),
! #endif
PyWinObject_FromTCHAR(buf));
if (v != NULL) {
--- 64,75 ----
_tcscpy(buf, _T("No error message is available"));
/* strip trailing cr/lf */
! size_t end = _tcslen(buf)-1;
! if (end>1 && (buf[end-1]==_T('\n') || buf[end-1]==_T('\r')))
! buf[end-1] = 0;
else
! if (end>0 && (buf[end]==_T('\n') || buf[end]==_T('\r')))
! buf[end]=0;
PyObject *v = Py_BuildValue("(iNN)", errorCode,
! PyWinCoreString_FromString(fnName),
PyWinObject_FromTCHAR(buf));
if (v != NULL) {
***************
*** 583,587 ****
pCon = &tc;
}
! PyObject *ret = PyTuple_New(noConns);
if (ret==NULL)
return NULL;
--- 577,581 ----
pCon = &tc;
}
! PyObject *ret = PyList_New(noConns);
if (ret==NULL)
return NULL;
***************
*** 598,602 ****
break;
}
! PyTuple_SET_ITEM(ret, i, item);
}
// @rdesc Each tuple is of format (handle, entryName, deviceType, deviceName)
--- 592,596 ----
break;
}
! PyList_SET_ITEM(ret, i, item);
}
// @rdesc Each tuple is of format (handle, entryName, deviceType, deviceName)
Index: PyTime.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyTime.cpp,v
retrieving revision 1.19.2.1
retrieving revision 1.19.2.2
diff -C2 -d -r1.19.2.1 -r1.19.2.2
*** PyTime.cpp 29 Aug 2008 04:59:25 -0000 1.19.2.1
--- PyTime.cpp 4 Dec 2008 00:07:22 -0000 1.19.2.2
***************
*** 640,649 ****
TCHAR resBuf[160];
wsprintf(resBuf, _T("<PyTime:%s %s>"), dateBuf, timeBuf);
! #if (PY_VERSION_HEX < 0x03000000)
! return PyString_FromTCHAR(resBuf);
! #else
! // Py3k requires that Unicode is returned
! return PyWinObject_FromWCHAR(resBuf);
! #endif
}
--- 640,644 ----
TCHAR resBuf[160];
wsprintf(resBuf, _T("<PyTime:%s %s>"), dateBuf, timeBuf);
! return PyWinCoreString_FromString(resBuf);
}
Index: win32consolemodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32consolemodule.cpp,v
retrieving revision 1.13.2.2
retrieving revision 1.13.2.3
diff -C2 -d -r1.13.2.2 -r1.13.2.3
*** win32consolemodule.cpp 7 Oct 2008 15:28:49 -0000 1.13.2.2
--- win32consolemodule.cpp 4 Dec 2008 00:07:22 -0000 1.13.2.3
***************
*** 211,219 ****
return NULL;
}
! #if (PY_VERSION_HEX < 0x03000000)
! return PyString_FromStringAndSize(buf,chars_printed);
! #else
! return PyUnicode_FromString(buf);
! #endif
}
--- 211,215 ----
return NULL;
}
! return PyWinCoreString_FromString(buf,chars_printed);
}
***************
*** 363,371 ****
return NULL;
}
! #if (PY_VERSION_HEX < 0x03000000)
! return PyString_FromStringAndSize(buf,chars_printed);
! #else
! return PyUnicode_FromString(buf);
! #endif
}
--- 359,363 ----
return NULL;
}
! return PyWinCoreString_FromString(buf,chars_printed);
}
***************
*** 755,763 ****
return NULL;
}
! #if (PY_VERSION_HEX < 0x03000000)
! return PyString_FromStringAndSize(buf,chars_printed);
! #else
! return PyUnicode_FromString(buf);
! #endif
}
--- 747,751 ----
return NULL;
}
! return PyWinCoreString_FromString(buf,chars_printed);
}
Index: win32clipboardmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32clipboardmodule.cpp,v
retrieving revision 1.23.2.2
retrieving revision 1.23.2.3
diff -C2 -d -r1.23.2.2 -r1.23.2.3
*** win32clipboardmodule.cpp 26 Nov 2008 07:17:39 -0000 1.23.2.2
--- win32clipboardmodule.cpp 4 Dec 2008 00:07:22 -0000 1.23.2.3
***************
*** 481,485 ****
return NULL;
if (!PyWinObject_AsHANDLE(obhglobal, &hglobal))
! return NULL;
size_t size = GlobalSize(hglobal);
if (!size)
--- 481,485 ----
return NULL;
if (!PyWinObject_AsHANDLE(obhglobal, &hglobal))
! return NULL;
size_t size = GlobalSize(hglobal);
if (!size)
***************
*** 903,907 ****
bufSize++; // size doesnt include nulls!
// else assume buffer needs no terminator...
! }
handle = GlobalAlloc(GHND, bufSize);
if (handle == NULL) {
--- 903,907 ----
bufSize++; // size doesnt include nulls!
// else assume buffer needs no terminator...
! }
handle = GlobalAlloc(GHND, bufSize);
if (handle == NULL) {
***************
*** 918,921 ****
--- 918,922 ----
if (!data)
+ // XXX - should we GlobalFree the mem?
return ReturnAPIError("SetClipboardData");
return PyWinLong_FromHANDLE(data);
Index: PyWinTypesmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypesmodule.cpp,v
retrieving revision 1.39.2.9
retrieving revision 1.39.2.10
diff -C2 -d -r1.39.2.9 -r1.39.2.10
*** PyWinTypesmodule.cpp 11 Nov 2008 00:39:36 -0000 1.39.2.9
--- PyWinTypesmodule.cpp 4 Dec 2008 00:07:22 -0000 1.39.2.10
***************
*** 326,334 ****
PyObject *v = Py_BuildValue("(iNN)",
errorCode,
! #if (PY_VERSION_HEX >= 0x03000000)
! PyUnicode_FromString(fnName),
! #else
! PyString_FromString(fnName),
! #endif
PyWinObject_FromTCHAR(buf));
if (free_buf && buf)
--- 326,330 ----
PyObject *v = Py_BuildValue("(iNN)",
errorCode,
! PyWinCoreString_FromString(fnName),
PyWinObject_FromTCHAR(buf));
if (free_buf && buf)
Index: PyHANDLE.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyHANDLE.cpp,v
retrieving revision 1.16.2.4
retrieving revision 1.16.2.5
diff -C2 -d -r1.16.2.4 -r1.16.2.5
*** PyHANDLE.cpp 5 Oct 2008 19:54:04 -0000 1.16.2.4
--- PyHANDLE.cpp 4 Dec 2008 00:07:22 -0000 1.16.2.5
***************
*** 322,327 ****
int PyHANDLE::print(FILE *fp, int flags)
{
! WCHAR resBuf[160];
! wsprintfW(resBuf, L"<%hs at %Id (%Id)>", GetTypeName(), this, m_handle);
// ### ACK! Python uses a non-debug runtime. We can't use stream
// ### functions when in DEBUG mode!! (we link against a different
--- 322,327 ----
int PyHANDLE::print(FILE *fp, int flags)
{
! TCHAR resBuf[160];
! wsprintf(resBuf, _T("<%hs at %Id (%Id)>"), GetTypeName(), this, m_handle);
// ### ACK! Python uses a non-debug runtime. We can't use stream
// ### functions when in DEBUG mode!! (we link against a different
***************
*** 330,334 ****
// ### - Double Ack - Always use the hack!
//#ifdef _DEBUG
! PyObject *ob = PyUnicode_FromWideChar(resBuf, wcslen(resBuf));
PyObject_Print(ob, fp, flags|Py_PRINT_RAW);
Py_DECREF(ob);
--- 330,334 ----
// ### - Double Ack - Always use the hack!
//#ifdef _DEBUG
! PyObject *ob = PyWinCoreString_FromString(resBuf);
PyObject_Print(ob, fp, flags|Py_PRINT_RAW);
Py_DECREF(ob);
|