Update of /cvsroot/pywin32/pywin32/win32/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3153/win32/src
Modified Files:
win32evtlog.i
Log Message:
Fix remaining 64-bit warnings
Index: win32evtlog.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32evtlog.i,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** win32evtlog.i 8 Nov 2003 12:34:45 -0000 1.5
--- win32evtlog.i 15 Aug 2007 09:39:48 -0000 1.6
***************
*** 240,287 ****
{
PyObject *rc = NULL;
! WORD numStrings = 0;
! BSTR *pStrings = NULL;
! int i;
DWORD dataSize = 0;
! char *pData;
PSID sid;
if (!PyWinObject_AsSID(obSID, &sid, TRUE))
return NULL;
! if (obStrings==Py_None) {
! pStrings = NULL;
! } else if (PySequence_Check(obStrings)) {
! numStrings = PySequence_Length(obStrings);
! pStrings = new BSTR [numStrings];
! if (pStrings==NULL) {
! PyErr_SetString(PyExc_MemoryError, "Allocating string arrays");
! goto cleanup;
! }
! memset(pStrings, 0, sizeof(WCHAR *)*numStrings);
! for (i=0;i<numStrings;i++) {
! PyObject *obString = PySequence_GetItem(obStrings, i);
! if (obString==NULL) {
! goto cleanup;
! }
! BOOL ok = PyWinObject_AsWCHAR(obString, pStrings+i);
! Py_XDECREF(obString);
! if (!ok)
! goto cleanup;
! }
! } else {
! PyErr_SetString(PyExc_TypeError, "strings must be None or a sequence");
! goto cleanup;
! }
! if (obData==Py_None)
pData = NULL;
! else if (PyString_Check(obData)){
! pData = PyString_AsString(obData);
! dataSize = PyString_Size(obData);
! } else {
! PyErr_SetString(PyExc_TypeError, "data must be None or a string");
return NULL;
! }
BOOL ok;
Py_BEGIN_ALLOW_THREADS
! ok = ReportEventW(hEventLog, wType, wCategory, dwEventID, sid, numStrings, dataSize, (const WCHAR **)pStrings, pData);
Py_END_ALLOW_THREADS
--- 240,261 ----
{
PyObject *rc = NULL;
! DWORD numStrings = 0;
! WCHAR **pStrings = NULL;
DWORD dataSize = 0;
! void *pData;
PSID sid;
if (!PyWinObject_AsSID(obSID, &sid, TRUE))
return NULL;
! if (!PyWinObject_AsReadBuffer(obData, &pData, &dataSize, TRUE))
pData = NULL;
! if (!PyWinObject_AsWCHARArray(obStrings, &pStrings, &numStrings, TRUE))
return NULL;
! if (numStrings > USHRT_MAX){
! PyErr_Format(PyExc_ValueError, "String inserts can contain at most %d strings", USHRT_MAX);
! goto cleanup;
! }
BOOL ok;
Py_BEGIN_ALLOW_THREADS
! ok = ReportEventW(hEventLog, wType, wCategory, dwEventID, sid, (WORD)numStrings, dataSize, (const WCHAR **)pStrings, pData);
Py_END_ALLOW_THREADS
***************
*** 293,301 ****
rc = Py_None;
cleanup:
! if (pStrings) {
! for (i=0;i<numStrings;i++)
! PyWinObject_FreeWCHAR(pStrings[i]);
! delete [] pStrings;
! }
return rc;
}
--- 267,271 ----
rc = Py_None;
cleanup:
! PyWinObject_FreeWCHARArray(pStrings, numStrings);
return rc;
}
***************
*** 402,412 ****
// @pyswig |ReportEvent|Reports an event
%name (ReportEvent) PyObject *MyReportEvent (
! HANDLE hEventLog,
! WORD wType,
! WORD wCategory,
! DWORD dwEventID,
! PyObject *pyobject,
! PyObject *pyobject,
! PyObject *pyobject
);
--- 372,382 ----
// @pyswig |ReportEvent|Reports an event
%name (ReportEvent) PyObject *MyReportEvent (
! HANDLE hEventLog, // @pyparm <o PyHANDLE>|EventLog||Handle to an event log
! WORD wType, // @pyparm int|Type||win32con.EVENTLOG_* value
! WORD wCategory, // @pyparm int|Category||Source-specific event category
! DWORD dwEventID, // @pyparm int|EventID||Source-specific event identifier
! PyObject *obUserSid, // @pyparm <o PySID>|UserSid||Sid of current user, can be None
! PyObject *obStrings, // @pyparm sequence|Strings||Sequence of unicode strings to be inserted in message
! PyObject *obRawData // @pyparm str|RawData||Binary data for event, can be None
);
|