mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-04-10 11:21:52 +00:00
Apply fixes from sonar.
This commit is contained in:
parent
2e6894f564
commit
8e1d3cfdd3
@ -1253,7 +1253,9 @@ std::string string_replace_all(std::string original, const std::string &oldpart,
|
||||
}
|
||||
|
||||
static void draw_string(const char *s) {
|
||||
int i, i2, pos;
|
||||
int i;
|
||||
int i2;
|
||||
int pos;
|
||||
#ifdef BUILD_X11
|
||||
int width_of_s;
|
||||
#endif /* BUILD_X11 */
|
||||
|
@ -42,10 +42,9 @@ struct diskio_stat {
|
||||
last(UINT_MAX),
|
||||
last_read(UINT_MAX),
|
||||
last_write(UINT_MAX) {
|
||||
std::memset(sample, 0, sizeof(sample[0]) * sizeof(sample));
|
||||
std::memset(sample_read, 0, sizeof(sample_read[0]) * sizeof(sample_read));
|
||||
std::memset(sample_write, 0,
|
||||
sizeof(sample_write[0]) * sizeof(sample_write));
|
||||
std::memset(sample, 0, sizeof(sample));
|
||||
std::memset(sample_read, 0, sizeof(sample_read));
|
||||
std::memset(sample_write, 0, sizeof(sample_write));
|
||||
}
|
||||
struct diskio_stat *next;
|
||||
char *dev;
|
||||
|
@ -47,9 +47,10 @@ static conky::simple_config_setting<std::string> hddtemp_host("hddtemp_host",
|
||||
static conky::simple_config_setting<std::string> hddtemp_port("hddtemp_port",
|
||||
"7634", false);
|
||||
|
||||
struct hdd_info {
|
||||
class hdd_info {
|
||||
public:
|
||||
hdd_info() : next(0) {}
|
||||
struct hdd_info *next;
|
||||
hdd_info *next;
|
||||
char *dev;
|
||||
short temp;
|
||||
char unit;
|
||||
@ -61,9 +62,9 @@ struct hdd_info {
|
||||
}
|
||||
};
|
||||
|
||||
struct hdd_info hdd_info_head;
|
||||
hdd_info hdd_info_head;
|
||||
|
||||
static void __free_hddtemp_info(struct hdd_info *hdi) {
|
||||
static void __free_hddtemp_info(hdd_info *hdi) {
|
||||
if (hdi->next) __free_hddtemp_info(hdi->next);
|
||||
free(hdi->dev);
|
||||
delete hdi;
|
||||
@ -77,7 +78,7 @@ static void free_hddtemp_info(void) {
|
||||
}
|
||||
|
||||
static void add_hddtemp_info(char *dev, short temp, char unit) {
|
||||
struct hdd_info *hdi = &hdd_info_head;
|
||||
hdd_info *hdi = &hdd_info_head;
|
||||
|
||||
DBGP("add_hddtemp_info(%s, %d, %c) being called", dev, temp, unit);
|
||||
while (hdi->next) hdi = hdi->next;
|
||||
@ -212,7 +213,7 @@ void free_hddtemp(struct text_object *obj) {
|
||||
}
|
||||
|
||||
static int get_hddtemp_info(const char *dev, short *val, char *unit) {
|
||||
struct hdd_info *hdi = hdd_info_head.next;
|
||||
hdd_info *hdi = hdd_info_head.next;
|
||||
|
||||
/* if no dev is given, just use hdd_info_head->next */
|
||||
while (dev && hdi) {
|
||||
|
@ -549,7 +549,8 @@ END_TRUE:
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct _dns_data {
|
||||
class _dns_data {
|
||||
public:
|
||||
_dns_data() = default;
|
||||
int nscount{0};
|
||||
char **ns_list{nullptr};
|
||||
|
@ -221,7 +221,13 @@ void init_pulseaudio(struct text_object *obj) {
|
||||
}
|
||||
pa_threaded_mainloop_start(pulseaudio->mainloop);
|
||||
|
||||
while (pulseaudio->cstate != PULSE_CONTEXT_READY) { usleep(200); }
|
||||
while (pulseaudio->cstate != PULSE_CONTEXT_READY) {
|
||||
struct timespec tim, tim2;
|
||||
tim.tv_sec = 1;
|
||||
tim.tv_nsec = 200000;
|
||||
|
||||
nanosleep(&tim, &tim2);
|
||||
}
|
||||
|
||||
// Initial parameters update
|
||||
|
||||
|
@ -116,7 +116,9 @@ void callback_base::start_routine() {
|
||||
|
||||
// clear any remaining posts in case the previous iteration was very slow
|
||||
// (this should only happen if wait == false)
|
||||
while (sem_start.trywait()) {}
|
||||
while (sem_start.trywait()) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
work();
|
||||
if (wait) { sem_wait.post(); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user