diff --git a/src/fs.c b/src/fs.c index 15196980..81b97118 100644 --- a/src/fs.c +++ b/src/fs.c @@ -197,7 +197,7 @@ void get_fs_type(const char *path, char *result) void init_fs_bar(struct text_object *obj, const char *arg) { - arg = scan_bar(obj, arg, 255); + arg = scan_bar(obj, arg, 1); if (arg) { while (isspace(*arg)) { arg++; @@ -211,7 +211,7 @@ void init_fs_bar(struct text_object *obj, const char *arg) obj->data.opaque = prepare_fs_stat(arg); } -static uint8_t do_fs_barval(struct text_object *obj, int be_free_bar) +static double do_fs_barval(struct text_object *obj, int be_free_bar) { double val = 1.0; struct fs_stat *fs = obj->data.opaque; @@ -220,20 +220,20 @@ static uint8_t do_fs_barval(struct text_object *obj, int be_free_bar) return 0; if (fs->size) - val = (double)fs->avail / (double)fs->size; + val = (double)fs->avail / fs->size; if (!be_free_bar) val = 1.0 - val; - return round_to_int(val * 255.0); + return val; } -uint8_t fs_barval(struct text_object *obj) +double fs_barval(struct text_object *obj) { return do_fs_barval(obj, 0); } -uint8_t fs_free_barval(struct text_object *obj) +double fs_free_barval(struct text_object *obj) { return do_fs_barval(obj, 1); } diff --git a/src/fs.h b/src/fs.h index 9f67f969..81d6322b 100644 --- a/src/fs.h +++ b/src/fs.h @@ -19,8 +19,8 @@ struct fs_stat { struct text_object; void init_fs_bar(struct text_object *, const char *); -uint8_t fs_barval(struct text_object *); -uint8_t fs_free_barval(struct text_object *); +double fs_barval(struct text_object *); +double fs_free_barval(struct text_object *); void init_fs(struct text_object *, const char *); uint8_t fs_free_percentage(struct text_object *);