]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Fix some pedantic compiler stuff and a warning off-by-1
authorbones_was_here <bones_was_here@xonotic.au>
Thu, 15 Aug 2024 14:01:51 +0000 (00:01 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Thu, 15 Aug 2024 14:03:14 +0000 (00:03 +1000)
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
builddate.c
common.c
sys_shared.c

index 268a9614b35aadf1a2a2d22f7ef39e5fb0af0630..161c095b15ea0298253447bc769a2ae744733e72 100644 (file)
@@ -20,12 +20,12 @@ const char *buildstring =
 //     STRINGIFY(__clang_major__)
 //     "."
 //     STRINGIFY(__clang_minor__)
-#elifdef __GNUC__
+#elif defined(__GNUC__)
        " GCC "
 //     STRINGIFY(__GNUC__)
 //     "."
 //     STRINGIFY(__GNUC_MINOR__)
-#elifdef _MSC_VER
+#elif defined(_MSC_VER)
        " MSC "
 //     STRINGIFY(_MSC_VER)
 #endif
index 0d701bca99864ea785ccdd3cf0762fb252f1b5ec..0870a4547d26035cf25edf054282728c28cd8b1c 100644 (file)
--- a/common.c
+++ b/common.c
@@ -1036,7 +1036,7 @@ int dpvsnprintf (char *buffer, size_t buffersize, const char *format, va_list ar
                        if (result > 0)
                        {
                                msg[sizeof(msg) - 1] = '\n'; // may have been lost in truncation
-                               Sys_Print(msg, min((size_t)result, sizeof(msg)));
+                               Sys_Print(msg, min((size_t)result, sizeof(msg) - 1));
                        }
                }
                return -1;
index d460b77b66b50fbe1dacb809a4073f274469c01c..0d6cf410d51eb04cfbccfa9b61d74d7cfe792980 100644 (file)
@@ -1011,16 +1011,16 @@ static void Sys_HandleCrash(int sig)
        sys.outfd = fileno(stderr); // not async-signal-safe :(
 #ifndef WIN32
        fcntl(sys.outfd, F_SETFL, fcntl(sys.outfd, F_GETFL, 0) & ~O_NONBLOCK);
-       Sys_Print("\n\n\e[1;37;41m    Engine Crash: ", 30);
+       Sys_Print("\n\n\x1B[1;37;41m    Engine Crash: ", 30);
        Sys_Print(sigdesc, strlen(sigdesc));
-       Sys_Print("    \e[m\n", 8);
+       Sys_Print("    \x1B[m\n", 8);
   #if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
        // the first two addresses will be in this function and in signal() in libc
        backtrace_symbols_fd(stackframes + 2, framecount - 2, sys.outfd);
   #endif
-       Sys_Print("\e[1m", 4);
+       Sys_Print("\x1B[1m", 4);
        Sys_Print(engineversion, strlen(engineversion));
-       Sys_Print("\e[m\n", 4);
+       Sys_Print("\x1B[m\n", 4);
 #else // Windows console doesn't support colours
        Sys_Print("\n\nEngine Crash: ", 16);
        Sys_Print(sigdesc, strlen(sigdesc));