4733: Fix MinGW warnings (fixes #4731) r=Jupeyy a=def-

`@Jupeyy` `@Robyt3` `@Zwelf` 

## Checklist

- [ ] Tested the change ingame
- [ ] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: Dennis Felsing <dennis@felsin9.de>
This commit is contained in:
bors[bot] 2022-02-19 08:51:54 +00:00 committed by GitHub
commit a5b3bd9fa0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 7 deletions

View file

@ -223,6 +223,7 @@ static void logger_file(const char *line, void *user)
aio_unlock(logfile);
}
#if !defined(CONF_FAMILY_WINDOWS)
static void logger_file_no_newline(const char *line, void *user)
{
ASYNCIO *logfile = (ASYNCIO *)user;
@ -230,8 +231,7 @@ static void logger_file_no_newline(const char *line, void *user)
aio_write_unlocked(logfile, line, str_length(line));
aio_unlock(logfile);
}
#if defined(CONF_FAMILY_WINDOWS)
#else
static void logger_stdout_sync(const char *line, void *user)
{
size_t length = str_length(line);
@ -2122,7 +2122,7 @@ static inline time_t filetime_to_unixtime(LPFILETIME filetime)
li.QuadPart -= 11644473600LL; // Windows epoch is in the past
t = li.QuadPart;
return t == li.QuadPart ? t : (time_t)-1;
return t == (time_t)li.QuadPart ? t : (time_t)-1;
}
#endif
@ -2613,8 +2613,8 @@ void str_append(char *dst, const char *src, int dst_size)
void str_copy(char *dst, const char *src, int dst_size)
{
strncpy(dst, src, dst_size - 1);
dst[dst_size - 1] = 0; /* assure null termination */
dst[0] = '\0';
strncat(dst, src, dst_size - 1);
str_utf8_fix_truncation(dst);
}

View file

@ -788,7 +788,7 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *pScreen, int *pWid
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, g_Config.m_GfxOpenGLMajor);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, g_Config.m_GfxOpenGLMinor);
dbg_msg("gfx", "Created OpenGL %zu.%zu context.", (size_t)g_Config.m_GfxOpenGLMajor, (size_t)g_Config.m_GfxOpenGLMinor);
dbg_msg("gfx", "Created OpenGL %d.%d context.", g_Config.m_GfxOpenGLMajor, g_Config.m_GfxOpenGLMinor);
if(m_BackendType == BACKEND_TYPE_OPENGL)
{

View file

@ -230,7 +230,11 @@ extern char *sqlite3_expanded_sql(sqlite3_stmt *pStmt) __attribute__((weak)); //
void CSqliteConnection::Print()
{
if(m_pStmt != nullptr && sqlite3_expanded_sql != nullptr)
if(m_pStmt != nullptr
#if defined(__GNUC__) && !defined(__MINGW32__)
&& sqlite3_expanded_sql != nullptr
#endif
)
{
char *pExpandedStmt = sqlite3_expanded_sql(m_pStmt);
dbg_msg("sql", "SQLite statement: %s", pExpandedStmt);