fix sw compiling, use MSVC8 _s functions when applicable

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2056 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-03-06 03:15:34 +00:00
parent b48c3034dd
commit 0693518eed
3 changed files with 14 additions and 7 deletions

View file

@ -186,11 +186,18 @@ extern "C" {
#ifdef _WIN32
#if (_MSC_VER >= 1400)
//with MSVC 8, use MS extensions
#define snprintf sprintf_s
#define vsnprintf(a, b, c, d) vsnprintf_s(a, b, _TRUNCATE, c, d)
#else
//msvc crap
#define snprintf linuxlike_snprintf
int VARGS linuxlike_snprintf(char *buffer, int size, const char *format, ...);
#define vsnprintf linuxlike_vsnprintf
int VARGS linuxlike_vsnprintf(char *buffer, int size, const char *format, va_list argptr);
#endif
#define _vsnprintf unsafe_vsnprintf
#define _snprintf unsafe_snprintf

View file

@ -137,11 +137,11 @@ void R_LoadSkyBox (void)
char pathname[MAX_QPATH];
for (i=0 ; i<6 ; i++)
{
_snprintf (pathname, MAX_QPATH-1, "env/%s%s.tga", skyname, suf[r_skysideimage[i]]);
snprintf (pathname, MAX_QPATH-1, "env/%s%s.tga", skyname, suf[r_skysideimage[i]]);
r_skytexinfo[i].texture = Mod_LoadWall (pathname); //preferable
if (!r_skytexinfo[i].texture)
{
_snprintf (pathname, MAX_QPATH-1, "env/%s%s.pcx", skyname, suf[r_skysideimage[i]]);
snprintf (pathname, MAX_QPATH-1, "env/%s%s.pcx", skyname, suf[r_skysideimage[i]]);
r_skytexinfo[i].texture = Mod_LoadWall (pathname); //q2 fall back
}
if (!r_skytexinfo[i].texture)

View file

@ -108,11 +108,11 @@ mpic_t *SWDraw_SafeCachePic (char *extpath)
qbyte *file, *image;
int width;
int height;
_snprintf(alternatename, MAX_QPATH-1,"pics/%s.pcx", path);
snprintf(alternatename, MAX_QPATH-1,"pics/%s.pcx", path);
file = COM_LoadMallocFile(alternatename);
if (!file)
{
_snprintf(alternatename, MAX_QPATH-1,"%s.pcx", path);
snprintf(alternatename, MAX_QPATH-1,"%s.pcx", path);
file = COM_LoadMallocFile(alternatename);
}
if (file)
@ -147,7 +147,7 @@ mpic_t *SWDraw_SafeCachePic (char *extpath)
qbyte *file, *image;
int width;
int height;
_snprintf(alternatename, MAX_QPATH-1,"%s.jpg", path);
snprintf(alternatename, MAX_QPATH-1,"%s.jpg", path);
file = COM_LoadMallocFile(alternatename);
if (file)
@ -182,7 +182,7 @@ mpic_t *SWDraw_SafeCachePic (char *extpath)
qbyte *file, *image;
int width;
int height;
_snprintf(alternatename, MAX_QPATH-1,"%s.tga", path);
snprintf(alternatename, MAX_QPATH-1,"%s.tga", path);
file = COM_LoadMallocFile(alternatename);
if (file)
@ -216,7 +216,7 @@ mpic_t *SWDraw_SafeCachePic (char *extpath)
//
// load the pic from disk
//
_snprintf(alternatename, MAX_QPATH-1,"%s.lmp", path);
snprintf(alternatename, MAX_QPATH-1,"%s.lmp", path);
COM_LoadCacheFile (alternatename, &pic->cache);
dat = pic->cache.data;