mirror of
https://github.com/python/cpython.git
synced 2025-10-01 04:42:10 +00:00
Make the prototypes of our private PyUnicode_FromWideChar and
PyUnicode_AsWideChar replacement functions compatible to the official functions by using Py_ssize_t instead of int.
This commit is contained in:
parent
7d1d43630e
commit
9f902470da
2 changed files with 6 additions and 5 deletions
|
@ -4711,13 +4711,14 @@ init_ctypes(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
* replacements for broken Python api functions
|
* replacements for broken Python api functions (in Python 2.3).
|
||||||
|
* See #1047269 Buffer overwrite in PyUnicode_AsWideChar
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_WCHAR_H
|
#ifdef HAVE_WCHAR_H
|
||||||
|
|
||||||
PyObject *My_PyUnicode_FromWideChar(register const wchar_t *w,
|
PyObject *My_PyUnicode_FromWideChar(register const wchar_t *w,
|
||||||
int size)
|
Py_ssize_t size)
|
||||||
{
|
{
|
||||||
PyUnicodeObject *unicode;
|
PyUnicodeObject *unicode;
|
||||||
|
|
||||||
|
@ -4749,7 +4750,7 @@ PyObject *My_PyUnicode_FromWideChar(register const wchar_t *w,
|
||||||
|
|
||||||
int My_PyUnicode_AsWideChar(PyUnicodeObject *unicode,
|
int My_PyUnicode_AsWideChar(PyUnicodeObject *unicode,
|
||||||
register wchar_t *w,
|
register wchar_t *w,
|
||||||
int size)
|
Py_ssize_t size)
|
||||||
{
|
{
|
||||||
if (unicode == NULL) {
|
if (unicode == NULL) {
|
||||||
PyErr_BadInternalCall();
|
PyErr_BadInternalCall();
|
||||||
|
|
|
@ -377,8 +377,8 @@ extern char *conversion_mode_errors;
|
||||||
# undef PyUnicode_AsWideChar
|
# undef PyUnicode_AsWideChar
|
||||||
# define PyUnicode_AsWideChar My_PyUnicode_AsWideChar
|
# define PyUnicode_AsWideChar My_PyUnicode_AsWideChar
|
||||||
|
|
||||||
extern PyObject *My_PyUnicode_FromWideChar(const wchar_t *, int);
|
extern PyObject *My_PyUnicode_FromWideChar(const wchar_t *, Py_ssize_t);
|
||||||
extern int My_PyUnicode_AsWideChar(PyUnicodeObject *, wchar_t *, int);
|
extern int My_PyUnicode_AsWideChar(PyUnicodeObject *, wchar_t *, Py_ssize_t);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue