From 8589bf2392ecb76012547cb288a561d759a41896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 23 Aug 2025 15:29:06 +0800 Subject: [PATCH] Chore: silence compiler warnings --- src/common/netif/netif_linux.c | 6 ++---- src/detection/gpu/gpu_windows.c | 2 +- src/detection/localip/localip_windows.c | 5 ++--- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/common/netif/netif_linux.c b/src/common/netif/netif_linux.c index bea80e77e..c54cc3242 100644 --- a/src/common/netif/netif_linux.c +++ b/src/common/netif/netif_linux.c @@ -130,8 +130,7 @@ bool ffNetifGetDefaultRouteImplV4(FFNetifDefaultRouteResult* result) } if (nlh->nlmsg_type == NLMSG_ERROR) { - struct nlmsgerr* err = (struct nlmsgerr*)NLMSG_DATA(nlh); - FF_DEBUG("Netlink reports error: %s", strerror(-err->error)); + FF_DEBUG("Netlink reports error: %s", strerror(-((struct nlmsgerr*)NLMSG_DATA(nlh))->error)); continue; } @@ -340,8 +339,7 @@ bool ffNetifGetDefaultRouteImplV6(FFNetifDefaultRouteResult* result) } if (nlh->nlmsg_type == NLMSG_ERROR) { - struct nlmsgerr* err = (struct nlmsgerr*)NLMSG_DATA(nlh); - FF_DEBUG("Netlink reports error: %s", strerror(-err->error)); + FF_DEBUG("Netlink reports error: %s", strerror(-((struct nlmsgerr*)NLMSG_DATA(nlh))->error)); continue; } diff --git a/src/detection/gpu/gpu_windows.c b/src/detection/gpu/gpu_windows.c index 66a3146ec..944e1030b 100644 --- a/src/detection/gpu/gpu_windows.c +++ b/src/detection/gpu/gpu_windows.c @@ -40,7 +40,7 @@ const char* ffDetectGPUImpl(FF_MAYBE_UNUSED const FFGPUOptions* options, FFlist* return "CM_Get_Device_ID_ListW failed"; } - int deviceCount = 0; + FF_MAYBE_UNUSED int deviceCount = 0; for (wchar_t* devId = devIdList; *devId; devId += wcslen(devId) + 1) { FF_DEBUG("Processing device ID: %ls", devId); diff --git a/src/detection/localip/localip_windows.c b/src/detection/localip/localip_windows.c index 0fe103853..2e12280c3 100644 --- a/src/detection/localip/localip_windows.c +++ b/src/detection/localip/localip_windows.c @@ -74,8 +74,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results) } } - int adapterCount = 0; - int processedCount = 0; + FF_MAYBE_UNUSED int adapterCount = 0, processedCount = 0; // Iterate through all of the adapters for (IP_ADAPTER_ADDRESSES* adapter = adapter_addresses; adapter; adapter = adapter->Next) @@ -137,7 +136,7 @@ const char* ffDetectLocalIps(const FFLocalIpOptions* options, FFlist* results) uint32_t typesToAdd = options->showType & (FF_LOCALIP_TYPE_IPV4_BIT | FF_LOCALIP_TYPE_IPV6_BIT | FF_LOCALIP_TYPE_ALL_IPS_BIT); FF_DEBUG("Types to add for adapter %u: 0x%X", (unsigned)adapter->IfIndex, typesToAdd); - int ipv4Count = 0, ipv6Count = 0; + FF_MAYBE_UNUSED int ipv4Count = 0, ipv6Count = 0; for (IP_ADAPTER_UNICAST_ADDRESS* ifa = adapter->FirstUnicastAddress; ifa; ifa = ifa->Next) {