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
Simon Rozman
69f2c639cd
string: improve strndup documentation
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-02-20 09:11:00 +01:00
Simon Rozman
442001f66b
curl: use CURL_GLOBAL_DEFAULT by default
...
This makes the client code a bit simpler for typical use-cases.
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-02-13 12:51:49 +01:00
Simon Rozman
faa776a060
curl: fix missing #include
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-02-13 12:44:37 +01:00
Simon Rozman
d13646952d
progress: unify clock usage
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-01-14 12:13:48 +01:00
Simon Rozman
32d656ceed
html: default string lengths in document::assign/append
...
We run a strnlen before processing anyway.
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-01-14 12:13:48 +01:00
Simon Rozman
2674bb0e32
string: add variants for char16_t/char32_t strings
...
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 >
2025-01-13 11:01:01 +01:00
Simon Rozman
a7543cf9ab
string: add snprintf
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-01-13 11:01:01 +01:00
Simon Rozman
db413bb5ce
UnitTests: fix to compile on Windows
...
sys_info.hpp requires an extra #define and linker library.
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-01-13 11:01:01 +01:00
Simon Rozman
8fd9fbf191
Bump Copyright year
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-01-08 12:36:35 +01:00
Simon Rozman
fc5a9aacf8
Trim trailing whitespace
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2025-01-07 15:01:45 +01:00
Simon Rozman
246f2baa1e
string: silence false-positive Code Analysis warning
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-11-19 10:18:03 +01:00
Simon Rozman
f45c92da23
Use == 0 for C strcmp
...
! is too easy to overlook.
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-11-15 10:39:45 +01:00
Simon Rozman
09123326c1
stream: add missing UTF-8 BOM
...
We want to ensure non-UTF8 configured Windows machines interpret our
source code correctly.
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-11-11 12:24:32 +01:00
Simon Rozman
0ae7fb6c7c
stream: use indexing operator for pointer arithmetics
2024-10-22 17:25:54 +02:00
Simon Rozman
4477706f06
stream: trun off false-positive Xcode analysis warning
2024-10-22 17:24:56 +02:00
Simon Rozman
74718b9ef8
uuid: provide uuid_str_max constant for client code
...
Using cryptic constants like 39 makes code awkward to understand.
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-10-21 12:50:52 +02:00
Simon Rozman
e442f4f502
chrono: add to_system() variants for Windows
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-10-21 12:49:08 +02:00
Simon Rozman
16e2384419
system: add safearray_accessor_with_size
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-10-18 23:47:10 +02:00
Simon Rozman
bfda0e962b
html: fix url_escape
...
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 >
2024-10-09 17:09:50 +02:00
Simon Rozman
6379065f15
curl: add
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-10-03 17:26:25 +02:00
Simon Rozman
582438ac61
sys_info: fix to compile for _WIN32
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-10-01 16:37:35 +02:00
Simon Rozman
8844c4059d
sys_info: add username
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-09-30 17:18:12 +02:00
Simon Rozman
9fb899849d
stream: weasel around false-positive GCC warning
...
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 >
2024-09-30 13:30:13 +02:00
Simon Rozman
4fa30d5630
memory: add get_ptr
...
This was migrated from WinStd being platform independent.
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-09-30 09:40:19 +02:00
Simon Rozman
5675f8b139
string: add recoding from UTF-16 to UTF-32
...
I know there are system functions for this (and libiconv), but this is
so trivial and quick in our implementation.
2024-09-27 14:11:11 +02:00
Simon Rozman
da11495282
string: fix high&low UTF-16 surrogate detection
...
U+D800 is a perfectly valid high surrogate. (Thou, not normal.)
While U+DC00 is a perfectly valid low surrogate.
2024-09-27 14:09:05 +02:00
Simon Rozman
f87191d113
memory: silence unknown #pragma warning
2024-09-27 14:05:46 +02:00
Simon Rozman
bdae4913c0
compat: add _In_reads_bytes_
2024-09-27 12:24:17 +02:00
Simon Rozman
8075686eee
memory: add sanitizing_allocator and sanitizing_blob
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-08-26 15:50:33 +02:00
Simon Rozman
d2be6a7c08
langid: address MSVC warnings
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-08-22 17:59:21 +02:00
Simon Rozman
c4e57f15df
langid: extend and fix conversions
...
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 >
2024-08-22 17:02:44 +02:00
Simon Rozman
e65eb35cc2
Cleanup precompiler directives
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-08-21 13:32:58 +02:00
Simon Rozman
d9eb8292a9
langid: finish
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-08-19 16:29:22 +02:00
Simon Rozman
8bd8143c6b
langid: sync Windows build
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-08-19 13:01:29 +02:00
Simon Rozman
e24bd3d1fa
socket: sync Windows build
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-08-19 13:01:13 +02:00
Simon Rozman
7b21a3983c
stdex: add langid
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-08-19 11:20:42 +02:00
Simon Rozman
98e8756808
string: add ispunct
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-08-19 09:25:23 +02:00
Simon Rozman
a95409c9ed
socket: add addrinfo, waddrinfo and saddrinfo
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-08-17 21:42:20 +02:00
Simon Rozman
d118313485
compat: add _Out_writes_all_opt_
...
Signed-off-by: Simon Rozman <simon@rozman.si >
2024-08-17 21:40:38 +02:00