mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-12-25 12:10:03 +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
|
||||
matrix:
|
||||
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
|
||||
dist: xenial
|
||||
addons:
|
||||
@ -35,7 +78,7 @@ matrix:
|
||||
- libcurl4-gnutls-dev
|
||||
- audacious-dev
|
||||
- libsystemd-dev
|
||||
- libxml2-dev
|
||||
- libxnvctrl-dev
|
||||
- gawk
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
|
||||
@ -73,7 +116,7 @@ matrix:
|
||||
- libcurl4-gnutls-dev
|
||||
- audacious-dev
|
||||
- libsystemd-dev
|
||||
- libxml2-dev
|
||||
- libxnvctrl-dev
|
||||
- gawk
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-6 && CXX=g++-6"
|
||||
@ -111,7 +154,7 @@ matrix:
|
||||
- libcurl4-gnutls-dev
|
||||
- audacious-dev
|
||||
- libsystemd-dev
|
||||
- libxml2-dev
|
||||
- libxnvctrl-dev
|
||||
- gawk
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
|
||||
@ -149,7 +192,7 @@ matrix:
|
||||
- libcurl4-gnutls-dev
|
||||
- audacious-dev
|
||||
- libsystemd-dev
|
||||
- libxml2-dev
|
||||
- libxnvctrl-dev
|
||||
- gawk
|
||||
env:
|
||||
- MATRIX_EVAL="CC=gcc-8 && CXX=g++-8"
|
||||
@ -187,53 +230,10 @@ matrix:
|
||||
- libcurl4-gnutls-dev
|
||||
- audacious-dev
|
||||
- libsystemd-dev
|
||||
- libxml2-dev
|
||||
- libxnvctrl-dev
|
||||
- gawk
|
||||
env:
|
||||
- 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
|
||||
osx_image: xcode9.4
|
||||
- os: osx
|
||||
@ -267,6 +267,7 @@ before_script:
|
||||
-DBUILD_PULSEAUDIO=ON \
|
||||
-DBUILD_JOURNAL=ON \
|
||||
-DBUILD_RSS=ON \
|
||||
-DBUILD_NVIDIA=ON \
|
||||
..
|
||||
cd ..
|
||||
mkdir build-no-x11
|
||||
|
@ -1,4 +1,4 @@
|
||||
FROM ubuntu:latest
|
||||
FROM ubuntu:bionic AS base
|
||||
RUN apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive \
|
||||
apt-get install -qy --no-install-recommends \
|
||||
@ -28,6 +28,8 @@ RUN apt-get update \
|
||||
libxnvctrl-dev \
|
||||
libiw-dev
|
||||
|
||||
FROM base
|
||||
|
||||
COPY . /conky
|
||||
WORKDIR /conky/build
|
||||
ARG X11=yes
|
||||
|
@ -1014,7 +1014,7 @@ int update_stat(void) {
|
||||
|
||||
cpu[idx].cpu_last_total = cpu[idx].cpu_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];
|
||||
}
|
||||
}
|
||||
@ -1171,7 +1171,8 @@ static int open_sysfs_sensor(const char *dir, const char *dev, const char *type,
|
||||
fd = open(path, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
/* 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);
|
||||
fd = open(path, O_RDONLY);
|
||||
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 */
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
DIR *dir;
|
||||
char *dirname;
|
||||
std::string dirname(mail->mbox);
|
||||
struct dirent *dirent;
|
||||
char *mailflags;
|
||||
size_t dirname_len = strlen(mail->mbox) + 5;
|
||||
|
||||
mail->mail_count = mail->new_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->replied_mail_count = mail->unreplied_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 */
|
||||
strcat(dirname, "cur");
|
||||
dirname = dirname + "/cur";
|
||||
|
||||
dir = opendir(dirname);
|
||||
dir = opendir(dirname.c_str());
|
||||
if (dir == nullptr) {
|
||||
NORM_ERR("cannot open directory");
|
||||
free(dirname);
|
||||
return;
|
||||
}
|
||||
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, ','))));
|
||||
if (mailflags == nullptr) {
|
||||
NORM_ERR("malloc");
|
||||
free(dirname);
|
||||
return;
|
||||
}
|
||||
strcpy(mailflags, strrchr(dirent->d_name, ','));
|
||||
@ -302,13 +292,12 @@ static void update_mail_count(struct local_mail_s *mail) {
|
||||
}
|
||||
closedir(dir);
|
||||
|
||||
dirname[std::max(0UL, strnlen(dirname, dirname_len - 1) - 3)] = '\0';
|
||||
strcat(dirname, "new");
|
||||
dirname.resize(dirname.size() - 3);
|
||||
dirname = dirname + "new";
|
||||
|
||||
dir = opendir(dirname);
|
||||
dir = opendir(dirname.c_str());
|
||||
if (dir == nullptr) {
|
||||
NORM_ERR("cannot open directory");
|
||||
free(dirname);
|
||||
return;
|
||||
}
|
||||
dirent = readdir(dir);
|
||||
@ -323,7 +312,6 @@ static void update_mail_count(struct local_mail_s *mail) {
|
||||
}
|
||||
closedir(dir);
|
||||
|
||||
free(dirname);
|
||||
return;
|
||||
}
|
||||
#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,
|
||||
int gid) {
|
||||
static nvidia_c_string ac_string[MAXNUMGPU];
|
||||
(void)tid;
|
||||
(void)aid;
|
||||
|
||||
if (update) {
|
||||
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);
|
||||
int value, temp1, temp2;
|
||||
char *str;
|
||||
Bool ret;
|
||||
int event_base;
|
||||
int error_base;
|
||||
|
||||
@ -924,6 +925,7 @@ void print_nvidia_value(struct text_object *obj, char *p,
|
||||
value = -1;
|
||||
break;
|
||||
}
|
||||
/* falls through */
|
||||
default:
|
||||
value = get_nvidia_value(nvs->target, nvs->attribute, nvs->gpu_id,
|
||||
nvs->arg);
|
||||
@ -974,6 +976,8 @@ void print_nvidia_value(struct text_object *obj, char *p,
|
||||
nvs->arg);
|
||||
value = ((float)temp1 * 100 / (float)temp2) + 0.5;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1027,7 +1031,7 @@ double get_nvidia_barval(struct text_object *obj) {
|
||||
NORM_ERR(
|
||||
"%s: invalid argument specified: '%s' (using 'fanlevel' instead).",
|
||||
nvs->command, nvs->arg);
|
||||
// No break, continue into fanlevel
|
||||
/* falls through */
|
||||
case ATTR_FAN_LEVEL: // fanlevel
|
||||
value = get_nvidia_value(nvs->target, ATTR_FAN_LEVEL, nvs->gpu_id,
|
||||
nvs->arg);
|
||||
@ -1064,7 +1068,7 @@ double get_nvidia_barval(struct text_object *obj) {
|
||||
value = ((float)temp1 * 100 / (float)temp2) + 0.5;
|
||||
break;
|
||||
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
|
||||
CRIT_ERR(nullptr, NULL,
|
||||
"%s: attribute is 'ATTR_FREQS_STRING' but token is not "
|
||||
|
Loading…
Reference in New Issue
Block a user