[va_list] initialize with ={0};

This commit is contained in:
akallabeth 2024-09-17 16:56:03 +02:00
parent fcdbc05979
commit 26003e59cc
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
31 changed files with 55 additions and 55 deletions

View File

@ -343,7 +343,7 @@ static UINT location_send(LocationClientContext* context, LOCATION_PDUTYPE type,
WINPR_ASSERT(callback);
UINT32 res = ERROR_INTERNAL_ERROR;
va_list ap;
va_list ap = { 0 };
va_start(ap, count);
switch (type)
{

View File

@ -1646,7 +1646,7 @@ static const char* state_str(size_t count, va_list ap, char* buffer, size_t size
static BOOL rdpdr_state_check(rdpdrPlugin* rdpdr, UINT16 packetid, enum RDPDR_CHANNEL_STATE next,
size_t count, ...)
{
va_list ap;
va_list ap = { 0 };
WINPR_ASSERT(rdpdr);
va_start(ap, count);

View File

@ -139,7 +139,7 @@ static BOOL log_libusb_result_(wLog* log, DWORD lvl, WINPR_FORMAT_ARG const char
if (error < 0)
{
char buffer[8192] = { 0 };
va_list ap;
va_list ap = { 0 };
va_start(ap, error);
(void)vsnprintf(buffer, sizeof(buffer), fmt, ap);
va_end(ap);

View File

@ -58,7 +58,7 @@ bool SDLConnectionDialog::visible() const
bool SDLConnectionDialog::setTitle(const char* fmt, ...)
{
std::lock_guard lock(_mux);
va_list ap;
va_list ap = {};
va_start(ap, fmt);
_title = print(fmt, ap);
va_end(ap);
@ -68,7 +68,7 @@ bool SDLConnectionDialog::setTitle(const char* fmt, ...)
bool SDLConnectionDialog::showInfo(const char* fmt, ...)
{
va_list ap;
va_list ap = {};
va_start(ap, fmt);
auto rc = show(MSG_INFO, fmt, ap);
va_end(ap);
@ -77,7 +77,7 @@ bool SDLConnectionDialog::showInfo(const char* fmt, ...)
bool SDLConnectionDialog::showWarn(const char* fmt, ...)
{
va_list ap;
va_list ap = {};
va_start(ap, fmt);
auto rc = show(MSG_WARN, fmt, ap);
va_end(ap);
@ -86,7 +86,7 @@ bool SDLConnectionDialog::showWarn(const char* fmt, ...)
bool SDLConnectionDialog::showError(const char* fmt, ...)
{
va_list ap;
va_list ap = {};
va_start(ap, fmt);
auto rc = show(MSG_ERROR, fmt, ap);
va_end(ap);

View File

@ -53,7 +53,7 @@ static const char* type_str_for_flags(UINT32 flags)
static BOOL sdl_wait_for_result(rdpContext* context, Uint32 type, SDL_Event* result)
{
const SDL_Event empty = { 0 };
const SDL_Event empty = {};
WINPR_ASSERT(context);
WINPR_ASSERT(result);
@ -72,7 +72,7 @@ static BOOL sdl_wait_for_result(rdpContext* context, Uint32 type, SDL_Event* res
static int sdl_show_dialog(rdpContext* context, const char* title, const char* message,
Sint32 flags)
{
SDL_Event event = { 0 };
SDL_Event event = {};
if (!sdl_push_user_event(SDL_USEREVENT_SHOW_DIALOG, title, message, flags))
return 0;
@ -86,7 +86,7 @@ static int sdl_show_dialog(rdpContext* context, const char* title, const char* m
BOOL sdl_authenticate_ex(freerdp* instance, char** username, char** password, char** domain,
rdp_auth_reason reason)
{
SDL_Event event = { 0 };
SDL_Event event = {};
BOOL res = FALSE;
SDLConnectionDialogHider hider(instance);
@ -185,7 +185,7 @@ BOOL sdl_choose_smartcard(freerdp* instance, SmartcardCertInfo** cert_list, DWOR
list.push_back(m.c_str());
}
SDL_Event event = { 0 };
SDL_Event event = {};
const char* title = "Select a logon smartcard certificate";
if (gateway)
title = "Select a gateway logon smartcard certificate";
@ -317,7 +317,7 @@ static DWORD sdl_show_ceritifcate_dialog(rdpContext* context, const char* title,
if (!sdl_push_user_event(SDL_USEREVENT_CERT_DIALOG, title, message))
return 0;
SDL_Event event = { 0 };
SDL_Event event = {};
if (!sdl_wait_for_result(context, SDL_USEREVENT_CERT_RESULT, &event))
return 0;
return static_cast<DWORD>(event.user.code);

View File

@ -63,7 +63,7 @@ int SdlSelectList::run()
if (!_buttons.update(_renderer))
throw;
SDL_Event event = { 0 };
SDL_Event event = {};
SDL_WaitEvent(&event);
switch (event.type)
{

View File

@ -665,7 +665,7 @@ static const char* sdl_window_get_title(rdpSettings* settings)
addPort = (port != 3389);
char buffer[MAX_PATH + 64] = { 0 };
char buffer[MAX_PATH + 64] = {};
if (!addPort)
(void)sprintf_s(buffer, sizeof(buffer), "%s %s", prefix, name);
@ -837,7 +837,7 @@ static int sdl_run(SdlContext* sdl)
while (!shall_abort(sdl))
{
SDL_Event windowEvent = { 0 };
SDL_Event windowEvent = {};
while (!shall_abort(sdl) && SDL_WaitEventTimeout(nullptr, 1000))
{
/* Only poll standard SDL events and SDL_USEREVENTS meant to create dialogs.
@ -1413,7 +1413,7 @@ static DWORD WINAPI sdl_client_thread_proc(SdlContext* sdl)
static BOOL sdl_client_global_init()
{
#if defined(_WIN32)
WSADATA wsaData = { 0 };
WSADATA wsaData = {};
const DWORD wVersionRequested = MAKEWORD(1, 1);
const int rc = WSAStartup(wVersionRequested, &wsaData);
if (rc != 0)

View File

@ -152,7 +152,7 @@ BOOL sdl_push_user_event(Uint32 type, ...)
SDL_Event ev = {};
SDL_UserEvent* event = &ev.user;
va_list ap;
va_list ap = {};
va_start(ap, type);
event->type = type;
switch (type)
@ -285,7 +285,7 @@ HANDLE WinPREvent::handle() const
bool sdl_push_quit()
{
SDL_Event ev = { 0 };
SDL_Event ev = {};
ev.type = SDL_QUIT;
SDL_PushEvent(&ev);
return true;

View File

@ -58,7 +58,7 @@ bool SDLConnectionDialog::visible() const
bool SDLConnectionDialog::setTitle(const char* fmt, ...)
{
std::lock_guard lock(_mux);
va_list ap;
va_list ap = {};
va_start(ap, fmt);
_title = print(fmt, ap);
va_end(ap);
@ -68,7 +68,7 @@ bool SDLConnectionDialog::setTitle(const char* fmt, ...)
bool SDLConnectionDialog::showInfo(const char* fmt, ...)
{
va_list ap;
va_list ap = {};
va_start(ap, fmt);
auto rc = show(MSG_INFO, fmt, ap);
va_end(ap);
@ -77,7 +77,7 @@ bool SDLConnectionDialog::showInfo(const char* fmt, ...)
bool SDLConnectionDialog::showWarn(const char* fmt, ...)
{
va_list ap;
va_list ap = {};
va_start(ap, fmt);
auto rc = show(MSG_WARN, fmt, ap);
va_end(ap);
@ -86,7 +86,7 @@ bool SDLConnectionDialog::showWarn(const char* fmt, ...)
bool SDLConnectionDialog::showError(const char* fmt, ...)
{
va_list ap;
va_list ap = {};
va_start(ap, fmt);
auto rc = show(MSG_ERROR, fmt, ap);
va_end(ap);

View File

@ -53,7 +53,7 @@ static const char* type_str_for_flags(UINT32 flags)
static BOOL sdl_wait_for_result(rdpContext* context, Uint32 type, SDL_Event* result)
{
const SDL_Event empty = { 0 };
const SDL_Event empty = {};
WINPR_ASSERT(context);
WINPR_ASSERT(result);
@ -72,7 +72,7 @@ static BOOL sdl_wait_for_result(rdpContext* context, Uint32 type, SDL_Event* res
static int sdl_show_dialog(rdpContext* context, const char* title, const char* message,
Sint32 flags)
{
SDL_Event event = { 0 };
SDL_Event event = {};
if (!sdl_push_user_event(SDL_EVENT_USER_SHOW_DIALOG, title, message, flags))
return 0;
@ -86,7 +86,7 @@ static int sdl_show_dialog(rdpContext* context, const char* title, const char* m
BOOL sdl_authenticate_ex(freerdp* instance, char** username, char** password, char** domain,
rdp_auth_reason reason)
{
SDL_Event event = { 0 };
SDL_Event event = {};
BOOL res = FALSE;
SDLConnectionDialogHider hider(instance);
@ -185,7 +185,7 @@ BOOL sdl_choose_smartcard(freerdp* instance, SmartcardCertInfo** cert_list, DWOR
list.push_back(m.c_str());
}
SDL_Event event = { 0 };
SDL_Event event = {};
const char* title = "Select a logon smartcard certificate";
if (gateway)
title = "Select a gateway logon smartcard certificate";
@ -315,7 +315,7 @@ static DWORD sdl_show_ceritifcate_dialog(rdpContext* context, const char* title,
if (!sdl_push_user_event(SDL_EVENT_USER_CERT_DIALOG, title, message))
return 0;
SDL_Event event = { 0 };
SDL_Event event = {};
if (!sdl_wait_for_result(context, SDL_EVENT_USER_CERT_RESULT, &event))
return 0;
return static_cast<DWORD>(event.user.code);

View File

@ -62,7 +62,7 @@ int SdlSelectList::run()
if (!_buttons.update(_renderer))
throw;
SDL_Event event = { 0 };
SDL_Event event = {};
SDL_WaitEvent(&event);
switch (event.type)
{

View File

@ -663,7 +663,7 @@ static const char* sdl_window_get_title(rdpSettings* settings)
addPort = (port != 3389);
char buffer[MAX_PATH + 64] = { 0 };
char buffer[MAX_PATH + 64] = {};
if (!addPort)
sprintf_s(buffer, sizeof(buffer), "%s %s", prefix, name);
@ -828,7 +828,7 @@ static int sdl_run(SdlContext* sdl)
while (!shall_abort(sdl))
{
SDL_Event windowEvent = { 0 };
SDL_Event windowEvent = {};
while (!shall_abort(sdl) && SDL_WaitEventTimeout(nullptr, 1000))
{
/* Only poll standard SDL events and SDL_EVENT_USERS meant to create dialogs.
@ -1397,7 +1397,7 @@ static DWORD WINAPI sdl_client_thread_proc(SdlContext* sdl)
static BOOL sdl_client_global_init()
{
#if defined(_WIN32)
WSADATA wsaData = { 0 };
WSADATA wsaData = {};
const DWORD wVersionRequested = MAKEWORD(1, 1);
const int rc = WSAStartup(wVersionRequested, &wsaData);
if (rc != 0)

View File

@ -198,7 +198,7 @@ BOOL sdl_push_user_event(Uint32 type, ...)
SDL_Event ev = {};
SDL_UserEvent* event = &ev.user;
va_list ap;
va_list ap = {};
va_start(ap, type);
event->type = type;
switch (type)
@ -331,7 +331,7 @@ HANDLE WinPREvent::handle() const
bool sdl_push_quit()
{
SDL_Event ev = { 0 };
SDL_Event ev = {};
ev.type = SDL_EVENT_QUIT;
SDL_PushEvent(&ev);
return true;

View File

@ -107,7 +107,7 @@ BOOL sdl_webview_get_access_token(freerdp* instance, AccessTokenType tokenType,
"ACCESS_TOKEN_TYPE_AAD expected 2 additional arguments, but got %" PRIuz
", ignoring",
count);
va_list ap;
va_list ap = {};
va_start(ap, count);
const char* scope = va_arg(ap, const char*);
const char* req_cnf = va_arg(ap, const char*);

View File

@ -34,7 +34,7 @@ static const DWORD log_level = WLOG_TRACE;
static void write_log(wLog* log, DWORD level, const char* fname, const char* fkt, size_t line, ...)
{
va_list ap;
va_list ap = { 0 };
va_start(ap, line);
WLog_PrintMessageVA(log, WLOG_MESSAGE_TEXT, level, line, fname, fkt, ap);
va_end(ap);

View File

@ -1127,7 +1127,7 @@ BOOL client_cli_get_access_token(freerdp* instance, AccessTokenType tokenType, c
"ACCESS_TOKEN_TYPE_AAD expected 2 additional arguments, but got %" PRIuz
", ignoring",
count);
va_list ap;
va_list ap = { 0 };
va_start(ap, count);
const char* scope = va_arg(ap, const char*);
const char* req_cnf = va_arg(ap, const char*);

View File

@ -625,7 +625,7 @@ static void writelog(wLog* log, DWORD level, const char* fname, const char* fkt,
if (!WLog_IsLevelActive(log, level))
return;
va_list ap;
va_list ap = { 0 };
va_start(ap, line);
WLog_PrintMessageVA(log, WLOG_MESSAGE_TEXT, level, line, fname, fkt, ap);
va_end(ap);

View File

@ -1425,7 +1425,7 @@ WINPR_ATTR_FORMAT_ARG(3, 4)
static SSIZE_T freerdp_client_write_setting_to_buffer(char** buffer, size_t* bufferSize,
WINPR_FORMAT_ARG const char* fmt, ...)
{
va_list ap;
va_list ap = { 0 };
SSIZE_T len = 0;
char* buf = NULL;
size_t bufSize = 0;

View File

@ -239,7 +239,7 @@ static char* append(const char* fmt, ...)
{
int rc = 0;
char* dst = NULL;
va_list ap;
va_list ap = { 0 };
va_start(ap, fmt);
rc = vsnprintf(NULL, 0, fmt, ap);

View File

@ -32,7 +32,7 @@ static void write_log(unsigned log_level, const char* fmt, ...)
{
char buffer[1024] = { 0 };
va_list ap;
va_list ap = { 0 };
va_start(ap, fmt);
vsnprintf(buffer, sizeof(buffer), fmt, ap);
va_end(ap);

View File

@ -57,7 +57,7 @@ static BOOL generate_pop_key(rdpAad* aad);
WINPR_ATTR_FORMAT_ARG(2, 3)
static SSIZE_T stream_sprintf(wStream* s, WINPR_FORMAT_ARG const char* fmt, ...)
{
va_list ap;
va_list ap = { 0 };
va_start(ap, fmt);
const int rc = vsnprintf(NULL, 0, fmt, ap);
va_end(ap);

View File

@ -1302,7 +1302,7 @@ void clearChannelError(rdpContext* context)
WINPR_ATTR_FORMAT_ARG(3, 4)
void setChannelError(rdpContext* context, UINT errorNum, WINPR_FORMAT_ARG const char* format, ...)
{
va_list ap;
va_list ap = { 0 };
va_start(ap, format);
WINPR_ASSERT(context);

View File

@ -345,7 +345,7 @@ BOOL http_context_set_pragma(HttpContext* context, WINPR_FORMAT_ARG const char*
free(context->Pragma);
context->Pragma = NULL;
va_list ap;
va_list ap = { 0 };
va_start(ap, Pragma);
return list_append(context, Pragma, ap);
}
@ -356,7 +356,7 @@ BOOL http_context_append_pragma(HttpContext* context, const char* Pragma, ...)
if (!context || !Pragma)
return FALSE;
va_list ap;
va_list ap = { 0 };
va_start(ap, Pragma);
return list_append(context, Pragma, ap);
}
@ -551,7 +551,7 @@ WINPR_ATTR_FORMAT_ARG(2, 3)
static BOOL http_encode_print(wStream* s, WINPR_FORMAT_ARG const char* fmt, ...)
{
char* str = NULL;
va_list ap;
va_list ap = { 0 };
int length = 0;
int used = 0;

View File

@ -762,7 +762,7 @@ WINPR_ATTR_FORMAT_ARG(3, 4)
static BOOL tsg_print(char** buffer, size_t* len, WINPR_FORMAT_ARG const char* fmt, ...)
{
int rc = 0;
va_list ap;
va_list ap = { 0 };
if (!buffer || !len || !fmt)
return FALSE;
va_start(ap, fmt);

View File

@ -186,7 +186,7 @@ static int testAbort(int port)
static char* concatenate(size_t count, ...)
{
char* rc = NULL;
va_list ap;
va_list ap = { 0 };
va_start(ap, count);
rc = _strdup(va_arg(ap, char*));
for (size_t x = 1; x < count; x++)

View File

@ -78,7 +78,7 @@ static void log_print(wLog* log, DWORD level, const char* file, const char* fkt,
if (!WLog_IsLevelActive(log, level))
return;
va_list ap;
va_list ap = { 0 };
va_start(ap, line);
WLog_PrintMessageVA(log, WLOG_MESSAGE_TEXT, level, line, file, fkt, ap);
va_end(ap);

View File

@ -134,7 +134,7 @@ void CommLog_Print(DWORD level, ...)
if (!CommInitialized())
return;
va_list ap;
va_list ap = { 0 };
va_start(ap, level);
WLog_PrintVA(sLog, level, ap);
va_end(ap);

View File

@ -177,7 +177,7 @@ BOOL winpr_str_append(const char* what, char* buffer, size_t size, const char* s
WINPR_ATTR_FORMAT_ARG(3, 4)
int winpr_asprintf(char** s, size_t* slen, WINPR_FORMAT_ARG const char* templ, ...)
{
va_list ap;
va_list ap = { 0 };
va_start(ap, templ);
int rc = winpr_vasprintf(s, slen, templ, ap);
@ -188,7 +188,7 @@ int winpr_asprintf(char** s, size_t* slen, WINPR_FORMAT_ARG const char* templ, .
WINPR_ATTR_FORMAT_ARG(3, 0)
int winpr_vasprintf(char** s, size_t* slen, WINPR_FORMAT_ARG const char* templ, va_list oap)
{
va_list ap;
va_list ap = { 0 };
*s = NULL;
*slen = 0;

View File

@ -595,7 +595,7 @@ static void log_print(wLog* log, DWORD level, const char* file, const char* fkt,
if (!WLog_IsLevelActive(log, level))
return;
va_list ap;
va_list ap = { 0 };
va_start(ap, line);
WLog_PrintMessageVA(log, WLOG_MESSAGE_TEXT, level, line, file, fkt, ap);
va_end(ap);

View File

@ -529,7 +529,7 @@ wObject* ArrayList_Object(wArrayList* arrayList)
BOOL ArrayList_ForEach(wArrayList* arrayList, ArrayList_ForEachFkt fkt, ...)
{
BOOL rc = 0;
va_list ap;
va_list ap = { 0 };
va_start(ap, fkt);
rc = ArrayList_ForEachAP(arrayList, fkt, ap);
va_end(ap);

View File

@ -121,7 +121,7 @@ int PubSub_Subscribe(wPubSub* pubSub, const char* EventName, ...)
int status = -1;
WINPR_ASSERT(pubSub);
va_list ap;
va_list ap = { 0 };
va_start(ap, EventName);
pEventHandler EventHandler = va_arg(ap, pEventHandler);
@ -154,7 +154,7 @@ int PubSub_Unsubscribe(wPubSub* pubSub, const char* EventName, ...)
WINPR_ASSERT(pubSub);
WINPR_ASSERT(EventName);
va_list ap;
va_list ap = { 0 };
va_start(ap, EventName);
pEventHandler EventHandler = va_arg(ap, pEventHandler);