From: Oliver Kurth Date: Fri, 22 Nov 2019 22:52:35 +0000 (-0800) Subject: More LOG() calls changed to variadic form. X-Git-Tag: stable-11.1.0~136 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45af4c5b46992039cc6a2bd637815304b27317f3;p=thirdparty%2Fopen-vm-tools.git More LOG() calls changed to variadic form. --- diff --git a/open-vm-tools/services/plugins/dndcp/dndGuest/copyPasteRpcV4.cc b/open-vm-tools/services/plugins/dndcp/dndGuest/copyPasteRpcV4.cc index ccaabb9dd..1c4137757 100644 --- a/open-vm-tools/services/plugins/dndcp/dndGuest/copyPasteRpcV4.cc +++ b/open-vm-tools/services/plugins/dndcp/dndGuest/copyPasteRpcV4.cc @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2010-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2010-2019 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -27,9 +27,17 @@ extern "C" { #if defined VMX86_TOOLS #include "debug.h" - #define LOG(level, msg) (Debug msg) + +/* gcc needs special syntax to handle zero-length variadic arguments */ +#if defined(_MSC_VER) + #define LOG(level, fmt, ...) Debug(fmt, __VA_ARGS__) +#else + #define LOG(level, fmt, ...) Debug(fmt, ##__VA_ARGS__) +#endif + #else #define LOGLEVEL_MODULE dnd + #define LOGLEVEL_VARIADIC #include "loglevel_user.h" #endif @@ -263,20 +271,20 @@ CopyPasteRpcV4::HandleMsg(RpcParams *params, { ASSERT(params); - LOG(4, ("%s: Got %s[%d], sessionId %d, srcId %d, binary size %d.\n", - __FUNCTION__, DnDCPMsgV4_LookupCmd(params->cmd), params->cmd, - params->sessionId, params->addrId, binarySize)); + LOG(4, "%s: Got %s[%d], sessionId %d, srcId %d, binary size %d.\n", + __FUNCTION__, DnDCPMsgV4_LookupCmd(params->cmd), params->cmd, + params->sessionId, params->addrId, binarySize); switch (params->cmd) { case CP_CMD_RECV_CLIPBOARD: CPClipboard clip; if (!binary || binarySize == 0) { - LOG(0, ("%s: invalid clipboard data.\n", __FUNCTION__)); + LOG(0, "%s: invalid clipboard data.\n", __FUNCTION__); break; } CPClipboard_Init(&clip); if (!CPClipboard_Unserialize(&clip, (void *)binary, binarySize)) { - LOG(0, ("%s: CPClipboard_Unserialize failed.\n", __FUNCTION__)); + LOG(0, "%s: CPClipboard_Unserialize failed.\n", __FUNCTION__); break; } srcRecvClipChanged.emit(params->sessionId, @@ -301,11 +309,11 @@ CopyPasteRpcV4::HandleMsg(RpcParams *params, pingReplyChanged.emit(params->optional.version.capability); break; case DNDCP_CMP_REPLY: - LOG(0, ("%s: Got cmp reply command %d.\n", __FUNCTION__, params->cmd)); + LOG(0, "%s: Got cmp reply command %d.\n", __FUNCTION__, params->cmd); cmdReplyChanged.emit(params->cmd, params->status); break; default: - LOG(0, ("%s: Got unknown command %d.\n", __FUNCTION__, params->cmd)); + LOG(0, "%s: Got unknown command %d.\n", __FUNCTION__, params->cmd); break; } } diff --git a/open-vm-tools/services/plugins/dndcp/dndGuest/dndRpcV4.cc b/open-vm-tools/services/plugins/dndcp/dndGuest/dndRpcV4.cc index 822af80dd..7b371d573 100644 --- a/open-vm-tools/services/plugins/dndcp/dndGuest/dndRpcV4.cc +++ b/open-vm-tools/services/plugins/dndcp/dndGuest/dndRpcV4.cc @@ -27,9 +27,17 @@ extern "C" { #if defined VMX86_TOOLS #include "debug.h" - #define LOG(level, msg) (Debug msg) + +/* gcc needs special syntax to handle zero-length variadic arguments */ +#if defined(_MSC_VER) + #define LOG(level, fmt, ...) Debug(fmt, __VA_ARGS__) +#else + #define LOG(level, fmt, ...) Debug(fmt, ##__VA_ARGS__) +#endif + #else #define LOGLEVEL_MODULE dnd + #define LOGLEVEL_VARIADIC #include "loglevel_user.h" #endif @@ -647,20 +655,20 @@ DnDRpcV4::HandleMsg(RpcParams *params, { ASSERT(params); - LOG(4, ("%s: Got %s[%d], sessionId %d, srcId %d, binary size %d.\n", - __FUNCTION__, DnDCPMsgV4_LookupCmd(params->cmd), params->cmd, - params->sessionId, params->addrId, binarySize)); + LOG(4, "%s: Got %s[%d], sessionId %d, srcId %d, binary size %d.\n", + __FUNCTION__, DnDCPMsgV4_LookupCmd(params->cmd), params->cmd, + params->sessionId, params->addrId, binarySize); switch (params->cmd) { case DND_CMD_SRC_DRAG_BEGIN: CPClipboard clip; if (!binary || binarySize == 0) { - LOG(0, ("%s: invalid clipboard data.\n", __FUNCTION__)); + LOG(0, "%s: invalid clipboard data.\n", __FUNCTION__); break; } CPClipboard_Init(&clip); if (!CPClipboard_Unserialize(&clip, (void *)binary, binarySize)) { - LOG(0, ("%s: CPClipboard_Unserialize failed.\n", __FUNCTION__)); + LOG(0, "%s: CPClipboard_Unserialize failed.\n", __FUNCTION__); break; } srcDragBeginChanged.emit(params->sessionId, &clip); @@ -736,20 +744,19 @@ DnDRpcV4::HandleMsg(RpcParams *params, case DNDCP_CMD_TEST_BIG_BINARY: { if (binarySize != DND_CP_MSG_MAX_BINARY_SIZE_V4) { - LOG(0, ("%s: msg size is not right, should be %u.\n", - __FUNCTION__, DND_CP_MSG_MAX_BINARY_SIZE_V4)); + LOG(0, "%s: msg size is not right, should be %u.\n", + __FUNCTION__, DND_CP_MSG_MAX_BINARY_SIZE_V4); } uint32 *testBinary = (uint32 *)binary; for (uint32 i = 0; i < DND_CP_MSG_MAX_BINARY_SIZE_V4 / sizeof *testBinary; i++) { if (testBinary[i] != i) { - LOG(0, ("%s: msg wrong in position %u. Expect %u, but got %u.\n", - __FUNCTION__, i, i, testBinary[i])); + LOG(0, "%s: msg wrong in position %u. Expect %u, but got %u.\n", + __FUNCTION__, i, i, testBinary[i]); return; } } - LOG(4, ("%s: successfully got big binary, sending back.\n", - __FUNCTION__)); + LOG(4, "%s: successfully got big binary, sending back.\n", __FUNCTION__); RpcParams outParams; memset(&outParams, 0, sizeof outParams); outParams.addrId = params->addrId; @@ -759,11 +766,11 @@ DnDRpcV4::HandleMsg(RpcParams *params, break; } case DNDCP_CMP_REPLY: - LOG(0, ("%s: Got cmp reply command %d.\n", __FUNCTION__, params->cmd)); + LOG(0, "%s: Got cmp reply command %d.\n", __FUNCTION__, params->cmd); cmdReplyChanged.emit(params->cmd, params->status); break; default: - LOG(0, ("%s: Got unknown command %d.\n", __FUNCTION__, params->cmd)); + LOG(0, "%s: Got unknown command %d.\n", __FUNCTION__, params->cmd); break; } } diff --git a/open-vm-tools/services/plugins/dndcp/dndGuest/fileTransferRpcV4.cc b/open-vm-tools/services/plugins/dndcp/dndGuest/fileTransferRpcV4.cc index 1ed917799..6c2bca9eb 100644 --- a/open-vm-tools/services/plugins/dndcp/dndGuest/fileTransferRpcV4.cc +++ b/open-vm-tools/services/plugins/dndcp/dndGuest/fileTransferRpcV4.cc @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2010-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2010-2019 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -35,9 +35,17 @@ extern "C" { #if defined VMX86_TOOLS #include "debug.h" - #define LOG(level, msg) (Debug msg) + +/* gcc needs special syntax to handle zero-length variadic arguments */ +#if defined(_MSC_VER) + #define LOG(level, fmt, ...) Debug(fmt, __VA_ARGS__) +#else + #define LOG(level, fmt, ...) Debug(fmt, ##__VA_ARGS__) +#endif + #else #define LOGLEVEL_MODULE dnd + #define LOGLEVEL_VARIADIC #include "loglevel_user.h" #endif } @@ -168,9 +176,9 @@ FileTransferRpcV4::HandleMsg(RpcParams *params, { ASSERT(params); - LOG(4, ("%s: Got %s[%d], sessionId %d, srcId %d, binary size %d.\n", - __FUNCTION__, DnDCPMsgV4_LookupCmd(params->cmd), params->cmd, - params->sessionId, params->addrId, binarySize)); + LOG(4, "%s: Got %s[%d], sessionId %d, srcId %d, binary size %d.\n", + __FUNCTION__, DnDCPMsgV4_LookupCmd(params->cmd), params->cmd, + params->sessionId, params->addrId, binarySize); switch (params->cmd) { case FT_CMD_HGFS_REQUEST: @@ -182,7 +190,7 @@ FileTransferRpcV4::HandleMsg(RpcParams *params, case DNDCP_CMD_PING_REPLY: break; default: - LOG(0, ("%s: Got unknown command %d.\n", __FUNCTION__, params->cmd)); + LOG(0, "%s: Got unknown command %d.\n", __FUNCTION__, params->cmd); break; } }