Commit Graph

4321 Commits

Author SHA1 Message Date
Armin Novak
b1d401a84e [winpr,platform] add nullptr fallback for pre C23 2026-02-26 13:43:51 +01:00
Armin Novak
e58819830a [c23] simplify boolean checks 2026-02-26 11:51:05 +01:00
Armin Novak
0531803808 [warnings] make function declaration names consistent
Use the same parameter names for declaration and implementation.
2026-02-26 10:35:25 +01:00
Armin Novak
e6c17b13cd [winpr,platform] fix WINPR_ATTR_MALLOC for older GCC 2026-02-26 09:05:29 +01:00
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
a5609b929e [winpr,ncrypt] use pragma once as guard 2026-02-25 15:05:51 +01:00
Armin Novak
5479777822 [winpr,file] fix unit test for WriteFile 2026-02-25 13:39:38 +01:00
Armin Novak
88e8c843f9 [winpr,platform] fall back to attribute for GCC
GCC does not like [[nodiscard]] on function pointers. Fall back to
attribute(warn_unused_result) syntax, which does seem to work.
2026-02-25 11:51:12 +01:00
Armin Novak
e9723d1b61 [attributes] update attribute definitions
* support C++
* support C23
* replace __inline et al with C11 inline
2026-02-25 11:51:11 +01:00
Armin Novak
3fcc287b16 [warnings] initialize all va_list 2026-02-25 07:41:39 +01:00
Armin Novak
b7892a7cc1 [winpr,sspi] fix kerberos unused warnings
when building without kerberos, eliminate all unused warnings
2026-02-25 07:41:39 +01:00
Armin Novak
3c84d08518 [winpr,platform] add C++ guards for macros
define attributes when included from C++ code
2026-02-24 17:14:56 +01:00
Armin Novak
c1d0653c87 [winpr,platform] fix C23 checks
https://en.cppreference.com/w/c/language/attributes.html has a nice
overview of attributes and when they were introduced. Adjust macro
checks accordingly.
2026-02-24 17:14:40 +01:00
Armin Novak
6cebb3e0cd [winpr] fix sign warnings 2026-02-24 16:23:15 +01:00
Armin Novak
8a24443ed6 [nodiscard] fix wrong attribute position 2026-02-24 16:10:11 +01:00
Armin Novak
a9be86ecfa [winpr,platform] add C23 [[nodiscard]] 2026-02-24 16:10:05 +01:00
Armin Novak
7c0a0c903b [winpr,crypto] use size_t as length for md[45] 2026-02-24 09:05:46 +01:00
Armin Novak
262dade595 [cmake] Define WINPR_DEFINE_ATTR_NODISCARD
* Do not define WINPR_ATTR_NODISCARD if WINPR_DEFINE_ATTR_NODISCARD is
  not defined.
* Define WINPR_DEFINE_ATTR_NODISCARD via CMake to enable this for
  internal use only
2026-02-20 09:01:54 +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
81cf9f6cf0 [winpr,warnings] properly handle function return 2026-02-16 09:18:36 +01:00
Armin Novak
399d92f26e [winpr] mark function pointers [[nodiscard]] 2026-02-15 23:57:23 +01:00
Armin Novak
606250f4cb [winpr,smartcard] fix returned attribute length
SCARD_ATTR_DEVICE_SYSTEM_NAME_W requires twice the size, so multiply
before return.
2026-02-12 10:01:06 +01:00
Armin Novak
b6b32bf8c4 [winpr,test] replace sscanf 2026-02-10 16:56:48 +01:00
Armin Novak
47c538fd3f [winpr] fix uninitialized variables 2026-02-10 16:56:44 +01:00
Armin Novak
6bf8793589 [winpr,smartcard] remove unused variable 2026-02-10 15:53:05 +01:00
Armin Novak
f8d85ac201 [winpr,smartcard] fix warnings 2026-02-10 15:53:05 +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
7a83036f9a [winpr,smartcard] fix variable data type 2026-02-10 15:53:04 +01:00
akallabeth
e253643386 [winpr,smartcard] simplify PCSC_ReadDeviceSystemName
* If we read SCARD_ATTR_DEVICE_SYSTEM_NAME_A just pass the actual
  destination buffer, no further processing required.
* In case of SCARD_ATTR_DEVICE_SYSTEM_NAME_W allocate a WCHAR version of
  the result, copy back to destination buffer.
2026-02-09 10:27:09 +01:00
Martin Fleisz
67705cfb35 Merge pull request #12207 from akallabeth/vendor-by-app
Vendor by app
2026-02-09 10:24:17 +01:00
miguel-cv
19b8e80b70 Add missing attribute in smartcard_pcsc
Add SCARD_ATTR_DEVICE_SYSTEM_NAME_A and SCARD_ATTR_DEVICE_SYSTEM_NAME_W to be more compliant with what windows expects. Returns the (provided by pcsc) reader_name.
2026-01-30 09:15:11 +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
Armin Novak
81d6ed2784 [winpr,path] modify GetCombinedPath
Allow the subPath argument to be a format string with variadic
arguments. This allows to generate a subPath on the fly. This change is
API compatible.
2026-01-29 22:47:30 +01:00
akallabeth
d17dc23257 [winpr,test] TestSynchTimerQueue: use int64
The calculations might overflow or be negative, so use INT64 to store
and present the results.
2026-01-28 09:52:49 +01:00
Armin Novak
ba07955689 [client,sdl] handle clipboard events in SdlContext 2026-01-27 15:22:40 +01:00
akallabeth
b5b451e35b Merge pull request #12192 from akallabeth/nodiscard
[winpr,platform] drop C23 [[nodiscard]]
2026-01-27 13:17:49 +01:00
Armin Novak
f443c1bc6f [winpr,platform] drop C23 [[nodiscard]]
In WINPR_ATTR_NODISCARD drop the C23 [[nodiscard]] until we figure out
how to avoid compiler errors on fedora/gcc 15
2026-01-27 12:59:22 +01:00
akallabeth
cf63326799 [winpr,platform] fix duplicate deprecation define 2026-01-27 12:15:03 +01:00
akallabeth
076a8386a6 Merge pull request #12186 from akallabeth/error-handling-fixes
Error handling fixes
2026-01-26 17:05:19 +01:00
akallabeth
1e4c1cd526 [winpr] mark all WINPR_ATTR_MALLOC also nodiscard 2026-01-26 13:39:41 +01:00