diff --git a/src/apcupsd.cc b/src/apcupsd.cc index 83065465..5e4deed6 100644 --- a/src/apcupsd.cc +++ b/src/apcupsd.cc @@ -266,7 +266,7 @@ double apcupsd_loadbarval(struct text_object *obj) { #define APCUPSD_PRINT_GENERATOR(name, idx) \ void print_apcupsd_##name(struct text_object *obj, char *p, \ - int p_max_size) { \ + unsigned int p_max_size) { \ (void)obj; \ snprintf(p, p_max_size, "%s", apcupsd.items[APCUPSD_##idx]); \ } diff --git a/src/apcupsd.h b/src/apcupsd.h index 2c4cf835..2e175818 100644 --- a/src/apcupsd.h +++ b/src/apcupsd.h @@ -31,16 +31,16 @@ int update_apcupsd(void); double apcupsd_loadbarval(struct text_object *); -void print_apcupsd_name(struct text_object *, char *, int); -void print_apcupsd_model(struct text_object *, char *, int); -void print_apcupsd_upsmode(struct text_object *, char *, int); -void print_apcupsd_cable(struct text_object *, char *, int); -void print_apcupsd_status(struct text_object *, char *, int); -void print_apcupsd_linev(struct text_object *, char *, int); -void print_apcupsd_load(struct text_object *, char *, int); -void print_apcupsd_charge(struct text_object *, char *, int); -void print_apcupsd_timeleft(struct text_object *, char *, int); -void print_apcupsd_temp(struct text_object *, char *, int); -void print_apcupsd_lastxfer(struct text_object *, char *, int); +void print_apcupsd_name(struct text_object *, char *, unsigned int); +void print_apcupsd_model(struct text_object *, char *, unsigned int); +void print_apcupsd_upsmode(struct text_object *, char *, unsigned int); +void print_apcupsd_cable(struct text_object *, char *, unsigned int); +void print_apcupsd_status(struct text_object *, char *, unsigned int); +void print_apcupsd_linev(struct text_object *, char *, unsigned int); +void print_apcupsd_load(struct text_object *, char *, unsigned int); +void print_apcupsd_charge(struct text_object *, char *, unsigned int); +void print_apcupsd_timeleft(struct text_object *, char *, unsigned int); +void print_apcupsd_temp(struct text_object *, char *, unsigned int); +void print_apcupsd_lastxfer(struct text_object *, char *, unsigned int); #endif /*APCUPSD_H_*/ diff --git a/src/audacious.cc b/src/audacious.cc index 1920c8dc..f434dd48 100644 --- a/src/audacious.cc +++ b/src/audacious.cc @@ -192,17 +192,17 @@ aud_result get_res() { } } // namespace -void print_audacious_status(struct text_object *, char *p, int p_max_size) { +void print_audacious_status(struct text_object *, char *p, unsigned int p_max_size) { const aud_result &res = get_res(); snprintf(p, p_max_size, "%s", as_message[res.status]); } -void print_audacious_title(struct text_object *obj, char *p, int p_max_size) { +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()); } void print_audacious_filename(struct text_object *obj, char *p, - int p_max_size) { + unsigned int p_max_size) { snprintf(p, std::min(obj->data.i, p_max_size), "%s", get_res().filename.c_str()); } @@ -213,14 +213,15 @@ double audacious_barval(struct text_object *) { } #define AUDACIOUS_TIME_GENERATOR(name) \ - void print_audacious_##name(struct text_object *, char *p, int p_max_size) { \ + void print_audacious_##name(struct text_object *, char *p, \ + unsigned int p_max_size) { \ const aud_result &res = get_res(); \ int sec = res.name / 1000; \ snprintf(p, p_max_size, "%d:%.2d", sec / 60, sec % 60); \ } \ \ void print_audacious_##name##_seconds(struct text_object *, char *p, \ - int p_max_size) { \ + unsigned int p_max_size) { \ snprintf(p, p_max_size, "%d", get_res().name); \ } @@ -228,7 +229,8 @@ AUDACIOUS_TIME_GENERATOR(length) AUDACIOUS_TIME_GENERATOR(position) #define AUDACIOUS_INT_GENERATOR(name, offset) \ - void print_audacious_##name(struct text_object *, char *p, int p_max_size) { \ + void print_audacious_##name(struct text_object *, char *p, \ + unsigned int p_max_size) { \ snprintf(p, p_max_size, "%d", get_res().name + offset); \ } diff --git a/src/audacious.h b/src/audacious.h index e8e70412..1bc40e40 100644 --- a/src/audacious.h +++ b/src/audacious.h @@ -24,19 +24,19 @@ #ifndef AUDACIOUS_H #define AUDACIOUS_H -void print_audacious_status(struct text_object *, char *, int); -void print_audacious_title(struct text_object *, char *, int); -void print_audacious_length(struct text_object *, char *, int); -void print_audacious_length_seconds(struct text_object *, char *, int); -void print_audacious_position(struct text_object *, char *, int); -void print_audacious_position_seconds(struct text_object *, char *, int); -void print_audacious_bitrate(struct text_object *, char *, int); -void print_audacious_frequency(struct text_object *, char *, int); -void print_audacious_channels(struct text_object *, char *, int); -void print_audacious_filename(struct text_object *, char *, int); -void print_audacious_playlist_length(struct text_object *, char *, int); -void print_audacious_playlist_position(struct text_object *, char *, int); -void print_audacious_main_volume(struct text_object *, char *, int); +void print_audacious_status(struct text_object *, char *, unsigned int); +void print_audacious_title(struct text_object *, char *, unsigned int); +void print_audacious_length(struct text_object *, char *, unsigned int); +void print_audacious_length_seconds(struct text_object *, char *, unsigned int); +void print_audacious_position(struct text_object *, char *, unsigned int); +void print_audacious_position_seconds(struct text_object *, char *, unsigned int); +void print_audacious_bitrate(struct text_object *, char *, unsigned int); +void print_audacious_frequency(struct text_object *, char *, unsigned int); +void print_audacious_channels(struct text_object *, char *, unsigned int); +void print_audacious_filename(struct text_object *, char *, unsigned int); +void print_audacious_playlist_length(struct text_object *, char *, unsigned int); +void print_audacious_playlist_position(struct text_object *, char *, unsigned int); +void print_audacious_main_volume(struct text_object *, char *, unsigned int); double audacious_barval(struct text_object *); #endif /* AUDACIOUS_H */ diff --git a/src/ccurl_thread.cc b/src/ccurl_thread.cc index 4dd1f078..04ba6766 100644 --- a/src/ccurl_thread.cc +++ b/src/ccurl_thread.cc @@ -198,7 +198,7 @@ void curl_parse_arg(struct text_object *obj, const char *arg) { obj->data.opaque = cd; } -void curl_print(struct text_object *obj, char *p, int p_max_size) { +void curl_print(struct text_object *obj, char *p, unsigned int p_max_size) { struct curl_data *cd = (struct curl_data *)obj->data.opaque; if (!cd || !cd->uri) { diff --git a/src/ccurl_thread.h b/src/ccurl_thread.h index 4131b15c..03ae15f6 100644 --- a/src/ccurl_thread.h +++ b/src/ccurl_thread.h @@ -84,7 +84,7 @@ void ccurl_process_info(char *p, int p_max_size, const std::string &uri, int interval); void curl_parse_arg(struct text_object *, const char *); -void curl_print(struct text_object *, char *, int); +void curl_print(struct text_object *, char *, unsigned int); void curl_obj_free(struct text_object *); /* $curl exports end */ diff --git a/src/cmus.cc b/src/cmus.cc index 4b6bb849..7b4daedf 100644 --- a/src/cmus.cc +++ b/src/cmus.cc @@ -137,7 +137,8 @@ void cmus_cb::work() { } // namespace #define CMUS_PRINT_GENERATOR(type, alt) \ - void print_cmus_##type(struct text_object *obj, char *p, int p_max_size) { \ + void print_cmus_##type(struct text_object *obj, char *p, \ + unsigned int p_max_size) { \ (void)obj; \ uint32_t period = std::max( \ lround(music_player_interval.get(*state) / active_update_interval()), \ @@ -178,7 +179,7 @@ double cmus_progress(struct text_object *obj) { return (double)cmus.progress; } -void print_cmus_totaltime(struct text_object *obj, char *p, int p_max_size) { +void print_cmus_totaltime(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; uint32_t period = std::max( lround(music_player_interval.get(*state) / active_update_interval()), 1l); @@ -187,7 +188,7 @@ void print_cmus_totaltime(struct text_object *obj, char *p, int p_max_size) { format_seconds_short(p, p_max_size, atol(cmus.totaltime.c_str())); } -void print_cmus_timeleft(struct text_object *obj, char *p, int p_max_size) { +void print_cmus_timeleft(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; uint32_t period = std::max( lround(music_player_interval.get(*state) / active_update_interval()), 1l); @@ -197,7 +198,7 @@ void print_cmus_timeleft(struct text_object *obj, char *p, int p_max_size) { format_seconds_short(p, p_max_size, (long)cmus.timeleft); } -void print_cmus_curtime(struct text_object *obj, char *p, int p_max_size) { +void print_cmus_curtime(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; uint32_t period = std::max( lround(music_player_interval.get(*state) / active_update_interval()), 1l); diff --git a/src/cmus.h b/src/cmus.h index 5dfa0470..0c8db416 100644 --- a/src/cmus.h +++ b/src/cmus.h @@ -23,21 +23,21 @@ #ifndef CMUS_H_ #define CMUS_H_ -void print_cmus_state(struct text_object *, char *, int); -void print_cmus_file(struct text_object *, char *, int); -void print_cmus_title(struct text_object *, char *, int); -void print_cmus_artist(struct text_object *, char *, int); -void print_cmus_album(struct text_object *, char *, int); -void print_cmus_totaltime(struct text_object *, char *, int); -void print_cmus_timeleft(struct text_object *, char *, int); -void print_cmus_curtime(struct text_object *, char *, int); -void print_cmus_random(struct text_object *, char *, int); -void print_cmus_repeat(struct text_object *, char *, int); -void print_cmus_aaa(struct text_object *, char *, int); -void print_cmus_track(struct text_object *, char *, int); -void print_cmus_genre(struct text_object *, char *, int); -void print_cmus_date(struct text_object *, char *, int); -void print_cmus_bar(struct text_object *, char *, int); +void print_cmus_state(struct text_object *, char *, unsigned int); +void print_cmus_file(struct text_object *, char *, unsigned int); +void print_cmus_title(struct text_object *, char *, unsigned int); +void print_cmus_artist(struct text_object *, char *, unsigned int); +void print_cmus_album(struct text_object *, char *, unsigned int); +void print_cmus_totaltime(struct text_object *, char *, unsigned int); +void print_cmus_timeleft(struct text_object *, char *, unsigned int); +void print_cmus_curtime(struct text_object *, char *, unsigned int); +void print_cmus_random(struct text_object *, char *, unsigned int); +void print_cmus_repeat(struct text_object *, char *, unsigned int); +void print_cmus_aaa(struct text_object *, char *, unsigned int); +void print_cmus_track(struct text_object *, char *, unsigned int); +void print_cmus_genre(struct text_object *, char *, unsigned int); +void print_cmus_date(struct text_object *, char *, unsigned int); +void print_cmus_bar(struct text_object *, char *, unsigned int); double cmus_progress(struct text_object *obj); uint8_t cmus_percent(struct text_object *obj); diff --git a/src/combine.cc b/src/combine.cc index 1491b670..2d6ba125 100644 --- a/src/combine.cc +++ b/src/combine.cc @@ -95,7 +95,7 @@ void parse_combine_arg(struct text_object *obj, const char *arg) { } } -void print_combine(struct text_object *obj, char *p, int p_max_size) { +void print_combine(struct text_object *obj, char *p, unsigned int p_max_size) { auto *cd = static_cast(obj->data.opaque); std::vector> buf; buf.resize(2); diff --git a/src/combine.h b/src/combine.h index 146ec236..29e18ad1 100644 --- a/src/combine.h +++ b/src/combine.h @@ -30,7 +30,7 @@ #define _COMBINE_H void parse_combine_arg(struct text_object *, const char *); -void print_combine(struct text_object *, char *, int); +void print_combine(struct text_object *, char *, unsigned int); void free_combine(struct text_object *); #endif /* _COMBINE_H */ diff --git a/src/common.cc b/src/common.cc index b52ab5ce..e1bec484 100644 --- a/src/common.cc +++ b/src/common.cc @@ -332,7 +332,7 @@ void scan_loadavg_arg(struct text_object *obj, const char *arg) { obj->data.i--; } -void print_loadavg(struct text_object *obj, char *p, int p_max_size) { +void print_loadavg(struct text_object *obj, char *p, unsigned int p_max_size) { float *v = info.loadavg; if (obj->data.i < 0) { @@ -351,7 +351,7 @@ void scan_no_update(struct text_object *obj, const char *arg) { void free_no_update(struct text_object *obj) { free(obj->data.s); } -void print_no_update(struct text_object *obj, char *p, int p_max_size) { +void print_no_update(struct text_object *obj, char *p, unsigned int p_max_size) { snprintf(p, p_max_size, "%s", obj->data.s); } @@ -389,8 +389,10 @@ double cpu_barval(struct text_object *obj) { } #define PRINT_HR_GENERATOR(name) \ - void print_##name(struct text_object *obj, char *p, int p_max_size) { \ - human_readable(apply_base_multiplier(obj->data.s, info.name), p, p_max_size); \ + void print_##name(struct text_object *obj, char *p, \ + unsigned int p_max_size) { \ + human_readable(apply_base_multiplier(obj->data.s, info.name), p, \ + p_max_size); \ } PRINT_HR_GENERATOR(mem) @@ -437,22 +439,22 @@ double swap_barval(struct text_object *obj) { : 0; } -void print_kernel(struct text_object *obj, char *p, int p_max_size) { +void print_kernel(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%s", info.uname_s.release); } -void print_machine(struct text_object *obj, char *p, int p_max_size) { +void print_machine(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%s", info.uname_s.machine); } -void print_nodename(struct text_object *obj, char *p, int p_max_size) { +void print_nodename(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%s", info.uname_s.nodename); } -void print_nodename_short(struct text_object *obj, char *p, int p_max_size) { +void print_nodename_short(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%s", info.uname_s.nodename); for (int i = 0; p[i] != 0; i++) { @@ -463,57 +465,57 @@ void print_nodename_short(struct text_object *obj, char *p, int p_max_size) { } } -void print_sysname(struct text_object *obj, char *p, int p_max_size) { +void print_sysname(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%s", info.uname_s.sysname); } #if defined(__DragonFly__) -void print_version(struct text_object *obj, char *p, int p_max_size) { +void print_version(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%s", info.uname_v); } #endif -void print_uptime(struct text_object *obj, char *p, int p_max_size) { +void print_uptime(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; format_seconds(p, p_max_size, static_cast(info.uptime)); } -void print_uptime_short(struct text_object *obj, char *p, int p_max_size) { +void print_uptime_short(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; format_seconds_short(p, p_max_size, static_cast(info.uptime)); } -void print_processes(struct text_object *obj, char *p, int p_max_size) { +void print_processes(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; spaced_print(p, p_max_size, "%hu", 4, info.procs); } -void print_running_processes(struct text_object *obj, char *p, int p_max_size) { +void print_running_processes(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; spaced_print(p, p_max_size, "%hu", 4, info.run_procs); } -void print_running_threads(struct text_object *obj, char *p, int p_max_size) { +void print_running_threads(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; spaced_print(p, p_max_size, "%hu", 4, info.run_threads); } -void print_threads(struct text_object *obj, char *p, int p_max_size) { +void print_threads(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; spaced_print(p, p_max_size, "%hu", 4, info.threads); } -void print_buffers(struct text_object *obj, char *p, int p_max_size) { +void print_buffers(struct text_object *obj, char *p, unsigned int p_max_size) { human_readable(apply_base_multiplier(obj->data.s, info.buffers), p, p_max_size); } -void print_cached(struct text_object *obj, char *p, int p_max_size) { +void print_cached(struct text_object *obj, char *p, unsigned int p_max_size) { human_readable(apply_base_multiplier(obj->data.s, info.cached), p, p_max_size); } -void print_evaluate(struct text_object *obj, char *p, int p_max_size) { +void print_evaluate(struct text_object *obj, char *p, unsigned int p_max_size) { std::vector buf(text_buffer_size.get(*state)); evaluate(obj->data.s, &buf[0], buf.size()); evaluate(&buf[0], p, p_max_size); @@ -582,21 +584,21 @@ int if_running_iftest(struct text_object *obj) { } #ifndef __OpenBSD__ -void print_acpitemp(struct text_object *obj, char *p, int p_max_size) { +void print_acpitemp(struct text_object *obj, char *p, unsigned int p_max_size) { temp_print(p, p_max_size, get_acpi_temperature(obj->data.i), TEMP_CELSIUS, 1); } void free_acpitemp(struct text_object *obj) { close(obj->data.i); } #endif /* !__OpenBSD__ */ -void print_freq(struct text_object *obj, char *p, int p_max_size) { +void print_freq(struct text_object *obj, char *p, unsigned int p_max_size) { static int ok = 1; if (ok != 0) { ok = get_freq(p, p_max_size, "%.0f", 1, obj->data.i); } } -void print_freq_g(struct text_object *obj, char *p, int p_max_size) { +void print_freq_g(struct text_object *obj, char *p, unsigned int p_max_size) { static int ok = 1; if (ok != 0) { #ifndef __OpenBSD__ @@ -609,21 +611,21 @@ void print_freq_g(struct text_object *obj, char *p, int p_max_size) { } #ifndef __OpenBSD__ -void print_acpifan(struct text_object *obj, char *p, int p_max_size) { +void print_acpifan(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; get_acpi_fan(p, p_max_size); } -void print_acpiacadapter(struct text_object *obj, char *p, int p_max_size) { +void print_acpiacadapter(struct text_object *obj, char *p, unsigned int p_max_size) { get_acpi_ac_adapter(p, p_max_size, static_cast(obj->data.opaque)); } -void print_battery(struct text_object *obj, char *p, int p_max_size) { +void print_battery(struct text_object *obj, char *p, unsigned int p_max_size) { get_battery_stuff(p, p_max_size, obj->data.s, BATTERY_STATUS); } -void print_battery_time(struct text_object *obj, char *p, int p_max_size) { +void print_battery_time(struct text_object *obj, char *p, unsigned int p_max_size) { get_battery_stuff(p, p_max_size, obj->data.s, BATTERY_TIME); } @@ -631,12 +633,12 @@ uint8_t battery_percentage(struct text_object *obj) { return get_battery_perct(obj->data.s); } -void print_battery_short(struct text_object *obj, char *p, int p_max_size) { +void print_battery_short(struct text_object *obj, char *p, unsigned int p_max_size) { get_battery_short_status(p, p_max_size, obj->data.s); } #endif /* !__OpenBSD__ */ -void print_blink(struct text_object *obj, char *p, int p_max_size) { +void print_blink(struct text_object *obj, char *p, unsigned int p_max_size) { // blinking like this can look a bit ugly if the chars in the font don't have // the same width std::vector buf(max_user_text.get(*state)); @@ -657,7 +659,7 @@ void print_blink(struct text_object *obj, char *p, int p_max_size) { visible = static_cast(static_cast(visible) == 0); } -void print_include(struct text_object *obj, char *p, int p_max_size) { +void print_include(struct text_object *obj, char *p, unsigned int p_max_size) { std::vector buf(max_user_text.get(*state)); if (obj->sub == nullptr) { @@ -669,7 +671,7 @@ void print_include(struct text_object *obj, char *p, int p_max_size) { } #ifdef BUILD_CURL -void print_stock(struct text_object *obj, char *p, int p_max_size) { +void print_stock(struct text_object *obj, char *p, unsigned int p_max_size) { if (!obj->data.s) { p[0] = 0; return; @@ -680,7 +682,7 @@ void print_stock(struct text_object *obj, char *p, int p_max_size) { void free_stock(struct text_object *obj) { free(obj->data.s); } #endif /* BUILD_CURL */ -void print_to_bytes(struct text_object *obj, char *p, int p_max_size) { +void print_to_bytes(struct text_object *obj, char *p, unsigned int p_max_size) { std::vector buf(max_user_text.get(*state)); long double bytes; char unit[16]; // 16 because we can also have long names (like mega-bytes) @@ -705,7 +707,7 @@ void print_to_bytes(struct text_object *obj, char *p, int p_max_size) { snprintf(p, p_max_size, "%s", &(buf[0])); } -void print_updates(struct text_object *obj, char *p, int p_max_size) { +void print_updates(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%d", get_total_updates()); } diff --git a/src/common.h b/src/common.h index 69ccb995..5b23e356 100644 --- a/src/common.h +++ b/src/common.h @@ -35,7 +35,7 @@ char *readfile(const char *filename, int *total_read, char showerror); -void print_to_bytes(struct text_object *, char *, int); +void print_to_bytes(struct text_object *, char *, unsigned int); void strfold(char *start, int count); int check_mount(struct text_object *); @@ -50,8 +50,8 @@ int update_threads(void); int update_running_processes(void); void update_stuff(void); char get_freq(char *, size_t, const char *, int, unsigned int); -void print_voltage_mv(struct text_object *, char *, int); -void print_voltage_v(struct text_object *, char *, int); +void print_voltage_mv(struct text_object *, char *, unsigned int); +void print_voltage_v(struct text_object *, char *, unsigned int); int update_load_average(void); void free_all_processes(void); struct process *get_first_process(void); @@ -86,11 +86,11 @@ double get_battery_perct_bar(struct text_object *); void get_battery_short_status(char *buf, unsigned int n, const char *bat); void scan_no_update(struct text_object *, const char *); -void print_no_update(struct text_object *, char *, int); +void print_no_update(struct text_object *, char *, unsigned int); void free_no_update(struct text_object *); void scan_loadavg_arg(struct text_object *, const char *); -void print_loadavg(struct text_object *, char *, int); +void print_loadavg(struct text_object *, char *, unsigned int); #ifdef BUILD_X11 void scan_loadgraph_arg(struct text_object *, const char *); double loadgraphval(struct text_object *); @@ -99,75 +99,75 @@ double loadgraphval(struct text_object *); uint8_t cpu_percentage(struct text_object *); double cpu_barval(struct text_object *); -void print_mem(struct text_object *, char *, int); -void print_memwithbuffers(struct text_object *, char *, int); -void print_memeasyfree(struct text_object *, char *, int); -void print_memfree(struct text_object *, char *, int); -void print_memmax(struct text_object *, char *, int); -void print_memdirty(struct text_object *, char *, int); -void print_swap(struct text_object *, char *, int); -void print_swapfree(struct text_object *, char *, int); -void print_swapmax(struct text_object *, char *, int); +void print_mem(struct text_object *, char *, unsigned int); +void print_memwithbuffers(struct text_object *, char *, unsigned int); +void print_memeasyfree(struct text_object *, char *, unsigned int); +void print_memfree(struct text_object *, char *, unsigned int); +void print_memmax(struct text_object *, char *, unsigned int); +void print_memdirty(struct text_object *, char *, unsigned int); +void print_swap(struct text_object *, char *, unsigned int); +void print_swapfree(struct text_object *, char *, unsigned int); +void print_swapmax(struct text_object *, char *, unsigned int); uint8_t mem_percentage(struct text_object *); double mem_barval(struct text_object *); double mem_with_buffers_barval(struct text_object *); uint8_t swap_percentage(struct text_object *); double swap_barval(struct text_object *); -void print_kernel(struct text_object *, char *, int); -void print_machine(struct text_object *, char *, int); -void print_nodename(struct text_object *, char *, int); -void print_nodename_short(struct text_object *, char *, int); -void print_sysname(struct text_object *, char *, int); +void print_kernel(struct text_object *, char *, unsigned int); +void print_machine(struct text_object *, char *, unsigned int); +void print_nodename(struct text_object *, char *, unsigned int); +void print_nodename_short(struct text_object *, char *, unsigned int); +void print_sysname(struct text_object *, char *, unsigned int); #if defined(__DragonFly__) -void print_version(struct text_object *obj, char *p, int p_max_size); +void print_version(struct text_object *obj, char *p, unsigned int p_max_size); #endif -void print_uptime(struct text_object *, char *, int); -void print_uptime_short(struct text_object *, char *, int); +void print_uptime(struct text_object *, char *, unsigned int); +void print_uptime_short(struct text_object *, char *, unsigned int); -void print_processes(struct text_object *, char *, int); -void print_running_processes(struct text_object *, char *, int); -void print_running_threads(struct text_object *, char *, int); -void print_threads(struct text_object *, char *, int); +void print_processes(struct text_object *, char *, unsigned int); +void print_running_processes(struct text_object *, char *, unsigned int); +void print_running_threads(struct text_object *, char *, unsigned int); +void print_threads(struct text_object *, char *, unsigned int); -void print_buffers(struct text_object *, char *, int); -void print_cached(struct text_object *, char *, int); +void print_buffers(struct text_object *, char *, unsigned int); +void print_cached(struct text_object *, char *, unsigned int); -void print_evaluate(struct text_object *, char *, int); +void print_evaluate(struct text_object *, char *, unsigned int); int if_empty_iftest(struct text_object *); int if_existing_iftest(struct text_object *); int if_running_iftest(struct text_object *); #ifndef __OpenBSD__ -void print_acpitemp(struct text_object *, char *, int); +void print_acpitemp(struct text_object *, char *, unsigned int); void free_acpitemp(struct text_object *); #endif /* !__OpenBSD__ */ -void print_freq(struct text_object *, char *, int); -void print_freq_g(struct text_object *, char *, int); +void print_freq(struct text_object *, char *, unsigned int); +void print_freq_g(struct text_object *, char *, unsigned int); #ifndef __OpenBSD__ -void print_acpifan(struct text_object *, char *, int); -void print_acpiacadapter(struct text_object *, char *, int); -void print_battery(struct text_object *, char *, int); -void print_battery_time(struct text_object *, char *, int); +void print_acpifan(struct text_object *, char *, unsigned int); +void print_acpiacadapter(struct text_object *, char *, unsigned int); +void print_battery(struct text_object *, char *, unsigned int); +void print_battery_time(struct text_object *, char *, unsigned int); uint8_t battery_percentage(struct text_object *); -void print_battery_short(struct text_object *, char *, int); +void print_battery_short(struct text_object *, char *, unsigned int); #endif /* !__OpenBSD__ */ void free_cpu(struct text_object *); -void print_blink(struct text_object *, char *, int); -void print_include(struct text_object *, char *, int); +void print_blink(struct text_object *, char *, unsigned int); +void print_include(struct text_object *, char *, unsigned int); -void print_updates(struct text_object *, char *, int); +void print_updates(struct text_object *, char *, unsigned int); int updatenr_iftest(struct text_object *); #ifdef BUILD_CURL -void print_stock(struct text_object *, char *, int); +void print_stock(struct text_object *, char *, unsigned int); void free_stock(struct text_object *); #endif /* BUILD_CURL */ #endif /* _COMMON_H */ diff --git a/src/cpu.cc b/src/cpu.cc index 99708b0d..ed95935f 100644 --- a/src/cpu.cc +++ b/src/cpu.cc @@ -131,7 +131,7 @@ seeya: } void -get_cpu_clock_speed(char *str1, int p_max_size) { +get_cpu_clock_speed(char *str1, unsigned int p_max_size) { uintmax_t x = 0; uintmax_t z = 0; struct timespec tc = {0L, 0L}; @@ -147,7 +147,7 @@ get_cpu_clock_speed(char *str1, int p_max_size) { snprintf(str1, p_max_size, FMT_UINT " MHz", ((z - x) / 100000U)); } -void print_freq2(struct text_object *obj, char *p, int p_max_size) { +void print_freq2(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; get_cpu_clock_speed(p, p_max_size); } diff --git a/src/cpu.h b/src/cpu.h index 0b588b99..c8f26fa3 100644 --- a/src/cpu.h +++ b/src/cpu.h @@ -32,9 +32,9 @@ #ifdef __x86_64__ uintmax_t rdtsc(void); -void get_cpu_clock_speed(char *, int); +void get_cpu_clock_speed(char *, unsigned int); uint8_t has_tsc_reg(void); -void print_freq2(struct text_object *, char *, int); +void print_freq2(struct text_object *, char *, unsigned int); #endif /* __x86_64__ */ #endif /* _CPU_H */ diff --git a/src/diskio.cc b/src/diskio.cc index 19d9e483..fb590f03 100644 --- a/src/diskio.cc +++ b/src/diskio.cc @@ -129,7 +129,7 @@ void parse_diskio_arg(struct text_object *obj, const char *arg) { * 1: write */ static void print_diskio_dir(struct text_object *obj, int dir, char *p, - int p_max_size) { + unsigned int p_max_size) { auto *diskio = static_cast(obj->data.opaque); double val; @@ -150,15 +150,15 @@ static void print_diskio_dir(struct text_object *obj, int dir, char *p, human_readable((val / active_update_interval()) * 1024LL, p, p_max_size); } -void print_diskio(struct text_object *obj, char *p, int p_max_size) { +void print_diskio(struct text_object *obj, char *p, unsigned int p_max_size) { print_diskio_dir(obj, 0, p, p_max_size); } -void print_diskio_read(struct text_object *obj, char *p, int p_max_size) { +void print_diskio_read(struct text_object *obj, char *p, unsigned int p_max_size) { print_diskio_dir(obj, -1, p, p_max_size); } -void print_diskio_write(struct text_object *obj, char *p, int p_max_size) { +void print_diskio_write(struct text_object *obj, char *p, unsigned int p_max_size) { print_diskio_dir(obj, 1, p, p_max_size); } diff --git a/src/diskio.h b/src/diskio.h index 4ba2afe7..6e5af7be 100644 --- a/src/diskio.h +++ b/src/diskio.h @@ -68,9 +68,9 @@ void clear_diskio_stats(void); void update_diskio_values(struct diskio_stat *, unsigned int, unsigned int); void parse_diskio_arg(struct text_object *, const char *); -void print_diskio(struct text_object *, char *, int); -void print_diskio_read(struct text_object *, char *, int); -void print_diskio_write(struct text_object *, char *, int); +void print_diskio(struct text_object *, char *, unsigned int); +void print_diskio_read(struct text_object *, char *, unsigned int); +void print_diskio_write(struct text_object *, char *, unsigned int); #ifdef BUILD_X11 void parse_diskiograph_arg(struct text_object *, const char *); double diskiographval(struct text_object *); diff --git a/src/entropy.cc b/src/entropy.cc index acbf9b29..c4a55442 100644 --- a/src/entropy.cc +++ b/src/entropy.cc @@ -64,7 +64,7 @@ int update_entropy() { return 0; } -void print_entropy_avail(struct text_object *obj, char *p, int p_max_size) { +void print_entropy_avail(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%u", entropy.avail); } @@ -75,7 +75,7 @@ uint8_t entropy_percentage(struct text_object *obj) { static_cast(entropy.poolsize)); } -void print_entropy_poolsize(struct text_object *obj, char *p, int p_max_size) { +void print_entropy_poolsize(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%u", entropy.poolsize); } @@ -86,7 +86,7 @@ double entropy_barval(struct text_object *obj) { return static_cast(entropy.avail) / entropy.poolsize; } -void print_password(struct text_object *obj, char *p, int p_max_size) { +void print_password(struct text_object *obj, char *p, unsigned int p_max_size) { time_t t; static const char letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&*()_"; static const int len = (int)sizeof(letters) - 1; diff --git a/src/entropy.h b/src/entropy.h index 9f3444d6..f91d6ff6 100644 --- a/src/entropy.h +++ b/src/entropy.h @@ -32,10 +32,10 @@ int update_entropy(void); -void print_entropy_avail(struct text_object *, char *, int); +void print_entropy_avail(struct text_object *, char *, unsigned int); uint8_t entropy_percentage(struct text_object *); -void print_entropy_poolsize(struct text_object *, char *, int); +void print_entropy_poolsize(struct text_object *, char *, unsigned int); double entropy_barval(struct text_object *); -void print_password(struct text_object *, char *, int); +void print_password(struct text_object *, char *, unsigned int); #endif /* _ENTROPY_H */ diff --git a/src/eve.cc b/src/eve.cc index 94523292..5c10f42d 100644 --- a/src/eve.cc +++ b/src/eve.cc @@ -438,7 +438,7 @@ void scan_eve(struct text_object *obj, const char *arg) { obj->data.opaque = ed; } -void print_eve(struct text_object *obj, char *p, int p_max_size) { +void print_eve(struct text_object *obj, char *p, unsigned int p_max_size) { struct eve_data *ed = (struct eve_data *)obj->data.opaque; if (!ed) return; diff --git a/src/eve.h b/src/eve.h index 5d2e432a..065539f4 100644 --- a/src/eve.h +++ b/src/eve.h @@ -32,7 +32,7 @@ #define TRAINING_INACTIVE "" void scan_eve(struct text_object *, const char *); -void print_eve(struct text_object *, char *, int); +void print_eve(struct text_object *, char *, unsigned int); void free_eve(struct text_object *); #endif /* _EVE_H */ diff --git a/src/exec.cc b/src/exec.cc index 40c97c91..7f1c5379 100644 --- a/src/exec.cc +++ b/src/exec.cc @@ -191,7 +191,7 @@ static inline double get_barnum(const char *buf) { * @param[in] p_max_size the maximum size of p... */ void fill_p(const char *buffer, struct text_object *obj, char *p, - int p_max_size) { + unsigned int p_max_size) { if (obj->parse) { evaluate(buffer, p, p_max_size); } else { @@ -300,7 +300,7 @@ void register_execi(struct text_object *obj) { * @param[out] p the string in which we store command output * @param[in] p_max_size the maximum size of p... */ -void print_exec(struct text_object *obj, char *p, int p_max_size) { +void print_exec(struct text_object *obj, char *p, unsigned int p_max_size) { if (obj->exec_handle != nullptr) { fill_p((*obj->exec_handle)->get_result_copy().c_str(), obj, p, p_max_size); } diff --git a/src/exec.h b/src/exec.h index 2a66cff5..e1cdf7b8 100644 --- a/src/exec.h +++ b/src/exec.h @@ -75,7 +75,7 @@ enum { void scan_exec_arg(struct text_object *, const char *, unsigned int); void register_exec(struct text_object *); void register_execi(struct text_object *); -void print_exec(struct text_object *, char *, int); +void print_exec(struct text_object *, char *, unsigned int); double execbarval(struct text_object *); void free_exec(struct text_object *); void free_execi(struct text_object *); diff --git a/src/fs.cc b/src/fs.cc index 8aba33b3..463d650e 100644 --- a/src/fs.cc +++ b/src/fs.cc @@ -253,7 +253,8 @@ uint8_t fs_used_percentage(struct text_object *obj) { } #define HUMAN_PRINT_FS_GENERATOR(name, expr) \ - void print_fs_##name(struct text_object *obj, char *p, int p_max_size) { \ + void print_fs_##name(struct text_object *obj, char *p, \ + unsigned int p_max_size) { \ struct fs_stat *fs = (struct fs_stat *)obj->data.opaque; \ if (fs) human_readable(expr, p, p_max_size); \ } @@ -262,7 +263,7 @@ HUMAN_PRINT_FS_GENERATOR(free, fs->avail) HUMAN_PRINT_FS_GENERATOR(size, fs->size) HUMAN_PRINT_FS_GENERATOR(used, fs->size - fs->free) -void print_fs_type(struct text_object *obj, char *p, int p_max_size) { +void print_fs_type(struct text_object *obj, char *p, unsigned int p_max_size) { auto *fs = static_cast(obj->data.opaque); if (fs != nullptr) { snprintf(p, p_max_size, "%s", fs->type); } diff --git a/src/fs.h b/src/fs.h index 5c01ef4c..4da9985b 100644 --- a/src/fs.h +++ b/src/fs.h @@ -52,10 +52,10 @@ double fs_free_barval(struct text_object *); void init_fs(struct text_object *, const char *); uint8_t fs_free_percentage(struct text_object *); uint8_t fs_used_percentage(struct text_object *); -void print_fs_free(struct text_object *, char *, int); -void print_fs_size(struct text_object *, char *, int); -void print_fs_used(struct text_object *, char *, int); -void print_fs_type(struct text_object *, char *, int); +void print_fs_free(struct text_object *, char *, unsigned int); +void print_fs_size(struct text_object *, char *, unsigned int); +void print_fs_used(struct text_object *, char *, unsigned int); +void print_fs_type(struct text_object *, char *, unsigned int); int update_fs_stats(void); struct fs_stat *prepare_fs_stat(const char *s); diff --git a/src/hddtemp.cc b/src/hddtemp.cc index fc661cc2..1b5f0580 100644 --- a/src/hddtemp.cc +++ b/src/hddtemp.cc @@ -220,7 +220,7 @@ static int get_hddtemp_info(const char *dev, short *val, char *unit) { return 0; } -void print_hddtemp(struct text_object *obj, char *p, int p_max_size) { +void print_hddtemp(struct text_object *obj, char *p, unsigned int p_max_size) { short val; char unit; diff --git a/src/hddtemp.h b/src/hddtemp.h index 8e5dcfd7..0b088b75 100644 --- a/src/hddtemp.h +++ b/src/hddtemp.h @@ -28,6 +28,6 @@ int update_hddtemp(void); void free_hddtemp(struct text_object *); -void print_hddtemp(struct text_object *, char *, int); +void print_hddtemp(struct text_object *, char *, unsigned int); #endif /*HDDTEMP_H_*/ diff --git a/src/i8k.cc b/src/i8k.cc index 7776508f..1928e63a 100644 --- a/src/i8k.cc +++ b/src/i8k.cc @@ -102,12 +102,12 @@ static void print_i8k_fan_status(char *p, int p_max_size, const char *status) { } void print_i8k_left_fan_status(struct text_object *obj, char *p, - int p_max_size) { + unsigned int p_max_size) { (void)obj; print_i8k_fan_status(p, p_max_size, i8k.left_fan_status); } -void print_i8k_cpu_temp(struct text_object *obj, char *p, int p_max_size) { +void print_i8k_cpu_temp(struct text_object *obj, char *p, unsigned int p_max_size) { int cpu_temp; (void)obj; @@ -117,12 +117,12 @@ void print_i8k_cpu_temp(struct text_object *obj, char *p, int p_max_size) { } void print_i8k_right_fan_status(struct text_object *obj, char *p, - int p_max_size) { + unsigned int p_max_size) { (void)obj; print_i8k_fan_status(p, p_max_size, i8k.right_fan_status); } -void print_i8k_ac_status(struct text_object *obj, char *p, int p_max_size) { +void print_i8k_ac_status(struct text_object *obj, char *p, unsigned int p_max_size) { int ac_status; (void)obj; @@ -140,7 +140,8 @@ void print_i8k_ac_status(struct text_object *obj, char *p, int p_max_size) { } #define I8K_PRINT_GENERATOR(name) \ - void print_i8k_##name(struct text_object *obj, char *p, int p_max_size) { \ + void print_i8k_##name(struct text_object *obj, char *p, \ + unsigned int p_max_size) { \ (void)obj; \ snprintf(p, p_max_size, "%s", i8k.name); \ } diff --git a/src/i8k.h b/src/i8k.h index 491c3bc1..20afe5a2 100644 --- a/src/i8k.h +++ b/src/i8k.h @@ -32,15 +32,15 @@ #define _I8K_H int update_i8k(void); -void print_i8k_left_fan_status(struct text_object *, char *, int); -void print_i8k_cpu_temp(struct text_object *, char *, int); -void print_i8k_right_fan_status(struct text_object *, char *, int); -void print_i8k_ac_status(struct text_object *, char *, int); -void print_i8k_version(struct text_object *, char *, int); -void print_i8k_bios(struct text_object *, char *, int); -void print_i8k_serial(struct text_object *, char *, int); -void print_i8k_left_fan_rpm(struct text_object *, char *, int); -void print_i8k_right_fan_rpm(struct text_object *, char *, int); -void print_i8k_buttons_status(struct text_object *, char *, int); +void print_i8k_left_fan_status(struct text_object *, char *, unsigned int); +void print_i8k_cpu_temp(struct text_object *, char *, unsigned int); +void print_i8k_right_fan_status(struct text_object *, char *, unsigned int); +void print_i8k_ac_status(struct text_object *, char *, unsigned int); +void print_i8k_version(struct text_object *, char *, unsigned int); +void print_i8k_bios(struct text_object *, char *, unsigned int); +void print_i8k_serial(struct text_object *, char *, unsigned int); +void print_i8k_left_fan_rpm(struct text_object *, char *, unsigned int); +void print_i8k_right_fan_rpm(struct text_object *, char *, unsigned int); +void print_i8k_buttons_status(struct text_object *, char *, unsigned int); #endif /* _I8K_H */ diff --git a/src/ibm.cc b/src/ibm.cc index 578f1e50..840f5c39 100644 --- a/src/ibm.cc +++ b/src/ibm.cc @@ -72,7 +72,7 @@ speed: 2944 commands: enable, disable * Peter Tarjan (ptarjan@citromail.hu) */ -void get_ibm_acpi_fan(struct text_object *obj, char *p, int p_max_size) { +void get_ibm_acpi_fan(struct text_object *obj, char *p, unsigned int p_max_size) { FILE *fp; unsigned int speed = 0; char fan[128]; @@ -171,7 +171,7 @@ commands: up, down, mute commands: level ( is 0-15) * Peter Tarjan (ptarjan@citromail.hu) */ -void get_ibm_acpi_volume(struct text_object *obj, char *p, int p_max_size) { +void get_ibm_acpi_volume(struct text_object *obj, char *p, unsigned int p_max_size) { FILE *fp; char volume[128]; unsigned int vol = -1; @@ -226,7 +226,7 @@ commands: up, down commands: level ( is 0-7) * Peter Tarjan (ptarjan@citromail.hu) */ -void get_ibm_acpi_brightness(struct text_object *obj, char *p, int p_max_size) { +void get_ibm_acpi_brightness(struct text_object *obj, char *p, unsigned int p_max_size) { FILE *fp; unsigned int brightness = 0; char filename[128]; @@ -271,7 +271,7 @@ commands: on, off * get "unknown" for a few models that do not make the status available. * Lluis Esquerda (eskerda@gmail.com) */ -void get_ibm_acpi_thinklight(struct text_object *obj, char *p, int p_max_size) { +void get_ibm_acpi_thinklight(struct text_object *obj, char *p, unsigned int p_max_size) { FILE *fp; char thinklight[8]; char filename[128]; @@ -317,6 +317,6 @@ void parse_ibm_temps_arg(struct text_object *obj, const char *arg) { obj->data.l = atoi(arg); } -void print_ibm_temps(struct text_object *obj, char *p, int p_max_size) { +void print_ibm_temps(struct text_object *obj, char *p, unsigned int p_max_size) { temp_print(p, p_max_size, ibm_acpi_temps[obj->data.l], TEMP_CELSIUS, 1); } diff --git a/src/ibm.h b/src/ibm.h index fccbfb5c..17c49f10 100644 --- a/src/ibm.h +++ b/src/ibm.h @@ -25,13 +25,13 @@ #ifndef _IBM_H #define _IBM_H -void get_ibm_acpi_fan(struct text_object *, char *, int); +void get_ibm_acpi_fan(struct text_object *, char *, unsigned int); int get_ibm_acpi_temps(void); -void get_ibm_acpi_volume(struct text_object *, char *, int); -void get_ibm_acpi_brightness(struct text_object *, char *, int); -void get_ibm_acpi_thinklight(struct text_object *, char *, int); +void get_ibm_acpi_volume(struct text_object *, char *, unsigned int); +void get_ibm_acpi_brightness(struct text_object *, char *, unsigned int); +void get_ibm_acpi_thinklight(struct text_object *, char *, unsigned int); void parse_ibm_temps_arg(struct text_object *, const char *); -void print_ibm_temps(struct text_object *, char *, int); +void print_ibm_temps(struct text_object *, char *, unsigned int); #endif /* _IBM_H */ diff --git a/src/ical.cc b/src/ical.cc index bad24a04..79ef568c 100644 --- a/src/ical.cc +++ b/src/ical.cc @@ -156,7 +156,7 @@ void parse_ical_args(struct text_object *obj, const char *arg, obj->data.opaque = opaque; } -void print_ical(struct text_object *obj, char *p, int p_max_size) { +void print_ical(struct text_object *obj, char *p, unsigned int p_max_size) { struct obj_ical *ical_obj = (struct obj_ical *)obj->data.opaque; struct ical_event *ll_current; diff --git a/src/ical.h b/src/ical.h index 29b50c95..2af9a550 100644 --- a/src/ical.h +++ b/src/ical.h @@ -26,7 +26,7 @@ #define ICAL_H_ void parse_ical_args(struct text_object *, const char *, void *, void *); -void print_ical(struct text_object *, char *, int); +void print_ical(struct text_object *, char *, unsigned int); void free_ical(struct text_object *); #endif /*ICAL_H_*/ diff --git a/src/iconv_tools.cc b/src/iconv_tools.cc index bdfa7786..cc7130b3 100644 --- a/src/iconv_tools.cc +++ b/src/iconv_tools.cc @@ -135,7 +135,7 @@ void init_iconv_start(struct text_object *obj, void *free_at_crash, void init_iconv_stop(void) { iconv_converting = 0; } -void print_iconv_start(struct text_object *obj, char *p, int p_max_size) { +void print_iconv_start(struct text_object *obj, char *p, unsigned int p_max_size) { (void)p; (void)p_max_size; @@ -143,7 +143,7 @@ void print_iconv_start(struct text_object *obj, char *p, int p_max_size) { iconv_selected = obj->data.i; } -void print_iconv_stop(struct text_object *obj, char *p, int p_max_size) { +void print_iconv_stop(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; (void)p; (void)p_max_size; diff --git a/src/iconv_tools.h b/src/iconv_tools.h index f8d368d9..a80b7175 100644 --- a/src/iconv_tools.h +++ b/src/iconv_tools.h @@ -35,7 +35,7 @@ void iconv_convert(size_t *, char *, char *, size_t); void init_iconv_start(struct text_object *, void *, const char *); void init_iconv_stop(void); -void print_iconv_start(struct text_object *, char *, int); -void print_iconv_stop(struct text_object *, char *, int); +void print_iconv_start(struct text_object *, char *, unsigned int); +void print_iconv_stop(struct text_object *, char *, unsigned int); #endif /* _ICONV_TOOLS_H */ diff --git a/src/imlib2.cc b/src/imlib2.cc index 4f376c18..c64bb53c 100644 --- a/src/imlib2.cc +++ b/src/imlib2.cc @@ -286,6 +286,6 @@ void cimlib_render(int x, int y, int width, int height) { } void print_image_callback(struct text_object *obj, char *, - int) { + unsigned int) { cimlib_add_image(obj->data.s); } diff --git a/src/imlib2.h b/src/imlib2.h index 4e538d78..c3d7be81 100644 --- a/src/imlib2.h +++ b/src/imlib2.h @@ -34,7 +34,7 @@ void cimlib_set_cache_flush_interval(long interval); void cimlib_render(int x, int y, int width, int height); void cimlib_cleanup(void); -void print_image_callback(struct text_object *, char *, int); +void print_image_callback(struct text_object *, char *, unsigned int); class imlib_cache_size_setting : public conky::range_config_setting { diff --git a/src/irc.cc b/src/irc.cc index 250fd122..bc4c7b6e 100644 --- a/src/irc.cc +++ b/src/irc.cc @@ -189,7 +189,7 @@ void parse_irc_args(struct text_object *obj, const char *arg) { obj->data.opaque = opaque; } -void print_irc(struct text_object *obj, char *p, int p_max_size) { +void print_irc(struct text_object *obj, char *p, unsigned int p_max_size) { struct obj_irc *ircobj = (struct obj_irc *)obj->data.opaque; struct ctx *ctxptr; struct ll_text *nextmsg, *curmsg; diff --git a/src/irc.h b/src/irc.h index 75db2556..90c5f2dd 100644 --- a/src/irc.h +++ b/src/irc.h @@ -26,7 +26,7 @@ #define IRC_H_ void parse_irc_args(struct text_object *, const char *); -void print_irc(struct text_object *, char *, int); +void print_irc(struct text_object *, char *, unsigned int); void free_irc(struct text_object *); #endif /*IRC_H_*/ diff --git a/src/journal.cc b/src/journal.cc index 7098b922..2fb0be14 100644 --- a/src/journal.cc +++ b/src/journal.cc @@ -102,7 +102,7 @@ void init_journal(const char *type, const char *arg, struct text_object *obj, } static int print_field(sd_journal *jh, const char *field, char spacer, - size_t *read, char *p, int p_max_size) { + size_t *read, char *p, unsigned int p_max_size) { const void *get; size_t length; size_t fieldlen = strlen(field) + 1; diff --git a/src/journal.h b/src/journal.h index aa696dfc..4d035aea 100644 --- a/src/journal.h +++ b/src/journal.h @@ -32,6 +32,6 @@ void free_journal(struct text_object *); void init_journal(const char *, const char *, struct text_object *, void *); -void print_journal(struct text_object *, char *, int); +void print_journal(struct text_object *, char *, unsigned int); #endif /* _JOURNAL_H */ diff --git a/src/linux.cc b/src/linux.cc index b10fd7ed..24853398 100644 --- a/src/linux.cc +++ b/src/linux.cc @@ -223,7 +223,7 @@ int update_meminfo(void) { return 0; } -void print_laptop_mode(struct text_object *obj, char *p, int p_max_size) { +void print_laptop_mode(struct text_object *obj, char *p, unsigned int p_max_size) { FILE *fp; int val = -1; @@ -240,7 +240,7 @@ void print_laptop_mode(struct text_object *obj, char *p, int p_max_size) { * # cat /sys/block/sda/queue/scheduler * noop [anticipatory] cfq */ -void print_ioscheduler(struct text_object *obj, char *p, int p_max_size) { +void print_ioscheduler(struct text_object *obj, char *p, unsigned int p_max_size) { FILE *fp; char buf[128]; @@ -339,13 +339,13 @@ int gateway_exists(struct text_object *obj) { return !!gw_info.count; } -void print_gateway_iface(struct text_object *obj, char *p, int p_max_size) { +void print_gateway_iface(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%s", gw_info.iface); } -void print_gateway_ip(struct text_object *obj, char *p, int p_max_size) { +void print_gateway_ip(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%s", gw_info.ip); @@ -1233,7 +1233,7 @@ PARSER_GENERATOR(i2c, "/sys/bus/i2c/devices/") PARSER_GENERATOR(hwmon, "/sys/class/hwmon/") PARSER_GENERATOR(platform, "/sys/bus/platform/devices/") -void print_sysfs_sensor(struct text_object *obj, char *p, int p_max_size) { +void print_sysfs_sensor(struct text_object *obj, char *p, unsigned int p_max_size) { double r; struct sysfs *sf = (struct sysfs *)obj->data.opaque; @@ -1423,12 +1423,12 @@ static char get_voltage(char *p_client_buffer, size_t client_buffer_size, return 1; } -void print_voltage_mv(struct text_object *obj, char *p, int p_max_size) { +void print_voltage_mv(struct text_object *obj, char *p, unsigned int p_max_size) { static int ok = 1; if (ok) { ok = get_voltage(p, p_max_size, "%.0f", 1, obj->data.i); } } -void print_voltage_v(struct text_object *obj, char *p, int p_max_size) { +void print_voltage_v(struct text_object *obj, char *p, unsigned int p_max_size) { static int ok = 1; if (ok) { ok = get_voltage(p, p_max_size, "%'.3f", 1000, obj->data.i); } } @@ -2380,7 +2380,7 @@ int get_entropy_poolsize(unsigned int *val) { } void print_disk_protect_queue(struct text_object *obj, char *p, - int p_max_size) { + unsigned int p_max_size) { FILE *fp; char path[128]; int state; @@ -2466,7 +2466,7 @@ int update_diskio(void) { return 0; } -void print_distribution(struct text_object *obj, char *p, int p_max_size) { +void print_distribution(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; int i, bytes_read; char *buf; diff --git a/src/linux.h b/src/linux.h index 95ad1fd5..4c468973 100644 --- a/src/linux.h +++ b/src/linux.h @@ -27,24 +27,24 @@ #include "common.h" -void print_disk_protect_queue(struct text_object *, char *, int); +void print_disk_protect_queue(struct text_object *, char *, unsigned int); -void print_ioscheduler(struct text_object *, char *, int); -void print_laptop_mode(struct text_object *, char *, int); +void print_ioscheduler(struct text_object *, char *, unsigned int); +void print_laptop_mode(struct text_object *, char *, unsigned int); int update_gateway_info(void); void free_gateway_info(struct text_object *obj); int gateway_exists(struct text_object *); -void print_gateway_iface(struct text_object *, char *, int); -void print_gateway_ip(struct text_object *, char *, int); +void print_gateway_iface(struct text_object *, char *, unsigned int); +void print_gateway_ip(struct text_object *, char *, unsigned int); enum { PB_BATT_STATUS, PB_BATT_PERCENT, PB_BATT_TIME }; -void get_powerbook_batt_info(struct text_object *, char *, int); +void get_powerbook_batt_info(struct text_object *, char *, unsigned int); void parse_i2c_sensor(struct text_object *, const char *); void parse_hwmon_sensor(struct text_object *, const char *); void parse_platform_sensor(struct text_object *, const char *); -void print_sysfs_sensor(struct text_object *, char *, int); +void print_sysfs_sensor(struct text_object *, char *, unsigned int); void free_sysfs_sensor(struct text_object *); int get_entropy_avail(unsigned int *); @@ -52,7 +52,7 @@ int get_entropy_poolsize(unsigned int *); int update_stat(void); -void print_distribution(struct text_object *, char *, int); +void print_distribution(struct text_object *, char *, unsigned int); void determine_longstat_file(void); diff --git a/src/llua.cc b/src/llua.cc index 18310a6d..ecd1b087 100644 --- a/src/llua.cc +++ b/src/llua.cc @@ -557,7 +557,7 @@ void llua_update_info(struct information *i, double u_interval) { lua_setglobal(lua_L, "conky_info"); } -void print_lua(struct text_object *obj, char *p, int p_max_size) { +void print_lua(struct text_object *obj, char *p, unsigned int p_max_size) { char *str = llua_getstring(obj->data.s); if (str != nullptr) { snprintf(p, p_max_size, "%s", str); @@ -565,7 +565,7 @@ void print_lua(struct text_object *obj, char *p, int p_max_size) { } } -void print_lua_parse(struct text_object *obj, char *p, int p_max_size) { +void print_lua_parse(struct text_object *obj, char *p, unsigned int p_max_size) { char *str = llua_getstring(obj->data.s); if (str != nullptr) { evaluate(str, p, p_max_size); diff --git a/src/llua.h b/src/llua.h index da22327c..9435930f 100644 --- a/src/llua.h +++ b/src/llua.h @@ -59,8 +59,8 @@ void llua_update_window_table(int text_start_x, int text_start_y, void llua_setup_info(struct information *i, double u_interval); void llua_update_info(struct information *i, double u_interval); -void print_lua(struct text_object *, char *, int); -void print_lua_parse(struct text_object *, char *, int); +void print_lua(struct text_object *, char *, unsigned int); +void print_lua_parse(struct text_object *, char *, unsigned int); double lua_barval(struct text_object *); #endif /* LUA_H_*/ diff --git a/src/mail.cc b/src/mail.cc index 1f16dbb7..1137acb1 100644 --- a/src/mail.cc +++ b/src/mail.cc @@ -470,7 +470,8 @@ void parse_local_mail_args(struct text_object *obj, const char *arg) { } #define PRINT_MAILS_GENERATOR(x) \ - void print_##x##mails(struct text_object *obj, char *p, int p_max_size) { \ + void print_##x##mails(struct text_object *obj, char *p, \ + unsigned int p_max_size) { \ struct local_mail_s *locmail = (struct local_mail_s *)obj->data.opaque; \ if (!locmail) return; \ update_mail_count(locmail); \ @@ -947,7 +948,7 @@ void imap_cb::work() { } } -void print_imap_unseen(struct text_object *obj, char *p, int p_max_size) { +void print_imap_unseen(struct text_object *obj, char *p, unsigned int p_max_size) { auto *mail = static_cast(obj->data.opaque); if (mail == nullptr) { @@ -959,7 +960,7 @@ void print_imap_unseen(struct text_object *obj, char *p, int p_max_size) { snprintf(p, p_max_size, "%lu", cb->get_result_copy().unseen); } -void print_imap_messages(struct text_object *obj, char *p, int p_max_size) { +void print_imap_messages(struct text_object *obj, char *p, unsigned int p_max_size) { auto *mail = static_cast(obj->data.opaque); if (mail == nullptr) { @@ -1031,7 +1032,7 @@ void pop3_cb::work() { } } -void print_pop3_unseen(struct text_object *obj, char *p, int p_max_size) { +void print_pop3_unseen(struct text_object *obj, char *p, unsigned int p_max_size) { auto *mail = static_cast(obj->data.opaque); if (mail == nullptr) { @@ -1043,7 +1044,7 @@ void print_pop3_unseen(struct text_object *obj, char *p, int p_max_size) { snprintf(p, p_max_size, "%lu", cb->get_result_copy().unseen); } -void print_pop3_used(struct text_object *obj, char *p, int p_max_size) { +void print_pop3_used(struct text_object *obj, char *p, unsigned int p_max_size) { auto *mail = static_cast(obj->data.opaque); if (mail == nullptr) { diff --git a/src/mail.h b/src/mail.h index 30c7c4a7..c3a94d1f 100644 --- a/src/mail.h +++ b/src/mail.h @@ -30,7 +30,7 @@ void parse_local_mail_args(struct text_object *, const char *); #define PRINT_MAILS_PROTO_GENERATOR(x) \ - void print_##x##mails(struct text_object *, char *, int); + void print_##x##mails(struct text_object *, char *, unsigned int); PRINT_MAILS_PROTO_GENERATOR() PRINT_MAILS_PROTO_GENERATOR(new_) @@ -53,10 +53,10 @@ void parse_global_pop3_mail_args(const char *); void parse_imap_mail_args(struct text_object *, const char *); void parse_pop3_mail_args(struct text_object *, const char *); void free_mail_obj(struct text_object *); -void print_imap_unseen(struct text_object *, char *, int); -void print_imap_messages(struct text_object *, char *, int); -void print_pop3_unseen(struct text_object *, char *, int); -void print_pop3_used(struct text_object *, char *, int); +void print_imap_unseen(struct text_object *, char *, unsigned int); +void print_imap_messages(struct text_object *, char *, unsigned int); +void print_pop3_unseen(struct text_object *, char *, unsigned int); +void print_pop3_used(struct text_object *, char *, unsigned int); namespace priv { class current_mail_spool_setting diff --git a/src/mboxscan.cc b/src/mboxscan.cc index a7b12902..3f7948bb 100644 --- a/src/mboxscan.cc +++ b/src/mboxscan.cc @@ -395,7 +395,7 @@ void parse_mboxscan_arg(struct text_object *obj, const char *arg) { obj->data.opaque = msd; } -void print_mboxscan(struct text_object *obj, char *p, int p_max_size) { +void print_mboxscan(struct text_object *obj, char *p, unsigned int p_max_size) { auto *msd = static_cast(obj->data.opaque); if (msd == nullptr) { diff --git a/src/mboxscan.h b/src/mboxscan.h index 040e2ae1..e55f5f74 100644 --- a/src/mboxscan.h +++ b/src/mboxscan.h @@ -31,7 +31,7 @@ #define _MBOXSCAN_H_ void parse_mboxscan_arg(struct text_object *, const char *); -void print_mboxscan(struct text_object *, char *, int); +void print_mboxscan(struct text_object *, char *, unsigned int); void free_mboxscan(struct text_object *); #endif /* _MBOXSCAN_H_ */ diff --git a/src/misc.cc b/src/misc.cc index 25bd83a1..3a69ab30 100644 --- a/src/misc.cc +++ b/src/misc.cc @@ -77,12 +77,12 @@ static inline unsigned int file_buffer_size(const char *data, const unsigned int return buf.st_size + 1; } -void print_cat(struct text_object *obj, char *p, int p_max_size) +void print_cat(struct text_object *obj, char *p, unsigned int p_max_size) { read_file(obj->data.s, p, p_max_size); } -void print_catp(struct text_object *obj, char *p, int p_max_size) +void print_catp(struct text_object *obj, char *p, unsigned int p_max_size) { const unsigned int sz = file_buffer_size(obj->data.s, text_buffer_size.get(*state)); char * buf = new char[sz]; @@ -94,7 +94,7 @@ void print_catp(struct text_object *obj, char *p, int p_max_size) delete[] buf; } -void print_cap(struct text_object *obj, char *p, int p_max_size) { +void print_cap(struct text_object *obj, char *p, unsigned int p_max_size) { int x = 0; int z = 0; char buf[p_max_size]; diff --git a/src/misc.h b/src/misc.h index 525f05ee..a1cd7770 100644 --- a/src/misc.h +++ b/src/misc.h @@ -33,8 +33,8 @@ #include "text_object.h" -void print_cat(struct text_object *, char *, int); -void print_catp(struct text_object *, char *, int); -void print_cap(struct text_object *, char *, int); +void print_cat(struct text_object *, char *, unsigned int); +void print_catp(struct text_object *, char *, unsigned int); +void print_cap(struct text_object *, char *, unsigned int); long long apply_base_multiplier(const char *, long long int); #endif /* _MISC_H */ diff --git a/src/moc.cc b/src/moc.cc index 073b20f7..5d4779fd 100644 --- a/src/moc.cc +++ b/src/moc.cc @@ -112,7 +112,8 @@ void moc_cb::work() { } // namespace #define MOC_PRINT_GENERATOR(type, alt) \ - void print_moc_##type(struct text_object *obj, char *p, int p_max_size) { \ + void print_moc_##type(struct text_object *obj, char *p, \ + unsigned int p_max_size) { \ (void)obj; \ uint32_t period = std::max( \ lround(music_player_interval.get(*state) / active_update_interval()), \ diff --git a/src/moc.h b/src/moc.h index fef701b7..5200ef35 100644 --- a/src/moc.h +++ b/src/moc.h @@ -23,16 +23,16 @@ #ifndef MOC_H_ #define MOC_H_ -void print_moc_state(struct text_object *, char *, int); -void print_moc_file(struct text_object *, char *, int); -void print_moc_title(struct text_object *, char *, int); -void print_moc_artist(struct text_object *, char *, int); -void print_moc_song(struct text_object *, char *, int); -void print_moc_album(struct text_object *, char *, int); -void print_moc_totaltime(struct text_object *, char *, int); -void print_moc_timeleft(struct text_object *, char *, int); -void print_moc_curtime(struct text_object *, char *, int); -void print_moc_bitrate(struct text_object *, char *, int); -void print_moc_rate(struct text_object *, char *, int); +void print_moc_state(struct text_object *, char *, unsigned int); +void print_moc_file(struct text_object *, char *, unsigned int); +void print_moc_title(struct text_object *, char *, unsigned int); +void print_moc_artist(struct text_object *, char *, unsigned int); +void print_moc_song(struct text_object *, char *, unsigned int); +void print_moc_album(struct text_object *, char *, unsigned int); +void print_moc_totaltime(struct text_object *, char *, unsigned int); +void print_moc_timeleft(struct text_object *, char *, unsigned int); +void print_moc_curtime(struct text_object *, char *, unsigned int); +void print_moc_bitrate(struct text_object *, char *, unsigned int); +void print_moc_rate(struct text_object *, char *, unsigned int); #endif /* MOC_H_ */ diff --git a/src/mpd.cc b/src/mpd.cc index b5280a35..89b4fab5 100644 --- a/src/mpd.cc +++ b/src/mpd.cc @@ -335,12 +335,12 @@ static inline void format_media_player_time(char *buf, const int size, } } -void print_mpd_elapsed(struct text_object *obj, char *p, int p_max_size) { +void print_mpd_elapsed(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; format_media_player_time(p, p_max_size, get_mpd().elapsed); } -void print_mpd_length(struct text_object *obj, char *p, int p_max_size) { +void print_mpd_length(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; format_media_player_time(p, p_max_size, get_mpd().length); } @@ -355,7 +355,7 @@ double mpd_barval(struct text_object *obj) { return get_mpd().progress; } -void print_mpd_smart(struct text_object *obj, char *p, int p_max_size) { +void print_mpd_smart(struct text_object *obj, char *p, unsigned int p_max_size) { const mpd_result &mpd_info = get_mpd(); int len = obj->data.i; if (len == 0 || len > p_max_size) { @@ -384,7 +384,8 @@ int check_mpd_playing(struct text_object *obj) { } #define MPD_PRINT_GENERATOR(name, fmt, acc) \ - void print_mpd_##name(struct text_object *obj, char *p, int p_max_size) { \ + void print_mpd_##name(struct text_object *obj, char *p, \ + unsigned int p_max_size) { \ if (obj->data.i && obj->data.i < p_max_size) p_max_size = obj->data.i; \ snprintf(p, p_max_size, fmt, get_mpd().name acc); \ } diff --git a/src/mpd.h b/src/mpd.h index 59119eb0..672f8396 100644 --- a/src/mpd.h +++ b/src/mpd.h @@ -28,24 +28,24 @@ #include /* text object functions */ -void print_mpd_elapsed(struct text_object *, char *, int); -void print_mpd_length(struct text_object *, char *, int); +void print_mpd_elapsed(struct text_object *, char *, unsigned int); +void print_mpd_length(struct text_object *, char *, unsigned int); uint8_t mpd_percentage(struct text_object *); double mpd_barval(struct text_object *); -void print_mpd_smart(struct text_object *, char *, int); -void print_mpd_title(struct text_object *, char *, int); -void print_mpd_artist(struct text_object *, char *, int); -void print_mpd_albumartist(struct text_object *, char *, int); -void print_mpd_album(struct text_object *, char *, int); -void print_mpd_date(struct text_object *, char *, int); -void print_mpd_random(struct text_object *, char *, int); -void print_mpd_repeat(struct text_object *, char *, int); -void print_mpd_track(struct text_object *, char *, int); -void print_mpd_name(struct text_object *, char *, int); -void print_mpd_file(struct text_object *, char *, int); -void print_mpd_vol(struct text_object *, char *, int); -void print_mpd_bitrate(struct text_object *, char *, int); -void print_mpd_status(struct text_object *, char *, int); +void print_mpd_smart(struct text_object *, char *, unsigned int); +void print_mpd_title(struct text_object *, char *, unsigned int); +void print_mpd_artist(struct text_object *, char *, unsigned int); +void print_mpd_albumartist(struct text_object *, char *, unsigned int); +void print_mpd_album(struct text_object *, char *, unsigned int); +void print_mpd_date(struct text_object *, char *, unsigned int); +void print_mpd_random(struct text_object *, char *, unsigned int); +void print_mpd_repeat(struct text_object *, char *, unsigned int); +void print_mpd_track(struct text_object *, char *, unsigned int); +void print_mpd_name(struct text_object *, char *, unsigned int); +void print_mpd_file(struct text_object *, char *, unsigned int); +void print_mpd_vol(struct text_object *, char *, unsigned int); +void print_mpd_bitrate(struct text_object *, char *, unsigned int); +void print_mpd_status(struct text_object *, char *, unsigned int); int check_mpd_playing(struct text_object *); #endif /*MPD_H_*/ diff --git a/src/mysql.cc b/src/mysql.cc index bcce21ac..7d4824e2 100644 --- a/src/mysql.cc +++ b/src/mysql.cc @@ -50,7 +50,7 @@ void mysql_finish(MYSQL *conn, MYSQL_RES *res) { mysql_library_end(); } -void print_mysql(struct text_object *obj, char *p, int p_max_size) { +void print_mysql(struct text_object *obj, char *p, unsigned int p_max_size) { MYSQL *conn = mysql_init(nullptr); MYSQL_RES *res = nullptr; diff --git a/src/mysql.h b/src/mysql.h index a95ba7d9..29320ac8 100644 --- a/src/mysql.h +++ b/src/mysql.h @@ -25,6 +25,6 @@ #ifndef MYSQL_H_ #define MYSQL_H_ -void print_mysql(struct text_object *, char *, int); +void print_mysql(struct text_object *, char *, unsigned int); #endif /*MYSQL_H_*/ diff --git a/src/net_stat.cc b/src/net_stat.cc index 4505bd70..a966b2c8 100644 --- a/src/net_stat.cc +++ b/src/net_stat.cc @@ -170,7 +170,7 @@ void parse_net_stat_bar_arg(struct text_object *obj, const char *arg, } } -void print_downspeed(struct text_object *obj, char *p, int p_max_size) { +void print_downspeed(struct text_object *obj, char *p, unsigned int p_max_size) { auto *ns = static_cast(obj->data.opaque); if (ns == nullptr) { return; } @@ -178,7 +178,7 @@ void print_downspeed(struct text_object *obj, char *p, int p_max_size) { human_readable(ns->recv_speed, p, p_max_size); } -void print_downspeedf(struct text_object *obj, char *p, int p_max_size) { +void print_downspeedf(struct text_object *obj, char *p, unsigned int p_max_size) { auto *ns = static_cast(obj->data.opaque); if (ns == nullptr) { return; } @@ -186,7 +186,7 @@ void print_downspeedf(struct text_object *obj, char *p, int p_max_size) { spaced_print(p, p_max_size, "%.1f", 8, ns->recv_speed / 1024.0); } -void print_upspeed(struct text_object *obj, char *p, int p_max_size) { +void print_upspeed(struct text_object *obj, char *p, unsigned int p_max_size) { auto *ns = static_cast(obj->data.opaque); if (ns == nullptr) { return; } @@ -194,7 +194,7 @@ void print_upspeed(struct text_object *obj, char *p, int p_max_size) { human_readable(ns->trans_speed, p, p_max_size); } -void print_upspeedf(struct text_object *obj, char *p, int p_max_size) { +void print_upspeedf(struct text_object *obj, char *p, unsigned int p_max_size) { auto *ns = static_cast(obj->data.opaque); if (ns == nullptr) { return; } @@ -202,7 +202,7 @@ void print_upspeedf(struct text_object *obj, char *p, int p_max_size) { spaced_print(p, p_max_size, "%.1f", 8, ns->trans_speed / 1024.0); } -void print_totaldown(struct text_object *obj, char *p, int p_max_size) { +void print_totaldown(struct text_object *obj, char *p, unsigned int p_max_size) { auto *ns = static_cast(obj->data.opaque); if (ns == nullptr) { return; } @@ -210,7 +210,7 @@ void print_totaldown(struct text_object *obj, char *p, int p_max_size) { human_readable(ns->recv, p, p_max_size); } -void print_totalup(struct text_object *obj, char *p, int p_max_size) { +void print_totalup(struct text_object *obj, char *p, unsigned int p_max_size) { auto *ns = static_cast(obj->data.opaque); if (ns == nullptr) { return; } @@ -218,7 +218,7 @@ void print_totalup(struct text_object *obj, char *p, int p_max_size) { human_readable(ns->trans, p, p_max_size); } -void print_addr(struct text_object *obj, char *p, int p_max_size) { +void print_addr(struct text_object *obj, char *p, unsigned int p_max_size) { auto *ns = static_cast(obj->data.opaque); if (ns == nullptr) { return; } @@ -234,7 +234,7 @@ void print_addr(struct text_object *obj, char *p, int p_max_size) { } #ifdef __linux__ -void print_addrs(struct text_object *obj, char *p, int p_max_size) { +void print_addrs(struct text_object *obj, char *p, unsigned int p_max_size) { struct net_stat *ns = (struct net_stat *)obj->data.opaque; if (!ns) return; @@ -248,7 +248,7 @@ void print_addrs(struct text_object *obj, char *p, int p_max_size) { } #ifdef BUILD_IPV6 -void print_v6addrs(struct text_object *obj, char *p, int p_max_size) { +void print_v6addrs(struct text_object *obj, char *p, unsigned int p_max_size) { struct net_stat *ns = (struct net_stat *)obj->data.opaque; char tempaddress[INET6_ADDRSTRLEN]; struct v6addr *current_v6 = ns->v6addrs; @@ -329,7 +329,7 @@ double upspeedgraphval(struct text_object *obj) { #endif /* BUILD_X11 */ #ifdef BUILD_WLAN -void print_wireless_essid(struct text_object *obj, char *p, int p_max_size) { +void print_wireless_essid(struct text_object *obj, char *p, unsigned int p_max_size) { struct net_stat *ns = (struct net_stat *)obj->data.opaque; if (!ns) { @@ -344,14 +344,14 @@ void print_wireless_essid(struct text_object *obj, char *p, int p_max_size) { snprintf(p, p_max_size, "%s", ns->essid); } -void print_wireless_mode(struct text_object *obj, char *p, int p_max_size) { +void print_wireless_mode(struct text_object *obj, char *p, unsigned int p_max_size) { struct net_stat *ns = (struct net_stat *)obj->data.opaque; if (!ns) return; snprintf(p, p_max_size, "%s", ns->mode); } -void print_wireless_channel(struct text_object *obj, char *p, int p_max_size) { +void print_wireless_channel(struct text_object *obj, char *p, unsigned int p_max_size) { struct net_stat *ns = (struct net_stat *)obj->data.opaque; if (!ns) return; @@ -362,8 +362,7 @@ void print_wireless_channel(struct text_object *obj, char *p, int p_max_size) { snprintf(p, p_max_size, "%s", "/"); } } -void print_wireless_frequency(struct text_object *obj, char *p, - int p_max_size) { +void print_wireless_frequency(struct text_object *obj, char *p, unsigned int p_max_size) { struct net_stat *ns = (struct net_stat *)obj->data.opaque; if (!ns) return; @@ -374,38 +373,35 @@ void print_wireless_frequency(struct text_object *obj, char *p, snprintf(p, p_max_size, "/"); } } -void print_wireless_bitrate(struct text_object *obj, char *p, int p_max_size) { +void print_wireless_bitrate(struct text_object *obj, char *p, unsigned int p_max_size) { struct net_stat *ns = (struct net_stat *)obj->data.opaque; if (!ns) return; snprintf(p, p_max_size, "%s", ns->bitrate); } -void print_wireless_ap(struct text_object *obj, char *p, int p_max_size) { +void print_wireless_ap(struct text_object *obj, char *p, unsigned int p_max_size) { struct net_stat *ns = (struct net_stat *)obj->data.opaque; if (!ns) return; snprintf(p, p_max_size, "%s", ns->ap); } -void print_wireless_link_qual(struct text_object *obj, char *p, - int p_max_size) { +void print_wireless_link_qual(struct text_object *obj, char *p, unsigned int p_max_size) { struct net_stat *ns = (struct net_stat *)obj->data.opaque; if (!ns) return; spaced_print(p, p_max_size, "%d", 4, ns->link_qual); } -void print_wireless_link_qual_max(struct text_object *obj, char *p, - int p_max_size) { +void print_wireless_link_qual_max(struct text_object *obj, char *p, unsigned int p_max_size) { struct net_stat *ns = (struct net_stat *)obj->data.opaque; if (!ns) return; spaced_print(p, p_max_size, "%d", 4, ns->link_qual_max); } -void print_wireless_link_qual_perc(struct text_object *obj, char *p, - int p_max_size) { +void print_wireless_link_qual_perc(struct text_object *obj, char *p, unsigned int p_max_size) { struct net_stat *ns = (struct net_stat *)obj->data.opaque; if (!ns) return; @@ -569,7 +565,7 @@ void parse_nameserver_arg(struct text_object *obj, const char *arg) { obj->data.l = arg != nullptr ? atoi(arg) : 0; } -void print_nameserver(struct text_object *obj, char *p, int p_max_size) { +void print_nameserver(struct text_object *obj, char *p, unsigned int p_max_size) { if (dns_data.nscount > obj->data.l) { snprintf(p, p_max_size, "%s", dns_data.ns_list[obj->data.l]); } diff --git a/src/net_stat.h b/src/net_stat.h index 56330aeb..27cafc9b 100644 --- a/src/net_stat.h +++ b/src/net_stat.h @@ -89,17 +89,17 @@ struct net_stat *get_net_stat(const char *, void *, void *); void parse_net_stat_arg(struct text_object *, const char *, void *); void parse_net_stat_bar_arg(struct text_object *, const char *, void *); -void print_downspeed(struct text_object *, char *, int); -void print_downspeedf(struct text_object *, char *, int); -void print_upspeed(struct text_object *, char *, int); -void print_upspeedf(struct text_object *, char *, int); -void print_totaldown(struct text_object *, char *, int); -void print_totalup(struct text_object *, char *, int); -void print_addr(struct text_object *, char *, int); +void print_downspeed(struct text_object *, char *, unsigned int); +void print_downspeedf(struct text_object *, char *, unsigned int); +void print_upspeed(struct text_object *, char *, unsigned int); +void print_upspeedf(struct text_object *, char *, unsigned int); +void print_totaldown(struct text_object *, char *, unsigned int); +void print_totalup(struct text_object *, char *, unsigned int); +void print_addr(struct text_object *, char *, unsigned int); #ifdef __linux__ -void print_addrs(struct text_object *, char *, int); +void print_addrs(struct text_object *, char *, unsigned int); #ifdef BUILD_IPV6 -void print_v6addrs(struct text_object *, char *, int); +void print_v6addrs(struct text_object *, char *, unsigned int); #endif /* BUILD_IPV6 */ #endif /* __linux__ */ #ifdef BUILD_X11 @@ -108,15 +108,15 @@ double downspeedgraphval(struct text_object *); double upspeedgraphval(struct text_object *); #endif /* BUILD_X11 */ #ifdef BUILD_WLAN -void print_wireless_essid(struct text_object *, char *, int); -void print_wireless_channel(struct text_object *, char *, int); -void print_wireless_frequency(struct text_object *, char *, int); -void print_wireless_mode(struct text_object *, char *, int); -void print_wireless_bitrate(struct text_object *, char *, int); -void print_wireless_ap(struct text_object *, char *, int); -void print_wireless_link_qual(struct text_object *, char *, int); -void print_wireless_link_qual_max(struct text_object *, char *, int); -void print_wireless_link_qual_perc(struct text_object *, char *, int); +void print_wireless_essid(struct text_object *, char *, unsigned int); +void print_wireless_channel(struct text_object *, char *, unsigned int); +void print_wireless_frequency(struct text_object *, char *, unsigned int); +void print_wireless_mode(struct text_object *, char *, unsigned int); +void print_wireless_bitrate(struct text_object *, char *, unsigned int); +void print_wireless_ap(struct text_object *, char *, unsigned int); +void print_wireless_link_qual(struct text_object *, char *, unsigned int); +void print_wireless_link_qual_max(struct text_object *, char *, unsigned int); +void print_wireless_link_qual_perc(struct text_object *, char *, unsigned int); double wireless_link_barval(struct text_object *); #endif /* BUILD_WLAN */ @@ -130,6 +130,6 @@ void free_if_up(struct text_object *); void free_dns_data(struct text_object *); int update_dns_data(void); void parse_nameserver_arg(struct text_object *, const char *); -void print_nameserver(struct text_object *, char *, int); +void print_nameserver(struct text_object *, char *, unsigned int); #endif /* _NET_STAT_H */ diff --git a/src/proc.cc b/src/proc.cc index 36d8b4b1..666ee2e1 100644 --- a/src/proc.cc +++ b/src/proc.cc @@ -58,7 +58,7 @@ char *readfile(const char *filename, int *total_read, char showerror) { return buf; } -void pid_readlink(const char *file, char *p, int p_max_size) { +void pid_readlink(const char *file, char *p, unsigned int p_max_size) { std::unique_ptr buf(new char[p_max_size]); memset(buf.get(), 0, p_max_size); @@ -106,7 +106,7 @@ int inlist(struct ll_string *front, char *string) { return 0; } -void print_pid_chroot(struct text_object *obj, char *p, int p_max_size) { +void print_pid_chroot(struct text_object *obj, char *p, unsigned int p_max_size) { std::ostringstream pathstream; std::unique_ptr buf(new char[max_user_text.get(*state)]); @@ -115,7 +115,7 @@ void print_pid_chroot(struct text_object *obj, char *p, int p_max_size) { pid_readlink(pathstream.str().c_str(), p, p_max_size); } -void print_pid_cmdline(struct text_object *obj, char *p, int p_max_size) { +void print_pid_cmdline(struct text_object *obj, char *p, unsigned int p_max_size) { char *buf; int i, bytes_read; std::ostringstream pathstream; @@ -140,7 +140,7 @@ void print_pid_cmdline(struct text_object *obj, char *p, int p_max_size) { } } -void print_pid_cwd(struct text_object *obj, char *p, int p_max_size) { +void print_pid_cwd(struct text_object *obj, char *p, unsigned int p_max_size) { std::unique_ptr buf(new char[p_max_size]); int bytes_read; std::ostringstream pathstream; @@ -157,7 +157,7 @@ void print_pid_cwd(struct text_object *obj, char *p, int p_max_size) { } } -void print_pid_environ(struct text_object *obj, char *p, int p_max_size) { +void print_pid_environ(struct text_object *obj, char *p, unsigned int p_max_size) { int i, total_read; pid_t pid; std::ostringstream pathstream; @@ -189,7 +189,7 @@ void print_pid_environ(struct text_object *obj, char *p, int p_max_size) { free(var); } -void print_pid_environ_list(struct text_object *obj, char *p, int p_max_size) { +void print_pid_environ_list(struct text_object *obj, char *p, unsigned int p_max_size) { char *buf = nullptr; char *buf2; int bytes_read, total_read; @@ -215,7 +215,7 @@ void print_pid_environ_list(struct text_object *obj, char *p, int p_max_size) { } } -void print_pid_exe(struct text_object *obj, char *p, int p_max_size) { +void print_pid_exe(struct text_object *obj, char *p, unsigned int p_max_size) { std::ostringstream pathstream; std::unique_ptr objbuf(new char[max_user_text.get(*state)]); @@ -224,7 +224,7 @@ void print_pid_exe(struct text_object *obj, char *p, int p_max_size) { pid_readlink(pathstream.str().c_str(), p, p_max_size); } -void print_pid_nice(struct text_object *obj, char *p, int p_max_size) { +void print_pid_nice(struct text_object *obj, char *p, unsigned int p_max_size) { char *buf = nullptr; int bytes_read; long int nice_value; @@ -249,7 +249,7 @@ void print_pid_nice(struct text_object *obj, char *p, int p_max_size) { } } -void print_pid_openfiles(struct text_object *obj, char *p, int p_max_size) { +void print_pid_openfiles(struct text_object *obj, char *p, unsigned int p_max_size) { DIR *dir; struct dirent *entry; std::unique_ptr buf(new char[p_max_size]); @@ -286,7 +286,7 @@ void print_pid_openfiles(struct text_object *obj, char *p, int p_max_size) { } } -void print_pid_parent(struct text_object *obj, char *p, int p_max_size) { +void print_pid_parent(struct text_object *obj, char *p, unsigned int p_max_size) { #define PARENT_ENTRY "PPid:\t" #define PARENTNOTFOUND "Can't find the process parent in '%s'" char *begin, *end, *buf = nullptr; @@ -314,7 +314,7 @@ void print_pid_parent(struct text_object *obj, char *p, int p_max_size) { } } -void print_pid_priority(struct text_object *obj, char *p, int p_max_size) { +void print_pid_priority(struct text_object *obj, char *p, unsigned int p_max_size) { char *buf = nullptr; int bytes_read; long int priority; @@ -339,7 +339,7 @@ void print_pid_priority(struct text_object *obj, char *p, int p_max_size) { } } -void print_pid_state(struct text_object *obj, char *p, int p_max_size) { +void print_pid_state(struct text_object *obj, char *p, unsigned int p_max_size) { #define STATE_ENTRY "State:\t" #define STATENOTFOUND "Can't find the process state in '%s'" char *begin, *end, *buf = nullptr; @@ -369,7 +369,7 @@ void print_pid_state(struct text_object *obj, char *p, int p_max_size) { } } -void print_pid_state_short(struct text_object *obj, char *p, int p_max_size) { +void print_pid_state_short(struct text_object *obj, char *p, unsigned int p_max_size) { char *begin, *buf = nullptr; int bytes_read; std::ostringstream pathstream; @@ -391,7 +391,7 @@ void print_pid_state_short(struct text_object *obj, char *p, int p_max_size) { } } -void print_pid_stderr(struct text_object *obj, char *p, int p_max_size) { +void print_pid_stderr(struct text_object *obj, char *p, unsigned int p_max_size) { std::ostringstream pathstream; std::unique_ptr objbuf(new char[max_user_text.get(*state)]); @@ -401,7 +401,7 @@ void print_pid_stderr(struct text_object *obj, char *p, int p_max_size) { pid_readlink(pathstream.str().c_str(), p, p_max_size); } -void print_pid_stdin(struct text_object *obj, char *p, int p_max_size) { +void print_pid_stdin(struct text_object *obj, char *p, unsigned int p_max_size) { std::unique_ptr objbuf(new char[max_user_text.get(*state)]); std::ostringstream pathstream; @@ -411,7 +411,7 @@ void print_pid_stdin(struct text_object *obj, char *p, int p_max_size) { pid_readlink(pathstream.str().c_str(), p, p_max_size); } -void print_pid_stdout(struct text_object *obj, char *p, int p_max_size) { +void print_pid_stdout(struct text_object *obj, char *p, unsigned int p_max_size) { std::ostringstream pathstream; std::unique_ptr objbuf(new char[max_user_text.get(*state)]); @@ -445,7 +445,7 @@ void scan_cmdline_to_pid_arg(struct text_object *obj, const char *arg, } } -void print_cmdline_to_pid(struct text_object *obj, char *p, int p_max_size) { +void print_cmdline_to_pid(struct text_object *obj, char *p, unsigned int p_max_size) { DIR *dir; struct dirent *entry; char *buf; @@ -479,7 +479,7 @@ void print_cmdline_to_pid(struct text_object *obj, char *p, int p_max_size) { } } -void print_pid_threads(struct text_object *obj, char *p, int p_max_size) { +void print_pid_threads(struct text_object *obj, char *p, unsigned int p_max_size) { #define THREADS_ENTRY "Threads:\t" #define THREADSNOTFOUND \ "Can't find the number of the threads of the process in '%s'" @@ -508,7 +508,7 @@ void print_pid_threads(struct text_object *obj, char *p, int p_max_size) { } } -void print_pid_thread_list(struct text_object *obj, char *p, int p_max_size) { +void print_pid_thread_list(struct text_object *obj, char *p, unsigned int p_max_size) { DIR *dir; struct dirent *entry; int totallength = 0; @@ -537,7 +537,7 @@ void print_pid_thread_list(struct text_object *obj, char *p, int p_max_size) { } void print_pid_time_kernelmode(struct text_object *obj, char *p, - int p_max_size) { + unsigned int p_max_size) { char *buf = nullptr; int bytes_read; unsigned long int umtime; @@ -560,7 +560,7 @@ void print_pid_time_kernelmode(struct text_object *obj, char *p, } } -void print_pid_time_usermode(struct text_object *obj, char *p, int p_max_size) { +void print_pid_time_usermode(struct text_object *obj, char *p, unsigned int p_max_size) { char *buf = nullptr; int bytes_read; unsigned long int kmtime; @@ -583,7 +583,7 @@ void print_pid_time_usermode(struct text_object *obj, char *p, int p_max_size) { } } -void print_pid_time(struct text_object *obj, char *p, int p_max_size) { +void print_pid_time(struct text_object *obj, char *p, unsigned int p_max_size) { char *buf = nullptr; int bytes_read; unsigned long int umtime, kmtime; @@ -729,35 +729,35 @@ void print_pid_Xid(struct text_object *obj, char *p, int p_max_size, idtype type } } -void print_pid_egid(struct text_object *obj, char *p, int p_max_size) { +void print_pid_egid(struct text_object *obj, char *p, unsigned int p_max_size) { print_pid_Xid(obj, p, p_max_size, egid); } -void print_pid_euid(struct text_object *obj, char *p, int p_max_size) { +void print_pid_euid(struct text_object *obj, char *p, unsigned int p_max_size) { print_pid_Xid(obj, p, p_max_size, euid); } -void print_pid_fsgid(struct text_object *obj, char *p, int p_max_size) { +void print_pid_fsgid(struct text_object *obj, char *p, unsigned int p_max_size) { print_pid_Xid(obj, p, p_max_size, fsgid); } -void print_pid_fsuid(struct text_object *obj, char *p, int p_max_size) { +void print_pid_fsuid(struct text_object *obj, char *p, unsigned int p_max_size) { print_pid_Xid(obj, p, p_max_size, fsuid); } -void print_pid_gid(struct text_object *obj, char *p, int p_max_size) { +void print_pid_gid(struct text_object *obj, char *p, unsigned int p_max_size) { print_pid_Xid(obj, p, p_max_size, gid); } -void print_pid_sgid(struct text_object *obj, char *p, int p_max_size) { +void print_pid_sgid(struct text_object *obj, char *p, unsigned int p_max_size) { print_pid_Xid(obj, p, p_max_size, sgid); } -void print_pid_suid(struct text_object *obj, char *p, int p_max_size) { +void print_pid_suid(struct text_object *obj, char *p, unsigned int p_max_size) { print_pid_Xid(obj, p, p_max_size, suid); } -void print_pid_uid(struct text_object *obj, char *p, int p_max_size) { +void print_pid_uid(struct text_object *obj, char *p, unsigned int p_max_size) { print_pid_Xid(obj, p, p_max_size, uid); } @@ -791,55 +791,55 @@ void internal_print_pid_vm(struct text_object *obj, char *p, int p_max_size, } } -void print_pid_vmpeak(struct text_object *obj, char *p, int p_max_size) { +void print_pid_vmpeak(struct text_object *obj, char *p, unsigned int p_max_size) { internal_print_pid_vm( obj, p, p_max_size, "VmPeak:\t", "Can't find the process peak virtual memory size in '%s'"); } -void print_pid_vmsize(struct text_object *obj, char *p, int p_max_size) { +void print_pid_vmsize(struct text_object *obj, char *p, unsigned int p_max_size) { internal_print_pid_vm(obj, p, p_max_size, "VmSize:\t", "Can't find the process virtual memory size in '%s'"); } -void print_pid_vmlck(struct text_object *obj, char *p, int p_max_size) { +void print_pid_vmlck(struct text_object *obj, char *p, unsigned int p_max_size) { internal_print_pid_vm(obj, p, p_max_size, "VmLck:\t", "Can't find the process locked memory size in '%s'"); } -void print_pid_vmhwm(struct text_object *obj, char *p, int p_max_size) { +void print_pid_vmhwm(struct text_object *obj, char *p, unsigned int p_max_size) { internal_print_pid_vm( obj, p, p_max_size, "VmHWM:\t", "Can't find the process peak resident set size in '%s'"); } -void print_pid_vmrss(struct text_object *obj, char *p, int p_max_size) { +void print_pid_vmrss(struct text_object *obj, char *p, unsigned int p_max_size) { internal_print_pid_vm(obj, p, p_max_size, "VmHWM:\t", "Can't find the process resident set size in '%s'"); } -void print_pid_vmdata(struct text_object *obj, char *p, int p_max_size) { +void print_pid_vmdata(struct text_object *obj, char *p, unsigned int p_max_size) { internal_print_pid_vm(obj, p, p_max_size, "VmData:\t", "Can't find the process data segment size in '%s'"); } -void print_pid_vmstk(struct text_object *obj, char *p, int p_max_size) { +void print_pid_vmstk(struct text_object *obj, char *p, unsigned int p_max_size) { internal_print_pid_vm(obj, p, p_max_size, "VmData:\t", "Can't find the process stack segment size in '%s'"); } -void print_pid_vmexe(struct text_object *obj, char *p, int p_max_size) { +void print_pid_vmexe(struct text_object *obj, char *p, unsigned int p_max_size) { internal_print_pid_vm(obj, p, p_max_size, "VmData:\t", "Can't find the process text segment size in '%s'"); } -void print_pid_vmlib(struct text_object *obj, char *p, int p_max_size) { +void print_pid_vmlib(struct text_object *obj, char *p, unsigned int p_max_size) { internal_print_pid_vm( obj, p, p_max_size, "VmLib:\t", "Can't find the process shared library code size in '%s'"); } -void print_pid_vmpte(struct text_object *obj, char *p, int p_max_size) { +void print_pid_vmpte(struct text_object *obj, char *p, unsigned int p_max_size) { internal_print_pid_vm( obj, p, p_max_size, "VmPTE:\t", "Can't find the process page table entries size in '%s'"); @@ -847,7 +847,7 @@ void print_pid_vmpte(struct text_object *obj, char *p, int p_max_size) { #define READ_ENTRY "read_bytes: " #define READNOTFOUND "Can't find the amount of bytes read in '%s'" -void print_pid_read(struct text_object *obj, char *p, int p_max_size) { +void print_pid_read(struct text_object *obj, char *p, unsigned int p_max_size) { char *begin, *end, *buf = nullptr; int bytes_read; std::ostringstream pathstream; @@ -874,7 +874,7 @@ void print_pid_read(struct text_object *obj, char *p, int p_max_size) { #define WRITE_ENTRY "write_bytes: " #define WRITENOTFOUND "Can't find the amount of bytes written in '%s'" -void print_pid_write(struct text_object *obj, char *p, int p_max_size) { +void print_pid_write(struct text_object *obj, char *p, unsigned int p_max_size) { char *begin, *end, *buf = nullptr; int bytes_read; std::ostringstream pathstream; diff --git a/src/proc.h b/src/proc.h index d54eba0b..9bb96083 100644 --- a/src/proc.h +++ b/src/proc.h @@ -34,50 +34,50 @@ #define READERR "Can't read '%s'" #define READSIZE 128 -void print_pid_chroot(struct text_object *obj, char *p, int p_max_size); -void print_pid_cmdline(struct text_object *obj, char *p, int p_max_size); -void print_pid_cwd(struct text_object *obj, char *p, int p_max_size); -void print_pid_environ(struct text_object *obj, char *p, int p_max_size); -void print_pid_environ_list(struct text_object *obj, char *p, int p_max_size); -void print_pid_exe(struct text_object *obj, char *p, int p_max_size); -void print_pid_nice(struct text_object *obj, char *p, int p_max_size); -void print_pid_openfiles(struct text_object *obj, char *p, int p_max_size); -void print_pid_parent(struct text_object *obj, char *p, int p_max_size); -void print_pid_priority(struct text_object *obj, char *p, int p_max_size); -void print_pid_state(struct text_object *obj, char *p, int p_max_size); -void print_pid_state_short(struct text_object *obj, char *p, int p_max_size); -void print_pid_stderr(struct text_object *obj, char *p, int p_max_size); -void print_pid_stdin(struct text_object *obj, char *p, int p_max_size); -void print_pid_stdout(struct text_object *obj, char *p, int p_max_size); -void print_pid_threads(struct text_object *obj, char *p, int p_max_size); -void print_pid_thread_list(struct text_object *obj, char *p, int p_max_size); +void print_pid_chroot(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_cmdline(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_cwd(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_environ(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_environ_list(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_exe(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_nice(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_openfiles(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_parent(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_priority(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_state(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_state_short(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_stderr(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_stdin(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_stdout(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_threads(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_thread_list(struct text_object *obj, char *p, unsigned int p_max_size); void print_pid_time_kernelmode(struct text_object *obj, char *p, - int p_max_size); -void print_pid_time_usermode(struct text_object *obj, char *p, int p_max_size); -void print_pid_time(struct text_object *obj, char *p, int p_max_size); -void print_pid_uid(struct text_object *obj, char *p, int p_max_size); -void print_pid_euid(struct text_object *obj, char *p, int p_max_size); -void print_pid_suid(struct text_object *obj, char *p, int p_max_size); -void print_pid_fsuid(struct text_object *obj, char *p, int p_max_size); -void print_pid_gid(struct text_object *obj, char *p, int p_max_size); -void print_pid_egid(struct text_object *obj, char *p, int p_max_size); -void print_pid_sgid(struct text_object *obj, char *p, int p_max_size); -void print_pid_fsgid(struct text_object *obj, char *p, int p_max_size); -void print_pid_read(struct text_object *obj, char *p, int p_max_size); -void print_pid_vmpeak(struct text_object *obj, char *p, int p_max_size); -void print_pid_vmsize(struct text_object *obj, char *p, int p_max_size); -void print_pid_vmlck(struct text_object *obj, char *p, int p_max_size); -void print_pid_vmhwm(struct text_object *obj, char *p, int p_max_size); -void print_pid_vmrss(struct text_object *obj, char *p, int p_max_size); -void print_pid_vmdata(struct text_object *obj, char *p, int p_max_size); -void print_pid_vmstk(struct text_object *obj, char *p, int p_max_size); -void print_pid_vmexe(struct text_object *obj, char *p, int p_max_size); -void print_pid_vmlib(struct text_object *obj, char *p, int p_max_size); -void print_pid_vmpte(struct text_object *obj, char *p, int p_max_size); -void print_pid_write(struct text_object *obj, char *p, int p_max_size); + unsigned int p_max_size); +void print_pid_time_usermode(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_time(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_uid(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_euid(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_suid(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_fsuid(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_gid(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_egid(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_sgid(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_fsgid(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_read(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_vmpeak(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_vmsize(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_vmlck(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_vmhwm(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_vmrss(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_vmdata(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_vmstk(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_vmexe(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_vmlib(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_vmpte(struct text_object *obj, char *p, unsigned int p_max_size); +void print_pid_write(struct text_object *obj, char *p, unsigned int p_max_size); void scan_cmdline_to_pid_arg(struct text_object *obj, const char *arg, void *free_at_crash); -void print_cmdline_to_pid(struct text_object *obj, char *p, int p_max_size); +void print_cmdline_to_pid(struct text_object *obj, char *p, unsigned int p_max_size); #endif /* CONKY_PROC_H */ diff --git a/src/pulseaudio.cc b/src/pulseaudio.cc index 72f19074..34ca4823 100644 --- a/src/pulseaudio.cc +++ b/src/pulseaudio.cc @@ -302,29 +302,29 @@ int puau_muted(struct text_object *obj) { } void print_puau_sink_description(struct text_object *obj, char *p, - int p_max_size) { + unsigned int p_max_size) { snprintf(p, p_max_size, "%s", get_pulseaudio(obj).sink_description.c_str()); } void print_puau_sink_active_port_name(struct text_object *obj, char *p, - int p_max_size) { + unsigned int p_max_size) { snprintf(p, p_max_size, "%s", get_pulseaudio(obj).sink_active_port_name.c_str()); } void print_puau_sink_active_port_description(struct text_object *obj, char *p, - int p_max_size) { + unsigned int p_max_size) { snprintf(p, p_max_size, "%s", get_pulseaudio(obj).sink_active_port_description.c_str()); } void print_puau_card_active_profile(struct text_object *obj, char *p, - int p_max_size) { + unsigned int p_max_size) { snprintf(p, p_max_size, "%s", get_pulseaudio(obj).card_active_profile_description.c_str()); } -void print_puau_card_name(struct text_object *obj, char *p, int p_max_size) { +void print_puau_card_name(struct text_object *obj, char *p, unsigned int p_max_size) { snprintf(p, p_max_size, "%s", get_pulseaudio(obj).card_name.c_str()); } diff --git a/src/pulseaudio.h b/src/pulseaudio.h index f1ee8058..b58a34ff 100644 --- a/src/pulseaudio.h +++ b/src/pulseaudio.h @@ -36,15 +36,11 @@ void init_pulseaudio(struct text_object *obj); void free_pulseaudio(struct text_object *obj); uint8_t puau_vol(struct text_object *); // preserve pa_* for libpulse -void print_puau_sink_description(struct text_object *obj, char *p, - int p_max_size); -void print_puau_sink_active_port_name(struct text_object *obj, char *p, - int p_max_size); -void print_puau_sink_active_port_description(struct text_object *obj, char *p, - int p_max_size); -void print_puau_card_name(struct text_object *obj, char *p, int p_max_size); -void print_puau_card_active_profile(struct text_object *obj, char *p, - int p_max_size); +void print_puau_sink_description(struct text_object *obj, char *p, unsigned int p_max_size); +void print_puau_sink_active_port_name(struct text_object *obj, char *p, unsigned int p_max_size); +void print_puau_sink_active_port_description(struct text_object *obj, char *p, unsigned int p_max_size); +void print_puau_card_name(struct text_object *obj, char *p, unsigned int p_max_size); +void print_puau_card_active_profile(struct text_object *obj, char *p, unsigned int p_max_size); double puau_volumebarval(struct text_object *obj); int puau_muted(struct text_object *obj); diff --git a/src/read_tcpip.cc b/src/read_tcpip.cc index dbfe8565..73cb7dbf 100644 --- a/src/read_tcpip.cc +++ b/src/read_tcpip.cc @@ -109,7 +109,7 @@ void parse_tcp_ping_arg(struct text_object *obj, const char *arg, } } -void print_tcp_ping(struct text_object *obj, char *p, int p_max_size) { +void print_tcp_ping(struct text_object *obj, char *p, unsigned int p_max_size) { struct timeval tv1 { }, tv2{}, timeout{}; auto *addr = static_cast(obj->data.opaque); @@ -214,11 +214,11 @@ void print_read_tcpip(struct text_object *obj, char *p, int p_max_size, close(sock); } -void print_read_tcp(struct text_object *obj, char *p, int p_max_size) { +void print_read_tcp(struct text_object *obj, char *p, unsigned int p_max_size) { print_read_tcpip(obj, p, p_max_size, IPPROTO_TCP); } -void print_read_udp(struct text_object *obj, char *p, int p_max_size) { +void print_read_udp(struct text_object *obj, char *p, unsigned int p_max_size) { print_read_tcpip(obj, p, p_max_size, IPPROTO_UDP); } diff --git a/src/read_tcpip.h b/src/read_tcpip.h index 0cec0ee8..b1e96a1a 100644 --- a/src/read_tcpip.h +++ b/src/read_tcpip.h @@ -33,9 +33,9 @@ void parse_read_tcpip_arg(struct text_object *, const char *, void *); void parse_tcp_ping_arg(struct text_object *obj, const char *arg, void *free_at_crash); -void print_read_tcp(struct text_object *, char *, int); -void print_read_udp(struct text_object *, char *, int); -void print_tcp_ping(struct text_object *, char *, int); +void print_read_tcp(struct text_object *, char *, unsigned int); +void print_read_udp(struct text_object *, char *, unsigned int); +void print_tcp_ping(struct text_object *, char *, unsigned int); void free_read_tcpip(struct text_object *); void free_tcp_ping(struct text_object *); diff --git a/src/rss.cc b/src/rss.cc index 4406cbc2..32272b56 100644 --- a/src/rss.cc +++ b/src/rss.cc @@ -172,7 +172,7 @@ void rss_scan_arg(struct text_object *obj, const char *arg) { obj->data.opaque = rd; } -void rss_print_info(struct text_object *obj, char *p, int p_max_size) { +void rss_print_info(struct text_object *obj, char *p, unsigned int p_max_size) { struct rss_data *rd = (struct rss_data *)obj->data.opaque; if (!rd) { diff --git a/src/rss.h b/src/rss.h index 700a1ff1..d2dc170a 100644 --- a/src/rss.h +++ b/src/rss.h @@ -26,7 +26,7 @@ #define RSS_H_ void rss_scan_arg(struct text_object *, const char *); -void rss_print_info(struct text_object *, char *, int); +void rss_print_info(struct text_object *, char *, unsigned int); void rss_free_obj_info(struct text_object *); #endif /*RSS_H_*/ diff --git a/src/scroll.cc b/src/scroll.cc index 4b7ab48f..45acefcd 100644 --- a/src/scroll.cc +++ b/src/scroll.cc @@ -199,7 +199,7 @@ void parse_scroll_arg(struct text_object *obj, const char *arg, #endif /* BUILD_X11 */ } -void print_scroll(struct text_object *obj, char *p, int p_max_size) { +void print_scroll(struct text_object *obj, char *p, unsigned int p_max_size) { auto *sd = static_cast(obj->data.opaque); unsigned int j, colorchanges = 0, frontcolorchanges = 0, visibcolorchanges = 0, strend; diff --git a/src/scroll.h b/src/scroll.h index 6dc0bb70..9260417a 100644 --- a/src/scroll.h +++ b/src/scroll.h @@ -30,7 +30,7 @@ #define _SCROLL_H void parse_scroll_arg(struct text_object *, const char *, void *, char *); -void print_scroll(struct text_object *, char *, int); +void print_scroll(struct text_object *, char *, unsigned int); void free_scroll(struct text_object *); #endif /* _SCROLL_H */ diff --git a/src/smapi.cc b/src/smapi.cc index ed5b8d28..e37e8bbe 100644 --- a/src/smapi.cc +++ b/src/smapi.cc @@ -110,7 +110,7 @@ static char *smapi_get_val(const char *args) { return smapi_get_str(str); } -void print_smapi(struct text_object *obj, char *p, int p_max_size) { +void print_smapi(struct text_object *obj, char *p, unsigned int p_max_size) { char *s; if (!obj->data.s) return; @@ -132,7 +132,7 @@ uint8_t smapi_bat_percentage(struct text_object *obj) { return val; } -void print_smapi_bat_temp(struct text_object *obj, char *p, int p_max_size) { +void print_smapi_bat_temp(struct text_object *obj, char *p, unsigned int p_max_size) { int idx, val; if (obj->data.s && sscanf(obj->data.s, "%i", &idx) == 1) { val = smapi_bat_installed_internal(idx) @@ -144,7 +144,7 @@ void print_smapi_bat_temp(struct text_object *obj, char *p, int p_max_size) { NORM_ERR("argument to smapi_bat_temp must be an integer"); } -void print_smapi_bat_power(struct text_object *obj, char *p, int p_max_size) { +void print_smapi_bat_power(struct text_object *obj, char *p, unsigned int p_max_size) { int idx, val; if (obj->data.s && sscanf(obj->data.s, "%i", &idx) == 1) { val = smapi_bat_installed_internal(idx) diff --git a/src/smapi.h b/src/smapi.h index e9b52e8a..8fabcdf1 100644 --- a/src/smapi.h +++ b/src/smapi.h @@ -24,10 +24,10 @@ #ifndef _SMAPI_H #define _SMAPI_H -void print_smapi(struct text_object *, char *, int); +void print_smapi(struct text_object *, char *, unsigned int); uint8_t smapi_bat_percentage(struct text_object *); -void print_smapi_bat_temp(struct text_object *, char *, int); -void print_smapi_bat_power(struct text_object *, char *, int); +void print_smapi_bat_temp(struct text_object *, char *, unsigned int); +void print_smapi_bat_power(struct text_object *, char *, unsigned int); double smapi_bat_barval(struct text_object *); int smapi_bat_installed(struct text_object *obj); diff --git a/src/sony.cc b/src/sony.cc index 98c5e424..ff9514a1 100644 --- a/src/sony.cc +++ b/src/sony.cc @@ -44,7 +44,7 @@ * I don't know the exact measurement unit, though. I may assume that 0 for * 'fan stopped' and 255 for 'maximum fan speed'. */ void get_sony_fanspeed(struct text_object *obj, char *p_client_buffer, - int client_buffer_size) { + unsigned int client_buffer_size) { FILE *fp; unsigned int speed = 0; char fan[128]; diff --git a/src/sony.h b/src/sony.h index 942ca167..907fa7a8 100644 --- a/src/sony.h +++ b/src/sony.h @@ -31,6 +31,6 @@ #ifndef _SONY_H #define _SONY_H -void get_sony_fanspeed(struct text_object *, char *, int); +void get_sony_fanspeed(struct text_object *, char *, unsigned int); #endif /* _SONY_H */ diff --git a/src/specials.cc b/src/specials.cc index 0560a138..1118e079 100644 --- a/src/specials.cc +++ b/src/specials.cc @@ -375,7 +375,7 @@ struct special_t *new_special(char *buf, enum special_types t) { return current; } -void new_gauge_in_shell(struct text_object *obj, char *p, int p_max_size, +void new_gauge_in_shell(struct text_object *obj, char *p, unsigned int p_max_size, double usage) { static const char *gaugevals[] = {"_. ", "\\. ", " | ", " ./", " ._"}; auto *g = static_cast(obj->special_data); @@ -405,7 +405,7 @@ void new_gauge_in_x11(struct text_object *obj, char *buf, double usage) { } #endif /* BUILD_X11 */ -void new_gauge(struct text_object *obj, char *p, int p_max_size, double usage) { +void new_gauge(struct text_object *obj, char *p, unsigned int p_max_size, double usage) { auto *g = static_cast(obj->special_data); if ((p_max_size == 0) || (g == nullptr)) { @@ -430,7 +430,7 @@ void new_gauge(struct text_object *obj, char *p, int p_max_size, double usage) { } #ifdef BUILD_X11 -void new_font(struct text_object *obj, char *p, int p_max_size) { +void new_font(struct text_object *obj, char *p, unsigned int p_max_size) { struct special_t *s; int tmp = selected_font; @@ -595,7 +595,7 @@ void new_graph(struct text_object *obj, char *buf, int buf_max_size, } } -void new_hr(struct text_object *obj, char *p, int p_max_size) { +void new_hr(struct text_object *obj, char *p, unsigned int p_max_size) { if (not out_to_x.get(*state)) { return; } @@ -627,7 +627,7 @@ void scan_stippled_hr(struct text_object *obj, const char *arg) { obj->special_data = sh; } -void new_stippled_hr(struct text_object *obj, char *p, int p_max_size) { +void new_stippled_hr(struct text_object *obj, char *p, unsigned int p_max_size) { struct special_t *s = nullptr; auto *sh = static_cast(obj->special_data); @@ -646,7 +646,7 @@ void new_stippled_hr(struct text_object *obj, char *p, int p_max_size) { } #endif /* BUILD_X11 */ -void new_fg(struct text_object *obj, char *p, int p_max_size) { +void new_fg(struct text_object *obj, char *p, unsigned int p_max_size) { #ifdef BUILD_X11 if (out_to_x.get(*state)) { new_special(p, FG)->arg = obj->data.l; @@ -663,7 +663,7 @@ void new_fg(struct text_object *obj, char *p, int p_max_size) { } #ifdef BUILD_X11 -void new_bg(struct text_object *obj, char *p, int p_max_size) { +void new_bg(struct text_object *obj, char *p, unsigned int p_max_size) { if (not out_to_x.get(*state)) { return; } @@ -730,7 +730,7 @@ static void new_bar_in_x11(struct text_object *obj, char *buf, double usage) { #endif /* BUILD_X11 */ /* usage is in range [0,255] */ -void new_bar(struct text_object *obj, char *p, int p_max_size, double usage) { +void new_bar(struct text_object *obj, char *p, unsigned int p_max_size, double usage) { auto *b = static_cast(obj->special_data); if ((p_max_size == 0) || (b == nullptr)) { @@ -754,28 +754,28 @@ void new_bar(struct text_object *obj, char *p, int p_max_size, double usage) { #endif /* BUILD_X11 */ } -void new_outline(struct text_object *obj, char *p, int p_max_size) { +void new_outline(struct text_object *obj, char *p, unsigned int p_max_size) { if (p_max_size == 0) { return; } new_special(p, OUTLINE)->arg = obj->data.l; } -void new_offset(struct text_object *obj, char *p, int p_max_size) { +void new_offset(struct text_object *obj, char *p, unsigned int p_max_size) { if (p_max_size == 0) { return; } new_special(p, OFFSET)->arg = obj->data.l; } -void new_voffset(struct text_object *obj, char *p, int p_max_size) { +void new_voffset(struct text_object *obj, char *p, unsigned int p_max_size) { if (p_max_size == 0) { return; } new_special(p, VOFFSET)->arg = obj->data.l; } -void new_alignr(struct text_object *obj, char *p, int p_max_size) { +void new_alignr(struct text_object *obj, char *p, unsigned int p_max_size) { if (p_max_size == 0) { return; } @@ -783,14 +783,14 @@ void new_alignr(struct text_object *obj, char *p, int p_max_size) { } // A postive offset pushes the text further left -void new_alignc(struct text_object *obj, char *p, int p_max_size) { +void new_alignc(struct text_object *obj, char *p, unsigned int p_max_size) { if (p_max_size == 0) { return; } new_special(p, ALIGNC)->arg = obj->data.l; } -void new_goto(struct text_object *obj, char *p, int p_max_size) { +void new_goto(struct text_object *obj, char *p, unsigned int p_max_size) { if (p_max_size == 0) { return; } @@ -817,7 +817,7 @@ void scan_tab(struct text_object *obj, const char *arg) { obj->special_data = t; } -void new_tab(struct text_object *obj, char *p, int p_max_size) { +void new_tab(struct text_object *obj, char *p, unsigned int p_max_size) { struct special_t *s = nullptr; auto *t = static_cast(obj->special_data); diff --git a/src/specials.h b/src/specials.h index 3de7a50a..ee4cca3e 100644 --- a/src/specials.h +++ b/src/specials.h @@ -92,22 +92,22 @@ void scan_tab(struct text_object *, const char *); void scan_stippled_hr(struct text_object *, const char *); /* printing specials */ -void new_font(struct text_object *, char *, int); +void new_font(struct text_object *, char *, unsigned int); void new_graph(struct text_object *, char *, int, double); -void new_hr(struct text_object *, char *, int); -void new_stippled_hr(struct text_object *, char *, int); +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_fg(struct text_object *, char *, int); -void new_bg(struct text_object *, char *, int); -void new_outline(struct text_object *, char *, int); -void new_offset(struct text_object *, char *, int); -void new_voffset(struct text_object *, char *, int); -void new_alignr(struct text_object *, char *, int); -void new_alignc(struct text_object *, char *, int); -void new_goto(struct text_object *, char *, int); -void new_tab(struct text_object *, char *, int); +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); +void new_offset(struct text_object *, char *, unsigned int); +void new_voffset(struct text_object *, char *, unsigned int); +void new_alignr(struct text_object *, char *, unsigned int); +void new_alignc(struct text_object *, char *, unsigned int); +void new_goto(struct text_object *, char *, unsigned int); +void new_tab(struct text_object *, char *, unsigned int); struct special_t *new_special(char *buf, enum special_types t); diff --git a/src/tailhead.cc b/src/tailhead.cc index a5c1519b..86df7eb0 100644 --- a/src/tailhead.cc +++ b/src/tailhead.cc @@ -118,7 +118,7 @@ void init_tailhead(const char *type, const char *arg, struct text_object *obj, } static void print_tailhead(const char *type, struct text_object *obj, char *p, - int p_max_size) { + unsigned int p_max_size) { int fd, i, endofstring = 0, linescounted = 0; FILE *fp; struct stat st {}; @@ -194,18 +194,18 @@ static void print_tailhead(const char *type, struct text_object *obj, char *p, } } -void print_head(struct text_object *obj, char *p, int p_max_size) { +void print_head(struct text_object *obj, char *p, unsigned int p_max_size) { print_tailhead("head", obj, p, p_max_size); } -void print_tail(struct text_object *obj, char *p, int p_max_size) { +void print_tail(struct text_object *obj, char *p, unsigned int p_max_size) { print_tailhead("tail", obj, p, p_max_size); } /* FIXME: use something more general (see also tail.c, head.c */ #define BUFSZ 0x1000 -void print_lines(struct text_object *obj, char *p, int p_max_size) { +void print_lines(struct text_object *obj, char *p, unsigned int p_max_size) { static int rep = 0; FILE *fp = open_file(obj->data.s, &rep); char buf[BUFSZ]; @@ -228,7 +228,7 @@ void print_lines(struct text_object *obj, char *p, int p_max_size) { fclose(fp); } -void print_words(struct text_object *obj, char *p, int p_max_size) { +void print_words(struct text_object *obj, char *p, unsigned int p_max_size) { static int rep = 0; FILE *fp = open_file(obj->data.s, &rep); char buf[BUFSZ]; diff --git a/src/tailhead.h b/src/tailhead.h index 83b4e6aa..9f7b80e5 100644 --- a/src/tailhead.h +++ b/src/tailhead.h @@ -32,10 +32,10 @@ void free_tailhead(struct text_object *); void init_tailhead(const char *, const char *, struct text_object *, void *); -void print_head(struct text_object *, char *, int); -void print_tail(struct text_object *, char *, int); +void print_head(struct text_object *, char *, unsigned int); +void print_tail(struct text_object *, char *, unsigned int); -void print_lines(struct text_object *, char *, int); -void print_words(struct text_object *, char *, int); +void print_lines(struct text_object *, char *, unsigned int); +void print_words(struct text_object *, char *, unsigned int); #endif /* _TAILHEAD_H */ diff --git a/src/tcp-portmon.cc b/src/tcp-portmon.cc index e8429d71..15ad6ba0 100644 --- a/src/tcp-portmon.cc +++ b/src/tcp-portmon.cc @@ -122,7 +122,7 @@ int tcp_portmon_init(struct text_object *obj, const char *arg) { return 0; } -void tcp_portmon_action(struct text_object *obj, char *p, int p_max_size) { +void tcp_portmon_action(struct text_object *obj, char *p, unsigned int p_max_size) { struct tcp_port_monitor_data *pmd = (tcp_port_monitor_data *)obj->data.opaque; tcp_port_monitor_t *p_monitor; diff --git a/src/tcp-portmon.h b/src/tcp-portmon.h index 8f8cc1d4..b061d510 100644 --- a/src/tcp-portmon.h +++ b/src/tcp-portmon.h @@ -37,7 +37,7 @@ struct tcp_port_monitor_data { struct text_object; int tcp_portmon_init(struct text_object *, const char *); -void tcp_portmon_action(struct text_object *, char *, int); +void tcp_portmon_action(struct text_object *, char *, unsigned int); int tcp_portmon_update(void); int tcp_portmon_clear(void); void tcp_portmon_free(struct text_object *); diff --git a/src/text_object.cc b/src/text_object.cc index e69bb211..f24a6acf 100644 --- a/src/text_object.cc +++ b/src/text_object.cc @@ -41,11 +41,11 @@ int gen_false_iftest(struct text_object *) { return 0; } -void gen_print_nothing(struct text_object *, char *, int) { +void gen_print_nothing(struct text_object *, char *, unsigned int) { // literally does nothing } -void gen_print_obj_data_s(struct text_object *obj, char *p, int p_max_size) { +void gen_print_obj_data_s(struct text_object *obj, char *p, unsigned int p_max_size) { if (obj->data.s == nullptr) { return; } diff --git a/src/text_object.h b/src/text_object.h index 6e879569..01dc3276 100644 --- a/src/text_object.h +++ b/src/text_object.h @@ -37,7 +37,7 @@ /* text object callbacks */ struct obj_cb { /* text object: print obj's output to p */ - void (*print)(struct text_object *obj, char *p, int p_max_size); + void (*print)(struct text_object *obj, char *p, unsigned int p_max_size); /* ifblock object: return zero to trigger jumping */ int (*iftest)(struct text_object *obj); @@ -69,11 +69,11 @@ int gen_false_iftest(struct text_object *); /* generic nothing printer callback printing nothing * used for the endif object */ -void gen_print_nothing(struct text_object *, char *, int); +void gen_print_nothing(struct text_object *, char *, unsigned int); /* generic obj->data.s printer * used by the $text object */ -void gen_print_obj_data_s(struct text_object *, char *, int); +void gen_print_obj_data_s(struct text_object *, char *, unsigned int); class legacy_cb : public conky::callback { typedef conky::callback Base; diff --git a/src/timeinfo.cc b/src/timeinfo.cc index 0f49e774..31d2ec66 100644 --- a/src/timeinfo.cc +++ b/src/timeinfo.cc @@ -78,7 +78,7 @@ void scan_tztime(struct text_object *obj, const char *arg) { obj->data.opaque = ts; } -void print_time(struct text_object *obj, char *p, int p_max_size) { +void print_time(struct text_object *obj, char *p, unsigned int p_max_size) { time_t t = time(nullptr); struct tm *tm = localtime(&t); @@ -86,7 +86,7 @@ void print_time(struct text_object *obj, char *p, int p_max_size) { strftime(p, p_max_size, static_cast(obj->data.opaque), tm); } -void print_utime(struct text_object *obj, char *p, int p_max_size) { +void print_utime(struct text_object *obj, char *p, unsigned int p_max_size) { time_t t = time(nullptr); struct tm *tm = gmtime(&t); @@ -94,7 +94,7 @@ void print_utime(struct text_object *obj, char *p, int p_max_size) { strftime(p, p_max_size, static_cast(obj->data.opaque), tm); } -void print_tztime(struct text_object *obj, char *p, int p_max_size) { +void print_tztime(struct text_object *obj, char *p, unsigned int p_max_size) { char *oldTZ = nullptr; time_t t; struct tm *tm; @@ -312,7 +312,7 @@ static void do_format_time(struct text_object *obj, char *p, } } -void print_format_time(struct text_object *obj, char *p, int p_max_size) { +void print_format_time(struct text_object *obj, char *p, unsigned int p_max_size) { std::unique_ptr buf(new char[max_user_text.get(*state)]); generate_text_internal(buf.get(), max_user_text.get(*state), *obj->sub); diff --git a/src/timeinfo.h b/src/timeinfo.h index 3f141751..5954dac5 100644 --- a/src/timeinfo.h +++ b/src/timeinfo.h @@ -41,10 +41,10 @@ void scan_time(struct text_object *, const char *); void scan_tztime(struct text_object *, const char *); /* print the time */ -void print_time(struct text_object *, char *, int); -void print_utime(struct text_object *, char *, int); -void print_tztime(struct text_object *, char *, int); -void print_format_time(struct text_object *obj, char *p, int p_max_size); +void print_time(struct text_object *, char *, unsigned int); +void print_utime(struct text_object *, char *, unsigned int); +void print_tztime(struct text_object *, char *, unsigned int); +void print_format_time(struct text_object *obj, char *p, unsigned int p_max_size); /* free object data */ void free_time(struct text_object *); diff --git a/src/user.cc b/src/user.cc index 6e24e532..2c8fdc41 100644 --- a/src/user.cc +++ b/src/user.cc @@ -36,7 +36,7 @@ #include "conky.h" #include "logging.h" -void print_uid_name(struct text_object *obj, char *p, int p_max_size) { +void print_uid_name(struct text_object *obj, char *p, unsigned int p_max_size) { struct passwd *pw; uid_t uid; char *firstinvalid; @@ -58,7 +58,7 @@ void print_uid_name(struct text_object *obj, char *p, int p_max_size) { } } -void print_gid_name(struct text_object *obj, char *p, int p_max_size) { +void print_gid_name(struct text_object *obj, char *p, unsigned int p_max_size) { struct group *grp; gid_t gid; char *firstinvalid; diff --git a/src/user.h b/src/user.h index 7c5080f8..e4ecb0da 100644 --- a/src/user.h +++ b/src/user.h @@ -30,7 +30,7 @@ #ifndef _USER_H #define _USER_H -void print_gid_name(struct text_object *obj, char *p, int p_max_size); -void print_uid_name(struct text_object *obj, char *p, int p_max_size); +void print_gid_name(struct text_object *obj, char *p, unsigned int p_max_size); +void print_uid_name(struct text_object *obj, char *p, unsigned int p_max_size); #endif /* _USER_H */ diff --git a/src/users.cc b/src/users.cc index 3e106724..63108f50 100644 --- a/src/users.cc +++ b/src/users.cc @@ -184,27 +184,27 @@ int update_users(void) { return 0; } -void print_user_names(struct text_object *obj, char *p, int p_max_size) { +void print_user_names(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%s", info.users.names); } -void print_user_terms(struct text_object *obj, char *p, int p_max_size) { +void print_user_terms(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%s", info.users.terms); } -void print_user_times(struct text_object *obj, char *p, int p_max_size) { +void print_user_times(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%s", info.users.times); } -void print_user_time(struct text_object *obj, char *p, int p_max_size) { +void print_user_time(struct text_object *obj, char *p, unsigned int p_max_size) { update_user_time(obj->data.s); snprintf(p, p_max_size, "%s", info.users.ctime); } -void print_user_number(struct text_object *obj, char *p, int p_max_size) { +void print_user_number(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%d", info.users.number); } diff --git a/src/users.h b/src/users.h index 31e0f192..7637ce13 100644 --- a/src/users.h +++ b/src/users.h @@ -32,11 +32,11 @@ int update_users(void); -void print_user_names(struct text_object *, char *, int); -void print_user_terms(struct text_object *, char *, int); -void print_user_times(struct text_object *, char *, int); -void print_user_time(struct text_object *, char *, int); -void print_user_number(struct text_object *, char *, int); +void print_user_names(struct text_object *, char *, unsigned int); +void print_user_terms(struct text_object *, char *, unsigned int); +void print_user_times(struct text_object *, char *, unsigned int); +void print_user_time(struct text_object *, char *, unsigned int); +void print_user_number(struct text_object *, char *, unsigned int); void free_user_names(struct text_object *); void free_user_terms(struct text_object *); diff --git a/src/weather.cc b/src/weather.cc index 813f58be..2d2e51f2 100644 --- a/src/weather.cc +++ b/src/weather.cc @@ -943,7 +943,7 @@ void scan_weather_forecast_arg(struct text_object *obj, const char *arg, obj->data.opaque = wfd; } -void print_weather_forecast(struct text_object *obj, char *p, int p_max_size) { +void print_weather_forecast(struct text_object *obj, char *p, unsigned int p_max_size) { struct weather_forecast_data *wfd = (struct weather_forecast_data *)obj->data.opaque; @@ -995,7 +995,7 @@ void scan_weather_arg(struct text_object *obj, const char *arg, obj->data.opaque = wd; } -void print_weather(struct text_object *obj, char *p, int p_max_size) { +void print_weather(struct text_object *obj, char *p, unsigned int p_max_size) { struct weather_data *wd = (struct weather_data *)obj->data.opaque; if (!wd || !wd->uri) { diff --git a/src/weather.h b/src/weather.h index b913e491..40ce50f5 100644 --- a/src/weather.h +++ b/src/weather.h @@ -33,11 +33,11 @@ #ifdef BUILD_WEATHER_XOAP void load_xoap_keys(void); void scan_weather_forecast_arg(struct text_object *, const char *, void *); -void print_weather_forecast(struct text_object *, char *, int); +void print_weather_forecast(struct text_object *, char *, unsigned int); #endif /* BUILD_WEATHER_XOAP */ void scan_weather_arg(struct text_object *, const char *, void *); -void print_weather(struct text_object *, char *, int); +void print_weather(struct text_object *, char *, unsigned int); void free_weather(struct text_object *); #endif /* WEATHER_H_ */ diff --git a/src/x11.cc b/src/x11.cc index 59447016..b6e89fc1 100644 --- a/src/x11.cc +++ b/src/x11.cc @@ -1156,7 +1156,7 @@ void get_x11_desktop_info(Display *current_display, Atom atom) { static const char NOT_IN_X[] = "Not running in X"; -void print_monitor(struct text_object *obj, char *p, int p_max_size) { +void print_monitor(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; if (not out_to_x.get(*state)) { @@ -1166,7 +1166,7 @@ void print_monitor(struct text_object *obj, char *p, int p_max_size) { snprintf(p, p_max_size, "%d", XDefaultScreen(display)); } -void print_monitor_number(struct text_object *obj, char *p, int p_max_size) { +void print_monitor_number(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; if (not out_to_x.get(*state)) { @@ -1176,7 +1176,7 @@ void print_monitor_number(struct text_object *obj, char *p, int p_max_size) { snprintf(p, p_max_size, "%d", XScreenCount(display)); } -void print_desktop(struct text_object *obj, char *p, int p_max_size) { +void print_desktop(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; if (not out_to_x.get(*state)) { @@ -1186,7 +1186,7 @@ void print_desktop(struct text_object *obj, char *p, int p_max_size) { snprintf(p, p_max_size, "%d", info.x11.desktop.current); } -void print_desktop_number(struct text_object *obj, char *p, int p_max_size) { +void print_desktop_number(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; if (not out_to_x.get(*state)) { @@ -1196,7 +1196,7 @@ void print_desktop_number(struct text_object *obj, char *p, int p_max_size) { snprintf(p, p_max_size, "%d", info.x11.desktop.number); } -void print_desktop_name(struct text_object *obj, char *p, int p_max_size) { +void print_desktop_name(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; if (not out_to_x.get(*state)) { @@ -1298,7 +1298,7 @@ void xpmdb_swap_buffers(void) { #endif /* BUILD_XDBE */ #define LOCK_TEMPLATE(func, num) \ -void print_##func(struct text_object *obj, char *p, int p_max_size) { \ +void print_##func(struct text_object *obj, char *p, unsigned int p_max_size) { \ (void)obj; \ XKeyboardState x; \ XGetKeyboardControl(display, &x); \ @@ -1309,7 +1309,7 @@ LOCK_TEMPLATE(num_led, 2) LOCK_TEMPLATE(caps_led, 1) LOCK_TEMPLATE(scroll_led, 4) -void print_kb_layout(struct text_object *obj, char *p, int p_max_size) { +void print_kb_layout(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; char *group = NULL; @@ -1324,7 +1324,7 @@ void print_kb_layout(struct text_object *obj, char *p, int p_max_size) { XFree(group); } -void print_mouse_speed(struct text_object *obj, char *p, int p_max_size) { +void print_mouse_speed(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; int acc_num = 0; int acc_denom = 0; diff --git a/src/x11.h b/src/x11.h index b1d2b46b..69905435 100644 --- a/src/x11.h +++ b/src/x11.h @@ -109,20 +109,20 @@ void set_transparent_background(Window win); void get_x11_desktop_info(Display *current_display, Atom atom); void set_struts(int); -void print_monitor(struct text_object *, char *, int); -void print_monitor_number(struct text_object *, char *, int); -void print_desktop(struct text_object *, char *, int); -void print_desktop_number(struct text_object *, char *, int); -void print_desktop_name(struct text_object *, char *, int); +void print_monitor(struct text_object *, char *, unsigned int); +void print_monitor_number(struct text_object *, char *, unsigned int); +void print_desktop(struct text_object *, char *, unsigned int); +void print_desktop_number(struct text_object *, char *, unsigned int); +void print_desktop_name(struct text_object *, char *, unsigned int); /* Num lock, Scroll lock, Caps Lock */ -void print_num_led(struct text_object *, char *, int); -void print_caps_led(struct text_object *, char *, int); -void print_scroll_led(struct text_object *, char *, int); +void print_num_led(struct text_object *, char *, unsigned int); +void print_caps_led(struct text_object *, char *, unsigned int); +void print_scroll_led(struct text_object *, char *, unsigned int); /* Keyboard layout and mouse speed in percentage */ -void print_kb_layout(struct text_object *, char *, int); -void print_mouse_speed(struct text_object *, char *, int); +void print_kb_layout(struct text_object *, char *, unsigned int); +void print_mouse_speed(struct text_object *, char *, unsigned int); #ifdef BUILD_XDBE void xdbe_swap_buffers(void); diff --git a/src/xmms2.cc b/src/xmms2.cc index 97f6e717..6cee3eb1 100644 --- a/src/xmms2.cc +++ b/src/xmms2.cc @@ -351,20 +351,20 @@ int update_xmms2(void) { return 0; } -void print_xmms2_tracknr(struct text_object *obj, char *p, int p_max_size) { +void print_xmms2_tracknr(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; if (info.xmms2.tracknr != -1) { snprintf(p, p_max_size, "%i", info.xmms2.tracknr); } } -void print_xmms2_elapsed(struct text_object *obj, char *p, int p_max_size) { +void print_xmms2_elapsed(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%02d:%02d", info.xmms2.elapsed / 60000, (info.xmms2.elapsed / 1000) % 60); } -void print_xmms2_duration(struct text_object *obj, char *p, int p_max_size) { +void print_xmms2_duration(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; snprintf(p, p_max_size, "%02d:%02d", info.xmms2.duration / 60000, (info.xmms2.duration / 1000) % 60); @@ -376,7 +376,7 @@ double xmms2_barval(struct text_object *obj) { return info.xmms2.progress; } -void print_xmms2_smart(struct text_object *obj, char *p, int p_max_size) { +void print_xmms2_smart(struct text_object *obj, char *p, unsigned int p_max_size) { (void)obj; int artist_len = strlen(info.xmms2.artist); int title_len = strlen(info.xmms2.title); @@ -390,7 +390,8 @@ void print_xmms2_smart(struct text_object *obj, char *p, int p_max_size) { } #define XMMS2_PRINT_GENERATOR(name, fmt) \ - void print_xmms2_##name(struct text_object *obj, char *p, int p_max_size) { \ + void print_xmms2_##name(struct text_object *obj, char *p, \ + unsigned int p_max_size) { \ (void)obj; \ snprintf(p, p_max_size, fmt, info.xmms2.name); \ } diff --git a/src/xmms2.h b/src/xmms2.h index 32c5145d..5c30d7f9 100644 --- a/src/xmms2.h +++ b/src/xmms2.h @@ -56,25 +56,25 @@ struct xmms2_s { int update_xmms2(void); -void print_xmms2_tracknr(struct text_object *, char *, int); -void print_xmms2_elapsed(struct text_object *, char *, int); -void print_xmms2_duration(struct text_object *, char *, int); +void print_xmms2_tracknr(struct text_object *, char *, unsigned int); +void print_xmms2_elapsed(struct text_object *, char *, unsigned int); +void print_xmms2_duration(struct text_object *, char *, unsigned int); double xmms2_barval(struct text_object *); -void print_xmms2_smart(struct text_object *, char *, int); -void print_xmms2_artist(struct text_object *, char *, int); -void print_xmms2_album(struct text_object *, char *, int); -void print_xmms2_title(struct text_object *, char *, int); -void print_xmms2_genre(struct text_object *, char *, int); -void print_xmms2_comment(struct text_object *, char *, int); -void print_xmms2_url(struct text_object *, char *, int); -void print_xmms2_status(struct text_object *, char *, int); -void print_xmms2_date(struct text_object *, char *, int); -void print_xmms2_bitrate(struct text_object *, char *, int); -void print_xmms2_id(struct text_object *, char *, int); -void print_xmms2_size(struct text_object *, char *, int); -void print_xmms2_playlist(struct text_object *, char *, int); -void print_xmms2_timesplayed(struct text_object *, char *, int); -void print_xmms2_percent(struct text_object *, char *, int); +void print_xmms2_smart(struct text_object *, char *, unsigned int); +void print_xmms2_artist(struct text_object *, char *, unsigned int); +void print_xmms2_album(struct text_object *, char *, unsigned int); +void print_xmms2_title(struct text_object *, char *, unsigned int); +void print_xmms2_genre(struct text_object *, char *, unsigned int); +void print_xmms2_comment(struct text_object *, char *, unsigned int); +void print_xmms2_url(struct text_object *, char *, unsigned int); +void print_xmms2_status(struct text_object *, char *, unsigned int); +void print_xmms2_date(struct text_object *, char *, unsigned int); +void print_xmms2_bitrate(struct text_object *, char *, unsigned int); +void print_xmms2_id(struct text_object *, char *, unsigned int); +void print_xmms2_size(struct text_object *, char *, unsigned int); +void print_xmms2_playlist(struct text_object *, char *, unsigned int); +void print_xmms2_timesplayed(struct text_object *, char *, unsigned int); +void print_xmms2_percent(struct text_object *, char *, unsigned int); int if_xmms2_connected(struct text_object *); void free_xmms2(struct text_object *);