Cygwin: Fix warning about address known to be non-NULL in /proc/locales

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: c42b98bdc6 ("Cygwin: introduce /proc/codesets and /proc/locales")
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
This commit is contained in:
Jon Turney 2024-08-04 16:37:44 +01:00
parent 367b69a280
commit 696cd4ee02
No known key found for this signature in database
GPG Key ID: C7C86F0370285C81
1 changed files with 1 additions and 2 deletions

View File

@ -2193,8 +2193,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)