1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-06-02 07:20:47 +00:00

Use unsigned int for p_max_size in obj_cb.print

This commit is contained in:
Nikolas Garofil 2018-08-08 01:22:23 +02:00 committed by Brenden Matthews
parent 29c9d9960b
commit 5dd23796a6
92 changed files with 537 additions and 534 deletions

View File

@ -266,7 +266,7 @@ double apcupsd_loadbarval(struct text_object *obj) {
#define APCUPSD_PRINT_GENERATOR(name, idx) \ #define APCUPSD_PRINT_GENERATOR(name, idx) \
void print_apcupsd_##name(struct text_object *obj, char *p, \ void print_apcupsd_##name(struct text_object *obj, char *p, \
int p_max_size) { \ unsigned int p_max_size) { \
(void)obj; \ (void)obj; \
snprintf(p, p_max_size, "%s", apcupsd.items[APCUPSD_##idx]); \ snprintf(p, p_max_size, "%s", apcupsd.items[APCUPSD_##idx]); \
} }

View File

@ -31,16 +31,16 @@ int update_apcupsd(void);
double apcupsd_loadbarval(struct text_object *); double apcupsd_loadbarval(struct text_object *);
void print_apcupsd_name(struct text_object *, char *, int); void print_apcupsd_name(struct text_object *, char *, unsigned int);
void print_apcupsd_model(struct text_object *, char *, int); void print_apcupsd_model(struct text_object *, char *, unsigned int);
void print_apcupsd_upsmode(struct text_object *, char *, int); void print_apcupsd_upsmode(struct text_object *, char *, unsigned int);
void print_apcupsd_cable(struct text_object *, char *, int); void print_apcupsd_cable(struct text_object *, char *, unsigned int);
void print_apcupsd_status(struct text_object *, char *, int); void print_apcupsd_status(struct text_object *, char *, unsigned int);
void print_apcupsd_linev(struct text_object *, char *, int); void print_apcupsd_linev(struct text_object *, char *, unsigned int);
void print_apcupsd_load(struct text_object *, char *, int); void print_apcupsd_load(struct text_object *, char *, unsigned int);
void print_apcupsd_charge(struct text_object *, char *, int); void print_apcupsd_charge(struct text_object *, char *, unsigned int);
void print_apcupsd_timeleft(struct text_object *, char *, int); void print_apcupsd_timeleft(struct text_object *, char *, unsigned int);
void print_apcupsd_temp(struct text_object *, char *, int); void print_apcupsd_temp(struct text_object *, char *, unsigned int);
void print_apcupsd_lastxfer(struct text_object *, char *, int); void print_apcupsd_lastxfer(struct text_object *, char *, unsigned int);
#endif /*APCUPSD_H_*/ #endif /*APCUPSD_H_*/

View File

@ -192,17 +192,17 @@ aud_result get_res() {
} }
} // namespace } // 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(); const aud_result &res = get_res();
snprintf(p, p_max_size, "%s", as_message[res.status]); 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()); 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, 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", snprintf(p, std::min(obj->data.i, p_max_size), "%s",
get_res().filename.c_str()); get_res().filename.c_str());
} }
@ -213,14 +213,15 @@ double audacious_barval(struct text_object *) {
} }
#define AUDACIOUS_TIME_GENERATOR(name) \ #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(); \ const aud_result &res = get_res(); \
int sec = res.name / 1000; \ int sec = res.name / 1000; \
snprintf(p, p_max_size, "%d:%.2d", sec / 60, sec % 60); \ snprintf(p, p_max_size, "%d:%.2d", sec / 60, sec % 60); \
} \ } \
\ \
void print_audacious_##name##_seconds(struct text_object *, char *p, \ 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); \ snprintf(p, p_max_size, "%d", get_res().name); \
} }
@ -228,7 +229,8 @@ AUDACIOUS_TIME_GENERATOR(length)
AUDACIOUS_TIME_GENERATOR(position) AUDACIOUS_TIME_GENERATOR(position)
#define AUDACIOUS_INT_GENERATOR(name, offset) \ #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); \ snprintf(p, p_max_size, "%d", get_res().name + offset); \
} }

View File

@ -24,19 +24,19 @@
#ifndef AUDACIOUS_H #ifndef AUDACIOUS_H
#define AUDACIOUS_H #define AUDACIOUS_H
void print_audacious_status(struct text_object *, char *, int); void print_audacious_status(struct text_object *, char *, unsigned int);
void print_audacious_title(struct text_object *, char *, int); void print_audacious_title(struct text_object *, char *, unsigned int);
void print_audacious_length(struct text_object *, char *, int); void print_audacious_length(struct text_object *, char *, unsigned int);
void print_audacious_length_seconds(struct text_object *, char *, int); void print_audacious_length_seconds(struct text_object *, char *, unsigned int);
void print_audacious_position(struct text_object *, char *, int); void print_audacious_position(struct text_object *, char *, unsigned int);
void print_audacious_position_seconds(struct text_object *, char *, int); void print_audacious_position_seconds(struct text_object *, char *, unsigned int);
void print_audacious_bitrate(struct text_object *, char *, int); void print_audacious_bitrate(struct text_object *, char *, unsigned int);
void print_audacious_frequency(struct text_object *, char *, int); void print_audacious_frequency(struct text_object *, char *, unsigned int);
void print_audacious_channels(struct text_object *, char *, int); void print_audacious_channels(struct text_object *, char *, unsigned int);
void print_audacious_filename(struct text_object *, char *, int); void print_audacious_filename(struct text_object *, char *, unsigned int);
void print_audacious_playlist_length(struct text_object *, char *, int); void print_audacious_playlist_length(struct text_object *, char *, unsigned int);
void print_audacious_playlist_position(struct text_object *, char *, int); void print_audacious_playlist_position(struct text_object *, char *, unsigned int);
void print_audacious_main_volume(struct text_object *, char *, int); void print_audacious_main_volume(struct text_object *, char *, unsigned int);
double audacious_barval(struct text_object *); double audacious_barval(struct text_object *);
#endif /* AUDACIOUS_H */ #endif /* AUDACIOUS_H */

View File

@ -198,7 +198,7 @@ void curl_parse_arg(struct text_object *obj, const char *arg) {
obj->data.opaque = cd; 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; struct curl_data *cd = (struct curl_data *)obj->data.opaque;
if (!cd || !cd->uri) { if (!cd || !cd->uri) {

View File

@ -84,7 +84,7 @@ void ccurl_process_info(char *p, int p_max_size, const std::string &uri,
int interval); int interval);
void curl_parse_arg(struct text_object *, const char *); 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 *); void curl_obj_free(struct text_object *);
/* $curl exports end */ /* $curl exports end */

View File

@ -137,7 +137,8 @@ void cmus_cb::work() {
} // namespace } // namespace
#define CMUS_PRINT_GENERATOR(type, alt) \ #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; \ (void)obj; \
uint32_t period = std::max( \ uint32_t period = std::max( \
lround(music_player_interval.get(*state) / active_update_interval()), \ lround(music_player_interval.get(*state) / active_update_interval()), \
@ -178,7 +179,7 @@ double cmus_progress(struct text_object *obj) {
return (double)cmus.progress; 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; (void)obj;
uint32_t period = std::max( uint32_t period = std::max(
lround(music_player_interval.get(*state) / active_update_interval()), 1l); 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())); 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; (void)obj;
uint32_t period = std::max( uint32_t period = std::max(
lround(music_player_interval.get(*state) / active_update_interval()), 1l); 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); 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; (void)obj;
uint32_t period = std::max( uint32_t period = std::max(
lround(music_player_interval.get(*state) / active_update_interval()), 1l); lround(music_player_interval.get(*state) / active_update_interval()), 1l);

View File

@ -23,21 +23,21 @@
#ifndef CMUS_H_ #ifndef CMUS_H_
#define CMUS_H_ #define CMUS_H_
void print_cmus_state(struct text_object *, char *, int); void print_cmus_state(struct text_object *, char *, unsigned int);
void print_cmus_file(struct text_object *, char *, int); void print_cmus_file(struct text_object *, char *, unsigned int);
void print_cmus_title(struct text_object *, char *, int); void print_cmus_title(struct text_object *, char *, unsigned int);
void print_cmus_artist(struct text_object *, char *, int); void print_cmus_artist(struct text_object *, char *, unsigned int);
void print_cmus_album(struct text_object *, char *, int); void print_cmus_album(struct text_object *, char *, unsigned int);
void print_cmus_totaltime(struct text_object *, char *, int); void print_cmus_totaltime(struct text_object *, char *, unsigned int);
void print_cmus_timeleft(struct text_object *, char *, int); void print_cmus_timeleft(struct text_object *, char *, unsigned int);
void print_cmus_curtime(struct text_object *, char *, int); void print_cmus_curtime(struct text_object *, char *, unsigned int);
void print_cmus_random(struct text_object *, char *, int); void print_cmus_random(struct text_object *, char *, unsigned int);
void print_cmus_repeat(struct text_object *, char *, int); void print_cmus_repeat(struct text_object *, char *, unsigned int);
void print_cmus_aaa(struct text_object *, char *, int); void print_cmus_aaa(struct text_object *, char *, unsigned int);
void print_cmus_track(struct text_object *, char *, int); void print_cmus_track(struct text_object *, char *, unsigned int);
void print_cmus_genre(struct text_object *, char *, int); void print_cmus_genre(struct text_object *, char *, unsigned int);
void print_cmus_date(struct text_object *, char *, int); void print_cmus_date(struct text_object *, char *, unsigned int);
void print_cmus_bar(struct text_object *, char *, int); void print_cmus_bar(struct text_object *, char *, unsigned int);
double cmus_progress(struct text_object *obj); double cmus_progress(struct text_object *obj);
uint8_t cmus_percent(struct text_object *obj); uint8_t cmus_percent(struct text_object *obj);

View File

@ -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<struct combine_data *>(obj->data.opaque); auto *cd = static_cast<struct combine_data *>(obj->data.opaque);
std::vector<std::vector<char>> buf; std::vector<std::vector<char>> buf;
buf.resize(2); buf.resize(2);

View File

@ -30,7 +30,7 @@
#define _COMBINE_H #define _COMBINE_H
void parse_combine_arg(struct text_object *, const char *); 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 *); void free_combine(struct text_object *);
#endif /* _COMBINE_H */ #endif /* _COMBINE_H */

View File

@ -332,7 +332,7 @@ void scan_loadavg_arg(struct text_object *obj, const char *arg) {
obj->data.i--; 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; float *v = info.loadavg;
if (obj->data.i < 0) { 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 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); 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) \ #define PRINT_HR_GENERATOR(name) \
void print_##name(struct text_object *obj, char *p, int p_max_size) { \ void print_##name(struct text_object *obj, char *p, \
human_readable(apply_base_multiplier(obj->data.s, info.name), p, p_max_size); \ unsigned int p_max_size) { \
human_readable(apply_base_multiplier(obj->data.s, info.name), p, \
p_max_size); \
} }
PRINT_HR_GENERATOR(mem) PRINT_HR_GENERATOR(mem)
@ -437,22 +439,22 @@ double swap_barval(struct text_object *obj) {
: 0; : 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; (void)obj;
snprintf(p, p_max_size, "%s", info.uname_s.release); 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; (void)obj;
snprintf(p, p_max_size, "%s", info.uname_s.machine); 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; (void)obj;
snprintf(p, p_max_size, "%s", info.uname_s.nodename); 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; (void)obj;
snprintf(p, p_max_size, "%s", info.uname_s.nodename); snprintf(p, p_max_size, "%s", info.uname_s.nodename);
for (int i = 0; p[i] != 0; i++) { 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; (void)obj;
snprintf(p, p_max_size, "%s", info.uname_s.sysname); snprintf(p, p_max_size, "%s", info.uname_s.sysname);
} }
#if defined(__DragonFly__) #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; (void)obj;
snprintf(p, p_max_size, "%s", info.uname_v); snprintf(p, p_max_size, "%s", info.uname_v);
} }
#endif #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; (void)obj;
format_seconds(p, p_max_size, static_cast<int>(info.uptime)); format_seconds(p, p_max_size, static_cast<int>(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; (void)obj;
format_seconds_short(p, p_max_size, static_cast<int>(info.uptime)); format_seconds_short(p, p_max_size, static_cast<int>(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; (void)obj;
spaced_print(p, p_max_size, "%hu", 4, info.procs); 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; (void)obj;
spaced_print(p, p_max_size, "%hu", 4, info.run_procs); 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; (void)obj;
spaced_print(p, p_max_size, "%hu", 4, info.run_threads); 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; (void)obj;
spaced_print(p, p_max_size, "%hu", 4, info.threads); 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); 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); 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<char> buf(text_buffer_size.get(*state)); std::vector<char> buf(text_buffer_size.get(*state));
evaluate(obj->data.s, &buf[0], buf.size()); evaluate(obj->data.s, &buf[0], buf.size());
evaluate(&buf[0], p, p_max_size); evaluate(&buf[0], p, p_max_size);
@ -582,21 +584,21 @@ int if_running_iftest(struct text_object *obj) {
} }
#ifndef __OpenBSD__ #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); 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); } void free_acpitemp(struct text_object *obj) { close(obj->data.i); }
#endif /* !__OpenBSD__ */ #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; static int ok = 1;
if (ok != 0) { if (ok != 0) {
ok = get_freq(p, p_max_size, "%.0f", 1, obj->data.i); 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; static int ok = 1;
if (ok != 0) { if (ok != 0) {
#ifndef __OpenBSD__ #ifndef __OpenBSD__
@ -609,21 +611,21 @@ void print_freq_g(struct text_object *obj, char *p, int p_max_size) {
} }
#ifndef __OpenBSD__ #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; (void)obj;
get_acpi_fan(p, p_max_size); 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, get_acpi_ac_adapter(p, p_max_size,
static_cast<const char *>(obj->data.opaque)); static_cast<const char *>(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); 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); 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); 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); get_battery_short_status(p, p_max_size, obj->data.s);
} }
#endif /* !__OpenBSD__ */ #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 // blinking like this can look a bit ugly if the chars in the font don't have
// the same width // the same width
std::vector<char> buf(max_user_text.get(*state)); std::vector<char> 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<int>(static_cast<int>(visible) == 0); visible = static_cast<int>(static_cast<int>(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<char> buf(max_user_text.get(*state)); std::vector<char> buf(max_user_text.get(*state));
if (obj->sub == nullptr) { if (obj->sub == nullptr) {
@ -669,7 +671,7 @@ void print_include(struct text_object *obj, char *p, int p_max_size) {
} }
#ifdef BUILD_CURL #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) { if (!obj->data.s) {
p[0] = 0; p[0] = 0;
return; 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); } void free_stock(struct text_object *obj) { free(obj->data.s); }
#endif /* BUILD_CURL */ #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<char> buf(max_user_text.get(*state)); std::vector<char> buf(max_user_text.get(*state));
long double bytes; long double bytes;
char unit[16]; // 16 because we can also have long names (like mega-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])); 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; (void)obj;
snprintf(p, p_max_size, "%d", get_total_updates()); snprintf(p, p_max_size, "%d", get_total_updates());
} }

View File

@ -35,7 +35,7 @@
char *readfile(const char *filename, int *total_read, char showerror); 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); void strfold(char *start, int count);
int check_mount(struct text_object *); int check_mount(struct text_object *);
@ -50,8 +50,8 @@ int update_threads(void);
int update_running_processes(void); int update_running_processes(void);
void update_stuff(void); void update_stuff(void);
char get_freq(char *, size_t, const char *, int, unsigned int); char get_freq(char *, size_t, const char *, int, unsigned int);
void print_voltage_mv(struct text_object *, char *, int); void print_voltage_mv(struct text_object *, char *, unsigned int);
void print_voltage_v(struct text_object *, char *, int); void print_voltage_v(struct text_object *, char *, unsigned int);
int update_load_average(void); int update_load_average(void);
void free_all_processes(void); void free_all_processes(void);
struct process *get_first_process(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 get_battery_short_status(char *buf, unsigned int n, const char *bat);
void scan_no_update(struct text_object *, const char *); 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 free_no_update(struct text_object *);
void scan_loadavg_arg(struct text_object *, const char *); 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 #ifdef BUILD_X11
void scan_loadgraph_arg(struct text_object *, const char *); void scan_loadgraph_arg(struct text_object *, const char *);
double loadgraphval(struct text_object *); double loadgraphval(struct text_object *);
@ -99,75 +99,75 @@ double loadgraphval(struct text_object *);
uint8_t cpu_percentage(struct text_object *); uint8_t cpu_percentage(struct text_object *);
double cpu_barval(struct text_object *); double cpu_barval(struct text_object *);
void print_mem(struct text_object *, char *, int); void print_mem(struct text_object *, char *, unsigned int);
void print_memwithbuffers(struct text_object *, char *, int); void print_memwithbuffers(struct text_object *, char *, unsigned int);
void print_memeasyfree(struct text_object *, char *, int); void print_memeasyfree(struct text_object *, char *, unsigned int);
void print_memfree(struct text_object *, char *, int); void print_memfree(struct text_object *, char *, unsigned int);
void print_memmax(struct text_object *, char *, int); void print_memmax(struct text_object *, char *, unsigned int);
void print_memdirty(struct text_object *, char *, int); void print_memdirty(struct text_object *, char *, unsigned int);
void print_swap(struct text_object *, char *, int); void print_swap(struct text_object *, char *, unsigned int);
void print_swapfree(struct text_object *, char *, int); void print_swapfree(struct text_object *, char *, unsigned int);
void print_swapmax(struct text_object *, char *, int); void print_swapmax(struct text_object *, char *, unsigned int);
uint8_t mem_percentage(struct text_object *); uint8_t mem_percentage(struct text_object *);
double mem_barval(struct text_object *); double mem_barval(struct text_object *);
double mem_with_buffers_barval(struct text_object *); double mem_with_buffers_barval(struct text_object *);
uint8_t swap_percentage(struct text_object *); uint8_t swap_percentage(struct text_object *);
double swap_barval(struct text_object *); double swap_barval(struct text_object *);
void print_kernel(struct text_object *, char *, int); void print_kernel(struct text_object *, char *, unsigned int);
void print_machine(struct text_object *, char *, int); void print_machine(struct text_object *, char *, unsigned int);
void print_nodename(struct text_object *, char *, int); void print_nodename(struct text_object *, char *, unsigned int);
void print_nodename_short(struct text_object *, char *, int); void print_nodename_short(struct text_object *, char *, unsigned int);
void print_sysname(struct text_object *, char *, int); void print_sysname(struct text_object *, char *, unsigned int);
#if defined(__DragonFly__) #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 #endif
void print_uptime(struct text_object *, char *, int); void print_uptime(struct text_object *, char *, unsigned int);
void print_uptime_short(struct text_object *, char *, int); void print_uptime_short(struct text_object *, char *, unsigned int);
void print_processes(struct text_object *, char *, int); void print_processes(struct text_object *, char *, unsigned int);
void print_running_processes(struct text_object *, char *, int); void print_running_processes(struct text_object *, char *, unsigned int);
void print_running_threads(struct text_object *, char *, int); void print_running_threads(struct text_object *, char *, unsigned int);
void print_threads(struct text_object *, char *, int); void print_threads(struct text_object *, char *, unsigned int);
void print_buffers(struct text_object *, char *, int); void print_buffers(struct text_object *, char *, unsigned int);
void print_cached(struct text_object *, char *, 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_empty_iftest(struct text_object *);
int if_existing_iftest(struct text_object *); int if_existing_iftest(struct text_object *);
int if_running_iftest(struct text_object *); int if_running_iftest(struct text_object *);
#ifndef __OpenBSD__ #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 *); void free_acpitemp(struct text_object *);
#endif /* !__OpenBSD__ */ #endif /* !__OpenBSD__ */
void print_freq(struct text_object *, char *, int); void print_freq(struct text_object *, char *, unsigned int);
void print_freq_g(struct text_object *, char *, int); void print_freq_g(struct text_object *, char *, unsigned int);
#ifndef __OpenBSD__ #ifndef __OpenBSD__
void print_acpifan(struct text_object *, char *, int); void print_acpifan(struct text_object *, char *, unsigned int);
void print_acpiacadapter(struct text_object *, char *, int); void print_acpiacadapter(struct text_object *, char *, unsigned int);
void print_battery(struct text_object *, char *, int); void print_battery(struct text_object *, char *, unsigned int);
void print_battery_time(struct text_object *, char *, int); void print_battery_time(struct text_object *, char *, unsigned int);
uint8_t battery_percentage(struct text_object *); 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__ */ #endif /* !__OpenBSD__ */
void free_cpu(struct text_object *); void free_cpu(struct text_object *);
void print_blink(struct text_object *, char *, int); void print_blink(struct text_object *, char *, unsigned int);
void print_include(struct text_object *, char *, 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 *); int updatenr_iftest(struct text_object *);
#ifdef BUILD_CURL #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 *); void free_stock(struct text_object *);
#endif /* BUILD_CURL */ #endif /* BUILD_CURL */
#endif /* _COMMON_H */ #endif /* _COMMON_H */

View File

@ -131,7 +131,7 @@ seeya:
} }
void 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 x = 0;
uintmax_t z = 0; uintmax_t z = 0;
struct timespec tc = {0L, 0L}; 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)); 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; (void)obj;
get_cpu_clock_speed(p, p_max_size); get_cpu_clock_speed(p, p_max_size);
} }

View File

@ -32,9 +32,9 @@
#ifdef __x86_64__ #ifdef __x86_64__
uintmax_t rdtsc(void); 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); 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 /* __x86_64__ */
#endif /* _CPU_H */ #endif /* _CPU_H */

View File

@ -129,7 +129,7 @@ void parse_diskio_arg(struct text_object *obj, const char *arg) {
* 1: write * 1: write
*/ */
static void print_diskio_dir(struct text_object *obj, int dir, char *p, 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<struct diskio_stat *>(obj->data.opaque); auto *diskio = static_cast<struct diskio_stat *>(obj->data.opaque);
double val; 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); 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); 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); 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); print_diskio_dir(obj, 1, p, p_max_size);
} }

View File

@ -68,9 +68,9 @@ void clear_diskio_stats(void);
void update_diskio_values(struct diskio_stat *, unsigned int, unsigned int); void update_diskio_values(struct diskio_stat *, unsigned int, unsigned int);
void parse_diskio_arg(struct text_object *, const char *); void parse_diskio_arg(struct text_object *, const char *);
void print_diskio(struct text_object *, char *, int); void print_diskio(struct text_object *, char *, unsigned int);
void print_diskio_read(struct text_object *, char *, int); void print_diskio_read(struct text_object *, char *, unsigned int);
void print_diskio_write(struct text_object *, char *, int); void print_diskio_write(struct text_object *, char *, unsigned int);
#ifdef BUILD_X11 #ifdef BUILD_X11
void parse_diskiograph_arg(struct text_object *, const char *); void parse_diskiograph_arg(struct text_object *, const char *);
double diskiographval(struct text_object *); double diskiographval(struct text_object *);

View File

@ -64,7 +64,7 @@ int update_entropy() {
return 0; 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; (void)obj;
snprintf(p, p_max_size, "%u", entropy.avail); snprintf(p, p_max_size, "%u", entropy.avail);
} }
@ -75,7 +75,7 @@ uint8_t entropy_percentage(struct text_object *obj) {
static_cast<double>(entropy.poolsize)); static_cast<double>(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; (void)obj;
snprintf(p, p_max_size, "%u", entropy.poolsize); snprintf(p, p_max_size, "%u", entropy.poolsize);
} }
@ -86,7 +86,7 @@ double entropy_barval(struct text_object *obj) {
return static_cast<double>(entropy.avail) / entropy.poolsize; return static_cast<double>(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; time_t t;
static const char letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&*()_"; static const char letters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&*()_";
static const int len = (int)sizeof(letters) - 1; static const int len = (int)sizeof(letters) - 1;

View File

@ -32,10 +32,10 @@
int update_entropy(void); 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 *); 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 *); 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 */ #endif /* _ENTROPY_H */

View File

@ -438,7 +438,7 @@ void scan_eve(struct text_object *obj, const char *arg) {
obj->data.opaque = ed; 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; struct eve_data *ed = (struct eve_data *)obj->data.opaque;
if (!ed) return; if (!ed) return;

View File

@ -32,7 +32,7 @@
#define TRAINING_INACTIVE "" #define TRAINING_INACTIVE ""
void scan_eve(struct text_object *, const char *); 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 *); void free_eve(struct text_object *);
#endif /* _EVE_H */ #endif /* _EVE_H */

View File

@ -191,7 +191,7 @@ static inline double get_barnum(const char *buf) {
* @param[in] p_max_size the maximum size of p... * @param[in] p_max_size the maximum size of p...
*/ */
void fill_p(const char *buffer, struct text_object *obj, char *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) { if (obj->parse) {
evaluate(buffer, p, p_max_size); evaluate(buffer, p, p_max_size);
} else { } else {
@ -300,7 +300,7 @@ void register_execi(struct text_object *obj) {
* @param[out] p the string in which we store command output * @param[out] p the string in which we store command output
* @param[in] p_max_size the maximum size of p... * @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) { if (obj->exec_handle != nullptr) {
fill_p((*obj->exec_handle)->get_result_copy().c_str(), obj, p, p_max_size); fill_p((*obj->exec_handle)->get_result_copy().c_str(), obj, p, p_max_size);
} }

View File

@ -75,7 +75,7 @@ enum {
void scan_exec_arg(struct text_object *, const char *, unsigned int); void scan_exec_arg(struct text_object *, const char *, unsigned int);
void register_exec(struct text_object *); void register_exec(struct text_object *);
void register_execi(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 *); double execbarval(struct text_object *);
void free_exec(struct text_object *); void free_exec(struct text_object *);
void free_execi(struct text_object *); void free_execi(struct text_object *);

View File

@ -253,7 +253,8 @@ uint8_t fs_used_percentage(struct text_object *obj) {
} }
#define HUMAN_PRINT_FS_GENERATOR(name, expr) \ #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; \ struct fs_stat *fs = (struct fs_stat *)obj->data.opaque; \
if (fs) human_readable(expr, p, p_max_size); \ 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(size, fs->size)
HUMAN_PRINT_FS_GENERATOR(used, fs->size - fs->free) 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<struct fs_stat *>(obj->data.opaque); auto *fs = static_cast<struct fs_stat *>(obj->data.opaque);
if (fs != nullptr) { snprintf(p, p_max_size, "%s", fs->type); } if (fs != nullptr) { snprintf(p, p_max_size, "%s", fs->type); }

View File

@ -52,10 +52,10 @@ double fs_free_barval(struct text_object *);
void init_fs(struct text_object *, const char *); void init_fs(struct text_object *, const char *);
uint8_t fs_free_percentage(struct text_object *); uint8_t fs_free_percentage(struct text_object *);
uint8_t fs_used_percentage(struct text_object *); uint8_t fs_used_percentage(struct text_object *);
void print_fs_free(struct text_object *, char *, int); void print_fs_free(struct text_object *, char *, unsigned int);
void print_fs_size(struct text_object *, char *, int); void print_fs_size(struct text_object *, char *, unsigned int);
void print_fs_used(struct text_object *, char *, int); void print_fs_used(struct text_object *, char *, unsigned int);
void print_fs_type(struct text_object *, char *, int); void print_fs_type(struct text_object *, char *, unsigned int);
int update_fs_stats(void); int update_fs_stats(void);
struct fs_stat *prepare_fs_stat(const char *s); struct fs_stat *prepare_fs_stat(const char *s);

View File

@ -220,7 +220,7 @@ static int get_hddtemp_info(const char *dev, short *val, char *unit) {
return 0; 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; short val;
char unit; char unit;

View File

@ -28,6 +28,6 @@
int update_hddtemp(void); int update_hddtemp(void);
void free_hddtemp(struct text_object *); 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_*/ #endif /*HDDTEMP_H_*/

View File

@ -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, void print_i8k_left_fan_status(struct text_object *obj, char *p,
int p_max_size) { unsigned int p_max_size) {
(void)obj; (void)obj;
print_i8k_fan_status(p, p_max_size, i8k.left_fan_status); 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; int cpu_temp;
(void)obj; (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, void print_i8k_right_fan_status(struct text_object *obj, char *p,
int p_max_size) { unsigned int p_max_size) {
(void)obj; (void)obj;
print_i8k_fan_status(p, p_max_size, i8k.right_fan_status); 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; int ac_status;
(void)obj; (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) \ #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; \ (void)obj; \
snprintf(p, p_max_size, "%s", i8k.name); \ snprintf(p, p_max_size, "%s", i8k.name); \
} }

View File

@ -32,15 +32,15 @@
#define _I8K_H #define _I8K_H
int update_i8k(void); int update_i8k(void);
void print_i8k_left_fan_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 *, int); void print_i8k_cpu_temp(struct text_object *, char *, unsigned int);
void print_i8k_right_fan_status(struct text_object *, char *, int); void print_i8k_right_fan_status(struct text_object *, char *, unsigned int);
void print_i8k_ac_status(struct text_object *, char *, int); void print_i8k_ac_status(struct text_object *, char *, unsigned int);
void print_i8k_version(struct text_object *, char *, int); void print_i8k_version(struct text_object *, char *, unsigned int);
void print_i8k_bios(struct text_object *, char *, int); void print_i8k_bios(struct text_object *, char *, unsigned int);
void print_i8k_serial(struct text_object *, char *, int); void print_i8k_serial(struct text_object *, char *, unsigned int);
void print_i8k_left_fan_rpm(struct text_object *, char *, int); void print_i8k_left_fan_rpm(struct text_object *, char *, unsigned int);
void print_i8k_right_fan_rpm(struct text_object *, char *, int); void print_i8k_right_fan_rpm(struct text_object *, char *, unsigned int);
void print_i8k_buttons_status(struct text_object *, char *, int); void print_i8k_buttons_status(struct text_object *, char *, unsigned int);
#endif /* _I8K_H */ #endif /* _I8K_H */

View File

@ -72,7 +72,7 @@ speed: 2944
commands: enable, disable commands: enable, disable
* Peter Tarjan (ptarjan@citromail.hu) */ * 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; FILE *fp;
unsigned int speed = 0; unsigned int speed = 0;
char fan[128]; char fan[128];
@ -171,7 +171,7 @@ commands: up, down, mute
commands: level <level> (<level> is 0-15) commands: level <level> (<level> is 0-15)
* Peter Tarjan (ptarjan@citromail.hu) */ * 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; FILE *fp;
char volume[128]; char volume[128];
unsigned int vol = -1; unsigned int vol = -1;
@ -226,7 +226,7 @@ commands: up, down
commands: level <level> (<level> is 0-7) commands: level <level> (<level> is 0-7)
* Peter Tarjan (ptarjan@citromail.hu) */ * 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; FILE *fp;
unsigned int brightness = 0; unsigned int brightness = 0;
char filename[128]; char filename[128];
@ -271,7 +271,7 @@ commands: on, off
* get "unknown" for a few models that do not make the status available. * get "unknown" for a few models that do not make the status available.
* Lluis Esquerda (eskerda@gmail.com) */ * 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; FILE *fp;
char thinklight[8]; char thinklight[8];
char filename[128]; char filename[128];
@ -317,6 +317,6 @@ void parse_ibm_temps_arg(struct text_object *obj, const char *arg) {
obj->data.l = atoi(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); temp_print(p, p_max_size, ibm_acpi_temps[obj->data.l], TEMP_CELSIUS, 1);
} }

View File

@ -25,13 +25,13 @@
#ifndef _IBM_H #ifndef _IBM_H
#define _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); int get_ibm_acpi_temps(void);
void get_ibm_acpi_volume(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 *, int); void get_ibm_acpi_brightness(struct text_object *, char *, unsigned int);
void get_ibm_acpi_thinklight(struct text_object *, char *, int); void get_ibm_acpi_thinklight(struct text_object *, char *, unsigned int);
void parse_ibm_temps_arg(struct text_object *, const char *); 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 */ #endif /* _IBM_H */

View File

@ -156,7 +156,7 @@ void parse_ical_args(struct text_object *obj, const char *arg,
obj->data.opaque = opaque; 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 obj_ical *ical_obj = (struct obj_ical *)obj->data.opaque;
struct ical_event *ll_current; struct ical_event *ll_current;

View File

@ -26,7 +26,7 @@
#define ICAL_H_ #define ICAL_H_
void parse_ical_args(struct text_object *, const char *, void *, void *); 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 *); void free_ical(struct text_object *);
#endif /*ICAL_H_*/ #endif /*ICAL_H_*/

View File

@ -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 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;
(void)p_max_size; (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; 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)obj;
(void)p; (void)p;
(void)p_max_size; (void)p_max_size;

View File

@ -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_start(struct text_object *, void *, const char *);
void init_iconv_stop(void); void init_iconv_stop(void);
void print_iconv_start(struct text_object *, char *, int); void print_iconv_start(struct text_object *, char *, unsigned int);
void print_iconv_stop(struct text_object *, char *, int); void print_iconv_stop(struct text_object *, char *, unsigned int);
#endif /* _ICONV_TOOLS_H */ #endif /* _ICONV_TOOLS_H */

View File

@ -286,6 +286,6 @@ void cimlib_render(int x, int y, int width, int height) {
} }
void print_image_callback(struct text_object *obj, char *, void print_image_callback(struct text_object *obj, char *,
int) { unsigned int) {
cimlib_add_image(obj->data.s); cimlib_add_image(obj->data.s);
} }

View File

@ -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_render(int x, int y, int width, int height);
void cimlib_cleanup(void); 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 class imlib_cache_size_setting
: public conky::range_config_setting<unsigned long> { : public conky::range_config_setting<unsigned long> {

View File

@ -189,7 +189,7 @@ void parse_irc_args(struct text_object *obj, const char *arg) {
obj->data.opaque = opaque; 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 obj_irc *ircobj = (struct obj_irc *)obj->data.opaque;
struct ctx *ctxptr; struct ctx *ctxptr;
struct ll_text *nextmsg, *curmsg; struct ll_text *nextmsg, *curmsg;

View File

@ -26,7 +26,7 @@
#define IRC_H_ #define IRC_H_
void parse_irc_args(struct text_object *, const char *); 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 *); void free_irc(struct text_object *);
#endif /*IRC_H_*/ #endif /*IRC_H_*/

View File

@ -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, 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; const void *get;
size_t length; size_t length;
size_t fieldlen = strlen(field) + 1; size_t fieldlen = strlen(field) + 1;

View File

@ -32,6 +32,6 @@
void free_journal(struct text_object *); void free_journal(struct text_object *);
void init_journal(const char *, const char *, struct text_object *, void *); 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 */ #endif /* _JOURNAL_H */

View File

@ -223,7 +223,7 @@ int update_meminfo(void) {
return 0; 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; FILE *fp;
int val = -1; 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 * # cat /sys/block/sda/queue/scheduler
* noop [anticipatory] cfq * 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; FILE *fp;
char buf[128]; char buf[128];
@ -339,13 +339,13 @@ int gateway_exists(struct text_object *obj) {
return !!gw_info.count; 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; (void)obj;
snprintf(p, p_max_size, "%s", gw_info.iface); 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; (void)obj;
snprintf(p, p_max_size, "%s", gw_info.ip); 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(hwmon, "/sys/class/hwmon/")
PARSER_GENERATOR(platform, "/sys/bus/platform/devices/") 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; double r;
struct sysfs *sf = (struct sysfs *)obj->data.opaque; 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; 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; static int ok = 1;
if (ok) { ok = get_voltage(p, p_max_size, "%.0f", 1, obj->data.i); } 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; static int ok = 1;
if (ok) { ok = get_voltage(p, p_max_size, "%'.3f", 1000, obj->data.i); } 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, void print_disk_protect_queue(struct text_object *obj, char *p,
int p_max_size) { unsigned int p_max_size) {
FILE *fp; FILE *fp;
char path[128]; char path[128];
int state; int state;
@ -2466,7 +2466,7 @@ int update_diskio(void) {
return 0; 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; (void)obj;
int i, bytes_read; int i, bytes_read;
char *buf; char *buf;

View File

@ -27,24 +27,24 @@
#include "common.h" #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_ioscheduler(struct text_object *, char *, unsigned int);
void print_laptop_mode(struct text_object *, char *, int); void print_laptop_mode(struct text_object *, char *, unsigned int);
int update_gateway_info(void); int update_gateway_info(void);
void free_gateway_info(struct text_object *obj); void free_gateway_info(struct text_object *obj);
int gateway_exists(struct text_object *); int gateway_exists(struct text_object *);
void print_gateway_iface(struct text_object *, char *, int); void print_gateway_iface(struct text_object *, char *, unsigned int);
void print_gateway_ip(struct text_object *, char *, int); void print_gateway_ip(struct text_object *, char *, unsigned int);
enum { PB_BATT_STATUS, PB_BATT_PERCENT, PB_BATT_TIME }; 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_i2c_sensor(struct text_object *, const char *);
void parse_hwmon_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 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 *); void free_sysfs_sensor(struct text_object *);
int get_entropy_avail(unsigned int *); int get_entropy_avail(unsigned int *);
@ -52,7 +52,7 @@ int get_entropy_poolsize(unsigned int *);
int update_stat(void); 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); void determine_longstat_file(void);

View File

@ -557,7 +557,7 @@ void llua_update_info(struct information *i, double u_interval) {
lua_setglobal(lua_L, "conky_info"); 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); char *str = llua_getstring(obj->data.s);
if (str != nullptr) { if (str != nullptr) {
snprintf(p, p_max_size, "%s", str); 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); char *str = llua_getstring(obj->data.s);
if (str != nullptr) { if (str != nullptr) {
evaluate(str, p, p_max_size); evaluate(str, p, p_max_size);

View File

@ -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_setup_info(struct information *i, double u_interval);
void llua_update_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(struct text_object *, char *, unsigned int);
void print_lua_parse(struct text_object *, char *, int); void print_lua_parse(struct text_object *, char *, unsigned int);
double lua_barval(struct text_object *); double lua_barval(struct text_object *);
#endif /* LUA_H_*/ #endif /* LUA_H_*/

View File

@ -470,7 +470,8 @@ void parse_local_mail_args(struct text_object *obj, const char *arg) {
} }
#define PRINT_MAILS_GENERATOR(x) \ #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; \ struct local_mail_s *locmail = (struct local_mail_s *)obj->data.opaque; \
if (!locmail) return; \ if (!locmail) return; \
update_mail_count(locmail); \ 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<struct mail_param_ex *>(obj->data.opaque); auto *mail = static_cast<struct mail_param_ex *>(obj->data.opaque);
if (mail == nullptr) { 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); 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<struct mail_param_ex *>(obj->data.opaque); auto *mail = static_cast<struct mail_param_ex *>(obj->data.opaque);
if (mail == nullptr) { 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<struct mail_param_ex *>(obj->data.opaque); auto *mail = static_cast<struct mail_param_ex *>(obj->data.opaque);
if (mail == nullptr) { 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); 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<struct mail_param_ex *>(obj->data.opaque); auto *mail = static_cast<struct mail_param_ex *>(obj->data.opaque);
if (mail == nullptr) { if (mail == nullptr) {

View File

@ -30,7 +30,7 @@
void parse_local_mail_args(struct text_object *, const char *); void parse_local_mail_args(struct text_object *, const char *);
#define PRINT_MAILS_PROTO_GENERATOR(x) \ #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()
PRINT_MAILS_PROTO_GENERATOR(new_) 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_imap_mail_args(struct text_object *, const char *);
void parse_pop3_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 free_mail_obj(struct text_object *);
void print_imap_unseen(struct text_object *, char *, int); void print_imap_unseen(struct text_object *, char *, unsigned int);
void print_imap_messages(struct text_object *, char *, int); void print_imap_messages(struct text_object *, char *, unsigned int);
void print_pop3_unseen(struct text_object *, char *, int); void print_pop3_unseen(struct text_object *, char *, unsigned int);
void print_pop3_used(struct text_object *, char *, int); void print_pop3_used(struct text_object *, char *, unsigned int);
namespace priv { namespace priv {
class current_mail_spool_setting class current_mail_spool_setting

View File

@ -395,7 +395,7 @@ void parse_mboxscan_arg(struct text_object *obj, const char *arg) {
obj->data.opaque = msd; 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<mboxscan_data *>(obj->data.opaque); auto *msd = static_cast<mboxscan_data *>(obj->data.opaque);
if (msd == nullptr) { if (msd == nullptr) {

View File

@ -31,7 +31,7 @@
#define _MBOXSCAN_H_ #define _MBOXSCAN_H_
void parse_mboxscan_arg(struct text_object *, const char *); 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 *); void free_mboxscan(struct text_object *);
#endif /* _MBOXSCAN_H_ */ #endif /* _MBOXSCAN_H_ */

View File

@ -77,12 +77,12 @@ static inline unsigned int file_buffer_size(const char *data, const unsigned int
return buf.st_size + 1; 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); 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)); const unsigned int sz = file_buffer_size(obj->data.s, text_buffer_size.get(*state));
char * buf = new char[sz]; char * buf = new char[sz];
@ -94,7 +94,7 @@ void print_catp(struct text_object *obj, char *p, int p_max_size)
delete[] buf; 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 x = 0;
int z = 0; int z = 0;
char buf[p_max_size]; char buf[p_max_size];

View File

@ -33,8 +33,8 @@
#include "text_object.h" #include "text_object.h"
void print_cat(struct text_object *, char *, int); void print_cat(struct text_object *, char *, unsigned int);
void print_catp(struct text_object *, char *, int); void print_catp(struct text_object *, char *, unsigned int);
void print_cap(struct text_object *, char *, int); void print_cap(struct text_object *, char *, unsigned int);
long long apply_base_multiplier(const char *, long long int); long long apply_base_multiplier(const char *, long long int);
#endif /* _MISC_H */ #endif /* _MISC_H */

View File

@ -112,7 +112,8 @@ void moc_cb::work() {
} // namespace } // namespace
#define MOC_PRINT_GENERATOR(type, alt) \ #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; \ (void)obj; \
uint32_t period = std::max( \ uint32_t period = std::max( \
lround(music_player_interval.get(*state) / active_update_interval()), \ lround(music_player_interval.get(*state) / active_update_interval()), \

View File

@ -23,16 +23,16 @@
#ifndef MOC_H_ #ifndef MOC_H_
#define MOC_H_ #define MOC_H_
void print_moc_state(struct text_object *, char *, int); void print_moc_state(struct text_object *, char *, unsigned int);
void print_moc_file(struct text_object *, char *, int); void print_moc_file(struct text_object *, char *, unsigned int);
void print_moc_title(struct text_object *, char *, int); void print_moc_title(struct text_object *, char *, unsigned int);
void print_moc_artist(struct text_object *, char *, int); void print_moc_artist(struct text_object *, char *, unsigned int);
void print_moc_song(struct text_object *, char *, int); void print_moc_song(struct text_object *, char *, unsigned int);
void print_moc_album(struct text_object *, char *, int); void print_moc_album(struct text_object *, char *, unsigned int);
void print_moc_totaltime(struct text_object *, char *, int); void print_moc_totaltime(struct text_object *, char *, unsigned int);
void print_moc_timeleft(struct text_object *, char *, int); void print_moc_timeleft(struct text_object *, char *, unsigned int);
void print_moc_curtime(struct text_object *, char *, int); void print_moc_curtime(struct text_object *, char *, unsigned int);
void print_moc_bitrate(struct text_object *, char *, int); void print_moc_bitrate(struct text_object *, char *, unsigned int);
void print_moc_rate(struct text_object *, char *, int); void print_moc_rate(struct text_object *, char *, unsigned int);
#endif /* MOC_H_ */ #endif /* MOC_H_ */

View File

@ -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; (void)obj;
format_media_player_time(p, p_max_size, get_mpd().elapsed); 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; (void)obj;
format_media_player_time(p, p_max_size, get_mpd().length); 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; 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(); const mpd_result &mpd_info = get_mpd();
int len = obj->data.i; int len = obj->data.i;
if (len == 0 || len > p_max_size) { 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) \ #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; \ 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); \ snprintf(p, p_max_size, fmt, get_mpd().name acc); \
} }

View File

@ -28,24 +28,24 @@
#include <cstdint> #include <cstdint>
/* text object functions */ /* text object functions */
void print_mpd_elapsed(struct text_object *, char *, int); void print_mpd_elapsed(struct text_object *, char *, unsigned int);
void print_mpd_length(struct text_object *, char *, int); void print_mpd_length(struct text_object *, char *, unsigned int);
uint8_t mpd_percentage(struct text_object *); uint8_t mpd_percentage(struct text_object *);
double mpd_barval(struct text_object *); double mpd_barval(struct text_object *);
void print_mpd_smart(struct text_object *, char *, int); void print_mpd_smart(struct text_object *, char *, unsigned int);
void print_mpd_title(struct text_object *, char *, int); void print_mpd_title(struct text_object *, char *, unsigned int);
void print_mpd_artist(struct text_object *, char *, int); void print_mpd_artist(struct text_object *, char *, unsigned int);
void print_mpd_albumartist(struct text_object *, char *, int); void print_mpd_albumartist(struct text_object *, char *, unsigned int);
void print_mpd_album(struct text_object *, char *, int); void print_mpd_album(struct text_object *, char *, unsigned int);
void print_mpd_date(struct text_object *, char *, int); void print_mpd_date(struct text_object *, char *, unsigned int);
void print_mpd_random(struct text_object *, char *, int); void print_mpd_random(struct text_object *, char *, unsigned int);
void print_mpd_repeat(struct text_object *, char *, int); void print_mpd_repeat(struct text_object *, char *, unsigned int);
void print_mpd_track(struct text_object *, char *, int); void print_mpd_track(struct text_object *, char *, unsigned int);
void print_mpd_name(struct text_object *, char *, int); void print_mpd_name(struct text_object *, char *, unsigned int);
void print_mpd_file(struct text_object *, char *, int); void print_mpd_file(struct text_object *, char *, unsigned int);
void print_mpd_vol(struct text_object *, char *, int); void print_mpd_vol(struct text_object *, char *, unsigned int);
void print_mpd_bitrate(struct text_object *, char *, int); void print_mpd_bitrate(struct text_object *, char *, unsigned int);
void print_mpd_status(struct text_object *, char *, int); void print_mpd_status(struct text_object *, char *, unsigned int);
int check_mpd_playing(struct text_object *); int check_mpd_playing(struct text_object *);
#endif /*MPD_H_*/ #endif /*MPD_H_*/

View File

@ -50,7 +50,7 @@ void mysql_finish(MYSQL *conn, MYSQL_RES *res) {
mysql_library_end(); 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 *conn = mysql_init(nullptr);
MYSQL_RES *res = nullptr; MYSQL_RES *res = nullptr;

View File

@ -25,6 +25,6 @@
#ifndef MYSQL_H_ #ifndef MYSQL_H_
#define 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_*/ #endif /*MYSQL_H_*/

View File

@ -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<struct net_stat *>(obj->data.opaque); auto *ns = static_cast<struct net_stat *>(obj->data.opaque);
if (ns == nullptr) { return; } 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); 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<struct net_stat *>(obj->data.opaque); auto *ns = static_cast<struct net_stat *>(obj->data.opaque);
if (ns == nullptr) { return; } 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); 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<struct net_stat *>(obj->data.opaque); auto *ns = static_cast<struct net_stat *>(obj->data.opaque);
if (ns == nullptr) { return; } 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); 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<struct net_stat *>(obj->data.opaque); auto *ns = static_cast<struct net_stat *>(obj->data.opaque);
if (ns == nullptr) { return; } 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); 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<struct net_stat *>(obj->data.opaque); auto *ns = static_cast<struct net_stat *>(obj->data.opaque);
if (ns == nullptr) { return; } 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); 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<struct net_stat *>(obj->data.opaque); auto *ns = static_cast<struct net_stat *>(obj->data.opaque);
if (ns == nullptr) { return; } 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); 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<struct net_stat *>(obj->data.opaque); auto *ns = static_cast<struct net_stat *>(obj->data.opaque);
if (ns == nullptr) { return; } if (ns == nullptr) { return; }
@ -234,7 +234,7 @@ void print_addr(struct text_object *obj, char *p, int p_max_size) {
} }
#ifdef __linux__ #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; struct net_stat *ns = (struct net_stat *)obj->data.opaque;
if (!ns) return; if (!ns) return;
@ -248,7 +248,7 @@ void print_addrs(struct text_object *obj, char *p, int p_max_size) {
} }
#ifdef BUILD_IPV6 #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; struct net_stat *ns = (struct net_stat *)obj->data.opaque;
char tempaddress[INET6_ADDRSTRLEN]; char tempaddress[INET6_ADDRSTRLEN];
struct v6addr *current_v6 = ns->v6addrs; struct v6addr *current_v6 = ns->v6addrs;
@ -329,7 +329,7 @@ double upspeedgraphval(struct text_object *obj) {
#endif /* BUILD_X11 */ #endif /* BUILD_X11 */
#ifdef BUILD_WLAN #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; struct net_stat *ns = (struct net_stat *)obj->data.opaque;
if (!ns) { 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); 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; struct net_stat *ns = (struct net_stat *)obj->data.opaque;
if (!ns) return; if (!ns) return;
snprintf(p, p_max_size, "%s", ns->mode); 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; struct net_stat *ns = (struct net_stat *)obj->data.opaque;
if (!ns) return; 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", "/"); snprintf(p, p_max_size, "%s", "/");
} }
} }
void print_wireless_frequency(struct text_object *obj, char *p, void print_wireless_frequency(struct text_object *obj, char *p, unsigned int p_max_size) {
int p_max_size) {
struct net_stat *ns = (struct net_stat *)obj->data.opaque; struct net_stat *ns = (struct net_stat *)obj->data.opaque;
if (!ns) return; if (!ns) return;
@ -374,38 +373,35 @@ void print_wireless_frequency(struct text_object *obj, char *p,
snprintf(p, p_max_size, "/"); 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; struct net_stat *ns = (struct net_stat *)obj->data.opaque;
if (!ns) return; if (!ns) return;
snprintf(p, p_max_size, "%s", ns->bitrate); 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; struct net_stat *ns = (struct net_stat *)obj->data.opaque;
if (!ns) return; if (!ns) return;
snprintf(p, p_max_size, "%s", ns->ap); snprintf(p, p_max_size, "%s", ns->ap);
} }
void print_wireless_link_qual(struct text_object *obj, char *p, void print_wireless_link_qual(struct text_object *obj, char *p, unsigned int p_max_size) {
int p_max_size) {
struct net_stat *ns = (struct net_stat *)obj->data.opaque; struct net_stat *ns = (struct net_stat *)obj->data.opaque;
if (!ns) return; if (!ns) return;
spaced_print(p, p_max_size, "%d", 4, ns->link_qual); spaced_print(p, p_max_size, "%d", 4, ns->link_qual);
} }
void print_wireless_link_qual_max(struct text_object *obj, char *p, void print_wireless_link_qual_max(struct text_object *obj, char *p, unsigned int p_max_size) {
int p_max_size) {
struct net_stat *ns = (struct net_stat *)obj->data.opaque; struct net_stat *ns = (struct net_stat *)obj->data.opaque;
if (!ns) return; if (!ns) return;
spaced_print(p, p_max_size, "%d", 4, ns->link_qual_max); spaced_print(p, p_max_size, "%d", 4, ns->link_qual_max);
} }
void print_wireless_link_qual_perc(struct text_object *obj, char *p, void print_wireless_link_qual_perc(struct text_object *obj, char *p, unsigned int p_max_size) {
int p_max_size) {
struct net_stat *ns = (struct net_stat *)obj->data.opaque; struct net_stat *ns = (struct net_stat *)obj->data.opaque;
if (!ns) return; 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; 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) { if (dns_data.nscount > obj->data.l) {
snprintf(p, p_max_size, "%s", dns_data.ns_list[obj->data.l]); snprintf(p, p_max_size, "%s", dns_data.ns_list[obj->data.l]);
} }

View File

@ -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_arg(struct text_object *, const char *, void *);
void parse_net_stat_bar_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_downspeed(struct text_object *, char *, unsigned int);
void print_downspeedf(struct text_object *, char *, int); void print_downspeedf(struct text_object *, char *, unsigned int);
void print_upspeed(struct text_object *, char *, int); void print_upspeed(struct text_object *, char *, unsigned int);
void print_upspeedf(struct text_object *, char *, int); void print_upspeedf(struct text_object *, char *, unsigned int);
void print_totaldown(struct text_object *, char *, int); void print_totaldown(struct text_object *, char *, unsigned int);
void print_totalup(struct text_object *, char *, int); void print_totalup(struct text_object *, char *, unsigned int);
void print_addr(struct text_object *, char *, int); void print_addr(struct text_object *, char *, unsigned int);
#ifdef __linux__ #ifdef __linux__
void print_addrs(struct text_object *, char *, int); void print_addrs(struct text_object *, char *, unsigned int);
#ifdef BUILD_IPV6 #ifdef BUILD_IPV6
void print_v6addrs(struct text_object *, char *, int); void print_v6addrs(struct text_object *, char *, unsigned int);
#endif /* BUILD_IPV6 */ #endif /* BUILD_IPV6 */
#endif /* __linux__ */ #endif /* __linux__ */
#ifdef BUILD_X11 #ifdef BUILD_X11
@ -108,15 +108,15 @@ double downspeedgraphval(struct text_object *);
double upspeedgraphval(struct text_object *); double upspeedgraphval(struct text_object *);
#endif /* BUILD_X11 */ #endif /* BUILD_X11 */
#ifdef BUILD_WLAN #ifdef BUILD_WLAN
void print_wireless_essid(struct text_object *, char *, int); void print_wireless_essid(struct text_object *, char *, unsigned int);
void print_wireless_channel(struct text_object *, char *, int); void print_wireless_channel(struct text_object *, char *, unsigned int);
void print_wireless_frequency(struct text_object *, char *, int); void print_wireless_frequency(struct text_object *, char *, unsigned int);
void print_wireless_mode(struct text_object *, char *, int); void print_wireless_mode(struct text_object *, char *, unsigned int);
void print_wireless_bitrate(struct text_object *, char *, int); void print_wireless_bitrate(struct text_object *, char *, unsigned int);
void print_wireless_ap(struct text_object *, char *, int); void print_wireless_ap(struct text_object *, char *, unsigned int);
void print_wireless_link_qual(struct text_object *, char *, int); void print_wireless_link_qual(struct text_object *, char *, unsigned int);
void print_wireless_link_qual_max(struct text_object *, char *, int); void print_wireless_link_qual_max(struct text_object *, char *, unsigned int);
void print_wireless_link_qual_perc(struct text_object *, char *, int); void print_wireless_link_qual_perc(struct text_object *, char *, unsigned int);
double wireless_link_barval(struct text_object *); double wireless_link_barval(struct text_object *);
#endif /* BUILD_WLAN */ #endif /* BUILD_WLAN */
@ -130,6 +130,6 @@ void free_if_up(struct text_object *);
void free_dns_data(struct text_object *); void free_dns_data(struct text_object *);
int update_dns_data(void); int update_dns_data(void);
void parse_nameserver_arg(struct text_object *, const char *); 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 */ #endif /* _NET_STAT_H */

View File

@ -58,7 +58,7 @@ char *readfile(const char *filename, int *total_read, char showerror) {
return buf; 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<char[]> buf(new char[p_max_size]); std::unique_ptr<char[]> buf(new char[p_max_size]);
memset(buf.get(), 0, p_max_size); memset(buf.get(), 0, p_max_size);
@ -106,7 +106,7 @@ int inlist(struct ll_string *front, char *string) {
return 0; 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::ostringstream pathstream;
std::unique_ptr<char[]> buf(new char[max_user_text.get(*state)]); std::unique_ptr<char[]> 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); 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; char *buf;
int i, bytes_read; int i, bytes_read;
std::ostringstream pathstream; 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<char[]> buf(new char[p_max_size]); std::unique_ptr<char[]> buf(new char[p_max_size]);
int bytes_read; int bytes_read;
std::ostringstream pathstream; 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; int i, total_read;
pid_t pid; pid_t pid;
std::ostringstream pathstream; std::ostringstream pathstream;
@ -189,7 +189,7 @@ void print_pid_environ(struct text_object *obj, char *p, int p_max_size) {
free(var); 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 *buf = nullptr;
char *buf2; char *buf2;
int bytes_read, total_read; 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::ostringstream pathstream;
std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]); std::unique_ptr<char[]> 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); 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; char *buf = nullptr;
int bytes_read; int bytes_read;
long int nice_value; 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; DIR *dir;
struct dirent *entry; struct dirent *entry;
std::unique_ptr<char[]> buf(new char[p_max_size]); std::unique_ptr<char[]> 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 PARENT_ENTRY "PPid:\t"
#define PARENTNOTFOUND "Can't find the process parent in '%s'" #define PARENTNOTFOUND "Can't find the process parent in '%s'"
char *begin, *end, *buf = nullptr; 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; char *buf = nullptr;
int bytes_read; int bytes_read;
long int priority; 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 STATE_ENTRY "State:\t"
#define STATENOTFOUND "Can't find the process state in '%s'" #define STATENOTFOUND "Can't find the process state in '%s'"
char *begin, *end, *buf = nullptr; 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; char *begin, *buf = nullptr;
int bytes_read; int bytes_read;
std::ostringstream pathstream; 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::ostringstream pathstream;
std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]); std::unique_ptr<char[]> 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); 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<char[]> objbuf(new char[max_user_text.get(*state)]); std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);
std::ostringstream pathstream; 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); 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::ostringstream pathstream;
std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]); std::unique_ptr<char[]> 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; DIR *dir;
struct dirent *entry; struct dirent *entry;
char *buf; 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 THREADS_ENTRY "Threads:\t"
#define THREADSNOTFOUND \ #define THREADSNOTFOUND \
"Can't find the number of the threads of the process in '%s'" "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; DIR *dir;
struct dirent *entry; struct dirent *entry;
int totallength = 0; 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, void print_pid_time_kernelmode(struct text_object *obj, char *p,
int p_max_size) { unsigned int p_max_size) {
char *buf = nullptr; char *buf = nullptr;
int bytes_read; int bytes_read;
unsigned long int umtime; 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; char *buf = nullptr;
int bytes_read; int bytes_read;
unsigned long int kmtime; 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; char *buf = nullptr;
int bytes_read; int bytes_read;
unsigned long int umtime, kmtime; 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); 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); 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); 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); 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); 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); 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); 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); 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( internal_print_pid_vm(
obj, p, p_max_size, "VmPeak:\t", obj, p, p_max_size, "VmPeak:\t",
"Can't find the process peak virtual memory size in '%s'"); "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", internal_print_pid_vm(obj, p, p_max_size, "VmSize:\t",
"Can't find the process virtual memory size in '%s'"); "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", internal_print_pid_vm(obj, p, p_max_size, "VmLck:\t",
"Can't find the process locked memory size in '%s'"); "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( internal_print_pid_vm(
obj, p, p_max_size, "VmHWM:\t", obj, p, p_max_size, "VmHWM:\t",
"Can't find the process peak resident set size in '%s'"); "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", internal_print_pid_vm(obj, p, p_max_size, "VmHWM:\t",
"Can't find the process resident set size in '%s'"); "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", internal_print_pid_vm(obj, p, p_max_size, "VmData:\t",
"Can't find the process data segment size in '%s'"); "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", internal_print_pid_vm(obj, p, p_max_size, "VmData:\t",
"Can't find the process stack segment size in '%s'"); "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", internal_print_pid_vm(obj, p, p_max_size, "VmData:\t",
"Can't find the process text segment size in '%s'"); "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( internal_print_pid_vm(
obj, p, p_max_size, "VmLib:\t", obj, p, p_max_size, "VmLib:\t",
"Can't find the process shared library code size in '%s'"); "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( internal_print_pid_vm(
obj, p, p_max_size, "VmPTE:\t", obj, p, p_max_size, "VmPTE:\t",
"Can't find the process page table entries size in '%s'"); "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 READ_ENTRY "read_bytes: "
#define READNOTFOUND "Can't find the amount of bytes read in '%s'" #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; char *begin, *end, *buf = nullptr;
int bytes_read; int bytes_read;
std::ostringstream pathstream; 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 WRITE_ENTRY "write_bytes: "
#define WRITENOTFOUND "Can't find the amount of bytes written in '%s'" #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; char *begin, *end, *buf = nullptr;
int bytes_read; int bytes_read;
std::ostringstream pathstream; std::ostringstream pathstream;

View File

@ -34,50 +34,50 @@
#define READERR "Can't read '%s'" #define READERR "Can't read '%s'"
#define READSIZE 128 #define READSIZE 128
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
void print_pid_time_kernelmode(struct text_object *obj, char *p, void print_pid_time_kernelmode(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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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 scan_cmdline_to_pid_arg(struct text_object *obj, const char *arg,
void *free_at_crash); 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 */ #endif /* CONKY_PROC_H */

View File

@ -302,29 +302,29 @@ int puau_muted(struct text_object *obj) {
} }
void print_puau_sink_description(struct text_object *obj, char *p, 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()); 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, 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", snprintf(p, p_max_size, "%s",
get_pulseaudio(obj).sink_active_port_name.c_str()); get_pulseaudio(obj).sink_active_port_name.c_str());
} }
void print_puau_sink_active_port_description(struct text_object *obj, char *p, 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", snprintf(p, p_max_size, "%s",
get_pulseaudio(obj).sink_active_port_description.c_str()); get_pulseaudio(obj).sink_active_port_description.c_str());
} }
void print_puau_card_active_profile(struct text_object *obj, char *p, 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", snprintf(p, p_max_size, "%s",
get_pulseaudio(obj).card_active_profile_description.c_str()); 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()); snprintf(p, p_max_size, "%s", get_pulseaudio(obj).card_name.c_str());
} }

View File

@ -36,15 +36,11 @@
void init_pulseaudio(struct text_object *obj); void init_pulseaudio(struct text_object *obj);
void free_pulseaudio(struct text_object *obj); void free_pulseaudio(struct text_object *obj);
uint8_t puau_vol(struct text_object *); // preserve pa_* for libpulse uint8_t puau_vol(struct text_object *); // preserve pa_* for libpulse
void print_puau_sink_description(struct text_object *obj, char *p, void print_puau_sink_description(struct text_object *obj, char *p, unsigned int p_max_size);
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_name(struct text_object *obj, char *p, void print_puau_sink_active_port_description(struct text_object *obj, char *p, unsigned int p_max_size);
int p_max_size); void print_puau_card_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, void print_puau_card_active_profile(struct text_object *obj, char *p, unsigned int p_max_size);
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);
double puau_volumebarval(struct text_object *obj); double puau_volumebarval(struct text_object *obj);
int puau_muted(struct text_object *obj); int puau_muted(struct text_object *obj);

View File

@ -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 { struct timeval tv1 {
}, tv2{}, timeout{}; }, tv2{}, timeout{};
auto *addr = static_cast<struct sockaddr_in *>(obj->data.opaque); auto *addr = static_cast<struct sockaddr_in *>(obj->data.opaque);
@ -214,11 +214,11 @@ void print_read_tcpip(struct text_object *obj, char *p, int p_max_size,
close(sock); 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); 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); print_read_tcpip(obj, p, p_max_size, IPPROTO_UDP);
} }

View File

@ -33,9 +33,9 @@
void parse_read_tcpip_arg(struct text_object *, const char *, void *); void parse_read_tcpip_arg(struct text_object *, const char *, void *);
void parse_tcp_ping_arg(struct text_object *obj, const char *arg, void parse_tcp_ping_arg(struct text_object *obj, const char *arg,
void *free_at_crash); void *free_at_crash);
void print_read_tcp(struct text_object *, char *, int); void print_read_tcp(struct text_object *, char *, unsigned int);
void print_read_udp(struct text_object *, char *, int); void print_read_udp(struct text_object *, char *, unsigned int);
void print_tcp_ping(struct text_object *, char *, int); void print_tcp_ping(struct text_object *, char *, unsigned int);
void free_read_tcpip(struct text_object *); void free_read_tcpip(struct text_object *);
void free_tcp_ping(struct text_object *); void free_tcp_ping(struct text_object *);

View File

@ -172,7 +172,7 @@ void rss_scan_arg(struct text_object *obj, const char *arg) {
obj->data.opaque = rd; 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; struct rss_data *rd = (struct rss_data *)obj->data.opaque;
if (!rd) { if (!rd) {

View File

@ -26,7 +26,7 @@
#define RSS_H_ #define RSS_H_
void rss_scan_arg(struct text_object *, const char *); 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 *); void rss_free_obj_info(struct text_object *);
#endif /*RSS_H_*/ #endif /*RSS_H_*/

View File

@ -199,7 +199,7 @@ void parse_scroll_arg(struct text_object *obj, const char *arg,
#endif /* BUILD_X11 */ #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<struct scroll_data *>(obj->data.opaque); auto *sd = static_cast<struct scroll_data *>(obj->data.opaque);
unsigned int j, colorchanges = 0, frontcolorchanges = 0, unsigned int j, colorchanges = 0, frontcolorchanges = 0,
visibcolorchanges = 0, strend; visibcolorchanges = 0, strend;

View File

@ -30,7 +30,7 @@
#define _SCROLL_H #define _SCROLL_H
void parse_scroll_arg(struct text_object *, const char *, void *, char *); 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 *); void free_scroll(struct text_object *);
#endif /* _SCROLL_H */ #endif /* _SCROLL_H */

View File

@ -110,7 +110,7 @@ static char *smapi_get_val(const char *args) {
return smapi_get_str(str); 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; char *s;
if (!obj->data.s) return; if (!obj->data.s) return;
@ -132,7 +132,7 @@ uint8_t smapi_bat_percentage(struct text_object *obj) {
return val; 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; int idx, val;
if (obj->data.s && sscanf(obj->data.s, "%i", &idx) == 1) { if (obj->data.s && sscanf(obj->data.s, "%i", &idx) == 1) {
val = smapi_bat_installed_internal(idx) 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"); 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; int idx, val;
if (obj->data.s && sscanf(obj->data.s, "%i", &idx) == 1) { if (obj->data.s && sscanf(obj->data.s, "%i", &idx) == 1) {
val = smapi_bat_installed_internal(idx) val = smapi_bat_installed_internal(idx)

View File

@ -24,10 +24,10 @@
#ifndef _SMAPI_H #ifndef _SMAPI_H
#define _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 *); uint8_t smapi_bat_percentage(struct text_object *);
void print_smapi_bat_temp(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 *, int); void print_smapi_bat_power(struct text_object *, char *, unsigned int);
double smapi_bat_barval(struct text_object *); double smapi_bat_barval(struct text_object *);
int smapi_bat_installed(struct text_object *obj); int smapi_bat_installed(struct text_object *obj);

View File

@ -44,7 +44,7 @@
* I don't know the exact measurement unit, though. I may assume that 0 for * I don't know the exact measurement unit, though. I may assume that 0 for
* 'fan stopped' and 255 for 'maximum fan speed'. */ * 'fan stopped' and 255 for 'maximum fan speed'. */
void get_sony_fanspeed(struct text_object *obj, char *p_client_buffer, void get_sony_fanspeed(struct text_object *obj, char *p_client_buffer,
int client_buffer_size) { unsigned int client_buffer_size) {
FILE *fp; FILE *fp;
unsigned int speed = 0; unsigned int speed = 0;
char fan[128]; char fan[128];

View File

@ -31,6 +31,6 @@
#ifndef _SONY_H #ifndef _SONY_H
#define _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 */ #endif /* _SONY_H */

View File

@ -375,7 +375,7 @@ struct special_t *new_special(char *buf, enum special_types t) {
return current; 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) { double usage) {
static const char *gaugevals[] = {"_. ", "\\. ", " | ", " ./", " ._"}; static const char *gaugevals[] = {"_. ", "\\. ", " | ", " ./", " ._"};
auto *g = static_cast<struct gauge *>(obj->special_data); auto *g = static_cast<struct gauge *>(obj->special_data);
@ -405,7 +405,7 @@ void new_gauge_in_x11(struct text_object *obj, char *buf, double usage) {
} }
#endif /* BUILD_X11 */ #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<struct gauge *>(obj->special_data); auto *g = static_cast<struct gauge *>(obj->special_data);
if ((p_max_size == 0) || (g == nullptr)) { 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 #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; struct special_t *s;
int tmp = selected_font; 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)) { if (not out_to_x.get(*state)) {
return; return;
} }
@ -627,7 +627,7 @@ void scan_stippled_hr(struct text_object *obj, const char *arg) {
obj->special_data = sh; 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; struct special_t *s = nullptr;
auto *sh = static_cast<struct stippled_hr *>(obj->special_data); auto *sh = static_cast<struct stippled_hr *>(obj->special_data);
@ -646,7 +646,7 @@ void new_stippled_hr(struct text_object *obj, char *p, int p_max_size) {
} }
#endif /* BUILD_X11 */ #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 #ifdef BUILD_X11
if (out_to_x.get(*state)) { if (out_to_x.get(*state)) {
new_special(p, FG)->arg = obj->data.l; 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 #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)) { if (not out_to_x.get(*state)) {
return; return;
} }
@ -730,7 +730,7 @@ static void new_bar_in_x11(struct text_object *obj, char *buf, double usage) {
#endif /* BUILD_X11 */ #endif /* BUILD_X11 */
/* usage is in range [0,255] */ /* 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<struct bar *>(obj->special_data); auto *b = static_cast<struct bar *>(obj->special_data);
if ((p_max_size == 0) || (b == nullptr)) { 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 */ #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) { if (p_max_size == 0) {
return; return;
} }
new_special(p, OUTLINE)->arg = obj->data.l; 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) { if (p_max_size == 0) {
return; return;
} }
new_special(p, OFFSET)->arg = obj->data.l; 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) { if (p_max_size == 0) {
return; return;
} }
new_special(p, VOFFSET)->arg = obj->data.l; 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) { if (p_max_size == 0) {
return; 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 // 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) { if (p_max_size == 0) {
return; return;
} }
new_special(p, ALIGNC)->arg = obj->data.l; 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) { if (p_max_size == 0) {
return; return;
} }
@ -817,7 +817,7 @@ void scan_tab(struct text_object *obj, const char *arg) {
obj->special_data = t; 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; struct special_t *s = nullptr;
auto *t = static_cast<struct tab *>(obj->special_data); auto *t = static_cast<struct tab *>(obj->special_data);

View File

@ -92,22 +92,22 @@ void scan_tab(struct text_object *, const char *);
void scan_stippled_hr(struct text_object *, const char *); void scan_stippled_hr(struct text_object *, const char *);
/* printing specials */ /* 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_graph(struct text_object *, char *, int, double);
void new_hr(struct text_object *, char *, int); void new_hr(struct text_object *, char *, unsigned int);
void new_stippled_hr(struct text_object *, char *, int); void new_stippled_hr(struct text_object *, char *, unsigned int);
#endif /* BUILD_X11 */ #endif /* BUILD_X11 */
void new_gauge(struct text_object *, char *, int, double); void new_gauge(struct text_object *, char *, int, double);
void new_bar(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_fg(struct text_object *, char *, unsigned int);
void new_bg(struct text_object *, char *, int); void new_bg(struct text_object *, char *, unsigned int);
void new_outline(struct text_object *, char *, int); void new_outline(struct text_object *, char *, unsigned int);
void new_offset(struct text_object *, char *, int); void new_offset(struct text_object *, char *, unsigned int);
void new_voffset(struct text_object *, char *, int); void new_voffset(struct text_object *, char *, unsigned int);
void new_alignr(struct text_object *, char *, int); void new_alignr(struct text_object *, char *, unsigned int);
void new_alignc(struct text_object *, char *, int); void new_alignc(struct text_object *, char *, unsigned int);
void new_goto(struct text_object *, char *, int); void new_goto(struct text_object *, char *, unsigned int);
void new_tab(struct text_object *, char *, int); void new_tab(struct text_object *, char *, unsigned int);
struct special_t *new_special(char *buf, enum special_types t); struct special_t *new_special(char *buf, enum special_types t);

View File

@ -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, 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; int fd, i, endofstring = 0, linescounted = 0;
FILE *fp; FILE *fp;
struct stat st {}; 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); 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); print_tailhead("tail", obj, p, p_max_size);
} }
/* FIXME: use something more general (see also tail.c, head.c */ /* FIXME: use something more general (see also tail.c, head.c */
#define BUFSZ 0x1000 #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; static int rep = 0;
FILE *fp = open_file(obj->data.s, &rep); FILE *fp = open_file(obj->data.s, &rep);
char buf[BUFSZ]; char buf[BUFSZ];
@ -228,7 +228,7 @@ void print_lines(struct text_object *obj, char *p, int p_max_size) {
fclose(fp); 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; static int rep = 0;
FILE *fp = open_file(obj->data.s, &rep); FILE *fp = open_file(obj->data.s, &rep);
char buf[BUFSZ]; char buf[BUFSZ];

View File

@ -32,10 +32,10 @@
void free_tailhead(struct text_object *); void free_tailhead(struct text_object *);
void init_tailhead(const char *, const char *, struct text_object *, void *); void init_tailhead(const char *, const char *, struct text_object *, void *);
void print_head(struct text_object *, char *, int); void print_head(struct text_object *, char *, unsigned int);
void print_tail(struct text_object *, char *, int); void print_tail(struct text_object *, char *, unsigned int);
void print_lines(struct text_object *, char *, int); void print_lines(struct text_object *, char *, unsigned int);
void print_words(struct text_object *, char *, int); void print_words(struct text_object *, char *, unsigned int);
#endif /* _TAILHEAD_H */ #endif /* _TAILHEAD_H */

View File

@ -122,7 +122,7 @@ int tcp_portmon_init(struct text_object *obj, const char *arg) {
return 0; 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; struct tcp_port_monitor_data *pmd = (tcp_port_monitor_data *)obj->data.opaque;
tcp_port_monitor_t *p_monitor; tcp_port_monitor_t *p_monitor;

View File

@ -37,7 +37,7 @@ struct tcp_port_monitor_data {
struct text_object; struct text_object;
int tcp_portmon_init(struct text_object *, const char *); 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_update(void);
int tcp_portmon_clear(void); int tcp_portmon_clear(void);
void tcp_portmon_free(struct text_object *); void tcp_portmon_free(struct text_object *);

View File

@ -41,11 +41,11 @@ int gen_false_iftest(struct text_object *) {
return 0; return 0;
} }
void gen_print_nothing(struct text_object *, char *, int) { void gen_print_nothing(struct text_object *, char *, unsigned int) {
// literally does nothing // 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) { if (obj->data.s == nullptr) {
return; return;
} }

View File

@ -37,7 +37,7 @@
/* text object callbacks */ /* text object callbacks */
struct obj_cb { struct obj_cb {
/* text object: print obj's output to p */ /* 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 */ /* ifblock object: return zero to trigger jumping */
int (*iftest)(struct text_object *obj); int (*iftest)(struct text_object *obj);
@ -69,11 +69,11 @@ int gen_false_iftest(struct text_object *);
/* generic nothing printer callback printing nothing /* generic nothing printer callback printing nothing
* used for the endif object */ * 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 /* generic obj->data.s printer
* used by the $text object */ * 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<void *, int (*)()> { class legacy_cb : public conky::callback<void *, int (*)()> {
typedef conky::callback<void *, int (*)()> Base; typedef conky::callback<void *, int (*)()> Base;

View File

@ -78,7 +78,7 @@ void scan_tztime(struct text_object *obj, const char *arg) {
obj->data.opaque = ts; 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); time_t t = time(nullptr);
struct tm *tm = localtime(&t); 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<char *>(obj->data.opaque), tm); strftime(p, p_max_size, static_cast<char *>(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); time_t t = time(nullptr);
struct tm *tm = gmtime(&t); 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<char *>(obj->data.opaque), tm); strftime(p, p_max_size, static_cast<char *>(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; char *oldTZ = nullptr;
time_t t; time_t t;
struct tm *tm; 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<char[]> buf(new char[max_user_text.get(*state)]); std::unique_ptr<char[]> buf(new char[max_user_text.get(*state)]);
generate_text_internal(buf.get(), max_user_text.get(*state), *obj->sub); generate_text_internal(buf.get(), max_user_text.get(*state), *obj->sub);

View File

@ -41,10 +41,10 @@ void scan_time(struct text_object *, const char *);
void scan_tztime(struct text_object *, const char *); void scan_tztime(struct text_object *, const char *);
/* print the time */ /* print the time */
void print_time(struct text_object *, char *, int); void print_time(struct text_object *, char *, unsigned int);
void print_utime(struct text_object *, char *, int); void print_utime(struct text_object *, char *, unsigned int);
void print_tztime(struct text_object *, char *, int); void print_tztime(struct text_object *, char *, unsigned int);
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);
/* free object data */ /* free object data */
void free_time(struct text_object *); void free_time(struct text_object *);

View File

@ -36,7 +36,7 @@
#include "conky.h" #include "conky.h"
#include "logging.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; struct passwd *pw;
uid_t uid; uid_t uid;
char *firstinvalid; 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; struct group *grp;
gid_t gid; gid_t gid;
char *firstinvalid; char *firstinvalid;

View File

@ -30,7 +30,7 @@
#ifndef _USER_H #ifndef _USER_H
#define _USER_H #define _USER_H
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);
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);
#endif /* _USER_H */ #endif /* _USER_H */

View File

@ -184,27 +184,27 @@ int update_users(void) {
return 0; 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; (void)obj;
snprintf(p, p_max_size, "%s", info.users.names); 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; (void)obj;
snprintf(p, p_max_size, "%s", info.users.terms); 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; (void)obj;
snprintf(p, p_max_size, "%s", info.users.times); 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); update_user_time(obj->data.s);
snprintf(p, p_max_size, "%s", info.users.ctime); 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; (void)obj;
snprintf(p, p_max_size, "%d", info.users.number); snprintf(p, p_max_size, "%d", info.users.number);
} }

View File

@ -32,11 +32,11 @@
int update_users(void); int update_users(void);
void print_user_names(struct text_object *, char *, int); void print_user_names(struct text_object *, char *, unsigned int);
void print_user_terms(struct text_object *, char *, int); void print_user_terms(struct text_object *, char *, unsigned int);
void print_user_times(struct text_object *, char *, int); void print_user_times(struct text_object *, char *, unsigned int);
void print_user_time(struct text_object *, char *, int); void print_user_time(struct text_object *, char *, unsigned int);
void print_user_number(struct text_object *, char *, int); void print_user_number(struct text_object *, char *, unsigned int);
void free_user_names(struct text_object *); void free_user_names(struct text_object *);
void free_user_terms(struct text_object *); void free_user_terms(struct text_object *);

View File

@ -943,7 +943,7 @@ void scan_weather_forecast_arg(struct text_object *obj, const char *arg,
obj->data.opaque = wfd; 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 *wfd =
(struct weather_forecast_data *)obj->data.opaque; (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; 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; struct weather_data *wd = (struct weather_data *)obj->data.opaque;
if (!wd || !wd->uri) { if (!wd || !wd->uri) {

View File

@ -33,11 +33,11 @@
#ifdef BUILD_WEATHER_XOAP #ifdef BUILD_WEATHER_XOAP
void load_xoap_keys(void); void load_xoap_keys(void);
void scan_weather_forecast_arg(struct text_object *, const char *, 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 */ #endif /* BUILD_WEATHER_XOAP */
void scan_weather_arg(struct text_object *, const char *, void *); 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 *); void free_weather(struct text_object *);
#endif /* WEATHER_H_ */ #endif /* WEATHER_H_ */

View File

@ -1156,7 +1156,7 @@ void get_x11_desktop_info(Display *current_display, Atom atom) {
static const char NOT_IN_X[] = "Not running in X"; 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; (void)obj;
if (not out_to_x.get(*state)) { 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)); 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; (void)obj;
if (not out_to_x.get(*state)) { 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)); 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; (void)obj;
if (not out_to_x.get(*state)) { 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); 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; (void)obj;
if (not out_to_x.get(*state)) { 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); 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; (void)obj;
if (not out_to_x.get(*state)) { if (not out_to_x.get(*state)) {
@ -1298,7 +1298,7 @@ void xpmdb_swap_buffers(void) {
#endif /* BUILD_XDBE */ #endif /* BUILD_XDBE */
#define LOCK_TEMPLATE(func, num) \ #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; \ (void)obj; \
XKeyboardState x; \ XKeyboardState x; \
XGetKeyboardControl(display, &x); \ XGetKeyboardControl(display, &x); \
@ -1309,7 +1309,7 @@ LOCK_TEMPLATE(num_led, 2)
LOCK_TEMPLATE(caps_led, 1) LOCK_TEMPLATE(caps_led, 1)
LOCK_TEMPLATE(scroll_led, 4) 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; (void)obj;
char *group = NULL; char *group = NULL;
@ -1324,7 +1324,7 @@ void print_kb_layout(struct text_object *obj, char *p, int p_max_size) {
XFree(group); 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; (void)obj;
int acc_num = 0; int acc_num = 0;
int acc_denom = 0; int acc_denom = 0;

View File

@ -109,20 +109,20 @@ void set_transparent_background(Window win);
void get_x11_desktop_info(Display *current_display, Atom atom); void get_x11_desktop_info(Display *current_display, Atom atom);
void set_struts(int); void set_struts(int);
void print_monitor(struct text_object *, char *, int); void print_monitor(struct text_object *, char *, unsigned int);
void print_monitor_number(struct text_object *, char *, int); void print_monitor_number(struct text_object *, char *, unsigned int);
void print_desktop(struct text_object *, char *, int); void print_desktop(struct text_object *, char *, unsigned int);
void print_desktop_number(struct text_object *, char *, int); void print_desktop_number(struct text_object *, char *, unsigned int);
void print_desktop_name(struct text_object *, char *, int); void print_desktop_name(struct text_object *, char *, unsigned int);
/* Num lock, Scroll lock, Caps Lock */ /* Num lock, Scroll lock, Caps Lock */
void print_num_led(struct text_object *, char *, int); void print_num_led(struct text_object *, char *, unsigned int);
void print_caps_led(struct text_object *, char *, int); void print_caps_led(struct text_object *, char *, unsigned int);
void print_scroll_led(struct text_object *, char *, int); void print_scroll_led(struct text_object *, char *, unsigned int);
/* Keyboard layout and mouse speed in percentage */ /* Keyboard layout and mouse speed in percentage */
void print_kb_layout(struct text_object *, char *, int); void print_kb_layout(struct text_object *, char *, unsigned int);
void print_mouse_speed(struct text_object *, char *, int); void print_mouse_speed(struct text_object *, char *, unsigned int);
#ifdef BUILD_XDBE #ifdef BUILD_XDBE
void xdbe_swap_buffers(void); void xdbe_swap_buffers(void);

View File

@ -351,20 +351,20 @@ int update_xmms2(void) {
return 0; 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; (void)obj;
if (info.xmms2.tracknr != -1) { if (info.xmms2.tracknr != -1) {
snprintf(p, p_max_size, "%i", info.xmms2.tracknr); 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; (void)obj;
snprintf(p, p_max_size, "%02d:%02d", info.xmms2.elapsed / 60000, snprintf(p, p_max_size, "%02d:%02d", info.xmms2.elapsed / 60000,
(info.xmms2.elapsed / 1000) % 60); (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; (void)obj;
snprintf(p, p_max_size, "%02d:%02d", info.xmms2.duration / 60000, snprintf(p, p_max_size, "%02d:%02d", info.xmms2.duration / 60000,
(info.xmms2.duration / 1000) % 60); (info.xmms2.duration / 1000) % 60);
@ -376,7 +376,7 @@ double xmms2_barval(struct text_object *obj) {
return info.xmms2.progress; 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; (void)obj;
int artist_len = strlen(info.xmms2.artist); int artist_len = strlen(info.xmms2.artist);
int title_len = strlen(info.xmms2.title); 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) \ #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; \ (void)obj; \
snprintf(p, p_max_size, fmt, info.xmms2.name); \ snprintf(p, p_max_size, fmt, info.xmms2.name); \
} }

View File

@ -56,25 +56,25 @@ struct xmms2_s {
int update_xmms2(void); int update_xmms2(void);
void print_xmms2_tracknr(struct text_object *, char *, int); void print_xmms2_tracknr(struct text_object *, char *, unsigned int);
void print_xmms2_elapsed(struct text_object *, char *, int); void print_xmms2_elapsed(struct text_object *, char *, unsigned int);
void print_xmms2_duration(struct text_object *, char *, int); void print_xmms2_duration(struct text_object *, char *, unsigned int);
double xmms2_barval(struct text_object *); double xmms2_barval(struct text_object *);
void print_xmms2_smart(struct text_object *, char *, int); void print_xmms2_smart(struct text_object *, char *, unsigned int);
void print_xmms2_artist(struct text_object *, char *, int); void print_xmms2_artist(struct text_object *, char *, unsigned int);
void print_xmms2_album(struct text_object *, char *, int); void print_xmms2_album(struct text_object *, char *, unsigned int);
void print_xmms2_title(struct text_object *, char *, int); void print_xmms2_title(struct text_object *, char *, unsigned int);
void print_xmms2_genre(struct text_object *, char *, int); void print_xmms2_genre(struct text_object *, char *, unsigned int);
void print_xmms2_comment(struct text_object *, char *, int); void print_xmms2_comment(struct text_object *, char *, unsigned int);
void print_xmms2_url(struct text_object *, char *, int); void print_xmms2_url(struct text_object *, char *, unsigned int);
void print_xmms2_status(struct text_object *, char *, int); void print_xmms2_status(struct text_object *, char *, unsigned int);
void print_xmms2_date(struct text_object *, char *, int); void print_xmms2_date(struct text_object *, char *, unsigned int);
void print_xmms2_bitrate(struct text_object *, char *, int); void print_xmms2_bitrate(struct text_object *, char *, unsigned int);
void print_xmms2_id(struct text_object *, char *, int); void print_xmms2_id(struct text_object *, char *, unsigned int);
void print_xmms2_size(struct text_object *, char *, int); void print_xmms2_size(struct text_object *, char *, unsigned int);
void print_xmms2_playlist(struct text_object *, char *, int); void print_xmms2_playlist(struct text_object *, char *, unsigned int);
void print_xmms2_timesplayed(struct text_object *, char *, int); void print_xmms2_timesplayed(struct text_object *, char *, unsigned int);
void print_xmms2_percent(struct text_object *, char *, int); void print_xmms2_percent(struct text_object *, char *, unsigned int);
int if_xmms2_connected(struct text_object *); int if_xmms2_connected(struct text_object *);
void free_xmms2(struct text_object *); void free_xmms2(struct text_object *);