Fix wxMSW wxDateTimePickerCtrl build with wxUSE_UNICODE_UTF8

Don't use the ternary operator as t_str() doesn't return a pointer in
this build configuration.

Also remove outdated (and maybe even wrong) comment about MinGW headers,
as it's better to use a temporary variable just to avoid writing the
cast explicitly anyhow.

Closes #19338.
This commit is contained in:
Vadim Zeitlin 2021-12-03 15:49:30 +01:00
parent cb3f8f3a5c
commit 552c9dd4ff

View File

@ -121,10 +121,14 @@ void wxDateTimePickerCtrl::MSWUpdateFormat(bool valid)
// as the control seems to remember whichever format was used when it was
// created, i.e. this works both with and without wxDP_SHOWCENTURY.
// Note: due to a bug in MinGW headers, with missing parentheses around the
// macro argument (corrected in or before 8.2, but still existing in 5.3),
// we have to use a temporary variable here.
const TCHAR* const format = valid ? NULL : m_nullText.t_str();
// Use a temporary variable to ensure that the code compiles in
// wxUSE_UNICODE_UTF8 case, where t_str() doesn't return a pointer.
const TCHAR* format;
if ( valid )
format = NULL;
else
format = m_nullText.t_str();
DateTime_SetFormat(GetHwnd(), format);
}