Fix the Linux build.
diff --git a/src/engine/qcommon/q_shared.cpp b/src/engine/qcommon/q_shared.cpp
index a949b81..0db4ec4 100644
--- a/src/engine/qcommon/q_shared.cpp
+++ b/src/engine/qcommon/q_shared.cpp
@@ -1893,18 +1893,18 @@ bool Com_sprintf( valueType* dest, size_t size, pointer fmt, ... )
if( len >= size )
{
#ifdef DEBUG
- Com_Printf( "ERROR! %s: destination buffer overflow of len %i, size %i\n"
+ Com_Printf( "ERROR! %s: destination buffer overflow of len %i, size %lu\n"
"Input was: %s", __FUNCTION__, len, size, dest );
return false;
#else
- Com_Printf( "ERROR! %s: destination buffer overflow of len %i, size %i\n"
+ Com_Printf( "ERROR! %s: destination buffer overflow of len %i, size %lu\n"
"Input was: %s", __FUNCTION__, len, size, dest );
#endif
}
if( len == -1 )
{
- Com_Printf( "Com_sprintf: overflow of %i bytes buffer\n", size );
+ Com_Printf( "Com_sprintf: overflow of %lu bytes buffer\n", size );
return false;
}
@@ -2411,6 +2411,7 @@ void VectorMatrixMultiply( const vec3_t p, vec3_t m[ 3 ], vec3_t out )
out[ 2 ] = m[ 0 ][ 2 ] * p[ 0 ] + m[ 1 ][ 2 ] * p[ 1 ] + m[ 2 ][ 2 ] * p[ 2 ];
}
+#if defined(_MSC_VER)
/*
=============
Q_vsnprintf
@@ -2428,6 +2429,7 @@ sint Q_vsnprintf( valueType* str, size_t size, pointer format, va_list ap )
return retval;
}
+#endif
#ifndef Q3MAP2
bool StringContainsWord( pointer haystack, pointer needle )
diff --git a/src/engine/qcommon/q_shared.h b/src/engine/qcommon/q_shared.h
index 3b639ec..5b1c1d9 100644
--- a/src/engine/qcommon/q_shared.h
+++ b/src/engine/qcommon/q_shared.h
@@ -750,7 +750,14 @@ bool SkipBracedSection( valueType** program );
bool SkipBracedSection_Depth( valueType** program, sint depth ); // start at given depth if already
void SkipRestOfLine( valueType** data );
+#if defined (_MSC_VER)
+// vsnprintf is ISO/IEC 9899:1999
+// abstracting this to make it portable
sint Q_vsnprintf( valueType* str, size_t size, pointer format, va_list args );
+#else // not using MSVC
+#define Q_vsnprintf vsnprintf
+#endif
+
bool Com_sprintf( valueType* dest, size_t size, pointer fmt, ... );
// mode parm for FS_FOpenFile
GitHub
sha: 5135fa24