350 Commits

Author SHA1 Message Date
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
848979950c progress: add aggregate_progress
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-19 15:00:53 +01:00
f3e117afcc watchdog: upgrade to rearm rather than die on initial timeout
This makes watchdog reusable.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-19 14:48:23 +01:00
528ea5fffe pool: add clear
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-19 14:44:37 +01:00
8839c80fec debug: add benchmark
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-18 12:19:44 +01:00
ab94d7014f stream: cleanup
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-16 08:24:37 +01:00
59a53e10f4 string: update documentation
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-11 09:09:46 +01:00
9f3d65d910 zlib: add
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-09 20:07:06 +01:00
790c26789a sys_info: add is_screen_reader
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-09 20:06:02 +01:00
c5feba2ed0 string: add unit test for sprintf
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-09 19:31:07 +01:00
38c6b40b21 Bump Copyright year
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-06 10:55:09 +01:00
b42aa969dc unicode: Write directly into std::string buffer
This removes extra memory allocation.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-05 22:55:15 +01:00
114609274f string: address Code Analysis warnings
Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-05 22:45:41 +01:00
293da738b9 string: upgrade sprintf to write directly into std::string buffer
This removes extra memory allocation.

Signed-off-by: Simon Rozman <simon@rozman.si>
2024-01-05 20:32:00 +01:00