363 Commits

Author SHA1 Message Date
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
a70db017b0 stream: fix spelling
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-04-22 08:57:19 +02:00
7e4dd3e49d socket: add sys_object alike wrapper for sockets
Unlike Posix, Windows handles HANDLE (file, pipe) and SOCKET descriptors
differently. It uses different close(), different errno... So sys_object
was not usable for socket without templating operations to a traits
class.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-04-22 08:43:00 +02:00
1f242823d0 system: make sys_object::duplicate public
It's useful to clone std handles when creating streams to write/read to
standard streams. As the stream we give handle to assumes the handle
ownership, it'd close the std handles in stream destructor.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-04-17 13:58:59 +02:00
525645b43b Configure branch for Git submodules
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-03-15 19:55:53 +01:00
9809765b33 minisign: add
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-03-15 14:45:27 +01:00
5e86663557 locale: allow setting of default locale
References: f689011a65bd14e8ce59b5402db9e2f4232b8346
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-03-04 14:21:50 +01:00
48e35c1ebd sgml: std::basic_string_view → std::basic_string
MSVC fails to deduce character type from std::string/wstring when
converting to std::basic_string_view.

Reference: f5bce32d06cdcf677ce8080027d3317c6387e715
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-03-04 13:46:00 +01:00
7e07d14de7 scoped_executor: add
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-03-01 09:28:48 +01:00
e0e1663c58 sys_info: fix missing #includes
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-27 13:57:03 +01:00
e558c9f244 sgml: Silence unreferenced parameter warning
This parameter is needed to provide compatibility between utf16_t and
utf32_t, so we may call this function from a single template for both
types.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-23 16:48:04 +01:00
d738c9f8fd Xcode: fix to compile
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-21 17:51:02 +01:00
e01040430f debug: fix to compile on non-Windows 2024-02-21 17:38:29 +01:00
c20d9dbc09 sgml: upgrade to support UTF-16 and 32
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>
2024-02-21 17:33:00 +01:00
c6f5a72e70 zlib: fix length comparison in unit test
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-21 15:51:21 +01:00
31a53e9e43 UnitTests: Specify intermediate and output folders
Microsoft changed defaults in recent Visual Studio update. To worse
IMHO.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-21 15:50:30 +01:00
ae8ce7f9f0 string: cleanup
Templates are inline by default.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-21 15:21:45 +01:00
f689011a65 locale: use nullptr as default locale on Windows too
Since stdex::locale_default is inline, it is initialized by the first
module referencing it. Not necessarily compiled with the same _CONSOLE
definition as other modules. This makes the default locale fluid.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-19 14:32:57 +01:00
87d678f524 sgml: dismiss MSVC warnings
Brain-dead _Printf_format_string_ SAL doesn't understand utf32_t is good
enough for unsigned int expected by %x placeholder.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-19 09:16:06 +01:00
10f999c7bf unicode: Cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-15 09:13:51 +01:00
0a719e3081 Xcode: turn on and resolve all warnings 2024-02-14 15:05:41 +01:00
0560c7bce9 Add missing UTF-8 BOM
This is required on Windows with default charset set to Windows-1252 or
another non-UTF-8 charset.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-14 12:33:29 +01:00
8ac0efa85d Xcode: resolve -Wsign-compare
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-14 12:28:39 +01:00
681a6955d8 Xcode: resolve -Wunknown-pragmas
This is a multi-platform project and while trying to reduce amount of

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-14 12:26:52 +01:00
2232b0d23e UnitTests: remove Xcode settings set as default already 2024-02-14 08:49:36 +01:00
82a0ea69f9 unicode: don't specify MB_PRECOMPOSED for UTF-7&8
MultiByteToWideChar returns ERROR_INVALID_FLAGS on pre Windows 10.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-12 13:02:06 +01:00
fb6ac904af sys_info: fix Windows x86 compilation
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-09 09:02:12 +01:00
b0c682edd6 Fix to compile for Windows
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-08 15:26:20 +01:00
9acd185d44 UnitTest: redesing to avoid #include ".cpp" in Xcode
Each unit test .cpp file is not a separate compilation unit in Xcode project
like it is in Visual Studio. Hopefully, Visual Studio test tool still likes
this arrangement.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-08 15:18:42 +01:00
1e627e1c6b UnitTests: add zlib testing
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-08 14:38:34 +01:00
6e121395f3 UnitTest: switch to C++17
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-08 14:17:15 +01:00
5b80f24830 string: fix vsnprintf on macOS
vsnprintf_l and vswprintf_l mutate va_list parameter on some versions of macOS (11.7 Big Sur).
This makes it impossible to call printf multiple times with a growing buffer.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-08 14:16:36 +01:00
b5e35922f1 string: revert emojis in unit test
Actually, using ill-created locale was the cause sprintf returned EILSEQ on %ls inserts containing emoji.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-08 14:04:15 +01:00
a4ca4df926 locale: use nullptr as default locale on non-Windows systems
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-08 14:02:20 +01:00
f5f4cbf308 sys_info: make platform_id enum
This allows same platform management across different operating systems.
Like with charset_id, the Windows numbering was adopted.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-08 13:08:29 +01:00
08a18d1519 macOS support
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-02-08 12:09:33 +01:00
b6be4f040e #if defined(_DEBUG) → #if !defined(NDEBUG)
Microsoft declares all identifiers starting with underscore _ as
internal to MSVC. Thus, we should either use defined(DEBUG) or
!defined(NDEBUG) to distinguish Debug and Release builds.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-25 10:35:09 +01:00
ce1688964a progress: add timeout_progress
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-25 09:52:43 +01:00
10830d5583 html: cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-24 18:19:01 +01:00
4a8ba9eb60 mapping: add + operator
This allows cleaner arithmetic when adjusting mapping by an offset.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-24 12:26:54 +01:00
18c41ebfdf interval: add += and -= operators
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-24 12:25:47 +01:00
cf73f8a48d zlib: Update
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-23 11:01:12 +01:00
016577dbec endian: mark one-byte "swap" functions as constexpr
While being here only for templates to work with various data types, the
one-byte "swap" functions are actually noop.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-22 16:57:25 +01:00
bf029efd07 parser: switch to own endian conversion
htonl and htons require Ws2_32.lib on Windows, while we already have
endian swapping functions in stdex.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-22 16:55:40 +01:00
bdb266f039 parser: fix detected IPv4 and IPv6 byte order
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-22 11:40:51 +01:00