mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 20:11:11 +00:00
Fix some more sonar issues.
Run clang-7 build first so that sonar data gets reported earlier, enable nvidia in travis builds.
This commit is contained in:
parent
9af6fa7903
commit
3c5fd4399a
97
.travis.yml
97
.travis.yml
@ -1,6 +1,49 @@
|
|||||||
language: cpp
|
language: cpp
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
|
- os: linux
|
||||||
|
dist: xenial
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
sources:
|
||||||
|
- llvm-toolchain-xenial-7
|
||||||
|
packages:
|
||||||
|
- clang-7
|
||||||
|
- libc++-7-dev
|
||||||
|
- cmake
|
||||||
|
- docbook2x
|
||||||
|
- libxdamage-dev
|
||||||
|
- libx11-dev
|
||||||
|
- libxft-dev
|
||||||
|
- libxext-dev
|
||||||
|
- libglib2.0-dev
|
||||||
|
- libxml2-dev
|
||||||
|
- libcurl4-gnutls-dev
|
||||||
|
- liblua5.3-dev
|
||||||
|
- libcairo2-dev
|
||||||
|
- libimlib2-dev
|
||||||
|
- libxinerama-dev
|
||||||
|
- libmysqlclient-dev
|
||||||
|
- libical-dev
|
||||||
|
- libircclient-dev
|
||||||
|
- libcairo2-dev
|
||||||
|
- libmicrohttpd-dev
|
||||||
|
- ncurses-dev
|
||||||
|
- librsvg2-dev
|
||||||
|
- libaudclient-dev
|
||||||
|
- libxmmsclient-dev
|
||||||
|
- libpulse-dev
|
||||||
|
- libcurl4-gnutls-dev
|
||||||
|
- audacious-dev
|
||||||
|
- libsystemd-dev
|
||||||
|
- libxnvctrl-dev
|
||||||
|
- gawk
|
||||||
|
sonarcloud:
|
||||||
|
organization: "brndnmtthws-github"
|
||||||
|
token:
|
||||||
|
secure: "KikPusy+HXcEVLr0Dqb6mkrefDU5jm7EGQ5fwO4sBG7bRMcnHV3V14s5yB4Ol8btpUC0nkNn/41+f37lkG+oT4y9ZeIH2ZrhsSEHxOgH6DF9ZSVJwtpLrF9siWgfZ0m5c5V7U5rzVYL3jlO1hQfXKCfMNAcwlKcEUrfpk7jVEZc="
|
||||||
|
env:
|
||||||
|
- MATRIX_EVAL="CC=clang-7 && CXX=clang++-7"
|
||||||
- os: linux
|
- os: linux
|
||||||
dist: xenial
|
dist: xenial
|
||||||
addons:
|
addons:
|
||||||
@ -35,7 +78,7 @@ matrix:
|
|||||||
- libcurl4-gnutls-dev
|
- libcurl4-gnutls-dev
|
||||||
- audacious-dev
|
- audacious-dev
|
||||||
- libsystemd-dev
|
- libsystemd-dev
|
||||||
- libxml2-dev
|
- libxnvctrl-dev
|
||||||
- gawk
|
- gawk
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
|
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
|
||||||
@ -73,7 +116,7 @@ matrix:
|
|||||||
- libcurl4-gnutls-dev
|
- libcurl4-gnutls-dev
|
||||||
- audacious-dev
|
- audacious-dev
|
||||||
- libsystemd-dev
|
- libsystemd-dev
|
||||||
- libxml2-dev
|
- libxnvctrl-dev
|
||||||
- gawk
|
- gawk
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
|
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
|
||||||
@ -111,7 +154,7 @@ matrix:
|
|||||||
- libcurl4-gnutls-dev
|
- libcurl4-gnutls-dev
|
||||||
- audacious-dev
|
- audacious-dev
|
||||||
- libsystemd-dev
|
- libsystemd-dev
|
||||||
- libxml2-dev
|
- libxnvctrl-dev
|
||||||
- gawk
|
- gawk
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
|
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
|
||||||
@ -149,7 +192,7 @@ matrix:
|
|||||||
- libcurl4-gnutls-dev
|
- libcurl4-gnutls-dev
|
||||||
- audacious-dev
|
- audacious-dev
|
||||||
- libsystemd-dev
|
- libsystemd-dev
|
||||||
- libxml2-dev
|
- libxnvctrl-dev
|
||||||
- gawk
|
- gawk
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"
|
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"
|
||||||
@ -187,53 +230,10 @@ matrix:
|
|||||||
- libcurl4-gnutls-dev
|
- libcurl4-gnutls-dev
|
||||||
- audacious-dev
|
- audacious-dev
|
||||||
- libsystemd-dev
|
- libsystemd-dev
|
||||||
- libxml2-dev
|
- libxnvctrl-dev
|
||||||
- gawk
|
- gawk
|
||||||
env:
|
env:
|
||||||
- MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0"
|
- MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0"
|
||||||
- os: linux
|
|
||||||
dist: xenial
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- llvm-toolchain-xenial-7
|
|
||||||
packages:
|
|
||||||
- clang-7
|
|
||||||
- libc++-7-dev
|
|
||||||
- cmake
|
|
||||||
- docbook2x
|
|
||||||
- libxdamage-dev
|
|
||||||
- libx11-dev
|
|
||||||
- libxft-dev
|
|
||||||
- libxext-dev
|
|
||||||
- libglib2.0-dev
|
|
||||||
- libxml2-dev
|
|
||||||
- libcurl4-gnutls-dev
|
|
||||||
- liblua5.3-dev
|
|
||||||
- libcairo2-dev
|
|
||||||
- libimlib2-dev
|
|
||||||
- libxinerama-dev
|
|
||||||
- libmysqlclient-dev
|
|
||||||
- libical-dev
|
|
||||||
- libircclient-dev
|
|
||||||
- libcairo2-dev
|
|
||||||
- libmicrohttpd-dev
|
|
||||||
- ncurses-dev
|
|
||||||
- librsvg2-dev
|
|
||||||
- libaudclient-dev
|
|
||||||
- libxmmsclient-dev
|
|
||||||
- libpulse-dev
|
|
||||||
- libcurl4-gnutls-dev
|
|
||||||
- audacious-dev
|
|
||||||
- libsystemd-dev
|
|
||||||
- libxml2-dev
|
|
||||||
- gawk
|
|
||||||
sonarcloud:
|
|
||||||
organization: "brndnmtthws-github"
|
|
||||||
token:
|
|
||||||
secure: "KikPusy+HXcEVLr0Dqb6mkrefDU5jm7EGQ5fwO4sBG7bRMcnHV3V14s5yB4Ol8btpUC0nkNn/41+f37lkG+oT4y9ZeIH2ZrhsSEHxOgH6DF9ZSVJwtpLrF9siWgfZ0m5c5V7U5rzVYL3jlO1hQfXKCfMNAcwlKcEUrfpk7jVEZc="
|
|
||||||
env:
|
|
||||||
- MATRIX_EVAL="CC=clang-7 && CXX=clang++-7"
|
|
||||||
- os: osx
|
- os: osx
|
||||||
osx_image: xcode9.4
|
osx_image: xcode9.4
|
||||||
- os: osx
|
- os: osx
|
||||||
@ -267,6 +267,7 @@ before_script:
|
|||||||
-DBUILD_PULSEAUDIO=ON \
|
-DBUILD_PULSEAUDIO=ON \
|
||||||
-DBUILD_JOURNAL=ON \
|
-DBUILD_JOURNAL=ON \
|
||||||
-DBUILD_RSS=ON \
|
-DBUILD_RSS=ON \
|
||||||
|
-DBUILD_NVIDIA=ON \
|
||||||
..
|
..
|
||||||
cd ..
|
cd ..
|
||||||
mkdir build-no-x11
|
mkdir build-no-x11
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
FROM ubuntu:latest
|
FROM ubuntu:bionic AS base
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& DEBIAN_FRONTEND=noninteractive \
|
&& DEBIAN_FRONTEND=noninteractive \
|
||||||
apt-get install -qy --no-install-recommends \
|
apt-get install -qy --no-install-recommends \
|
||||||
@ -28,6 +28,8 @@ RUN apt-get update \
|
|||||||
libxnvctrl-dev \
|
libxnvctrl-dev \
|
||||||
libiw-dev
|
libiw-dev
|
||||||
|
|
||||||
|
FROM base
|
||||||
|
|
||||||
COPY . /conky
|
COPY . /conky
|
||||||
WORKDIR /conky/build
|
WORKDIR /conky/build
|
||||||
ARG X11=yes
|
ARG X11=yes
|
||||||
|
@ -1014,7 +1014,7 @@ int update_stat(void) {
|
|||||||
|
|
||||||
cpu[idx].cpu_last_total = cpu[idx].cpu_total;
|
cpu[idx].cpu_last_total = cpu[idx].cpu_total;
|
||||||
cpu[idx].cpu_last_active_total = cpu[idx].cpu_active_total;
|
cpu[idx].cpu_last_active_total = cpu[idx].cpu_active_total;
|
||||||
for (i = samples - 1; i > 1; i--) {
|
for (i = samples - 1; i > 0; i--) {
|
||||||
cpu[idx].cpu_val[i] = cpu[idx].cpu_val[i - 1];
|
cpu[idx].cpu_val[i] = cpu[idx].cpu_val[i - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1171,7 +1171,8 @@ static int open_sysfs_sensor(const char *dir, const char *dev, const char *type,
|
|||||||
fd = open(path, O_RDONLY);
|
fd = open(path, O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
/* if it fails, strip the /device from dev and attempt again */
|
/* if it fails, strip the /device from dev and attempt again */
|
||||||
buf[std::max(0UL, strnlen(buf, 255) - 7)] = 0;
|
size_t len_to_trunc = std::max(7UL, strnlen(buf, 255)) - 7;
|
||||||
|
buf[len_to_trunc] = 0;
|
||||||
snprintf(path, 255, "%s%s/%s%d_input", dir, dev, type, n);
|
snprintf(path, 255, "%s%s/%s%d_input", dir, dev, type, n);
|
||||||
fd = open(path, O_RDONLY);
|
fd = open(path, O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
|
24
src/mail.cc
24
src/mail.cc
@ -226,10 +226,9 @@ static void update_mail_count(struct local_mail_s *mail) {
|
|||||||
/* maildir format */
|
/* maildir format */
|
||||||
if (S_ISDIR(st.st_mode)) {
|
if (S_ISDIR(st.st_mode)) {
|
||||||
DIR *dir;
|
DIR *dir;
|
||||||
char *dirname;
|
std::string dirname(mail->mbox);
|
||||||
struct dirent *dirent;
|
struct dirent *dirent;
|
||||||
char *mailflags;
|
char *mailflags;
|
||||||
size_t dirname_len = strlen(mail->mbox) + 5;
|
|
||||||
|
|
||||||
mail->mail_count = mail->new_mail_count = 0;
|
mail->mail_count = mail->new_mail_count = 0;
|
||||||
mail->seen_mail_count = mail->unseen_mail_count = 0;
|
mail->seen_mail_count = mail->unseen_mail_count = 0;
|
||||||
@ -237,20 +236,12 @@ static void update_mail_count(struct local_mail_s *mail) {
|
|||||||
mail->forwarded_mail_count = mail->unforwarded_mail_count = 0;
|
mail->forwarded_mail_count = mail->unforwarded_mail_count = 0;
|
||||||
mail->replied_mail_count = mail->unreplied_mail_count = 0;
|
mail->replied_mail_count = mail->unreplied_mail_count = 0;
|
||||||
mail->draft_mail_count = mail->trashed_mail_count = 0;
|
mail->draft_mail_count = mail->trashed_mail_count = 0;
|
||||||
dirname = static_cast<char *>(malloc(sizeof(char) * dirname_len));
|
|
||||||
if (dirname == nullptr) {
|
|
||||||
NORM_ERR("malloc");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
strcpy(dirname, mail->mbox);
|
|
||||||
strcat(dirname, "/");
|
|
||||||
/* checking the cur subdirectory */
|
/* checking the cur subdirectory */
|
||||||
strcat(dirname, "cur");
|
dirname = dirname + "/cur";
|
||||||
|
|
||||||
dir = opendir(dirname);
|
dir = opendir(dirname.c_str());
|
||||||
if (dir == nullptr) {
|
if (dir == nullptr) {
|
||||||
NORM_ERR("cannot open directory");
|
NORM_ERR("cannot open directory");
|
||||||
free(dirname);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dirent = readdir(dir);
|
dirent = readdir(dir);
|
||||||
@ -262,7 +253,6 @@ static void update_mail_count(struct local_mail_s *mail) {
|
|||||||
malloc(sizeof(char) * strlen(strrchr(dirent->d_name, ','))));
|
malloc(sizeof(char) * strlen(strrchr(dirent->d_name, ','))));
|
||||||
if (mailflags == nullptr) {
|
if (mailflags == nullptr) {
|
||||||
NORM_ERR("malloc");
|
NORM_ERR("malloc");
|
||||||
free(dirname);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
strcpy(mailflags, strrchr(dirent->d_name, ','));
|
strcpy(mailflags, strrchr(dirent->d_name, ','));
|
||||||
@ -302,13 +292,12 @@ static void update_mail_count(struct local_mail_s *mail) {
|
|||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
|
||||||
dirname[std::max(0UL, strnlen(dirname, dirname_len - 1) - 3)] = '\0';
|
dirname.resize(dirname.size() - 3);
|
||||||
strcat(dirname, "new");
|
dirname = dirname + "new";
|
||||||
|
|
||||||
dir = opendir(dirname);
|
dir = opendir(dirname.c_str());
|
||||||
if (dir == nullptr) {
|
if (dir == nullptr) {
|
||||||
NORM_ERR("cannot open directory");
|
NORM_ERR("cannot open directory");
|
||||||
free(dirname);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dirent = readdir(dir);
|
dirent = readdir(dir);
|
||||||
@ -323,7 +312,6 @@ static void update_mail_count(struct local_mail_s *mail) {
|
|||||||
}
|
}
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
|
||||||
free(dirname);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -763,6 +763,8 @@ static int cache_nvidia_string_value(TARGET_ID tid, ATTR_ID aid, char *token,
|
|||||||
SEARCH_ID search, int *value, int update,
|
SEARCH_ID search, int *value, int update,
|
||||||
int gid) {
|
int gid) {
|
||||||
static nvidia_c_string ac_string[MAXNUMGPU];
|
static nvidia_c_string ac_string[MAXNUMGPU];
|
||||||
|
(void)tid;
|
||||||
|
(void)aid;
|
||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
if (strcmp(token, (char *)"nvclockmin") == 0 &&
|
if (strcmp(token, (char *)"nvclockmin") == 0 &&
|
||||||
@ -885,7 +887,6 @@ void print_nvidia_value(struct text_object *obj, char *p,
|
|||||||
struct nvidia_s *nvs = static_cast<nvidia_s *>(obj->data.opaque);
|
struct nvidia_s *nvs = static_cast<nvidia_s *>(obj->data.opaque);
|
||||||
int value, temp1, temp2;
|
int value, temp1, temp2;
|
||||||
char *str;
|
char *str;
|
||||||
Bool ret;
|
|
||||||
int event_base;
|
int event_base;
|
||||||
int error_base;
|
int error_base;
|
||||||
|
|
||||||
@ -924,6 +925,7 @@ void print_nvidia_value(struct text_object *obj, char *p,
|
|||||||
value = -1;
|
value = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* falls through */
|
||||||
default:
|
default:
|
||||||
value = get_nvidia_value(nvs->target, nvs->attribute, nvs->gpu_id,
|
value = get_nvidia_value(nvs->target, nvs->attribute, nvs->gpu_id,
|
||||||
nvs->arg);
|
nvs->arg);
|
||||||
@ -974,6 +976,8 @@ void print_nvidia_value(struct text_object *obj, char *p,
|
|||||||
nvs->arg);
|
nvs->arg);
|
||||||
value = ((float)temp1 * 100 / (float)temp2) + 0.5;
|
value = ((float)temp1 * 100 / (float)temp2) + 0.5;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1027,7 +1031,7 @@ double get_nvidia_barval(struct text_object *obj) {
|
|||||||
NORM_ERR(
|
NORM_ERR(
|
||||||
"%s: invalid argument specified: '%s' (using 'fanlevel' instead).",
|
"%s: invalid argument specified: '%s' (using 'fanlevel' instead).",
|
||||||
nvs->command, nvs->arg);
|
nvs->command, nvs->arg);
|
||||||
// No break, continue into fanlevel
|
/* falls through */
|
||||||
case ATTR_FAN_LEVEL: // fanlevel
|
case ATTR_FAN_LEVEL: // fanlevel
|
||||||
value = get_nvidia_value(nvs->target, ATTR_FAN_LEVEL, nvs->gpu_id,
|
value = get_nvidia_value(nvs->target, ATTR_FAN_LEVEL, nvs->gpu_id,
|
||||||
nvs->arg);
|
nvs->arg);
|
||||||
@ -1064,7 +1068,7 @@ double get_nvidia_barval(struct text_object *obj) {
|
|||||||
value = ((float)temp1 * 100 / (float)temp2) + 0.5;
|
value = ((float)temp1 * 100 / (float)temp2) + 0.5;
|
||||||
break;
|
break;
|
||||||
case ATTR_FREQS_STRING: // mtrfreq (calculate out of memfreqmax)
|
case ATTR_FREQS_STRING: // mtrfreq (calculate out of memfreqmax)
|
||||||
if (nvs->token == "memTransferRate") {
|
if (strcmp(nvs->token, "memTransferRate") != 0) {
|
||||||
// Just in case error for silly devs
|
// Just in case error for silly devs
|
||||||
CRIT_ERR(nullptr, NULL,
|
CRIT_ERR(nullptr, NULL,
|
||||||
"%s: attribute is 'ATTR_FREQS_STRING' but token is not "
|
"%s: attribute is 'ATTR_FREQS_STRING' but token is not "
|
||||||
|
Loading…
Reference in New Issue
Block a user