Skip to content

Commit

Permalink
Fix some pedantic compiler stuff and a warning off-by-1
Browse files Browse the repository at this point in the history
Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
  • Loading branch information
bones-was-here committed Aug 15, 2024
1 parent 558f167 commit a94d756
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions builddate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions sys_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit a94d756

Please sign in to comment.