From 829cc3f238fe2a2a7b97c489d40087e465e355d7 Mon Sep 17 00:00:00 2001 From: Markus Volk Date: Tue, 4 Aug 2020 07:29:26 +0200 Subject: [PATCH] helpers.cpp: fix narrowing conversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit switch expression is 'int', but f_type gets stored as 'long unsigned int' on 32-bit machines since it may not fit otherwise. Recent compilers diagnose this and bail out with: ../../../git/src/system/helpers.cpp:330:9: error: narrowing conversion of '2240043254' from 'long unsigned int' to 'int' [-Wnarrowing] casting the switch expression to long unsigned int seems to be the solution. in short: this fixes the build for 32-bit machines with gcc ≥ 10.x Signed-off-by: Markus Volk Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/1d73d07f2264b47b26cbd1781d579c084d32e1ad Author: Markus Volk Date: 2020-08-04 (Tue, 04 Aug 2020) --- src/system/helpers.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 03e35b0d7..74fd4b465 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -456,7 +456,7 @@ int check_dir(const char * dir, bool allow_tmp) int ret = -1; struct statfs s; if (::statfs(dir, &s) == 0) { - switch (s.f_type) { + switch ((long unsigned int)s.f_type) { case 0x858458f6L: // ramfs case 0x1021994L: // tmpfs if(allow_tmp)