From 380c94c6c1a942948503546c195a91e1d2ffde30 Mon Sep 17 00:00:00 2001 From: JohnNy_cz Date: Sat, 10 Jun 2006 22:15:24 +0000 Subject: [PATCH] fixed crash on release build with code optimization killed ms vs 8.0 warnings git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2322 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- fteqtv/parse.c | 2 +- fteqtv/qtv.h | 11 ++++++++++- fteqtv/qw.c | 16 ++++++++++------ fteqtv/source.c | 4 ++-- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/fteqtv/parse.c b/fteqtv/parse.c index 64f926a3b..29d5313c9 100644 --- a/fteqtv/parse.c +++ b/fteqtv/parse.c @@ -1351,7 +1351,7 @@ void ParseMessage(sv_t *tv, char *buffer, int length, int to, int mask) if (tv->file) { fclose(tv->file); - unlink(tv->downloadname); + _unlink(tv->downloadname); Sys_Printf(tv->cluster, "Was already downloading %s\nOld download canceled\n"); tv->file = NULL; } diff --git a/fteqtv/qtv.h b/fteqtv/qtv.h index 1f5e27bc7..a2c9ae590 100644 --- a/fteqtv/qtv.h +++ b/fteqtv/qtv.h @@ -669,15 +669,25 @@ unsigned int BSP_Checksum(bsp_t *bsp); int BSP_SphereLeafNums(bsp_t *bsp, int maxleafs, unsigned short *list, float x, float y, float z, float radius); qboolean BSP_Visible(bsp_t *bsp, int leafcount, unsigned short *list); void BSP_SetupForPosition(bsp_t *bsp, float x, float y, float z); +void QW_SetViewersServer(viewer_t *viewer, sv_t *sv); +unsigned short QCRC_Block (unsigned char *start, int count); +void Netchan_OutOfBand (cluster_t *cluster, SOCKET sock, netadr_t adr, int length, unsigned char *data); +void WriteDeltaUsercmd (netmsg_t *m, const usercmd_t *from, usercmd_t *move); +void SendClientCommand(sv_t *qtv, char *fmt, ...); +void QTV_Run(sv_t *qtv); char *Rcon_Command(cluster_t *cluster, sv_t *qtv, char *command, char *buffer, int sizeofbuffer, qboolean localcommand); char *COM_ParseToken (char *data, char *out, int outsize, const char *punctuation); char *Info_ValueForKey (char *s, const char *key, char *buffer, int buffersize); void Info_SetValueForStarKey (char *s, const char *key, const char *value, int maxsize); +void ReadDeltaUsercmd (netmsg_t *m, const usercmd_t *from, usercmd_t *move); +unsigned Com_BlockChecksum (void *buffer, int length); void Sys_Printf(cluster_t *cluster, char *fmt, ...); #ifdef _WIN32 int snprintf(char *buffer, int buffersize, char *format, ...); +#endif +#if (defined(_WIN32) && !defined(_VC80_UPGRADE)) int vsnprintf(char *buffer, int buffersize, char *format, va_list argptr); #endif @@ -685,4 +695,3 @@ qboolean Net_FileProxy(sv_t *qtv, char *filename); sv_t *QTV_NewServerConnection(cluster_t *cluster, char *server, qboolean force, qboolean autoclose, qboolean noduplicates); SOCKET Net_MVDListen(int port); qboolean Net_StopFileProxy(sv_t *qtv); - diff --git a/fteqtv/qw.c b/fteqtv/qw.c index 0f2497e99..d074fb0ab 100644 --- a/fteqtv/qw.c +++ b/fteqtv/qw.c @@ -40,7 +40,9 @@ int snprintf(char *buffer, int buffersize, char *format, ...) return ret; } -int vsnprintf(char *buffer, int buffersize, char *format, va_list argptr) +#endif +#if (defined(_WIN32) && !defined(_VC80_UPGRADE)) +int vsnprintf(char *buffer, int buffersize, char *format, va_list argptr) { int ret; ret = _vsnprintf (buffer, buffersize, format, argptr); @@ -289,16 +291,18 @@ int SendCurrentUserinfos(sv_t *tv, int cursize, netmsg_t *msg, int i, int thispl for (; i < MAX_CLIENTS; i++) { - if (i == thisplayer && !tv->controller) + if (i == thisplayer && (!tv || !(tv->controller))) { WriteByte(msg, svc_updateuserinfo); WriteByte(msg, i); WriteLong(msg, i); WriteString2(msg, "\\*spectator\\1\\name\\"); - if (!tv || !*tv->hostname) - WriteString(msg, "FTEQTV"); - else + + if (tv && tv->hostname && tv->hostname[0]) WriteString(msg, tv->hostname); + else + WriteString(msg, "FTEQTV"); + WriteByte(msg, svc_updatefrags); WriteByte(msg, i); @@ -996,7 +1000,7 @@ void SendLocalPlayerState(sv_t *tv, viewer_t *v, int playernum, netmsg_t *msg) void SendPlayerStates(sv_t *tv, viewer_t *v, netmsg_t *msg) { packet_entities_t *e; - int i,j; + int i; usercmd_t to; unsigned short flags; short interp; diff --git a/fteqtv/source.c b/fteqtv/source.c index 741da8bfa..1cbd4ab3b 100644 --- a/fteqtv/source.c +++ b/fteqtv/source.c @@ -1826,9 +1826,9 @@ void Cluster_Run(cluster_t *cluster) char *result; char c; - if (!kbhit()) + if (!_kbhit()) break; - c = getch(); + c = _getch(); if (c == '\n' || c == '\r') {