From a091d209cf73d768b4b601dccbcd8699bdef331b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 31 Mar 2025 18:44:41 +0800 Subject: [PATCH] Swap: fix code smells --- src/detection/swap/swap_haiku.c | 6 ++---- src/detection/swap/swap_linux.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/detection/swap/swap_haiku.c b/src/detection/swap/swap_haiku.c index b61f213e7..a9502c915 100644 --- a/src/detection/swap/swap_haiku.c +++ b/src/detection/swap/swap_haiku.c @@ -2,16 +2,14 @@ #include -enum { FFMaxNSwap = 8 }; - const char* ffDetectSwap(FFSwapResult* swap) { system_info info; if (get_system_info(&info) != B_OK) return "Error getting system info"; - swap->bytesTotal = B_PAGE_SIZE * info.max_swap_pages; - swap->bytesUsed = B_PAGE_SIZE * (info.max_swap_pages - info.free_swap_pages); + swap->bytesTotal = B_PAGE_SIZE * (uint64_t) info.max_swap_pages; + swap->bytesUsed = B_PAGE_SIZE * (uint64_t) (info.max_swap_pages - info.free_swap_pages); return NULL; } diff --git a/src/detection/swap/swap_linux.c b/src/detection/swap/swap_linux.c index 15f8fd24d..d86bad19b 100644 --- a/src/detection/swap/swap_linux.c +++ b/src/detection/swap/swap_linux.c @@ -7,7 +7,7 @@ const char* ffDetectSwap(FFSwapResult* swap) { - // #620 + // Ref: #620 char buf[PROC_FILE_BUFFSIZ]; ssize_t nRead = ffReadFileData("/proc/meminfo", ARRAY_SIZE(buf) - 1, buf); if(nRead < 0)