From bfd7eabc0f752945c2c1f3fb958ea7808eba65e8 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Fri, 4 Dec 2009 01:17:47 +0100 Subject: [PATCH] convert get_battery_perct_bar to double --- src/common.h | 2 +- src/core.c | 2 +- src/freebsd.c | 4 ++-- src/linux.c | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common.h b/src/common.h index 072ecc47..13bcbe48 100644 --- a/src/common.h +++ b/src/common.h @@ -60,7 +60,7 @@ void get_acpi_ac_adapter(char *, size_t); void get_acpi_fan(char *, size_t); void get_battery_stuff(char *buf, unsigned int n, const char *bat, int item); int get_battery_perct(const char *bat); -uint8_t get_battery_perct_bar(struct text_object *); +double get_battery_perct_bar(struct text_object *); void get_battery_short_status(char *buf, unsigned int n, const char *bat); void scan_loadavg_arg(struct text_object *, const char *); diff --git a/src/core.c b/src/core.c index 0d8415a1..150f20e8 100644 --- a/src/core.c +++ b/src/core.c @@ -297,7 +297,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long END OBJ(battery_bar, 0) char bat[64]; if (arg) { - arg = scan_bar(obj, arg, 255); + arg = scan_bar(obj, arg, 100); sscanf(arg, "%63s", bat); } else { strcpy(bat, "BAT0"); diff --git a/src/freebsd.c b/src/freebsd.c index a976f68a..3adf6304 100644 --- a/src/freebsd.c +++ b/src/freebsd.c @@ -471,10 +471,10 @@ int get_battery_perct(const char *bat) return batperct > 100 ? 100 : batperct; } -uint8_t get_battery_perct_bar(struct text_object *obj) +double get_battery_perct_bar(struct text_object *obj) { int batperct = get_battery_perct(obj->data.s); - return round_to_int((double)batperct * 2.55); + return batperct; } int open_acpi_temperature(const char *name) diff --git a/src/linux.c b/src/linux.c index a9e0f815..64415313 100644 --- a/src/linux.c +++ b/src/linux.c @@ -2055,13 +2055,13 @@ int get_battery_perct(const char *bat) return last_battery_perct[idx]; } -uint8_t get_battery_perct_bar(struct text_object *obj) +double get_battery_perct_bar(struct text_object *obj) { int idx; get_battery_perct(obj->data.s); idx = get_battery_idx(obj->data.s); - return round_to_int((double)last_battery_perct[idx] * 2.55); + return last_battery_perct[idx]; } /* On Apple powerbook and ibook: