cygwin.c: fix several silly/terrible C errors #22724
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Errors fixed:
Not detected by the compiler, but the preprocessor version checks only looked at
CYGWIN_VERSION_API_MINOR
, ignoringCYGWIN_VERSION_API_MAJOR
.extra_len
was declared as a pointer, but used as an integer. I don't see how this could have ever worked.Again, I don't see how this could have ever worked. We're passing the address of a local (stack) variable to
realloc
(instead of the value of the variable).The argument is declared as
U8 *
, so this is mostly harmless, but a cast silences the warning anyway.This is arguably a bug in
utf8_to_utf16
, which doesn't declare its input argument as pointer-to-const. But it's also achar *
vsU8 *
type mismatch, so a cast silences both issues.This is a missing
const
in the declaration of a variable that points to string literals.