Commit 381380c9 authored by Mark Florisson's avatar Mark Florisson

Silence some warnings

parent 54cbd0e8
......@@ -1466,7 +1466,8 @@ class CCodeWriter(object):
if type.is_pyobject:
self.putln("%s = NULL;" % decl)
elif type.is_memoryviewslice:
self.putln("%s = { 0 };" % decl)
import MemoryView
self.putln("%s = %s;" % (decl, MemoryView.memslice_entry_init))
else:
self.putln("%s;" % decl)
......
......@@ -60,6 +60,8 @@ _spec_to_abbrev = {
'follow' : '_',
}
memslice_entry_init = "{ 0, 0, { 0 }, { 0 }, { 0 } }"
memview_name = u'memoryview'
memview_typeptr_cname = '__pyx_memoryview_type'
memview_objstruct_cname = '__pyx_memoryview_obj'
......@@ -529,7 +531,8 @@ class CopyFuncUtilCode(object):
mode = 'fortran'
contig_flag = memview_f_contiguous
context = dict(
C = dict(
context,
copy_name=self.copy_func_name,
mode=mode,
sizeof_dtype="sizeof(%s)" % self.from_memview.dtype.declaration_code(''),
......@@ -539,7 +542,7 @@ class CopyFuncUtilCode(object):
_, copy_code = UtilityCode.load_as_string("MemviewSliceCopyTemplate",
from_file="MemoryView_C.c",
context=context)
context=C)
code.put(copy_code)
......@@ -915,6 +918,7 @@ context = {
'memview_struct_name': memview_objstruct_cname,
'max_dims': Options.buffer_max_dims,
'memviewslice_name': memviewslice_cname,
'memslice_init': memslice_entry_init,
}
memviewslice_declare_code = load_memview_c_utility(
"MemviewSliceStruct",
......
......@@ -383,7 +383,8 @@ class Scope(object):
entries[name] = entry
if type.is_memoryviewslice:
entry.init = "{ 0, 0 }"
import MemoryView
entry.init = MemoryView.memslice_entry_init
entry.scope = self
entry.visibility = visibility
......
......@@ -174,6 +174,9 @@ cdef extern from "pythread.h":
int PyThread_acquire_lock(PyThread_type_lock, int mode) nogil
void PyThread_release_lock(PyThread_type_lock) nogil
cdef extern from "string.h":
void *memset(void *b, int c, size_t len)
cdef extern from *:
int __Pyx_GetBuffer(object, Py_buffer *, int) except -1
void __Pyx_ReleaseBuffer(Py_buffer *)
......@@ -415,9 +418,13 @@ cdef tuple _unellipsify(object index, int ndim):
cdef memoryview memview_slice(memoryview memview, object indices):
cdef int new_ndim = 0, suboffset_dim = -1, dim
cdef bint negative_step
cdef {{memviewslice_name}} dst, src
cdef {{memviewslice_name}} src, dst
cdef {{memviewslice_name}} *p_src
# dst is copied by value in memoryview_fromslice -- initialize it
# src is never copied
memset(&dst, 0, sizeof(dst))
cdef _memoryviewslice memviewsliceobj
assert memview.view.ndim > 0
......
......@@ -49,7 +49,7 @@ static CYTHON_INLINE char *__pyx_memviewslice_index_full(const char *bufp, Py_ss
/////////////// ObjectToMemviewSlice ///////////////
static CYTHON_INLINE {{memviewslice_name}} {{funcname}}(PyObject *obj) {
{{memviewslice_name}} result = {0};
{{memviewslice_name}} result = {{memslice_init}};
struct __pyx_memoryview_obj *memview = \
(struct __pyx_memoryview_obj *) __pyx_memoryview_new(obj, {{buf_flag}});
......@@ -336,7 +336,7 @@ static __Pyx_memviewslice {{copy_name}}(const __Pyx_memviewslice from_mvs) {
__Pyx_RefNannyDeclarations
int i;
__Pyx_memviewslice new_mvs = {0, 0};
__Pyx_memviewslice new_mvs = {{memslice_init}};
struct __pyx_memoryview_obj *from_memview = from_mvs.memview;
Py_buffer *buf = &from_memview->view;
PyObject *shape_tuple = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment