mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 18:45:10 +00:00
Complete 'Use unsigned int for p_max_size in obj_cb.print'
This commit is contained in:
parent
18c18277ed
commit
34848ef0b1
@ -198,12 +198,12 @@ void print_audacious_status(struct text_object *, char *p, unsigned int p_max_si
|
||||
}
|
||||
|
||||
void print_audacious_title(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||
snprintf(p, std::min(obj->data.i, p_max_size), "%s", get_res().title.c_str());
|
||||
snprintf(p, std::min((unsigned int) obj->data.i, p_max_size), "%s", get_res().title.c_str());
|
||||
}
|
||||
|
||||
void print_audacious_filename(struct text_object *obj, char *p,
|
||||
unsigned int p_max_size) {
|
||||
snprintf(p, std::min(obj->data.i, p_max_size), "%s",
|
||||
snprintf(p, std::min((unsigned int) obj->data.i, p_max_size), "%s",
|
||||
get_res().filename.c_str());
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ out:
|
||||
}
|
||||
|
||||
bool read_log(size_t *read, size_t *length, time_t *time, uint64_t *timestamp,
|
||||
sd_journal *jh, char *p, int p_max_size) {
|
||||
sd_journal *jh, char *p, unsigned int p_max_size) {
|
||||
struct tm tm;
|
||||
if (sd_journal_get_realtime_usec(jh, timestamp) < 0) return false;
|
||||
*time = *timestamp / 1000000;
|
||||
@ -167,7 +167,7 @@ bool read_log(size_t *read, size_t *length, time_t *time, uint64_t *timestamp,
|
||||
return true;
|
||||
}
|
||||
|
||||
void print_journal(struct text_object *obj, char *p, int p_max_size) {
|
||||
void print_journal(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||
struct journal *j = (struct journal *)obj->data.opaque;
|
||||
sd_journal *jh = nullptr;
|
||||
size_t read = 0;
|
||||
|
@ -2253,7 +2253,7 @@ static char pb_battery_info[3][32];
|
||||
static double pb_battery_info_update;
|
||||
|
||||
#define PMU_PATH "/proc/pmu"
|
||||
void get_powerbook_batt_info(struct text_object *obj, char *buffer, int n) {
|
||||
void get_powerbook_batt_info(struct text_object *obj, char *buffer, unsigned int n) {
|
||||
static int rep = 0;
|
||||
const char *batt_path = PMU_PATH "/battery_0";
|
||||
const char *info_path = PMU_PATH "/info";
|
||||
|
@ -677,7 +677,7 @@ void new_bg(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||
#endif /* BUILD_X11 */
|
||||
|
||||
static void new_bar_in_shell(struct text_object *obj, char *buffer,
|
||||
int buf_max_size, double usage) {
|
||||
unsigned int buf_max_size, double usage) {
|
||||
auto *b = static_cast<struct bar *>(obj->special_data);
|
||||
int width, i, scaledusage;
|
||||
|
||||
|
@ -97,8 +97,8 @@ void new_graph(struct text_object *, char *, int, double);
|
||||
void new_hr(struct text_object *, char *, unsigned int);
|
||||
void new_stippled_hr(struct text_object *, char *, unsigned int);
|
||||
#endif /* BUILD_X11 */
|
||||
void new_gauge(struct text_object *, char *, int, double);
|
||||
void new_bar(struct text_object *, char *, int, double);
|
||||
void new_gauge(struct text_object *, char *, unsigned int, double);
|
||||
void new_bar(struct text_object *, char *, unsigned int, double);
|
||||
void new_fg(struct text_object *, char *, unsigned int);
|
||||
void new_bg(struct text_object *, char *, unsigned int);
|
||||
void new_outline(struct text_object *, char *, unsigned int);
|
||||
|
12
src/top.cc
12
src/top.cc
@ -484,7 +484,7 @@ static conky::range_config_setting<unsigned int> top_name_width(
|
||||
static conky::simple_config_setting<bool> top_name_verbose("top_name_verbose",
|
||||
false, true);
|
||||
|
||||
static void print_top_name(struct text_object *obj, char *p, int p_max_size) {
|
||||
static void print_top_name(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||
auto *td = static_cast<struct top_data *>(obj->data.opaque);
|
||||
int width;
|
||||
|
||||
@ -503,7 +503,7 @@ static void print_top_name(struct text_object *obj, char *p, int p_max_size) {
|
||||
}
|
||||
}
|
||||
|
||||
static void print_top_mem(struct text_object *obj, char *p, int p_max_size) {
|
||||
static void print_top_mem(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||
auto *td = static_cast<struct top_data *>(obj->data.opaque);
|
||||
int width;
|
||||
|
||||
@ -517,7 +517,7 @@ static void print_top_mem(struct text_object *obj, char *p, int p_max_size) {
|
||||
(static_cast<float>(td->list[td->num]->rss) / info.memmax) / 10);
|
||||
}
|
||||
|
||||
static void print_top_time(struct text_object *obj, char *p, int p_max_size) {
|
||||
static void print_top_time(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||
auto *td = static_cast<struct top_data *>(obj->data.opaque);
|
||||
int width;
|
||||
char *timeval;
|
||||
@ -533,7 +533,7 @@ static void print_top_time(struct text_object *obj, char *p, int p_max_size) {
|
||||
free(timeval);
|
||||
}
|
||||
|
||||
static void print_top_user(struct text_object *obj, char *p, int p_max_size) {
|
||||
static void print_top_user(struct text_object *obj, char *p, unsigned int p_max_size) {
|
||||
auto *td = static_cast<struct top_data *>(obj->data.opaque);
|
||||
struct passwd *pw;
|
||||
|
||||
@ -552,7 +552,7 @@ static void print_top_user(struct text_object *obj, char *p, int p_max_size) {
|
||||
|
||||
#define PRINT_TOP_GENERATOR(name, width, fmt, field) \
|
||||
static void print_top_##name(struct text_object *obj, char *p, \
|
||||
int p_max_size) { \
|
||||
unsigned int p_max_size) { \
|
||||
struct top_data *td = (struct top_data *)obj->data.opaque; \
|
||||
if (!td || !td->list || !td->list[td->num]) return; \
|
||||
snprintf(p, MIN(p_max_size, width), fmt, td->list[td->num]->field); \
|
||||
@ -560,7 +560,7 @@ static void print_top_user(struct text_object *obj, char *p, int p_max_size) {
|
||||
|
||||
#define PRINT_TOP_HR_GENERATOR(name, field, denom) \
|
||||
static void print_top_##name(struct text_object *obj, char *p, \
|
||||
int p_max_size) { \
|
||||
unsigned int p_max_size) { \
|
||||
struct top_data *td = (struct top_data *)obj->data.opaque; \
|
||||
if (!td || !td->list || !td->list[td->num]) return; \
|
||||
human_readable(td->list[td->num]->field / (denom), p, p_max_size); \
|
||||
|
Loading…
Reference in New Issue
Block a user