From: havoc Date: Tue, 17 Jun 2008 10:46:24 +0000 (+0000) Subject: fixed all VS2005 deprecated function warnings X-Git-Tag: xonotic-v0.1.0preview~2209 X-Git-Url: https://de.git.xonotic.org/?a=commitdiff_plain;h=f87cf4e9590a353b5253b5bf098ec4450d49a965;p=xonotic%2Fdarkplaces.git fixed all VS2005 deprecated function warnings found one actual buffer overrun problem in GetMapList (map name completion was using sprintf with a 64 character buffer, which is EASILY overflowed) added VS2005 projects git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8365 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cl_demo.c b/cl_demo.c index 8a93daf6..580125b2 100644 --- a/cl_demo.c +++ b/cl_demo.c @@ -63,7 +63,7 @@ void CL_NextDemo (void) } } - sprintf (str,"playdemo %s\n", cls.demos[cls.demonum]); + dpsnprintf (str, sizeof(str), "playdemo %s\n", cls.demos[cls.demonum]); Cbuf_InsertText (str); cls.demonum++; } diff --git a/cl_parse.c b/cl_parse.c index ea2668ac..6b7c2585 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -369,6 +369,9 @@ void CL_ParseEntityLump(char *entdata) r_refdef.fog_start = 0; r_refdef.fog_alpha = 1; r_refdef.fog_end = 16384; +#if _MSC_VER >= 1400 +#define sscanf sscanf_s +#endif sscanf(value, "%f %f %f %f %f %f %f", &r_refdef.fog_density, &r_refdef.fog_red, &r_refdef.fog_green, &r_refdef.fog_blue, &r_refdef.fog_alpha, &r_refdef.fog_start, &r_refdef.fog_end); } else if (!strcmp("fog_density", key)) diff --git a/cl_particles.c b/cl_particles.c index a7dec899..34d84302 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -1324,6 +1324,9 @@ void CL_ReadPointFile_f (void) t++; tchar = *t; *t = 0; +#if _MSC_VER >= 1400 +#define sscanf sscanf_s +#endif r = sscanf (pointfilepos,"%f %f %f", &org[0], &org[1], &org[2]); *t = tchar; pointfilepos = t; diff --git a/cl_screen.c b/cl_screen.c index 52d93d45..8088a750 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -697,18 +697,23 @@ void R_TimeReport_EndFrame(void) // put the location name in the r_speeds display as it greatly helps // when creating loc files loc = CL_Locs_FindNearest(cl.movement_origin); - if (loc) - sprintf(string + strlen(string), "Location: %s\n", loc->name); - sprintf(string + strlen(string), "%3i renders org:'%+8.2f %+8.2f %+8.2f' dir:'%+2.3f %+2.3f %+2.3f'\n", r_refdef.stats.renders, r_refdef.view.origin[0], r_refdef.view.origin[1], r_refdef.view.origin[2], r_refdef.view.forward[0], r_refdef.view.forward[1], r_refdef.view.forward[2]); - sprintf(string + strlen(string), "%7i surfaces%7i triangles %5i entities (%7i surfaces%7i triangles)\n", r_refdef.stats.world_surfaces, r_refdef.stats.world_triangles, r_refdef.stats.entities, r_refdef.stats.entities_surfaces, r_refdef.stats.entities_triangles); - sprintf(string + strlen(string), "%5i leafs%5i portals%6i/%6i particles%6i/%6i decals %3i%% quality\n", r_refdef.stats.world_leafs, r_refdef.stats.world_portals, r_refdef.stats.particles, cl.num_particles, r_refdef.stats.decals, cl.num_decals, (int)(100 * r_refdef.view.quality)); - sprintf(string + strlen(string), "%7i lightmap updates (%7i pixels)\n", r_refdef.stats.lightmapupdates, r_refdef.stats.lightmapupdatepixels); - sprintf(string + strlen(string), "%4i lights%4i clears%4i scissored%7i light%7i shadow%7i dynamic\n", r_refdef.stats.lights, r_refdef.stats.lights_clears, r_refdef.stats.lights_scissored, r_refdef.stats.lights_lighttriangles, r_refdef.stats.lights_shadowtriangles, r_refdef.stats.lights_dynamicshadowtriangles); - if (r_refdef.stats.bloom) - sprintf(string + strlen(string), "rendered%6i meshes%8i triangles bloompixels%8i copied%8i drawn\n", r_refdef.stats.meshes, r_refdef.stats.meshes_elements / 3, r_refdef.stats.bloom_copypixels, r_refdef.stats.bloom_drawpixels); - else - sprintf(string + strlen(string), "rendered%6i meshes%8i triangles\n", r_refdef.stats.meshes, r_refdef.stats.meshes_elements / 3); - strlcat(string, r_speeds_timestring, sizeof(string)); + dpsnprintf(string, sizeof(string), +"%s%s\n" +"%3i renders org:'%+8.2f %+8.2f %+8.2f' dir:'%+2.3f %+2.3f %+2.3f'\n" +"%7i surfaces%7i triangles %5i entities (%7i surfaces%7i triangles)\n" +"%5i leafs%5i portals%6i/%6i particles%6i/%6i decals %3i%% quality\n" +"%7i lightmap updates (%7i pixels)\n" +"%4i lights%4i clears%4i scissored%7i light%7i shadow%7i dynamic\n" +"rendered%6i meshes%8i triangles bloompixels%8i copied%8i drawn\n" +"%s" +, loc ? "Location: " : "", loc ? loc->name : "" +, r_refdef.stats.renders, r_refdef.view.origin[0], r_refdef.view.origin[1], r_refdef.view.origin[2], r_refdef.view.forward[0], r_refdef.view.forward[1], r_refdef.view.forward[2] +, r_refdef.stats.world_surfaces, r_refdef.stats.world_triangles, r_refdef.stats.entities, r_refdef.stats.entities_surfaces, r_refdef.stats.entities_triangles +, r_refdef.stats.world_leafs, r_refdef.stats.world_portals, r_refdef.stats.particles, cl.num_particles, r_refdef.stats.decals, cl.num_decals, (int)(100 * r_refdef.view.quality) +, r_refdef.stats.lightmapupdates, r_refdef.stats.lightmapupdatepixels +, r_refdef.stats.lights, r_refdef.stats.lights_clears, r_refdef.stats.lights_scissored, r_refdef.stats.lights_lighttriangles, r_refdef.stats.lights_shadowtriangles, r_refdef.stats.lights_dynamicshadowtriangles +, r_refdef.stats.meshes, r_refdef.stats.meshes_elements / 3, r_refdef.stats.bloom_copypixels, r_refdef.stats.bloom_drawpixels +, r_speeds_timestring); memset(&r_refdef.stats, 0, sizeof(r_refdef.stats)); @@ -844,11 +849,11 @@ void SCR_ScreenShot_f (void) unsigned char *buffer3; qboolean jpeg = (scr_screenshot_jpeg.integer != 0); - sprintf (base, "screenshots/%s", scr_screenshot_name.string); + dpsnprintf (base, sizeof(base), "screenshots/%s", scr_screenshot_name.string); if (strcmp (oldname, scr_screenshot_name.string)) { - sprintf(oldname, "%s", scr_screenshot_name.string); + dpsnprintf(oldname, sizeof(oldname), "%s", scr_screenshot_name.string); shotnumber = 0; } @@ -862,7 +867,7 @@ void SCR_ScreenShot_f (void) return; } - sprintf(filename, "%s%06d.%s", base, shotnumber, jpeg ? "jpg" : "tga"); + dpsnprintf(filename, sizeof(filename), "%s%06d.%s", base, shotnumber, jpeg ? "jpg" : "tga"); buffer1 = (unsigned char *)Mem_Alloc(tempmempool, vid.width * vid.height * 3); buffer2 = (unsigned char *)Mem_Alloc(tempmempool, vid.width * vid.height * 3); @@ -1733,7 +1738,7 @@ static void R_Envmap_f (void) for (j = 0;j < 12;j++) { - sprintf(filename, "env/%s%s.tga", basename, envmapinfo[j].name); + dpsnprintf(filename, sizeof(filename), "env/%s%s.tga", basename, envmapinfo[j].name); Matrix4x4_CreateFromQuakeEntity(&r_refdef.view.matrix, r_refdef.view.origin[0], r_refdef.view.origin[1], r_refdef.view.origin[2], envmapinfo[j].angles[0], envmapinfo[j].angles[1], envmapinfo[j].angles[2], 1); r_refdef.view.quality = 1; r_refdef.view.clear = true; diff --git a/cl_video.c b/cl_video.c index a9f2fc4d..9ac887c9 100644 --- a/cl_video.c +++ b/cl_video.c @@ -328,7 +328,7 @@ static void CL_PlayVideo_f(void) return; } - sprintf(name, "video/%s.dpv", Cmd_Argv(1)); + dpsnprintf(name, sizeof(name), "video/%s.dpv", Cmd_Argv(1)); CL_VideoStart(name); } diff --git a/clvm_cmds.c b/clvm_cmds.c index a5ae8f06..430aec87 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -1191,28 +1191,28 @@ static void VM_CL_getplayerkey (void) strlcpy(t, cl.scores[i].name, sizeof(t)); else if(!strcasecmp(c, "frags")) - sprintf(t, "%i", cl.scores[i].frags); + dpsnprintf(t, sizeof(t), "%i", cl.scores[i].frags); else if(!strcasecmp(c, "ping")) - sprintf(t, "%i", cl.scores[i].qw_ping); + dpsnprintf(t, sizeof(t), "%i", cl.scores[i].qw_ping); else if(!strcasecmp(c, "pl")) - sprintf(t, "%i", cl.scores[i].qw_packetloss); + dpsnprintf(t, sizeof(t), "%i", cl.scores[i].qw_packetloss); else if(!strcasecmp(c, "entertime")) - sprintf(t, "%f", cl.scores[i].qw_entertime); + dpsnprintf(t, sizeof(t), "%f", cl.scores[i].qw_entertime); else if(!strcasecmp(c, "colors")) - sprintf(t, "%i", cl.scores[i].colors); + dpsnprintf(t, sizeof(t), "%i", cl.scores[i].colors); else if(!strcasecmp(c, "topcolor")) - sprintf(t, "%i", cl.scores[i].colors & 0xf0); + dpsnprintf(t, sizeof(t), "%i", cl.scores[i].colors & 0xf0); else if(!strcasecmp(c, "bottomcolor")) - sprintf(t, "%i", (cl.scores[i].colors &15)<<4); + dpsnprintf(t, sizeof(t), "%i", (cl.scores[i].colors &15)<<4); else if(!strcasecmp(c, "viewentity")) - sprintf(t, "%i", i+1); + dpsnprintf(t, sizeof(t), "%i", i+1); if(!t[0]) return; PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(t); diff --git a/common.c b/common.c index c211044b..499dccfd 100644 --- a/common.c +++ b/common.c @@ -1623,7 +1623,11 @@ int dpvsnprintf (char *buffer, size_t buffersize, const char *format, va_list ar { int result; +#if _MSC_VER >= 1400 + result = _vsnprintf_s (buffer, buffersize, _TRUNCATE, format, args); +#else result = vsnprintf (buffer, buffersize, format, args); +#endif if (result < 0 || (size_t)result >= buffersize) { buffer[buffersize - 1] = '\0'; @@ -2026,7 +2030,7 @@ void InfoString_SetValue(char *buffer, size_t bufferlength, const char *key, con // set the key/value and append the remaining text char tempbuffer[4096]; strlcpy(tempbuffer, buffer + pos2, sizeof(tempbuffer)); - sprintf(buffer + pos, "\\%s\\%s%s", key, value, tempbuffer); + dpsnprintf(buffer + pos, sizeof(buffer) - pos, "\\%s\\%s%s", key, value, tempbuffer); } else { diff --git a/console.c b/console.c index 126cd3a8..ab1af14e 100644 --- a/console.c +++ b/console.c @@ -192,13 +192,22 @@ const char* Log_Timestamp (const char *desc) { static char timestamp [128]; time_t crt_time; - const struct tm *crt_tm; +#if _MSC_VER >= 1400 + struct tm crt_tm; +#else + struct tm *crt_tm; +#endif char timestring [64]; // Build the time stamp (ex: "Wed Jun 30 21:49:08 1993"); time (&crt_time); +#if _MSC_VER >= 1400 + localtime_s (&crt_tm, &crt_time); + strftime (timestring, sizeof (timestring), "%a %b %d %H:%M:%S %Y", &crt_tm); +#else crt_tm = localtime (&crt_time); strftime (timestring, sizeof (timestring), "%a %b %d %H:%M:%S %Y", crt_tm); +#endif if (desc != NULL) dpsnprintf (timestamp, sizeof (timestamp), "====== %s (%s) ======\n", desc, timestring); @@ -1386,9 +1395,9 @@ void Con_DrawNotify (void) // LordHavoc: speedup, and other improvements if (chat_team) - sprintf(temptext, "say_team:%s%c", chat_buffer, (int) 10+((int)(realtime*con_cursorspeed)&1)); + dpsnprintf(temptext, sizeof(temptext), "say_team:%s%c", chat_buffer, (int) 10+((int)(realtime*con_cursorspeed)&1)); else - sprintf(temptext, "say:%s%c", chat_buffer, (int) 10+((int)(realtime*con_cursorspeed)&1)); + dpsnprintf(temptext, sizeof(temptext), "say:%s%c", chat_buffer, (int) 10+((int)(realtime*con_cursorspeed)&1)); // FIXME word wrap inputsize = (numChatlines ? con_chatsize : con_notifysize).value; @@ -1561,13 +1570,13 @@ its format (q1/q2/q3/hl) and even its message qboolean GetMapList (const char *s, char *completedname, int completednamebufferlength) { fssearch_t *t; - char message[64]; + char message[1024]; int i, k, max, p, o, min; unsigned char *len; qfile_t *f; unsigned char buf[1024]; - sprintf(message, "maps/%s*.bsp", s); + dpsnprintf(message, sizeof(message), "maps/%s*.bsp", s); t = FS_Search(message, 1, true); if(!t) return false; diff --git a/cvar.c b/cvar.c index 7203dee6..24fb2b2e 100644 --- a/cvar.c +++ b/cvar.c @@ -316,9 +316,9 @@ void Cvar_SetValueQuick(cvar_t *var, float value) char val[MAX_INPUTLINE]; if ((float)((int)value) == value) - sprintf(val, "%i", (int)value); + dpsnprintf(val, sizeof(val), "%i", (int)value); else - sprintf(val, "%f", value); + dpsnprintf(val, sizeof(val), "%f", value); Cvar_SetQuick(var, val); } @@ -327,9 +327,9 @@ void Cvar_SetValue(const char *var_name, float value) char val[MAX_INPUTLINE]; if ((float)((int)value) == value) - sprintf(val, "%i", (int)value); + dpsnprintf(val, sizeof(val), "%i", (int)value); else - sprintf(val, "%f", value); + dpsnprintf(val, sizeof(val), "%f", value); Cvar_Set(var_name, val); } diff --git a/darkplaces-dedicated.vcproj b/darkplaces-dedicated.vcproj new file mode 100755 index 00000000..3b3f3be0 --- /dev/null +++ b/darkplaces-dedicated.vcproj @@ -0,0 +1,2231 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darkplaces-sdl.vcproj b/darkplaces-sdl.vcproj new file mode 100755 index 00000000..5d24db4c --- /dev/null +++ b/darkplaces-sdl.vcproj @@ -0,0 +1,2556 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/darkplaces.sln b/darkplaces.sln new file mode 100755 index 00000000..3dc17892 --- /dev/null +++ b/darkplaces.sln @@ -0,0 +1,32 @@ + +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual C++ Express 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "darkplaces", "darkplaces.vcproj", "{2A31FD21-E0DF-462F-BB97-844CCD7B9E19}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "darkplaces-dedicated", "darkplaces-dedicated.vcproj", "{F8FBA9F0-F4E4-4B22-B6D1-21F7FB9C72F7}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "darkplaces-sdl", "darkplaces-sdl.vcproj", "{4C61C95C-3753-46B8-B817-4D57E48A9C45}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2A31FD21-E0DF-462F-BB97-844CCD7B9E19}.Debug|Win32.ActiveCfg = Debug|Win32 + {2A31FD21-E0DF-462F-BB97-844CCD7B9E19}.Debug|Win32.Build.0 = Debug|Win32 + {2A31FD21-E0DF-462F-BB97-844CCD7B9E19}.Release|Win32.ActiveCfg = Release|Win32 + {2A31FD21-E0DF-462F-BB97-844CCD7B9E19}.Release|Win32.Build.0 = Release|Win32 + {F8FBA9F0-F4E4-4B22-B6D1-21F7FB9C72F7}.Debug|Win32.ActiveCfg = Debug|Win32 + {F8FBA9F0-F4E4-4B22-B6D1-21F7FB9C72F7}.Debug|Win32.Build.0 = Debug|Win32 + {F8FBA9F0-F4E4-4B22-B6D1-21F7FB9C72F7}.Release|Win32.ActiveCfg = Release|Win32 + {F8FBA9F0-F4E4-4B22-B6D1-21F7FB9C72F7}.Release|Win32.Build.0 = Release|Win32 + {4C61C95C-3753-46B8-B817-4D57E48A9C45}.Debug|Win32.ActiveCfg = Debug|Win32 + {4C61C95C-3753-46B8-B817-4D57E48A9C45}.Debug|Win32.Build.0 = Debug|Win32 + {4C61C95C-3753-46B8-B817-4D57E48A9C45}.Release|Win32.ActiveCfg = Release|Win32 + {4C61C95C-3753-46B8-B817-4D57E48A9C45}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/darkplaces.vcproj b/darkplaces.vcproj new file mode 100755 index 00000000..a10d81dd --- /dev/null +++ b/darkplaces.vcproj @@ -0,0 +1,2400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fs.c b/fs.c index 173dcb55..f6360fde 100644 --- a/fs.c +++ b/fs.c @@ -55,6 +55,17 @@ # define lseek _lseeki64 #endif +#if _MSC_VER >= 1400 +// suppress deprecated warnings +# include +# include +# define read _read +# define write _write +# define close _close +# define unlink _unlink +# define dup _dup +#endif + /* All of Quake's data access is through a hierchal file system, but the contents @@ -560,7 +571,11 @@ pack_t *FS_LoadPackPK3 (const char *packfile) pack_t *pack; int real_nb_files; +#if _MSC_VER >= 1400 + _sopen_s(&packhandle, packfile, O_RDONLY | O_BINARY, _SH_DENYNO, _S_IREAD | _S_IWRITE); +#else packhandle = open (packfile, O_RDONLY | O_BINARY); +#endif if (packhandle < 0) return NULL; @@ -771,7 +786,11 @@ pack_t *FS_LoadPackPAK (const char *packfile) pack_t *pack; dpackfile_t *info; +#if _MSC_VER >= 1400 + _sopen_s(&packhandle, packfile, O_RDONLY | O_BINARY, _SH_DENYNO, _S_IREAD | _S_IWRITE); +#else packhandle = open (packfile, O_RDONLY | O_BINARY); +#endif if (packhandle < 0) return NULL; read (packhandle, (void *)&header, sizeof(header)); @@ -1023,8 +1042,11 @@ void FS_AddGameHierarchy (const char *dir) char userdir[MAX_QPATH]; #ifdef WIN32 TCHAR mydocsdir[MAX_PATH + 1]; +#if _MSC_VER >= 1400 + size_t homedirlen; +#endif #endif - const char *homedir; + char *homedir; // Add the common game directory FS_AddGameDirectory (va("%s%s/", fs_basedir, dir)); @@ -1041,10 +1063,18 @@ void FS_AddGameHierarchy (const char *dir) else { // use the environment - homedir = getenv ("USERPROFILE"); +#if _MSC_VER >= 1400 + _dupenv_s (&homedir, &homedirlen, "USERPROFILE"); +#else + homedir = getenv("USERPROFILE"); +#endif + if(homedir) { dpsnprintf(userdir, sizeof(userdir), "%s/My Documents/My Games/%s/", homedir, gameuserdirname); +#if _MSC_VER >= 1400 + free(homedir); +#endif Con_DPrintf("Obtained personal directory %s from environment\n", userdir); } else @@ -1066,7 +1096,12 @@ void FS_AddGameHierarchy (const char *dir) #ifdef WIN32 if(!COM_CheckParm("-mygames")) { +#if _MSC_VER >= 1400 + int fd; + _sopen_s(&fd, va("%s%s/config.cfg", fs_basedir, dir), O_WRONLY | O_CREAT, _SH_DENYNO, _S_IREAD | _S_IWRITE); // note: no O_TRUNC here! +#else int fd = open (va("%s%s/config.cfg", fs_basedir, dir), O_WRONLY | O_CREAT, 0666); // note: no O_TRUNC here! +#endif if(fd >= 0) { close(fd); @@ -1539,7 +1574,11 @@ static qfile_t* FS_SysOpen (const char* filepath, const char* mode, qboolean non memset (file, 0, sizeof (*file)); file->ungetc = EOF; +#if _MSC_VER >= 1400 + _sopen_s(&file->handle, filepath, mod | opt, _SH_DENYNO, _S_IREAD | _S_IWRITE); +#else file->handle = open (filepath, mod | opt, 0666); +#endif if (file->handle < 0) { Mem_Free (file); diff --git a/gl_rmain.c b/gl_rmain.c index af6adf3f..6b84a822 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -3420,6 +3420,9 @@ static void R_BlendView(void) if (r_glsl_permutation->loc_UserVec1 >= 0) { float a=0, b=0, c=0, d=0; +#if _MSC_VER >= 1400 +#define sscanf sscanf_s +#endif sscanf(r_glsl_postprocess_uservec1.string, "%f %f %f %f", &a, &b, &c, &d); qglUniform4fARB(r_glsl_permutation->loc_UserVec1, a, b, c, d); } diff --git a/host_cmd.c b/host_cmd.c index fc3db1b9..5c835c63 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -499,7 +499,7 @@ void Host_Savegame_f (void) FS_Printf(f, "%i\n", SAVEGAME_VERSION); memset(comment, 0, sizeof(comment)); - sprintf(comment, "%-21.21s kills:%3i/%3i", PRVM_GetString(prog->edicts->fields.server->message), (int)prog->globals.server->killed_monsters, (int)prog->globals.server->total_monsters); + dpsnprintf(comment, sizeof(comment), "%-21.21s kills:%3i/%3i", PRVM_GetString(prog->edicts->fields.server->message), (int)prog->globals.server->killed_monsters, (int)prog->globals.server->total_monsters); // convert space to _ to make stdio happy // LordHavoc: convert control characters to _ as well for (i=0 ; iname); + dpsnprintf (text, sizeof(text), "\001%s tells you: ", host_client->name); else if(*(sv_adminnick.string)) - sprintf (text, "\001<%s tells you> ", sv_adminnick.string); + dpsnprintf (text, sizeof(text), "\001<%s tells you> ", sv_adminnick.string); else - sprintf (text, "\001<%s tells you> ", hostname.string); + dpsnprintf (text, sizeof(text), "\001<%s tells you> ", hostname.string); p1 = Cmd_Args(); p2 = p1 + strlen(p1); diff --git a/image.c b/image.c index 5cca3c3c..2a224515 100644 --- a/image.c +++ b/image.c @@ -806,7 +806,7 @@ unsigned char *loadimagepixelsbgra (const char *filename, qboolean complain, qbo // now try all the formats in the selected list for (format = firstformat;format->formatstring;format++) { - sprintf (name, format->formatstring, basename); + dpsnprintf (name, sizeof(name), format->formatstring, basename); f = FS_LoadFile(name, tempmempool, true, &filesize); if (f) { @@ -845,7 +845,7 @@ unsigned char *loadimagepixelsbgra (const char *filename, qboolean complain, qbo Con_Printf("Couldn't load %s using ", filename); for (format = firstformat;format->formatstring;format++) { - sprintf (name, format->formatstring, basename); + dpsnprintf (name, sizeof(name), format->formatstring, basename); Con_Printf(format == firstformat ? "\"%s\"" : (format[1].formatstring ? ", \"%s\"" : " or \"%s\".\n"), format->formatstring); } } diff --git a/keys.c b/keys.c index bc20e8be..b6747acb 100644 --- a/keys.c +++ b/keys.c @@ -288,7 +288,19 @@ Key_Console (int key, char ascii) if ((cbd = Sys_GetClipboardData()) != 0) { int i; +#if 1 + while (*cbd) + { + if (*cbd == '\n' || *cbd == '\r' || *cbd == '\b') + { + *cbd++ = 0; + break; + } + cbd++; + } +#else strtok(cbd, "\n\r\b"); +#endif i = (int)strlen(cbd); if (i + key_linepos >= MAX_INPUTLINE) i= MAX_INPUTLINE - key_linepos; diff --git a/lhnet.c b/lhnet.c index 2546ff3b..fde0f4e7 100644 --- a/lhnet.c +++ b/lhnet.c @@ -143,6 +143,9 @@ int LHNETADDRESS_FromString(lhnetaddress_t *address, const char *string, int def // try to parse as dotted decimal ipv4 address first // note this supports partial ip addresses d1 = d2 = d3 = d4 = 0; +#if _MSC_VER >= 1400 +#define sscanf sscanf_s +#endif if (sscanf(name, "%d.%d.%d.%d", &d1, &d2, &d3, &d4) >= 1 && (unsigned int)d1 < 256 && (unsigned int)d2 < 256 && (unsigned int)d3 < 256 && (unsigned int)d4 < 256) { // parsed a valid ipv4 address @@ -253,7 +256,7 @@ int LHNETADDRESS_ToString(const lhnetaddress_t *address, char *string, int strin { if (stringbuffersize >= 12) { - sprintf(string, "local:%d", (int)address->addressdata.loop.port); + dpsnprintf(string, stringbuffersize, "local:%d", (int)address->addressdata.loop.port); return 1; } } @@ -271,7 +274,7 @@ int LHNETADDRESS_ToString(const lhnetaddress_t *address, char *string, int strin { if (stringbuffersize >= 22) { - sprintf(string, "%d.%d.%d.%d:%d", (int)address->addressdata.inet4.address[0], (int)address->addressdata.inet4.address[1], (int)address->addressdata.inet4.address[2], (int)address->addressdata.inet4.address[3], (int)ntohs(address->addressdata.inet4.port)); + dpsnprintf(string, stringbuffersize, "%d.%d.%d.%d:%d", (int)address->addressdata.inet4.address[0], (int)address->addressdata.inet4.address[1], (int)address->addressdata.inet4.address[2], (int)address->addressdata.inet4.address[3], (int)ntohs(address->addressdata.inet4.port)); return 1; } } @@ -279,7 +282,7 @@ int LHNETADDRESS_ToString(const lhnetaddress_t *address, char *string, int strin { if (stringbuffersize >= 16) { - sprintf(string, "%d.%d.%d.%d", (int)address->addressdata.inet4.address[0], (int)address->addressdata.inet4.address[1], (int)address->addressdata.inet4.address[2], (int)address->addressdata.inet4.address[3]); + dpsnprintf(string, stringbuffersize, "%d.%d.%d.%d", (int)address->addressdata.inet4.address[0], (int)address->addressdata.inet4.address[1], (int)address->addressdata.inet4.address[2], (int)address->addressdata.inet4.address[3]); return 1; } } @@ -289,7 +292,7 @@ int LHNETADDRESS_ToString(const lhnetaddress_t *address, char *string, int strin { if (stringbuffersize >= 88) { - sprintf(string, "[%x:%x:%x:%x:%x:%x:%x:%x]:%d", (int)address->addressdata.inet6.address[0], (int)address->addressdata.inet6.address[1], (int)address->addressdata.inet6.address[2], (int)address->addressdata.inet6.address[3], (int)address->addressdata.inet6.address[4], (int)address->addressdata.inet6.address[5], (int)address->addressdata.inet6.address[6], (int)address->addressdata.inet6.address[7], (int)ntohs(address->addressdata.inet6.port)); + dpsnprintf(string, stringbuffersize, "[%x:%x:%x:%x:%x:%x:%x:%x]:%d", (int)address->addressdata.inet6.address[0], (int)address->addressdata.inet6.address[1], (int)address->addressdata.inet6.address[2], (int)address->addressdata.inet6.address[3], (int)address->addressdata.inet6.address[4], (int)address->addressdata.inet6.address[5], (int)address->addressdata.inet6.address[6], (int)address->addressdata.inet6.address[7], (int)ntohs(address->addressdata.inet6.port)); return 1; } } @@ -297,7 +300,7 @@ int LHNETADDRESS_ToString(const lhnetaddress_t *address, char *string, int strin { if (stringbuffersize >= 80) { - sprintf(string, "%x:%x:%x:%x:%x:%x:%x:%x", (int)address->addressdata.inet6.address[0], (int)address->addressdata.inet6.address[1], (int)address->addressdata.inet6.address[2], (int)address->addressdata.inet6.address[3], (int)address->addressdata.inet6.address[4], (int)address->addressdata.inet6.address[5], (int)address->addressdata.inet6.address[6], (int)address->addressdata.inet6.address[7]); + dpsnprintf(string, stringbuffersize, "%x:%x:%x:%x:%x:%x:%x:%x", (int)address->addressdata.inet6.address[0], (int)address->addressdata.inet6.address[1], (int)address->addressdata.inet6.address[2], (int)address->addressdata.inet6.address[3], (int)address->addressdata.inet6.address[4], (int)address->addressdata.inet6.address[5], (int)address->addressdata.inet6.address[6], (int)address->addressdata.inet6.address[7]); return 1; } } diff --git a/menu.c b/menu.c index dea6f27e..696f753a 100644 --- a/menu.c +++ b/menu.c @@ -829,7 +829,7 @@ static void M_ScanSaves (void) { strlcpy (m_filenames[i], "--- UNUSED SLOT ---", sizeof(m_filenames[i])); loadable[i] = false; - sprintf (name, "s%i.sav", (int)i); + dpsnprintf (name, sizeof(name), "s%i.sav", (int)i); f = FS_Open (name, "rb", false, false); if (!f) continue; @@ -1508,9 +1508,9 @@ static void M_DrawSlider (int x, int y, float num, float rangemin, float rangema M_DrawCharacter (x+i*8, y, 130); M_DrawCharacter (x + (SLIDER_RANGE-1)*8 * range, y, 131); if (fabs((int)num - num) < 0.01) - sprintf(text, "%i", (int)num); + dpsnprintf(text, sizeof(text), "%i", (int)num); else - sprintf(text, "%.3f", num); + dpsnprintf(text, sizeof(text), "%.3f", num); M_Print(x + (SLIDER_RANGE+2) * 8, y, text); } @@ -2634,7 +2634,7 @@ static void M_Keys_Key (int k, char ascii) } else //if (k != '`') { - sprintf (cmd, "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]); + dpsnprintf (cmd, sizeof(cmd), "bind \"%s\" \"%s\"\n", Key_KeynumToString (k), bindnames[keys_cursor][0]); Cbuf_InsertText (cmd); } @@ -3272,7 +3272,7 @@ void M_Menu_LanConfig_f (void) if (StartingGame) lanConfig_cursor = 1; lanConfig_port = 26000; - sprintf(lanConfig_portname, "%u", (unsigned int) lanConfig_port); + dpsnprintf(lanConfig_portname, sizeof(lanConfig_portname), "%u", (unsigned int) lanConfig_port); M_Update_Return_Reason(""); } @@ -3438,7 +3438,7 @@ static void M_LanConfig_Key (int key, char ascii) l = atoi(lanConfig_portname); if (l <= 65535) lanConfig_port = l; - sprintf(lanConfig_portname, "%u", (unsigned int) lanConfig_port); + dpsnprintf(lanConfig_portname, sizeof(lanConfig_portname), "%u", (unsigned int) lanConfig_port); } //============================================================================= diff --git a/model_alias.c b/model_alias.c index 960de7ae..7c6a8531 100644 --- a/model_alias.c +++ b/model_alias.c @@ -1042,7 +1042,7 @@ void Mod_IDP0_Load(dp_model_t *mod, void *buffer, void *bufferend) } } - sprintf(loadmodel->skinscenes[i].name, "skin %i", i); + dpsnprintf(loadmodel->skinscenes[i].name, sizeof(loadmodel->skinscenes[i].name), "skin %i", i); loadmodel->skinscenes[i].firstframe = totalskins; loadmodel->skinscenes[i].framecount = groupskins; loadmodel->skinscenes[i].framerate = 1.0f / interval; @@ -1051,9 +1051,9 @@ void Mod_IDP0_Load(dp_model_t *mod, void *buffer, void *bufferend) for (j = 0;j < groupskins;j++) { if (groupskins > 1) - sprintf (name, "%s_%i_%i", loadmodel->name, i, j); + dpsnprintf (name, sizeof(name), "%s_%i_%i", loadmodel->name, i, j); else - sprintf (name, "%s_%i", loadmodel->name, i); + dpsnprintf (name, sizeof(name), "%s_%i", loadmodel->name, i); if (!Mod_LoadTextureFromQ3Shader(loadmodel->data_textures + totalskins * loadmodel->num_surfaces, name, false, true, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_ALPHA | TEXF_PICMIP | TEXF_COMPRESS)) Mod_BuildAliasSkinFromSkinFrame(loadmodel->data_textures + totalskins * loadmodel->num_surfaces, R_SkinFrame_LoadInternalQuake(name, (r_mipskins.integer ? TEXF_MIPMAP : 0) | TEXF_PICMIP, true, r_fullbrights.integer, (unsigned char *)datapointer, skinwidth, skinheight)); datapointer += skinwidth * skinheight; diff --git a/model_brush.c b/model_brush.c index b06bceb3..45709d22 100644 --- a/model_brush.c +++ b/model_brush.c @@ -1417,7 +1417,7 @@ static void Mod_Q1BSP_LoadTextures(lump_t *l) if (!name[0]) { - sprintf(name, "unnamed%i", i); + dpsnprintf(name, sizeof(name), "unnamed%i", i); Con_DPrintf("%s: warning: renaming unnamed texture to %s\n", loadmodel->name, name); } @@ -3560,7 +3560,7 @@ void Mod_Q1BSP_Load(dp_model_t *mod, void *buffer, void *bufferend) if (!loadmodel->isworldmodel) continue; // duplicate the basic information - sprintf(name, "*%i", i); + dpsnprintf(name, sizeof(name), "*%i", i); mod = Mod_FindName(name); // copy the base model to this one *mod = *loadmodel; @@ -4186,6 +4186,9 @@ static void Mod_Q3BSP_LoadEntities(lump_t *l) strlcpy(value, com_token, sizeof(value)); if (!strcmp("gridsize", key)) { +#if _MSC_VER >= 1400 +#define sscanf sscanf_s +#endif if (sscanf(value, "%f %f %f", &v[0], &v[1], &v[2]) == 3 && v[0] != 0 && v[1] != 0 && v[2] != 0) VectorCopy(v, loadmodel->brushq3.num_lightgrid_cellsize); } @@ -5740,7 +5743,7 @@ void Mod_Q3BSP_Load(dp_model_t *mod, void *buffer, void *bufferend) if (!loadmodel->isworldmodel) continue; // duplicate the basic information - sprintf(name, "*%i", i); + dpsnprintf(name, sizeof(name), "*%i", i); mod = Mod_FindName(name); *mod = *loadmodel; strlcpy(mod->name, name, sizeof(mod->name)); diff --git a/model_sprite.c b/model_sprite.c index 9fa62fdb..0c27bc21 100644 --- a/model_sprite.c +++ b/model_sprite.c @@ -148,7 +148,7 @@ static void Mod_Sprite_SharedSetup(const unsigned char *datapointer, int version Host_Error("Mod_Sprite_SharedSetup: invalid interval"); } - sprintf(loadmodel->animscenes[i].name, "frame %i", i); + dpsnprintf(loadmodel->animscenes[i].name, sizeof(loadmodel->animscenes[i].name), "frame %i", i); loadmodel->animscenes[i].firstframe = realframes; loadmodel->animscenes[i].framecount = groupframes; loadmodel->animscenes[i].framerate = 1.0f / interval; @@ -182,13 +182,13 @@ static void Mod_Sprite_SharedSetup(const unsigned char *datapointer, int version { if (groupframes > 1) { - sprintf (name, "%s_%i_%i", loadmodel->name, i, j); - sprintf (fogname, "%s_%i_%ifog", loadmodel->name, i, j); + dpsnprintf (name, sizeof(name), "%s_%i_%i", loadmodel->name, i, j); + dpsnprintf (fogname, sizeof(fogname), "%s_%i_%ifog", loadmodel->name, i, j); } else { - sprintf (name, "%s_%i", loadmodel->name, i); - sprintf (fogname, "%s_%ifog", loadmodel->name, i); + dpsnprintf (name, sizeof(name), "%s_%i", loadmodel->name, i); + dpsnprintf (fogname, sizeof(fogname), "%s_%ifog", loadmodel->name, i); } if (!(skinframe = R_SkinFrame_LoadExternal(name, texflags | TEXF_COMPRESS, false))) { diff --git a/netconn.c b/netconn.c index f88dfdad..e21c7152 100755 --- a/netconn.c +++ b/netconn.c @@ -433,7 +433,7 @@ static void _ServerList_Test(void) serverlist_cache[serverlist_cachecount].info.ping = 1000 + 1024 - i; dpsnprintf( serverlist_cache[serverlist_cachecount].info.name, sizeof(serverlist_cache[serverlist_cachecount].info.name), "Black's ServerList Test %i", i ); serverlist_cache[serverlist_cachecount].finished = true; - sprintf( serverlist_cache[serverlist_cachecount].line1, "%i %s", serverlist_cache[serverlist_cachecount].info.ping, serverlist_cache[serverlist_cachecount].info.name ); + dpsnprintf( serverlist_cache[serverlist_cachecount].line1, sizeof(serverlist_cache[serverlist_cachecount].info.line1), "%i %s", serverlist_cache[serverlist_cachecount].info.ping, serverlist_cache[serverlist_cachecount].info.name ); ServerList_ViewList_Insert( &serverlist_cache[serverlist_cachecount] ); serverlist_cachecount++; } diff --git a/prvm_cmds.c b/prvm_cmds.c index 3dd182b2..084883c6 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -561,9 +561,9 @@ void VM_ftos (void) v = PRVM_G_FLOAT(OFS_PARM0); if ((float)((int)v) == v) - sprintf(s, "%i", (int)v); + dpsnprintf(s, sizeof(s), "%i", (int)v); else - sprintf(s, "%f", v); + dpsnprintf(s, sizeof(s), "%f", v); PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(s); } @@ -599,7 +599,7 @@ void VM_vtos (void) VM_SAFEPARMCOUNT(1,VM_vtos); - sprintf (s, "'%5.1f %5.1f %5.1f'", PRVM_G_VECTOR(OFS_PARM0)[0], PRVM_G_VECTOR(OFS_PARM0)[1], PRVM_G_VECTOR(OFS_PARM0)[2]); + dpsnprintf (s, sizeof(s), "'%5.1f %5.1f %5.1f'", PRVM_G_VECTOR(OFS_PARM0)[0], PRVM_G_VECTOR(OFS_PARM0)[1], PRVM_G_VECTOR(OFS_PARM0)[2]); PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(s); } @@ -617,7 +617,7 @@ void VM_etos (void) VM_SAFEPARMCOUNT(1, VM_etos); - sprintf (s, "entity %i", PRVM_G_EDICTNUM(OFS_PARM0)); + dpsnprintf (s, sizeof(s), "entity %i", PRVM_G_EDICTNUM(OFS_PARM0)); PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(s); } @@ -691,22 +691,39 @@ string strftime(float uselocaltime, string[, string ...]) void VM_strftime(void) { time_t t; +#if _MSC_VER >= 1400 + struct tm tm; + int tmresult; +#else struct tm *tm; +#endif char fmt[VM_STRINGTEMP_LENGTH]; char result[VM_STRINGTEMP_LENGTH]; VM_SAFEPARMCOUNTRANGE(2, 8, VM_strftime); VM_VarString(1, fmt, sizeof(fmt)); t = time(NULL); +#if _MSC_VER >= 1400 + if (PRVM_G_FLOAT(OFS_PARM0)) + tmresult = localtime_s(&tm, &t); + else + tmresult = gmtime_s(&tm, &t); + if (!tmresult) +#else if (PRVM_G_FLOAT(OFS_PARM0)) tm = localtime(&t); else tm = gmtime(&t); if (!tm) +#endif { PRVM_G_INT(OFS_RETURN) = 0; return; } +#if _MSC_VER >= 1400 + strftime(result, sizeof(result), fmt, &tm); +#else strftime(result, sizeof(result), fmt, tm); +#endif PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(result); } diff --git a/prvm_edict.c b/prvm_edict.c index 876a9bbd..658b01c8 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -408,34 +408,34 @@ char *PRVM_ValueString (etype_t type, prvm_eval_t *val) case ev_entity: n = val->edict; if (n < 0 || n >= prog->limit_edicts) - sprintf (line, "entity %i (invalid!)", n); + dpsnprintf (line, sizeof(line), "entity %i (invalid!)", n); else - sprintf (line, "entity %i", n); + dpsnprintf (line, sizeof(line), "entity %i", n); break; case ev_function: f = prog->functions + val->function; - sprintf (line, "%s()", PRVM_GetString(f->s_name)); + dpsnprintf (line, sizeof(line), "%s()", PRVM_GetString(f->s_name)); break; case ev_field: def = PRVM_ED_FieldAtOfs ( val->_int ); - sprintf (line, ".%s", PRVM_GetString(def->s_name)); + dpsnprintf (line, sizeof(line), ".%s", PRVM_GetString(def->s_name)); break; case ev_void: - sprintf (line, "void"); + dpsnprintf (line, sizeof(line), "void"); break; case ev_float: // LordHavoc: changed from %5.1f to %10.4f - sprintf (line, "%10.4f", val->_float); + dpsnprintf (line, sizeof(line), "%10.4f", val->_float); break; case ev_vector: // LordHavoc: changed from %5.1f to %10.4f - sprintf (line, "'%10.4f %10.4f %10.4f'", val->vector[0], val->vector[1], val->vector[2]); + dpsnprintf (line, sizeof(line), "'%10.4f %10.4f %10.4f'", val->vector[0], val->vector[1], val->vector[2]); break; case ev_pointer: - sprintf (line, "pointer"); + dpsnprintf (line, sizeof(line), "pointer"); break; default: - sprintf (line, "bad type %i", (int) type); + dpsnprintf (line, sizeof(line), "bad type %i", (int) type); break; } @@ -537,11 +537,11 @@ char *PRVM_GlobalString (int ofs) val = (void *)&prog->globals.generic[ofs]; def = PRVM_ED_GlobalAtOfs(ofs); if (!def) - sprintf (line,"GLOBAL%i", ofs); + dpsnprintf (line, sizeof(line), "GLOBAL%i", ofs); else { s = PRVM_ValueString ((etype_t)def->type, (prvm_eval_t *)val); - sprintf (line,"%s (=%s)", PRVM_GetString(def->s_name), s); + dpsnprintf (line, sizeof(line), "%s (=%s)", PRVM_GetString(def->s_name), s); } //i = strlen(line); @@ -560,9 +560,9 @@ char *PRVM_GlobalStringNoContents (int ofs) def = PRVM_ED_GlobalAtOfs(ofs); if (!def) - sprintf (line,"GLOBAL%i", ofs); + dpsnprintf (line, sizeof(line), "GLOBAL%i", ofs); else - sprintf (line,"%s", PRVM_GetString(def->s_name)); + dpsnprintf (line, sizeof(line), "%s", PRVM_GetString(def->s_name)); //i = strlen(line); //for ( ; i<20 ; i++) @@ -599,7 +599,7 @@ void PRVM_ED_Print(prvm_edict_t *ed, const char *wildcard_fieldname) } tempstring[0] = 0; - sprintf(tempstring, "\n%s EDICT %i:\n", PRVM_NAME, PRVM_NUM_FOR_EDICT(ed)); + dpsnprintf(tempstring, sizeof(tempstring), "\n%s EDICT %i:\n", PRVM_NAME, PRVM_NUM_FOR_EDICT(ed)); for (i=1 ; iprogs->numfielddefs ; i++) { d = &prog->fielddefs[i]; @@ -1204,7 +1204,7 @@ const char *PRVM_ED_ParseEdict (const char *data, prvm_edict_t *ent) { char temp[32]; strlcpy (temp, com_token, sizeof(temp)); - sprintf (com_token, "0 %s 0", temp); + dpsnprintf (com_token, sizeof(com_token), "0 %s 0", temp); } if (!PRVM_ED_ParseEpair(ent, key, com_token, strcmp(keyname, "wad") != 0)) @@ -1915,7 +1915,7 @@ void PRVM_Fields_f (void) strlcat(tempstring, "pointer ", sizeof(tempstring)); break; default: - sprintf (tempstring2, "bad type %i ", d->type & ~DEF_SAVEGLOBAL); + dpsnprintf (tempstring2, sizeof(tempstring2), "bad type %i ", d->type & ~DEF_SAVEGLOBAL); strlcat(tempstring, tempstring2, sizeof(tempstring)); break; } @@ -1929,7 +1929,7 @@ void PRVM_Fields_f (void) strlcat(tempstring, name, sizeof(tempstring)); for (j = (int)strlen(name);j < 25;j++) strlcat(tempstring, " ", sizeof(tempstring)); - sprintf(tempstring2, "%5d", counts[i]); + dpsnprintf(tempstring2, sizeof(tempstring2), "%5d", counts[i]); strlcat(tempstring, tempstring2, sizeof(tempstring)); strlcat(tempstring, "\n", sizeof(tempstring)); if (strlen(tempstring) >= sizeof(tempstring)/2) diff --git a/r_shadow.c b/r_shadow.c index 0091ada6..8c98c598 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -3643,6 +3643,9 @@ void R_Shadow_LoadWorldLights(void) t++; } *s = 0; +#if _MSC_VER >= 1400 +#define sscanf sscanf_s +#endif a = sscanf(t, "%f %f %f %f %f %f %f %d %s %f %f %f %f %f %f %f %f %i", &origin[0], &origin[1], &origin[2], &radius, &color[0], &color[1], &color[2], &style, cubemapname, &corona, &angles[0], &angles[1], &angles[2], &coronasizescale, &ambientscale, &diffusescale, &specularscale, &flags); *s = tempchar; if (a < 18) @@ -3712,11 +3715,11 @@ void R_Shadow_SaveWorldLights(void) if (!light) continue; if (light->coronasizescale != 0.25f || light->ambientscale != 0 || light->diffusescale != 1 || light->specularscale != 1 || light->flags != LIGHTFLAG_REALTIMEMODE) - sprintf(line, "%s%f %f %f %f %f %f %f %d \"%s\" %f %f %f %f %f %f %f %f %i\n", light->shadow ? "" : "!", light->origin[0], light->origin[1], light->origin[2], light->radius, light->color[0], light->color[1], light->color[2], light->style, light->cubemapname, light->corona, light->angles[0], light->angles[1], light->angles[2], light->coronasizescale, light->ambientscale, light->diffusescale, light->specularscale, light->flags); + dpsnprintf(line, sizeof(line), "%s%f %f %f %f %f %f %f %d \"%s\" %f %f %f %f %f %f %f %f %i\n", light->shadow ? "" : "!", light->origin[0], light->origin[1], light->origin[2], light->radius, light->color[0], light->color[1], light->color[2], light->style, light->cubemapname, light->corona, light->angles[0], light->angles[1], light->angles[2], light->coronasizescale, light->ambientscale, light->diffusescale, light->specularscale, light->flags); else if (light->cubemapname[0] || light->corona || light->angles[0] || light->angles[1] || light->angles[2]) - sprintf(line, "%s%f %f %f %f %f %f %f %d \"%s\" %f %f %f %f\n", light->shadow ? "" : "!", light->origin[0], light->origin[1], light->origin[2], light->radius, light->color[0], light->color[1], light->color[2], light->style, light->cubemapname, light->corona, light->angles[0], light->angles[1], light->angles[2]); + dpsnprintf(line, sizeof(line), "%s%f %f %f %f %f %f %f %d \"%s\" %f %f %f %f\n", light->shadow ? "" : "!", light->origin[0], light->origin[1], light->origin[2], light->radius, light->color[0], light->color[1], light->color[2], light->style, light->cubemapname, light->corona, light->angles[0], light->angles[1], light->angles[2]); else - sprintf(line, "%s%f %f %f %f %f %f %f %d\n", light->shadow ? "" : "!", light->origin[0], light->origin[1], light->origin[2], light->radius, light->color[0], light->color[1], light->color[2], light->style); + dpsnprintf(line, sizeof(line), "%s%f %f %f %f %f %f %f %d\n", light->shadow ? "" : "!", light->origin[0], light->origin[1], light->origin[2], light->radius, light->color[0], light->color[1], light->color[2], light->style); if (bufchars + strlen(line) > bufmaxchars) { bufmaxchars = bufchars + strlen(line) + 2048; @@ -4463,26 +4466,26 @@ void R_Shadow_EditLights_DrawSelectedLightProperties(void) lightnumber = lightindex; lightcount++; } - sprintf(temp, "Cursor origin: %.0f %.0f %.0f", r_editlights_cursorlocation[0], r_editlights_cursorlocation[1], r_editlights_cursorlocation[2]); DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, false);y += 8; - sprintf(temp, "Total lights : %i active (%i total)", lightcount, (int)Mem_ExpandableArray_IndexRange(&r_shadow_worldlightsarray)); DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, false);y += 8; + dpsnprintf(temp, sizeof(temp), "Cursor origin: %.0f %.0f %.0f", r_editlights_cursorlocation[0], r_editlights_cursorlocation[1], r_editlights_cursorlocation[2]); DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, false);y += 8; + dpsnprintf(temp, sizeof(temp), "Total lights : %i active (%i total)", lightcount, (int)Mem_ExpandableArray_IndexRange(&r_shadow_worldlightsarray)); DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, false);y += 8; y += 8; if (r_shadow_selectedlight == NULL) return; - sprintf(temp, "Light #%i properties:", lightnumber);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; - sprintf(temp, "Origin : %.0f %.0f %.0f\n", r_shadow_selectedlight->origin[0], r_shadow_selectedlight->origin[1], r_shadow_selectedlight->origin[2]);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; - sprintf(temp, "Angles : %.0f %.0f %.0f\n", r_shadow_selectedlight->angles[0], r_shadow_selectedlight->angles[1], r_shadow_selectedlight->angles[2]);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; - sprintf(temp, "Color : %.2f %.2f %.2f\n", r_shadow_selectedlight->color[0], r_shadow_selectedlight->color[1], r_shadow_selectedlight->color[2]);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; - sprintf(temp, "Radius : %.0f\n", r_shadow_selectedlight->radius);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; - sprintf(temp, "Corona : %.0f\n", r_shadow_selectedlight->corona);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; - sprintf(temp, "Style : %i\n", r_shadow_selectedlight->style);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; - sprintf(temp, "Shadows : %s\n", r_shadow_selectedlight->shadow ? "yes" : "no");DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; - sprintf(temp, "Cubemap : %s\n", r_shadow_selectedlight->cubemapname);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; - sprintf(temp, "CoronaSize : %.2f\n", r_shadow_selectedlight->coronasizescale);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; - sprintf(temp, "Ambient : %.2f\n", r_shadow_selectedlight->ambientscale);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; - sprintf(temp, "Diffuse : %.2f\n", r_shadow_selectedlight->diffusescale);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; - sprintf(temp, "Specular : %.2f\n", r_shadow_selectedlight->specularscale);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; - sprintf(temp, "NormalMode : %s\n", (r_shadow_selectedlight->flags & LIGHTFLAG_NORMALMODE) ? "yes" : "no");DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; - sprintf(temp, "RealTimeMode : %s\n", (r_shadow_selectedlight->flags & LIGHTFLAG_REALTIMEMODE) ? "yes" : "no");DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; + dpsnprintf(temp, sizeof(temp), "Light #%i properties:", lightnumber);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; + dpsnprintf(temp, sizeof(temp), "Origin : %.0f %.0f %.0f\n", r_shadow_selectedlight->origin[0], r_shadow_selectedlight->origin[1], r_shadow_selectedlight->origin[2]);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; + dpsnprintf(temp, sizeof(temp), "Angles : %.0f %.0f %.0f\n", r_shadow_selectedlight->angles[0], r_shadow_selectedlight->angles[1], r_shadow_selectedlight->angles[2]);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; + dpsnprintf(temp, sizeof(temp), "Color : %.2f %.2f %.2f\n", r_shadow_selectedlight->color[0], r_shadow_selectedlight->color[1], r_shadow_selectedlight->color[2]);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; + dpsnprintf(temp, sizeof(temp), "Radius : %.0f\n", r_shadow_selectedlight->radius);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; + dpsnprintf(temp, sizeof(temp), "Corona : %.0f\n", r_shadow_selectedlight->corona);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; + dpsnprintf(temp, sizeof(temp), "Style : %i\n", r_shadow_selectedlight->style);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; + dpsnprintf(temp, sizeof(temp), "Shadows : %s\n", r_shadow_selectedlight->shadow ? "yes" : "no");DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; + dpsnprintf(temp, sizeof(temp), "Cubemap : %s\n", r_shadow_selectedlight->cubemapname);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; + dpsnprintf(temp, sizeof(temp), "CoronaSize : %.2f\n", r_shadow_selectedlight->coronasizescale);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; + dpsnprintf(temp, sizeof(temp), "Ambient : %.2f\n", r_shadow_selectedlight->ambientscale);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; + dpsnprintf(temp, sizeof(temp), "Diffuse : %.2f\n", r_shadow_selectedlight->diffusescale);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; + dpsnprintf(temp, sizeof(temp), "Specular : %.2f\n", r_shadow_selectedlight->specularscale);DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; + dpsnprintf(temp, sizeof(temp), "NormalMode : %s\n", (r_shadow_selectedlight->flags & LIGHTFLAG_NORMALMODE) ? "yes" : "no");DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; + dpsnprintf(temp, sizeof(temp), "RealTimeMode : %s\n", (r_shadow_selectedlight->flags & LIGHTFLAG_REALTIMEMODE) ? "yes" : "no");DrawQ_String(x, y, temp, 0, 8, 8, 1, 1, 1, 1, 0, NULL, true);y += 8; } void R_Shadow_EditLights_ToggleShadow_f(void) diff --git a/sbar.c b/sbar.c index bcf4d24d..f1b5ab58 100644 --- a/sbar.c +++ b/sbar.c @@ -458,7 +458,7 @@ void Sbar_DrawNum (int x, int y, int num, int digits, int color) char str[32], *ptr; int l, frame; - l = sprintf(str, "%i", num); + l = dpsnprintf(str, sizeof(str), "%i", num); ptr = str; if (l > digits) ptr += (l-digits); @@ -493,10 +493,10 @@ void Sbar_DrawXNum (int x, int y, int num, int digits, int lettersize, float r, if (digits < 0) { digits = -digits; - l = sprintf(str, "%0*i", digits, num); + l = dpsnprintf(str, sizeof(str), "%0*i", digits, num); } else - l = sprintf(str, "%i", num); + l = dpsnprintf(str, sizeof(str), "%i", num); ptr = str; if (l > digits) ptr += (l-digits); @@ -682,7 +682,7 @@ void Sbar_SoloScoreboard (void) *(strchr(str, '\n')) = 0; // make the time string - timelen = sprintf(timestr, " %i:%02i", minutes, seconds); + timelen = dpsnprintf(timestr, sizeof(timestr), " %i:%02i", minutes, seconds); // truncate the level name if necessary to make room for time max = 38 - timelen; @@ -701,10 +701,10 @@ void Sbar_SoloScoreboard (void) int l; if (gamemode != GAME_NEXUIZ) { - sprintf (str,"Monsters:%3i /%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]); + dpsnprintf (str, sizeof(str), "Monsters:%3i /%3i", cl.stats[STAT_MONSTERS], cl.stats[STAT_TOTALMONSTERS]); Sbar_DrawString (8, 4, str); - sprintf (str,"Secrets :%3i /%3i", cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]); + dpsnprintf (str, sizeof(str), "Secrets :%3i /%3i", cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]); Sbar_DrawString (8, 12, str); } @@ -713,7 +713,7 @@ void Sbar_SoloScoreboard (void) seconds = (int)(cl.time - 60*minutes); tens = seconds / 10; units = seconds - 10*tens; - sprintf (str,"Time :%3i:%i%i", minutes, tens, units); + dpsnprintf (str, sizeof(str), "Time :%3i:%i%i", minutes, tens, units); Sbar_DrawString (184, 4, str); // draw level name @@ -870,7 +870,7 @@ void Sbar_DrawInventory (void) // ammo counts for (i=0 ; i<4 ; i++) { - sprintf (num, "%4i",cl.stats[STAT_SHELLS+i] ); + dpsnprintf (num, sizeof(num), "%4i",cl.stats[STAT_SHELLS+i] ); if (num[0] != ' ') Sbar_DrawCharacter ( (6*i+0)*8 - 2, -24, 18 + num[0] - '0'); if (num[1] != ' ') @@ -949,7 +949,7 @@ void Sbar_DrawFrags (void) // draw number f = s->frags; - sprintf (num, "%3i",f); + dpsnprintf (num, sizeof(num), "%3i",f); if (k == cl.viewentity - 1) { @@ -993,7 +993,7 @@ void Sbar_DrawFace (void) // draw number f = s->frags; - sprintf (num, "%3i",f); + dpsnprintf (num, sizeof(num), "%3i",f); if ((s->colors & 0xf0)==0) { diff --git a/snd_main.c b/snd_main.c index 85874f25..46600ca7 100644 --- a/snd_main.c +++ b/snd_main.c @@ -471,7 +471,10 @@ void S_Startup (void) qboolean fixed_speed, fixed_width, fixed_channels; snd_format_t chosen_fmt; static snd_format_t prev_render_format = {0, 0, 0}; - const char* env; + char* env; +#if _MSC_VER >= 1400 + size_t envlen; +#endif int i; if (!snd_initialized.integer) @@ -487,22 +490,43 @@ void S_Startup (void) chosen_fmt.channels = snd_channels.integer; // Check the environment variables to see if the player wants a particular sound format +#if _MSC_VER >= 1400 + _dupenv_s(&env, &envlen, "QUAKE_SOUND_CHANNELS"); +#else env = getenv("QUAKE_SOUND_CHANNELS"); +#endif if (env != NULL) { chosen_fmt.channels = atoi (env); +#if _MSC_VER >= 1400 + free(env); +#endif fixed_channels = true; } +#if _MSC_VER >= 1400 + _dupenv_s(&env, &envlen, "QUAKE_SOUND_SPEED"); +#else env = getenv("QUAKE_SOUND_SPEED"); +#endif if (env != NULL) { chosen_fmt.speed = atoi (env); +#if _MSC_VER >= 1400 + free(env); +#endif fixed_speed = true; } +#if _MSC_VER >= 1400 + _dupenv_s(&env, &envlen, "QUAKE_SOUND_SAMPLEBITS"); +#else env = getenv("QUAKE_SOUND_SAMPLEBITS"); +#endif if (env != NULL) { chosen_fmt.width = atoi (env) / 8; +#if _MSC_VER >= 1400 + free(env); +#endif fixed_width = true; } diff --git a/sys_linux.c b/sys_linux.c index af4beb86..e1f85be1 100644 --- a/sys_linux.c +++ b/sys_linux.c @@ -60,6 +60,8 @@ void Sys_PrintToTerminal(const char *text) // BUG: for some reason, NDELAY also affects stdout (1) when used on stdin (0). int origflags = fcntl (1, F_GETFL, 0); fcntl (1, F_SETFL, origflags & ~FNDELAY); +#else +#define write _write #endif while(*text) { @@ -193,7 +195,7 @@ char *Sys_ConsoleInput(void) if (c == '\r') { text[len] = '\0'; - putch ('\n'); + _putch ('\n'); len = 0; return text; } @@ -201,16 +203,16 @@ char *Sys_ConsoleInput(void) { if (len) { - putch (c); - putch (' '); - putch (c); + _putch (c); + _putch (' '); + _putch (c); len--; } continue; } if (len < sizeof (text) - 1) { - putch (c); + _putch (c); text[len] = c; len++; } diff --git a/sys_sdl.c b/sys_sdl.c index ee2df9a3..6ca78129 100644 --- a/sys_sdl.c +++ b/sys_sdl.c @@ -53,6 +53,8 @@ void Sys_PrintToTerminal(const char *text) // BUG: for some reason, NDELAY also affects stdout (1) when used on stdin (0). int origflags = fcntl (1, F_GETFL, 0); fcntl (1, F_SETFL, origflags & ~FNDELAY); +#else +#define write _write #endif while(*text) { @@ -111,11 +113,11 @@ char *Sys_ConsoleInput(void) while (_kbhit ()) { c = _getch (); - putch (c); + _putch (c); if (c == '\r') { text[len] = 0; - putch ('\n'); + _putch ('\n'); len = 0; return text; } @@ -123,8 +125,8 @@ char *Sys_ConsoleInput(void) { if (len) { - putch (' '); - putch (c); + _putch (' '); + _putch (c); len--; text[len] = 0; } diff --git a/sys_shared.c b/sys_shared.c index e332f23b..91f72d41 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -10,7 +10,13 @@ static char sys_timestring[128]; char *Sys_TimeString(const char *timeformat) { time_t mytime = time(NULL); +#if _MSC_VER >= 1400 + struct tm mytm; + localtime_s(&mytm, &mytime); + strftime(sys_timestring, sizeof(sys_timestring), timeformat, &mytm); +#else strftime(sys_timestring, sizeof(sys_timestring), timeformat, localtime(&mytime)); +#endif return sys_timestring; } diff --git a/todo b/todo index ff3217d9..0772aaab 100644 --- a/todo +++ b/todo @@ -5,6 +5,7 @@ 0 bug darkplaces client csqc: input queue functions needed for csqc prediction aren't implemented (Spike) 0 bug darkplaces client csqc: precaches on client don't work, have to precache on server - what's going wrong here? (daemon, Urre) 0 bug darkplaces client csqc: there is no WriteFloat, making ReadFloat useless (Urre) +0 bug darkplaces client qc: trace_dphittexturename should be a static buffer rather than a tempstring, it produces unnecessary warnings currently (div0) 0 bug darkplaces client qw: add .mvd demo support 0 bug darkplaces client qw: add .qwd demo support 0 bug darkplaces client qw: add spectator cvar (Plague Monkey Rat) @@ -37,6 +38,7 @@ 0 bug darkplaces renderer: if an animated model is entirely transparent, the RSurf_ActiveModelEntity call updating vertices is completely wasted 0 bug darkplaces renderer: r_speeds counts entities twice with r_hdr 1, the whole counting code probably needs auditing (Morphed, and jim on inside3d) 0 bug darkplaces server csqc networking: csqc entity sending code does not currently detect packet loss and repeat lost entities (FrikaC, Chris Page, div0) +0 bug darkplaces server qc: trace_dphittexturename should be a static buffer rather than a tempstring, it produces unnecessary warnings currently (div0) 0 bug darkplaces server: SV_PushMove is ignoring model type in its angles_x handling, where as the renderer checks only model type to determine angles_x handling (Urre) 0 bug darkplaces server: SV_PushMove's call to SV_ClipMoveToEntity should do a trace, not just a point test, to support hollow pusher models (Urre) 0 bug darkplaces server: savegames do not save precaches, which means that automatic precaching frequently results in invalid modelindex values when reloading the savegame, and this bug also exists in many quake mods that randomly choose multiple variants of a monster, each with separate precaches, resulting in a different precache order when reloading the savegame