[format strings] ensure __LINE__ is of type size_t

__LINE__ is not particularily well defined (most fall back to int).
We want to ensure that all the uses in a format string match the format
specifier, so do an explicit cast
This commit is contained in:
akallabeth 2023-01-24 14:37:41 +01:00 committed by akallabeth
parent 686c26794b
commit 74530a7931
7 changed files with 10 additions and 10 deletions

View File

@ -47,7 +47,7 @@ static BOOL rdp_recv_sync_pdu(rdpRdp* rdp, wStream* s, const char* what)
WINPR_UNUSED(rdp);
if (!Stream_CheckAndLogRequiredLengthEx(TAG, WLOG_WARN, s, 4, "%s(%s:%" PRIuz ") %s",
__FUNCTION__, __FILE__, __LINE__, what))
__FUNCTION__, __FILE__, (size_t)__LINE__, what))
return FALSE;
Stream_Read_UINT16(s, msgType);
if (msgType != SYNCMSGTYPE_SYNC)

View File

@ -464,7 +464,7 @@ static BOOL license_check_stream_capacity(wStream* s, size_t expect, const char*
WINPR_ASSERT(where);
if (!Stream_CheckAndLogRequiredCapacityEx(TAG, WLOG_WARN, s, expect, 1, "%s(%s:%" PRIuz ") %s",
__FUNCTION__, __FILE__, __LINE__, where))
__FUNCTION__, __FILE__, (size_t)__LINE__, where))
return FALSE;
return TRUE;

View File

@ -135,11 +135,11 @@ typedef struct
#define Stream_CheckAndLogRequiredLengthSrv(log, s, len) \
Stream_CheckAndLogRequiredLengthWLogEx(log, WLOG_WARN, s, len, \
proxy_client_rx " %s(%s:%" PRIuz ")", __FUNCTION__, \
__FILE__, __LINE__)
__FILE__, (size_t)__LINE__)
#define Stream_CheckAndLogRequiredLengthClient(log, s, len) \
Stream_CheckAndLogRequiredLengthWLogEx(log, WLOG_WARN, s, len, \
proxy_server_rx " %s(%s:%" PRIuz ")", __FUNCTION__, \
__FILE__, __LINE__)
__FILE__, (size_t)__LINE__)
#define Stream_CheckAndLogRequiredLengthRx(srv, log, s, len) \
Stream_CheckAndLogRequiredLengthRx_(srv, log, s, len, __FUNCTION__, __FILE__, __LINE__)
static BOOL Stream_CheckAndLogRequiredLengthRx_(BOOL srv, wLog* log, wStream* s, size_t len,

View File

@ -35,7 +35,7 @@
{ \
wLog* _log_cached_ptr = WLog_Get("com.freerdp.winpr.assert"); \
WLog_Print(_log_cached_ptr, WLOG_FATAL, "%s [%s:%s:%" PRIuz "]", #cond, __FILE__, \
__FUNCTION__, __LINE__); \
__FUNCTION__, (size_t)__LINE__); \
winpr_log_backtrace_ex(_log_cached_ptr, WLOG_FATAL, 20); \
abort(); \
} \

View File

@ -38,7 +38,7 @@
#define NTLM_CheckAndLogRequiredCapacity(tag, s, nmemb, what) \
Stream_CheckAndLogRequiredCapacityEx(tag, WLOG_WARN, s, nmemb, 1, "%s(%s:%" PRIuz ") " what, \
__FUNCTION__, __FILE__, __LINE__)
__FUNCTION__, __FILE__, (size_t)__LINE__)
static char NTLM_CLIENT_SIGN_MAGIC[] = "session key to client-to-server signing key magic constant";
static char NTLM_SERVER_SIGN_MAGIC[] = "session key to server-to-client signing key magic constant";
@ -111,7 +111,7 @@ BOOL ntlm_write_version_info(wStream* s, const NTLM_VERSION_INFO* versionInfo)
if (!Stream_CheckAndLogRequiredCapacityEx(
TAG, WLOG_WARN, s, 5ull + sizeof(versionInfo->Reserved), 1ull,
"%s(%s:%" PRIuz ") NTLM_VERSION_INFO", __FUNCTION__, __FILE__, __LINE__))
"%s(%s:%" PRIuz ") NTLM_VERSION_INFO", __FUNCTION__, __FILE__, (size_t)__LINE__))
return FALSE;
Stream_Write_UINT8(s, versionInfo->ProductMajorVersion); /* ProductMajorVersion (1 byte) */

View File

@ -37,7 +37,7 @@
#define NTLM_CheckAndLogRequiredCapacity(tag, s, nmemb, what) \
Stream_CheckAndLogRequiredCapacityEx(tag, WLOG_WARN, s, nmemb, 1, "%s(%s:%" PRIuz ") " what, \
__FUNCTION__, __FILE__, __LINE__)
__FUNCTION__, __FILE__, (size_t)__LINE__)
static const char NTLM_SIGNATURE[8] = { 'N', 'T', 'L', 'M', 'S', 'S', 'P', '\0' };
@ -437,7 +437,7 @@ static BOOL ntlm_write_negotiate_flags(wStream* s, UINT32 flags, const char* nam
if (!Stream_CheckAndLogRequiredCapacityEx(TAG, WLOG_WARN, s, 4ull, 1ull,
"%s(%s:%" PRIuz ") %s::NegotiateFlags", __FUNCTION__,
__FILE__, __LINE__, name))
__FILE__, (size_t)__LINE__, name))
return FALSE;
WLog_DBG(TAG, "Write flags %s", ntlm_negotiate_flags_string(buffer, ARRAYSIZE(buffer), flags));

View File

@ -35,7 +35,7 @@
if (!(cond)) \
{ \
WLog_FATAL(STREAM_TAG, "%s [%s:%s:%" PRIuz "]", #cond, __FILE__, __FUNCTION__, \
__LINE__); \
(size_t)__LINE__); \
winpr_log_backtrace(STREAM_TAG, WLOG_FATAL, 20); \
abort(); \
} \