From 6b100b0cf47dda06d1dc1d38211d910488b5d803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Sun, 20 Dec 2020 16:58:17 +0100 Subject: [PATCH] Use upper case numeric literals See https://rules.sonarsource.com/c/RSPEC-818 --- AffinityPanel.c | 6 +++--- linux/LinuxProcessList.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/AffinityPanel.c b/AffinityPanel.c index 767e849a..314dcae3 100644 --- a/AffinityPanel.c +++ b/AffinityPanel.c @@ -281,7 +281,7 @@ static MaskItem* AffinityPanel_addObject(AffinityPanel* this, hwloc_obj_t obj, u indent_buf[0] = '\0'; if (depth > 0) { for (unsigned i = 1; i < depth; i++) { - xSnprintf(&indent_buf[off], left, "%s ", (indent & (1u << i)) ? CRT_treeStr[TREE_STR_VERT] : " "); + xSnprintf(&indent_buf[off], left, "%s ", (indent & (1U << i)) ? CRT_treeStr[TREE_STR_VERT] : " "); size_t len = strlen(&indent_buf[off]); off += len; left -= len; @@ -323,9 +323,9 @@ static MaskItem* AffinityPanel_addObject(AffinityPanel* this, hwloc_obj_t obj, u static MaskItem* AffinityPanel_buildTopology(AffinityPanel* this, hwloc_obj_t obj, unsigned indent, MaskItem* parent) { MaskItem* item = AffinityPanel_addObject(this, obj, indent, parent); if (obj->next_sibling) { - indent |= (1u << obj->depth); + indent |= (1U << obj->depth); } else { - indent &= ~(1u << obj->depth); + indent &= ~(1U << obj->depth); } for (unsigned i = 0; i < obj->arity; i++) { diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c index b58afa35..39215779 100644 --- a/linux/LinuxProcessList.c +++ b/linux/LinuxProcessList.c @@ -1371,8 +1371,8 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, openat_arg_ } /* period might be 0 after system sleep */ - float percent_cpu = (period < 1e-6) ? 0.0f : ((lp->utime + lp->stime - lasttimes) / period * 100.0); - proc->percent_cpu = CLAMP(percent_cpu, 0.0f, cpus * 100.0f); + float percent_cpu = (period < 1e-6) ? 0.0F : ((lp->utime + lp->stime - lasttimes) / period * 100.0); + proc->percent_cpu = CLAMP(percent_cpu, 0.0F, cpus * 100.0F); proc->percent_mem = proc->m_resident / (double)(pl->totalMem) * 100.0; if (!preExisting) {