diff options
author | Warren Weckesser <warren.weckesser@gmail.com> | 2019-04-05 14:59:32 -0400 |
---|---|---|
committer | Warren Weckesser <warren.weckesser@gmail.com> | 2019-04-05 14:59:32 -0400 |
commit | 8fdacfc041bce4f63a4172d56da4520a3040b79d (patch) | |
tree | 5bb1aaba914c3f6334fad630a12eac61c24da66e /numpy/f2py/src/fortranobject.c | |
parent | c1bf6a600cb4c8c7261a000f47b11ef8fd9f792d (diff) | |
download | numpy-8fdacfc041bce4f63a4172d56da4520a3040b79d.tar.gz |
MAINT: f2py: Add a cast to avoid a compiler warning.
The warning
[...]/fortranobject.c:138:18: warning: comparison of integers of different signs: 'Py_ssize_t' (aka 'long') and 'unsigned long' [-Wsign-compare]
if (size < sizeof(notalloc)) {
~~~~ ^ ~~~~~~~~~~~~~~~~
occurs 17 times when scipy is built. The change in this pull request casts
`size` to `size_t` before comparing it to `sizeof(...)`. A previous check
has already eliminated the possibility that `size` is negative, so this cast
is safe.
Diffstat (limited to 'numpy/f2py/src/fortranobject.c')
-rw-r--r-- | numpy/f2py/src/fortranobject.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/f2py/src/fortranobject.c b/numpy/f2py/src/fortranobject.c index 78b06f066..4a981bf55 100644 --- a/numpy/f2py/src/fortranobject.c +++ b/numpy/f2py/src/fortranobject.c @@ -135,7 +135,7 @@ format_def(char *buf, Py_ssize_t size, FortranDataDef def) if (def.data == NULL) { static const char notalloc[] = ", not allocated"; - if (size < sizeof(notalloc)) { + if ((size_t) size < sizeof(notalloc)) { return -1; } memcpy(p, notalloc, sizeof(notalloc)); |