Fix several MS compiler warnings.
authorJosh Ayers <josh.ayers@gmail.com>
Tue, 21 May 2013 03:54:00 +0000 (20:54 -0700)
committerJosh Ayers <josh.ayers@gmail.com>
Tue, 21 May 2013 03:54:00 +0000 (20:54 -0700)
Cython/Utility/MemoryView.pyx
Cython/Utility/MemoryView_C.c

index c5163ad..e49f27a 100644 (file)
@@ -117,7 +117,7 @@ cdef class array:
         cdef Py_ssize_t i
         cdef PyObject **p
 
-        self.ndim = len(shape)
+        self.ndim = <int> len(shape)
         self.itemsize = itemsize
 
         if not self.ndim:
@@ -870,7 +870,7 @@ cdef int slice_memviewslice(
 #
 @cname('__pyx_pybuffer_index')
 cdef char *pybuffer_index(Py_buffer *view, char *bufp, Py_ssize_t index,
-                          int dim) except NULL:
+                          Py_ssize_t dim) except NULL:
     cdef Py_ssize_t shape, stride, suboffset = -1
     cdef Py_ssize_t itemsize = view.itemsize
     cdef char *resultp
index 85a71f1..1575733 100644 (file)
@@ -25,7 +25,7 @@ typedef struct {
 //       libatomic + autotools-like distutils support? Such a pain...
 #if CYTHON_ATOMICS && __GNUC__ >= 4 && (__GNUC_MINOR__ > 1 ||           \
                     (__GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL >= 2)) && \
-                    !defined(__i386__)                   
+                    !defined(__i386__)
     /* gcc >= 4.1.2 */
     #define __pyx_atomic_incr_aligned(value, lock) __sync_fetch_and_add(value, 1)
     #define __pyx_atomic_decr_aligned(value, lock) __sync_fetch_and_sub(value, 1)
@@ -580,7 +580,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs,
 
 
     for(i = 0; i < ndim; i++) {
-        temp_int = PyInt_FromLong(from_mvs->shape[i]);
+        temp_int = PyInt_FromSsize_t(from_mvs->shape[i]);
         if(unlikely(!temp_int)) {
             goto fail;
         } else {