[pywin32-checkins] pywin32/win32/src PyWinTypes.h,1.50,1.51
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2008-02-10 13:44:16
|
Update of /cvsroot/pywin32/pywin32/win32/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6855 Modified Files: PyWinTypes.h Log Message: * fix wchar/whcar_t confusion with later compilers. * disable warnings about #pragma's not understood by old MSVCs * provide PyLong_AsUnsignedLongMask for py2.2 * remove support for PYWIN_USE_PYUNICODE, MS_WINCE, NO_PYWINTYPES_BSTR, PYWIN_NO_PYTHON_LONG_LONG Index: PyWinTypes.h =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypes.h,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** PyWinTypes.h 6 Feb 2008 18:37:46 -0000 1.50 --- PyWinTypes.h 10 Feb 2008 13:44:20 -0000 1.51 *************** *** 9,12 **** --- 9,18 ---- #endif + // early msvc versions complain about pragma #s it doesn't understand + // C:\mssdk\VC\INCLUDE\string.h(142) : warning C4616: #pragma warning : warning number '6059' out of range, must be between '4001' and '4999' + // and: + // C:\mssdk\include\wingdi.h(4340) : warning C4068: unknown pragma + // I doubt we ever care about that warning, so unconditionally nuke em! + #pragma warning( disable:4616 4068 ) // Python.h and Windows.h both protect themselves from multiple // includes - so it is safe to do here (and provides a handy *************** *** 25,28 **** --- 31,38 ---- #endif + #if PY_VERSION_HEX < 0x02030000 + #define PyLong_AsUnsignedLongMask PyLong_AsUnsignedLong + #endif + // This only enables runtime checks in debug builds - so we use // our own so we can enable it always should we desire... *************** *** 32,45 **** #include "mmsystem.h" ! // Do we want to use the builtin Unicode object? ! // If defined, we use the standard builtin type. ! // If not define, we have our own Unicode type ! // (but that doesnt work seamlessly with PyString objects) ! ! // For 1.6+ builds, this will be ON. ! // For 1.5 builds, this will be OFF ! #if (PY_VERSION_HEX >= 0x01060000) #define PYWIN_USE_PYUNICODE - #endif // *** NOTE *** FREEZE_PYWINTYPES is deprecated. It used to be used --- 42,47 ---- #include "mmsystem.h" ! // This can be removed once we are confident noone else uses it... #define PYWIN_USE_PYUNICODE // *** NOTE *** FREEZE_PYWINTYPES is deprecated. It used to be used *************** *** 67,91 **** #include <tchar.h> - #ifdef MS_WINCE - // These macros caused grief on CE once (do they still?) - # ifndef IN - # define IN - # endif - # ifdef OUT - # undef OUT - # endif - # ifndef OUT - # define OUT - # endif - // Having trouble making these work for Palm PCs?? - // NOTE: These are old - for Windows CE 1 devices, and well - // before the PPC platform. It is unlikely recent CE toolkits - // still need all this magic. - # ifndef PYWIN_HPC /* Palm PC */ - # define NO_PYWINTYPES_TIME - # define NO_PYWINTYPES_IID - # define NO_PYWINTYPES_BSTR - # endif - #endif // MS_WINCE /* ** Error/Exception handling --- 69,72 ---- *************** *** 142,146 **** extern PYWINTYPES_EXPORT int PyUnicode_Size(PyObject *op); - #ifndef NO_PYWINTYPES_BSTR // Given a PyObject (string, Unicode, etc) create a "BSTR" with the value PYWINTYPES_EXPORT BOOL PyWinObject_AsBstr(PyObject *stringObject, BSTR *pResult, BOOL bNoneOK = FALSE, DWORD *pResultLen = NULL); --- 123,126 ---- *************** *** 153,159 **** PYWINTYPES_EXPORT BSTR PyWin_String_AsBstr(const char *str); - #endif // NO_PYWINTYPES_BSTR - - // Given a string or Unicode object, get WCHAR characters. PYWINTYPES_EXPORT BOOL PyWinObject_AsWCHAR(PyObject *stringObject, WCHAR **pResult, BOOL bNoneOK = FALSE, DWORD *pResultLen = NULL); --- 133,136 ---- *************** *** 161,165 **** PYWINTYPES_EXPORT void PyWinObject_FreeWCHAR(WCHAR *pResult); ! // As of Python 2.6, Python switched to 'wchar_t' for unicode. Some old // win32 structures that still use 'unsigned short' now fail from C++ with // VS8 so we provide a couple of helpers. --- 138,142 ---- PYWINTYPES_EXPORT void PyWinObject_FreeWCHAR(WCHAR *pResult); ! // As of Python 2.6, Python switched to 'wchar_t' for unicode, so old // win32 structures that still use 'unsigned short' now fail from C++ with // VS8 so we provide a couple of helpers. *************** *** 168,172 **** // Its not clear how to resolve this, but while VS2003 is the default // compiler, that is what must work. ! #if 0 // and _MSC_VER >= 1400 inline BOOL PyWinObject_AsWCHAR(PyObject *stringObject, unsigned short **pResult, BOOL bNoneOK = FALSE, DWORD *pResultLen = NULL) { --- 145,150 ---- // Its not clear how to resolve this, but while VS2003 is the default // compiler, that is what must work. ! // py2.5 on x64 also needs it, and that is min x64 we support ! #if (PY_VERSION_HEX >= 0x02060000) || defined(_WIN64) inline BOOL PyWinObject_AsWCHAR(PyObject *stringObject, unsigned short **pResult, BOOL bNoneOK = FALSE, DWORD *pResultLen = NULL) { *************** *** 263,267 **** PYWINTYPES_EXPORT PyObject *PyWinObject_FromOLECHAR(const OLECHAR * str, int numChars); - #ifndef MS_WINCE // String support for buffers allocated via a function of your choice. PYWINTYPES_EXPORT BOOL PyWinObject_AsPfnAllocatedWCHAR(PyObject *stringObject, --- 241,244 ---- *************** *** 274,278 **** PYWINTYPES_EXPORT BOOL PyWinObject_AsTaskAllocatedWCHAR(PyObject *stringObject, WCHAR **ppResult, BOOL bNoneOK /*= FALSE*/,DWORD *pResultLen /*= NULL*/); PYWINTYPES_EXPORT void PyWinObject_FreeTaskAllocatedWCHAR(WCHAR * str); - #endif // MS_WINCE // String conversion - These must also be freed with PyWinObject_FreeString PYWINTYPES_EXPORT BOOL PyWin_WCHAR_AsString(WCHAR *input, DWORD inLen, char **pResult); --- 251,254 ---- *************** *** 291,306 **** ** LARGE_INTEGER objects */ - #ifdef LONG_LONG - // Python got its own support for 64 bit ints as of Python 1.5.2. - // However, for 1.5.2 we stick without it - we use it for 1.6 and on. - # if (PY_VERSION_HEX < 0x01060000) - # define PYWIN_NO_PYTHON_LONG_LONG - # endif - #else - // If LONG_LONG is undefined, we are still building pre 1.5.2, so - // we have no choice but to define it. - # define PYWIN_NO_PYTHON_LONG_LONG - #endif - // These need to be renamed. For now, the old names still appear in the DLL. PYWINTYPES_EXPORT BOOL PyLong_AsTwoInts(PyObject *ob, int *hiint, unsigned *loint); --- 267,270 ---- *************** *** 501,506 **** ** SECURITY_DESCRIPTOR support */ - #ifndef MS_WINCE /* These are not available on Windows CE */ - extern PYWINTYPES_EXPORT PyTypeObject PySECURITY_DESCRIPTORType; #define PySECURITY_DESCRIPTOR_Check(ob) ((ob)->ob_type == &PySECURITY_DESCRIPTORType) --- 465,468 ---- *************** *** 532,537 **** PYWINTYPES_EXPORT BOOL PyWinObject_AsACL(PyObject *ob, PACL *ppACL, BOOL bNoneOK = FALSE); - #endif /* MS_WINCE */ - /* ** Win32 HANDLE wrapper - any handle closable by "CloseHandle()" --- 494,497 ---- *************** *** 584,588 **** ** Other Utilities */ - #ifndef NO_PYWINTYPES_BSTR // ---------------------------------------------------------------------- // WARNING - NEVER EVER USE new() ON THIS CLASS --- 544,547 ---- *************** *** 619,623 **** return TRUE; } - #endif // NO_PYWINTYPES_BSTR // ---------------------------------------------------------------------- --- 578,581 ---- |