Where test expression is already or almost boolean type, using ternery
operator is excessive and possibly more difficult to read.
Signed-off-by: Simon Rozman <simon@rozman.si>
Code analysis got quite good and we'd better keep warnings on our radar.
Either:
1. Research and resolve the reason for the warning.
2. Remove silencing and let code analysis complain.
3. Comment why some warning silencing is there.
Signed-off-by: Simon Rozman <simon@rozman.si>
Windows and Apple (NSString) are using UTF-16 wchar_t. All others use
UTF-32. This eliminates need for additional conversion should we need
UTF-32 on Windows&Apple or UTF-16 on others. Mind, UTF-16↔32 is not a
trivial conversion as it may change number of code units.
Signed-off-by: Simon Rozman <simon@rozman.si>
Nice catch: when calling with basic_bol::match(nullptr, 5, 5), the
method addresses null[4].
Turned this condition into debug assert, as (nullptr, 5, 5) is invalid
input parameter combination.
No need to use locale-specific character type detection when ASCII.
Locale-specific implementation on Windows is not that very fast.
Signed-off-by: Simon Rozman <simon@rozman.si>
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>