Skip to content

GH-131296: fix clang-cl warnings in fileutils.c #131301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Python/fileutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ int _Py_open_cloexec_works = -1;

// mbstowcs() and mbrtowc() errors
static const size_t DECODE_ERROR = ((size_t)-1);
#ifdef HAVE_MBRTOWC
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix warning : unused variable 'INCOMPLETE_CHARACTER' [-Wunused-const-variable]

static const size_t INCOMPLETE_CHARACTER = (size_t)-2;

#endif

static int
get_surrogateescape(_Py_error_handler errors, int *surrogateescape)
Expand Down Expand Up @@ -129,7 +130,7 @@ is_valid_wide_char(wchar_t ch)
// Reject lone surrogate characters
return 0;
}
if (ch > MAX_UNICODE) {
if (sizeof(ch) > 2 && ch > MAX_UNICODE) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix warning : result of comparison of constant 1114111 with expression of type 'wchar_t' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]

// bpo-35883: Reject characters outside [U+0000; U+10ffff] range.
// The glibc mbstowcs() UTF-8 decoder does not respect the RFC 3629,
// it creates characters outside the [U+0000; U+10ffff] range:
Expand Down
Loading