commit
7bca994dd2
@ -23,7 +23,9 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <winpr/assert.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/path.h>
|
||||
#include <winpr/assert.h>
|
||||
@ -191,6 +193,7 @@ void xf_keyboard_release_all_keypress(xfContext* xfc)
|
||||
{
|
||||
WINPR_ASSERT(xfc);
|
||||
|
||||
WINPR_STATIC_ASSERT(ARRAYSIZE(xfc->KeyboardState) <= UINT32_MAX);
|
||||
for (size_t keycode = 0; keycode < ARRAYSIZE(xfc->KeyboardState); keycode++)
|
||||
{
|
||||
if (xfc->KeyboardState[keycode])
|
||||
|
@ -21,7 +21,9 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <winpr/assert.h>
|
||||
#include <winpr/crt.h>
|
||||
|
||||
#include <freerdp/utils/string.h>
|
||||
@ -324,6 +326,7 @@ DWORD freerdp_keyboard_init(DWORD keyboardLayoutId)
|
||||
|
||||
ZeroMemory(VIRTUAL_SCANCODE_TO_X11_KEYCODE, sizeof(VIRTUAL_SCANCODE_TO_X11_KEYCODE));
|
||||
|
||||
WINPR_STATIC_ASSERT(ARRAYSIZE(VIRTUAL_SCANCODE_TO_X11_KEYCODE) <= UINT32_MAX);
|
||||
for (size_t keycode = 0; keycode < ARRAYSIZE(VIRTUAL_SCANCODE_TO_X11_KEYCODE); keycode++)
|
||||
{
|
||||
const DWORD x11 = X11_KEYCODE_TO_VIRTUAL_SCANCODE[keycode];
|
||||
|
@ -21,7 +21,9 @@
|
||||
#include <freerdp/config.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <winpr/assert.h>
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/ssl.h>
|
||||
#include <winpr/path.h>
|
||||
@ -797,6 +799,8 @@ static BOOL shadow_server_create_certificate(rdpShadowServer* server, const char
|
||||
{
|
||||
BOOL rc = FALSE;
|
||||
char* makecert_argv[6] = { "makecert", "-rdp", "-live", "-silent", "-y", "5" };
|
||||
|
||||
WINPR_STATIC_ASSERT(ARRAYSIZE(makecert_argv) <= INT_MAX);
|
||||
const size_t makecert_argc = ARRAYSIZE(makecert_argv);
|
||||
|
||||
MAKECERT_CONTEXT* makecert = makecert_context_new();
|
||||
@ -804,7 +808,6 @@ static BOOL shadow_server_create_certificate(rdpShadowServer* server, const char
|
||||
if (!makecert)
|
||||
goto out_fail;
|
||||
|
||||
WINPR_ASSERT(makecert_argc <= INT_MAX);
|
||||
if (makecert_context_process(makecert, (int)makecert_argc, makecert_argv) < 0)
|
||||
goto out_fail;
|
||||
|
||||
|
@ -22,32 +22,6 @@
|
||||
|
||||
#include <winpr/platform.h>
|
||||
|
||||
// C99 related macros
|
||||
#if defined(__STDC__) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
#define WINPR_RESTRICT restrict
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1900
|
||||
#define WINPR_RESTRICT __restrict
|
||||
#else
|
||||
#define WINPR_RESTRICT
|
||||
#endif
|
||||
|
||||
// C23 related macros
|
||||
#if defined(__STDC__) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L)
|
||||
#define WINPR_FALLTHROUGH \
|
||||
(void)0; \
|
||||
[[fallthrough]];
|
||||
#elif defined(__clang__)
|
||||
#define WINPR_FALLTHROUGH \
|
||||
(void)0; \
|
||||
__attribute__((fallthrough));
|
||||
#elif defined(__GNUC__) && (__GNUC__ >= 7)
|
||||
#define WINPR_FALLTHROUGH \
|
||||
(void)0; \
|
||||
__attribute__((fallthrough));
|
||||
#else
|
||||
#define WINPR_FALLTHROUGH (void)0;
|
||||
#endif
|
||||
|
||||
/* Set by CMake during configuration */
|
||||
#cmakedefine WINPR_HAVE_STDINT_H
|
||||
#cmakedefine WINPR_HAVE_STDBOOL_H
|
||||
|
@ -22,6 +22,8 @@
|
||||
#define WINPR_ASSERT_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <winpr/winpr.h>
|
||||
#include <winpr/wtypes.h>
|
||||
#include <winpr/wlog.h>
|
||||
@ -56,8 +58,28 @@ extern "C"
|
||||
#endif
|
||||
|
||||
#else
|
||||
#include <assert.h>
|
||||
#define WINPR_ASSERT(cond) assert(cond)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#if defined(__cplusplus) && (__cplusplus >= 201703L) // C++ 17
|
||||
#define WINPR_STATIC_ASSERT(cond) static_assert(cond)
|
||||
#elif defined(__cplusplus) && (__cplusplus >= 201103L) // C++ 11
|
||||
#define WINPR_STATIC_ASSERT(cond) static_assert(cond, #cond)
|
||||
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L) // C23
|
||||
#define WINPR_STATIC_ASSERT(cond) static_assert(cond)
|
||||
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) // C11
|
||||
#define WINPR_STATIC_ASSERT(cond) _Static_assert(cond, #cond)
|
||||
#else
|
||||
WINPR_PRAGMA_WARNING("static-assert macro not supported on this platform")
|
||||
#define WINPR_STATIC_ASSERT(cond) assert(cond)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* WINPR_ERROR_H */
|
||||
|
@ -27,8 +27,36 @@
|
||||
#define WINPR_PRAGMA_WARNING(msg) WINPR_DO_PRAGMA(GCC warning #msg)
|
||||
#elif defined(__clang__)
|
||||
#define WINPR_PRAGMA_WARNING(msg) WINPR_DO_PRAGMA(GCC warning #msg)
|
||||
#elif defined(_MSC_VER)
|
||||
#elif defined(_MSC_VER) && (_MSC_VER >= 1920)
|
||||
#define WINPR_PRAGMA_WARNING(msg) WINPR_DO_PRAGMA(message \x28 #msg \x29)
|
||||
#else
|
||||
#define WINPR_PRAGMA_WARNING(msg)
|
||||
#endif
|
||||
|
||||
// C99 related macros
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
#define WINPR_RESTRICT restrict
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1900
|
||||
#define WINPR_RESTRICT __restrict
|
||||
#else
|
||||
#define WINPR_RESTRICT
|
||||
#endif
|
||||
|
||||
// C23 related macros
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L)
|
||||
#define WINPR_FALLTHROUGH \
|
||||
(void)0; \
|
||||
[[fallthrough]];
|
||||
#elif defined(__clang__)
|
||||
#define WINPR_FALLTHROUGH \
|
||||
(void)0; \
|
||||
__attribute__((fallthrough));
|
||||
#elif defined(__GNUC__) && (__GNUC__ >= 7)
|
||||
#define WINPR_FALLTHROUGH \
|
||||
(void)0; \
|
||||
__attribute__((fallthrough));
|
||||
#else
|
||||
#define WINPR_FALLTHROUGH (void)0;
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
|
@ -65,7 +65,7 @@
|
||||
#define WINPR_FORMAT_ARG _Printf_format_string_
|
||||
#endif
|
||||
|
||||
#if defined(__STDC__) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L)
|
||||
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L)
|
||||
#define WINPR_DEPRECATED(obj) [[deprecated]] obj
|
||||
#define WINPR_DEPRECATED_VAR(text, obj) [[deprecated(text)]] obj
|
||||
#define WINPR_NORETURN(obj) [[noreturn]] obj
|
||||
|
Loading…
Reference in New Issue
Block a user