[pywin32-checkins] pywin32/win32/src win32apimodule.cpp,1.31,1.32
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: <mha...@us...> - 2003-11-08 12:29:01
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1:/tmp/cvs-serv25242 Modified Files: win32apimodule.cpp Log Message: Don't use BSTRs for WCHARs, especially now we have conversion functions spelt WCHAR. Index: win32apimodule.cpp =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/win32apimodule.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** win32apimodule.cpp 7 Nov 2003 03:58:17 -0000 1.31 --- win32apimodule.cpp 8 Nov 2003 12:28:58 -0000 1.32 *************** *** 626,634 **** } else if (flags & FORMAT_MESSAGE_FROM_STRING) { ! if (!PyUnicode_Check(obSource)) { ! PyErr_SetString(PyExc_TypeError, "Flags has FORMAT_MESSAGE_FROM_STRING, but object not a Unicode object"); ! goto cleanup; ! } ! if (!PyWinObject_AsBstr(obSource, &szSource)) goto cleanup; pSource = (void *)szSource; --- 626,630 ---- } else if (flags & FORMAT_MESSAGE_FROM_STRING) { ! if (!PyWinObject_AsWCHAR(obSource, &szSource)) goto cleanup; pSource = (void *)szSource; *************** *** 655,659 **** goto cleanup; } ! if (!PyWinObject_AsBstr(subObject, pInserts+i)) { goto cleanup; } --- 651,655 ---- goto cleanup; } ! if (!PyWinObject_AsWCHAR(subObject, pInserts+i)) { goto cleanup; } *************** *** 679,685 **** if (pInserts) { for (i=0;i<numInserts;i++) ! SysFreeString(pInserts[i]); free(pInserts); } if (resultBuf) LocalFree(resultBuf); --- 675,682 ---- if (pInserts) { for (i=0;i<numInserts;i++) ! PyWinObject_FreeWCHAR(pInserts[i]); free(pInserts); } + PyWinObject_FreeWCHAR(szSource); if (resultBuf) LocalFree(resultBuf); *************** *** 3662,3666 **** if ( PyInt_Check(obType) ) lpType = MAKEINTRESOURCEW(PyInt_AS_LONG((PyIntObject *)obType)); ! else if (PyWinObject_AsBstr(obType, &lpType) ) bFreeType = TRUE; else --- 3659,3663 ---- if ( PyInt_Check(obType) ) lpType = MAKEINTRESOURCEW(PyInt_AS_LONG((PyIntObject *)obType)); ! else if (PyWinObject_AsWCHAR(obType, &lpType) ) bFreeType = TRUE; else *************** *** 3670,3674 **** if ( PyInt_Check(obName) ) lpName = MAKEINTRESOURCEW(PyInt_AS_LONG((PyIntObject *)obName)); ! else if ( PyWinObject_AsBstr(obName, &lpName) ) bFreeName = TRUE; else { --- 3667,3671 ---- if ( PyInt_Check(obName) ) lpName = MAKEINTRESOURCEW(PyInt_AS_LONG((PyIntObject *)obName)); ! else if ( PyWinObject_AsWCHAR(obName, &lpName) ) bFreeName = TRUE; else { *************** *** 3678,3683 **** BOOL ok = UpdateResourceW(hUpdate, lpType, lpName, wLanguage, lpData, cbData); ! if (bFreeType) PyWinObject_FreeBstr(lpType); ! if (bFreeName) PyWinObject_FreeBstr(lpName); if ( !ok ) return ReturnAPIError("UpdateResource"); --- 3675,3680 ---- BOOL ok = UpdateResourceW(hUpdate, lpType, lpName, wLanguage, lpData, cbData); ! if (bFreeType) PyWinObject_FreeWCHAR(lpType); ! if (bFreeName) PyWinObject_FreeWCHAR(lpName); if ( !ok ) return ReturnAPIError("UpdateResource"); |