New macros:
- CONSTEXPR_IF_MSVC2022: constexpr for MSVC 2022 and later (also gcc).
- CONSTEXPR_NO_MSVC: no constexpr on any MSVC (but yes on gcc).
Use CONSTEXPR_IF_MSVC2022 on multi-line constexpr functions.
Use CONSTEXPR_NO_MSVC on functions that can be constexpr on gcc but
not any version of MSVC.
Also Gsvt::Console::fflush().
[rpcli] rpcli.cpp, verifykeys.cpp: Use Gsvt::Console::fflush().
verifykeys.cpp: Only call fflush() at the end of the function.
Code size difference: (64-bit Gentoo Linux, gcc-15.1.0, release build, no LTO)
text data bss dec hex filename
45929 2168 432 48529 bd91 rpcli [before]
45968 2176 416 48560 bdb0 rpcli [after]
-39 +8 -16 -31 -1f Difference
Gsvt::StdOut and Gsvt::StdErr are predefined as wrappers around
gsvt_stdout and gsvt_stderr.
Accessing either of the wrapper classes automatically calls gsvt_init().
gsvt_posix.c, gsvt_win32.c: Rework gsvt_init() to use pthread_once() so
multiple initializations won't cause problems.
[rpcli] rpcli.cpp, verifykeys.cpp: Use gsvtpp.
This does increase the code size a tiny bit...
Code size difference: (64-bit Gentoo Linux, gcc-15.1.0, release build, no LTO)
text data bss dec hex filename
45810 2152 416 48378 bcfa rpcli [before]
45929 2168 432 48529 bd91 rpcli [after]
+119 +16 +16 +151 +97 Difference
- Convert the language code from uppercase to lowercase.
- After the conversion, make sure that the language code is all
lowercase characters.
- Colorize the warning message in yellow.
ctypex.h:
- Use `int` instead of `char` in the non-localized functions. This
ensures Windows TCHAR works properly without getting truncated.
- New functions toupper_ascii() and tolower_ascii().
Mostly copied from rpcli's vt.cpp, but with a few changes. In particular:
- gsvt_fwrite() and gsvt_fputs() are wrappers around the ANSI emulation
code, *if* ANSI isn't supported and it's a real console.
- The ANSI emulation code no longer resets attributes after data is
written, since we might make multiple calls with color changes.
[rpcli] rpcli.cpp: Simplify the Windows-specific code.
Instead of checking if the console is a console, just use gsvt_fwrite().
gsvt_fwrite() will handle this.
FIXME: gsvt_cout wrapper so we can get rid of this.
Currently for Linux only. The Linux implementation is mostly just
wrapper functions around stdio.
gsvt_fputs() does not have a `newline` parameter, so anything that
used ConsolePrint()'s `newline` parameter now has to explicitly
call gsvt_newline().
Otherwise, we have to install the specific Tracker library, which is
versioned, so we end up with more problems.
(cherry picked from commit 1356d23d4c)
fmt::format() worked on my main system, but on Xubuntu 16.04, it didn't
work because the fmt headers aren't included:
src/kde/xattr/Ext2AttrView.cpp: In member function ‘void Ext2AttrViewPrivate::retranslateUi_nonDesigner()’:
src/kde/xattr/Ext2AttrView.cpp:94:13: error: ‘fmt’ has not been declared
s_label = fmt::format(FRUN(s_lsattr_fmt), p->lsattr_chr,
^
src/kde/xattr/Ext2AttrView.cpp:94:42: error: ‘FRUN’ was not declared in this scope
s_label = fmt::format(FRUN(s_lsattr_fmt), p->lsattr_chr,
^
We're not linking to fmt in the XAttrView plugin, so use QString::arg()
instead. (I'm guessing CMake auto-magically linked to fmt because
libromdata links to it...)
NOTE: The debug build still links to libfmt-11.so (and a bunch of other
libraries that aren't actually needed). The release build no longer links
to libfmt-11.so. I'm guessing CMake is skipping .so trimming in the debug
builds in order to save time.
This doesn't affect the compiled output, but it's needed by gcc-5.4
in order to be marked as constexpr.
The uninitialized union *is* allowed as of C++20, supported in
gcc-10.1 and later.
Also, put 'd' first so the whole DWORD is initialized instead of just
one 16-bit WORD.
This doesn't affect the compiled output, but it's needed by gcc-5.4
in order to be marked as constexpr.
The uninitialized union *is* allowed as of C++20, supported in
gcc-10.1 and later.
aflplusplus, and the debug version of rpcli, was hanging on some fuzzed
XEXes with ~4 GB headers because the debug version of std::vector<> was
initializing each byte, one at a time.
Headers shouldn't be that big, but we'll go with a maximum of 16 MB
just in case.
Found using aflplusplus-4.32c.
This cleans up the code a bit, but does increase the .o size due to the
use of std::string.
Code size difference: (64-bit Gentoo Linux, gcc-15.1.0, release build, no LTO)
text data bss dec hex filename
6898 8 0 6906 1afa conversion_iconv.cpp.o [before]
9780 8 0 9788 263c conversion_iconv.cpp.o [after]
+2882 0 0 +2882 +b42 Difference
- DoFile(): JSON errors should be printed to stdout, not stderr.
- _tmain(): Remove an extra newline after the `default:` case's
"skipping unknown switch" message.
Interestingly, this didn't print any warnings or errors on gcc, but on
MSVC, this warning was produced:
src\librpbase\TextOut_text.cpp(359,20): error C2220: the following warning is treated as an error
src\librpbase\TextOut_text.cpp(359,20): warning C4996: 'fmt::v11::localtime': was declared deprecated
Only 5 bits are currently used, and this reduces padding due to 64-bit
alignment in the mxh union.
Total struct size before: 9,176
Total struct size after: 9,168
Difference: -8
These functions do non-localized checks, which improves performance in
most cases (due to not need to do locale lookups) and is more "correct"
when checking ROM headers in most cases.
[rpcli] vt.cpp: Removed vt_isdigit() and vt_isalpha(). We can use
isdigit_ascii() and isalpha_ascii() instead.
[libromdata] Updated most IS*() uses to is*_ascii().
NOTE: ISPRINT() and ISSPACE() are left as-is for now.
VirtualBoy: We can mark all of the private is*() functions as
constexpr now.
vWii packages use v0 tickets and TMDs. The "content groups" doesn't
exist, nor does the FST, the system XMLs, or the TGA icons.
Skip all of these if a v0 TMD is detected.
TODO: Change the system name for v0?
Needed to enable hexpand and set xalign.
Not sure if this is needed or supported on GTK2 or GTK3, but using
gtk_box_pack_end() seems to work on the older versions anyway.
XAttrView: Set the compression algorithm in Ext2AttrView.
We're using Ext2AttrView because most Linux file systems that support
compression also support Ext2-style attributes.