Commit Graph

1054 Commits

Author SHA1 Message Date
Armin Novak
208bcbd153 [winpr] Add initializer functions
* Add initializer for wStream
* Add initializer for ASN1 decoder
2026-02-25 19:39:24 +01:00
Armin Novak
48267edf2f [winpr] add WINPR_C_ARRAY_INIT
since C23 allows c++ style initializing replace direct use with this
macro
2026-02-25 19:23:08 +01:00
Armin Novak
3fcc287b16 [warnings] initialize all va_list 2026-02-25 07:41:39 +01:00
Armin Novak
8a24443ed6 [nodiscard] fix wrong attribute position 2026-02-24 16:10:11 +01:00
Armin Novak
33bcf76950 [winpr,collections] fix Queue and MessageQueue
EnsureCapacity was nulling the wrong elements, this commit rectifies
that.
2026-02-19 12:07:42 +01:00
Armin Novak
b08892fb9c [winpr,utils] improve TestQueue
properly test queue fill, drain and resize
2026-02-18 15:43:40 +01:00
Armin Novak
d48452faf3 [winpr,utils] Add Queue_Capacity 2026-02-18 15:43:40 +01:00
Armin Novak
b78cb455cb [winpr,queue] improve queue management
* Fix Queue_EnsureCapacity reallocation handling, ensure queue->tail is
  properly updated.
* Fix allocation behaviour, use growthFactor * 32 as block size.
* Add doxygen for Queue_New
2026-02-18 15:43:39 +01:00
Armin Novak
c0d477d278 [winpr,utils] improve TestMessageQueue
properly test queue fill, drain and resize
2026-02-18 15:32:04 +01:00
Armin Novak
57dfd75231 [winpr,utils] add MessageQueue_Capacity 2026-02-18 14:26:03 +01:00
Armin Novak
c9b72743e3 [winpr,utils] ensure message queue capacity
the capacity should always be larger than what is actually used.
2026-02-18 14:26:03 +01:00
Armin Novak
3b286a923d [winpr,stream] improve return checks in Stream_EnsureCapacity
* Properly check all return values and propagate them back to caller
* Simplify new stream size calculation
2026-02-18 14:26:03 +01:00
Armin Novak
d015ba58de [winpr,collections] fix sign warnings 2026-02-17 16:38:35 +01:00
Armin Novak
118afc0b95 [allocations] fix growth of preallocated buffers
* Replace * 2 with * sizeof(WCHAR) for string usages
* Grow streams and other buffers reasonably, e.g. add 128 elements per
  try and check for possible overflows
* Add constant postfix to force them to 64bit
2026-02-17 13:54:34 +01:00
Armin Novak
399d92f26e [winpr] mark function pointers [[nodiscard]] 2026-02-15 23:57:23 +01:00
Armin Novak
47c538fd3f [winpr] fix uninitialized variables 2026-02-10 16:56:44 +01:00
Armin Novak
52cf5d18f4 [winpr,utils] fix WITH_RESOURCE_VERSIONING
winpr_getApplicationDetailsVersion returned a wrong value.
2026-02-10 15:53:04 +01:00
Armin Novak
5f7f1672ff [winpr,utils] add application details getter/setter
* Allow an application to set a vendor/product/version namespace to search
  for configuration files/settings/...
* Replace all WINPR_VENDOR_STRING et al macros with these getters
2026-01-29 22:47:40 +01:00
akallabeth
1e4c1cd526 [winpr] mark all WINPR_ATTR_MALLOC also nodiscard 2026-01-26 13:39:41 +01:00
akallabeth
75ca7c181f [winpr,wlog] remove duplicate wlog destroy 2026-01-23 22:20:51 +01:00
akallabeth
35b9d1b338 [c,printf] fix wlog format string to match arguments 2026-01-16 11:43:33 +01:00
akallabeth
220dedc723 [winpr,collections] use ListDictionary_Lock
For internal sync, do not directly call EnterCriticalSection but use
the wrapper
2026-01-12 09:03:42 +01:00
Armin Novak
3365d4fb12 [clang,warnings] fix Wjump-misses-init 2026-01-08 11:32:46 +01:00
Armin Novak
91d865aefb [clang,warnings] fix Wjump-misses-init 2026-01-08 11:32:46 +01:00
Armin Novak
f44acc3d25 [clang,warnings] fix Wjump-misses-init 2026-01-08 11:32:46 +01:00
Armin Novak
4a29dcac42 [winpr,utils] explicit NULL checks in jansson WINPR_JSON_ParseWithLength 2025-12-11 09:08:57 +01:00
akallabeth
bbae8d1d6b [winpr,utils] fix jansson wrapper
* Fix WINPR_JSON_ParseWithLength (jansson does not like buffer sizes
  larger than the JSON strig)
* Implement WINPR_JSON_GetErrorPtr
2025-12-10 15:22:57 +01:00
akallabeth
3390e27725 [winpr,utils] fix command line error logging
* fix log messages
* add missing error branches
* fix initialization of logger
2025-11-24 15:56:41 +01:00
akallabeth
f5a51d72b3 [winpr,utils] improve WLog logging
* Increase maximum message size to 16384 bytes (ARM transport logs huge
  texts)
* Unify text message logging to a single function
2025-11-11 11:41:15 +01:00
akallabeth
0dd6d838bb [winpr,json] add WINPR_JSON_AddIntegerToObject
This function adds a integer value (in contrast to real values with
WINPR_JSON_AddNumberToObject) to a JSON object.
2025-10-28 11:13:44 +01:00
Armin Novak
4300fc586d [winpr,json] check for jansson required minimum version 2025-10-01 14:34:26 +02:00
Armin Novak
204079d73c [winpr,json] fix WINPR_JSON_AddItemToArray
Use reference stealing version to add the item to the array
2025-09-30 17:19:56 +02:00
Armin Novak
b2783956bf [winpr,json] fix jansson return value check
json_object_set_new returns 0 on success, -1 on failure
2025-09-30 17:05:05 +02:00
Armin Novak
5c69cf1406 [winpr,json] fix jansson reference count 2025-09-30 17:04:59 +02:00
Armin Novak
fde7eb57ee [winpr,json] fix jansson WINPR_JSON_GetNumberValue 2025-09-30 13:18:55 +02:00
Armin Novak
dc6ae54d7a [winpr,json] fix jansson WINPR_JSON_IsObject 2025-09-30 10:15:39 +02:00
Armin Novak
efd1109ca0 [winpr,json] fix a memory leak with jansson
* Add a reference count debug option to jansson implementation
* Fix a memory leak with add_to_object
2025-09-30 09:51:21 +02:00
akallabeth
74648eb3a9 [c,standard] use C99 inline 2025-09-26 11:29:26 +02:00
Armin Novak
8f8cd89f69 [winpr,json] add jansson support
* Split JSON implementations in separate files
* Simplify JSON detection
* Add jansson implementation
2025-09-25 15:09:28 +02:00
Armin Novak
75787a62de [winpr,json] fix json-c case insensitive object get 2025-09-23 12:33:31 +02:00
Armin Novak
113b73512c [CMake,winpr] add pkg-config dependencies
Depending on CMake variables add cmake required.private options
2025-09-11 07:17:33 +02:00
Armin Novak
058cfa972f [macros] #ifndef MAX
on some platforms the macro is part of the standard library, only define
if not already there.
2025-08-20 11:38:46 +02:00
akallabeth
65f18983ed [warnings] Fix format string errors
* Fix casts of format string arguments (%p requires void*)
* Fix format string to match type of arguments
2025-08-13 15:09:48 +02:00
akallabeth
c3e507a82e [winpr,wlog] Replace WLog_PrintMessage calls
Prefer WLog_PrintTextMessage to have proper format string checks in
place.
2025-08-13 15:08:01 +02:00
akallabeth
df89b04424 [winpr,wlog] Add specialized text log functions
The generic WLog_PrintMessage(VA) functions lack proper checks of the
supplied format strings.
Add WLog_PrintTextMessage(VA) functions that do compile time checks of
supplied format strings to uncover usage errors early and use them in
the logger macros.
2025-08-13 15:07:51 +02:00
Armin Novak
ff8c47b1fc [winpr,utils] do not log command line arguments
Only builds with -DWITH_DEBUG_UTILS_CMDLINE_DUMP=ON will dump the
command line argument that failed during parsing to the log.
2025-07-09 12:26:44 +02:00
Armin Novak
45b3cbf120 [winpr,utils] Add escaped quote support
In CommandLineParseCommaSeparatedValues[Ex] now escaped characters are
respected, so a single quote in a string does not break parsing.
2025-07-09 09:55:57 +02:00
akallabeth
aadc257ecd [utils,json] add functions to read from file 2025-05-26 19:36:40 +02:00
Yixue Wang
e444ce53d7 [stream] reset pool array size after clearing
StreamPool becomes inconsistent after clearing. This might be a
problem in some critical situation. Reset pool array size after
clearing.
2025-05-26 14:27:14 +08:00
akallabeth
4840c9d4ae [winpr,stream] fill up empty stream
In Stream_Write_UTF16_String_From_UTF8 fill up WCHAR if requested even
for empty source strings
2025-04-28 17:09:12 +02:00