From 34848ef0b19bb3d04c51211c0686b3b441709498 Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Wed, 8 Aug 2018 15:33:13 +0200 Subject: [PATCH] Complete 'Use unsigned int for p_max_size in obj_cb.print' --- src/audacious.cc | 4 ++-- src/journal.cc | 4 ++-- src/linux.cc | 2 +- src/specials.cc | 2 +- src/specials.h | 4 ++-- src/top.cc | 12 ++++++------ 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/audacious.cc b/src/audacious.cc index f434dd48..0e92215e 100644 --- a/src/audacious.cc +++ b/src/audacious.cc @@ -198,12 +198,12 @@ void print_audacious_status(struct text_object *, char *p, unsigned int p_max_si } void print_audacious_title(struct text_object *obj, char *p, unsigned int p_max_size) { - snprintf(p, std::min(obj->data.i, p_max_size), "%s", get_res().title.c_str()); + snprintf(p, std::min((unsigned int) obj->data.i, p_max_size), "%s", get_res().title.c_str()); } void print_audacious_filename(struct text_object *obj, char *p, unsigned int p_max_size) { - snprintf(p, std::min(obj->data.i, p_max_size), "%s", + snprintf(p, std::min((unsigned int) obj->data.i, p_max_size), "%s", get_res().filename.c_str()); } diff --git a/src/journal.cc b/src/journal.cc index 2fb0be14..20be87e8 100644 --- a/src/journal.cc +++ b/src/journal.cc @@ -127,7 +127,7 @@ out: } bool read_log(size_t *read, size_t *length, time_t *time, uint64_t *timestamp, - sd_journal *jh, char *p, int p_max_size) { + sd_journal *jh, char *p, unsigned int p_max_size) { struct tm tm; if (sd_journal_get_realtime_usec(jh, timestamp) < 0) return false; *time = *timestamp / 1000000; @@ -167,7 +167,7 @@ bool read_log(size_t *read, size_t *length, time_t *time, uint64_t *timestamp, return true; } -void print_journal(struct text_object *obj, char *p, int p_max_size) { +void print_journal(struct text_object *obj, char *p, unsigned int p_max_size) { struct journal *j = (struct journal *)obj->data.opaque; sd_journal *jh = nullptr; size_t read = 0; diff --git a/src/linux.cc b/src/linux.cc index 24853398..ce6bd456 100644 --- a/src/linux.cc +++ b/src/linux.cc @@ -2253,7 +2253,7 @@ static char pb_battery_info[3][32]; static double pb_battery_info_update; #define PMU_PATH "/proc/pmu" -void get_powerbook_batt_info(struct text_object *obj, char *buffer, int n) { +void get_powerbook_batt_info(struct text_object *obj, char *buffer, unsigned int n) { static int rep = 0; const char *batt_path = PMU_PATH "/battery_0"; const char *info_path = PMU_PATH "/info"; diff --git a/src/specials.cc b/src/specials.cc index 1118e079..f2ea093f 100644 --- a/src/specials.cc +++ b/src/specials.cc @@ -677,7 +677,7 @@ void new_bg(struct text_object *obj, char *p, unsigned int p_max_size) { #endif /* BUILD_X11 */ static void new_bar_in_shell(struct text_object *obj, char *buffer, - int buf_max_size, double usage) { + unsigned int buf_max_size, double usage) { auto *b = static_cast(obj->special_data); int width, i, scaledusage; diff --git a/src/specials.h b/src/specials.h index ee4cca3e..d396d4f2 100644 --- a/src/specials.h +++ b/src/specials.h @@ -97,8 +97,8 @@ void new_graph(struct text_object *, char *, int, double); void new_hr(struct text_object *, char *, unsigned int); void new_stippled_hr(struct text_object *, char *, unsigned int); #endif /* BUILD_X11 */ -void new_gauge(struct text_object *, char *, int, double); -void new_bar(struct text_object *, char *, int, double); +void new_gauge(struct text_object *, char *, unsigned int, double); +void new_bar(struct text_object *, char *, unsigned int, double); void new_fg(struct text_object *, char *, unsigned int); void new_bg(struct text_object *, char *, unsigned int); void new_outline(struct text_object *, char *, unsigned int); diff --git a/src/top.cc b/src/top.cc index a67e169b..0c01346f 100644 --- a/src/top.cc +++ b/src/top.cc @@ -484,7 +484,7 @@ static conky::range_config_setting top_name_width( static conky::simple_config_setting top_name_verbose("top_name_verbose", false, true); -static void print_top_name(struct text_object *obj, char *p, int p_max_size) { +static void print_top_name(struct text_object *obj, char *p, unsigned int p_max_size) { auto *td = static_cast(obj->data.opaque); int width; @@ -503,7 +503,7 @@ static void print_top_name(struct text_object *obj, char *p, int p_max_size) { } } -static void print_top_mem(struct text_object *obj, char *p, int p_max_size) { +static void print_top_mem(struct text_object *obj, char *p, unsigned int p_max_size) { auto *td = static_cast(obj->data.opaque); int width; @@ -517,7 +517,7 @@ static void print_top_mem(struct text_object *obj, char *p, int p_max_size) { (static_cast(td->list[td->num]->rss) / info.memmax) / 10); } -static void print_top_time(struct text_object *obj, char *p, int p_max_size) { +static void print_top_time(struct text_object *obj, char *p, unsigned int p_max_size) { auto *td = static_cast(obj->data.opaque); int width; char *timeval; @@ -533,7 +533,7 @@ static void print_top_time(struct text_object *obj, char *p, int p_max_size) { free(timeval); } -static void print_top_user(struct text_object *obj, char *p, int p_max_size) { +static void print_top_user(struct text_object *obj, char *p, unsigned int p_max_size) { auto *td = static_cast(obj->data.opaque); struct passwd *pw; @@ -552,7 +552,7 @@ static void print_top_user(struct text_object *obj, char *p, int p_max_size) { #define PRINT_TOP_GENERATOR(name, width, fmt, field) \ static void print_top_##name(struct text_object *obj, char *p, \ - int p_max_size) { \ + unsigned int p_max_size) { \ struct top_data *td = (struct top_data *)obj->data.opaque; \ if (!td || !td->list || !td->list[td->num]) return; \ snprintf(p, MIN(p_max_size, width), fmt, td->list[td->num]->field); \ @@ -560,7 +560,7 @@ static void print_top_user(struct text_object *obj, char *p, int p_max_size) { #define PRINT_TOP_HR_GENERATOR(name, field, denom) \ static void print_top_##name(struct text_object *obj, char *p, \ - int p_max_size) { \ + unsigned int p_max_size) { \ struct top_data *td = (struct top_data *)obj->data.opaque; \ if (!td || !td->list || !td->list[td->num]) return; \ human_readable(td->list[td->num]->field / (denom), p, p_max_size); \