Commit dd4d8b4d authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

Fix compilation warnings on Windows (GH-8627)

* Fix compilation warning in _ctypes module on Window

(cherry picked from commit 20f11fe4)

* Fix compilation warnings on Windows 64-bit

(cherry picked from commit 725e4212)

* Fix compiler warning in unicodeobject.c

Explicitly case to Py_UNICODE to fix the warning:

Objects\unicodeobject.c(4225): warning C4244: '=' :
conversion from 'long' to 'Py_UNICODE', possible loss of data

The downcast cannot overflow since we check that value <= 0x10ffff.
parent 6a6b2483
......@@ -119,7 +119,7 @@ void ffi_prep_args(char *stack, extended_cif *ecif)
argp += z;
}
if (argp - stack > ecif->cif->bytes)
if (argp >= stack && (unsigned)(argp - stack) > ecif->cif->bytes)
{
Py_FatalError("FFI BUG: not enough stack space for arguments");
}
......
......@@ -132,7 +132,7 @@ _pysqlite_long_from_int64(sqlite_int64 value)
}
# endif
#endif
return PyInt_FromLong(value);
return PyInt_FromLong(Py_SAFE_DOWNCAST(value, sqlite_int64, long));
}
sqlite_int64
......
......@@ -4222,7 +4222,7 @@ PyObject *PyUnicode_DecodeCharmap(const char *s,
p = PyUnicode_AS_UNICODE(v) + oldpos;
}
value -= 0x10000;
*p++ = 0xD800 | (value >> 10);
*p++ = 0xD800 | (Py_UNICODE)(value >> 10);
*p++ = 0xDC00 | (value & 0x3FF);
extrachars -= 2;
}
......
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