Update of /cvsroot/pywin32/pywin32/win32/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15705
Modified Files:
PyWinTypes.h win2krasmodule.cpp win32clipboardmodule.cpp
win32crypt.i win32event.i win32file.i win32file_comm.cpp
win32helpmodule.cpp win32job.i win32trace.cpp
Log Message:
Avoid lots of warnings including WRITE_RESTRICTED being redefined by
letting pywintypes.h manage the order etc of including python.h, windows.h
and structmember.h. Also add Py_CLEAR and Py_RETURN_NONE to py2.3 builds.
Index: win32trace.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32trace.cpp,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** win32trace.cpp 3 Jan 2009 04:59:38 -0000 1.20
--- win32trace.cpp 3 Jan 2009 06:43:58 -0000 1.21
***************
*** 31,37 ****
*/
- #include "windows.h"
- #include "Python.h"
- #include "structmember.h"
#include "PyWinTypes.h"
#include "PyWinObjects.h"
--- 31,34 ----
Index: win32file_comm.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32file_comm.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** win32file_comm.cpp 11 Dec 2008 00:25:40 -0000 1.8
--- win32file_comm.cpp 3 Jan 2009 06:43:58 -0000 1.9
***************
*** 4,10 ****
// @doc
- #include "windows.h"
- #include "Python.h"
- #include "structmember.h"
#include "PyWinTypes.h"
#include "PyWinObjects.h"
--- 4,7 ----
Index: win32clipboardmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32clipboardmodule.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** win32clipboardmodule.cpp 8 Dec 2008 13:16:37 -0000 1.25
--- win32clipboardmodule.cpp 3 Jan 2009 06:43:58 -0000 1.26
***************
*** 18,25 ****
#define PY_SSIZE_T_CLEAN // this should be Py_ssize_t clean!
- // #define UNICODE
- // #define _UNICODE // CRT function (_tcs*) switch based on this
- #include "windows.h"
- #include "Python.h"
#include "pywintypes.h"
--- 18,21 ----
Index: win32job.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32job.i,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** win32job.i 17 Dec 2008 13:04:59 -0000 1.5
--- win32job.i 3 Jan 2009 06:43:58 -0000 1.6
***************
*** 9,13 ****
#endif
- #include "windows.h"
#include "PyWinTypes.h"
--- 9,12 ----
Index: win32event.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32event.i,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** win32event.i 13 Nov 2008 11:11:58 -0000 1.11
--- win32event.i 3 Jan 2009 06:43:58 -0000 1.12
***************
*** 7,15 ****
//#define UNICODE
#define _WIN32_WINNT 0x0501
- #ifndef MS_WINCE
- #include "windows.h"
- //#include "winsock2.h"
- //#include "mswsock.h"
- #endif
%}
--- 7,10 ----
Index: win32crypt.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32crypt.i,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** win32crypt.i 3 Jun 2007 14:53:07 -0000 1.5
--- win32crypt.i 3 Jan 2009 06:43:58 -0000 1.6
***************
*** 4,10 ****
%{
- #include "windows.h"
- #include "wincrypt.h"
#include "PyWinTypes.h"
#include "malloc.h"
#include "abstract.h" // for PyObject_AsReadBuffer
--- 4,9 ----
%{
#include "PyWinTypes.h"
+ #include "wincrypt.h"
#include "malloc.h"
#include "abstract.h" // for PyObject_AsReadBuffer
Index: win32helpmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32helpmodule.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** win32helpmodule.cpp 17 Dec 2008 13:11:57 -0000 1.9
--- win32helpmodule.cpp 3 Jan 2009 06:43:58 -0000 1.10
***************
*** 16,24 ****
- #include "windows.h"
- #include "htmlhelp.h"
- #include "Python.h"
- #include "structmember.h"
#include "PyWinTypes.h"
#define DllExport _declspec(dllexport)
--- 16,21 ----
#include "PyWinTypes.h"
+ #include "htmlhelp.h"
#define DllExport _declspec(dllexport)
Index: win2krasmodule.cpp
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win2krasmodule.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** win2krasmodule.cpp 11 Dec 2008 00:25:40 -0000 1.10
--- win2krasmodule.cpp 3 Jan 2009 06:43:58 -0000 1.11
***************
*** 16,26 ****
#endif
! #include "windows.h"
#include "ras.h"
#include "raserror.h"
- #include "Python.h"
- #include "pywintypes.h"
-
typedef PyObject* (*PFNReturnRasError)(char *fnName, long err);
--- 16,23 ----
#endif
! #include "pywintypes.h"
#include "ras.h"
#include "raserror.h"
typedef PyObject* (*PFNReturnRasError)(char *fnName, long err);
Index: PyWinTypes.h
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/PyWinTypes.h,v
retrieving revision 1.58
retrieving revision 1.59
diff -C2 -d -r1.58 -r1.59
*** PyWinTypes.h 11 Dec 2008 00:25:40 -0000 1.58
--- PyWinTypes.h 3 Jan 2009 06:43:58 -0000 1.59
***************
*** 18,23 ****
--- 18,61 ----
// includes - so it is safe to do here (and provides a handy
// choke point for #include vagaries
+
+ // Some other warnings generated by MSVC6 which we don't care about
+ #if (PY_VERSION_HEX < 0x02060000)
+ #pragma warning( disable:4035 )
+ #endif
+
+
#include "Python.h"
+ // many many files need python's structmember.h, and its possible people
+ // #included windows.h before including us...
+ #ifdef WRITE_RESTRICTED
+ #undef WRITE_RESTRICTED
+ #endif
+ #include "structmember.h"
+ // and python's structmember.h #defines this, conflicting with windows.h
+ #ifdef WRITE_RESTRICTED
+ #undef WRITE_RESTRICTED
+ #endif
#include "windows.h"
+ #undef WRITE_RESTRICTED // stop anyone using the wrong one accidently...
+
+ // Python 2.3 doesn't have Py_CLEAR...
+ #if (PY_VERSION_HEX < 0x02040000)
+ #ifndef Py_CLEAR
+ #define Py_CLEAR(op) \
+ do { \
+ if (op) { \
+ PyObject *_py_tmp = (PyObject *)(op); \
+ (op) = NULL; \
+ Py_DECREF(_py_tmp); \
+ } \
+ } while (0)
+ #endif
+ // or Py_RETURN_NONE
+ #ifndef Py_RETURN_NONE
+ /* Macro for returning Py_None from a function */
+ #define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
+ #endif
+
+ #endif // (PY_VERSION_HEX < 0x02040000)
Index: win32file.i
===================================================================
RCS file: /cvsroot/pywin32/pywin32/win32/src/win32file.i,v
retrieving revision 1.96
retrieving revision 1.97
diff -C2 -d -r1.96 -r1.97
*** win32file.i 11 Dec 2008 00:25:40 -0000 1.96
--- win32file.i 3 Jan 2009 06:43:58 -0000 1.97
***************
*** 30,34 ****
#include "winsock2.h"
#include "mswsock.h"
! #include "windows.h"
#include "winbase.h"
#include "assert.h"
--- 30,34 ----
#include "winsock2.h"
#include "mswsock.h"
! #include "pywintypes.h"
#include "winbase.h"
#include "assert.h"
|