diff -crB thrift-0.2.0/lib/py/setup.py thrift-0.2.0-msvc-patched/lib/py/setup.py *** thrift-0.2.0/lib/py/setup.py 2009-05-10 13:14:44.000000000 +0800 --- thrift-0.2.0-msvc-patched/lib/py/setup.py 2010-01-20 14:15:29.000000000 +0800 *************** *** 19,28 **** --- 19,35 ---- # under the License. # + import sys from distutils.core import setup, Extension + libraries = [] + + if sys.platform == 'win32': + libraries.append('ws2_32') + fastbinarymod = Extension('thrift.protocol.fastbinary', sources = ['src/protocol/fastbinary.c'], + libraries = libraries, ) setup(name = 'Thrift', diff -crB thrift-0.2.0/lib/py/src/protocol/fastbinary.c thrift-0.2.0-msvc-patched/lib/py/src/protocol/fastbinary.c *** thrift-0.2.0/lib/py/src/protocol/fastbinary.c 2009-03-31 05:35:00.000000000 +0800 --- thrift-0.2.0-msvc-patched/lib/py/src/protocol/fastbinary.c 2010-01-20 14:54:27.000000000 +0800 *************** *** 19,27 **** --- 19,49 ---- #include #include "cStringIO.h" + #ifdef _MSC_VER + #undef inline + #define inline __inline + #undef bool + #define bool int + #define false 0 + #define true 1 + typedef __int8 int8_t; + typedef __int16 int16_t; + typedef __int32 int32_t; + typedef __int64 int64_t; + #define INT8_MIN ((int8_t)_I8_MIN) + #define INT8_MAX _I8_MAX + #define INT16_MIN ((int16_t)_I16_MIN) + #define INT16_MAX _I16_MAX + #define INT32_MIN ((int32_t)_I32_MIN) + #define INT32_MAX _I32_MAX + #define INT64_MIN ((int64_t)_I64_MIN) + #define INT64_MAX _I64_MAX + #include + #else #include #include #include + #endif /* Fix endianness issues on Solaris */ #if defined (__SVR4) && defined (__sun) *************** *** 42,47 **** --- 64,82 ---- #endif #endif + #ifndef BYTE_ORDER + #ifdef _MSC_VER + #ifndef BIG_ENDIAN + #define BIG_ENDIAN (4321) + #endif + #ifndef LITTLE_ENDIAN + #define LITTLE_ENDIAN (1234) + #endif + + #define BYTE_ORDER LITTLE_ENDIAN + #endif + #endif + // TODO(dreiss): defval appears to be unused. Look into removing it. // TODO(dreiss): Make parse_spec_args recursive, and cache the output // permanently in the object. (Malloc and orphan.) *************** *** 1110,1120 **** case T_STRUCT: { StructTypeArgs parsedargs; if (!parse_struct_args(&parsedargs, typeargs)) { return NULL; } ! PyObject* ret = PyObject_CallObject(parsedargs.klass, NULL); if (!ret) { return NULL; } --- 1145,1156 ---- case T_STRUCT: { StructTypeArgs parsedargs; + PyObject* ret = NULL; if (!parse_struct_args(&parsedargs, typeargs)) { return NULL; } ! (PyObject*) ret = PyObject_CallObject(parsedargs.klass, NULL); if (!ret) { return NULL; } *************** *** 1147,1153 **** PyObject* transport = NULL; PyObject* typeargs = NULL; StructTypeArgs parsedargs; ! DecodeBuffer input = {}; if (!PyArg_ParseTuple(args, "OOO", &output_obj, &transport, &typeargs)) { return NULL; --- 1183,1189 ---- PyObject* transport = NULL; PyObject* typeargs = NULL; StructTypeArgs parsedargs; ! DecodeBuffer input; if (!PyArg_ParseTuple(args, "OOO", &output_obj, &transport, &typeargs)) { return NULL;