deal with some gcc15 warnings
authornotaz <notasas@gmail.com>
Mon, 13 Apr 2026 23:01:45 +0000 (02:01 +0300)
committernotaz <notasas@gmail.com>
Tue, 14 Apr 2026 20:10:45 +0000 (23:10 +0300)
frontend/main.c
frontend/plugin_lib.c
plugins/dfsound/oss.c

index ee2de1c..e761b3e 100644 (file)
@@ -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);
index f17b6b4..d912f5f 100644 (file)
@@ -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;
index 6b1cb4a..4cbdace 100644 (file)
 #include <sys/soundcard.h>
 #include "out.h"
 
+#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
+#pragma GCC diagnostic ignored "-Wunused-result"
+#endif
+
 ////////////////////////////////////////////////////////////////////////
 // oss globals
 ////////////////////////////////////////////////////////////////////////