mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Use PyUnicode_AsUnicodeAndSize() instead of PyUnicode_GET_SIZE()
This commit is contained in:
parent
e459a0877e
commit
beac78bb24
3 changed files with 15 additions and 9 deletions
|
@ -2282,6 +2282,8 @@ case_ok(PyObject *filename, Py_ssize_t prefix_delta, PyObject *name)
|
|||
WIN32_FIND_DATAW data;
|
||||
HANDLE h;
|
||||
int cmp;
|
||||
wchar_t *wname;
|
||||
Py_ssizet wname_len;
|
||||
|
||||
if (Py_GETENV("PYTHONCASEOK") != NULL)
|
||||
return 1;
|
||||
|
@ -2294,9 +2296,12 @@ case_ok(PyObject *filename, Py_ssize_t prefix_delta, PyObject *name)
|
|||
return 0;
|
||||
}
|
||||
FindClose(h);
|
||||
cmp = wcsncmp(data.cFileName,
|
||||
PyUnicode_AS_UNICODE(name),
|
||||
PyUnicode_GET_SIZE(name));
|
||||
|
||||
wname = PyUnicode_AsUnicodeAndSize(name, &wname_len);
|
||||
if (wname == NULL)
|
||||
return -1;
|
||||
|
||||
cmp = wcsncmp(data.cFileName, wname, wname_len);
|
||||
return cmp == 0;
|
||||
#elif defined(USE_CASE_OK_BYTES)
|
||||
int match;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue