Use %d instead of accidentally %i
authorAaron Marcher <me@drkhsh.at>
Fri, 18 May 2018 17:58:51 +0000 (19:58 +0200)
committerAaron Marcher <me@drkhsh.at>
Fri, 18 May 2018 17:58:51 +0000 (19:58 +0200)
components/battery.c
components/cpu.c

index c7c402a832b9ce4b219fbd89248ebcc8ece0ffa6..3965e8f8974d26ed9419594cf0add3b2254ea318 100644 (file)
@@ -16,7 +16,7 @@
 
                snprintf(path, sizeof(path), "%s%s%s", "/sys/class/power_supply/",
                         bat, "/capacity");
-               return (pscanf(path, "%i", &perc) == 1) ? bprintf("%d", perc) : NULL;
+               return (pscanf(path, "%d", &perc) == 1) ? bprintf("%d", perc) : NULL;
        }
 
        const char *
                if (!strcmp(state, "Discharging")) {
                        snprintf(path, sizeof(path), "%s%s%s", "/sys/class/power_supply/",
                                         bat, "/charge_now");
-                       if (pscanf(path, "%i", &charge_now) != 1) {
+                       if (pscanf(path, "%d", &charge_now) != 1) {
                                return NULL;
                        }
                        snprintf(path, sizeof(path), "%s%s%s", "/sys/class/power_supply/",
                                         bat, "/current_now");
-                       if (pscanf(path, "%i", &current_now) != 1) {
+                       if (pscanf(path, "%d", &current_now) != 1) {
                                return NULL;
                        }
 
index b9b3924859ec46c27e90657c72006fc2cd60144c..60a799111571a1f09905aca00a366cb77598afed 100644 (file)
@@ -12,7 +12,7 @@
                int freq;
 
                return (pscanf("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq",
-                              "%i", &freq) == 1) ?
+                              "%d", &freq) == 1) ?
                       bprintf("%d", (freq + 500) / 1000) : NULL;
        }