From: notaz Date: Mon, 13 Apr 2026 23:01:45 +0000 (+0300) Subject: deal with some gcc15 warnings X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=591b7a04cc64fcf1ef9ef32228b804777b72bb67;p=pcsx_rearmed.git deal with some gcc15 warnings --- diff --git a/frontend/main.c b/frontend/main.c index ee2de1cf..e761b3eb 100644 --- a/frontend/main.c +++ b/frontend/main.c @@ -604,8 +604,8 @@ int main(int argc, char *argv[]) if (i+1 >= argc) break; strncpy(isofilename, argv[++i], MAXPATHLEN); if (isofilename[0] != '/') { - getcwd(path, MAXPATHLEN); - if (strlen(path) + strlen(isofilename) + 1 < MAXPATHLEN) { + if (getcwd(path, MAXPATHLEN) != NULL && + strlen(path) + strlen(isofilename) + 1 < MAXPATHLEN) { strcat(path, "/"); strcat(path, isofilename); strcpy(isofilename, path); @@ -637,8 +637,8 @@ int main(int argc, char *argv[]) } else { strncpy(file, argv[i], MAXPATHLEN); if (file[0] != '/') { - getcwd(path, MAXPATHLEN); - if (strlen(path) + strlen(file) + 1 < MAXPATHLEN) { + if (getcwd(path, MAXPATHLEN) != NULL && + strlen(path) + strlen(file) + 1 < MAXPATHLEN) { strcat(path, "/"); strcat(path, file); strcpy(file, path); diff --git a/frontend/plugin_lib.c b/frontend/plugin_lib.c index f17b6b4c..d912f5fc 100644 --- a/frontend/plugin_lib.c +++ b/frontend/plugin_lib.c @@ -76,16 +76,20 @@ void (*pl_plat_hud_print)(int x, int y, const char *str, int bpp); static __attribute__((noinline)) int get_cpu_ticks(void) { static unsigned long last_utime; - static int fd; + static int fd = -1; unsigned long utime, ret; - char buf[128]; + char buf[256]; + ssize_t n; - if (fd == 0) + if (fd == -1) fd = open("/proc/self/stat", O_RDONLY); + if (fd == -1) + return 0; lseek(fd, 0, SEEK_SET); - buf[0] = 0; - read(fd, buf, sizeof(buf)); - buf[sizeof(buf) - 1] = 0; + n = read(fd, buf, sizeof(buf) - 1); + if (n <= 0) + return 0; + buf[n] = 0; sscanf(buf, "%*d %*s %*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %lu", &utime); ret = utime - last_utime; diff --git a/plugins/dfsound/oss.c b/plugins/dfsound/oss.c index 6b1cb4a5..4cbdace7 100644 --- a/plugins/dfsound/oss.c +++ b/plugins/dfsound/oss.c @@ -25,6 +25,10 @@ #include #include "out.h" +#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) +#pragma GCC diagnostic ignored "-Wunused-result" +#endif + //////////////////////////////////////////////////////////////////////// // oss globals ////////////////////////////////////////////////////////////////////////