From: Mattia Basaglia Date: Sun, 9 Aug 2015 14:22:00 +0000 (+0200) Subject: Always use the custom version of strlcpy X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f643ebfbd50f70d25bdf301d4538ff8598647590;p=xonotic%2Fdarkplaces.git Always use the custom version of strlcpy --- diff --git a/cd_bsd.c b/cd_bsd.c index 7b3a855a..4cead23b 100644 --- a/cd_bsd.c +++ b/cd_bsd.c @@ -254,7 +254,7 @@ void CDAudio_SysInit (void) // COMMANDLINEOPTION: BSD Sound: -cddev chooses which CD drive to use if ((i = COM_CheckParm("-cddev")) != 0 && i < com_argc - 1) - strlcpy(cd_dev, com_argv[i + 1], sizeof(cd_dev)); + dp_strlcpy(cd_dev, com_argv[i + 1], sizeof(cd_dev)); } int CDAudio_SysStartup (void) diff --git a/cd_linux.c b/cd_linux.c index bc07b849..e6118c01 100644 --- a/cd_linux.c +++ b/cd_linux.c @@ -233,7 +233,7 @@ void CDAudio_SysInit (void) // COMMANDLINEOPTION: Linux Sound: -cddev chooses which CD drive to use if ((i = COM_CheckParm("-cddev")) != 0 && i < com_argc - 1) - strlcpy(cd_dev, com_argv[i + 1], sizeof(cd_dev)); + dp_strlcpy(cd_dev, com_argv[i + 1], sizeof(cd_dev)); } int CDAudio_SysStartup (void) diff --git a/cd_shared.c b/cd_shared.c index 43b4a7f4..11b33196 100644 --- a/cd_shared.c +++ b/cd_shared.c @@ -474,7 +474,7 @@ static void CD_f (void) return; } for (n = 1; n <= ret; n++) - strlcpy(remap[n], Cmd_Argv (n+1), sizeof(*remap)); + dp_strlcpy(remap[n], Cmd_Argv (n+1), sizeof(*remap)); #endif return; } @@ -633,7 +633,7 @@ void CDAudio_StartPlaylist(qboolean resume) break; // if we don't find the desired track, use the first one if (count == 0) - strlcpy(trackname, com_token, sizeof(trackname)); + dp_strlcpy(trackname, com_token, sizeof(trackname)); } } if (count > 0) @@ -663,7 +663,7 @@ void CDAudio_StartPlaylist(qboolean resume) break; if (listindex == current) { - strlcpy(trackname, com_token, sizeof(trackname)); + dp_strlcpy(trackname, com_token, sizeof(trackname)); break; } } diff --git a/cl_demo.c b/cl_demo.c index 5741e813..887be420 100644 --- a/cl_demo.c +++ b/cl_demo.c @@ -377,7 +377,7 @@ void CL_Record_f (void) track = -1; // get the demo name - strlcpy (name, Cmd_Argv(1), sizeof (name)); + dp_strlcpy (name, Cmd_Argv(1), sizeof (name)); FS_DefaultExtension (name, ".dem", sizeof (name)); // start the map up @@ -392,7 +392,7 @@ void CL_Record_f (void) Con_Print("ERROR: couldn't open.\n"); return; } - strlcpy(cls.demoname, name, sizeof(cls.demoname)); + dp_strlcpy(cls.demoname, name, sizeof(cls.demoname)); cls.forcetrack = track; FS_Printf(cls.demofile, "%i\n", cls.forcetrack); @@ -424,7 +424,7 @@ void CL_PlayDemo_f (void) } // open the demo file - strlcpy (name, Cmd_Argv(1), sizeof (name)); + dp_strlcpy (name, Cmd_Argv(1), sizeof (name)); FS_DefaultExtension (name, ".dem", sizeof (name)); f = FS_OpenVirtualFile(name, false); if (!f) @@ -447,7 +447,7 @@ void CL_PlayDemo_f (void) Con_Printf("Playing demo %s.\n", name); cls.demofile = f; - strlcpy(cls.demoname, name, sizeof(cls.demoname)); + dp_strlcpy(cls.demoname, name, sizeof(cls.demoname)); cls.demoplayback = true; cls.state = ca_connected; diff --git a/cl_dyntexture.c b/cl_dyntexture.c index fb378def..f30b3e18 100644 --- a/cl_dyntexture.c +++ b/cl_dyntexture.c @@ -39,7 +39,7 @@ static dyntexture_t * cl_finddyntexture( const char *name, qboolean warnonfailur return NULL; } dyntexture = &dyntextures[ dyntexturecount++ ]; - strlcpy( dyntexture->name, name, sizeof( dyntexture->name ) ); + dp_strlcpy( dyntexture->name, name, sizeof( dyntexture->name ) ); dyntexture->texture = DEFAULT_DYNTEXTURE; return dyntexture; } diff --git a/cl_input.c b/cl_input.c index b70a19ec..18fb4697 100644 --- a/cl_input.c +++ b/cl_input.c @@ -211,7 +211,7 @@ static void IN_BestWeapon_Register(const char *name, int impulse, int weaponbit, Con_Printf("no slot left for weapon definition; increase IN_BESTWEAPON_MAX\n"); return; // sorry } - strlcpy(in_bestweapon_info[i].name, name, sizeof(in_bestweapon_info[i].name)); + dp_strlcpy(in_bestweapon_info[i].name, name, sizeof(in_bestweapon_info[i].name)); in_bestweapon_info[i].impulse = impulse; if(weaponbit != -1) in_bestweapon_info[i].weaponbit = weaponbit; diff --git a/cl_main.c b/cl_main.c index 51a02ffb..33d8d447 100644 --- a/cl_main.c +++ b/cl_main.c @@ -2021,7 +2021,7 @@ static void CL_Fog_HeightTexture_f (void) r_refdef.fog_end = atof(Cmd_Argv(7)); r_refdef.fog_height = atof(Cmd_Argv(8)); r_refdef.fog_fadedepth = atof(Cmd_Argv(9)); - strlcpy(r_refdef.fog_height_texturename, Cmd_Argv(10), sizeof(r_refdef.fog_height_texturename)); + dp_strlcpy(r_refdef.fog_height_texturename, Cmd_Argv(10), sizeof(r_refdef.fog_height_texturename)); } @@ -2086,7 +2086,7 @@ void CL_Locs_FindLocationName(char *buffer, size_t buffersize, vec3_t point) cl_locnode_t *loc; loc = CL_Locs_FindNearest(point); if (loc) - strlcpy(buffer, loc->name, buffersize); + dp_strlcpy(buffer, loc->name, buffersize); else dpsnprintf(buffer, buffersize, "LOC=%.0f:%.0f:%.0f", point[0], point[1], point[2]); } diff --git a/cl_parse.c b/cl_parse.c index 923e48e7..8e8c20e5 100644 --- a/cl_parse.c +++ b/cl_parse.c @@ -400,14 +400,14 @@ void CL_ParseEntityLump(char *entdata) if (com_token[0] == '}') break; // end of worldspawn if (com_token[0] == '_') - strlcpy (key, com_token + 1, sizeof (key)); + dp_strlcpy (key, com_token + 1, sizeof (key)); else - strlcpy (key, com_token, sizeof (key)); + dp_strlcpy (key, com_token, sizeof (key)); while (key[strlen(key)-1] == ' ') // remove trailing spaces key[strlen(key)-1] = 0; if (!COM_ParseToken_Simple(&data, false, false, true)) return; // error - strlcpy (value, com_token, sizeof (value)); + dp_strlcpy (value, com_token, sizeof (value)); if (!strcmp("sky", key)) { loadedsky = true; @@ -483,9 +483,9 @@ static void CL_SetupWorldModel(void) // set up csqc world for collision culling if (cl.worldmodel) { - strlcpy(cl.worldname, cl.worldmodel->name, sizeof(cl.worldname)); + dp_strlcpy(cl.worldname, cl.worldmodel->name, sizeof(cl.worldname)); FS_StripExtension(cl.worldname, cl.worldnamenoextension, sizeof(cl.worldnamenoextension)); - strlcpy(cl.worldbasename, !strncmp(cl.worldnamenoextension, "maps/", 5) ? cl.worldnamenoextension + 5 : cl.worldnamenoextension, sizeof(cl.worldbasename)); + dp_strlcpy(cl.worldbasename, !strncmp(cl.worldnamenoextension, "maps/", 5) ? cl.worldnamenoextension + 5 : cl.worldnamenoextension, sizeof(cl.worldbasename)); Cvar_SetQuick(&cl_worldmessage, cl.worldmessage); Cvar_SetQuick(&cl_worldname, cl.worldname); Cvar_SetQuick(&cl_worldnamenoextension, cl.worldnamenoextension); @@ -557,7 +557,7 @@ static qboolean QW_CL_CheckOrDownloadFile(const char *filename) if (!cls.netcon) return true; - strlcpy(cls.qw_downloadname, filename, sizeof(cls.qw_downloadname)); + dp_strlcpy(cls.qw_downloadname, filename, sizeof(cls.qw_downloadname)); Con_Printf("Downloading %s\n", filename); if (!cls.qw_downloadmemory) @@ -834,7 +834,7 @@ static void QW_CL_ParseModelList(void) Host_Error("Server sent too many model precaches"); if (strlen(str) >= MAX_QPATH) Host_Error("Server sent a precache name of %i characters (max %i)", (int)strlen(str), MAX_QPATH - 1); - strlcpy(cl.model_name[nummodels], str, sizeof (cl.model_name[nummodels])); + dp_strlcpy(cl.model_name[nummodels], str, sizeof (cl.model_name[nummodels])); } n = MSG_ReadByte(&cl_message); @@ -869,7 +869,7 @@ static void QW_CL_ParseSoundList(void) Host_Error("Server sent too many sound precaches"); if (strlen(str) >= MAX_QPATH) Host_Error("Server sent a precache name of %i characters (max %i)", (int)strlen(str), MAX_QPATH - 1); - strlcpy(cl.sound_name[numsounds], str, sizeof (cl.sound_name[numsounds])); + dp_strlcpy(cl.sound_name[numsounds], str, sizeof (cl.sound_name[numsounds])); } n = MSG_ReadByte(&cl_message); @@ -983,7 +983,7 @@ static void QW_CL_ProcessUserInfo(int slot) InfoString_GetValue(cl.scores[slot].qw_userinfo, "team", cl.scores[slot].qw_team, sizeof(cl.scores[slot].qw_team)); InfoString_GetValue(cl.scores[slot].qw_userinfo, "skin", cl.scores[slot].qw_skin, sizeof(cl.scores[slot].qw_skin)); if (!cl.scores[slot].qw_skin[0]) - strlcpy(cl.scores[slot].qw_skin, "base", sizeof(cl.scores[slot].qw_skin)); + dp_strlcpy(cl.scores[slot].qw_skin, "base", sizeof(cl.scores[slot].qw_skin)); // TODO: skin cache } @@ -999,7 +999,7 @@ static void QW_CL_UpdateUserInfo(void) return; } cl.scores[slot].qw_userid = MSG_ReadLong(&cl_message); - strlcpy(cl.scores[slot].qw_userinfo, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(cl.scores[slot].qw_userinfo)); + dp_strlcpy(cl.scores[slot].qw_userinfo, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(cl.scores[slot].qw_userinfo)); QW_CL_ProcessUserInfo(slot); } @@ -1010,8 +1010,8 @@ static void QW_CL_SetInfo(void) char key[2048]; char value[2048]; slot = MSG_ReadByte(&cl_message); - strlcpy(key, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(key)); - strlcpy(value, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(value)); + dp_strlcpy(key, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(key)); + dp_strlcpy(value, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(value)); if (slot >= cl.maxclients) { Con_Printf("svc_setinfo >= cl.maxclients\n"); @@ -1027,8 +1027,8 @@ static void QW_CL_ServerInfo(void) char key[2048]; char value[2048]; char temp[32]; - strlcpy(key, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(key)); - strlcpy(value, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(value)); + dp_strlcpy(key, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(key)); + dp_strlcpy(value, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(value)); Con_DPrintf("SERVERINFO: %s=%s\n", key, value); InfoString_SetValue(cl.qw_serverinfo, sizeof(cl.qw_serverinfo), key, value); InfoString_GetValue(cl.qw_serverinfo, "teamplay", temp, sizeof(temp)); @@ -1528,7 +1528,7 @@ static void CL_DownloadBegin_f(void) CL_StopDownload(0, 0); // we're really beginning a download now, so initialize stuff - strlcpy(cls.qw_downloadname, Cmd_Argv(2), sizeof(cls.qw_downloadname)); + dp_strlcpy(cls.qw_downloadname, Cmd_Argv(2), sizeof(cls.qw_downloadname)); cls.qw_downloadmemorymaxsize = size; cls.qw_downloadmemory = (unsigned char *) Mem_Alloc(cls.permanentmempool, cls.qw_downloadmemorymaxsize); cls.qw_downloadnumber++; @@ -1729,7 +1729,7 @@ static void CL_ParseServerInfo (void) str = MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)); Con_Printf("server gamedir is %s\n", str); - strlcpy(gamedir[0], str, sizeof(gamedir[0])); + dp_strlcpy(gamedir[0], str, sizeof(gamedir[0])); // change gamedir if needed if (!FS_ChangeGameDirs(1, gamedir, true, false)) @@ -1747,7 +1747,7 @@ static void CL_ParseServerInfo (void) // get the full level name str = MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)); - strlcpy (cl.worldmessage, str, sizeof(cl.worldmessage)); + dp_strlcpy (cl.worldmessage, str, sizeof(cl.worldmessage)); // get the movevars that are defined in the qw protocol cl.movevars_gravity = MSG_ReadFloat(&cl_message); @@ -1794,9 +1794,9 @@ static void CL_ParseServerInfo (void) // (we don't even know the name of the map yet) // this also means cl_autodemo does not work on QW protocol... - strlcpy(cl.worldname, "", sizeof(cl.worldname)); - strlcpy(cl.worldnamenoextension, "", sizeof(cl.worldnamenoextension)); - strlcpy(cl.worldbasename, "qw", sizeof(cl.worldbasename)); + dp_strlcpy(cl.worldname, "", sizeof(cl.worldname)); + dp_strlcpy(cl.worldnamenoextension, "", sizeof(cl.worldnamenoextension)); + dp_strlcpy(cl.worldbasename, "qw", sizeof(cl.worldbasename)); Cvar_SetQuick(&cl_worldname, cl.worldname); Cvar_SetQuick(&cl_worldnamenoextension, cl.worldnamenoextension); Cvar_SetQuick(&cl_worldbasename, cl.worldbasename); @@ -1824,7 +1824,7 @@ static void CL_ParseServerInfo (void) // parse signon message str = MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)); - strlcpy (cl.worldmessage, str, sizeof(cl.worldmessage)); + dp_strlcpy (cl.worldmessage, str, sizeof(cl.worldmessage)); // seperate the printfs so the server message can have a color if (cls.protocol != PROTOCOL_NEHAHRAMOVIE) // no messages when playing the Nehahra movie @@ -1843,7 +1843,7 @@ static void CL_ParseServerInfo (void) Host_Error ("Server sent too many model precaches"); if (strlen(str) >= MAX_QPATH) Host_Error ("Server sent a precache name of %i characters (max %i)", (int)strlen(str), MAX_QPATH - 1); - strlcpy (cl.model_name[nummodels], str, sizeof (cl.model_name[nummodels])); + dp_strlcpy (cl.model_name[nummodels], str, sizeof (cl.model_name[nummodels])); } // parse sound precache list for (numsounds=1 ; ; numsounds++) @@ -1855,13 +1855,13 @@ static void CL_ParseServerInfo (void) Host_Error("Server sent too many sound precaches"); if (strlen(str) >= MAX_QPATH) Host_Error("Server sent a precache name of %i characters (max %i)", (int)strlen(str), MAX_QPATH - 1); - strlcpy (cl.sound_name[numsounds], str, sizeof (cl.sound_name[numsounds])); + dp_strlcpy (cl.sound_name[numsounds], str, sizeof (cl.sound_name[numsounds])); } // set the base name for level-specific things... this gets updated again by CL_SetupWorldModel later - strlcpy(cl.worldname, cl.model_name[1], sizeof(cl.worldname)); + dp_strlcpy(cl.worldname, cl.model_name[1], sizeof(cl.worldname)); FS_StripExtension(cl.worldname, cl.worldnamenoextension, sizeof(cl.worldnamenoextension)); - strlcpy(cl.worldbasename, !strncmp(cl.worldnamenoextension, "maps/", 5) ? cl.worldnamenoextension + 5 : cl.worldnamenoextension, sizeof(cl.worldbasename)); + dp_strlcpy(cl.worldbasename, !strncmp(cl.worldnamenoextension, "maps/", 5) ? cl.worldnamenoextension + 5 : cl.worldnamenoextension, sizeof(cl.worldbasename)); Cvar_SetQuick(&cl_worldmessage, cl.worldmessage); Cvar_SetQuick(&cl_worldname, cl.worldname); Cvar_SetQuick(&cl_worldnamenoextension, cl.worldnamenoextension); @@ -1943,7 +1943,7 @@ static void CL_ParseServerInfo (void) cls.forcetrack = -1; FS_Printf (cls.demofile, "%i\n", cls.forcetrack); cls.demorecording = true; - strlcpy(cls.demoname, demofile, sizeof(cls.demoname)); + dp_strlcpy(cls.demoname, demofile, sizeof(cls.demoname)); cls.demo_lastcsprogssize = -1; cls.demo_lastcsprogscrc = -1; } @@ -3030,10 +3030,10 @@ static void CL_IPLog_Add(const char *address, const char *name, qboolean checkex sz_name = strlen(name) + 1; cl_iplog_items[cl_iplog_numitems].address = (char *) Mem_Alloc(cls.permanentmempool, sz_address); cl_iplog_items[cl_iplog_numitems].name = (char *) Mem_Alloc(cls.permanentmempool, sz_name); - strlcpy(cl_iplog_items[cl_iplog_numitems].address, address, sz_address); + dp_strlcpy(cl_iplog_items[cl_iplog_numitems].address, address, sz_address); // TODO: maybe it would be better to strip weird characters from name when // copying it here rather than using a straight strcpy? - strlcpy(cl_iplog_items[cl_iplog_numitems].name, name, sz_name); + dp_strlcpy(cl_iplog_items[cl_iplog_numitems].name, name, sz_name); cl_iplog_numitems++; if (addtofile) { @@ -3473,7 +3473,7 @@ void CL_ParseServerMessage(void) { char description[32*64], temp[64]; int count; - strlcpy(description, "packet dump: ", sizeof(description)); + dp_strlcpy(description, "packet dump: ", sizeof(description)); i = cmdcount - 32; if (i < 0) i = 0; @@ -3555,7 +3555,7 @@ void CL_ParseServerMessage(void) Con_Printf ("svc_lightstyle >= MAX_LIGHTSTYLES"); break; } - strlcpy (cl.lightstyle[i].map, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof (cl.lightstyle[i].map)); + dp_strlcpy (cl.lightstyle[i].map, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof (cl.lightstyle[i].map)); cl.lightstyle[i].map[MAX_STYLESTRING - 1] = 0; cl.lightstyle[i].length = (int)strlen(cl.lightstyle[i].map); break; @@ -3838,7 +3838,7 @@ void CL_ParseServerMessage(void) { char description[32*64], temp[64]; int count; - strlcpy (description, "packet dump: ", sizeof(description)); + dp_strlcpy (description, "packet dump: ", sizeof(description)); i = cmdcount - 32; if (i < 0) i = 0; @@ -3981,7 +3981,7 @@ void CL_ParseServerMessage(void) Con_Printf ("svc_lightstyle >= MAX_LIGHTSTYLES"); break; } - strlcpy (cl.lightstyle[i].map, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof (cl.lightstyle[i].map)); + dp_strlcpy (cl.lightstyle[i].map, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof (cl.lightstyle[i].map)); cl.lightstyle[i].map[MAX_STYLESTRING - 1] = 0; cl.lightstyle[i].length = (int)strlen(cl.lightstyle[i].map); break; @@ -4037,7 +4037,7 @@ void CL_ParseServerMessage(void) i = MSG_ReadByte(&cl_message); if (i >= cl.maxclients) Host_Error ("CL_ParseServerMessage: svc_updatename >= cl.maxclients"); - strlcpy (cl.scores[i].name, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof (cl.scores[i].name)); + dp_strlcpy (cl.scores[i].name, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof (cl.scores[i].name)); break; case svc_updatefrags: diff --git a/cl_particles.c b/cl_particles.c index 54f73efb..b3edcbc6 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -333,7 +333,7 @@ static void CL_Particles_ParseEffectInfo(const char *textstart, const char *text break; if (argc < 16) { - strlcpy(argv[argc], com_token, sizeof(argv[argc])); + dp_strlcpy(argv[argc], com_token, sizeof(argv[argc])); argc++; } } @@ -363,7 +363,7 @@ static void CL_Particles_ParseEffectInfo(const char *textstart, const char *text } else { - strlcpy(particleeffectname[effectnameindex], argv[1], sizeof(particleeffectname[effectnameindex])); + dp_strlcpy(particleeffectname[effectnameindex], argv[1], sizeof(particleeffectname[effectnameindex])); break; } } @@ -545,15 +545,15 @@ static void CL_Particles_LoadEffectInfo(const char *customfile) memset(particleeffectinfo, 0, sizeof(particleeffectinfo)); memset(particleeffectname, 0, sizeof(particleeffectname)); for (i = 0;i < EFFECT_TOTAL;i++) - strlcpy(particleeffectname[i], standardeffectnames[i], sizeof(particleeffectname[i])); + dp_strlcpy(particleeffectname[i], standardeffectnames[i], sizeof(particleeffectname[i])); for (filepass = 0;;filepass++) { if (filepass == 0) { if (customfile) - strlcpy(filename, customfile, sizeof(filename)); + dp_strlcpy(filename, customfile, sizeof(filename)); else - strlcpy(filename, "effectinfo.txt", sizeof(filename)); + dp_strlcpy(filename, "effectinfo.txt", sizeof(filename)); } else if (filepass == 1) { @@ -2397,7 +2397,7 @@ static void R_InitParticleTexture (void) if (COM_ParseToken_Simple(&bufptr, true, false, true) && strcmp(com_token, "\n")) { - strlcpy(texturename, com_token, sizeof(texturename)); + dp_strlcpy(texturename, com_token, sizeof(texturename)); s1 = atof(com_token); if (COM_ParseToken_Simple(&bufptr, true, false, true) && strcmp(com_token, "\n")) { @@ -2409,9 +2409,9 @@ static void R_InitParticleTexture (void) if (COM_ParseToken_Simple(&bufptr, true, false, true) && strcmp(com_token, "\n")) { t2 = atof(com_token); - strlcpy(texturename, "particles/particlefont.tga", sizeof(texturename)); + dp_strlcpy(texturename, "particles/particlefont.tga", sizeof(texturename)); if (COM_ParseToken_Simple(&bufptr, true, false, true) && strcmp(com_token, "\n")) - strlcpy(texturename, com_token, sizeof(texturename)); + dp_strlcpy(texturename, com_token, sizeof(texturename)); } } } diff --git a/cl_screen.c b/cl_screen.c index 5bcce5f3..75cd9974 100644 --- a/cl_screen.c +++ b/cl_screen.c @@ -160,7 +160,7 @@ for a few moments */ void SCR_CenterPrint(const char *str) { - strlcpy (scr_centerstring, str, sizeof (scr_centerstring)); + dp_strlcpy (scr_centerstring, str, sizeof (scr_centerstring)); scr_centertime_off = scr_centertime.value; scr_centertime_start = cl.time; @@ -678,7 +678,7 @@ static void SCR_InfoBar_f(void) if(Cmd_Argc() == 3) { scr_infobartime_off = atof(Cmd_Argv(1)); - strlcpy(scr_infobarstring, Cmd_Argv(2), sizeof(scr_infobarstring)); + dp_strlcpy(scr_infobarstring, Cmd_Argv(2), sizeof(scr_infobarstring)); } else { @@ -1444,7 +1444,7 @@ void SCR_ScreenShot_f (void) if (Cmd_Argc() == 2) { const char *ext; - strlcpy(filename, Cmd_Argv(1), sizeof(filename)); + dp_strlcpy(filename, Cmd_Argv(1), sizeof(filename)); ext = FS_FileExtension(filename); if (!strcasecmp(ext, "jpg")) { @@ -1537,7 +1537,7 @@ void SCR_ScreenShot_f (void) { if(SCR_ScreenShot (filename, buffer1, buffer2, 0, 0, vid.width, vid.height, false, false, false, false, false, true, scr_screenshot_alpha.integer != 0)) { - strlcpy(filename + strlen(filename) - 3, "tga", 4); + dp_strlcpy(filename + strlen(filename) - 3, "tga", 4); Con_Printf("Wrote %s\n", filename); } } @@ -1869,7 +1869,7 @@ static void R_Envmap_f (void) return; } - strlcpy (basename, Cmd_Argv(1), sizeof (basename)); + dp_strlcpy (basename, Cmd_Argv(1), sizeof (basename)); size = atoi(Cmd_Argv(2)); if (size != 128 && size != 256 && size != 512 && size != 1024) { @@ -1941,8 +1941,8 @@ void SHOWLMP_decodeshow(void) int k; char lmplabel[256], picname[256]; float x, y; - strlcpy (lmplabel,MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof (lmplabel)); - strlcpy (picname, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof (picname)); + dp_strlcpy (lmplabel,MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof (lmplabel)); + dp_strlcpy (picname, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof (picname)); if (gamemode == GAME_NEHAHRA) // LordHavoc: nasty old legacy junk { x = MSG_ReadByte(&cl_message); @@ -1973,8 +1973,8 @@ void SHOWLMP_decodeshow(void) if (!cl.showlmps[k].isactive) break; cl.showlmps[k].isactive = true; - strlcpy (cl.showlmps[k].label, lmplabel, sizeof (cl.showlmps[k].label)); - strlcpy (cl.showlmps[k].pic, picname, sizeof (cl.showlmps[k].pic)); + dp_strlcpy (cl.showlmps[k].label, lmplabel, sizeof (cl.showlmps[k].label)); + dp_strlcpy (cl.showlmps[k].pic, picname, sizeof (cl.showlmps[k].pic)); cl.showlmps[k].x = x; cl.showlmps[k].y = y; cl.num_showlmps = max(cl.num_showlmps, k + 1); @@ -2360,7 +2360,7 @@ void SCR_PushLoadingScreen (qboolean redraw, const char *msg, float len_in_paren s->prev = loadingscreenstack; loadingscreenstack = s; - strlcpy(s->msg, msg, sizeof(s->msg)); + dp_strlcpy(s->msg, msg, sizeof(s->msg)); s->relative_completion = 0; if(s->prev) diff --git a/cl_video.c b/cl_video.c index db2302d6..fe9c9339 100644 --- a/cl_video.c +++ b/cl_video.c @@ -217,11 +217,11 @@ static void LoadSubtitles( clvideo_t *video, const char *subtitlesfile ) static clvideo_t* OpenVideo( clvideo_t *video, const char *filename, const char *name, int owner, const char *subtitlesfile ) { - strlcpy( video->filename, filename, sizeof(video->filename) ); + dp_strlcpy( video->filename, filename, sizeof(video->filename) ); video->ownertag = owner; if( strncmp( name, CLVIDEOPREFIX, sizeof( CLVIDEOPREFIX ) - 1 ) ) return NULL; - strlcpy( video->cpif.name, name, sizeof(video->cpif.name) ); + dp_strlcpy( video->cpif.name, name, sizeof(video->cpif.name) ); if( !OpenStream( video ) ) return NULL; diff --git a/clvm_cmds.c b/clvm_cmds.c index 9d41dda6..ebf11de3 100644 --- a/clvm_cmds.c +++ b/clvm_cmds.c @@ -580,7 +580,7 @@ static void VM_CL_lightstyle (prvm_prog_t *prog) VM_Warning(prog, "VM_CL_lightstyle >= MAX_LIGHTSTYLES\n"); return; } - strlcpy (cl.lightstyle[i].map, c, sizeof (cl.lightstyle[i].map)); + dp_strlcpy (cl.lightstyle[i].map, c, sizeof (cl.lightstyle[i].map)); cl.lightstyle[i].map[MAX_STYLESTRING - 1] = 0; cl.lightstyle[i].length = (int)strlen(cl.lightstyle[i].map); } @@ -1257,7 +1257,7 @@ static void VM_CL_getstats (prvm_prog_t *prog) VM_Warning(prog, "VM_CL_getstats: index>MAX_CL_STATS-4 or index<0\n"); return; } - strlcpy(t, (char*)&cl.stats[i], sizeof(t)); + dp_strlcpy(t, (char*)&cl.stats[i], sizeof(t)); PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(prog, t); } @@ -1576,7 +1576,7 @@ static void VM_CL_getplayerkey (prvm_prog_t *prog) t[0] = 0; if(!strcasecmp(c, "name")) - strlcpy(t, cl.scores[i].name, sizeof(t)); + dp_strlcpy(t, cl.scores[i].name, sizeof(t)); else if(!strcasecmp(c, "frags")) dpsnprintf(t, sizeof(t), "%i", cl.scores[i].frags); diff --git a/cmd.c b/cmd.c index cab160b4..eb7dc14d 100644 --- a/cmd.c +++ b/cmd.c @@ -136,7 +136,7 @@ static void Cmd_Centerprint_f (void) c = Cmd_Argc(); if(c >= 2) { - strlcpy(msg, Cmd_Argv(1), sizeof(msg)); + dp_strlcpy(msg, Cmd_Argv(1), sizeof(msg)); for(i = 2; i < c; ++i) { strlcat(msg, " ", sizeof(msg)); @@ -869,7 +869,7 @@ static void Cmd_Alias_f (void) cmdalias_t *prev, *current; a = (cmdalias_t *)Z_Malloc (sizeof(cmdalias_t)); - strlcpy (a->name, s, sizeof (a->name)); + dp_strlcpy (a->name, s, sizeof (a->name)); // insert it at the right alphanumeric position for( prev = NULL, current = cmd_alias ; current && strcmp( current->name, a->name ) < 0 ; prev = current, current = current->next ) ; diff --git a/common.c b/common.c index 66b7895a..a9ce6c1e 100644 --- a/common.c +++ b/common.c @@ -1588,7 +1588,7 @@ static void COM_SetGameType(int index) // if there are spaces in the game's network filter name it would // cause parse errors in getservers in dpmaster, so we need to replace // them with _ characters - strlcpy(gamenetworkfilternamebuffer, gamenetworkfiltername, sizeof(gamenetworkfilternamebuffer)); + dp_strlcpy(gamenetworkfilternamebuffer, gamenetworkfiltername, sizeof(gamenetworkfilternamebuffer)); while ((s = strchr(gamenetworkfilternamebuffer, ' ')) != NULL) *s = '_'; gamenetworkfiltername = gamenetworkfilternamebuffer; @@ -2097,13 +2097,13 @@ void InfoString_SetValue(char *buffer, size_t bufferlength, const char *key, con { // set the key/value and append the remaining text char tempbuffer[MAX_INPUTLINE]; - strlcpy(tempbuffer, buffer + pos2, sizeof(tempbuffer)); + dp_strlcpy(tempbuffer, buffer + pos2, sizeof(tempbuffer)); dpsnprintf(buffer + pos, bufferlength - pos, "\\%s\\%s%s", key, value, tempbuffer); } else { // just remove the key from the text - strlcpy(buffer + pos, buffer + pos2, bufferlength - pos); + dp_strlcpy(buffer + pos, buffer + pos2, bufferlength - pos); } } @@ -2138,7 +2138,7 @@ void InfoString_Print(char *buffer) } //======================================================== -// strlcat and strlcpy, from OpenBSD +// strlcat and dp_strlcpy, from OpenBSD /* * Copyright (c) 1998 Todd C. Miller @@ -2191,9 +2191,9 @@ strlcat(char *dst, const char *src, size_t siz) #endif // #ifndef HAVE_STRLCAT -#ifndef HAVE_STRLCPY +//#ifndef HAVE_STRLCPY size_t -strlcpy(char *dst, const char *src, size_t siz) +dp_strlcpy(char *dst, const char *src, size_t siz) { register char *d = dst; register const char *s = src; @@ -2218,7 +2218,7 @@ strlcpy(char *dst, const char *src, size_t siz) return(s - src - 1); /* count does not include NUL */ } -#endif // #ifndef HAVE_STRLCPY +//#endif // #ifndef HAVE_STRLCPY void FindFraction(double val, int *num, int *denom, int denomMax) { @@ -2256,7 +2256,7 @@ char **XPM_DecodeString(const char *in) while(COM_ParseToken_QuakeC(&in, false)) { tokens[line] = lines[line]; - strlcpy(lines[line++], com_token, sizeof(lines[0])); + dp_strlcpy(lines[line++], com_token, sizeof(lines[0])); if(!COM_ParseToken_QuakeC(&in, false)) return NULL; if(!strcmp(com_token, "}")) diff --git a/common.h b/common.h index 6e45808e..98386561 100644 --- a/common.h +++ b/common.h @@ -366,15 +366,15 @@ void InfoString_Print(char *buffer); size_t strlcat(char *dst, const char *src, size_t siz); #endif // #ifndef HAVE_STRLCAT -#ifndef HAVE_STRLCPY +//#ifndef HAVE_STRLCPY /*! * Copy src to string dst of size siz. At most siz-1 characters * will be copied. Always NUL terminates (unless siz == 0). * Returns strlen(src); if retval >= siz, truncation occurred. */ -size_t strlcpy(char *dst, const char *src, size_t siz); +size_t dp_strlcpy(char *dst, const char *src, size_t siz); -#endif // #ifndef HAVE_STRLCPY +//#endif // #ifndef HAVE_STRLCPY void FindFraction(double val, int *num, int *denom, int denomMax); diff --git a/console.c b/console.c index 1f5b30d9..16b4b8bc 100644 --- a/console.c +++ b/console.c @@ -384,7 +384,7 @@ const char *ConBuffer_GetLine(conbuffer_t *buf, int i) static char copybuf[MAX_INPUTLINE]; // client only con_lineinfo_t *l = &CONBUFFER_LINES(buf, i); size_t sz = l->len+1 > sizeof(copybuf) ? sizeof(copybuf) : l->len+1; - strlcpy(copybuf, l->start, sz); + dp_strlcpy(copybuf, l->start, sz); return copybuf; } @@ -504,7 +504,7 @@ static void Log_Open (void) logfile = FS_OpenRealFile(log_file.string, "a", false); if (logfile != NULL) { - strlcpy (crt_log_file, log_file.string, sizeof (crt_log_file)); + dp_strlcpy (crt_log_file, log_file.string, sizeof (crt_log_file)); FS_Print (logfile, Log_Timestamp ("Log started")); } } @@ -1519,7 +1519,7 @@ static void Con_DrawInput (void) if (!key_consoleactive) return; // don't draw anything - strlcpy(editlinecopy, key_line, sizeof(editlinecopy)); + dp_strlcpy(editlinecopy, key_line, sizeof(editlinecopy)); text = editlinecopy; // Advanced Console Editing by Radix radix@planetquake.com @@ -2127,12 +2127,12 @@ qboolean GetMapList (const char *s, char *completedname, int completednamebuffer char entfilename[MAX_QPATH]; char desc[64]; desc[0] = 0; - strlcpy(message, "^1ERROR: open failed^7", sizeof(message)); + dp_strlcpy(message, "^1ERROR: open failed^7", sizeof(message)); p = 0; f = FS_OpenVirtualFile(t->filenames[i], true); if(f) { - strlcpy(message, "^1ERROR: not a known map format^7", sizeof(message)); + dp_strlcpy(message, "^1ERROR: not a known map format^7", sizeof(message)); memset(buf, 0, 1024); FS_Read(f, buf, 1024); if (!memcmp(buf, "IBSP", 4)) @@ -2183,7 +2183,7 @@ qboolean GetMapList (const char *s, char *completedname, int completednamebuffer { dpsnprintf(desc, sizeof(desc), "unknown%i", BuffLittleLong(buf)); } - strlcpy(entfilename, t->filenames[i], sizeof(entfilename)); + dp_strlcpy(entfilename, t->filenames[i], sizeof(entfilename)); memcpy(entfilename + strlen(entfilename) - 4, ".ent", 5); entities = (char *)FS_LoadFile(entfilename, tempmempool, true, NULL); if (!entities && lumplen >= 10) @@ -2219,7 +2219,7 @@ qboolean GetMapList (const char *s, char *completedname, int completednamebuffer if (!strcmp(keyname, "message")) { // get the message contents - strlcpy(message, com_token, sizeof(message)); + dp_strlcpy(message, com_token, sizeof(message)); break; } } @@ -2429,10 +2429,10 @@ static int Nicks_CompleteCountPossible(char *line, int pos, char *s, qboolean is if(match < 0) continue; //Con_Printf("Possible match: %s|%s\n", cl.scores[p].name, name); - strlcpy(Nicks_list[count], cl.scores[p].name, sizeof(Nicks_list[count])); + dp_strlcpy(Nicks_list[count], cl.scores[p].name, sizeof(Nicks_list[count])); // the sanitized list - strlcpy(Nicks_sanlist[count], name, sizeof(Nicks_sanlist[count])); + dp_strlcpy(Nicks_sanlist[count], name, sizeof(Nicks_sanlist[count])); if(!count) { Nicks_matchpos = match; @@ -2546,7 +2546,7 @@ static void Nicks_CutMatchesAlphaNumeric(int count) if(Nicks_strcleanlen(Nicks_sanlist[0]) < strlen(tempstr)) { // if the clean sanitized one is longer than the current one, use it, it has crap chars which definitely are in there - strlcpy(Nicks_sanlist[0], tempstr, sizeof(Nicks_sanlist[0])); + dp_strlcpy(Nicks_sanlist[0], tempstr, sizeof(Nicks_sanlist[0])); } } @@ -2602,7 +2602,7 @@ static void Nicks_CutMatchesNoSpaces(int count) if(Nicks_strcleanlen(Nicks_sanlist[0]) < strlen(tempstr)) { // if the clean sanitized one is longer than the current one, use it, it has crap chars which definitely are in there - strlcpy(Nicks_sanlist[0], tempstr, sizeof(Nicks_sanlist[0])); + dp_strlcpy(Nicks_sanlist[0], tempstr, sizeof(Nicks_sanlist[0])); } } @@ -2770,13 +2770,13 @@ void Con_CompleteCommandLine (void) pos++; s = key_line + pos; - strlcpy(s2, key_line + key_linepos, sizeof(s2)); //save chars after cursor + dp_strlcpy(s2, key_line + key_linepos, sizeof(s2)); //save chars after cursor key_line[key_linepos] = 0; //hide them space = strchr(key_line + 1, ' '); if(space && pos == (space - key_line) + 1) { - strlcpy(command, key_line + 1, min(sizeof(command), (unsigned int)(space - key_line))); + dp_strlcpy(command, key_line + 1, min(sizeof(command), (unsigned int)(space - key_line))); patterns = Cvar_VariableString(va(vabuf, sizeof(vabuf), "con_completion_%s", command)); // TODO maybe use a better place for this? if(patterns && !*patterns) @@ -2842,7 +2842,7 @@ void Con_CompleteCommandLine (void) const char *slash = strrchr(s, '/'); if(slash) { - strlcpy(t, s, min(sizeof(t), (unsigned int)(slash - s + 2))); // + 2, because I want to include the slash + dp_strlcpy(t, s, min(sizeof(t), (unsigned int)(slash - s + 2))); // + 2, because I want to include the slash strlcat(t, com_token, sizeof(t)); search = FS_Search(t, true, true); } @@ -2865,7 +2865,7 @@ void Con_CompleteCommandLine (void) const char *slash = strrchr(s, '/'); if(slash) { - strlcpy(t, s, min(sizeof(t), (unsigned int)(slash - s + 2))); // + 2, because I want to include the slash + dp_strlcpy(t, s, min(sizeof(t), (unsigned int)(slash - s + 2))); // + 2, because I want to include the slash strlcat(t, "*", sizeof(t)); search = FS_Search(t, true, true); } @@ -2925,7 +2925,7 @@ void Con_CompleteCommandLine (void) // of resultbuf.strings[0]. We want to append the characters // from resultbuf.strings[0] to (not including) p as these are // the unique prefix - strlcpy(t, (resultbuf.numstrings > 0 ? resultbuf : dirbuf).strings[0], min(matchchars + 1, sizeof(t))); + dp_strlcpy(t, (resultbuf.numstrings > 0 ? resultbuf : dirbuf).strings[0], min(matchchars + 1, sizeof(t))); } // first move the cursor @@ -2977,7 +2977,7 @@ void Con_CompleteCommandLine (void) if (!(c + v + a + n)) // No possible matches { if(s2[0]) - strlcpy(&key_line[key_linepos], s2, sizeof(key_line) - key_linepos); + dp_strlcpy(&key_line[key_linepos], s2, sizeof(key_line) - key_linepos); return; } diff --git a/crypto.c b/crypto.c index 6abaaa22..e36ef9e8 100644 --- a/crypto.c +++ b/crypto.c @@ -724,9 +724,9 @@ qboolean Crypto_RetrieveHostKey(lhnetaddress_t *peeraddress, int *keyid, char *k if(keyid) *keyid = hk->keyid; if(keyfp) - strlcpy(keyfp, pubkeys_fp64[hk->keyid], keyfplen); + dp_strlcpy(keyfp, pubkeys_fp64[hk->keyid], keyfplen); if(idfp) - strlcpy(idfp, hk->idfp, idfplen); + dp_strlcpy(idfp, hk->idfp, idfplen); if(aeslevel) *aeslevel = hk->aeslevel; if(issigned) @@ -745,10 +745,10 @@ int Crypto_RetrieveLocalKey(int keyid, char *keyfp, size_t keyfplen, char *idfp, if(!pubkeys[keyid]) return -1; if(keyfp) - strlcpy(keyfp, pubkeys_fp64[keyid], keyfplen); + dp_strlcpy(keyfp, pubkeys_fp64[keyid], keyfplen); if(idfp) if(pubkeys_havepriv[keyid]) - strlcpy(idfp, pubkeys_priv_fp64[keyid], idfplen); + dp_strlcpy(idfp, pubkeys_priv_fp64[keyid], idfplen); if(issigned) *issigned = pubkeys_havesig[keyid]; return 1; @@ -1831,8 +1831,8 @@ static int Crypto_ServerParsePacket_Internal(const char *data_in, size_t len_in, if(CDATA->s >= 0) { // I am the server, and my key is ok... so let's set server_keyfp and server_idfp - strlcpy(crypto->server_keyfp, pubkeys_fp64[CDATA->s], sizeof(crypto->server_keyfp)); - strlcpy(crypto->server_idfp, pubkeys_priv_fp64[CDATA->s], sizeof(crypto->server_idfp)); + dp_strlcpy(crypto->server_keyfp, pubkeys_fp64[CDATA->s], sizeof(crypto->server_keyfp)); + dp_strlcpy(crypto->server_idfp, pubkeys_priv_fp64[CDATA->s], sizeof(crypto->server_idfp)); crypto->server_issigned = pubkeys_havesig[CDATA->s]; if(!CDATA->id) @@ -1974,7 +1974,7 @@ static int Crypto_ServerParsePacket_Internal(const char *data_in, size_t len_in, CLEAR_CDATA; return Crypto_ServerError(data_out, len_out, "d0_blind_id_authenticate_with_private_id_verify failed (authentication error)", "Authentication error"); } - strlcpy(crypto->client_keyfp, pubkeys_fp64[CDATA->c], sizeof(crypto->client_keyfp)); + dp_strlcpy(crypto->client_keyfp, pubkeys_fp64[CDATA->c], sizeof(crypto->client_keyfp)); crypto->client_issigned = status; memset(crypto->client_idfp, 0, sizeof(crypto->client_idfp)); @@ -2288,7 +2288,7 @@ int Crypto_ClientParsePacket(const char *data_in, size_t len_in, char *data_out, CDATA->s = serverid; CDATA->c = clientid; memset(crypto->dhkey, 0, sizeof(crypto->dhkey)); - strlcpy(CDATA->challenge, challenge, sizeof(CDATA->challenge)); + dp_strlcpy(CDATA->challenge, challenge, sizeof(CDATA->challenge)); crypto->client_keyfp[0] = 0; crypto->client_idfp[0] = 0; crypto->server_keyfp[0] = 0; @@ -2327,8 +2327,8 @@ int Crypto_ClientParsePacket(const char *data_in, size_t len_in, char *data_out, if(clientid >= 0) { // I am the client, and my key is ok... so let's set client_keyfp and client_idfp - strlcpy(crypto->client_keyfp, pubkeys_fp64[CDATA->c], sizeof(crypto->client_keyfp)); - strlcpy(crypto->client_idfp, pubkeys_priv_fp64[CDATA->c], sizeof(crypto->client_idfp)); + dp_strlcpy(crypto->client_keyfp, pubkeys_fp64[CDATA->c], sizeof(crypto->client_keyfp)); + dp_strlcpy(crypto->client_idfp, pubkeys_priv_fp64[CDATA->c], sizeof(crypto->client_idfp)); crypto->client_issigned = pubkeys_havesig[CDATA->c]; } @@ -2463,7 +2463,7 @@ int Crypto_ClientParsePacket(const char *data_in, size_t len_in, char *data_out, return Crypto_ClientError(data_out, len_out, "d0_blind_id_authenticate_with_private_id_verify failed (server authentication error)"); } - strlcpy(crypto->server_keyfp, pubkeys_fp64[CDATA->s], sizeof(crypto->server_keyfp)); + dp_strlcpy(crypto->server_keyfp, pubkeys_fp64[CDATA->s], sizeof(crypto->server_keyfp)); if (!status && CDATA->wantserver_issigned) { CLEAR_CDATA; diff --git a/csprogs.c b/csprogs.c index b1598dda..1fa58a4a 100644 --- a/csprogs.c +++ b/csprogs.c @@ -593,7 +593,7 @@ void CL_VM_Parse_StuffCmd (const char *msg) l = strlen(p); if(l > sizeof(buf) - 1) l = sizeof(buf) - 1; - strlcpy(buf, p, l + 1); // strlcpy needs a + 1 as it includes the newline! + dp_strlcpy(buf, p, l + 1); // dp_strlcpy needs a + 1 as it includes the newline! Cmd_ExecuteString(buf, src_command, true); diff --git a/filematch.c b/filematch.c index 99711676..54846a37 100644 --- a/filematch.c +++ b/filematch.c @@ -168,7 +168,7 @@ void listdirectory(stringlist_t *list, const char *basepath, const char *path) char pattern[4096], *c; WIN32_FIND_DATA n_file; HANDLE hFile; - strlcpy (pattern, basepath, sizeof(pattern)); + dp_strlcpy (pattern, basepath, sizeof(pattern)); strlcat (pattern, path, sizeof (pattern)); strlcat (pattern, "*", sizeof (pattern)); // ask for the directory listing handle diff --git a/fs.c b/fs.c index e682f6fa..6cb7451f 100644 --- a/fs.c +++ b/fs.c @@ -767,7 +767,7 @@ static pack_t *FS_LoadPackPK3FromFD (const char *packfile, int packhandle, qbool // Create a package structure in memory pack = (pack_t *)Mem_Alloc(fs_mempool, sizeof (pack_t)); pack->ignorecase = true; // PK3 ignores case - strlcpy (pack->filename, packfile, sizeof (pack->filename)); + dp_strlcpy (pack->filename, packfile, sizeof (pack->filename)); pack->handle = packhandle; pack->numfiles = eocd.nbentries; pack->files = (packfile_t *)Mem_Alloc(fs_mempool, eocd.nbentries * sizeof(packfile_t)); @@ -883,7 +883,7 @@ static packfile_t* FS_AddFileToPack (const char* name, pack_t* pack, memmove (pfile + 1, pfile, (pack->numfiles - left) * sizeof (*pfile)); pack->numfiles++; - strlcpy (pfile->name, name, sizeof (pfile->name)); + dp_strlcpy (pfile->name, name, sizeof (pfile->name)); pfile->offset = offset; pfile->packsize = packsize; pfile->realsize = realsize; @@ -1026,7 +1026,7 @@ static pack_t *FS_LoadPackPAK (const char *packfile) pack = (pack_t *)Mem_Alloc(fs_mempool, sizeof (pack_t)); pack->ignorecase = true; // PAK is sensitive in Quake1 but insensitive in Quake2 - strlcpy (pack->filename, packfile, sizeof (pack->filename)); + dp_strlcpy (pack->filename, packfile, sizeof (pack->filename)); pack->handle = packhandle; pack->numfiles = 0; pack->files = (packfile_t *)Mem_Alloc(fs_mempool, numpackfiles * sizeof(packfile_t)); @@ -1062,7 +1062,7 @@ static pack_t *FS_LoadPackVirtual (const char *dirname) pack = (pack_t *)Mem_Alloc(fs_mempool, sizeof (pack_t)); pack->vpack = true; pack->ignorecase = false; - strlcpy (pack->filename, dirname, sizeof(pack->filename)); + dp_strlcpy (pack->filename, dirname, sizeof(pack->filename)); pack->handle = -1; pack->numfiles = -1; pack->files = NULL; @@ -1118,7 +1118,7 @@ static qboolean FS_AddPack_Fullpath(const char *pakfile, const char *shortname, if(pak) { - strlcpy(pak->shortname, shortname, sizeof(pak->shortname)); + dp_strlcpy(pak->shortname, shortname, sizeof(pak->shortname)); //Con_DPrintf(" Registered pack with short name %s\n", shortname); if(keep_plain_dirs) @@ -1236,7 +1236,7 @@ static void FS_AddGameDirectory (const char *dir) stringlist_t list; searchpath_t *search; - strlcpy (fs_gamedir, dir, sizeof (fs_gamedir)); + dp_strlcpy (fs_gamedir, dir, sizeof (fs_gamedir)); stringlistinit(&list); listdirectory(&list, "", dir); @@ -1265,7 +1265,7 @@ static void FS_AddGameDirectory (const char *dir) // Add the directory to the search path // (unpacked files have the priority over packed files) search = (searchpath_t *)Mem_Alloc(fs_mempool, sizeof(searchpath_t)); - strlcpy (search->filename, dir, sizeof (search->filename)); + dp_strlcpy (search->filename, dir, sizeof (search->filename)); search->next = fs_searchpaths; fs_searchpaths = search; } @@ -1401,9 +1401,9 @@ void FS_Rescan (void) FS_AddGameHierarchy (gamedirname1); // update the com_modname (used for server info) if (gamedirname2 && gamedirname2[0]) - strlcpy(com_modname, gamedirname2, sizeof(com_modname)); + dp_strlcpy(com_modname, gamedirname2, sizeof(com_modname)); else - strlcpy(com_modname, gamedirname1, sizeof(com_modname)); + dp_strlcpy(com_modname, gamedirname1, sizeof(com_modname)); // add the game-specific path, if any // (only used for mission packs and the like, which should set fs_modified) @@ -1423,11 +1423,11 @@ void FS_Rescan (void) fs_modified = true; FS_AddGameHierarchy (fs_gamedirs[i]); // update the com_modname (used server info) - strlcpy (com_modname, fs_gamedirs[i], sizeof (com_modname)); + dp_strlcpy (com_modname, fs_gamedirs[i], sizeof (com_modname)); if(i) strlcat(gamedirbuf, va(vabuf, sizeof(vabuf), " %s", fs_gamedirs[i]), sizeof(gamedirbuf)); else - strlcpy(gamedirbuf, fs_gamedirs[i], sizeof(gamedirbuf)); + dp_strlcpy(gamedirbuf, fs_gamedirs[i], sizeof(gamedirbuf)); } Cvar_SetQuick(&cvar_fs_gamedir, gamedirbuf); // so QC or console code can query it @@ -1442,7 +1442,7 @@ void FS_Rescan (void) Cvar_SetQuick (&scr_screenshot_name, gamescreenshotname); if((i = COM_CheckParm("-modname")) && i < com_argc - 1) - strlcpy(com_modname, com_argv[i+1], sizeof(com_modname)); + dp_strlcpy(com_modname, com_argv[i+1], sizeof(com_modname)); // If "-condebug" is in the command line, remove the previous log file if (COM_CheckParm ("-condebug") != 0) @@ -1534,7 +1534,7 @@ qboolean FS_ChangeGameDirs(int numgamedirs, char gamedirs[][MAX_QPATH], qboolean fs_numgamedirs = numgamedirs; for (i = 0;i < fs_numgamedirs;i++) - strlcpy(fs_gamedirs[i], gamedirs[i], sizeof(fs_gamedirs[i])); + dp_strlcpy(fs_gamedirs[i], gamedirs[i], sizeof(fs_gamedirs[i])); // reinitialize filesystem to detect the new paks FS_Rescan(); @@ -1586,7 +1586,7 @@ static void FS_GameDir_f (void) } for (i = 0;i < numgamedirs;i++) - strlcpy(gamedirs[i], Cmd_Argv(i+1), sizeof(gamedirs[i])); + dp_strlcpy(gamedirs[i], Cmd_Argv(i+1), sizeof(gamedirs[i])); if ((cls.state == ca_connected && !cls.demoplayback) || sv.active) { @@ -1713,8 +1713,8 @@ static void FS_ListGameDirs(void) continue; if(!*info) continue; - strlcpy(fs_all_gamedirs[fs_all_gamedirs_count].name, list2.strings[i], sizeof(fs_all_gamedirs[fs_all_gamedirs_count].name)); - strlcpy(fs_all_gamedirs[fs_all_gamedirs_count].description, info, sizeof(fs_all_gamedirs[fs_all_gamedirs_count].description)); + dp_strlcpy(fs_all_gamedirs[fs_all_gamedirs_count].name, list2.strings[i], sizeof(fs_all_gamedirs[fs_all_gamedirs_count].name)); + dp_strlcpy(fs_all_gamedirs[fs_all_gamedirs_count].description, info, sizeof(fs_all_gamedirs[fs_all_gamedirs_count].description)); ++fs_all_gamedirs_count; } } @@ -1766,7 +1766,7 @@ void FS_Init_SelfPack (void) if(i >= args_left) break; q = (char *)Mem_Alloc(fs_mempool, sz); - strlcpy(q, com_token, sz); + dp_strlcpy(q, com_token, sz); new_argv[com_argc + i] = q; ++i; } @@ -1786,7 +1786,7 @@ static int FS_ChooseUserDir(userdirmode_t userdirmode, char *userdir, size_t use { // fs_basedir is "" by default, to utilize this you can simply add your gamedir to the Resources in xcode // fs_userdir stores configurations to the Documents folder of the app - strlcpy(userdir, "../Documents/", MAX_OSPATH); + dp_strlcpy(userdir, "../Documents/", MAX_OSPATH); return 1; } return -1; @@ -1808,7 +1808,7 @@ static int FS_ChooseUserDir(userdirmode_t userdirmode, char *userdir, size_t use default: return -1; case USERDIRMODE_NOHOME: - strlcpy(userdir, fs_basedir, userdirsize); + dp_strlcpy(userdir, fs_basedir, userdirsize); break; case USERDIRMODE_MYGAMES: if (!shfolder_dll) @@ -1881,7 +1881,7 @@ static int FS_ChooseUserDir(userdirmode_t userdirmode, char *userdir, size_t use default: return -1; case USERDIRMODE_NOHOME: - strlcpy(userdir, fs_basedir, userdirsize); + dp_strlcpy(userdir, fs_basedir, userdirsize); break; case USERDIRMODE_HOME: homedir = getenv("HOME"); @@ -1970,7 +1970,7 @@ void FS_Init (void) i = COM_CheckParm ("-basedir"); if (i && i < com_argc-1) { - strlcpy (fs_basedir, com_argv[i+1], sizeof (fs_basedir)); + dp_strlcpy (fs_basedir, com_argv[i+1], sizeof (fs_basedir)); i = (int)strlen (fs_basedir); if (i > 0 && (fs_basedir[i-1] == '\\' || fs_basedir[i-1] == '/')) fs_basedir[i-1] = 0; @@ -1979,7 +1979,7 @@ void FS_Init (void) { // If the base directory is explicitly defined by the compilation process #ifdef DP_FS_BASEDIR - strlcpy(fs_basedir, DP_FS_BASEDIR, sizeof(fs_basedir)); + dp_strlcpy(fs_basedir, DP_FS_BASEDIR, sizeof(fs_basedir)); #elif defined(__ANDROID__) dpsnprintf(fs_basedir, sizeof(fs_basedir), "/sdcard/%s/", gameuserdirname); #elif defined(MACOSX) @@ -1987,7 +1987,7 @@ void FS_Init (void) if (strstr(com_argv[0], ".app/")) { char *split; - strlcpy(fs_basedir, com_argv[0], sizeof(fs_basedir)); + dp_strlcpy(fs_basedir, com_argv[0], sizeof(fs_basedir)); split = strstr(fs_basedir, ".app/"); if (split) { @@ -2102,7 +2102,7 @@ void FS_Init (void) if(p == fs_checkgamedir_missing) Con_Printf("WARNING: -game %s%s/ not found!\n", fs_basedir, com_argv[i]); // add the gamedir to the list of active gamedirs - strlcpy (fs_gamedirs[fs_numgamedirs], com_argv[i], sizeof(fs_gamedirs[fs_numgamedirs])); + dp_strlcpy (fs_gamedirs[fs_numgamedirs], com_argv[i], sizeof(fs_gamedirs[fs_numgamedirs])); fs_numgamedirs++; } } @@ -3497,7 +3497,7 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet) pak = searchpath->pack; for (i = 0;i < pak->numfiles;i++) { - strlcpy(temp, pak->files[i].name, sizeof(temp)); + dp_strlcpy(temp, pak->files[i].name, sizeof(temp)); while (temp[0]) { if (matchpattern(temp, (char *)pattern, true)) @@ -3567,7 +3567,7 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet) // prevseparator points past the '/' right before the wildcard and nextseparator at the one following it (or at the end of the string) // copy everything up except nextseperator - strlcpy(subpattern, pattern, min(sizeof(subpattern), (size_t) (nextseparator - pattern + 1))); + dp_strlcpy(subpattern, pattern, min(sizeof(subpattern), (size_t) (nextseparator - pattern + 1))); // find the last '/' before the wildcard prevseparator = strrchr( subpattern, '/' ); if (!prevseparator) @@ -3576,11 +3576,11 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet) prevseparator++; // copy everything from start to the previous including the '/' (before the wildcard) // everything up to start is already included in the path of matchedSet's entries - strlcpy(subpath, start, min(sizeof(subpath), (size_t) ((prevseparator - subpattern) - (start - pattern) + 1))); + dp_strlcpy(subpath, start, min(sizeof(subpath), (size_t) ((prevseparator - subpattern) - (start - pattern) + 1))); // for each entry in matchedSet try to open the subdirectories specified in subpath for( dirlistindex = 0 ; dirlistindex < matchedSet.numstrings ; dirlistindex++ ) { - strlcpy( temp, matchedSet.strings[ dirlistindex ], sizeof(temp) ); + dp_strlcpy( temp, matchedSet.strings[ dirlistindex ], sizeof(temp) ); strlcat( temp, subpath, sizeof(temp) ); listdirectory( &foundSet, searchpath->filename, temp ); } diff --git a/ft2.c b/ft2.c index bc9544f2..af7d858e 100644 --- a/ft2.c +++ b/ft2.c @@ -268,7 +268,7 @@ static const unsigned char *fontfilecache_LoadFile(const char *path, qboolean qu for(i = 0; i < MAX_FONTFILES; ++i) if(fontfiles[i].refcount <= 0) { - strlcpy(fontfiles[i].path, path, sizeof(fontfiles[i].path)); + dp_strlcpy(fontfiles[i].path, path, sizeof(fontfiles[i].path)); fontfiles[i].len = *filesizepointer; fontfiles[i].buf = buf; fontfiles[i].refcount = 1; @@ -526,7 +526,7 @@ qboolean Font_LoadFont(const char *name, dp_font_t *dpfnt) Mem_Free(ft2); return false; } - strlcpy(ft2->name, name, sizeof(ft2->name)); + dp_strlcpy(ft2->name, name, sizeof(ft2->name)); ft2->image_font = true; ft2->has_kerning = false; } @@ -703,7 +703,7 @@ static qboolean Font_LoadFile(const char *name, int _face, ft2_settings_t *setti Con_Printf("Failed to add attachment %u to %s\n", (unsigned)i, font->name); } - strlcpy(font->name, name, sizeof(font->name)); + dp_strlcpy(font->name, name, sizeof(font->name)); font->image_font = false; font->has_kerning = !!(((FT_Face)(font->face))->face_flags & FT_FACE_FLAG_KERNING); return true; diff --git a/gl_backend.c b/gl_backend.c index b1ac3ff2..8a12f7e3 100644 --- a/gl_backend.c +++ b/gl_backend.c @@ -3333,7 +3333,7 @@ r_meshbuffer_t *R_Mesh_CreateMeshBuffer(const void *data, size_t size, const cha buffer->isuniformbuffer = isuniformbuffer; buffer->isdynamic = isdynamic; buffer->isindex16 = isindex16; - strlcpy(buffer->name, name, sizeof(buffer->name)); + dp_strlcpy(buffer->name, name, sizeof(buffer->name)); R_Mesh_UpdateMeshBuffer(buffer, data, size, false, 0); return buffer; } diff --git a/gl_draw.c b/gl_draw.c index 0f0c3670..d256063b 100644 --- a/gl_draw.c +++ b/gl_draw.c @@ -369,7 +369,7 @@ cachepic_t *Draw_CachePic_Flags(const char *path, unsigned int cachepicflags) } pic = cachepics + (numcachepics++); memset(pic, 0, sizeof(*pic)); - strlcpy (pic->name, path, sizeof(pic->name)); + dp_strlcpy (pic->name, path, sizeof(pic->name)); // link into list pic->chain = cachepichash[hashkey]; cachepichash[hashkey] = pic; @@ -598,7 +598,7 @@ cachepic_t *Draw_NewPic(const char *picname, int width, int height, int alpha, u } pic = cachepics + (numcachepics++); memset(pic, 0, sizeof(*pic)); - strlcpy (pic->name, picname, sizeof(pic->name)); + dp_strlcpy (pic->name, picname, sizeof(pic->name)); // link into list pic->chain = cachepichash[hashkey]; cachepichash[hashkey] = pic; @@ -646,7 +646,7 @@ void LoadFont(qboolean override, const char *name, dp_font_t *fnt, float scale, if(override || !fnt->texpath[0]) { - strlcpy(fnt->texpath, name, sizeof(fnt->texpath)); + dp_strlcpy(fnt->texpath, name, sizeof(fnt->texpath)); // load the cvars when the font is FIRST loader fnt->settings.scale = scale; fnt->settings.voffset = voffset; @@ -693,7 +693,7 @@ void LoadFont(qboolean override, const char *name, dp_font_t *fnt, float scale, if(fnt->tex == r_texture_notexture) { fnt->tex = Draw_CachePic_Flags("gfx/conchars", CACHEPICFLAG_NOCOMPRESSION | (r_nearest_conchars.integer ? CACHEPICFLAG_NEAREST : 0))->tex; - strlcpy(widthfile, "gfx/conchars.width", sizeof(widthfile)); + dp_strlcpy(widthfile, "gfx/conchars.width", sizeof(widthfile)); } else dpsnprintf(widthfile, sizeof(widthfile), "%s.width", fnt->fallbacks[i]); @@ -802,7 +802,7 @@ dp_font_t *FindFont(const char *title, qboolean allocate_new) { if(!strcmp(dp_fonts.f[i].title, "")) { - strlcpy(dp_fonts.f[i].title, title, sizeof(dp_fonts.f[i].title)); + dp_strlcpy(dp_fonts.f[i].title, title, sizeof(dp_fonts.f[i].title)); return &dp_fonts.f[i]; } } @@ -817,7 +817,7 @@ dp_font_t *FindFont(const char *title, qboolean allocate_new) if (dp_fonts.f[i].ft2) dp_fonts.f[i].ft2->settings = &dp_fonts.f[i].settings; // register a font in first expanded slot - strlcpy(dp_fonts.f[oldsize].title, title, sizeof(dp_fonts.f[oldsize].title)); + dp_strlcpy(dp_fonts.f[oldsize].title, title, sizeof(dp_fonts.f[oldsize].title)); return &dp_fonts.f[oldsize]; } return NULL; @@ -904,7 +904,7 @@ static void LoadFont_f(void) } if(!c || (c - filelist) > MAX_QPATH) - strlcpy(mainfont, filelist, sizeof(mainfont)); + dp_strlcpy(mainfont, filelist, sizeof(mainfont)); else { memcpy(mainfont, filelist, c - filelist); @@ -930,7 +930,7 @@ static void LoadFont_f(void) } if(!c || (c-filelist) > MAX_QPATH) { - strlcpy(f->fallbacks[i], filelist, sizeof(mainfont)); + dp_strlcpy(f->fallbacks[i], filelist, sizeof(mainfont)); } else { @@ -1060,15 +1060,15 @@ void GL_Draw_Init (void) memset(dp_fonts.f, 0, sizeof(dp_font_t) * dp_fonts.maxsize); // assign starting font names - strlcpy(FONT_DEFAULT->title, "default", sizeof(FONT_DEFAULT->title)); - strlcpy(FONT_DEFAULT->texpath, "gfx/conchars", sizeof(FONT_DEFAULT->texpath)); - strlcpy(FONT_CONSOLE->title, "console", sizeof(FONT_CONSOLE->title)); - strlcpy(FONT_SBAR->title, "sbar", sizeof(FONT_SBAR->title)); - strlcpy(FONT_NOTIFY->title, "notify", sizeof(FONT_NOTIFY->title)); - strlcpy(FONT_CHAT->title, "chat", sizeof(FONT_CHAT->title)); - strlcpy(FONT_CENTERPRINT->title, "centerprint", sizeof(FONT_CENTERPRINT->title)); - strlcpy(FONT_INFOBAR->title, "infobar", sizeof(FONT_INFOBAR->title)); - strlcpy(FONT_MENU->title, "menu", sizeof(FONT_MENU->title)); + dp_strlcpy(FONT_DEFAULT->title, "default", sizeof(FONT_DEFAULT->title)); + dp_strlcpy(FONT_DEFAULT->texpath, "gfx/conchars", sizeof(FONT_DEFAULT->texpath)); + dp_strlcpy(FONT_CONSOLE->title, "console", sizeof(FONT_CONSOLE->title)); + dp_strlcpy(FONT_SBAR->title, "sbar", sizeof(FONT_SBAR->title)); + dp_strlcpy(FONT_NOTIFY->title, "notify", sizeof(FONT_NOTIFY->title)); + dp_strlcpy(FONT_CHAT->title, "chat", sizeof(FONT_CHAT->title)); + dp_strlcpy(FONT_CENTERPRINT->title, "centerprint", sizeof(FONT_CENTERPRINT->title)); + dp_strlcpy(FONT_INFOBAR->title, "infobar", sizeof(FONT_INFOBAR->title)); + dp_strlcpy(FONT_MENU->title, "menu", sizeof(FONT_MENU->title)); for(i = 0, j = 0; i < MAX_USERFONTS; ++i) if(!FONT_USER(i)->title[0]) dpsnprintf(FONT_USER(i)->title, sizeof(FONT_USER(i)->title), "user%d", j++); diff --git a/gl_rmain.c b/gl_rmain.c index 3d9686e0..ddb9f443 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -554,7 +554,7 @@ static void R_BuildFogHeightTexture(void) float c[4]; float f; inpixels = NULL; - strlcpy(r_refdef.fogheighttexturename, r_refdef.fog_height_texturename, sizeof(r_refdef.fogheighttexturename)); + dp_strlcpy(r_refdef.fogheighttexturename, r_refdef.fog_height_texturename, sizeof(r_refdef.fogheighttexturename)); if (r_refdef.fogheighttexturename[0]) inpixels = loadimagepixelsbgra(r_refdef.fogheighttexturename, true, false, false, NULL); if (!inpixels) @@ -1641,7 +1641,7 @@ static void R_HLSL_CacheShader(r_hlsl_permutation_t *p, const char *cachename, c } if (vslog) { - strlcpy(temp, (const char *)ID3DXBuffer_GetBufferPointer(vslog), min(sizeof(temp), ID3DXBuffer_GetBufferSize(vslog))); + dp_strlcpy(temp, (const char *)ID3DXBuffer_GetBufferPointer(vslog), min(sizeof(temp), ID3DXBuffer_GetBufferSize(vslog))); Con_DPrintf("HLSL vertex shader compile output for %s follows:\n%s\n", cachename, temp); ID3DXBuffer_Release(vslog); } @@ -1664,7 +1664,7 @@ static void R_HLSL_CacheShader(r_hlsl_permutation_t *p, const char *cachename, c } if (pslog) { - strlcpy(temp, (const char *)ID3DXBuffer_GetBufferPointer(pslog), min(sizeof(temp), ID3DXBuffer_GetBufferSize(pslog))); + dp_strlcpy(temp, (const char *)ID3DXBuffer_GetBufferPointer(pslog), min(sizeof(temp), ID3DXBuffer_GetBufferSize(pslog))); Con_DPrintf("HLSL pixel shader compile output for %s follows:\n%s\n", cachename, temp); ID3DXBuffer_Release(pslog); } @@ -3266,7 +3266,7 @@ skinframe_t *R_SkinFrame_Find(const char *name, int textureflags, int comparewid return NULL; item = (skinframe_t *)Mem_ExpandableArray_AllocRecord(&r_skinframe.array); memset(item, 0, sizeof(*item)); - strlcpy(item->basename, basename, sizeof(item->basename)); + dp_strlcpy(item->basename, basename, sizeof(item->basename)); item->base = dyntexture; // either NULL or dyntexture handle item->textureflags = textureflags & ~TEXF_FORCE_RELOAD; item->comparewidth = comparewidth; @@ -3959,7 +3959,7 @@ rtexture_t *R_GetCubemap(const char *basename) return r_texture_whitecube; r_texture_numcubemaps++; r_texture_cubemaps[i] = (cubemapinfo_t *)Mem_Alloc(r_main_mempool, sizeof(cubemapinfo_t)); - strlcpy(r_texture_cubemaps[i]->basename, basename, sizeof(r_texture_cubemaps[i]->basename)); + dp_strlcpy(r_texture_cubemaps[i]->basename, basename, sizeof(r_texture_cubemaps[i]->basename)); r_texture_cubemaps[i]->texture = R_LoadCubemap(r_texture_cubemaps[i]->basename); return r_texture_cubemaps[i]->texture; } @@ -8104,7 +8104,7 @@ static void R_LoadQWSkin(r_qwskincache_t *cache, const char *skinname) char name[MAX_QPATH]; skinframe_t *skinframe; unsigned char pixels[296*194]; - strlcpy(cache->name, skinname, sizeof(cache->name)); + dp_strlcpy(cache->name, skinname, sizeof(cache->name)); dpsnprintf(name, sizeof(name), "skins/%s.pcx", cache->name); if (developer_loading.integer) Con_Printf("loading %s\n", name); diff --git a/gl_textures.c b/gl_textures.c index ded21684..db6e47ec 100644 --- a/gl_textures.c +++ b/gl_textures.c @@ -1779,7 +1779,7 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden glt = (gltexture_t *)Mem_ExpandableArray_AllocRecord(&texturearray); if (identifier) - strlcpy (glt->identifier, identifier, sizeof(glt->identifier)); + dp_strlcpy (glt->identifier, identifier, sizeof(glt->identifier)); glt->pool = pool; glt->chain = pool->gltchain; pool->gltchain = glt; @@ -1951,7 +1951,7 @@ rtexture_t *R_LoadTextureRenderBuffer(rtexturepool_t *rtexturepool, const char * glt = (gltexture_t *)Mem_ExpandableArray_AllocRecord(&texturearray); if (identifier) - strlcpy (glt->identifier, identifier, sizeof(glt->identifier)); + dp_strlcpy (glt->identifier, identifier, sizeof(glt->identifier)); glt->pool = pool; glt->chain = pool->gltchain; pool->gltchain = glt; @@ -2313,7 +2313,7 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen texinfo = R_GetTexTypeInfo(textype, flags); - strlcpy (glt->identifier, vabuf, sizeof(glt->identifier)); + dp_strlcpy (glt->identifier, vabuf, sizeof(glt->identifier)); glt->pool = pool; glt->chain = pool->gltchain; pool->gltchain = glt; @@ -2799,7 +2799,7 @@ rtexture_t *R_LoadTextureDDSFile(rtexturepool_t *rtexturepool, const char *filen texinfo = R_GetTexTypeInfo(textype, flags); glt = (gltexture_t *)Mem_ExpandableArray_AllocRecord(&texturearray); - strlcpy (glt->identifier, filename, sizeof(glt->identifier)); + dp_strlcpy (glt->identifier, filename, sizeof(glt->identifier)); glt->pool = pool; glt->chain = pool->gltchain; pool->gltchain = glt; diff --git a/host.c b/host.c index 7e7bc56a..a1bc33ec 100644 --- a/host.c +++ b/host.c @@ -141,7 +141,7 @@ void Host_Error (const char *error, ...) Sys_Error ("Host_Error: recursively entered (original error was: %s new error is: %s)", hosterrorstring2, hosterrorstring1); hosterror = true; - strlcpy(hosterrorstring2, hosterrorstring1, sizeof(hosterrorstring2)); + dp_strlcpy(hosterrorstring2, hosterrorstring1, sizeof(hosterrorstring2)); CL_Parse_DumpPacket(); diff --git a/host_cmd.c b/host_cmd.c index 10012cc9..12f0577f 100644 --- a/host_cmd.c +++ b/host_cmd.c @@ -150,9 +150,9 @@ static void Host_Status_f (void) } if(sv_status_privacy.integer && cmd_source != src_command) - strlcpy(ip, client->netconnection ? "hidden" : "botclient", 48); + dp_strlcpy(ip, client->netconnection ? "hidden" : "botclient", 48); else - strlcpy(ip, (client->netconnection && client->netconnection->address) ? client->netconnection->address : "botclient", 48); + dp_strlcpy(ip, (client->netconnection && client->netconnection->address) ? client->netconnection->address : "botclient", 48); frags = client->frags; @@ -389,7 +389,7 @@ static void Host_Map_f (void) svs.serverflags = 0; // haven't completed an episode yet allowcheats = sv_cheats.integer != 0; - strlcpy(level, Cmd_Argv(1), sizeof(level)); + dp_strlcpy(level, Cmd_Argv(1), sizeof(level)); SV_SpawnServer(level); if (sv.active && cls.state == ca_disconnected) CL_EstablishConnection("local:1", -2); @@ -426,7 +426,7 @@ static void Host_Changelevel_f (void) SV_SaveSpawnparms (); allowcheats = sv_cheats.integer != 0; - strlcpy(level, Cmd_Argv(1), sizeof(level)); + dp_strlcpy(level, Cmd_Argv(1), sizeof(level)); SV_SpawnServer(level); if (sv.active && cls.state == ca_disconnected) CL_EstablishConnection("local:1", -2); @@ -462,7 +462,7 @@ static void Host_Restart_f (void) key_dest = key_game; allowcheats = sv_cheats.integer != 0; - strlcpy(mapname, sv.name, sizeof(mapname)); + dp_strlcpy(mapname, sv.name, sizeof(mapname)); SV_SpawnServer(mapname); if (sv.active && cls.state == ca_disconnected) CL_EstablishConnection("local:1", -2); @@ -749,7 +749,7 @@ static void Host_Savegame_f (void) return; } - strlcpy (name, Cmd_Argv(1), sizeof (name)); + dp_strlcpy (name, Cmd_Argv(1), sizeof (name)); FS_DefaultExtension (name, ".sav", sizeof (name)); Host_Savegame_to(prog, name); @@ -785,7 +785,7 @@ static void Host_Loadgame_f (void) return; } - strlcpy (filename, Cmd_Argv(1), sizeof(filename)); + dp_strlcpy (filename, Cmd_Argv(1), sizeof(filename)); FS_DefaultExtension (filename, ".sav", sizeof (filename)); Con_Printf("Loading game from %s...\n", filename); @@ -845,7 +845,7 @@ static void Host_Loadgame_f (void) // mapname COM_ParseToken_Simple(&t, false, false, true); - strlcpy (mapname, com_token, sizeof(mapname)); + dp_strlcpy (mapname, com_token, sizeof(mapname)); if(developer_entityparsing.integer) Con_Printf("Host_Loadgame_f: loading time\n"); @@ -889,7 +889,7 @@ static void Host_Loadgame_f (void) t = start; break; } - strlcpy(sv.lightstyles[i], com_token, sizeof(sv.lightstyles[i])); + dp_strlcpy(sv.lightstyles[i], com_token, sizeof(sv.lightstyles[i])); } if(developer_entityparsing.integer) @@ -1008,7 +1008,7 @@ static void Host_Loadgame_f (void) i = atoi(com_token); COM_ParseToken_Simple(&t, false, false, true); if (i >= 0 && i < MAX_LIGHTSTYLES) - strlcpy(sv.lightstyles[i], com_token, sizeof(sv.lightstyles[i])); + dp_strlcpy(sv.lightstyles[i], com_token, sizeof(sv.lightstyles[i])); else Con_Printf("unsupported lightstyle %i \"%s\"\n", i, com_token); } @@ -1019,7 +1019,7 @@ static void Host_Loadgame_f (void) COM_ParseToken_Simple(&t, false, false, true); if (i >= 0 && i < MAX_MODELS) { - strlcpy(sv.model_precache[i], com_token, sizeof(sv.model_precache[i])); + dp_strlcpy(sv.model_precache[i], com_token, sizeof(sv.model_precache[i])); sv.models[i] = Mod_ForName (sv.model_precache[i], true, false, sv.model_precache[i][0] == '*' ? sv.worldname : NULL); } else @@ -1031,7 +1031,7 @@ static void Host_Loadgame_f (void) i = atoi(com_token); COM_ParseToken_Simple(&t, false, false, true); if (i >= 0 && i < MAX_SOUNDS) - strlcpy(sv.sound_precache[i], com_token, sizeof(sv.sound_precache[i])); + dp_strlcpy(sv.sound_precache[i], com_token, sizeof(sv.sound_precache[i])); else Con_Printf("unsupported sound %i \"%s\"\n", i, com_token); } @@ -1134,7 +1134,7 @@ static void Host_Name_f (void) else newNameSource = Cmd_Args(); - strlcpy(newName, newNameSource, sizeof(newName)); + dp_strlcpy(newName, newNameSource, sizeof(newName)); if (cmd_source == src_command) { @@ -1156,7 +1156,7 @@ static void Host_Name_f (void) host_client->nametime = realtime + max(0.0f, sv_namechangetimer.value); // point the string back at updateclient->name to keep it safe - strlcpy (host_client->name, newName, sizeof (host_client->name)); + dp_strlcpy (host_client->name, newName, sizeof (host_client->name)); for (i = 0, j = 0;host_client->name[i];i++) if (host_client->name[i] != '\r' && host_client->name[i] != '\n') @@ -1228,7 +1228,7 @@ static void Host_Name_f (void) { if (host_client->begun) SV_BroadcastPrintf("%s ^7changed name to %s\n", host_client->old_name, host_client->name); - strlcpy(host_client->old_name, host_client->name, sizeof(host_client->old_name)); + dp_strlcpy(host_client->old_name, host_client->name, sizeof(host_client->old_name)); // send notification to all clients MSG_WriteByte (&sv.reliable_datagram, svc_updatename); MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients); @@ -1260,9 +1260,9 @@ static void Host_Playermodel_f (void) } if (Cmd_Argc () == 2) - strlcpy (newPath, Cmd_Argv(1), sizeof (newPath)); + dp_strlcpy (newPath, Cmd_Argv(1), sizeof (newPath)); else - strlcpy (newPath, Cmd_Args(), sizeof (newPath)); + dp_strlcpy (newPath, Cmd_Args(), sizeof (newPath)); for (i = 0, j = 0;newPath[i];i++) if (newPath[i] != '\r' && newPath[i] != '\n') @@ -1286,11 +1286,11 @@ static void Host_Playermodel_f (void) */ // point the string back at updateclient->name to keep it safe - strlcpy (host_client->playermodel, newPath, sizeof (host_client->playermodel)); + dp_strlcpy (host_client->playermodel, newPath, sizeof (host_client->playermodel)); PRVM_serveredictstring(host_client->edict, playermodel) = PRVM_SetEngineString(prog, host_client->playermodel); if (strcmp(host_client->old_model, host_client->playermodel)) { - strlcpy(host_client->old_model, host_client->playermodel, sizeof(host_client->old_model)); + dp_strlcpy(host_client->old_model, host_client->playermodel, sizeof(host_client->old_model)); /*// send notification to all clients MSG_WriteByte (&sv.reliable_datagram, svc_updatepmodel); MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients); @@ -1320,9 +1320,9 @@ static void Host_Playerskin_f (void) } if (Cmd_Argc () == 2) - strlcpy (newPath, Cmd_Argv(1), sizeof (newPath)); + dp_strlcpy (newPath, Cmd_Argv(1), sizeof (newPath)); else - strlcpy (newPath, Cmd_Args(), sizeof (newPath)); + dp_strlcpy (newPath, Cmd_Args(), sizeof (newPath)); for (i = 0, j = 0;newPath[i];i++) if (newPath[i] != '\r' && newPath[i] != '\n') @@ -1346,13 +1346,13 @@ static void Host_Playerskin_f (void) */ // point the string back at updateclient->name to keep it safe - strlcpy (host_client->playerskin, newPath, sizeof (host_client->playerskin)); + dp_strlcpy (host_client->playerskin, newPath, sizeof (host_client->playerskin)); PRVM_serveredictstring(host_client->edict, playerskin) = PRVM_SetEngineString(prog, host_client->playerskin); if (strcmp(host_client->old_skin, host_client->playerskin)) { //if (host_client->begun) // SV_BroadcastPrintf("%s changed skin to %s\n", host_client->name, host_client->playerskin); - strlcpy(host_client->old_skin, host_client->playerskin, sizeof(host_client->old_skin)); + dp_strlcpy(host_client->old_skin, host_client->playerskin, sizeof(host_client->old_skin)); /*// send notification to all clients MSG_WriteByte (&sv.reliable_datagram, svc_updatepskin); MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients); @@ -2427,7 +2427,7 @@ static void Host_Startdemos_f (void) Con_DPrintf("%i demo(s) in loop\n", c); for (i=1 ; i= MAX_RCONS) NetConn_WriteString(mysocket, "\377\377\377\377getchallenge", &to); // otherwise we'll request the challenge later - strlcpy(cls.rcon_commands[cls.rcon_ringpos], Cmd_Args(), sizeof(cls.rcon_commands[cls.rcon_ringpos])); + dp_strlcpy(cls.rcon_commands[cls.rcon_ringpos], Cmd_Args(), sizeof(cls.rcon_commands[cls.rcon_ringpos])); cls.rcon_addresses[cls.rcon_ringpos] = to; cls.rcon_timeout[cls.rcon_ringpos] = realtime + rcon_secure_challengetimeout.value; cls.rcon_ringpos = (cls.rcon_ringpos + 1) % MAX_RCONS; @@ -2684,7 +2684,7 @@ static void Host_Rcon_f (void) // credit: taken from QuakeWorld if(HMAC_MDFOUR_16BYTES((unsigned char *) (buf + 24), (unsigned char *) argbuf, (int)strlen(argbuf), (unsigned char *) rcon_password.string, n)) { buf[40] = ' '; - strlcpy(buf + 41, argbuf, sizeof(buf) - 41); + dp_strlcpy(buf + 41, argbuf, sizeof(buf) - 41); NetConn_Write(mysocket, buf, 41 + (int)strlen(buf + 41), &to); } } @@ -2774,7 +2774,7 @@ static void Host_FullServerinfo_f (void) // credit: taken from QuakeWorld return; } - strlcpy (cl.qw_serverinfo, Cmd_Argv(1), sizeof(cl.qw_serverinfo)); + dp_strlcpy (cl.qw_serverinfo, Cmd_Argv(1), sizeof(cl.qw_serverinfo)); InfoString_GetValue(cl.qw_serverinfo, "teamplay", temp, sizeof(temp)); cl.qw_teamplay = atoi(temp); } @@ -2808,7 +2808,7 @@ static void Host_FullInfo_f (void) // credit: taken from QuakeWorld if (len >= sizeof(key)) { len = sizeof(key) - 1; } - strlcpy(key, s, len + 1); + dp_strlcpy(key, s, len + 1); s += len; if (!*s) { @@ -2821,7 +2821,7 @@ static void Host_FullInfo_f (void) // credit: taken from QuakeWorld if (len >= sizeof(value)) { len = sizeof(value) - 1; } - strlcpy(value, s, len + 1); + dp_strlcpy(value, s, len + 1); CL_SetInfo(key, value, false, false, false, false); diff --git a/image.c b/image.c index d72ceca7..bcd749ce 100644 --- a/image.c +++ b/image.c @@ -832,7 +832,7 @@ void Image_StripImageExtension (const char *in, char *out, size_t size_out) if (ext && (!strcmp(ext, "tga") || !strcmp(ext, "pcx") || !strcmp(ext, "lmp") || !strcmp(ext, "png") || !strcmp(ext, "jpg") || !strcmp(ext, "wal"))) FS_StripExtension(in, out, size_out); else - strlcpy(out, in, size_out); + dp_strlcpy(out, in, size_out); } static unsigned char image_linearfromsrgb[256]; diff --git a/jpeg.c b/jpeg.c index 44e53e42..c6bb81d2 100644 --- a/jpeg.c +++ b/jpeg.c @@ -1018,7 +1018,7 @@ static void CompressedImageCache_Add(const char *imagename, size_t maxsize, void return; // can't add this i = (CompressedImageCacheItem*) Z_Malloc(sizeof(CompressedImageCacheItem)); - strlcpy(i->imagename, imagename, sizeof(i->imagename)); + dp_strlcpy(i->imagename, imagename, sizeof(i->imagename)); i->maxsize = maxsize; i->compressed = compressed; i->compressed_size = compressed_size; diff --git a/keys.c b/keys.c index 62db1675..94ddb033 100644 --- a/keys.c +++ b/keys.c @@ -127,7 +127,7 @@ static qboolean Key_History_Get_foundCommand(void) { if (!history_matchfound) return false; - strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1); + dp_strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1); key_linepos = (int)strlen(key_line); history_matchfound = false; return true; @@ -136,7 +136,7 @@ static qboolean Key_History_Get_foundCommand(void) static void Key_History_Up(void) { if(history_line == -1) // editing the "new" line - strlcpy(history_savedline, key_line + 1, sizeof(history_savedline)); + dp_strlcpy(history_savedline, key_line + 1, sizeof(history_savedline)); if (Key_History_Get_foundCommand()) return; @@ -146,14 +146,14 @@ static void Key_History_Up(void) history_line = CONBUFFER_LINES_COUNT(&history) - 1; if(history_line != -1) { - strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1); + dp_strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1); key_linepos = (int)strlen(key_line); } } else if(history_line > 0) { --history_line; // this also does -1 -> 0, so it is good - strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1); + dp_strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1); key_linepos = (int)strlen(key_line); } } @@ -169,12 +169,12 @@ static void Key_History_Down(void) if(history_line < CONBUFFER_LINES_COUNT(&history) - 1) { ++history_line; - strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1); + dp_strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1); } else { history_line = -1; - strlcpy(key_line + 1, history_savedline, sizeof(key_line) - 1); + dp_strlcpy(key_line + 1, history_savedline, sizeof(key_line) - 1); } key_linepos = (int)strlen(key_line); @@ -183,12 +183,12 @@ static void Key_History_Down(void) static void Key_History_First(void) { if(history_line == -1) // editing the "new" line - strlcpy(history_savedline, key_line + 1, sizeof(history_savedline)); + dp_strlcpy(history_savedline, key_line + 1, sizeof(history_savedline)); if (CONBUFFER_LINES_COUNT(&history) > 0) { history_line = 0; - strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1); + dp_strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1); key_linepos = (int)strlen(key_line); } } @@ -196,12 +196,12 @@ static void Key_History_First(void) static void Key_History_Last(void) { if(history_line == -1) // editing the "new" line - strlcpy(history_savedline, key_line + 1, sizeof(history_savedline)); + dp_strlcpy(history_savedline, key_line + 1, sizeof(history_savedline)); if (CONBUFFER_LINES_COUNT(&history) > 0) { history_line = CONBUFFER_LINES_COUNT(&history) - 1; - strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1); + dp_strlcpy(key_line + 1, ConBuffer_GetLine(&history, history_line), sizeof(key_line) - 1); key_linepos = (int)strlen(key_line); } } @@ -214,11 +214,11 @@ static void Key_History_Find_Backwards(void) size_t digits = strlen(va(vabuf, sizeof(vabuf), "%i", HIST_MAXLINES)); if (history_line == -1) // editing the "new" line - strlcpy(history_savedline, key_line + 1, sizeof(history_savedline)); + dp_strlcpy(history_savedline, key_line + 1, sizeof(history_savedline)); if (strcmp(key_line + 1, history_searchstring)) // different string? Start a new search { - strlcpy(history_searchstring, key_line + 1, sizeof(history_searchstring)); + dp_strlcpy(history_searchstring, key_line + 1, sizeof(history_searchstring)); i = CONBUFFER_LINES_COUNT(&history) - 1; } else if (history_line == -1) @@ -253,7 +253,7 @@ static void Key_History_Find_Forwards(void) if (strcmp(key_line + 1, history_searchstring)) // different string? Start a new search { - strlcpy(history_searchstring, key_line + 1, sizeof(history_searchstring)); + dp_strlcpy(history_searchstring, key_line + 1, sizeof(history_searchstring)); i = 0; } else i = history_line + 1; @@ -759,7 +759,7 @@ Key_Console (int key, int unicode) cbd[i]=0; temp[0]=0; if ( key_linepos < (int)strlen(key_line) ) - strlcpy(temp, key_line + key_linepos, (int)strlen(key_line) - key_linepos +1); + dp_strlcpy(temp, key_line + key_linepos, (int)strlen(key_line) - key_linepos +1); key_line[key_linepos] = 0; strlcat(key_line, cbd, sizeof(key_line)); if (temp[0]) @@ -945,7 +945,7 @@ Key_Console (int key, int unicode) if (key_linepos > 1) { int newpos = (int)u8_prevbyte(key_line+1, key_linepos-1) + 1; // do NOT give the ']' to u8_prevbyte - strlcpy(key_line + newpos, key_line + key_linepos, sizeof(key_line) + 1 - key_linepos); + dp_strlcpy(key_line + newpos, key_line + key_linepos, sizeof(key_line) + 1 - key_linepos); key_linepos = newpos; } return; diff --git a/libcurl.c b/libcurl.c index 2f001d5b..0c84fe9a 100644 --- a/libcurl.c +++ b/libcurl.c @@ -250,7 +250,7 @@ static void Curl_CommandWhenDone(const char *cmd) if(!curl_dll) return; if(cmd) - strlcpy(command_when_done, cmd, sizeof(command_when_done)); + dp_strlcpy(command_when_done, cmd, sizeof(command_when_done)); else *command_when_done = 0; } @@ -266,7 +266,7 @@ static void Curl_CommandWhenError(const char *cmd) if(!curl_dll) return; if(cmd) - strlcpy(command_when_error, cmd, sizeof(command_when_error)); + dp_strlcpy(command_when_error, cmd, sizeof(command_when_error)); else *command_when_error = 0; } @@ -545,7 +545,7 @@ static void Curl_EndDownload(downloadinfo *di, CurlStatus status, CURLcode error break; } if(content_type_) - strlcpy(content_type, content_type_, sizeof(content_type)); + dp_strlcpy(content_type, content_type_, sizeof(content_type)); else *content_type = 0; @@ -1053,8 +1053,8 @@ static qboolean Curl_Begin(const char *URL, const char *extraheaders, double max if(forthismap) ++numdownloads_added; di = (downloadinfo *) Z_Malloc(sizeof(*di)); - strlcpy(di->filename, name, sizeof(di->filename)); - strlcpy(di->url, URL, sizeof(di->url)); + dp_strlcpy(di->filename, name, sizeof(di->filename)); + dp_strlcpy(di->url, URL, sizeof(di->url)); dpsnprintf(di->referer, sizeof(di->referer), "dp://%s/", cls.netcon ? cls.netcon->address : "notconnected.invalid"); di->forthismap = forthismap; di->stream = NULL; @@ -1595,7 +1595,7 @@ Curl_downloadinfo_t *Curl_GetDownloadInfo(int *nDownloads, const char **addition if(developer.integer <= 0) if(di->buffer) continue; - strlcpy(downinfo[i].filename, di->filename, sizeof(downinfo[i].filename)); + dp_strlcpy(downinfo[i].filename, di->filename, sizeof(downinfo[i].filename)); if(di->curle) { downinfo[i].progress = Curl_GetDownloadAmount(di); @@ -1686,7 +1686,7 @@ static const char *Curl_FindPackURL(const char *filename) *urlend = 0; if(matchpattern(filename, pattern, true)) { - strlcpy(foundurl, url, sizeof(foundurl)); + dp_strlcpy(foundurl, url, sizeof(foundurl)); Z_Free(buf); return foundurl; } @@ -1738,7 +1738,7 @@ void Curl_RequireFile(const char *filename) { requirement *req = (requirement *) Z_Malloc(sizeof(*requirements)); req->next = requirements; - strlcpy(req->filename, filename, sizeof(req->filename)); + dp_strlcpy(req->filename, filename, sizeof(req->filename)); requirements = req; } diff --git a/menu.c b/menu.c index d3e2b8db..4b9162a2 100644 --- a/menu.c +++ b/menu.c @@ -112,7 +112,7 @@ static qboolean m_entersound; ///< play after drawing a frame, so caching won't void M_Update_Return_Reason(const char *s) { - strlcpy(m_return_reason, s, sizeof(m_return_reason)); + dp_strlcpy(m_return_reason, s, sizeof(m_return_reason)); if (s) Con_DPrintf("%s\n", s); } @@ -860,7 +860,7 @@ static void M_ScanSaves (void) for (i=0 ; i> 4; setup_bottom = setup_oldbottom = cl_color.integer & 15; setup_rate = cl_rate.integer; @@ -2499,8 +2499,8 @@ static void M_AddBindToCategory(bindcategory_t *c, char *command, char *descript *b = Z_Alloc(sizeof(binditem_t) + strlen(command) + 1 + strlen(description) + 1); *b->command = (char *)((*b) + 1); *b->description = *b->command + strlen(command) + 1; - strlcpy(*b->command, command, strlen(command) + 1); - strlcpy(*b->description, description, strlen(description) + 1); + dp_strlcpy(*b->command, command, strlen(command) + 1); + dp_strlcpy(*b->description, description, strlen(description) + 1); } static void M_AddBind (char *category, char *command, char *description) @@ -2643,7 +2643,7 @@ static void M_Keys_Draw (void) // LordHavoc: redesigned to print more than 2 keys, inspired by Tomaz's MiniRacer if (keys[0] == -1) - strlcpy(keystring, "???", sizeof(keystring)); + dp_strlcpy(keystring, "???", sizeof(keystring)); else { char tinystr[2]; @@ -4551,7 +4551,7 @@ static void ModList_RebuildList(void) if (FS_CheckNastyPath (list.strings[i], true)) continue; if (!FS_CheckGameDir(list.strings[i])) continue; - strlcpy (modlist[modlist_count].dir, list.strings[i], sizeof(modlist[modlist_count].dir)); + dp_strlcpy (modlist[modlist_count].dir, list.strings[i], sizeof(modlist[modlist_count].dir)); //check currently loaded mods modlist[modlist_count].loaded = false; if (fs_numgamedirs) @@ -4577,7 +4577,7 @@ static void ModList_Enable (void) // copy our mod list into an array for FS_ChangeGameDirs numgamedirs = modlist_numenabled; for (i = 0; i < modlist_numenabled; i++) - strlcpy (gamedirs[i], modlist[modlist_enabled[i]].dir,sizeof (gamedirs[i])); + dp_strlcpy (gamedirs[i], modlist[modlist_enabled[i]].dir,sizeof (gamedirs[i])); // this code snippet is from FS_ChangeGameDirs if (fs_numgamedirs == numgamedirs) diff --git a/model_alias.c b/model_alias.c index ca4c88ef..dc380258 100644 --- a/model_alias.c +++ b/model_alias.c @@ -881,7 +881,7 @@ static void Mod_MDL_LoadFrames (unsigned char* datapointer, int inverts, int *ve // get scene name from first frame pinframe = (daliasframe_t *)datapointer; - strlcpy(scene->name, pinframe->name, sizeof(scene->name)); + dp_strlcpy(scene->name, pinframe->name, sizeof(scene->name)); scene->firstframe = pose; scene->framecount = groupframes; scene->framerate = 1.0f / interval; @@ -1302,7 +1302,7 @@ void Mod_IDP0_Load(dp_model_t *mod, void *buffer, void *bufferend) // store the info about the new skin Mod_BuildAliasSkinFromSkinFrame(loadmodel->data_textures + totalskins * loadmodel->num_surfaces, tempskinframe); - strlcpy(loadmodel->skinscenes[loadmodel->numskins].name, name, sizeof(loadmodel->skinscenes[loadmodel->numskins].name)); + dp_strlcpy(loadmodel->skinscenes[loadmodel->numskins].name, name, sizeof(loadmodel->skinscenes[loadmodel->numskins].name)); loadmodel->skinscenes[loadmodel->numskins].firstframe = totalskins; loadmodel->skinscenes[loadmodel->numskins].framecount = 1; loadmodel->skinscenes[loadmodel->numskins].framerate = 10.0f; @@ -1577,7 +1577,7 @@ void Mod_IDP2_Load(dp_model_t *mod, void *buffer, void *bufferend) out[k] = v[vertremap[k]]; datapointer += numxyz * sizeof(trivertx_t); - strlcpy(loadmodel->animscenes[i].name, pinframe->name, sizeof(loadmodel->animscenes[i].name)); + dp_strlcpy(loadmodel->animscenes[i].name, pinframe->name, sizeof(loadmodel->animscenes[i].name)); loadmodel->animscenes[i].firstframe = i; loadmodel->animscenes[i].framecount = 1; loadmodel->animscenes[i].framerate = 10; @@ -1685,7 +1685,7 @@ void Mod_IDP3_Load(dp_model_t *mod, void *buffer, void *bufferend) loadmodel->animscenes = (animscene_t *)Mem_Alloc(loadmodel->mempool, loadmodel->numframes * sizeof(animscene_t)); for (i = 0, pinframe = (md3frameinfo_t *)((unsigned char *)pinmodel + LittleLong(pinmodel->lump_frameinfo));i < loadmodel->numframes;i++, pinframe++) { - strlcpy(loadmodel->animscenes[i].name, pinframe->name, sizeof(loadmodel->animscenes[i].name)); + dp_strlcpy(loadmodel->animscenes[i].name, pinframe->name, sizeof(loadmodel->animscenes[i].name)); loadmodel->animscenes[i].firstframe = i; loadmodel->animscenes[i].framecount = 1; loadmodel->animscenes[i].framerate = 10; @@ -1698,7 +1698,7 @@ void Mod_IDP3_Load(dp_model_t *mod, void *buffer, void *bufferend) loadmodel->data_tags = (aliastag_t *)Mem_Alloc(loadmodel->mempool, loadmodel->num_tagframes * loadmodel->num_tags * sizeof(aliastag_t)); for (i = 0, pintag = (md3tag_t *)((unsigned char *)pinmodel + LittleLong(pinmodel->lump_tags));i < loadmodel->num_tagframes * loadmodel->num_tags;i++, pintag++) { - strlcpy(loadmodel->data_tags[i].name, pintag->name, sizeof(loadmodel->data_tags[i].name)); + dp_strlcpy(loadmodel->data_tags[i].name, pintag->name, sizeof(loadmodel->data_tags[i].name)); for (j = 0;j < 9;j++) loadmodel->data_tags[i].matrixgl[j] = LittleFloat(pintag->rotationmatrix[j]); for (j = 0;j < 3;j++) @@ -3072,7 +3072,7 @@ void Mod_PSKMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) // copy over the bones for (index = 0;index < numbones;index++) { - strlcpy(loadmodel->data_bones[index].name, bones[index].name, sizeof(loadmodel->data_bones[index].name)); + dp_strlcpy(loadmodel->data_bones[index].name, bones[index].name, sizeof(loadmodel->data_bones[index].name)); loadmodel->data_bones[index].parent = (index || bones[index].parent > 0) ? bones[index].parent : -1; if (loadmodel->data_bones[index].parent >= index) Host_Error("%s bone[%i].parent >= %i", loadmodel->name, index, index); @@ -3194,7 +3194,7 @@ void Mod_PSKMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) } else { - strlcpy(loadmodel->animscenes[0].name, "base", sizeof(loadmodel->animscenes[0].name)); + dp_strlcpy(loadmodel->animscenes[0].name, "base", sizeof(loadmodel->animscenes[0].name)); loadmodel->animscenes[0].firstframe = 0; loadmodel->animscenes[0].framecount = 1; loadmodel->animscenes[0].loop = true; @@ -3556,7 +3556,7 @@ void Mod_INTERQUAKEMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) joint1[i].rotation[j] = LittleFloat(injoint1[i].rotation[j]); joint1[i].scale[j] = LittleFloat(injoint1[i].scale[j]); } - strlcpy(loadmodel->data_bones[i].name, &text[joint1[i].name], sizeof(loadmodel->data_bones[i].name)); + dp_strlcpy(loadmodel->data_bones[i].name, &text[joint1[i].name], sizeof(loadmodel->data_bones[i].name)); loadmodel->data_bones[i].parent = joint1[i].parent; if (loadmodel->data_bones[i].parent >= i) Host_Error("%s bone[%i].parent >= %i", loadmodel->name, i, i); @@ -3588,7 +3588,7 @@ void Mod_INTERQUAKEMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) joint[i].scale[j] = LittleFloat(injoint[i].scale[j]); } joint[i].rotation[3] = LittleFloat(injoint[i].rotation[3]); - strlcpy(loadmodel->data_bones[i].name, &text[joint[i].name], sizeof(loadmodel->data_bones[i].name)); + dp_strlcpy(loadmodel->data_bones[i].name, &text[joint[i].name], sizeof(loadmodel->data_bones[i].name)); loadmodel->data_bones[i].parent = joint[i].parent; if (loadmodel->data_bones[i].parent >= i) Host_Error("%s bone[%i].parent >= %i", loadmodel->name, i, i); @@ -3616,7 +3616,7 @@ void Mod_INTERQUAKEMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) anim.num_frames = LittleLong(anims[i].num_frames); anim.framerate = LittleFloat(anims[i].framerate); anim.flags = LittleLong(anims[i].flags); - strlcpy(loadmodel->animscenes[i].name, &text[anim.name], sizeof(loadmodel->animscenes[i].name)); + dp_strlcpy(loadmodel->animscenes[i].name, &text[anim.name], sizeof(loadmodel->animscenes[i].name)); loadmodel->animscenes[i].firstframe = anim.first_frame; loadmodel->animscenes[i].framecount = anim.num_frames; loadmodel->animscenes[i].loop = ((anim.flags & IQM_LOOP) != 0); @@ -3624,7 +3624,7 @@ void Mod_INTERQUAKEMODEL_Load(dp_model_t *mod, void *buffer, void *bufferend) } if (header.num_anims <= 0) { - strlcpy(loadmodel->animscenes[0].name, "static", sizeof(loadmodel->animscenes[0].name)); + dp_strlcpy(loadmodel->animscenes[0].name, "static", sizeof(loadmodel->animscenes[0].name)); loadmodel->animscenes[0].firstframe = 0; loadmodel->animscenes[0].framecount = 1; loadmodel->animscenes[0].loop = true; diff --git a/model_brush.c b/model_brush.c index 66cb6d0b..998d88f7 100644 --- a/model_brush.c +++ b/model_brush.c @@ -115,27 +115,27 @@ void Mod_BrushInit(void) Cvar_SetQuick(&mod_q3shader_force_addalpha, "1"); memset(&mod_q1bsp_texture_solid, 0, sizeof(mod_q1bsp_texture_solid)); - strlcpy(mod_q1bsp_texture_solid.name, "solid" , sizeof(mod_q1bsp_texture_solid.name)); + dp_strlcpy(mod_q1bsp_texture_solid.name, "solid" , sizeof(mod_q1bsp_texture_solid.name)); mod_q1bsp_texture_solid.surfaceflags = 0; mod_q1bsp_texture_solid.supercontents = SUPERCONTENTS_SOLID; mod_q1bsp_texture_sky = mod_q1bsp_texture_solid; - strlcpy(mod_q1bsp_texture_sky.name, "sky", sizeof(mod_q1bsp_texture_sky.name)); + dp_strlcpy(mod_q1bsp_texture_sky.name, "sky", sizeof(mod_q1bsp_texture_sky.name)); mod_q1bsp_texture_sky.surfaceflags = Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT | Q3SURFACEFLAG_NOMARKS | Q3SURFACEFLAG_NODLIGHT | Q3SURFACEFLAG_NOLIGHTMAP; mod_q1bsp_texture_sky.supercontents = SUPERCONTENTS_SKY | SUPERCONTENTS_NODROP; mod_q1bsp_texture_lava = mod_q1bsp_texture_solid; - strlcpy(mod_q1bsp_texture_lava.name, "*lava", sizeof(mod_q1bsp_texture_lava.name)); + dp_strlcpy(mod_q1bsp_texture_lava.name, "*lava", sizeof(mod_q1bsp_texture_lava.name)); mod_q1bsp_texture_lava.surfaceflags = Q3SURFACEFLAG_NOMARKS; mod_q1bsp_texture_lava.supercontents = SUPERCONTENTS_LAVA | SUPERCONTENTS_NODROP; mod_q1bsp_texture_slime = mod_q1bsp_texture_solid; - strlcpy(mod_q1bsp_texture_slime.name, "*slime", sizeof(mod_q1bsp_texture_slime.name)); + dp_strlcpy(mod_q1bsp_texture_slime.name, "*slime", sizeof(mod_q1bsp_texture_slime.name)); mod_q1bsp_texture_slime.surfaceflags = Q3SURFACEFLAG_NOMARKS; mod_q1bsp_texture_slime.supercontents = SUPERCONTENTS_SLIME; mod_q1bsp_texture_water = mod_q1bsp_texture_solid; - strlcpy(mod_q1bsp_texture_water.name, "*water", sizeof(mod_q1bsp_texture_water.name)); + dp_strlcpy(mod_q1bsp_texture_water.name, "*water", sizeof(mod_q1bsp_texture_water.name)); mod_q1bsp_texture_water.surfaceflags = Q3SURFACEFLAG_NOMARKS; mod_q1bsp_texture_water.supercontents = SUPERCONTENTS_WATER; } @@ -1656,7 +1656,7 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb) skinframe = NULL; for (i = 0, tx = loadmodel->data_textures;i < loadmodel->num_textures;i++, tx++) { - strlcpy(tx->name, "NO TEXTURE FOUND", sizeof(tx->name)); + dp_strlcpy(tx->name, "NO TEXTURE FOUND", sizeof(tx->name)); tx->width = 16; tx->height = 16; tx->basealpha = 1.0f; @@ -1771,7 +1771,7 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb) loadmodel->data_textures[i] = backuptex; tx = loadmodel->data_textures + i; - strlcpy(tx->name, name, sizeof(tx->name)); + dp_strlcpy(tx->name, name, sizeof(tx->name)); tx->width = mtwidth; tx->height = mtheight; tx->basealpha = 1.0f; @@ -2016,9 +2016,9 @@ static void Mod_Q1BSP_LoadLighting(sizebuf_t *sb) else // LordHavoc: bsp version 29 (normal white lighting) { // LordHavoc: hope is not lost yet, check for a .lit file to load - strlcpy (litfilename, loadmodel->name, sizeof (litfilename)); + dp_strlcpy (litfilename, loadmodel->name, sizeof (litfilename)); FS_StripExtension (litfilename, litfilename, sizeof (litfilename)); - strlcpy (dlitfilename, litfilename, sizeof (dlitfilename)); + dp_strlcpy (dlitfilename, litfilename, sizeof (dlitfilename)); strlcat (litfilename, ".lit", sizeof (litfilename)); strlcat (dlitfilename, ".dlit", sizeof (dlitfilename)); data = (unsigned char*) FS_LoadFile(litfilename, tempmempool, false, &filesize); @@ -2113,9 +2113,9 @@ static void Mod_Q1BSP_ParseWadsFromEntityLump(const char *data) if (com_token[0] == '}') break; // end of worldspawn if (com_token[0] == '_') - strlcpy(key, com_token + 1, sizeof(key)); + dp_strlcpy(key, com_token + 1, sizeof(key)); else - strlcpy(key, com_token, sizeof(key)); + dp_strlcpy(key, com_token, sizeof(key)); while (key[strlen(key)-1] == ' ') // remove trailing spaces key[strlen(key)-1] = 0; if (!COM_ParseToken_Simple(&data, false, false, true)) @@ -3218,7 +3218,7 @@ static void Mod_Q1BSP_LoadMapBrushes(void) COM_ParseToken_Simple(&data, false, false, true); } COM_ParseToken_Simple(&data, false, false, true); - strlcpy(facetexture, com_token, sizeof(facetexture)); + dp_strlcpy(facetexture, com_token, sizeof(facetexture)); COM_ParseToken_Simple(&data, false, false, true); //scroll_s = atof(com_token); COM_ParseToken_Simple(&data, false, false, true); @@ -3979,7 +3979,7 @@ void Mod_Q1BSP_Load(dp_model_t *mod, void *buffer, void *bufferend) // copy the base model to this one *mod = *loadmodel; // rename the clone back to its proper name - strlcpy(mod->name, name, sizeof(mod->name)); + dp_strlcpy(mod->name, name, sizeof(mod->name)); mod->brush.parentmodel = loadmodel; // textures and memory belong to the main model mod->texturepool = NULL; @@ -4892,7 +4892,7 @@ static void Mod_Q2BSP_Load(dp_model_t *mod, void *buffer, void *bufferend) // copy the base model to this one *mod = *loadmodel; // rename the clone back to its proper name - strlcpy(mod->name, name, sizeof(mod->name)); + dp_strlcpy(mod->name, name, sizeof(mod->name)); mod->brush.parentmodel = loadmodel; // textures and memory belong to the main model mod->texturepool = NULL; @@ -5068,14 +5068,14 @@ static void Mod_Q3BSP_LoadEntities(lump_t *l) if (com_token[0] == '}') break; // end of worldspawn if (com_token[0] == '_') - strlcpy(key, com_token + 1, sizeof(key)); + dp_strlcpy(key, com_token + 1, sizeof(key)); else - strlcpy(key, com_token, sizeof(key)); + dp_strlcpy(key, com_token, sizeof(key)); while (key[strlen(key)-1] == ' ') // remove trailing spaces key[strlen(key)-1] = 0; if (!COM_ParseToken_Simple(&data, false, false, true)) break; // error - strlcpy(value, com_token, sizeof(value)); + dp_strlcpy(value, com_token, sizeof(value)); if (!strcasecmp("gridsize", key)) // this one is case insensitive to 100% match q3map2 { #if _MSC_VER >= 1400 @@ -5293,7 +5293,7 @@ static void Mod_Q3BSP_LoadEffects(lump_t *l) for (i = 0;i < count;i++, in++, out++) { - strlcpy (out->shadername, in->shadername, sizeof (out->shadername)); + dp_strlcpy (out->shadername, in->shadername, sizeof (out->shadername)); n = LittleLong(in->brushindex); if (n >= loadmodel->brush.num_brushes) { @@ -7832,7 +7832,7 @@ static void Mod_Q3BSP_Load(dp_model_t *mod, void *buffer, void *bufferend) // copy the base model to this one *mod = *loadmodel; // rename the clone back to its proper name - strlcpy(mod->name, name, sizeof(mod->name)); + dp_strlcpy(mod->name, name, sizeof(mod->name)); mod->brush.parentmodel = loadmodel; // textures and memory belong to the main model mod->texturepool = NULL; @@ -8180,7 +8180,7 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) texturenames = (char *)Mem_Realloc(loadmodel->mempool, texturenames, maxtextures * MAX_QPATH); } textureindex = numtextures++; - strlcpy(texturenames + textureindex*MAX_QPATH, loadmodel->name, MAX_QPATH); + dp_strlcpy(texturenames + textureindex*MAX_QPATH, loadmodel->name, MAX_QPATH); } for (j = 1;j < argc;j++) { @@ -8273,7 +8273,7 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) texturenames = (char *)Mem_Realloc(loadmodel->mempool, texturenames, maxtextures * MAX_QPATH); } textureindex = numtextures++; - strlcpy(texturenames + textureindex*MAX_QPATH, argv[1], MAX_QPATH); + dp_strlcpy(texturenames + textureindex*MAX_QPATH, argv[1], MAX_QPATH); } } } @@ -8488,7 +8488,7 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) // copy the base model to this one *mod = *loadmodel; // rename the clone back to its proper name - strlcpy(mod->name, name, sizeof(mod->name)); + dp_strlcpy(mod->name, name, sizeof(mod->name)); mod->brush.parentmodel = loadmodel; // textures and memory belong to the main model mod->texturepool = NULL; diff --git a/model_shared.c b/model_shared.c index c1bd882f..cc736e6a 100644 --- a/model_shared.c +++ b/model_shared.c @@ -195,7 +195,7 @@ void Mod_UnloadModel (dp_model_t *mod) if (developer_loading.integer) Con_Printf("unloading model %s\n", mod->name); - strlcpy(name, mod->name, sizeof(name)); + dp_strlcpy(name, mod->name, sizeof(name)); parentmodel = mod->brush.parentmodel; used = mod->used; if (mod->mempool) @@ -216,7 +216,7 @@ void Mod_UnloadModel (dp_model_t *mod) // clear the struct to make it available memset(mod, 0, sizeof(dp_model_t)); // restore the fields we want to preserve - strlcpy(mod->name, name, sizeof(mod->name)); + dp_strlcpy(mod->name, name, sizeof(mod->name)); mod->brush.parentmodel = parentmodel; mod->used = used; mod->loaded = false; @@ -285,7 +285,7 @@ static int Mod_FrameGroupify_ParseGroups(const char *buf, mod_framegroupify_pars name[0] = 0; if (bufptr && strcmp(com_token, "\n")) { - strlcpy(name, com_token, sizeof(name)); + dp_strlcpy(name, com_token, sizeof(name)); COM_ParseToken_Simple(&bufptr, true, false, true); } @@ -308,7 +308,7 @@ static void Mod_FrameGroupify_ParseGroups_Store (unsigned int i, int start, int dp_model_t *mod = (dp_model_t *) pass; animscene_t *anim = &mod->animscenes[i]; if(name) - strlcpy(anim->name, name, sizeof(anim[i].name)); + dp_strlcpy(anim->name, name, sizeof(anim[i].name)); else dpsnprintf(anim->name, sizeof(anim[i].name), "groupified_%d_anim", i); anim->firstframe = bound(0, start, mod->num_poses - 1); @@ -590,7 +590,7 @@ dp_model_t *Mod_FindName(const char *name, const char *parentname) // no match found, create a new one mod = (dp_model_t *) Mem_ExpandableArray_AllocRecord(&models); - strlcpy(mod->name, name, sizeof(mod->name)); + dp_strlcpy(mod->name, name, sizeof(mod->name)); if (parentname[0]) mod->brush.parentmodel = Mod_FindName(parentname, NULL); else @@ -1694,7 +1694,7 @@ void Mod_LoadQ3Shaders(void) // name j = (int)strlen(com_token)+1; custsurfaceparmnames[numcustsurfaceflags] = (char *)Mem_Alloc(tempmempool, j); - strlcpy(custsurfaceparmnames[numcustsurfaceflags], com_token, j+1); + dp_strlcpy(custsurfaceparmnames[numcustsurfaceflags], com_token, j+1); // value if (COM_ParseToken_QuakeC(&text, false)) custsurfaceflags[numcustsurfaceflags] = strtol(com_token, NULL, 0); @@ -1758,7 +1758,7 @@ void Mod_LoadQ3Shaders(void) // WHEN ADDING DEFAULTS HERE, REMEMBER TO PUT DEFAULTS IN ALL LOADERS // JUST GREP FOR "specularscalemod = 1". - strlcpy(shader.name, com_token, sizeof(shader.name)); + dp_strlcpy(shader.name, com_token, sizeof(shader.name)); if (!COM_ParseToken_QuakeC(&text, false) || strcasecmp(com_token, "{")) { Con_DPrintf("%s parsing error - expected \"{\", found \"%s\"\n", search->filenames[fileindex], com_token); @@ -1801,7 +1801,7 @@ void Mod_LoadQ3Shaders(void) if(j == 0 && !strncasecmp(com_token, "dp_", 3)) dpsnprintf(parameter[j], sizeof(parameter[j]), "dp%s", &com_token[3]); else - strlcpy(parameter[j], com_token, sizeof(parameter[j])); + dp_strlcpy(parameter[j], com_token, sizeof(parameter[j])); numparameters = j + 1; } if (!COM_ParseToken_QuakeC(&text, true)) @@ -2056,7 +2056,7 @@ void Mod_LoadQ3Shaders(void) if(j == 0 && !strncasecmp(com_token, "dp_", 3)) dpsnprintf(parameter[j], sizeof(parameter[j]), "dp%s", &com_token[3]); else - strlcpy(parameter[j], com_token, sizeof(parameter[j])); + dp_strlcpy(parameter[j], com_token, sizeof(parameter[j])); numparameters = j + 1; } if (!COM_ParseToken_QuakeC(&text, true)) @@ -2166,7 +2166,7 @@ void Mod_LoadQ3Shaders(void) else if (!strcasecmp(parameter[0], "dpnortlight")) shader.dpnortlight = true; else if (!strcasecmp(parameter[0], "dpreflectcube")) - strlcpy(shader.dpreflectcube, parameter[1], sizeof(shader.dpreflectcube)); + dp_strlcpy(shader.dpreflectcube, parameter[1], sizeof(shader.dpreflectcube)); else if (!strcasecmp(parameter[0], "dpmeshcollisions")) shader.dpmeshcollisions = true; // this sets dpshaderkill to true if dpshaderkillifcvarzero was used, and to false if dpnoshaderkillifcvarzero was used @@ -2225,14 +2225,14 @@ void Mod_LoadQ3Shaders(void) { // some q3 skies don't have the sky parm set shader.surfaceparms |= Q3SURFACEPARM_SKY; - strlcpy(shader.skyboxname, parameter[1], sizeof(shader.skyboxname)); + dp_strlcpy(shader.skyboxname, parameter[1], sizeof(shader.skyboxname)); } else if (!strcasecmp(parameter[0], "skyparms") && numparameters >= 2) { // some q3 skies don't have the sky parm set shader.surfaceparms |= Q3SURFACEPARM_SKY; if (!atoi(parameter[1]) && strcasecmp(parameter[1], "-")) - strlcpy(shader.skyboxname, parameter[1], sizeof(shader.skyboxname)); + dp_strlcpy(shader.skyboxname, parameter[1], sizeof(shader.skyboxname)); } else if (!strcasecmp(parameter[0], "cull") && numparameters >= 2) { @@ -2443,7 +2443,7 @@ qboolean Mod_LoadTextureFromQ3Shader(texture_t *texture, const char *name, qbool q3shaderinfo_t *shader; if (!name) name = ""; - strlcpy(texture->name, name, sizeof(texture->name)); + dp_strlcpy(texture->name, name, sizeof(texture->name)); texture->basealpha = 1.0f; shader = name[0] ? Mod_LookupQ3Shader(name) : NULL; @@ -2824,7 +2824,7 @@ tag_torso, do { if (words < 10) - strlcpy(word[words++], com_token, sizeof (word[0])); + dp_strlcpy(word[words++], com_token, sizeof (word[0])); else wordsoverflow = true; } @@ -2844,8 +2844,8 @@ tag_torso, skinfileitem = (skinfileitem_t *)Mem_Alloc(loadmodel->mempool, sizeof(skinfileitem_t)); skinfileitem->next = skinfile->items; skinfile->items = skinfileitem; - strlcpy (skinfileitem->name, word[1], sizeof (skinfileitem->name)); - strlcpy (skinfileitem->replacement, word[2], sizeof (skinfileitem->replacement)); + dp_strlcpy (skinfileitem->name, word[1], sizeof (skinfileitem->name)); + dp_strlcpy (skinfileitem->replacement, word[2], sizeof (skinfileitem->replacement)); } else Con_Printf("Mod_LoadSkinFiles: parsing error in file \"%s_%i.skin\" on line #%i: wrong number of parameters to command \"%s\", see documentation in DP_GFX_SKINFILES extension in dpextensions.qc\n", loadmodel->name, i, line, word[0]); @@ -2863,8 +2863,8 @@ tag_torso, skinfileitem = (skinfileitem_t *)Mem_Alloc(loadmodel->mempool, sizeof(skinfileitem_t)); skinfileitem->next = skinfile->items; skinfile->items = skinfileitem; - strlcpy (skinfileitem->name, word[0], sizeof (skinfileitem->name)); - strlcpy (skinfileitem->replacement, word[2], sizeof (skinfileitem->replacement)); + dp_strlcpy (skinfileitem->name, word[0], sizeof (skinfileitem->name)); + dp_strlcpy (skinfileitem->replacement, word[2], sizeof (skinfileitem->replacement)); } else Con_Printf("Mod_LoadSkinFiles: parsing error in file \"%s_%i.skin\" on line #%i: does not look like tag or mesh specification, or replace command, see documentation in DP_GFX_SKINFILES extension in dpextensions.qc\n", loadmodel->name, i, line); @@ -3110,7 +3110,7 @@ static void Mod_Decompile_OBJ(dp_model_t *model, const char *filename, const cha if (textureindex >= maxtextures) continue; // just a precaution textureindex = counttextures++; - strlcpy(texturenames + textureindex * MAX_QPATH, texname, MAX_QPATH); + dp_strlcpy(texturenames + textureindex * MAX_QPATH, texname, MAX_QPATH); if (outbufferpos >= outbuffermax >> 1) { outbuffermax *= 2; @@ -3385,7 +3385,7 @@ static void Mod_Decompile_f(void) return; } - strlcpy(inname, Cmd_Argv(1), sizeof(inname)); + dp_strlcpy(inname, Cmd_Argv(1), sizeof(inname)); FS_StripExtension(inname, basename, sizeof(basename)); mod = Mod_ForName(inname, false, true, inname[0] == '*' ? cl.model_name[1] : NULL); @@ -3426,7 +3426,7 @@ static void Mod_Decompile_f(void) if (l > 0) dpmtextsize += l; for (i = 0;i < mod->numframes;i = j) { - strlcpy(animname, mod->animscenes[i].name, sizeof(animname)); + dp_strlcpy(animname, mod->animscenes[i].name, sizeof(animname)); first = mod->animscenes[i].firstframe; if (mod->animscenes[i].framecount > 1) { @@ -3447,7 +3447,7 @@ static void Mod_Decompile_f(void) count = mod->num_poses - first; for (j = i + 1;j < mod->numframes;j++) { - strlcpy(animname2, mod->animscenes[j].name, sizeof(animname2)); + dp_strlcpy(animname2, mod->animscenes[j].name, sizeof(animname2)); for (l = 0, k = (int)strlen(animname2);animname2[l];l++) if(animname2[l] < '0' || animname2[l] > '9') k = l + 1; @@ -3462,7 +3462,7 @@ static void Mod_Decompile_f(void) } // if it's only one frame, use the original frame name if (j == i + 1) - strlcpy(animname, mod->animscenes[i].name, sizeof(animname)); + dp_strlcpy(animname, mod->animscenes[i].name, sizeof(animname)); } dpsnprintf(outname, sizeof(outname), "%s_decompiled/%s.smd", basename, animname); diff --git a/mvm_cmds.c b/mvm_cmds.c index ace22bfa..e96872e2 100644 --- a/mvm_cmds.c +++ b/mvm_cmds.c @@ -332,25 +332,25 @@ static void VM_M_setserverlistmaskstring(prvm_prog_t *prog) switch( field ) { case SLIF_CNAME: - strlcpy( mask->info.cname, str, sizeof(mask->info.cname) ); + dp_strlcpy( mask->info.cname, str, sizeof(mask->info.cname) ); break; case SLIF_NAME: - strlcpy( mask->info.name, str, sizeof(mask->info.name) ); + dp_strlcpy( mask->info.name, str, sizeof(mask->info.name) ); break; case SLIF_QCSTATUS: - strlcpy( mask->info.qcstatus, str, sizeof(mask->info.qcstatus) ); + dp_strlcpy( mask->info.qcstatus, str, sizeof(mask->info.qcstatus) ); break; case SLIF_PLAYERS: - strlcpy( mask->info.players, str, sizeof(mask->info.players) ); + dp_strlcpy( mask->info.players, str, sizeof(mask->info.players) ); break; case SLIF_MAP: - strlcpy( mask->info.map, str, sizeof(mask->info.map) ); + dp_strlcpy( mask->info.map, str, sizeof(mask->info.map) ); break; case SLIF_MOD: - strlcpy( mask->info.mod, str, sizeof(mask->info.mod) ); + dp_strlcpy( mask->info.mod, str, sizeof(mask->info.mod) ); break; case SLIF_GAME: - strlcpy( mask->info.game, str, sizeof(mask->info.game) ); + dp_strlcpy( mask->info.game, str, sizeof(mask->info.game) ); break; default: VM_Warning(prog, "VM_M_setserverlistmaskstring: Bad field number %i passed!\n", field ); diff --git a/netconn.c b/netconn.c index 9b53ed3f..616ac9ad 100755 --- a/netconn.c +++ b/netconn.c @@ -183,7 +183,7 @@ void NetConn_UpdateFavorites(void) // currently 44 bytes, longest possible IPv6 address: 39 bytes, so this works // (if v6 address contains port, it must start with '[') { - strlcpy(favorites_idfp[nFavorites_idfp], com_token, sizeof(favorites_idfp[nFavorites_idfp])); + dp_strlcpy(favorites_idfp[nFavorites_idfp], com_token, sizeof(favorites_idfp[nFavorites_idfp])); ++nFavorites_idfp; } else @@ -1610,7 +1610,7 @@ static int NetConn_ClientParsePacket_ServerList_ProcessReply(const char *address memset(entry, 0, sizeof(*entry)); // store the data the engine cares about (address and ping) - strlcpy(entry->info.cname, addressstring, sizeof(entry->info.cname)); + dp_strlcpy(entry->info.cname, addressstring, sizeof(entry->info.cname)); entry->info.ping = 100000; entry->querytime = realtime; // if not in the slist menu we should print the server to console @@ -1697,7 +1697,7 @@ static qboolean NetConn_ClientParsePacket_ServerList_PrepareQuery( int protocol, memset(entry, 0, sizeof(*entry)); entry->protocol = protocol; // store the data the engine cares about (address and ping) - strlcpy (entry->info.cname, ipstring, sizeof(entry->info.cname)); + dp_strlcpy (entry->info.cname, ipstring, sizeof(entry->info.cname)); entry->info.isfavorite = isfavorite; @@ -1881,7 +1881,7 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat { int k; buf[45] = ' '; - strlcpy(buf + 46, argbuf, sizeof(buf) - 46); + dp_strlcpy(buf + 46, argbuf, sizeof(buf) - 46); NetConn_Write(mysocket, buf, 46 + (int)strlen(buf + 46), peeraddress); cls.rcon_commands[i][0] = 0; --cls.rcon_trying; @@ -1977,17 +1977,17 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat else Con_Printf("statusResponse without players block?\n"); - if ((s = InfoString_GetValue(string, "gamename" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->game, s, sizeof (info->game)); - if ((s = InfoString_GetValue(string, "modname" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->mod , s, sizeof (info->mod )); - if ((s = InfoString_GetValue(string, "mapname" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->map , s, sizeof (info->map )); - if ((s = InfoString_GetValue(string, "hostname" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->name, s, sizeof (info->name)); + if ((s = InfoString_GetValue(string, "gamename" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->game, s, sizeof (info->game)); + if ((s = InfoString_GetValue(string, "modname" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->mod , s, sizeof (info->mod )); + if ((s = InfoString_GetValue(string, "mapname" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->map , s, sizeof (info->map )); + if ((s = InfoString_GetValue(string, "hostname" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->name, s, sizeof (info->name)); if ((s = InfoString_GetValue(string, "protocol" , infostringvalue, sizeof(infostringvalue))) != NULL) info->protocol = atoi(s); if ((s = InfoString_GetValue(string, "clients" , infostringvalue, sizeof(infostringvalue))) != NULL) info->numplayers = atoi(s); if ((s = InfoString_GetValue(string, "bots" , infostringvalue, sizeof(infostringvalue))) != NULL) info->numbots = atoi(s); if ((s = InfoString_GetValue(string, "sv_maxclients", infostringvalue, sizeof(infostringvalue))) != NULL) info->maxplayers = atoi(s); if ((s = InfoString_GetValue(string, "gameversion" , infostringvalue, sizeof(infostringvalue))) != NULL) info->gameversion = atoi(s); - if ((s = InfoString_GetValue(string, "qcstatus" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->qcstatus, s, sizeof(info->qcstatus)); - if (p != NULL) strlcpy(info->players, p, sizeof(info->players)); + if ((s = InfoString_GetValue(string, "qcstatus" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->qcstatus, s, sizeof(info->qcstatus)); + if (p != NULL) dp_strlcpy(info->players, p, sizeof(info->players)); info->numhumans = info->numplayers - max(0, info->numbots); info->freeslots = info->maxplayers - info->numplayers; @@ -2019,16 +2019,16 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat info->maxplayers = 0; info->gameversion = 0; - if ((s = InfoString_GetValue(string, "gamename" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->game, s, sizeof (info->game)); - if ((s = InfoString_GetValue(string, "modname" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->mod , s, sizeof (info->mod )); - if ((s = InfoString_GetValue(string, "mapname" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->map , s, sizeof (info->map )); - if ((s = InfoString_GetValue(string, "hostname" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->name, s, sizeof (info->name)); + if ((s = InfoString_GetValue(string, "gamename" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->game, s, sizeof (info->game)); + if ((s = InfoString_GetValue(string, "modname" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->mod , s, sizeof (info->mod )); + if ((s = InfoString_GetValue(string, "mapname" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->map , s, sizeof (info->map )); + if ((s = InfoString_GetValue(string, "hostname" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->name, s, sizeof (info->name)); if ((s = InfoString_GetValue(string, "protocol" , infostringvalue, sizeof(infostringvalue))) != NULL) info->protocol = atoi(s); if ((s = InfoString_GetValue(string, "clients" , infostringvalue, sizeof(infostringvalue))) != NULL) info->numplayers = atoi(s); if ((s = InfoString_GetValue(string, "bots" , infostringvalue, sizeof(infostringvalue))) != NULL) info->numbots = atoi(s); if ((s = InfoString_GetValue(string, "sv_maxclients", infostringvalue, sizeof(infostringvalue))) != NULL) info->maxplayers = atoi(s); if ((s = InfoString_GetValue(string, "gameversion" , infostringvalue, sizeof(infostringvalue))) != NULL) info->gameversion = atoi(s); - if ((s = InfoString_GetValue(string, "qcstatus" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->qcstatus, s, sizeof(info->qcstatus)); + if ((s = InfoString_GetValue(string, "qcstatus" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->qcstatus, s, sizeof(info->qcstatus)); info->numhumans = info->numplayers - max(0, info->numbots); info->freeslots = info->maxplayers - info->numplayers; @@ -2138,10 +2138,10 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat return true; info = &serverlist_cache[n].info; - strlcpy(info->game, "QuakeWorld", sizeof(info->game)); - if ((s = InfoString_GetValue(string, "*gamedir" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->mod , s, sizeof (info->mod ));else info->mod[0] = 0; - if ((s = InfoString_GetValue(string, "map" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->map , s, sizeof (info->map ));else info->map[0] = 0; - if ((s = InfoString_GetValue(string, "hostname" , infostringvalue, sizeof(infostringvalue))) != NULL) strlcpy(info->name, s, sizeof (info->name));else info->name[0] = 0; + dp_strlcpy(info->game, "QuakeWorld", sizeof(info->game)); + if ((s = InfoString_GetValue(string, "*gamedir" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->mod , s, sizeof (info->mod ));else info->mod[0] = 0; + if ((s = InfoString_GetValue(string, "map" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->map , s, sizeof (info->map ));else info->map[0] = 0; + if ((s = InfoString_GetValue(string, "hostname" , infostringvalue, sizeof(infostringvalue))) != NULL) dp_strlcpy(info->name, s, sizeof (info->name));else info->name[0] = 0; info->protocol = 0; info->numplayers = 0; // updated below info->numhumans = 0; // updated below @@ -2254,10 +2254,10 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat break; info = &serverlist_cache[n].info; - strlcpy(info->game, "Quake", sizeof(info->game)); - strlcpy(info->mod , "", sizeof(info->mod)); // mod name is not specified - strlcpy(info->name, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(info->name)); - strlcpy(info->map , MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(info->map)); + dp_strlcpy(info->game, "Quake", sizeof(info->game)); + dp_strlcpy(info->mod , "", sizeof(info->mod)); // mod name is not specified + dp_strlcpy(info->name, MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(info->name)); + dp_strlcpy(info->map , MSG_ReadString(&cl_message, cl_readstring, sizeof(cl_readstring)), sizeof(info->map)); info->numplayers = MSG_ReadByte(&cl_message); info->maxplayers = MSG_ReadByte(&cl_message); info->protocol = MSG_ReadByte(&cl_message); @@ -2584,17 +2584,17 @@ static qboolean NetConn_BuildStatusResponse(const char* challenge, char* out_msg if (IS_NEXUIZ_DERIVED(gamemode) && (teamplay.integer > 0)) { if(cl->frags == -666) // spectator - strlcpy(teambuf, " 0", sizeof(teambuf)); + dp_strlcpy(teambuf, " 0", sizeof(teambuf)); else if(cl->colors == 0x44) // red team - strlcpy(teambuf, " 1", sizeof(teambuf)); + dp_strlcpy(teambuf, " 1", sizeof(teambuf)); else if(cl->colors == 0xDD) // blue team - strlcpy(teambuf, " 2", sizeof(teambuf)); + dp_strlcpy(teambuf, " 2", sizeof(teambuf)); else if(cl->colors == 0xCC) // yellow team - strlcpy(teambuf, " 3", sizeof(teambuf)); + dp_strlcpy(teambuf, " 3", sizeof(teambuf)); else if(cl->colors == 0x99) // pink team - strlcpy(teambuf, " 4", sizeof(teambuf)); + dp_strlcpy(teambuf, " 4", sizeof(teambuf)); else - strlcpy(teambuf, " 0", sizeof(teambuf)); + dp_strlcpy(teambuf, " 0", sizeof(teambuf)); } else *teambuf = 0; @@ -2763,7 +2763,7 @@ static const char *RCon_Authenticate(lhnetaddress_t *peeraddress, const char *pa while((userpass_end = strchr(userpass_start, ' '))) { have_usernames = true; - strlcpy(buf, userpass_start, ((size_t)(userpass_end-userpass_start) >= sizeof(buf)) ? (int)(sizeof(buf)) : (int)(userpass_end-userpass_start+1)); + dp_strlcpy(buf, userpass_start, ((size_t)(userpass_end-userpass_start) >= sizeof(buf)) ? (int)(sizeof(buf)) : (int)(userpass_end-userpass_start+1)); if(buf[0]) if(comparator(peeraddress, buf, password, cs, cslen)) goto allow; @@ -2782,7 +2782,7 @@ static const char *RCon_Authenticate(lhnetaddress_t *peeraddress, const char *pa while((userpass_end = strchr(userpass_start, ' '))) { have_usernames = true; - strlcpy(buf, userpass_start, ((size_t)(userpass_end-userpass_start) >= sizeof(buf)) ? (int)(sizeof(buf)) : (int)(userpass_end-userpass_start+1)); + dp_strlcpy(buf, userpass_start, ((size_t)(userpass_end-userpass_start) >= sizeof(buf)) ? (int)(sizeof(buf)) : (int)(userpass_end-userpass_start+1)); if(buf[0]) if(comparator(peeraddress, buf, password, cs, cslen)) goto check; @@ -3369,7 +3369,7 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat { // connect to the client // everything is allocated, just fill in the details - strlcpy (conn->address, addressstring2, sizeof (conn->address)); + dp_strlcpy (conn->address, addressstring2, sizeof (conn->address)); if (developer_extra.integer) Con_DPrintf("Datagram_ParseConnectionless: sending CCREP_ACCEPT to %s.\n", addressstring2); // send back the info about the server connection @@ -3517,8 +3517,8 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat char *s; char *endpos; const char *userlevel; - strlcpy(password, MSG_ReadString(&sv_message, sv_readstring, sizeof(sv_readstring)), sizeof(password)); - strlcpy(cmd, MSG_ReadString(&sv_message, sv_readstring, sizeof(sv_readstring)), sizeof(cmd)); + dp_strlcpy(password, MSG_ReadString(&sv_message, sv_readstring, sizeof(sv_readstring)), sizeof(password)); + dp_strlcpy(cmd, MSG_ReadString(&sv_message, sv_readstring, sizeof(sv_readstring)), sizeof(cmd)); s = cmd; endpos = cmd + strlen(cmd) + 1; // one behind the NUL, so adding strlen+1 will eventually reach it userlevel = RCon_Authenticate(peeraddress, password, s, endpos, plaintext_matching, NULL, 0); diff --git a/prvm_cmds.c b/prvm_cmds.c index ba832b81..eac3cbb5 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -2594,7 +2594,7 @@ void VM_tokenize (prvm_prog_t *prog) VM_SAFEPARMCOUNT(1,VM_tokenize); - strlcpy(tokenize_string, PRVM_G_STRING(OFS_PARM0), sizeof(tokenize_string)); + dp_strlcpy(tokenize_string, PRVM_G_STRING(OFS_PARM0), sizeof(tokenize_string)); p = tokenize_string; num_tokens = 0; @@ -2625,7 +2625,7 @@ void VM_tokenize_console (prvm_prog_t *prog) VM_SAFEPARMCOUNT(1,VM_tokenize); - strlcpy(tokenize_string, PRVM_G_STRING(OFS_PARM0), sizeof(tokenize_string)); + dp_strlcpy(tokenize_string, PRVM_G_STRING(OFS_PARM0), sizeof(tokenize_string)); p = tokenize_string; num_tokens = 0; @@ -2675,7 +2675,7 @@ void VM_tokenizebyseparator (prvm_prog_t *prog) VM_SAFEPARMCOUNTRANGE(2, 8,VM_tokenizebyseparator); - strlcpy(tokenize_string, PRVM_G_STRING(OFS_PARM0), sizeof(tokenize_string)); + dp_strlcpy(tokenize_string, PRVM_G_STRING(OFS_PARM0), sizeof(tokenize_string)); p = tokenize_string; numseparators = 0; @@ -3613,7 +3613,7 @@ void VM_loadfont(prvm_prog_t *prog) if (i >= 0 && i < dp_fonts.maxsize) { f = &dp_fonts.f[i]; - strlcpy(f->title, fontname, sizeof(f->title)); // replace name + dp_strlcpy(f->title, fontname, sizeof(f->title)); // replace name } } if (!f) @@ -3638,7 +3638,7 @@ void VM_loadfont(prvm_prog_t *prog) c = cm; } if(!c || (c - filelist) > MAX_QPATH) - strlcpy(mainfont, filelist, sizeof(mainfont)); + dp_strlcpy(mainfont, filelist, sizeof(mainfont)); else { memcpy(mainfont, filelist, c - filelist); @@ -3665,7 +3665,7 @@ void VM_loadfont(prvm_prog_t *prog) } if(!c || (c-filelist) > MAX_QPATH) { - strlcpy(f->fallbacks[i], filelist, sizeof(mainfont)); + dp_strlcpy(f->fallbacks[i], filelist, sizeof(mainfont)); } else { @@ -4536,7 +4536,7 @@ void VM_altstr_set(prvm_prog_t *prog) if( *in == '\'' || (*in == '\\' && !*++in) ) break; - strlcpy(out, in, outstr + sizeof(outstr) - out); + dp_strlcpy(out, in, outstr + sizeof(outstr) - out); PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString(prog, outstr ); } @@ -4575,7 +4575,7 @@ void VM_altstr_ins(prvm_prog_t *prog) for( ; *set ; *out++ = *set++ ); *out++ = '\''; - strlcpy(out, in, outstr + sizeof(outstr) - out); + dp_strlcpy(out, in, outstr + sizeof(outstr) - out); PRVM_G_INT( OFS_RETURN ) = PRVM_SetTempString(prog, outstr ); } @@ -5363,7 +5363,7 @@ void VM_bufstr_find(prvm_prog_t *prog) match = PRVM_G_STRING(OFS_PARM1); else { - strlcpy(string, PRVM_G_STRING(OFS_PARM1), sizeof(string)); + dp_strlcpy(string, PRVM_G_STRING(OFS_PARM1), sizeof(string)); match = detect_match_rule(string, &matchrule); } matchlen = (int)strlen(match); @@ -5409,7 +5409,7 @@ void VM_matchpattern(prvm_prog_t *prog) match = PRVM_G_STRING(OFS_PARM1); else { - strlcpy(string, PRVM_G_STRING(OFS_PARM1), sizeof(string)); + dp_strlcpy(string, PRVM_G_STRING(OFS_PARM1), sizeof(string)); match = detect_match_rule(string, &matchrule); } @@ -5866,7 +5866,7 @@ void VM_infoadd (prvm_prog_t *prog) key = PRVM_G_STRING(OFS_PARM1); VM_VarString(prog, 2, value, sizeof(value)); - strlcpy(temp, info, VM_STRINGTEMP_LENGTH); + dp_strlcpy(temp, info, VM_STRINGTEMP_LENGTH); InfoString_SetValue(temp, VM_STRINGTEMP_LENGTH, key, value); @@ -6282,7 +6282,7 @@ void VM_uri_get (prvm_prog_t *prog) // POST: we sign postdata \0 query string size_t ll; handle->sigdata = (char *)Z_Malloc(8192); - strlcpy(handle->sigdata, "X-D0-Blind-ID-Detached-Signature: ", 8192); + dp_strlcpy(handle->sigdata, "X-D0-Blind-ID-Detached-Signature: ", 8192); l = strlen(handle->sigdata); handle->siglen = Crypto_SignDataDetached(handle->postdata, handle->postlen + 1 + lq, postkeyid, handle->sigdata + l, 8192 - l); if(!handle->siglen) @@ -6302,7 +6302,7 @@ void VM_uri_get (prvm_prog_t *prog) handle->sigdata[handle->siglen] = 0; } out1: - strlcpy(handle->posttype, posttype, sizeof(handle->posttype)); + dp_strlcpy(handle->posttype, posttype, sizeof(handle->posttype)); ret = Curl_Begin_ToMemory_POST(url, handle->sigdata, 0, handle->posttype, handle->postdata, handle->postlen, (unsigned char *) handle->buffer, sizeof(handle->buffer), uri_to_string_callback, handle); } else @@ -6312,7 +6312,7 @@ out1: // GET: we sign JUST the query string size_t l, ll; handle->sigdata = (char *)Z_Malloc(8192); - strlcpy(handle->sigdata, "X-D0-Blind-ID-Detached-Signature: ", 8192); + dp_strlcpy(handle->sigdata, "X-D0-Blind-ID-Detached-Signature: ", 8192); l = strlen(handle->sigdata); handle->siglen = Crypto_SignDataDetached(query_string, lq, postkeyid, handle->sigdata + l, 8192 - l); if(!handle->siglen) diff --git a/prvm_edict.c b/prvm_edict.c index bc6c5ad5..2bafccd6 100644 --- a/prvm_edict.c +++ b/prvm_edict.c @@ -424,7 +424,7 @@ static char *PRVM_ValueString (prvm_prog_t *prog, etype_t type, prvm_eval_t *val switch (type) { case ev_string: - strlcpy (line, PRVM_GetString (prog, val->string), linelength); + dp_strlcpy (line, PRVM_GetString (prog, val->string), linelength); break; case ev_entity: n = val->edict; @@ -520,7 +520,7 @@ char *PRVM_UglyValueString (prvm_prog_t *prog, etype_t type, prvm_eval_t *val, c break; case ev_function: f = prog->functions + val->function; - strlcpy (line, PRVM_GetString (prog, f->s_name), linelength); + dp_strlcpy (line, PRVM_GetString (prog, f->s_name), linelength); break; case ev_field: def = PRVM_ED_FieldAtOfs ( prog, val->_int ); @@ -906,7 +906,7 @@ void PRVM_ED_ParseGlobals (prvm_prog_t *prog, const char *data) if (developer_entityparsing.integer) Con_Printf("Key: \"%s\"", com_token); - strlcpy (keyname, com_token, sizeof(keyname)); + dp_strlcpy (keyname, com_token, sizeof(keyname)); // parse value if (!COM_ParseToken_Simple(&data, false, true, true)) @@ -1259,7 +1259,7 @@ const char *PRVM_ED_ParseEdict (prvm_prog_t *prog, const char *data, prvm_edict_ // and allow them to be turned into vectors. (FIXME...) if (!strcmp(com_token, "angle")) { - strlcpy (com_token, "angles", sizeof(com_token)); + dp_strlcpy (com_token, "angles", sizeof(com_token)); anglehack = true; } else @@ -1267,9 +1267,9 @@ const char *PRVM_ED_ParseEdict (prvm_prog_t *prog, const char *data, prvm_edict_ // FIXME: change light to _light to get rid of this hack if (!strcmp(com_token, "light")) - strlcpy (com_token, "light_lev", sizeof(com_token)); // hack for single light def + dp_strlcpy (com_token, "light_lev", sizeof(com_token)); // hack for single light def - strlcpy (keyname, com_token, sizeof(keyname)); + dp_strlcpy (keyname, com_token, sizeof(keyname)); // another hack to fix keynames with trailing spaces n = strlen(keyname); @@ -1309,7 +1309,7 @@ const char *PRVM_ED_ParseEdict (prvm_prog_t *prog, const char *data, prvm_edict_ if (anglehack) { char temp[32]; - strlcpy (temp, com_token, sizeof(temp)); + dp_strlcpy (temp, com_token, sizeof(temp)); dpsnprintf (com_token, sizeof(com_token), "0 %s 0", temp); } @@ -1765,7 +1765,7 @@ static po_t *PRVM_PO_Load(const char *filename, const char *filename2, mempool_t break; if((size_t)(q - p) >= (size_t) sizeof(inbuf)) break; - strlcpy(inbuf, p, q - p); // not - 1, because this adds a NUL + dp_strlcpy(inbuf, p, q - p); // not - 1, because this adds a NUL PRVM_PO_ParseString(decodedbuf + decodedpos, inbuf, sizeof(decodedbuf) - decodedpos); decodedpos += strlen(decodedbuf + decodedpos); if(*q == '\r') @@ -2811,7 +2811,7 @@ static void PRVM_Breakpoint_f(void) { debug_data_t *debug = &debug_data[prog - prvm_prog_list]; - strlcpy(debug->break_statement, Cmd_Argv(2), sizeof(debug->break_statement)); + dp_strlcpy(debug->break_statement, Cmd_Argv(2), sizeof(debug->break_statement)); } PRVM_UpdateBreakpoints(prog); } @@ -2840,7 +2840,7 @@ static void PRVM_GlobalWatchpoint_f(void) { debug_data_t *debug = &debug_data[prog - prvm_prog_list]; - strlcpy(debug->watch_global, Cmd_Argv(2), sizeof(debug->watch_global)); + dp_strlcpy(debug->watch_global, Cmd_Argv(2), sizeof(debug->watch_global)); } PRVM_UpdateBreakpoints(prog); } @@ -2870,7 +2870,7 @@ static void PRVM_EdictWatchpoint_f(void) { debug_data_t *debug = &debug_data[prog - prvm_prog_list]; debug->watch_edict = atoi(Cmd_Argv(2)); - strlcpy(debug->watch_field, Cmd_Argv(3), sizeof(debug->watch_field)); + dp_strlcpy(debug->watch_field, Cmd_Argv(3), sizeof(debug->watch_field)); } PRVM_UpdateBreakpoints(prog); } diff --git a/prvm_exec.c b/prvm_exec.c index ad11c113..9cec5a7d 100644 --- a/prvm_exec.c +++ b/prvm_exec.c @@ -259,7 +259,7 @@ void PRVM_ShortStackTrace(prvm_prog_t *prog, char *buf, size_t bufsize) } else { - strlcpy(buf, "", bufsize); + dp_strlcpy(buf, "", bufsize); return; } diff --git a/r_shadow.c b/r_shadow.c index b97ae62d..ed2526a4 100644 --- a/r_shadow.c +++ b/r_shadow.c @@ -3410,7 +3410,7 @@ void R_RTLight_Update(rtlight_t *rtlight, int isstatic, matrix4x4_t *matrix, vec VectorCopy(color, rtlight->color); rtlight->cubemapname[0] = 0; if (cubemapname && cubemapname[0]) - strlcpy(rtlight->cubemapname, cubemapname, sizeof(rtlight->cubemapname)); + dp_strlcpy(rtlight->cubemapname, cubemapname, sizeof(rtlight->cubemapname)); rtlight->shadow = shadow; rtlight->corona = corona; rtlight->style = style; @@ -5393,7 +5393,7 @@ static void R_Shadow_UpdateWorldLight(dlight_t *light, vec3_t origin, vec3_t ang light->style = style; light->shadow = shadowenable; light->corona = corona; - strlcpy(light->cubemapname, cubemapname, sizeof(light->cubemapname)); + dp_strlcpy(light->cubemapname, cubemapname, sizeof(light->cubemapname)); light->coronasizescale = coronasizescale; light->ambientscale = ambientscale; light->diffusescale = diffusescale; @@ -5817,14 +5817,14 @@ void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void) if (com_token[0] == '}') break; // end of entity if (com_token[0] == '_') - strlcpy(key, com_token + 1, sizeof(key)); + dp_strlcpy(key, com_token + 1, sizeof(key)); else - strlcpy(key, com_token, sizeof(key)); + dp_strlcpy(key, com_token, sizeof(key)); while (key[strlen(key)-1] == ' ') // remove trailing spaces key[strlen(key)-1] = 0; if (!COM_ParseToken_Simple(&data, false, false, true)) break; // error - strlcpy(value, com_token, sizeof(value)); + dp_strlcpy(value, com_token, sizeof(value)); // now that we have the key pair worked out... if (!strcmp("light", key)) @@ -6036,7 +6036,7 @@ void R_Shadow_EditLights_Reload_f(void) { if (!cl.worldmodel) return; - strlcpy(r_shadow_mapname, cl.worldname, sizeof(r_shadow_mapname)); + dp_strlcpy(r_shadow_mapname, cl.worldname, sizeof(r_shadow_mapname)); R_Shadow_ClearWorldLights(); if (r_shadow_realtime_world_importlightentitiesfrommap.integer <= 1) { @@ -6109,7 +6109,7 @@ static void R_Shadow_EditLights_Edit_f(void) radius = r_shadow_selectedlight->radius; style = r_shadow_selectedlight->style; if (r_shadow_selectedlight->cubemapname) - strlcpy(cubemapname, r_shadow_selectedlight->cubemapname, sizeof(cubemapname)); + dp_strlcpy(cubemapname, r_shadow_selectedlight->cubemapname, sizeof(cubemapname)); else cubemapname[0] = 0; shadows = r_shadow_selectedlight->shadow; @@ -6313,7 +6313,7 @@ static void R_Shadow_EditLights_Edit_f(void) return; } if (Cmd_Argc() == 3) - strlcpy(cubemapname, Cmd_Argv(2), sizeof(cubemapname)); + dp_strlcpy(cubemapname, Cmd_Argv(2), sizeof(cubemapname)); else cubemapname[0] = 0; } @@ -6633,7 +6633,7 @@ static void R_Shadow_EditLights_CopyInfo_f(void) r_shadow_bufferlight.radius = r_shadow_selectedlight->radius; r_shadow_bufferlight.style = r_shadow_selectedlight->style; if (r_shadow_selectedlight->cubemapname) - strlcpy(r_shadow_bufferlight.cubemapname, r_shadow_selectedlight->cubemapname, sizeof(r_shadow_bufferlight.cubemapname)); + dp_strlcpy(r_shadow_bufferlight.cubemapname, r_shadow_selectedlight->cubemapname, sizeof(r_shadow_bufferlight.cubemapname)); else r_shadow_bufferlight.cubemapname[0] = 0; r_shadow_bufferlight.shadow = r_shadow_selectedlight->shadow; diff --git a/r_sky.c b/r_sky.c index 97b2dafe..d682916b 100644 --- a/r_sky.c +++ b/r_sky.c @@ -153,7 +153,7 @@ int R_SetSkyBox(const char *sky) return false; } - strlcpy(skyname, sky, sizeof(skyname)); + dp_strlcpy(skyname, sky, sizeof(skyname)); return R_LoadSkyBox(); } diff --git a/sbar.c b/sbar.c index 9cc3b870..9b591dc9 100644 --- a/sbar.c +++ b/sbar.c @@ -605,7 +605,7 @@ void Sbar_SortFrags (void) teamname = "Total Team Score"; break; } - strlcpy(teams[teamlines-1].name, teamname, sizeof(teams[teamlines-1].name)); + dp_strlcpy(teams[teamlines-1].name, teamname, sizeof(teams[teamlines-1].name)); teams[teamlines-1].frags = 0; teams[teamlines-1].colors = color + 16 * color; @@ -1136,12 +1136,12 @@ void Sbar_ShowFPS(void) } if (showtime.integer) { - strlcpy(timestring, Sys_TimeString(showtime_format.string), sizeof(timestring)); + dp_strlcpy(timestring, Sys_TimeString(showtime_format.string), sizeof(timestring)); fps_strings++; } if (showdate.integer) { - strlcpy(datestring, Sys_TimeString(showdate_format.string), sizeof(datestring)); + dp_strlcpy(datestring, Sys_TimeString(showdate_format.string), sizeof(datestring)); fps_strings++; } if (showblur.integer) @@ -1207,9 +1207,9 @@ void Sbar_ShowFPS(void) // probably needs adding a new SUPERCONTENTS type trace = CL_TraceLine(org, dest, MOVE_NORMAL, NULL, SUPERCONTENTS_SOLID, collision_extendmovelength.value, true, false, NULL, true, true); if(trace.hittexture) - strlcpy(texstring, trace.hittexture->name, sizeof(texstring)); + dp_strlcpy(texstring, trace.hittexture->name, sizeof(texstring)); else - strlcpy(texstring, "(no texture hit)", sizeof(texstring)); + dp_strlcpy(texstring, "(no texture hit)", sizeof(texstring)); fps_strings++; } if (fps_strings) diff --git a/snd_3dras.c b/snd_3dras.c index 0619796a..bd10823b 100644 --- a/snd_3dras.c +++ b/snd_3dras.c @@ -254,7 +254,7 @@ static void S_Play_Common (float fvol, float attenuation){ while (i < Cmd_Argc ()) { // Get the name, and appends ".wav" as an extension if there's none - strlcpy (name, Cmd_Argv (i), sizeof (name)); + dp_strlcpy (name, Cmd_Argv (i), sizeof (name)); if (!strrchr (name, '.')) strlcat (name, ".wav", sizeof (name)); i++; @@ -581,7 +581,7 @@ sfx_t* S_FindName (const char *name){ now->rasptr=0; //sfx->looptstart=0; //sfx->total_length=0; - strlcpy (now->name, name, sizeof (now->name)); + dp_strlcpy (now->name, name, sizeof (now->name)); return now; } return NULL; diff --git a/snd_main.c b/snd_main.c index d54267bd..af9f2e3a 100644 --- a/snd_main.c +++ b/snd_main.c @@ -273,7 +273,7 @@ static void S_Play_Common (float fvol, float attenuation) while (i < Cmd_Argc ()) { // Get the name, and appends ".wav" as an extension if there's none - strlcpy (name, Cmd_Argv (i), sizeof (name)); + dp_strlcpy (name, Cmd_Argv (i), sizeof (name)); if (!strrchr (name, '.')) strlcat (name, ".wav", sizeof (name)); i++; @@ -1010,7 +1010,7 @@ sfx_t *S_FindName (const char *name) // Add a sfx_t struct for this sound sfx = (sfx_t *)Mem_Alloc (snd_mempool, sizeof (*sfx)); memset (sfx, 0, sizeof(*sfx)); - strlcpy (sfx->name, name, sizeof (sfx->name)); + dp_strlcpy (sfx->name, name, sizeof (sfx->name)); sfx->memsize = sizeof(*sfx); sfx->next = known_sfx; known_sfx = sfx; diff --git a/sv_demo.c b/sv_demo.c index 9a9cc164..b1917e8c 100644 --- a/sv_demo.c +++ b/sv_demo.c @@ -11,7 +11,7 @@ void SV_StartDemoRecording(client_t *client, const char *filename, int forcetrac if(client->sv_demo_file != NULL) return; // we already have a demo - strlcpy(name, filename, sizeof(name)); + dp_strlcpy(name, filename, sizeof(name)); FS_DefaultExtension(name, ".dem", sizeof(name)); Con_Printf("Recording demo for # %d (%s) to %s\n", PRVM_NUM_FOR_EDICT(client->edict), client->netaddress, name); diff --git a/sv_main.c b/sv_main.c index f1f1248a..95009b52 100644 --- a/sv_main.c +++ b/sv_main.c @@ -1097,8 +1097,8 @@ void SV_ConnectClient (int clientnum, netconn_t *netconnection) ); } - strlcpy(client->name, "unconnected", sizeof(client->name)); - strlcpy(client->old_name, "unconnected", sizeof(client->old_name)); + dp_strlcpy(client->name, "unconnected", sizeof(client->name)); + dp_strlcpy(client->old_name, "unconnected", sizeof(client->old_name)); client->prespawned = false; client->spawned = false; client->begun = false; @@ -2024,7 +2024,7 @@ void SV_WriteClientdataToMessage (client_t *client, prvm_edict_t *ent, sizebuf_t s = PRVM_GetString(prog, PRVM_serveredictstring(ent, weaponmodel)); if (strcmp(s, client->weaponmodel)) { - strlcpy(client->weaponmodel, s, sizeof(client->weaponmodel)); + dp_strlcpy(client->weaponmodel, s, sizeof(client->weaponmodel)); client->weaponmodelindex = SV_ModelIndex(s, 1); } @@ -2479,15 +2479,15 @@ static void SV_UpdateToReliableMessages (void) if (name == NULL) name = ""; // always point the string back at host_client->name to keep it safe - //strlcpy (host_client->name, name, sizeof (host_client->name)); + //dp_strlcpy (host_client->name, name, sizeof (host_client->name)); if (name != host_client->name) // prevent buffer overlap SIGABRT on Mac OSX - strlcpy (host_client->name, name, sizeof (host_client->name)); + dp_strlcpy (host_client->name, name, sizeof (host_client->name)); PRVM_serveredictstring(host_client->edict, netname) = PRVM_SetEngineString(prog, host_client->name); if (strcmp(host_client->old_name, host_client->name)) { if (host_client->begun) SV_BroadcastPrintf("%s ^7changed name to %s\n", host_client->old_name, host_client->name); - strlcpy(host_client->old_name, host_client->name, sizeof(host_client->old_name)); + dp_strlcpy(host_client->old_name, host_client->name, sizeof(host_client->old_name)); // send notification to all clients MSG_WriteByte (&sv.reliable_datagram, svc_updatename); MSG_WriteByte (&sv.reliable_datagram, i); @@ -2511,9 +2511,9 @@ static void SV_UpdateToReliableMessages (void) if (model == NULL) model = ""; // always point the string back at host_client->name to keep it safe - //strlcpy (host_client->playermodel, model, sizeof (host_client->playermodel)); + //dp_strlcpy (host_client->playermodel, model, sizeof (host_client->playermodel)); if (model != host_client->playermodel) // prevent buffer overlap SIGABRT on Mac OSX - strlcpy (host_client->playermodel, model, sizeof (host_client->playermodel)); + dp_strlcpy (host_client->playermodel, model, sizeof (host_client->playermodel)); PRVM_serveredictstring(host_client->edict, playermodel) = PRVM_SetEngineString(prog, host_client->playermodel); // NEXUIZ_PLAYERSKIN @@ -2521,9 +2521,9 @@ static void SV_UpdateToReliableMessages (void) if (skin == NULL) skin = ""; // always point the string back at host_client->name to keep it safe - //strlcpy (host_client->playerskin, skin, sizeof (host_client->playerskin)); + //dp_strlcpy (host_client->playerskin, skin, sizeof (host_client->playerskin)); if (skin != host_client->playerskin) // prevent buffer overlap SIGABRT on Mac OSX - strlcpy (host_client->playerskin, skin, sizeof (host_client->playerskin)); + dp_strlcpy (host_client->playerskin, skin, sizeof (host_client->playerskin)); PRVM_serveredictstring(host_client->edict, playerskin) = PRVM_SetEngineString(prog, host_client->playerskin); // TODO: add an extension name for this [1/17/2008 Black] @@ -2701,7 +2701,7 @@ static void SV_Download_f(void) Download_CheckExtensions(); - strlcpy(host_client->download_name, Cmd_Argv(1), sizeof(host_client->download_name)); + dp_strlcpy(host_client->download_name, Cmd_Argv(1), sizeof(host_client->download_name)); extension = FS_FileExtension(host_client->download_name); // host_client is asking to download a specified file @@ -2869,7 +2869,7 @@ int SV_ModelIndex(const char *s, int precachemode) // testing //if (precachemode == 2) // return 0; - strlcpy(filename, s, sizeof(filename)); + dp_strlcpy(filename, s, sizeof(filename)); for (i = 2;i < limit;i++) { if (!sv.model_precache[i][0]) @@ -2883,7 +2883,7 @@ int SV_ModelIndex(const char *s, int precachemode) } if (precachemode == 1) Con_Printf("SV_ModelIndex(\"%s\"): not precached (fix your code), precaching anyway\n", filename); - strlcpy(sv.model_precache[i], filename, sizeof(sv.model_precache[i])); + dp_strlcpy(sv.model_precache[i], filename, sizeof(sv.model_precache[i])); if (sv.state == ss_loading) { // running from SV_SpawnServer which is launched from the client console command interpreter @@ -2932,7 +2932,7 @@ int SV_SoundIndex(const char *s, int precachemode) // testing //if (precachemode == 2) // return 0; - strlcpy(filename, s, sizeof(filename)); + dp_strlcpy(filename, s, sizeof(filename)); for (i = 1;i < limit;i++) { if (!sv.sound_precache[i][0]) @@ -2946,7 +2946,7 @@ int SV_SoundIndex(const char *s, int precachemode) } if (precachemode == 1) Con_Printf("SV_SoundIndex(\"%s\"): not precached (fix your code), precaching anyway\n", filename); - strlcpy(sv.sound_precache[i], filename, sizeof(sv.sound_precache[i])); + dp_strlcpy(sv.sound_precache[i], filename, sizeof(sv.sound_precache[i])); if (sv.state != ss_loading) { MSG_WriteByte(&sv.reliable_datagram, svc_precache); @@ -2987,7 +2987,7 @@ int SV_ParticleEffectIndex(const char *name) sv.particleeffectnamesloaded = true; memset(sv.particleeffectname, 0, sizeof(sv.particleeffectname)); for (i = 0;i < EFFECT_TOTAL;i++) - strlcpy(sv.particleeffectname[i], standardeffectnames[i], sizeof(sv.particleeffectname[i])); + dp_strlcpy(sv.particleeffectname[i], standardeffectnames[i], sizeof(sv.particleeffectname[i])); for (filepass = 0;;filepass++) { if (filepass == 0) @@ -3011,7 +3011,7 @@ int SV_ParticleEffectIndex(const char *name) break; if (argc < 16) { - strlcpy(argv[argc], com_token, sizeof(argv[argc])); + dp_strlcpy(argv[argc], com_token, sizeof(argv[argc])); argc++; } } @@ -3032,7 +3032,7 @@ int SV_ParticleEffectIndex(const char *name) } else { - strlcpy(sv.particleeffectname[effectnameindex], argv[1], sizeof(sv.particleeffectname[effectnameindex])); + dp_strlcpy(sv.particleeffectname[effectnameindex], argv[1], sizeof(sv.particleeffectname[effectnameindex])); break; } } @@ -3185,7 +3185,7 @@ static void SV_Prepare_CSQC(void) sv.csqc_progsize = (int)progsize; sv.csqc_progcrc = CRC_Block(svs.csqc_progdata, progsize); - strlcpy(sv.csqc_progname, csqc_progname.string, sizeof(sv.csqc_progname)); + dp_strlcpy(sv.csqc_progname, csqc_progname.string, sizeof(sv.csqc_progname)); Con_DPrintf("server detected csqc progs file \"%s\" with size %i and crc %i\n", sv.csqc_progname, sv.csqc_progsize, sv.csqc_progcrc); Con_DPrint("Compressing csprogs.dat\n"); @@ -3369,10 +3369,10 @@ void SV_SpawnServer (const char *server) sv.active = true; // set level base name variables for later use - strlcpy (sv.name, server, sizeof (sv.name)); - strlcpy(sv.worldname, modelname, sizeof(sv.worldname)); + dp_strlcpy (sv.name, server, sizeof (sv.name)); + dp_strlcpy(sv.worldname, modelname, sizeof(sv.worldname)); FS_StripExtension(sv.worldname, sv.worldnamenoextension, sizeof(sv.worldnamenoextension)); - strlcpy(sv.worldbasename, !strncmp(sv.worldnamenoextension, "maps/", 5) ? sv.worldnamenoextension + 5 : sv.worldnamenoextension, sizeof(sv.worldbasename)); + dp_strlcpy(sv.worldbasename, !strncmp(sv.worldnamenoextension, "maps/", 5) ? sv.worldnamenoextension + 5 : sv.worldnamenoextension, sizeof(sv.worldbasename)); //Cvar_SetQuick(&sv_worldmessage, sv.worldmessage); // set later after QC is spawned Cvar_SetQuick(&sv_worldname, sv.worldname); Cvar_SetQuick(&sv_worldnamenoextension, sv.worldnamenoextension); @@ -3423,10 +3423,10 @@ void SV_SpawnServer (const char *server) World_SetSize(&sv.world, sv.worldname, sv.worldmodel->normalmins, sv.worldmodel->normalmaxs, prog); World_Start(&sv.world); - strlcpy(sv.sound_precache[0], "", sizeof(sv.sound_precache[0])); + dp_strlcpy(sv.sound_precache[0], "", sizeof(sv.sound_precache[0])); - strlcpy(sv.model_precache[0], "", sizeof(sv.model_precache[0])); - strlcpy(sv.model_precache[1], sv.worldname, sizeof(sv.model_precache[1])); + dp_strlcpy(sv.model_precache[0], "", sizeof(sv.model_precache[0])); + dp_strlcpy(sv.model_precache[1], sv.worldname, sizeof(sv.model_precache[1])); for (i = 1;i < sv.worldmodel->brush.numsubmodels && i+1 < MAX_MODELS;i++) { dpsnprintf(sv.model_precache[i+1], sizeof(sv.model_precache[i+1]), "*%i", i); @@ -3536,7 +3536,7 @@ void SV_SpawnServer (const char *server) } // update the map title cvar - strlcpy(sv.worldmessage, PRVM_GetString(prog, PRVM_serveredictstring(prog->edicts, message)), sizeof(sv.worldmessage)); // map title (not related to filename) + dp_strlcpy(sv.worldmessage, PRVM_GetString(prog, PRVM_serveredictstring(prog->edicts, message)), sizeof(sv.worldmessage)); // map title (not related to filename) Cvar_SetQuick(&sv_worldmessage, sv.worldmessage); Con_DPrint("Server spawned.\n"); diff --git a/svvm_cmds.c b/svvm_cmds.c index ff55c4fd..fc94a7de 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -1226,7 +1226,7 @@ static void VM_SV_lightstyle(prvm_prog_t *prog) } // change the string in sv - strlcpy(sv.lightstyles[style], val, sizeof(sv.lightstyles[style])); + dp_strlcpy(sv.lightstyles[style], val, sizeof(sv.lightstyles[style])); // send message to all clients on this server if (sv.state != ss_active) @@ -1659,7 +1659,7 @@ void VM_SV_UpdateCustomStats (client_t *client, prvm_edict_t *ent, sizebuf_t *ms //string as 16 bytes case 1: memset(s, 0, 17); - strlcpy(s, PRVM_E_STRING(ent, vm_customstats[i].fieldoffset), 16); + dp_strlcpy(s, PRVM_E_STRING(ent, vm_customstats[i].fieldoffset), 16); stats[i+32] = s[ 0] + s[ 1] * 256 + s[ 2] * 65536 + s[ 3] * 16777216; stats[i+33] = s[ 4] + s[ 5] * 256 + s[ 6] * 65536 + s[ 7] * 16777216; stats[i+34] = s[ 8] + s[ 9] * 256 + s[10] * 65536 + s[11] * 16777216; diff --git a/sys_sdl.c b/sys_sdl.c index 228c0a49..93afa7a4 100644 --- a/sys_sdl.c +++ b/sys_sdl.c @@ -176,7 +176,7 @@ char *Sys_GetClipboardData (void) size_t allocsize; allocsize = GlobalSize (hClipboardData) + 1; data = (char *)Z_Malloc (allocsize); - strlcpy (data, cliptext, allocsize); + dp_strlcpy (data, cliptext, allocsize); GlobalUnlock (hClipboardData); } } diff --git a/sys_shared.c b/sys_shared.c index 03c05985..d1668f70 100644 --- a/sys_shared.c +++ b/sys_shared.c @@ -167,12 +167,12 @@ notfound: if (!dllhandle && strrchr(com_argv[0], '/')) { char path[MAX_OSPATH]; - strlcpy(path, com_argv[0], sizeof(path)); + dp_strlcpy(path, com_argv[0], sizeof(path)); strrchr(path, '/')[1] = 0; for (i = 0; dllnames[i] != NULL; i++) { char temp[MAX_OSPATH]; - strlcpy(temp, path, sizeof(temp)); + dp_strlcpy(temp, path, sizeof(temp)); strlcat(temp, dllnames[i], sizeof(temp)); Con_DPrintf (" \"%s\"", temp); #ifdef WIN32 diff --git a/sys_win.c b/sys_win.c index de1f4718..4b0203b9 100644 --- a/sys_win.c +++ b/sys_win.c @@ -216,7 +216,7 @@ char *Sys_GetClipboardData (void) size_t allocsize; allocsize = GlobalSize (hClipboardData) + 1; data = (char *)Z_Malloc (allocsize); - strlcpy (data, cliptext, allocsize); + dp_strlcpy (data, cliptext, allocsize); GlobalUnlock (hClipboardData); } } diff --git a/vid_agl.c b/vid_agl.c index bacbb5ff..9a175843 100644 --- a/vid_agl.c +++ b/vid_agl.c @@ -370,7 +370,7 @@ static int GL_OpenLibrary(void) Con_Printf("Unable to open symbol list for %s\n", name); return false; } - strlcpy(gl_driver, name, sizeof(gl_driver)); + dp_strlcpy(gl_driver, name, sizeof(gl_driver)); Con_Printf("Loading OpenGL driver %s\n", name2); if (!(cglobj = dlopen(name2, RTLD_LAZY))) diff --git a/vid_glx.c b/vid_glx.c index 8327b260..e6b88bf7 100644 --- a/vid_glx.c +++ b/vid_glx.c @@ -834,7 +834,7 @@ static int GL_OpenLibrary(const char *name) Con_Printf("Unable to open symbol list for %s\n", name); return false; } - strlcpy(gl_driver, name, sizeof(gl_driver)); + dp_strlcpy(gl_driver, name, sizeof(gl_driver)); return true; } diff --git a/vid_wgl.c b/vid_wgl.c index 24379fbf..23e85616 100644 --- a/vid_wgl.c +++ b/vid_wgl.c @@ -760,7 +760,7 @@ static int GL_OpenLibrary(const char *name) Con_Printf("Unable to LoadLibrary %s\n", name); return false; } - strlcpy(gl_driver, name, sizeof(gl_driver)); + dp_strlcpy(gl_driver, name, sizeof(gl_driver)); return true; } diff --git a/world.c b/world.c index 60bd0937..743544eb 100644 --- a/world.c +++ b/world.c @@ -106,7 +106,7 @@ void World_SetSize(world_t *world, const char *filename, const vec3_t mins, cons { int i; - strlcpy(world->filename, filename, sizeof(world->filename)); + dp_strlcpy(world->filename, filename, sizeof(world->filename)); VectorCopy(mins, world->mins); VectorCopy(maxs, world->maxs); world->prog = prog; diff --git a/zone.c b/zone.c index fe80693c..ddf618d4 100644 --- a/zone.c +++ b/zone.c @@ -527,7 +527,7 @@ mempool_t *_Mem_AllocPool(const char *name, int flags, mempool_t *parent, const pool->chain = NULL; pool->totalsize = 0; pool->realsize = sizeof(mempool_t); - strlcpy (pool->name, name, sizeof (pool->name)); + dp_strlcpy (pool->name, name, sizeof (pool->name)); pool->parent = parent; pool->next = poolchain; poolchain = pool; @@ -879,7 +879,7 @@ char* Mem_strdup (mempool_t *pool, const char* s) return NULL; sz = strlen (s) + 1; p = (char*)Mem_Alloc (pool, sz); - strlcpy (p, s, sz); + dp_strlcpy (p, s, sz); return p; }