407 Commits

Author SHA1 Message Date
246f2baa1e string: silence false-positive Code Analysis warning
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-11-19 10:18:03 +01:00
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
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
0ae7fb6c7c stream: use indexing operator for pointer arithmetics 2024-10-22 17:25:54 +02:00
4477706f06 stream: trun off false-positive Xcode analysis warning 2024-10-22 17:24:56 +02:00
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
e442f4f502 chrono: add to_system() variants for Windows
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-10-21 12:49:08 +02:00
16e2384419 system: add safearray_accessor_with_size
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-10-18 23:47:10 +02:00
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
6379065f15 curl: add
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-10-03 17:26:25 +02:00
582438ac61 sys_info: fix to compile for _WIN32
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-10-01 16:37:35 +02:00
8844c4059d sys_info: add username
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-09-30 17:18:12 +02:00
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
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
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
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
f87191d113 memory: silence unknown #pragma warning 2024-09-27 14:05:46 +02:00
bdae4913c0 compat: add _In_reads_bytes_ 2024-09-27 12:24:17 +02:00
8075686eee memory: add sanitizing_allocator and sanitizing_blob
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-08-26 15:50:33 +02:00
d2be6a7c08 langid: address MSVC warnings
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-08-22 17:59:21 +02:00
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
e65eb35cc2 Cleanup precompiler directives
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-08-21 13:32:58 +02:00
d9eb8292a9 langid: finish
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-08-19 16:29:22 +02:00
8bd8143c6b langid: sync Windows build
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-08-19 13:01:29 +02:00
e24bd3d1fa socket: sync Windows build
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-08-19 13:01:13 +02:00
7b21a3983c stdex: add langid
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-08-19 11:20:42 +02:00
98e8756808 string: add ispunct
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-08-19 09:25:23 +02:00
a95409c9ed socket: add addrinfo, waddrinfo and saddrinfo
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-08-17 21:42:20 +02:00
d118313485 compat: add _Out_writes_all_opt_
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-08-17 21:40:38 +02:00
b1a19c01e8 uuid: fix non-Windows platforms 2024-08-14 13:39:03 +02:00
633d0bd119 uuid: add strtouuid
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-06-18 16:58:22 +02:00
5503a0c339 string: add 8 and 16-bit string to binary conversions
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-06-18 16:31:03 +02:00
351fd6babc assert: silence compiler warning for NDEBUG
_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>
2024-06-10 11:30:03 +02:00
ef829b02e9 assert: fix to compile Release versions
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-05-28 11:54:12 +02:00
8c9b07fd2c assert: finish Windows part
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-05-28 11:31:04 +02:00
5c5197d80d string: remove dead code
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-05-28 10:35:47 +02:00
ebd1414721 compat: fix
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-05-28 10:34:26 +02:00
f643951425 system: move _T to compat
...where it belongs.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-05-28 10:25:20 +02:00
5436dda7f6 assert: initial version
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-05-28 10:22:24 +02:00
146c9c948d sgml: address signed/unsigned warnings
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>
2024-05-27 15:05:23 +02:00
ea2f129577 string: stop abusing logical | to load operands and test for zero
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>
2024-05-27 14:37:25 +02:00
ac6bd1315c minisign: add trailing newline
Reported-by: Xcode
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-05-27 13:52:36 +02:00
10c9362b4f mapping: disambiguate local variable el
Reported-by: Xcode
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-05-27 13:51:37 +02:00
a0626f802a system: fix to compile with Xcode
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-05-27 12:17:38 +02:00
c1616b032e mapping: add invert()
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-04-25 15:16:12 +02:00
c6c7498562 mapping: add dst2src and src2dst
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-04-25 12:41:08 +02:00
a97b037a78 minisign: fix SAL
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-04-23 11:12:54 +02:00
369dc7ce39 base64: fix code-analysis warning
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-04-23 11:12:39 +02:00
24c35279a0 chrono: fix aosn_timestamp::period
AOsn is measuring time in **milli**seconds. Not **micro**seconds! All
conversions among clocks were off by a factor of 1000.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-04-23 11:12:07 +02:00
3d3b7565bf socket: add missing namespace
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-04-22 13:56:10 +02:00