summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2012-04-06 15:41:12 -0600
committerCharles Harris <charlesr.harris@gmail.com>2012-04-06 18:09:04 -0600
commit1e89ff5197cdcb9434f1595a4a2fe9ef7780d085 (patch)
tree95161446d8297440841d0aef77f88ee21050d9c9 /numpy
parent032bcf08ee3b930e250329bfbd27ea270e5fa013 (diff)
downloadnumpy-1e89ff5197cdcb9434f1595a4a2fe9ef7780d085.tar.gz
WRN: Fix some compiler warnings.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/blasdot/_dotblas.c18
-rw-r--r--numpy/core/src/multiarray/common.c18
-rw-r--r--numpy/core/src/multiarray/item_selection.c8
-rw-r--r--numpy/core/src/multiarray/nditer_pywrap.c4
-rw-r--r--numpy/core/src/multiarray/number.c15
-rw-r--r--numpy/linalg/lapack_litemodule.c2
6 files changed, 38 insertions, 27 deletions
diff --git a/numpy/core/blasdot/_dotblas.c b/numpy/core/blasdot/_dotblas.c
index 6f7a82de2..a1a8da89f 100644
--- a/numpy/core/blasdot/_dotblas.c
+++ b/numpy/core/blasdot/_dotblas.c
@@ -242,7 +242,7 @@ dotblas_matrixproduct(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject* kwa
&op1, &op2, &out)) {
return NULL;
}
- if (out == Py_None) {
+ if ((PyObject *)out == Py_None) {
out = NULL;
}
@@ -260,7 +260,7 @@ dotblas_matrixproduct(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject* kwa
return PyArray_Return((PyArrayObject *)PyArray_MatrixProduct2(
(PyObject *)op1,
(PyObject *)op2,
- (PyObject *)out));
+ out));
}
dtype = PyArray_DescrFromType(typenum);
@@ -295,7 +295,7 @@ dotblas_matrixproduct(PyObject *NPY_UNUSED(dummy), PyObject *args, PyObject* kwa
}
ret = (PyArrayObject *)PyArray_MatrixProduct2((PyObject *)ap1,
(PyObject *)ap2,
- (PyObject *)out);
+ out);
Py_DECREF(ap1);
Py_DECREF(ap2);
return PyArray_Return(ret);
@@ -1236,16 +1236,20 @@ PyObject *PyInit__dotblas(void)
PyMODINIT_FUNC init_dotblas(void)
#endif
{
+#if defined(NPY_PY3K)
int i;
- PyObject *d, *s, *m;
- /* Create the module and add the functions */
-#if defined(NPY_PY3K)
+ PyObject *d, *s, *m;
m = PyModule_Create(&moduledef);
#else
- m = Py_InitModule3("_dotblas", dotblas_module_methods, module_doc);
+ int i;
+
+ PyObject *d, *s;
+ Py_InitModule3("_dotblas", dotblas_module_methods, module_doc);
#endif
+ /* add the functions */
+
/* Import the array object */
import_array();
diff --git a/numpy/core/src/multiarray/common.c b/numpy/core/src/multiarray/common.c
index fb4d41180..613632c45 100644
--- a/numpy/core/src/multiarray/common.c
+++ b/numpy/core/src/multiarray/common.c
@@ -149,9 +149,6 @@ PyArray_DTypeFromObjectHelper(PyObject *obj, int maxdims, int *out_contains_na,
/* Check if it's a NumPy scalar */
if (PyArray_IsScalar(obj, Generic)) {
- int itemsize;
- PyObject *temp;
-
if (!string_type) {
dtype = PyArray_DescrFromScalar(obj);
if (dtype == NULL) {
@@ -159,6 +156,9 @@ PyArray_DTypeFromObjectHelper(PyObject *obj, int maxdims, int *out_contains_na,
}
}
else {
+ int itemsize;
+ PyObject *temp;
+
if (string_type == NPY_STRING) {
if ((temp = PyObject_Str(obj)) == NULL) {
return -1;
@@ -178,6 +178,9 @@ PyArray_DTypeFromObjectHelper(PyObject *obj, int maxdims, int *out_contains_na,
itemsize <<= 1;
#endif
}
+ else {
+ goto fail;
+ }
Py_DECREF(temp);
if (*out_dtype != NULL &&
(*out_dtype)->type_num == string_type &&
@@ -196,10 +199,10 @@ PyArray_DTypeFromObjectHelper(PyObject *obj, int maxdims, int *out_contains_na,
/* Check if it's a Python scalar */
dtype = _array_find_python_scalar_type(obj);
if (dtype != NULL) {
- int itemsize;
- PyObject *temp;
-
if (string_type) {
+ int itemsize;
+ PyObject *temp;
+
if (string_type == NPY_STRING) {
if ((temp = PyObject_Str(obj)) == NULL) {
return -1;
@@ -219,6 +222,9 @@ PyArray_DTypeFromObjectHelper(PyObject *obj, int maxdims, int *out_contains_na,
itemsize <<= 1;
#endif
}
+ else {
+ goto fail;
+ }
Py_DECREF(temp);
if (*out_dtype != NULL &&
(*out_dtype)->type_num == string_type &&
diff --git a/numpy/core/src/multiarray/item_selection.c b/numpy/core/src/multiarray/item_selection.c
index 241afe0b0..77faa1eb2 100644
--- a/numpy/core/src/multiarray/item_selection.c
+++ b/numpy/core/src/multiarray/item_selection.c
@@ -1601,7 +1601,7 @@ local_argsearch_left(PyArrayObject *arr, PyArrayObject *key,
npy_intp nkeys = PyArray_SIZE(key);
char *parr = PyArray_DATA(arr);
char *pkey = PyArray_DATA(key);
- npy_intp *psorter = PyArray_DATA(sorter);
+ npy_intp *psorter = (npy_intp *)PyArray_DATA(sorter);
npy_intp *pret = (npy_intp *)PyArray_DATA(ret);
int elsize = PyArray_DESCR(arr)->elsize;
npy_intp i;
@@ -1652,7 +1652,7 @@ local_argsearch_right(PyArrayObject *arr, PyArrayObject *key,
npy_intp nkeys = PyArray_SIZE(key);
char *parr = PyArray_DATA(arr);
char *pkey = PyArray_DATA(key);
- npy_intp *psorter = PyArray_DATA(sorter);
+ npy_intp *psorter = (npy_intp *)PyArray_DATA(sorter);
npy_intp *pret = (npy_intp *)PyArray_DATA(ret);
int elsize = PyArray_DESCR(arr)->elsize;
npy_intp i;
@@ -1718,8 +1718,6 @@ PyArray_SearchSorted(PyArrayObject *op1, PyObject *op2,
PyArrayObject *ap2 = NULL;
PyArrayObject *ap3 = NULL;
PyArrayObject *sorter = NULL;
- PyObject *max = NULL;
- PyObject *min = NULL;
PyArrayObject *ret = NULL;
PyArray_Descr *dtype;
NPY_BEGIN_THREADS_DEF;
@@ -1809,7 +1807,7 @@ PyArray_SearchSorted(PyArrayObject *op1, PyObject *op2,
}
}
else {
- int err;
+ int err=0;
if (side == NPY_SEARCHLEFT) {
NPY_BEGIN_THREADS_DESCR(PyArray_DESCR(ap2));
diff --git a/numpy/core/src/multiarray/nditer_pywrap.c b/numpy/core/src/multiarray/nditer_pywrap.c
index a10958965..3a6c632e0 100644
--- a/numpy/core/src/multiarray/nditer_pywrap.c
+++ b/numpy/core/src/multiarray/nditer_pywrap.c
@@ -2350,7 +2350,7 @@ npyiter_subscript(NewNpyArrayIterObject *self, PyObject *op)
}
else if (PySlice_Check(op)) {
Py_ssize_t istart = 0, iend = 0, istep = 0;
- if (PySlice_GetIndices(op,
+ if (PySlice_GetIndices((PySliceObject *)op,
NpyIter_GetNOp(self->iter),
&istart, &iend, &istep) < 0) {
return NULL;
@@ -2400,7 +2400,7 @@ npyiter_ass_subscript(NewNpyArrayIterObject *self, PyObject *op,
}
else if (PySlice_Check(op)) {
Py_ssize_t istart = 0, iend = 0, istep = 0;
- if (PySlice_GetIndices(op,
+ if (PySlice_GetIndices((PySliceObject *)op,
NpyIter_GetNOp(self->iter),
&istart, &iend, &istep) < 0) {
return -1;
diff --git a/numpy/core/src/multiarray/number.c b/numpy/core/src/multiarray/number.c
index cea9e029f..f0e4dcd13 100644
--- a/numpy/core/src/multiarray/number.c
+++ b/numpy/core/src/multiarray/number.c
@@ -387,7 +387,7 @@ fast_scalar_power(PyArrayObject *a1, PyObject *o2, int inplace)
return PyArray_GenericUnaryFunction(a1, fastop);
}
}
- /* Because this is called with all arrays, we need to
+ /* Because this is called with all arrays, we need to
* change the output if the kind of the scalar is different
* than that of the input and inplace is not on ---
* (thus, the input should be up-cast)
@@ -399,19 +399,22 @@ fast_scalar_power(PyArrayObject *a1, PyObject *o2, int inplace)
(a1, (PyObject *)a1, fastop);
}
else {
- PyObject *a1_conv;
- PyArray_Descr *dtype=NULL;
+ PyArray_Descr *dtype = NULL;
PyObject *res;
+
/* We only special-case the FLOAT_SCALAR and integer types */
if (kind == NPY_FLOAT_SCALAR && PyArray_ISINTEGER(a1)) {
dtype = PyArray_DescrFromType(NPY_DOUBLE);
- a1 = PyArray_CastToType(a1, dtype, PyArray_ISFORTRAN(a1));
- if (a1 == NULL) return NULL;
+ a1 = (PyArrayObject *)PyArray_CastToType(a1, dtype,
+ PyArray_ISFORTRAN(a1));
+ if (a1 == NULL) {
+ return NULL;
+ }
}
else {
Py_INCREF(a1);
}
- res = PyArray_GenericBinaryFunction(a1, a1, fastop);
+ res = PyArray_GenericBinaryFunction(a1, (PyObject *)a1, fastop);
Py_DECREF(a1);
return res;
}
diff --git a/numpy/linalg/lapack_litemodule.c b/numpy/linalg/lapack_litemodule.c
index f8b527463..cc6238239 100644
--- a/numpy/linalg/lapack_litemodule.c
+++ b/numpy/linalg/lapack_litemodule.c
@@ -119,7 +119,7 @@ check_object(PyObject *ob, int t, char *obname,
obname, tname, funname);
return 0;
}
- else if (PyArray_ISBYTESWAPPED(ob)) {
+ else if (PyArray_ISBYTESWAPPED((PyArrayObject *)ob)) {
PyErr_Format(LapackError,
"Parameter %s has non-native byte order in lapack_lite.%s",
obname, funname);