1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-15 17:47:09 +00:00

Workaround for 2 sonarcloud complaints

This commit is contained in:
Nikolas Garofil 2018-08-08 20:28:36 +02:00 committed by Brenden Matthews
parent 38959715e5
commit 37a85ad8b0
2 changed files with 35 additions and 13 deletions

View File

@ -228,17 +228,23 @@ double audacious_barval(struct text_object *) {
AUDACIOUS_TIME_GENERATOR(length)
AUDACIOUS_TIME_GENERATOR(position)
#define AUDACIOUS_INT_GENERATOR(name, offset) \
#define AUDACIOUS_INT_GENERATOR_0(name) \
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); \
}
AUDACIOUS_INT_GENERATOR(bitrate, 0)
AUDACIOUS_INT_GENERATOR(frequency, 0)
AUDACIOUS_INT_GENERATOR(channels, 0)
AUDACIOUS_INT_GENERATOR(playlist_length, 0)
AUDACIOUS_INT_GENERATOR(playlist_position, 1)
AUDACIOUS_INT_GENERATOR(main_volume, 0)
#define AUDACIOUS_INT_GENERATOR_1(name) \
void print_audacious_##name(struct text_object *, char *p, \
unsigned int p_max_size) { \
snprintf(p, p_max_size, "%d", get_res().name + 1); \
}
AUDACIOUS_INT_GENERATOR_0(bitrate)
AUDACIOUS_INT_GENERATOR_0(frequency)
AUDACIOUS_INT_GENERATOR_0(channels)
AUDACIOUS_INT_GENERATOR_0(playlist_length)
AUDACIOUS_INT_GENERATOR_1(playlist_position)
AUDACIOUS_INT_GENERATOR_0(main_volume)
#undef AUDACIOUS_PRINT_GENERATOR

View File

@ -1296,17 +1296,33 @@ void xpmdb_swap_buffers(void) {
}
#endif /* BUILD_XDBE */
#define LOCK_TEMPLATE(func, num) \
#define LOCK_TEMPLATE_1(func) \
void print_##func(struct text_object *obj, char *p, unsigned int p_max_size) { \
(void)obj; \
XKeyboardState x; \
XGetKeyboardControl(display, &x); \
snprintf(p, p_max_size, "%s", (x.led_mask & num ? "On" : "Off")); \
snprintf(p, p_max_size, "%s", (x.led_mask & 1 ? "On" : "Off")); \
}
LOCK_TEMPLATE(num_led, 2)
LOCK_TEMPLATE(caps_led, 1)
LOCK_TEMPLATE(scroll_led, 4)
#define LOCK_TEMPLATE_2(func) \
void print_##func(struct text_object *obj, char *p, unsigned int p_max_size) { \
(void)obj; \
XKeyboardState x; \
XGetKeyboardControl(display, &x); \
snprintf(p, p_max_size, "%s", (x.led_mask & 2 ? "On" : "Off")); \
}
#define LOCK_TEMPLATE_4(func) \
void print_##func(struct text_object *obj, char *p, unsigned int p_max_size) { \
(void)obj; \
XKeyboardState x; \
XGetKeyboardControl(display, &x); \
snprintf(p, p_max_size, "%s", (x.led_mask & 4 ? "On" : "Off")); \
}
LOCK_TEMPLATE_2(num_led)
LOCK_TEMPLATE_1(caps_led)
LOCK_TEMPLATE_4(scroll_led)
void print_kb_layout(struct text_object *obj, char *p, unsigned int p_max_size) {
(void)obj;