WiiUPackage already showed a message if XML parsing is disabled, but
none of the other classes did.
TODO: EXE_PE: Check if a manifest is present before showing this message.
I initially used vtbl because it was a direct port from the SSSE3 version,
which uses pshufb. It turns out ARM NEON has another instruction, vrev,
that's specifically designed for byteswapping. vrev has the following
advantages over vtbl:
- No shuffle mask (lookup table) is needed.
- Has 128-bit vector versions on ARMv7. (Or, at the very least, MSVC
for ARMv7 has 128-bit vector versions. It didn't have them for the
vtbl instruction when I tried it out.)
Tested on my phone (Pixel 8 Pro) and ByteswapTest passed with vrev.
Fixes#443: Use VREV for byteswapping with NEON?
Reported by @ccawley2011.
pugixml uses "_d" instead of "d".
[pugixml] CMakeLists.txt: Disable options. The cmake_dependent_option()
setup for PUGIXML_USE_POSTFIX prevented the postfix from working because
the top-level source directory is not the same as PugiXML's directory.
[libwin32common] DelayLoadHelper: Handle PugiXML's "_d" postfix.
DelayLoadHelper.cmake has new variables for debug/release only DLLs,
which is used for PugiXML due to the different debug postfix.
Add the PugiXML include path to the GTK and KDE targets
It was already added in the Windows target (as TinyXML2).
This likely didn't cause any problems before because TinyXML2 is usually
installed system-wide on Linux systems.
Need to switch from std::unique_ptr<> to PugiXML's own allocation
and deallocation functions.
Note that because we're converting from UTF-16LE to UTF-8, PugiXML
will end up deallocating our buffer immediately after the text
conversion, so it isn't really "in-place". For other RomData subclasses
that use UTF-8 XML files, e.g. WiiUPackage, it *will* be in-place.
This will allow us to test the PugiXML code on AppVeyor.
TODO:
- Add an internal copy of PugiXML.
- Port everything from TinyXML2 to PugiXML.
- Remove TinyXML2.
This lets us specify a default value if the element either doesn't exist
or has no text.
This actually does have a visible change. Previously, if an image was
missing NAME, DESCRIPTION, DISPLAYNAME, or DISPLAYDESCRIPTION, those
fields would show up blank. If they existed but had no text, they'd
show up with "(none)". With this change, they show up as "(none)" if
they either don't exist or have no text.
PugiXML's API is a lot more straightforward than TinyXML's:
- Uses handle objects instead of pointers. (The handles are essentially
structs containing pointers, but it's a bit easier to work with.)
- Text nodes can be cast to bool and will return true if they have text,
or false if they don't.
- Most functions will return a valid, but empty, handle if the requested
node doesn't exist, so we don't have to do explicit nullptr checking.
- Built-in support for UTF-16, so we don't need to use librptext.
- Supports in-place parsing, so it doesn't have to make another copy.
(This doesn't work if encoding conversion is needed, but that's handled
automatically.)
- xml_text::as_int() exists at least as far back as 1.7, which is included
in Ubuntu 16.04. On the other hand, TinyXML 2.2.0, also included in
Ubuntu 16.04, does not have XMLElement::IntText(). Since as_int() is
available, we can get rid of XMLElement_IntText().
Optimizations related to PugiXML:
- Simplify creationTime parsing by taking advantage of the fact that
xml_nodes can never dereference a nullptr.
Other changes:
- Add a sanity check verifying that the WIM file contains at least 1
image.
- Move the image count sanity check to before xml_document parsing.
TODO: Simplify some more parsing.
This fixes issues with MSVC 2015 and some other versions with different
C++ standards levels.
src\libromdata/img/TCreateThumbnail.hpp(109): warning C4346: 'std::is_pointer<_Ty>::value':
dependent name is not a type (compiling source file src\win32\RP_ExtractIcon.cpp)
I thought I got this one earlier...
src\librptext\conversion_win32.cpp(176): warning C4267: 'argument':
conversion from 'size_t' to 'int', possible loss of data
Disabled these warnings:
- C4005: macro redefinition (libpng's intprefix.out.tf1 is breaking on this...)
- C4091: 'typedef ': ignored on left of 'tagGPFIDL_FLAGS' when no variable is declared
- C4800: 'BOOL': forcing value to bool 'true' or 'false' (performance warning)
TODO:
- Re-enable C4800 as not-an-error?
- Figure out how to fix libpng's C4005 warnings.
These warnings (now handled as errors) appeared in the AppVeyor build
with MSVC 2015:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\algorithm(1669): error C2220: warning treated as error - no 'object' file generated [build\src\amiibo-data\amiiboc.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\algorithm(1669): warning C4996: 'std::reverse_copy::_Unchecked_iterators::_Deprecate': Call to 'std::reverse_copy' with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' [build\src\amiibo-data\amiiboc.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\algorithm(1669): note: see declaration of 'std::reverse_copy::_Unchecked_iterators::_Deprecate'
extlib\fmt\include\fmt/chrono.h(659): note: see reference to function template instantiation '_OutIt *std::reverse_copy<char*,char*>(_BidIt,_BidIt,_OutIt)' being compiled
with
[
_OutIt=char *,
_BidIt=char *
]
extlib\fmt\include\fmt\color.h(410): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) [build\src\amiibo-data\amiiboc.vcxproj]
extlib\fmt\include\fmt\color.h(409): note: while compiling class template member function 'bool fmt::v11::detail::ansi_color_escape<Char>::has_emphasis(fmt::v11::emphasis,fmt::v11::emphasis) noexcept'
with
[
Char=wchar_t
]
extlib\fmt\include\fmt\color.h(371): note: see reference to function template instantiation 'bool fmt::v11::detail::ansi_color_escape<Char>::has_emphasis(fmt::v11::emphasis,fmt::v11::emphasis) noexcept' being compiled
with
[
Char=wchar_t
]
extlib\fmt\include\fmt\color.h(450): note: see reference to class template instantiation 'fmt::v11::detail::ansi_color_escape<Char>' being compiled
with
[
Char=wchar_t
]
extlib\fmt\include\fmt/xchar.h(328): note: see reference to function template instantiation 'void fmt::v11::detail::vformat_to<T>(fmt::v11::detail::buffer<T> &,const fmt::v11::text_style &,fmt::v11::basic_string_view<wchar_t>,fmt::v11::basic_format_args<fmt::v11::wformat_context>)' being compiled
with
[
T=wchar_t
]
Both lastmodtime_high and lastmodtime_low were being initialized to
strtoul(s_highPart, ...).
Testing Windows 10 (10.0.19041.5363) recovery image: (winre.wim)
- HIGHPART: 0x01D5ACCD
- LOWPART: 0x97A856C3
- Decimal: 132201763089962691
Timestamp conversions before and after: (using TZ=UTC)
- Before: 12/07/2019 07:07:37 AM
- After: 12/07/2019 07:11:48 AM
Manually converting it using a website:
- Saturday, December 7, 2019 7:11:48 AM
TODO: Split the XML code into a separate .cpp file and add DelayLoad checks.
This was updated in DelayLoadHelper.cmake when TinyXML2 was updated, but
I forgot to update it here.
FIXME: Define this somewhere else so we don't forget to update it later.
Mostly related to converting `off64_t` (file sizes) to `size_t`.
J2MEPrivate::loadFileFromZip():
- Cast the default max_size parameter to `size_t`.
- Cast file_info.uncompressed_size to `size_t` as well. This should be
optimized out in 64-bit builds.
ELF:
- Need to cast d_tag values to `size_t` before using it with operator[].
CdiReader, GdiReader:
- Cast std::numeric_limits<>::max() to `size_t` before comparing it
with idx.