This is analogous to string.hpp's strlen, strcpy, strcat, which use C++
polymorphism rather than function name decorations for char/wchar_t
flavors.
Signed-off-by: Simon Rozman <simon@rozman.si>
While runtime asserts also served as MSVC Code Analysis hints, the lack
of asserts in Release builds provides no hints to Code Analysis which
rises a lot of warnings then.
Maybe I should learn how to use SAL to annotate <ptr, len> parameter
pairs to allow ptr==nullptr when and only when len==0? 😇
Signed-off-by: Simon Rozman <simon@rozman.si>
This is a royal PITA to get compiled under various combinations of
WIN32_LEAN_AND_MEAN and _WINSOCKAPI_ combinations.
Signed-off-by: Simon Rozman <simon@rozman.si>
Windows is very peculiar with #include <windows.h>. Besides we need some
OS primitive wrappers that are OS-specific.
Signed-off-by: Simon Rozman <simon@rozman.si>
The sgml.hpp is about converting between SGML and UTF-16/Unicode
actually. The "wstr" naming aligns better with std::wstring, wchar_t
etc.
Signed-off-by: Simon Rozman <simon@rozman.si>
Classes using m_locale must allow locale configuration in their
constructor. Otherwise m_locale was always set to default by
basic_parser<> constructor.
Signed-off-by: Simon Rozman <simon@rozman.si>
The Release testing revealed that compiler might free temporary
std::locale instances sooner than we thought, exposing UaF.
On 64-bit arch, a reference takes 8 bytes, a std::locale copy takes 16
bytes. So duplicating a locale in each parser instance is not such a big
deal to risk an UaF.
Signed-off-by: Simon Rozman <simon@rozman.si>
These files are C++ only. They should either have no extension like
standard C++ headers (which is cumbersome on Windows environments), or
.hpp.
.h is used for C and hybrid C/C++ headers.
Signed-off-by: Simon Rozman <simon@rozman.si>