Skip to content

Commit

Permalink
Fix typo & add type casts
Browse files Browse the repository at this point in the history
  • Loading branch information
nineteendo committed Apr 28, 2024
1 parent 28b4b6e commit 19209c6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Modules/posixmodule.c
Expand Up @@ -1307,7 +1307,7 @@ path_converter(PyObject *o, void *p)
goto error_exit;
}
#endif
if (!path->null_embeddable && wcslen(wide) != length) {
if (!path->null_embeddable && wcslen(wide) != (size_t)length) {
FORMAT_EXCEPTION(PyExc_ValueError,
"embedded null character in %s");
goto error_exit;
Expand Down Expand Up @@ -1361,7 +1361,7 @@ path_converter(PyObject *o, void *p)

length = PyBytes_GET_SIZE(bytes);
narrow = PyBytes_AS_STRING(bytes);
if (!path->null_embeddable && (size_t)length != strlen(narrow)) {
if (!path->null_embeddable && strlen(narrow) != (size_t)length) {
FORMAT_EXCEPTION(PyExc_ValueError, "embedded null character in %s");
goto error_exit;
}
Expand All @@ -1385,7 +1385,7 @@ path_converter(PyObject *o, void *p)
goto error_exit;
}
#endif
if (!path->null_embeddable && wcslen(wide) != length) {
if (!path->null_embeddable && wcslen(wide) != (size_t)length) {
FORMAT_EXCEPTION(PyExc_ValueError,
"embedded null character in %s");
goto error_exit;
Expand All @@ -1394,7 +1394,7 @@ path_converter(PyObject *o, void *p)
#ifdef MS_WINDOWS
path->narrow = TRUE;
#else
path->narrow = narrow
path->narrow = narrow;
#endif
Py_DECREF(bytes);
wide = NULL;
Expand Down

0 comments on commit 19209c6

Please sign in to comment.