06ad21caab
string: fix strncoll to trim string lengths
...
Doxygen Action / build (push) Has been cancelled
MSVC implementation does not stop on zero terminator.
Signed-off-by: Simon Rozman <simon.rozman@amebis.si >
2025-12-18 13:28:36 +01:00
83fa108f99
stream: fix cache flush when stream is at EOF
...
Signed-off-by: Simon Rozman <simon.rozman@amebis.si >
2025-12-18 13:27:37 +01:00
97e781778c
interval: add extend and intersect
...
Doxygen Action / build (push) Has been cancelled
Signed-off-by: Simon Rozman <simon.rozman@amebis.si >
2025-12-16 17:41:58 +01:00
9e9209c55b
string: fix char16_t/char16_t strncmp
...
Doxygen Action / build (push) Has been cancelled
Signed-off-by: Simon Rozman <simon.rozman@amebis.si >
2025-12-12 18:44:11 +01:00
655bee3692
string: add variants for char16_t/char16_t strncmp
...
Doxygen Action / build (push) Has been cancelled
Technically, this is still binary compare with no locale-specific
ordering knowledge. But takes Unicode representation of UTF-16 surrogate
pairs when comparing.
Signed-off-by: Simon Rozman <simon.rozman@amebis.si >
2025-12-03 12:49:10 +01:00
Simon Rozman
f9b7dba542
stream: resolve Xcode analysis warning
...
Doxygen Action / build (push) Has been cancelled
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-10-01 16:22:48 +02:00
Simon Rozman
918eeeefa6
parser: use indexing to get string offsets
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-10-01 16:20:53 +02:00
Simon Rozman
2cc53b41f5
Upgrade to Xcode 26
Doxygen Action / build (push) Has been cancelled
2025-09-30 17:23:23 +02:00
Simon Rozman
9df39583d6
compat: add a simple std::ctype<char16_t> for OSX
...
Doxygen Action / build (push) Has been cancelled
Standard C++ implementation has std::ctype<wchar_t> for UTF-32, but no
UTF-16 one. Since NSString is UTF-16, we need support for UTF-16 in C++
too if unnecessary translations between UTF-16/32 are to be avoided.
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-09-15 12:11:59 +02:00
Simon Rozman
4611976a42
html: support for char16_t
...
This allows processing UTF-16 HTML documents on non-Windows platforms.
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-09-11 15:10:50 +02:00
Simon Rozman
0e091003b6
string: cleanup
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-09-11 15:00:01 +02:00
Simon Rozman
0f57f7de35
string: fix typo
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-09-11 12:17:56 +02:00
Simon Rozman
2785ee68f3
json: support any ASCII-compliant char type
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-09-11 12:16:49 +02:00
Simon Rozman
b2f0ac3a3b
system: add note to deprecate sstring
...
Doxygen Action / build (push) Has been cancelled
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-08-27 12:49:37 +02:00
Simon Rozman
de592cebb9
stream: resolve code analysis warnings
...
Doxygen Action / build (push) Has been cancelled
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-08-11 17:21:34 +02:00
Simon Rozman
9588b602a9
system: add to_sstring()
...
Doxygen Action / build (push) Has been cancelled
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-07-08 11:17:40 +02:00
Simon Rozman
b99b2fc19e
Common: Enforce explicit handle validation
...
Some invalid handle values are -1 or INVALID_HANDLE_VALUE, hence our
handle template has a specific invalid handle value parameter we should
always test against. Time and again, I find my code simply comparing
handle against zero.
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-07-08 11:17:16 +02:00
Simon Rozman
a9d87b4cfd
stream: set file sharing on POSIX
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-06-30 20:25:33 +02:00
Simon Rozman
faeddedd46
stream: modify read_reminder() to allow custom allocator
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-06-27 15:13:02 +02:00
Simon Rozman
214e307486
mbedtls: add
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-06-17 16:45:29 +02:00
Simon Rozman
7aa64cb625
exception, curl: switch to a reusable numbered errors
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-06-17 16:45:09 +02:00
Simon Rozman
e0cbc4a90a
locale: add missing #include
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-06-17 16:38:06 +02:00
Simon Rozman
19a3ee3af2
exception: add missing #include
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-06-17 16:37:40 +02:00
Simon Rozman
5f2b243942
system: basic_sys_object::get → basic_sys_object::operator T
...
The handle validation is done with valid() method now, so using operator
T to auto-retrieve object handle should not provide ambiguities any
more. As long as we remember to use valid() for testing!
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-06-12 14:20:13 +02:00
Simon Rozman
db91035b42
unicode: fix and cleanup Windows support
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-06-11 09:57:30 +02:00
Simon Rozman
b5cc4c01a9
math: fix align_up declaration
...
Using add() which is non-constexpr, the align_up() itself may not be
constexpr.
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-06-11 09:55:41 +02:00
Simon Rozman
47d10e2d78
Require explicit handle validation
...
Using operator bool() hid ambiguity when handle was polymorfic with
bool.
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-06-09 22:37:08 +02:00
Simon Rozman
f1e894aefd
stream: read huge data in blocks on POSIX
...
read() blocks when there is no more data to read. However, we do need
to loop when read is divided into blocks.
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-06-05 12:29:47 +02:00
Simon Rozman
fc852c77c7
parser: address GCC warnings
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-06-05 12:29:43 +02:00
Simon Rozman
341073b587
html: ignore MSVC pragmas in GCC builds
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-06-05 12:29:35 +02:00
Simon Rozman
2bfe310d47
unicode: inject invalid character on encode failure
...
...rather than throw. This mimics Windows behaviour.
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-06-05 12:29:10 +02:00
Simon Rozman
f454ae9cab
unicode: add ASCII charset
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-06-05 12:29:03 +02:00
Simon Rozman
862c073ca8
stream: read from system stream once on POSIX
...
Looping ReadFile() system call is Windows-specific. POSIX systems don't
need this. In fact: with pipes using buffered streams, this blocks the
read until one full buffer of data is available.
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-06-02 14:22:44 +02:00
Simon Rozman
7bb614a34f
stream: assert buffer is not nullptr before use
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-05-27 15:22:42 +02:00
Simon Rozman
191f3bb2f9
stream: check for address overflows in memory_stream
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-05-27 11:55:07 +02:00
Simon Rozman
406d14746f
math: add align_up/down
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-05-27 11:52:14 +02:00
Simon Rozman
496dc9cb34
Revise ternary operators
...
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 >
2025-05-27 10:23:25 +02:00
Simon Rozman
bed22e7fa5
compat: add _Acquires_lock_
...
It is not exactly needed by stdex, but we have such a nice collection of
the MSVC SAL here already.
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-05-26 16:00:27 +02:00
Simon Rozman
be273d4263
exception: Add exception_msg helper
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-05-13 09:36:22 +02:00
Simon Rozman
4c499f2905
json: add escape
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-04-22 18:43:34 +02:00
Simon Rozman
1b8053f95c
Revise lambda declarations
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-04-16 10:34:11 +02:00
Simon Rozman
487f6fa922
Clear warning suppression
...
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 >
2025-04-03 16:15:27 +02:00
Simon Rozman
91c9a71a5d
Resolve code analysis warnings
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-03-28 17:28:19 +01:00
Simon Rozman
5fc35751a3
UnitTest: Switch to Assert::IsTrue for primitive datatypes
...
Visual Studio 2019 has issues compiling Assert::AreEqual<stdex::langid>.
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-03-28 15:45:24 +01:00
Simon Rozman
51d472d8b2
UnitTest: ShortProjectName is not available in VS2019
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-03-28 14:26:54 +01:00
Simon Rozman
50578dabaa
unicode: Remove deprecated MB_PRECOMPOSED
...
Online documentation suggests it should be used as default (for the most
of code pages), SDK source code says it's deprecated. Let's remove it
and see how things work.
Reference: https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-03-28 14:17:29 +01:00
Simon Rozman
832daf89d6
UnitTests: Fix source code charset
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-03-28 14:17:29 +01:00
Simon Rozman
aae79719cb
AppVeyor: Initial support
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-03-28 13:31:14 +01:00
Simon Rozman
2694f59d79
Sync with Xcode
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-03-12 11:14:19 +01:00
Simon Rozman
bfd8aaff65
Stop throwing in destructors
...
When exception processing is unwinding the stack, any exception thrown
in destructors end up std::terminate()-in our process.
Since all workarounds to report errors from destructors seems an
overkill, and the only important place where we should notify the user
about a failure is the stdex::stream::cache::~cache() (data loss occurs
when failure happens here), and if we'd throw in stdex::stream::cache::
~cache(), our process would get terminated anyway so the data loss is
inevitable, let's just silence this for now and come up with a better
solution later if we get smarter anytime in the future.
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-03-06 22:15:45 +01:00