From 4f52c04b3b81ef426b7ab60b7618ab0e3997fc5a Mon Sep 17 00:00:00 2001 From: BjossiAlfreds Date: Sat, 26 Oct 2024 19:56:02 +0000 Subject: [PATCH 1/2] Small fix for SDL3 API change for SetClipboardText --- src/client/input/sdl2.c | 5 ++++- src/client/input/sdl3.c | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/client/input/sdl2.c b/src/client/input/sdl2.c index 992d1a88..ed2a28f9 100644 --- a/src/client/input/sdl2.c +++ b/src/client/input/sdl2.c @@ -2441,8 +2441,11 @@ IN_GetClipboardText(char *out, size_t n) SDL_free(s); } +/* Copy string s to the clipboard. + Returns 0 on success, 1 otherwise. +*/ int IN_SetClipboardText(const char *s) { - return SDL_SetClipboardText(s); + return SDL_SetClipboardText(s) != 0; } diff --git a/src/client/input/sdl3.c b/src/client/input/sdl3.c index 52b97535..2bee5218 100644 --- a/src/client/input/sdl3.c +++ b/src/client/input/sdl3.c @@ -2437,8 +2437,13 @@ IN_GetClipboardText(char *out, size_t n) SDL_free(s); } +/* Copy string s to the clipboard. + Returns 0 on success, 1 otherwise. +*/ int IN_SetClipboardText(const char *s) { - return SDL_SetClipboardText(s); + bool res = SDL_SetClipboardText(s); + + return !res; } From 1b7ceada592c7e4f56578142b1fe2b7e0ad2f208 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 2 Nov 2024 14:05:47 +0000 Subject: [PATCH 2/2] FS_Dir_f little optimisation. --- src/common/filesystem.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/filesystem.c b/src/common/filesystem.c index 6e15cdbc..ece3ba97 100644 --- a/src/common/filesystem.c +++ b/src/common/filesystem.c @@ -1534,6 +1534,7 @@ FS_Dir_f(void) char **dirnames; /* File list. */ char findname[1024]; /* File search path and pattern. */ char *path = NULL; /* Search path. */ + char *lastsep; char wildcard[1024] = "*.*"; /* File pattern. */ int i; /* Loop counter. */ int ndirs; /* Number of files in list. */ @@ -1555,9 +1556,10 @@ FS_Dir_f(void) { for (i = 0; i < ndirs - 1; i++) { - if (strrchr(dirnames[i], '/')) + lastsep = strrchr(dirnames[i], '/'); + if (lastsep) { - Com_Printf("%s\n", strrchr(dirnames[i], '/') + 1); + Com_Printf("%s\n", lastsep + 1); } else {