char16_t is not exactly the wchar_t on Windows. char32_t is not exactly
the wchar_t on POSIX. Rather than selecting the appropriate variant,
polymorphism picked the template implementation of strncmp, strcpy and
strncpy. The one that does not convert UTF16 surrogate pairs against
their UTF32 representation.
Signed-off-by: Simon Rozman <simon@rozman.si>
When used in URLs to be passed to a browser, strings MUST NOT contain +.
We must escape + too, otherwise browsers converts it to a space or %20,
which does not represent the original value anymore.
Signed-off-by: Simon Rozman <simon@rozman.si>
As _countof is manually implemented on non-Windows platforms, GCC
knows it returns size_t, but fails to realize it will never be more than
0x400 in our case making truncation harmless.
Signed-off-by: Simon Rozman <simon@rozman.si>
LANGID 9 should convert to "en" and 1033 to "en-US". 36 to "sl" and
1060 to "sl-SI". Likewise backwards. Otherwise, we are loosing
disambiguation between generic and country-specific language variants.
Signed-off-by: Simon Rozman <simon@rozman.si>
_Analysis_assume_(expression) is removed by precompiler and statements
like: if (test) stdex_assert(expr); resolved to: if (test) ;
Remains to be seen if Xcode is happy with this change.
Signed-off-by: Simon Rozman <simon@rozman.si>
The sgml_unicode.hpp stores UTF-32 strings in
stdex::sgml_unicode_pair::unicode. Hence stdex::utf32_t should be used as
its datatype. Unfortunately, that doesn't work with U string literal: U
requires hundreds of typecasts to make it fit stdex::utf32_t, since char32_t
is signed, stdex::utf32_t is unsigned. OTOH, L string literal cannot be
used on Windows (produces UTF-16, not UTF-32).
Reported-by: Xcode
Signed-off-by: Simon Rozman <simon@rozman.si>
Looks short and compact, but requires static_cast<unsigned int> to cover T1
and T2 of different signess. Which doesn't look all that nice anymore.
However, typecasting would only hide the warning. We want the warning to
occur, to encourage us to sync types on template invocation instead.
Signed-off-by: Simon Rozman <simon@rozman.si>