rp-libfmt.h: Add a to_tstring() macro.

NOTE: `using` statements within `namespace fmt` didn't work:
src\rp-libfmt.h(48,21): error C2061: syntax error: identifier 'to_wstring'

[win32] RomDataFormat.cpp, ImageTypesTab.cpp: Use fmt::to_tstring().
This commit is contained in:
David Korth 2025-05-11 11:11:10 -04:00
parent 1912c62551
commit 99942e6a04
3 changed files with 13 additions and 8 deletions

View File

@ -41,4 +41,15 @@
# endif /* FMT_VERSION >= 80000 */
#endif /* _WIN32 */
// Windows: fmt::to_tstring()
// NOTE: `using` statements within `namespace fmt` didn't work:
// src\rp-libfmt.h(48,21): error C2061: syntax error: identifier 'to_wstring'
#ifdef _WIN32
# ifdef _UNICODE
# define to_tstring to_wstring
# else /* !_UNICODE */
# define to_tstring to_string
# endif /* _UNICODE */
#endif /* _WIN32 */
#endif /* __cplusplus */

View File

@ -124,12 +124,7 @@ tstring formatDimensions(const int dimensions[3])
dimensions[0], dimensions[1]);
}
} else {
// FIXME: fmt::to_tstring()?
#ifdef _UNICODE
tstr = fmt::to_wstring(dimensions[0]);
#else /* !_UNICODE */
tstr = fmt::to_string(dimensions[0]);
#endif /* _UNICODE */
tstr = fmt::to_tstring(dimensions[0]);
}
return tstr;

View File

@ -403,8 +403,7 @@ void ImageTypesTabPrivate::addComboBoxStrings(unsigned int cbid, int max_prio)
// tr: Don't use this image type for this particular system.
ComboBox_AddString(cboImageType, TC_("ImageTypesTab|Values", "No"));
for (int i = 1; i <= max_prio; i++) {
// FIXME: fmt::to_tstring()?
ComboBox_AddString(cboImageType, fmt::to_wstring(i).c_str());
ComboBox_AddString(cboImageType, fmt::to_tstring(i).c_str());
}
ComboBox_SetCurSel(cboImageType, 0);
}