Use %d instead of accidentally %i
This commit is contained in:
parent
f170028527
commit
f317819984
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
snprintf(path, sizeof(path), "%s%s%s", "/sys/class/power_supply/",
|
snprintf(path, sizeof(path), "%s%s%s", "/sys/class/power_supply/",
|
||||||
bat, "/capacity");
|
bat, "/capacity");
|
||||||
return (pscanf(path, "%i", &perc) == 1) ? bprintf("%d", perc) : NULL;
|
return (pscanf(path, "%d", &perc) == 1) ? bprintf("%d", perc) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
@ -62,12 +62,12 @@
|
|||||||
if (!strcmp(state, "Discharging")) {
|
if (!strcmp(state, "Discharging")) {
|
||||||
snprintf(path, sizeof(path), "%s%s%s", "/sys/class/power_supply/",
|
snprintf(path, sizeof(path), "%s%s%s", "/sys/class/power_supply/",
|
||||||
bat, "/charge_now");
|
bat, "/charge_now");
|
||||||
if (pscanf(path, "%i", &charge_now) != 1) {
|
if (pscanf(path, "%d", &charge_now) != 1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
snprintf(path, sizeof(path), "%s%s%s", "/sys/class/power_supply/",
|
snprintf(path, sizeof(path), "%s%s%s", "/sys/class/power_supply/",
|
||||||
bat, "/current_now");
|
bat, "/current_now");
|
||||||
if (pscanf(path, "%i", ¤t_now) != 1) {
|
if (pscanf(path, "%d", ¤t_now) != 1) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
int freq;
|
int freq;
|
||||||
|
|
||||||
return (pscanf("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq",
|
return (pscanf("/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq",
|
||||||
"%i", &freq) == 1) ?
|
"%d", &freq) == 1) ?
|
||||||
bprintf("%d", (freq + 500) / 1000) : NULL;
|
bprintf("%d", (freq + 500) / 1000) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user