Skip to content

Commit

Permalink
Cygwin: Fix warning about address known to be non-NULL in /proc/locales
Browse files Browse the repository at this point in the history
Fix a gcc 12 warning about an address known to be non-NULL in
format_proc_locale_proc().

> ../../../../src/winsup/cygwin/fhandler/proc.cc: In function ‘BOOL format_proc_locale_proc(LPWSTR, DWORD, LPARAM)’:
> ../../../../src/winsup/cygwin/fhandler/proc.cc:2156:11: error: the address of ‘iso15924’ will never be NULL [-Werror=address]
>  2156 |       if (iso15924)
>       |           ^~~~~~~~
> ../../../../src/winsup/cygwin/fhandler/proc.cc:2133:11: note: ‘iso15924’ declared here
>  2133 |   wchar_t iso15924[ENCODING_LEN + 1] = { 0 };
>       |           ^~~~~~~~

Fixes: c42b98b ("Cygwin: introduce /proc/codesets and /proc/locales")
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
  • Loading branch information
jon-turney authored and github-cygwin committed Aug 22, 2024
1 parent 6204d84 commit 87b066b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions winsup/cygwin/fhandler/proc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2153,8 +2153,7 @@ format_proc_locale_proc (LPWSTR win_locale, DWORD info, LPARAM param)
if (!(cp2 = wcschr (cp + 2, L'-')))
return TRUE;
/* Otherwise, store in iso15924 */
if (iso15924)
wcpcpy (wcpncpy (iso15924, cp, cp2 - cp), L";");
wcpcpy (wcpncpy (iso15924, cp, cp2 - cp), L";");
}
cp = wcsrchr (win_locale, L'-');
if (cp)
Expand Down

0 comments on commit 87b066b

Please sign in to comment.