mirror of
https://github.com/transmission/transmission
synced 2025-01-30 19:03:04 +00:00
Make use of TR_UNUSED macro where cast-to-void was used before
This commit is contained in:
parent
ff8d0dbf3b
commit
75458d6be3
10 changed files with 62 additions and 52 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <libtransmission/transmission.h>
|
||||
#include <libtransmission/error.h>
|
||||
#include <libtransmission/log.h>
|
||||
#include <libtransmission/tr-macros.h>
|
||||
#include <libtransmission/utils.h>
|
||||
|
||||
#include "daemon.h"
|
||||
|
@ -74,7 +75,7 @@ static void do_log_system_error(char const* file, int line, tr_log_level level,
|
|||
|
||||
static BOOL WINAPI handle_console_ctrl(DWORD control_type)
|
||||
{
|
||||
(void)control_type;
|
||||
TR_UNUSED(control_type);
|
||||
|
||||
callbacks->on_stop(callback_arg);
|
||||
return TRUE;
|
||||
|
@ -141,9 +142,9 @@ static void stop_service(void)
|
|||
|
||||
static DWORD WINAPI handle_service_ctrl(DWORD control_code, DWORD event_type, LPVOID event_data, LPVOID context)
|
||||
{
|
||||
(void)event_type;
|
||||
(void)event_data;
|
||||
(void)context;
|
||||
TR_UNUSED(event_type);
|
||||
TR_UNUSED(event_data);
|
||||
TR_UNUSED(context);
|
||||
|
||||
switch (control_code)
|
||||
{
|
||||
|
@ -167,15 +168,15 @@ static DWORD WINAPI handle_service_ctrl(DWORD control_code, DWORD event_type, LP
|
|||
|
||||
static unsigned int __stdcall service_thread_main(void* context)
|
||||
{
|
||||
(void)context;
|
||||
TR_UNUSED(context);
|
||||
|
||||
return callbacks->on_start(callback_arg, false);
|
||||
}
|
||||
|
||||
static VOID WINAPI service_main(DWORD argc, LPWSTR* argv)
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
TR_UNUSED(argc);
|
||||
TR_UNUSED(argv);
|
||||
|
||||
status_handle = RegisterServiceCtrlHandlerExW(service_name, &handle_service_ctrl, NULL);
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <libtransmission/error.h>
|
||||
#include <libtransmission/file.h>
|
||||
#include <libtransmission/tr-getopt.h>
|
||||
#include <libtransmission/tr-macros.h>
|
||||
#include <libtransmission/log.h>
|
||||
#include <libtransmission/utils.h>
|
||||
#include <libtransmission/variant.h>
|
||||
|
@ -311,7 +312,7 @@ static void printMessage(tr_sys_file_t logfile, int level, char const* name, cha
|
|||
|
||||
#else
|
||||
|
||||
(void)level;
|
||||
TR_UNUSED(level);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -622,6 +623,10 @@ static void daemon_stop(void* arg)
|
|||
|
||||
static int daemon_start(void* raw_arg, bool foreground)
|
||||
{
|
||||
#ifndef HAVE_SYSLOG
|
||||
TR_UNUSED(foreground);
|
||||
#endif
|
||||
|
||||
bool boolVal;
|
||||
char const* pid_filename;
|
||||
bool pidfile_created = false;
|
||||
|
@ -633,10 +638,6 @@ static int daemon_start(void* raw_arg, bool foreground)
|
|||
tr_variant* const settings = &arg->settings;
|
||||
char const* const configDir = arg->configDir;
|
||||
|
||||
#ifndef HAVE_SYSLOG
|
||||
(void)foreground;
|
||||
#endif
|
||||
|
||||
sd_notifyf(0, "MAINPID=%d\n", (int)getpid());
|
||||
|
||||
/* should go before libevent calls */
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "transmission.h"
|
||||
#include "crypto-utils.h"
|
||||
#include "tr-assert.h"
|
||||
#include "tr-macros.h"
|
||||
#include "utils.h"
|
||||
|
||||
/***
|
||||
|
@ -65,30 +66,30 @@ void tr_dh_secret_free(tr_dh_secret_t handle)
|
|||
|
||||
tr_x509_store_t tr_ssl_get_x509_store(tr_ssl_ctx_t handle)
|
||||
{
|
||||
(void)handle;
|
||||
TR_UNUSED(handle);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool tr_x509_store_add(tr_x509_store_t handle, tr_x509_cert_t cert)
|
||||
{
|
||||
(void)handle;
|
||||
(void)cert;
|
||||
TR_UNUSED(handle);
|
||||
TR_UNUSED(cert);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
tr_x509_cert_t tr_x509_cert_new(void const* der, size_t der_length)
|
||||
{
|
||||
(void)der;
|
||||
(void)der_length;
|
||||
TR_UNUSED(der);
|
||||
TR_UNUSED(der_length);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void tr_x509_cert_free(tr_x509_cert_t handle)
|
||||
{
|
||||
(void)handle;
|
||||
TR_UNUSED(handle);
|
||||
}
|
||||
|
||||
#endif /* TR_CRYPTO_X509_FALLBACK */
|
||||
|
|
|
@ -831,11 +831,11 @@ skip_darwin_fcntl:
|
|||
|
||||
#else
|
||||
|
||||
(void)handle;
|
||||
(void)offset;
|
||||
(void)size;
|
||||
(void)advice;
|
||||
(void)error;
|
||||
TR_UNUSED(handle);
|
||||
TR_UNUSED(offset);
|
||||
TR_UNUSED(size);
|
||||
TR_UNUSED(advice);
|
||||
TR_UNUSED(error);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -844,7 +844,7 @@ skip_darwin_fcntl:
|
|||
|
||||
bool tr_sys_file_preallocate(tr_sys_file_t handle, uint64_t size, int flags, tr_error** error)
|
||||
{
|
||||
(void)size;
|
||||
TR_UNUSED(size);
|
||||
|
||||
TR_ASSERT(handle != TR_BAD_SYS_FILE);
|
||||
|
||||
|
@ -1052,8 +1052,8 @@ bool tr_sys_file_lock(tr_sys_file_t handle, int operation, tr_error** error)
|
|||
|
||||
#else
|
||||
|
||||
(void)handle;
|
||||
(void)operation;
|
||||
TR_UNUSED(handle);
|
||||
TR_UNUSED(operation);
|
||||
|
||||
errno = ENOSYS;
|
||||
ret = false;
|
||||
|
|
|
@ -251,9 +251,9 @@ static tr_sys_file_t open_file(char const* path, DWORD access, DWORD disposition
|
|||
|
||||
static bool create_dir(char const* path, int flags, int permissions, bool okay_if_exists, tr_error** error)
|
||||
{
|
||||
TR_ASSERT(path != NULL);
|
||||
TR_UNUSED(permissions);
|
||||
|
||||
(void)permissions;
|
||||
TR_ASSERT(path != NULL);
|
||||
|
||||
bool ret;
|
||||
DWORD error_code = ERROR_SUCCESS;
|
||||
|
@ -820,11 +820,11 @@ tr_sys_file_t tr_sys_file_get_std(tr_std_sys_file_t std_file, tr_error** error)
|
|||
|
||||
tr_sys_file_t tr_sys_file_open(char const* path, int flags, int permissions, tr_error** error)
|
||||
{
|
||||
TR_UNUSED(permissions);
|
||||
|
||||
TR_ASSERT(path != NULL);
|
||||
TR_ASSERT((flags & (TR_SYS_FILE_READ | TR_SYS_FILE_WRITE)) != 0);
|
||||
|
||||
(void)permissions;
|
||||
|
||||
tr_sys_file_t ret;
|
||||
DWORD native_access = 0;
|
||||
DWORD native_disposition = OPEN_EXISTING;
|
||||
|
@ -1140,16 +1140,16 @@ bool tr_sys_file_truncate(tr_sys_file_t handle, uint64_t size, tr_error** error)
|
|||
|
||||
bool tr_sys_file_advise(tr_sys_file_t handle, uint64_t offset, uint64_t size, tr_sys_file_advice_t advice, tr_error** error)
|
||||
{
|
||||
TR_UNUSED(handle);
|
||||
TR_UNUSED(offset);
|
||||
TR_UNUSED(size);
|
||||
TR_UNUSED(advice);
|
||||
TR_UNUSED(error);
|
||||
|
||||
TR_ASSERT(handle != TR_BAD_SYS_FILE);
|
||||
TR_ASSERT(size > 0);
|
||||
TR_ASSERT(advice == TR_SYS_FILE_ADVICE_WILL_NEED || advice == TR_SYS_FILE_ADVICE_DONT_NEED);
|
||||
|
||||
(void)handle;
|
||||
(void)offset;
|
||||
(void)size;
|
||||
(void)advice;
|
||||
(void)error;
|
||||
|
||||
bool ret = true;
|
||||
|
||||
/* ??? */
|
||||
|
@ -1210,11 +1210,11 @@ void* tr_sys_file_map_for_reading(tr_sys_file_t handle, uint64_t offset, uint64_
|
|||
|
||||
bool tr_sys_file_unmap(void const* address, uint64_t size, tr_error** error)
|
||||
{
|
||||
TR_UNUSED(size);
|
||||
|
||||
TR_ASSERT(address != NULL);
|
||||
TR_ASSERT(size > 0);
|
||||
|
||||
(void)size;
|
||||
|
||||
bool ret = UnmapViewOfFile(address);
|
||||
|
||||
if (!ret)
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "peer-io.h" /* tr_peerIoAddrStr() FIXME this should be moved to net.h */
|
||||
#include "session.h" /* tr_sessionGetPublicAddress() */
|
||||
#include "tr-assert.h"
|
||||
#include "tr-macros.h"
|
||||
#include "tr-utp.h" /* tr_utpSendTo() */
|
||||
#include "utils.h" /* tr_time(), tr_logAddDebug() */
|
||||
|
||||
|
@ -170,8 +171,8 @@ void tr_netSetTOS(tr_socket_t s, int tos, tr_address_type type)
|
|||
|
||||
#else
|
||||
|
||||
(void)s;
|
||||
(void)tos;
|
||||
TR_UNUSED(s);
|
||||
TR_UNUSED(tos);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -187,8 +188,8 @@ void tr_netSetTOS(tr_socket_t s, int tos, tr_address_type type)
|
|||
|
||||
#else
|
||||
|
||||
(void)s;
|
||||
(void)tos;
|
||||
TR_UNUSED(s);
|
||||
TR_UNUSED(tos);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -212,8 +213,8 @@ void tr_netSetCongestionControl(tr_socket_t s, char const* algorithm)
|
|||
|
||||
#else
|
||||
|
||||
(void)s;
|
||||
(void)algorithm;
|
||||
TR_UNUSED(s);
|
||||
TR_UNUSED(algorithm);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
#endif
|
||||
|
||||
#include "transmission.h"
|
||||
#include "tr-macros.h"
|
||||
#include "utils.h"
|
||||
#include "platform-quota.h"
|
||||
|
||||
|
@ -449,7 +450,7 @@ static int64_t tr_getQuotaFreeSpace(struct tr_device_info const* info)
|
|||
|
||||
#else /* _WIN32 */
|
||||
|
||||
(void)info;
|
||||
TR_UNUSED(info);
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "ptrarray.h"
|
||||
#include "tr-assert.h"
|
||||
#include "tr-macros.h"
|
||||
#include "utils.h"
|
||||
|
||||
#define FLOOR 32
|
||||
|
@ -238,7 +239,7 @@ void tr_ptrArrayRemoveSortedPointer(tr_ptrArray* t, void const* ptr, tr_voidptr_
|
|||
|
||||
#ifndef TR_ENABLE_ASSERTS
|
||||
|
||||
(void)removed;
|
||||
TR_UNUSED(removed);
|
||||
|
||||
#else
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "platform.h" /* mutex */
|
||||
#include "session.h"
|
||||
#include "tr-assert.h"
|
||||
#include "tr-macros.h"
|
||||
#include "trevent.h" /* tr_runInEventThread() */
|
||||
#include "utils.h"
|
||||
#include "version.h" /* User-Agent */
|
||||
|
@ -153,9 +154,6 @@ static int sockoptfunction(void* vtask, curl_socket_t fd, curlsocktype purpose)
|
|||
|
||||
static CURLcode ssl_context_func(CURL* curl, void* ssl_ctx, void* user_data)
|
||||
{
|
||||
(void)curl;
|
||||
(void)user_data;
|
||||
|
||||
tr_x509_store_t const cert_store = tr_ssl_get_x509_store(ssl_ctx);
|
||||
if (cert_store == NULL)
|
||||
{
|
||||
|
@ -207,6 +205,11 @@ static CURLcode ssl_context_func(CURL* curl, void* ssl_ctx, void* user_data)
|
|||
CertCloseStore(sys_cert_store, 0);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
TR_UNUSED(curl);
|
||||
TR_UNUSED(user_data);
|
||||
|
||||
#endif
|
||||
|
||||
return CURLE_OK;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "transmission.h"
|
||||
#include "error.h"
|
||||
#include "file.h"
|
||||
#include "tr-macros.h"
|
||||
|
||||
#include "test-fixtures.h"
|
||||
|
||||
|
@ -54,7 +55,7 @@ protected:
|
|||
{
|
||||
#ifndef _WIN32
|
||||
|
||||
(void)dst_is_dir;
|
||||
TR_UNUSED(dst_is_dir);
|
||||
|
||||
return symlink(src_path, dst_path) != -1;
|
||||
|
||||
|
@ -146,8 +147,8 @@ protected:
|
|||
|
||||
#else
|
||||
|
||||
(void)path;
|
||||
(void)permissions;
|
||||
TR_UNUSED(path);
|
||||
TR_UNUSED(permissions);
|
||||
|
||||
/* No UNIX permissions on Windows */
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue