]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
com: rename BSD strlcpy and strlcat
authorbones_was_here <bones_was_here@xonotic.au>
Fri, 15 Dec 2023 10:16:15 +0000 (20:16 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Sat, 20 Jan 2024 09:42:07 +0000 (19:42 +1000)
The C standard reserves str* and mem* for the implementation.
Checking for BSD or OS X is not a robust way to determine if libc
provides these (eg glibc may implement them).

Signed-off-by: bones_was_here <bones_was_here@xonotic.au>
59 files changed:
cd_shared.c
cl_cmd.c
cl_demo.c
cl_input.c
cl_main.c
cl_parse.c
cl_particles.c
cl_screen.c
cl_video.c
cl_video_jamdecode.c
cl_video_libavw.c
clvm_cmds.c
cmd.c
com_game.c
com_infostring.c
common.c
common.h
console.c
crypto.c
csprogs.c
dpvsimpledecode.c
filematch.c
fs.c
ft2.c
gl_backend.c
gl_draw.c
gl_rmain.c
gl_textures.c
host.c
image.c
jpeg.c
keys.c
libcurl.c
menu.c
model_alias.c
model_brush.c
model_shared.c
mvm_cmds.c
netconn.c
protocol.c
prvm_cmds.c
prvm_edict.c
prvm_exec.c
r_shadow.c
r_sky.c
r_stats.c
sbar.c
snd_main.c
sv_ccmds.c
sv_demo.c
sv_main.c
sv_save.c
sv_send.c
svvm_cmds.c
sys_sdl.c
sys_shared.c
vid_shared.c
world.c
zone.c

index 88551e0a43ee6fa7d16844dd7ae3e13f3d0c30ba..389675f80395cf66dceede7da6c3fde86ea1f9d5 100644 (file)
@@ -321,7 +321,7 @@ static void CD_f(cmd_state_t *cmd)
                        return;
                }
                for (n = 1; n <= ret; n++)
-                       strlcpy(remap[n], Cmd_Argv(cmd, n+1), sizeof(*remap));
+                       dp_strlcpy(remap[n], Cmd_Argv(cmd, n+1), sizeof(*remap));
 #endif
                return;
        }
@@ -473,7 +473,7 @@ static void CDAudio_StartPlaylist(qbool 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)
@@ -503,7 +503,7 @@ static void CDAudio_StartPlaylist(qbool resume)
                                                break;
                                        if (listindex == current)
                                        {
-                                               strlcpy(trackname, com_token, sizeof(trackname));
+                                               dp_strlcpy(trackname, com_token, sizeof(trackname));
                                                break;
                                        }
                                }
index 4bbd8ea9e5a7d629fd097688ae94efd1e5121509..681b83c1642340be0b5d1b965dd177f354b855c8 100644 (file)
--- a/cl_cmd.c
+++ b/cl_cmd.c
@@ -113,40 +113,40 @@ void CL_ForwardToServer (const char *s)
                                        if (cl.stats[STAT_ITEMS] & IT_QUAD)
                                        {
                                                if (temp[0])
-                                                       strlcat(temp, " ", sizeof(temp));
-                                               strlcat(temp, "quad", sizeof(temp));
+                                                       dp_strlcat(temp, " ", sizeof(temp));
+                                               dp_strlcat(temp, "quad", sizeof(temp));
                                        }
                                        if (cl.stats[STAT_ITEMS] & IT_INVULNERABILITY)
                                        {
                                                if (temp[0])
-                                                       strlcat(temp, " ", sizeof(temp));
-                                               strlcat(temp, "pent", sizeof(temp));
+                                                       dp_strlcat(temp, " ", sizeof(temp));
+                                               dp_strlcat(temp, "pent", sizeof(temp));
                                        }
                                        if (cl.stats[STAT_ITEMS] & IT_INVISIBILITY)
                                        {
                                                if (temp[0])
-                                                       strlcat(temp, " ", sizeof(temp));
-                                               strlcat(temp, "eyes", sizeof(temp));
+                                                       dp_strlcat(temp, " ", sizeof(temp));
+                                               dp_strlcat(temp, "eyes", sizeof(temp));
                                        }
                                        break;
                                case 'w': // weapon status (outputs "SSG:NG:SNG:GL:RL:LG" with the text between : characters omitted if you lack the weapon)
                                        if (cl.stats[STAT_ITEMS] & IT_SUPER_SHOTGUN)
-                                               strlcat(temp, "SSG", sizeof(temp));
-                                       strlcat(temp, ":", sizeof(temp));
+                                               dp_strlcat(temp, "SSG", sizeof(temp));
+                                       dp_strlcat(temp, ":", sizeof(temp));
                                        if (cl.stats[STAT_ITEMS] & IT_NAILGUN)
-                                               strlcat(temp, "NG", sizeof(temp));
-                                       strlcat(temp, ":", sizeof(temp));
+                                               dp_strlcat(temp, "NG", sizeof(temp));
+                                       dp_strlcat(temp, ":", sizeof(temp));
                                        if (cl.stats[STAT_ITEMS] & IT_SUPER_NAILGUN)
-                                               strlcat(temp, "SNG", sizeof(temp));
-                                       strlcat(temp, ":", sizeof(temp));
+                                               dp_strlcat(temp, "SNG", sizeof(temp));
+                                       dp_strlcat(temp, ":", sizeof(temp));
                                        if (cl.stats[STAT_ITEMS] & IT_GRENADE_LAUNCHER)
-                                               strlcat(temp, "GL", sizeof(temp));
-                                       strlcat(temp, ":", sizeof(temp));
+                                               dp_strlcat(temp, "GL", sizeof(temp));
+                                       dp_strlcat(temp, ":", sizeof(temp));
                                        if (cl.stats[STAT_ITEMS] & IT_ROCKET_LAUNCHER)
-                                               strlcat(temp, "RL", sizeof(temp));
-                                       strlcat(temp, ":", sizeof(temp));
+                                               dp_strlcat(temp, "RL", sizeof(temp));
+                                       dp_strlcat(temp, ":", sizeof(temp));
                                        if (cl.stats[STAT_ITEMS] & IT_LIGHTNING)
-                                               strlcat(temp, "LG", sizeof(temp));
+                                               dp_strlcat(temp, "LG", sizeof(temp));
                                        break;
                                default:
                                        // not a recognized macro, print it as-is...
@@ -592,7 +592,7 @@ static void CL_Rcon_f(cmd_state_t *cmd) // credit: taken from QuakeWorld
                        ++cls.rcon_trying;
                        if(i >= MAX_RCONS)
                                NetConn_WriteString(mysocket, "\377\377\377\377getchallenge", &cls.rcon_address); // otherwise we'll request the challenge later
-                       strlcpy(cls.rcon_commands[cls.rcon_ringpos], Cmd_Args(cmd), sizeof(cls.rcon_commands[cls.rcon_ringpos]));
+                       dp_strlcpy(cls.rcon_commands[cls.rcon_ringpos], Cmd_Args(cmd), sizeof(cls.rcon_commands[cls.rcon_ringpos]));
                        cls.rcon_addresses[cls.rcon_ringpos] = cls.rcon_address;
                        cls.rcon_timeout[cls.rcon_ringpos] = host.realtime + rcon_secure_challengetimeout.value;
                        cls.rcon_ringpos = (cls.rcon_ringpos + 1) % MAX_RCONS;
@@ -606,7 +606,7 @@ static void CL_Rcon_f(cmd_state_t *cmd) // 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), &cls.rcon_address);
                        }
                }
@@ -637,7 +637,7 @@ static void CL_FullServerinfo_f(cmd_state_t *cmd) // credit: taken from QuakeWor
                return;
        }
 
-       strlcpy (cl.qw_serverinfo, Cmd_Argv(cmd, 1), sizeof(cl.qw_serverinfo));
+       dp_strlcpy (cl.qw_serverinfo, Cmd_Argv(cmd, 1), sizeof(cl.qw_serverinfo));
        InfoString_GetValue(cl.qw_serverinfo, "teamplay", temp, sizeof(temp));
        cl.qw_teamplay = atoi(temp);
 }
@@ -671,7 +671,7 @@ static void CL_FullInfo_f(cmd_state_t *cmd) // 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)
                {
@@ -684,7 +684,7 @@ static void CL_FullInfo_f(cmd_state_t *cmd) // 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);
 
index 268e66dd87ed7cdf3bc34fff6e6c1468c71e8233..e67c1ab60dde9a3c19cdc3ee0d562566c5f6ec4c 100644 (file)
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -381,7 +381,7 @@ void CL_Record_f(cmd_state_t *cmd)
                track = -1;
 
        // get the demo name
-       strlcpy (name, Cmd_Argv(cmd, 1), sizeof (name));
+       dp_strlcpy (name, Cmd_Argv(cmd, 1), sizeof (name));
        FS_DefaultExtension (name, ".dem", sizeof (name));
 
        // start the map up
@@ -396,7 +396,7 @@ void CL_Record_f(cmd_state_t *cmd)
                Con_Print(CON_ERROR "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);
@@ -414,7 +414,7 @@ void CL_PlayDemo(const char *demo)
        qfile_t *f;
 
        // open the demo file
-       strlcpy (name, demo, sizeof (name));
+       dp_strlcpy (name, demo, sizeof (name));
        FS_DefaultExtension (name, ".dem", sizeof (name));
        f = FS_OpenVirtualFile(name, false);
        if (!f)
@@ -436,7 +436,7 @@ void CL_PlayDemo(const char *demo)
 
        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;
@@ -662,7 +662,7 @@ static void CL_Startdemos_f(cmd_state_t *cmd)
        Con_DPrintf("%i demo(s) in loop\n", c);
 
        for (i=1 ; i<c+1 ; i++)
-               strlcpy (cls.demos[i-1], Cmd_Argv(cmd, i), sizeof (cls.demos[i-1]));
+               dp_strlcpy (cls.demos[i-1], Cmd_Argv(cmd, i), sizeof (cls.demos[i-1]));
 
        // LadyHavoc: clear the remaining slots
        for (;i <= MAX_DEMOS;i++)
index 505bc1a29555fdbd134e935abd82d9e37afa35ce..8e0e96f600ea9ed3a1676ec85cdb1240ce7492b1 100644 (file)
@@ -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;
index 7dffe2c8a46db87ae24e7d4065b397a45ec277a3..6a69648eb0a54de5e3916c7388b1dfc7b951e05a 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -455,7 +455,7 @@ void CL_DisconnectEx(qbool kicked, const char *fmt, ... )
                if(fmt && reason[0] != '\0')
                        dpsnprintf(cl_connect_status, sizeof(cl_connect_status), "Disconnect: %s", reason);
                else
-                       strlcpy(cl_connect_status, "Disconnected", sizeof(cl_connect_status));
+                       dp_strlcpy(cl_connect_status, "Disconnected", sizeof(cl_connect_status));
                Con_Printf("%s\n", cl_connect_status);
        }
        cls.state = ca_disconnected;
@@ -602,13 +602,13 @@ void CL_EstablishConnection(const char *address, int firstarg)
                        *cls.connect_userinfo = 0;
                }
 
-               strlcpy(cl_connect_status, "Connect: pending...", sizeof(cl_connect_status));
+               dp_strlcpy(cl_connect_status, "Connect: pending...", sizeof(cl_connect_status));
                SCR_BeginLoadingPlaque(false);
        }
        else
        {
                Con_Printf(CON_ERROR "Connect: failed, unable to find a network socket suitable to reach %s\n", address);
-               strlcpy(cl_connect_status, "Connect: failed, no network", sizeof(cl_connect_status));
+               dp_strlcpy(cl_connect_status, "Connect: failed, no network", sizeof(cl_connect_status));
        }
 }
 
@@ -890,7 +890,7 @@ void CL_AllocLightFlash(entity_render_t *ent, matrix4x4_t *matrix, float radius,
                dl->die = 0;
        dl->cubemapname[0] = 0;
        if (cubemapname && cubemapname[0])
-               strlcpy(dl->cubemapname, cubemapname, sizeof(dl->cubemapname));
+               dp_strlcpy(dl->cubemapname, cubemapname, sizeof(dl->cubemapname));
        dl->style = style;
        dl->shadow = shadowenable;
        dl->corona = corona;
@@ -2160,7 +2160,7 @@ static void CL_Fog_HeightTexture_f(cmd_state_t *cmd)
        r_refdef.fog_end = atof(Cmd_Argv(cmd, 7));
        r_refdef.fog_height = atof(Cmd_Argv(cmd, 8));
        r_refdef.fog_fadedepth = atof(Cmd_Argv(cmd, 9));
-       strlcpy(r_refdef.fog_height_texturename, Cmd_Argv(cmd, 10), sizeof(r_refdef.fog_height_texturename));
+       dp_strlcpy(r_refdef.fog_height_texturename, Cmd_Argv(cmd, 10), sizeof(r_refdef.fog_height_texturename));
 }
 
 
@@ -2225,7 +2225,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]);
 }
index d9c8fb1775cae277a503b2e3cd6fe394411db29d..f2ec8630be6625a9409001b8ecc4c25051b1fc48 100644 (file)
@@ -403,14 +403,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;
@@ -487,9 +487,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);
@@ -561,7 +561,7 @@ static qbool 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)
@@ -838,7 +838,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);
@@ -873,7 +873,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);
@@ -987,7 +987,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
 }
 
@@ -1003,7 +1003,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);
 }
@@ -1014,8 +1014,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");
@@ -1031,8 +1031,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));
@@ -1530,7 +1530,7 @@ static void CL_DownloadBegin_f(cmd_state_t *cmd)
        CL_StopDownload(0, 0);
 
        // we're really beginning a download now, so initialize stuff
-       strlcpy(cls.qw_downloadname, Cmd_Argv(cmd, 2), sizeof(cls.qw_downloadname));
+       dp_strlcpy(cls.qw_downloadname, Cmd_Argv(cmd, 2), sizeof(cls.qw_downloadname));
        cls.qw_downloadmemorymaxsize = size;
        cls.qw_downloadmemory = (unsigned char *) Mem_Alloc(cls.permanentmempool, cls.qw_downloadmemorymaxsize);
        cls.qw_downloadnumber++;
@@ -1735,7 +1735,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))
@@ -1753,7 +1753,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);
@@ -1800,9 +1800,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);
@@ -1830,7 +1830,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
@@ -1849,7 +1849,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++)
@@ -1861,13 +1861,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);
@@ -1949,7 +1949,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;
                        }
@@ -3032,10 +3032,10 @@ static void CL_IPLog_Add(const char *address, const char *name, qbool checkexist
        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)
        {
@@ -3517,7 +3517,7 @@ void CL_ParseServerMessage(void)
                                {
                                        char description[32*64], logtemp[64];
                                        int count;
-                                       strlcpy(description, "packet dump: ", sizeof(description));
+                                       dp_strlcpy(description, "packet dump: ", sizeof(description));
                                        i = cmdcount - 32;
                                        if (i < 0)
                                                i = 0;
@@ -3526,7 +3526,7 @@ void CL_ParseServerMessage(void)
                                        while(count > 0)
                                        {
                                                dpsnprintf(logtemp, sizeof(logtemp), "%3i:%s ", cmdlog[i], cmdlogname[i]);
-                                               strlcat(description, logtemp, sizeof(description));
+                                               dp_strlcat(description, logtemp, sizeof(description));
                                                count--;
                                                i++;
                                                i &= 31;
@@ -3598,7 +3598,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;
@@ -3868,7 +3868,7 @@ void CL_ParseServerMessage(void)
                                {
                                        char description[32*64], tempdesc[64];
                                        int count;
-                                       strlcpy (description, "packet dump: ", sizeof(description));
+                                       dp_strlcpy (description, "packet dump: ", sizeof(description));
                                        i = cmdcount - 32;
                                        if (i < 0)
                                                i = 0;
@@ -3877,7 +3877,7 @@ void CL_ParseServerMessage(void)
                                        while(count > 0)
                                        {
                                                dpsnprintf (tempdesc, sizeof (tempdesc), "%3i:%s ", cmdlog[i], cmdlogname[i]);
-                                               strlcat (description, tempdesc, sizeof (description));
+                                               dp_strlcat (description, tempdesc, sizeof (description));
                                                count--;
                                                i++;
                                                i &= 31;
@@ -4010,7 +4010,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;
@@ -4067,7 +4067,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:
index 64fe93b8ce10c176dccba3eb10cbb553a51d1bc3..31abace8711e9e2dfbd2bfe20b37460c12519785 100644 (file)
@@ -332,7 +332,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++;
                        }
                }
@@ -362,7 +362,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)
                {
@@ -2357,7 +2357,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"))
                                {
@@ -2369,9 +2369,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));
                                                }
                                        }
                                }
index 8540f2431aa3f8f7f582eb331a0f3d622cb5108e..202a520e4423df3bd94ea46cf7899d13e07a0456 100644 (file)
@@ -142,7 +142,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;
 
@@ -170,11 +170,11 @@ static void SCR_Centerprint_f (cmd_state_t *cmd)
        c = Cmd_Argc(cmd);
        if(c >= 2)
        {
-               strlcpy(msg, Cmd_Argv(cmd,1), sizeof(msg));
+               dp_strlcpy(msg, Cmd_Argv(cmd,1), sizeof(msg));
                for(i = 2; i < c; ++i)
                {
-                       strlcat(msg, " ", sizeof(msg));
-                       strlcat(msg, Cmd_Argv(cmd, i), sizeof(msg));
+                       dp_strlcat(msg, " ", sizeof(msg));
+                       dp_strlcat(msg, Cmd_Argv(cmd, i), sizeof(msg));
                }
                c = (unsigned int)strlen(msg);
                for(p = 0, i = 0; i < c; ++i)
@@ -682,7 +682,7 @@ static void SCR_InfoBar_f(cmd_state_t *cmd)
        if(Cmd_Argc(cmd) == 3)
        {
                scr_infobartime_off = atof(Cmd_Argv(cmd, 1));
-               strlcpy(scr_infobarstring, Cmd_Argv(cmd, 2), sizeof(scr_infobarstring));
+               dp_strlcpy(scr_infobarstring, Cmd_Argv(cmd, 2), sizeof(scr_infobarstring));
        }
        else
        {
@@ -916,7 +916,7 @@ void SCR_ScreenShot_f(cmd_state_t *cmd)
        if (Cmd_Argc(cmd) == 2)
        {
                const char *ext;
-               strlcpy(filename, Cmd_Argv(cmd, 1), sizeof(filename));
+               dp_strlcpy(filename, Cmd_Argv(cmd, 1), sizeof(filename));
                ext = FS_FileExtension(filename);
                if (!strcasecmp(ext, "jpg"))
                {
@@ -1009,7 +1009,7 @@ void SCR_ScreenShot_f(cmd_state_t *cmd)
                {
                        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);
                        }
                }
@@ -1340,7 +1340,7 @@ static void R_Envmap_f(cmd_state_t *cmd)
                return;
        }
 
-       strlcpy (basename, Cmd_Argv(cmd, 1), sizeof (basename));
+       dp_strlcpy (basename, Cmd_Argv(cmd, 1), sizeof (basename));
        size = atoi(Cmd_Argv(cmd, 2));
        if (size != 128 && size != 256 && size != 512 && size != 1024)
        {
@@ -1416,8 +1416,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) // LadyHavoc: nasty old legacy junk
        {
                x = MSG_ReadByte(&cl_message);
@@ -1448,8 +1448,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);
@@ -1781,7 +1781,7 @@ static void SCR_DrawScreen (void)
                        loadingscreenstack_t connect_status, *og_ptr = loadingscreenstack;
 
                        connect_status.absolute_loading_amount_min = 0;
-                       strlcpy(connect_status.msg, cl_connect_status, sizeof(cl_connect_status));
+                       dp_strlcpy(connect_status.msg, cl_connect_status, sizeof(cl_connect_status));
                        loadingscreenstack = &connect_status;
                        SCR_DrawLoadingScreen();
                        loadingscreenstack = og_ptr;
@@ -1905,7 +1905,7 @@ void SCR_PushLoadingScreen (const char *msg, float len_in_parent)
        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)
index 2804661b2b8c38c437ac6a51a779a27ee89b32e0..2d5cc453b4b703bb8e3b19194667e322ba88aeae 100644 (file)
@@ -214,7 +214,7 @@ 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));
        dpsnprintf(video->name, sizeof(video->name), CLVIDEOPREFIX "%s", name);
        video->ownertag = owner;
        if( strncmp( name, CLVIDEOPREFIX, sizeof( CLVIDEOPREFIX ) - 1 ) )
index 04bd63489dfe7253df7ebc91b387e1474809aee8..49d8e96e86da312514943a89fd4be4e3c43a38f2 100644 (file)
@@ -151,7 +151,7 @@ void *jam_open(clvideo_t *video, char *filename, const char **errorstring)
        {
                sfx_t* sfx;
                FS_StripExtension(filename, wavename, namelen);
-               strlcat(wavename, ".wav", namelen);
+               dp_strlcat(wavename, ".wav", namelen);
                sfx = S_PrecacheSound(wavename, false, false);
                if (sfx != NULL)
                        s->sndchan = S_StartSound (-1, 0, sfx, vec3_origin, 1.0f, 0);
index 83f4921c35677005afeb608254a0697add198831..b0181be0dd7d71f409aa74ca2bbe0a0abae342f4 100644 (file)
@@ -335,7 +335,7 @@ void *LibAvW_OpenVideo(clvideo_t *video, char *filename, const char **errorstrin
        if (wavename)
        {
                FS_StripExtension(filename, wavename, len-1);
-               strlcat(wavename, ".wav", len);
+               dp_strlcat(wavename, ".wav", len);
                s->sfx = S_PrecacheSound(wavename, false, false);
                s->sndchan = -1;
                Z_Free(wavename);
index 29ade032f819644c920cbe4c736279a43859af09..c93d5584bcf0448f0b450f91f064967bf8481233 100644 (file)
@@ -618,7 +618,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);
 }
@@ -1639,7 +1639,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)
@@ -1664,7 +1664,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);
@@ -1691,7 +1691,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
                {
@@ -2071,7 +2071,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);
 }
 
@@ -2393,7 +2393,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);
@@ -4128,7 +4128,7 @@ static void VM_CL_R_PolygonBegin (prvm_prog_t *prog)
        prog->polygonbegin_model = mod;
        if (texname == NULL || texname[0] == 0)
                texname = "$whiteimage";
-       strlcpy(prog->polygonbegin_texname, texname, sizeof(prog->polygonbegin_texname));
+       dp_strlcpy(prog->polygonbegin_texname, texname, sizeof(prog->polygonbegin_texname));
        prog->polygonbegin_drawflags = drawflags;
        prog->polygonbegin_numvertices = 0;
 }
diff --git a/cmd.c b/cmd.c
index 8c6c2eaa3344cd7efd97d940c00a803454dcbd9e..8c6570ecdf3447017e2549ae23c880610e98975d 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -193,7 +193,7 @@ static void Cbuf_LinkString(cmd_state_t *cmd, llist_t *head, cmd_input_t *existi
        }
        cbuf->size += cmdsize;
 
-       strlcpy(&node->text[offset], text, cmdsize + 1); // always sets the last char to \0
+       dp_strlcpy(&node->text[offset], text, cmdsize + 1); // always sets the last char to \0
        //Con_Printf("^5Cbuf_LinkString(): %s `^7%s^5`\n", node->pending ? "append" : "new", &node->text[offset]);
        node->pending = leavepending;
 }
@@ -960,7 +960,7 @@ static void Cmd_Alias_f (cmd_state_t *cmd)
                cmd_alias_t *prev, *current;
 
                a = (cmd_alias_t *)Z_Malloc (sizeof(cmd_alias_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->userdefined->alias ; current && strcmp( current->name, a->name ) < 0 ; prev = current, current = current->next )
                        ;
@@ -979,10 +979,10 @@ static void Cmd_Alias_f (cmd_state_t *cmd)
        for (i=2 ; i < c ; i++)
        {
                if (i != 2)
-                       strlcat (line, " ", sizeof (line));
-               strlcat (line, Cmd_Argv(cmd, i), sizeof (line));
+                       dp_strlcat (line, " ", sizeof (line));
+               dp_strlcat (line, Cmd_Argv(cmd, i), sizeof (line));
        }
-       strlcat (line, "\n", sizeof (line));
+       dp_strlcat (line, "\n", sizeof (line));
 
        alloclen = strlen (line) + 1;
        if(alloclen >= 2)
index 1406989ba6e4a9c6fccc840a6f650bbf15cb77c5..e2add7e2ef7b0376f92a1b765935a89cb0ff941a 100644 (file)
@@ -195,7 +195,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;
index 8412e489edf370737fefacee261a5e8d3d663be7..778bf82d6df4c93415ea2a99cf5adecd5a720090 100644 (file)
@@ -122,13 +122,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);
        }
 }
 
index d479459c04fda307f730cb35342df8c11998223c..0f7ddd2b8bc11fc31d45c340ee9a3e8f085c7c7e 100644 (file)
--- a/common.c
+++ b/common.c
@@ -1327,10 +1327,7 @@ COM_StringDecolorize(const char *in, size_t size_in, char *out, size_t size_out,
 /*     $OpenBSD: strlcat.c,v 1.19 2019/01/25 00:19:25 millert Exp $    */
 /*     $OpenBSD: strlcpy.c,v 1.16 2019/01/25 00:19:25 millert Exp $    */
 
-
-#ifndef HAVE_STRLCAT
-size_t
-strlcat(char *dst, const char *src, size_t dsize)
+size_t dp_strlcat(char *dst, const char *src, size_t dsize)
 {
        const char *odst = dst;
        const char *osrc = src;
@@ -1356,12 +1353,8 @@ strlcat(char *dst, const char *src, size_t dsize)
 
        return(dlen + (src - osrc));    /* count does not include NUL */
 }
-#endif  // #ifndef HAVE_STRLCAT
 
-
-#ifndef HAVE_STRLCPY
-size_t
-strlcpy(char *dst, const char *src, size_t dsize)
+size_t dp_strlcpy(char *dst, const char *src, size_t dsize)
 {
        const char *osrc = src;
        size_t nleft = dsize;
@@ -1385,7 +1378,6 @@ strlcpy(char *dst, const char *src, size_t dsize)
        return(src - osrc - 1); /* count does not include NUL */
 }
 
-#endif  // #ifndef HAVE_STRLCPY
 
 void FindFraction(double val, int *num, int *denom, int denomMax)
 {
@@ -1423,7 +1415,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, "}"))
index 0fdf97ce59a3e0f982a7c247198c7a7671707c20..677219d621fc8e3579d5016d8255f5d295822325 100644 (file)
--- a/common.h
+++ b/common.h
@@ -281,14 +281,6 @@ qbool COM_StringDecolorize(const char *in, size_t size_in, char *out, size_t siz
 void COM_ToLowerString (const char *in, char *out, size_t size_out);
 void COM_ToUpperString (const char *in, char *out, size_t size_out);
 
-// strlcat and strlcpy, from OpenBSD
-// Most (all?) BSDs already have them
-#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(MACOSX)
-# define HAVE_STRLCAT 1
-# define HAVE_STRLCPY 1
-#endif
-
-#ifndef HAVE_STRLCAT
 /*!
  * Appends src to string dst of size dsize (unlike strncat, dsize is the
  * full size of dst, not space left).  At most dsize-1 characters
@@ -296,18 +288,14 @@ void COM_ToUpperString (const char *in, char *out, size_t size_out);
  * Returns strlen(src) + MIN(dsize, strlen(initial dst)).
  * If retval >= dsize, truncation occurred.
  */
-size_t strlcat(char *dst, const char *src, size_t dsize);
-#endif  // #ifndef HAVE_STRLCAT
+size_t dp_strlcat(char *dst, const char *src, size_t dsize);
 
-#ifndef HAVE_STRLCPY
 /*!
  * Copy string src to buffer dst of size dsize.  At most dsize-1
  * chars will be copied.  Always NUL terminates (unless dsize == 0).
  * Returns strlen(src); if retval >= dsize, truncation occurred.
  */
-size_t strlcpy(char *dst, const char *src, size_t dsize);
-
-#endif  // #ifndef HAVE_STRLCPY
+size_t dp_strlcpy(char *dst, const char *src, size_t dsize);
 
 void FindFraction(double val, int *num, int *denom, int denomMax);
 
index fd2df3e0532aba93aeae25a16ce66b4ff46b1d96..7767617cfd7f2f8335a50511a51910a040420170 100644 (file)
--- a/console.c
+++ b/console.c
@@ -392,7 +392,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;
 }
 
@@ -512,7 +512,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"));
        }
 }
@@ -1536,7 +1536,7 @@ static void Con_DrawInput(qbool is_console, float x, float v, float inputsize)
        {
                // empty prefix because ] is part of the console edit line
                prefix = "";
-               strlcpy(text, key_line, sizeof(text));
+               dp_strlcpy(text, key_line, sizeof(text));
                linepos = key_linepos;
                fnt = FONT_CONSOLE;
        }
@@ -1548,7 +1548,7 @@ static void Con_DrawInput(qbool is_console, float x, float v, float inputsize)
                        prefix = "say_team:";
                else
                        prefix = "say:";
-               strlcpy(text, chat_buffer, sizeof(text));
+               dp_strlcpy(text, chat_buffer, sizeof(text));
                linepos = chat_bufferpos;
                fnt = FONT_CHAT;
        }
@@ -2149,12 +2149,12 @@ qbool GetMapList (const char *s, char *completedname, int completednamebufferlen
                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))
@@ -2210,7 +2210,7 @@ qbool GetMapList (const char *s, char *completedname, int completednamebufferlen
                        }
                        else
                                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)
@@ -2246,7 +2246,7 @@ qbool GetMapList (const char *s, char *completedname, int completednamebufferlen
                                        if (!strcmp(keyname, "message"))
                                        {
                                                // get the message contents
-                                               strlcpy(message, com_token, sizeof(message));
+                                               dp_strlcpy(message, com_token, sizeof(message));
                                                break;
                                        }
                                }
@@ -2455,10 +2455,10 @@ static int Nicks_CompleteCountPossible(char *line, int pos, char *s, qbool isCon
                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;
@@ -2572,7 +2572,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]));
        }
 }
 
@@ -2628,7 +2628,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]));
        }
 }
 
@@ -2775,7 +2775,7 @@ int Con_CompleteCommandLine(cmd_state_t *cmd, qbool is_console)
        pos++;
 
        s = line + pos;
-       strlcpy(s2, line + linepos, sizeof(s2)); //save chars after cursor
+       dp_strlcpy(s2, line + linepos, sizeof(s2)); //save chars after cursor
        line[linepos] = 0; //hide them
 
        c = v = a = n = cmd_len = 0;
@@ -2785,7 +2785,7 @@ int Con_CompleteCommandLine(cmd_state_t *cmd, qbool is_console)
        space = strchr(line + 1, ' ');
        if(space && pos == (space - line) + 1)
        {
-               strlcpy(command, line + 1, min(sizeof(command), (unsigned int)(space - line)));
+               dp_strlcpy(command, line + 1, min(sizeof(command), (unsigned int)(space - line)));
 
                patterns = Cvar_VariableString(cmd->cvars, va(vabuf, sizeof(vabuf), "con_completion_%s", command), CF_CLIENT | CF_SERVER); // TODO maybe use a better place for this?
                if(patterns && !*patterns)
@@ -2802,8 +2802,8 @@ int Con_CompleteCommandLine(cmd_state_t *cmd, qbool is_console)
 
                                // and now do the actual work
                                *s = 0;
-                               strlcat(line, t, MAX_INPUTLINE);
-                               strlcat(line, s2, MAX_INPUTLINE); //add back chars after cursor
+                               dp_strlcat(line, t, MAX_INPUTLINE);
+                               dp_strlcat(line, s2, MAX_INPUTLINE); //add back chars after cursor
 
                                // and fix the cursor
                                if(linepos > (int) strlen(line))
@@ -2851,8 +2851,8 @@ int Con_CompleteCommandLine(cmd_state_t *cmd, qbool is_console)
                                                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
-                                                       strlcat(t, com_token, sizeof(t));
+                                                       dp_strlcpy(t, s, min(sizeof(t), (unsigned int)(slash - s + 2))); // + 2, because I want to include the slash
+                                                       dp_strlcat(t, com_token, sizeof(t));
                                                        search = FS_Search(t, true, true, NULL);
                                                }
                                                else
@@ -2874,8 +2874,8 @@ int Con_CompleteCommandLine(cmd_state_t *cmd, qbool is_console)
                                        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
-                                               strlcat(t, "*", sizeof(t));
+                                               dp_strlcpy(t, s, min(sizeof(t), (unsigned int)(slash - s + 2))); // + 2, because I want to include the slash
+                                               dp_strlcat(t, "*", sizeof(t));
                                                search = FS_Search(t, true, true, NULL);
                                        }
                                        else
@@ -2934,7 +2934,7 @@ int Con_CompleteCommandLine(cmd_state_t *cmd, qbool is_console)
                                                // 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
@@ -2942,8 +2942,8 @@ int Con_CompleteCommandLine(cmd_state_t *cmd, qbool is_console)
 
                                        // and now do the actual work
                                        *s = 0;
-                                       strlcat(line, t, MAX_INPUTLINE);
-                                       strlcat(line, s2, MAX_INPUTLINE); //add back chars after cursor
+                                       dp_strlcat(line, t, MAX_INPUTLINE);
+                                       dp_strlcat(line, s2, MAX_INPUTLINE); //add back chars after cursor
 
                                        // and fix the cursor
                                        if(linepos > (int) strlen(line))
@@ -2988,7 +2988,7 @@ nicks:
        if (!(c + v + a + n))   // No possible matches
        {
                if(s2[0])
-                       strlcpy(&line[linepos], s2, linesize - linepos);
+                       dp_strlcpy(&line[linepos], s2, linesize - linepos);
                return linepos;
        }
 
@@ -3051,7 +3051,7 @@ done:
 
        // use strlcat to avoid a buffer overrun
        line[linepos] = 0;
-       strlcat(line, s2, linesize);
+       dp_strlcat(line, s2, linesize);
 
        if (!is_console)
                return linepos;
index d910e4919f3033391a26205c63500abfeb631378..e6a09ea0b318a39f15e2912e28d0b315b68b8f40 100644 (file)
--- a/crypto.c
+++ b/crypto.c
@@ -750,9 +750,9 @@ qbool Crypto_RetrieveHostKey(lhnetaddress_t *peeraddress, int *keyid, char *keyf
        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)
@@ -771,10 +771,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;
@@ -848,7 +848,7 @@ static void Crypto_BuildIdString(void)
        dpsnprintf(crypto_idstring_buf, sizeof(crypto_idstring_buf), "%d", d0_rijndael_dll ? crypto_aeslevel.integer : 0);
        for (i = 0; i < MAX_PUBKEYS; ++i)
                if (pubkeys[i])
-                       strlcat(crypto_idstring_buf, va(vabuf, sizeof(vabuf), " %s@%s%s", pubkeys_priv_fp64[i], pubkeys_havesig[i] ? "" : "~", pubkeys_fp64[i]), sizeof(crypto_idstring_buf));
+                       dp_strlcat(crypto_idstring_buf, va(vabuf, sizeof(vabuf), " %s@%s%s", pubkeys_priv_fp64[i], pubkeys_havesig[i] ? "" : "~", pubkeys_fp64[i]), sizeof(crypto_idstring_buf));
        crypto_idstring = crypto_idstring_buf;
 }
 
@@ -1292,7 +1292,7 @@ static void Crypto_KeyGen_f(cmd_state_t *cmd)
                {
                        Con_Printf("Generated private ID key_%d.d0pk (public key fingerprint: %s)\n", keygen_i, pubkeys_priv_fp64[keygen_i]);
                        pubkeys_havepriv[keygen_i] = true;
-                       strlcat(crypto_idstring_buf, va(vabuf, sizeof(vabuf), " %s@%s", pubkeys_priv_fp64[keygen_i], pubkeys_fp64[keygen_i]), sizeof(crypto_idstring_buf));
+                       dp_strlcat(crypto_idstring_buf, va(vabuf, sizeof(vabuf), " %s@%s", pubkeys_priv_fp64[keygen_i], pubkeys_fp64[keygen_i]), sizeof(crypto_idstring_buf));
                        crypto_idstring = crypto_idstring_buf;
                        Crypto_BuildChallengeAppend();
                }
@@ -1858,8 +1858,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)
@@ -2001,7 +2001,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));
@@ -2324,7 +2324,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;
@@ -2363,8 +2363,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];
                        }
 
@@ -2508,7 +2508,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;
index 7bc6cee08e51bb8231b2511ed8e2688aea6064f4..f7e6fd004197831b5c3f376884d3a265ed1e429b 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -629,10 +629,10 @@ void CSQC_AddPrintText (const char *msg)
                                cl.csqc_printtextbuf[0] = 0;
                        }
                        else
-                               strlcat(cl.csqc_printtextbuf, msg, MAX_INPUTLINE);
+                               dp_strlcat(cl.csqc_printtextbuf, msg, MAX_INPUTLINE);
                        return;
                }
-               strlcat(cl.csqc_printtextbuf, msg, MAX_INPUTLINE);
+               dp_strlcat(cl.csqc_printtextbuf, msg, MAX_INPUTLINE);
                CL_VM_Parse_Print(cl.csqc_printtextbuf);
                cl.csqc_printtextbuf[0] = 0;
        }
index 011c95bf4d32260c3078aaebec28fa304779b10f..244387ab6dc55f5edebc912d82dc782ae8e91413 100644 (file)
@@ -397,7 +397,7 @@ void *dpvsimpledecode_open(clvideo_t *video, char *filename, const char **errors
                                                                        sfx_t* sfx;
 
                                                                        FS_StripExtension(filename, wavename, namelen);
-                                                                       strlcat(wavename, ".wav", namelen);
+                                                                       dp_strlcat(wavename, ".wav", namelen);
                                                                        sfx = S_PrecacheSound (wavename, false, false);
                                                                        if (sfx != NULL)
                                                                                s->sndchan = S_StartSound (-1, 0, sfx, vec3_origin, 1.0f, 0);
index d9c73bbd0a0a34bd0044ca1b82d2eefedad20e67..38ee0372e940211702ecb710b3504852bd5c26b3 100644 (file)
@@ -176,9 +176,9 @@ void listdirectory(stringlist_t *list, const char *basepath, const char *path)
        int lenw = 0;
        WIN32_FIND_DATAW n_file;
        HANDLE hFile;
-       strlcpy (pattern, basepath, sizeof(pattern));
-       strlcat (pattern, path, sizeof (pattern));
-       strlcat (pattern, "*", sizeof (pattern));
+       dp_strlcpy(pattern, basepath, sizeof(pattern));
+       dp_strlcat(pattern, path, sizeof (pattern));
+       dp_strlcat(pattern, "*", sizeof (pattern));
        fromwtf8(pattern, strlen(pattern), patternw, BUFSIZE);
        // ask for the directory listing handle
        hFile = FindFirstFileW(patternw, &n_file);
diff --git a/fs.c b/fs.c
index 2b51ec910905be9261e3f7c7ad5d743569f59c01..9469956ae88b4ad10d39872fe42b122f2c931bac 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -864,7 +864,7 @@ static pack_t *FS_LoadPackPK3FromFD (const char *packfile, filedesc_t packhandle
        // 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));
@@ -982,7 +982,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;
@@ -1140,7 +1140,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));
@@ -1176,7 +1176,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 = FILEDESC_INVALID;
        pack->numfiles = -1;
        pack->files = NULL;
@@ -1232,7 +1232,7 @@ static qbool FS_AddPack_Fullpath(const char *pakfile, const char *shortname, qbo
 
        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)
@@ -1351,7 +1351,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);
@@ -1381,7 +1381,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;
 }
@@ -1563,9 +1563,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)
@@ -1585,11 +1585,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));
+                       dp_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
 
@@ -1607,7 +1607,7 @@ void FS_Rescan (void)
        }
 
        if((i = Sys_CheckParm("-modname")) && i < sys.argc - 1)
-               strlcpy(com_modname, sys.argv[i+1], sizeof(com_modname));
+               dp_strlcpy(com_modname, sys.argv[i+1], sizeof(com_modname));
 
        // If "-condebug" is in the command line, remove the previous log file
        if (Sys_CheckParm ("-condebug") != 0)
@@ -1699,7 +1699,7 @@ qbool FS_ChangeGameDirs(int numgamedirs, char gamedirs[][MAX_QPATH], qbool compl
 
        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();
@@ -1747,7 +1747,7 @@ static void FS_GameDir_f(cmd_state_t *cmd)
        }
 
        for (i = 0;i < numgamedirs;i++)
-               strlcpy(gamedirs[i], Cmd_Argv(cmd, i+1), sizeof(gamedirs[i]));
+               dp_strlcpy(gamedirs[i], Cmd_Argv(cmd, i+1), sizeof(gamedirs[i]));
 
        if ((cls.state == ca_connected && !cls.demoplayback) || sv.active)
        {
@@ -1874,8 +1874,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;
        }
 }
@@ -1906,7 +1906,7 @@ static void COM_InsertFlags(const char *buf) {
                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[i] = q;
                ++i;
        }
@@ -1929,7 +1929,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;
@@ -1953,7 +1953,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)
@@ -2024,7 +2024,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");
@@ -2123,7 +2123,7 @@ static void FS_Init_Dir (void)
        i = Sys_CheckParm ("-basedir");
        if (i && i < sys.argc-1)
        {
-               strlcpy (fs_basedir, sys.argv[i+1], sizeof (fs_basedir));
+               dp_strlcpy (fs_basedir, sys.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;
@@ -2132,7 +2132,7 @@ static void FS_Init_Dir (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)
@@ -2140,7 +2140,7 @@ static void FS_Init_Dir (void)
                if (strstr(sys.argv[0], ".app/"))
                {
                        char *split;
-                       strlcpy(fs_basedir, sys.argv[0], sizeof(fs_basedir));
+                       dp_strlcpy(fs_basedir, sys.argv[0], sizeof(fs_basedir));
                        split = strstr(fs_basedir, ".app/");
                        if (split)
                        {
@@ -2152,7 +2152,7 @@ static void FS_Init_Dir (void)
                                if (stat(va(vabuf, sizeof(vabuf), "%s/Contents/Resources/%s", fs_basedir, gamedirname1), &statresult) == 0)
                                {
                                        // found gamedir inside Resources, use it
-                                       strlcat(fs_basedir, "Contents/Resources/", sizeof(fs_basedir));
+                                       dp_strlcat(fs_basedir, "Contents/Resources/", sizeof(fs_basedir));
                                }
                                else
                                {
@@ -2171,7 +2171,7 @@ static void FS_Init_Dir (void)
        memset(fs_basedir + sizeof(fs_basedir) - 2, 0, 2);
        // add a path separator to the end of the basedir if it lacks one
        if (fs_basedir[0] && fs_basedir[strlen(fs_basedir) - 1] != '/' && fs_basedir[strlen(fs_basedir) - 1] != '\\')
-               strlcat(fs_basedir, "/", sizeof(fs_basedir));
+               dp_strlcat(fs_basedir, "/", sizeof(fs_basedir));
 
        // Add the personal game directory
        if((i = Sys_CheckParm("-userdir")) && i < sys.argc - 1)
@@ -2181,7 +2181,7 @@ static void FS_Init_Dir (void)
        else
        {
 #ifdef DP_FS_USERDIR
-               strlcpy(fs_userdir, DP_FS_USERDIR, sizeof(fs_userdir));
+               dp_strlcpy(fs_userdir, DP_FS_USERDIR, sizeof(fs_userdir));
 #else
                int dirmode;
                int highestuserdirmode = USERDIRMODE_COUNT - 1;
@@ -2259,7 +2259,7 @@ static void FS_Init_Dir (void)
                        if(p == fs_checkgamedir_missing)
                                Con_Printf(CON_WARN "WARNING: -game %s%s/ not found!\n", fs_basedir, sys.argv[i]);
                        // add the gamedir to the list of active gamedirs
-                       strlcpy (fs_gamedirs[fs_numgamedirs], sys.argv[i], sizeof(fs_gamedirs[fs_numgamedirs]));
+                       dp_strlcpy (fs_gamedirs[fs_numgamedirs], sys.argv[i], sizeof(fs_gamedirs[fs_numgamedirs]));
                        fs_numgamedirs++;
                }
        }
@@ -3628,7 +3628,7 @@ void FS_DefaultExtension (char *path, const char *extension, size_t size_path)
                src--;
        }
 
-       strlcat (path, extension, size_path);
+       dp_strlcat (path, extension, size_path);
 }
 
 
@@ -3774,7 +3774,7 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet, const
                        for (i = 0;i < pak->numfiles;i++)
                        {
                                char temp[MAX_OSPATH];
-                               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))
@@ -3846,7 +3846,7 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet, const
 
                                // 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)
@@ -3855,13 +3855,13 @@ fssearch_t *FS_Search(const char *pattern, int caseinsensitive, int quiet, const
                                        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++ ) {
                                        char temp[MAX_OSPATH];
-                                       strlcpy( temp, matchedSet.strings[ dirlistindex ], sizeof(temp) );
-                                       strlcat( temp, subpath, sizeof(temp) );
+                                       dp_strlcpy( temp, matchedSet.strings[ dirlistindex ], sizeof(temp) );
+                                       dp_strlcat( temp, subpath, sizeof(temp) );
                                        listdirectory( &foundSet, searchpath->filename, temp );
                                }
                                if( dirlistindex == 0 ) {
diff --git a/ft2.c b/ft2.c
index 3296e9498361af7ead19b12e9a66b3e5146feccb..64efe9a674c93a4834458e55fb7c96710b26673c 100644 (file)
--- a/ft2.c
+++ b/ft2.c
@@ -288,7 +288,7 @@ static const unsigned char *fontfilecache_LoadFile(const char *path, qbool quiet
                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;
@@ -547,7 +547,7 @@ qbool 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;
        }
@@ -724,7 +724,7 @@ static qbool Font_LoadFile(const char *name, int _face, ft2_settings_t *settings
                        Con_Printf(CON_ERROR "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;
index 32a6ee7d18051968669747a72c617e30c72126b7..b5336a226223f62d852b5760a5b8e534117c8546 100644 (file)
@@ -1773,7 +1773,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;
 }
index ea8798971b83c4408715ba20e12e2bb894bcd65d..d6b6a4a72ea6ce4904a51775afcb5002eae92866 100644 (file)
--- a/gl_draw.c
+++ b/gl_draw.c
@@ -143,7 +143,7 @@ cachepic_t *Draw_CachePic_Flags(const char *path, unsigned int cachepicflags)
        Con_DPrintf("Draw_CachePic(\"%s\"): frame %i: loading pic%s\n", path, draw_frame, (cachepicflags & CACHEPICFLAG_NOTPERSISTENT) ? " notpersist" : "");
        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;
@@ -286,7 +286,7 @@ cachepic_t *Draw_NewPic(const char *picname, int width, int height, unsigned cha
                Con_DPrintf("Draw_NewPic(\"%s\"): frame %i: creating new cachepic\n", picname, draw_frame);
                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;
@@ -336,7 +336,7 @@ void LoadFont(qbool override, const char *name, dp_font_t *fnt, float scale, flo
 
        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;
@@ -384,7 +384,7 @@ void LoadFont(qbool override, const char *name, dp_font_t *fnt, float scale, flo
                if(!Draw_IsPicLoaded(fnt->pic))
                {
                        fnt->pic = Draw_CachePic_Flags("gfx/conchars", CACHEPICFLAG_NOCOMPRESSION | (r_nearest_conchars.integer ? CACHEPICFLAG_NEAREST : 0));
-                       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]);
@@ -493,7 +493,7 @@ dp_font_t *FindFont(const char *title, qbool 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];
                        }
                }
@@ -508,7 +508,7 @@ dp_font_t *FindFont(const char *title, qbool 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;
@@ -577,7 +577,7 @@ static void LoadFont_f(cmd_state_t *cmd)
        else
        {
                if (strcmp(cmd->cmdline, f->cmdline) != 0 || r_font_always_reload.integer)
-                       strlcpy(f->cmdline, cmd->cmdline, MAX_FONT_CMDLINE);
+                       dp_strlcpy(f->cmdline, cmd->cmdline, MAX_FONT_CMDLINE);
                else
                {
                        Con_DPrintf("LoadFont: font %s is unchanged\n", Cmd_Argv(cmd, 1));
@@ -605,7 +605,7 @@ static void LoadFont_f(cmd_state_t *cmd)
        }
 
        if(!c || (c - filelist) >= MAX_QPATH)
-               strlcpy(mainfont, filelist, sizeof(mainfont));
+               dp_strlcpy(mainfont, filelist, sizeof(mainfont));
        else
        {
                memcpy(mainfont, filelist, c - filelist);
@@ -631,7 +631,7 @@ static void LoadFont_f(cmd_state_t *cmd)
                }
                if(!c || (c-filelist) >= MAX_QPATH)
                {
-                       strlcpy(f->fallbacks[i], filelist, sizeof(mainfont));
+                       dp_strlcpy(f->fallbacks[i], filelist, sizeof(mainfont));
                }
                else
                {
@@ -768,15 +768,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++);
index aae45056151281c32ad1ae9c38b5d74c4e613e08..ec88c18736f00ecda75e1cc3087de9a2d9cd78ac 100644 (file)
@@ -533,7 +533,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)
@@ -1044,7 +1044,7 @@ static void R_GLSL_CompilePermutation(r_glsl_permutation_t *p, unsigned int mode
        permutationname[0] = 0;
        sourcestring = ShaderModeInfo_GetShaderText(modeinfo, true, false);
 
-       strlcat(permutationname, modeinfo->filename, sizeof(permutationname));
+       dp_strlcat(permutationname, modeinfo->filename, sizeof(permutationname));
 
        // we need 140 for r_glsl_skeletal (GL_ARB_uniform_buffer_object)
        if(vid.support.glshaderversion >= 140)
@@ -1098,7 +1098,7 @@ static void R_GLSL_CompilePermutation(r_glsl_permutation_t *p, unsigned int mode
        vertstrings_list[vertstrings_count++] = modeinfo->pretext;
        geomstrings_list[geomstrings_count++] = modeinfo->pretext;
        fragstrings_list[fragstrings_count++] = modeinfo->pretext;
-       strlcat(permutationname, modeinfo->name, sizeof(permutationname));
+       dp_strlcat(permutationname, modeinfo->name, sizeof(permutationname));
 
        // now add all the permutation pretexts
        for (i = 0;i < SHADERPERMUTATION_COUNT;i++)
@@ -1108,7 +1108,7 @@ static void R_GLSL_CompilePermutation(r_glsl_permutation_t *p, unsigned int mode
                        vertstrings_list[vertstrings_count++] = shaderpermutationinfo[i].pretext;
                        geomstrings_list[geomstrings_count++] = shaderpermutationinfo[i].pretext;
                        fragstrings_list[fragstrings_count++] = shaderpermutationinfo[i].pretext;
-                       strlcat(permutationname, shaderpermutationinfo[i].name, sizeof(permutationname));
+                       dp_strlcat(permutationname, shaderpermutationinfo[i].name, sizeof(permutationname));
                }
                else
                {
@@ -2260,7 +2260,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->textureflags = compareflags;
                item->comparewidth = comparewidth;
                item->compareheight = compareheight;
@@ -2989,7 +2989,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;
 }
@@ -6575,7 +6575,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);
index 1e3e1d7e5d79a63afd47e0840e0f05af35a14bdd..7065432e8a4142c4de7818759949a33b475b08cf 100644 (file)
@@ -1291,7 +1291,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;
@@ -1382,7 +1382,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;
@@ -1686,7 +1686,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;
@@ -2164,7 +2164,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 2bfd6912c239084b2645b0b8a13b9beec4dd6670..d291799ce7f5b9f3bafd91a60f248a5f62a601b3 100644 (file)
--- a/host.c
+++ b/host.c
@@ -113,7 +113,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/image.c b/image.c
index ed498ed6562ce832080410a4fc25a9378aeb4727..15835797ecde5bf6c2df3ed18f4402a55a724a5d 100644 (file)
--- a/image.c
+++ b/image.c
@@ -921,7 +921,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];
@@ -1059,14 +1059,14 @@ unsigned char *loadimagepixelsbgra (const char *filename, qbool complain, qbool
                        *c = '#';
        path[0] = 0;
        name[0] = 0;
-       strlcpy(afterpath, basename, sizeof(afterpath));
+       dp_strlcpy(afterpath, basename, sizeof(afterpath));
        if (strchr(basename, '/'))
        {
                int i;
                for (i = 0;i < (int)sizeof(path)-1 && basename[i] != '/' && basename[i];i++)
                        path[i] = basename[i];
                path[i] = 0;
-               strlcpy(afterpath, basename + i + 1, sizeof(afterpath));
+               dp_strlcpy(afterpath, basename + i + 1, sizeof(afterpath));
        }
        if (gamemode == GAME_TENEBRAE)
                firstformat = imageformats_tenebrae;
diff --git a/jpeg.c b/jpeg.c
index beab84335221c9ad4e3f06cb4e765fdc8bbc45b8..70eb3e472d1478c5ff7736447e84e488ef99e767 100644 (file)
--- a/jpeg.c
+++ b/jpeg.c
@@ -1019,7 +1019,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 fae464524839a9250f51ffb9d2230d8741663749..739d26bb050f2fe7d8f071a59a8da75667c13aac 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -129,7 +129,7 @@ static qbool 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;
@@ -138,7 +138,7 @@ static qbool 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;
@@ -148,14 +148,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);
        }
 }
@@ -171,12 +171,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);
@@ -185,12 +185,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);
        }
 }
@@ -198,12 +198,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);
        }
 }
@@ -216,11 +216,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)
@@ -255,7 +255,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;
@@ -951,7 +951,7 @@ int Key_Parse_CommonKeys(cmd_state_t *cmd, qbool is_console, int key, int unicod
                {
                        // hide ']' from u8_prevbyte otherwise it could go out of bounds
                        int newpos = (int)u8_prevbyte(line + linestart, linepos - linestart) + linestart;
-                       strlcpy(line + newpos, line + linepos, linesize + 1 - linepos);
+                       dp_strlcpy(line + newpos, line + linepos, linesize + 1 - linepos);
                        linepos = newpos;
                }
                return linepos;
@@ -1516,9 +1516,9 @@ Key_In_Bind_f(cmd_state_t *cmd)
 // copy the rest of the command line
        line[0] = 0;                                                    // start out with a null string
        for (i = 3; i < c; i++) {
-               strlcat (line, Cmd_Argv(cmd, i), sizeof (line));
+               dp_strlcat (line, Cmd_Argv(cmd, i), sizeof (line));
                if (i != (c - 1))
-                       strlcat (line, " ", sizeof (line));
+                       dp_strlcat (line, " ", sizeof (line));
        }
 
        if(!Key_SetBinding (b, m, line))
@@ -1663,9 +1663,9 @@ Key_Bind_f(cmd_state_t *cmd)
 // copy the rest of the command line
        line[0] = 0;                                                    // start out with a null string
        for (i = 2; i < c; i++) {
-               strlcat (line, Cmd_Argv(cmd, i), sizeof (line));
+               dp_strlcat (line, Cmd_Argv(cmd, i), sizeof (line));
                if (i != (c - 1))
-                       strlcat (line, " ", sizeof (line));
+                       dp_strlcat (line, " ", sizeof (line));
        }
 
        if(!Key_SetBinding (b, 0, line))
index 65adee3081b919d6bf814be533ac260d4c5af4e6..7454b24a05844b18d3e26b7f9091df189df98933 100644 (file)
--- a/libcurl.c
+++ b/libcurl.c
@@ -256,7 +256,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;
 }
@@ -272,7 +272,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;
 }
@@ -553,7 +553,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;
 
@@ -1061,8 +1061,8 @@ static qbool Curl_Begin(const char *URL, const char *extraheaders, double maxspe
                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;
@@ -1638,7 +1638,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);
@@ -1729,7 +1729,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;
                                                }
@@ -1781,7 +1781,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;
 }
 
@@ -1833,18 +1833,18 @@ static qbool Curl_SendRequirement(const char *filename, qbool foundone, char *se
        if(packurl && *packurl && strcmp(packurl, "-"))
        {
                if(!foundone)
-                       strlcat(sendbuffer, "curl --clear_autodownload\n", sendbuffer_len);
+                       dp_strlcat(sendbuffer, "curl --clear_autodownload\n", sendbuffer_len);
 
-               strlcat(sendbuffer, "curl --pak --forthismap --as ", sendbuffer_len);
-               strlcat(sendbuffer, thispack, sendbuffer_len);
+               dp_strlcat(sendbuffer, "curl --pak --forthismap --as ", sendbuffer_len);
+               dp_strlcat(sendbuffer, thispack, sendbuffer_len);
                if(sv_curl_maxspeed.value > 0)
                        dpsnprintf(sendbuffer + strlen(sendbuffer), sendbuffer_len - strlen(sendbuffer), " --maxspeed=%.1f", sv_curl_maxspeed.value);
-               strlcat(sendbuffer, " --for ", sendbuffer_len);
-               strlcat(sendbuffer, filename, sendbuffer_len);
-               strlcat(sendbuffer, " ", sendbuffer_len);
-               strlcat(sendbuffer, packurl, sendbuffer_len);
-               strlcat(sendbuffer, thispack, sendbuffer_len);
-               strlcat(sendbuffer, "\n", sendbuffer_len);
+               dp_strlcat(sendbuffer, " --for ", sendbuffer_len);
+               dp_strlcat(sendbuffer, filename, sendbuffer_len);
+               dp_strlcat(sendbuffer, " ", sendbuffer_len);
+               dp_strlcat(sendbuffer, packurl, sendbuffer_len);
+               dp_strlcat(sendbuffer, thispack, sendbuffer_len);
+               dp_strlcat(sendbuffer, "\n", sendbuffer_len);
 
                return true;
        }
@@ -1867,7 +1867,7 @@ void Curl_SendRequirements(void)
                foundone = Curl_SendRequirement(com_token, foundone, sendbuffer, sizeof(sendbuffer)) || foundone;
 
        if(foundone)
-               strlcat(sendbuffer, "curl --finish_autodownload\n", sizeof(sendbuffer));
+               dp_strlcat(sendbuffer, "curl --finish_autodownload\n", sizeof(sendbuffer));
 
        if(strlen(sendbuffer) + 1 < sizeof(sendbuffer))
                SV_ClientCommands("%s", sendbuffer);
diff --git a/menu.c b/menu.c
index 6749f6daa4d715cc5990ca4fba1744f6c9eb0028..f2d359839af9372f405e72b32e89c690f506a1bb 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -850,7 +850,7 @@ static void M_ScanSaves (void)
 
        for (i=0 ; i<MAX_SAVEGAMES ; i++)
        {
-               strlcpy (m_filenames[i], "--- UNUSED SLOT ---", sizeof(m_filenames[i]));
+               dp_strlcpy (m_filenames[i], "--- UNUSED SLOT ---", sizeof(m_filenames[i]));
                loadable[i] = false;
                dpsnprintf (name, sizeof(name), "s%i.sav", (int)i);
                f = FS_OpenRealFile (name, "rb", false);
@@ -866,7 +866,7 @@ static void M_ScanSaves (void)
                //version = atoi(com_token);
                // description
                COM_ParseToken_Simple(&t, false, false, true);
-               strlcpy (m_filenames[i], com_token, sizeof (m_filenames[i]));
+               dp_strlcpy (m_filenames[i], com_token, sizeof (m_filenames[i]));
 
        // change _ back to space
                for (j=0 ; j<SAVEGAME_COMMENT_LENGTH ; j++)
@@ -1284,7 +1284,7 @@ void M_Menu_Setup_f(cmd_state_t *cmd)
        key_dest = key_menu;
        m_state = m_setup;
        m_entersound = true;
-       strlcpy(setup_myname, cl_name.string, sizeof(setup_myname));
+       dp_strlcpy(setup_myname, cl_name.string, sizeof(setup_myname));
        setup_top = setup_oldtop = cl_topcolor.integer;
        setup_bottom = setup_oldbottom = cl_bottomcolor.integer;
        setup_rate = cl_rate.integer;
@@ -2632,7 +2632,7 @@ static void M_Keys_Draw (void)
 
                // LadyHavoc: 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[TINYSTR_LEN];
@@ -2642,8 +2642,8 @@ static void M_Keys_Draw (void)
                                if (keys[j] != -1)
                                {
                                        if (j > 0)
-                                               strlcat(keystring, " or ", sizeof(keystring));
-                                       strlcat(keystring, Key_KeynumToString (keys[j], tinystr, TINYSTR_LEN), sizeof(keystring));
+                                               dp_strlcat(keystring, " or ", sizeof(keystring));
+                                       dp_strlcat(keystring, Key_KeynumToString (keys[j], tinystr, TINYSTR_LEN), sizeof(keystring));
                                }
                        }
                }
@@ -4554,7 +4554,7 @@ static void ModList_RebuildList(void)
                description = FS_CheckGameDir(list.strings[i]);
                if (description == NULL || description == fs_checkgamedir_missing) 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)
@@ -4580,7 +4580,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)
index 46375f962f0798e04917d777590fd81b2ca5b4e7..aea60dad8a10bb45ed1247528151cd2aeba45ac3 100644 (file)
@@ -904,7 +904,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;
@@ -1281,7 +1281,7 @@ void Mod_IDP0_Load(model_t *mod, void *buffer, void *bufferend)
 
                        // store the info about the new skin
                        Mod_LoadCustomMaterial(loadmodel->mempool, loadmodel->data_textures + totalskins * loadmodel->num_surfaces, name, SUPERCONTENTS_SOLID, MATERIALFLAG_WALL, 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;
@@ -1542,7 +1542,7 @@ void Mod_IDP2_Load(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;
@@ -1636,7 +1636,7 @@ void Mod_IDP3_Load(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;
@@ -1649,7 +1649,7 @@ void Mod_IDP3_Load(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++)
@@ -2547,7 +2547,7 @@ void Mod_PSKMODEL_Load(model_t *mod, void *buffer, void *bufferend)
        loadmodel->synctype = ST_RAND;
 
        FS_StripExtension(loadmodel->name, animname, sizeof(animname));
-       strlcat(animname, ".psa", sizeof(animname));
+       dp_strlcat(animname, ".psa", sizeof(animname));
        animbuffer = animfilebuffer = FS_LoadFile(animname, loadmodel->mempool, false, &filesize);
        animbufferend = (void *)((unsigned char*)animbuffer + (int)filesize);
        if (!animbuffer)
@@ -2974,7 +2974,7 @@ void Mod_PSKMODEL_Load(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);
@@ -3098,7 +3098,7 @@ void Mod_PSKMODEL_Load(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;
@@ -3443,7 +3443,7 @@ void Mod_INTERQUAKEMODEL_Load(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);
@@ -3475,7 +3475,7 @@ void Mod_INTERQUAKEMODEL_Load(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);
@@ -3503,7 +3503,7 @@ void Mod_INTERQUAKEMODEL_Load(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);
@@ -3511,7 +3511,7 @@ void Mod_INTERQUAKEMODEL_Load(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;
index aeebd8760fc30c034220f783df7b637a56919c60..083d0146c6b662062262c3d286f45761bb65f412 100644 (file)
@@ -121,27 +121,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;
 }
@@ -1710,7 +1710,7 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb)
        skinframemissing = R_SkinFrame_LoadMissing();
        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;
@@ -1828,7 +1828,7 @@ static void Mod_Q1BSP_LoadTextures(sizebuf_t *sb)
                // no luck with loading shaders or external textures - restore the in-progress texture loading
                loadmodel->data_textures[i] = backuptex;
 
-               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;
@@ -2105,11 +2105,11 @@ static void Mod_Q1BSP_LoadLighting(sizebuf_t *sb)
        else // LadyHavoc: bsp version 29 (normal white lighting)
        {
                // LadyHavoc: 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));
-               strlcat (litfilename, ".lit", sizeof (litfilename));
-               strlcat (dlitfilename, ".dlit", sizeof (dlitfilename));
+               dp_strlcpy (dlitfilename, litfilename, sizeof (dlitfilename));
+               dp_strlcat (litfilename, ".lit", sizeof (litfilename));
+               dp_strlcat (dlitfilename, ".dlit", sizeof (dlitfilename));
                data = (unsigned char*) FS_LoadFile(litfilename, tempmempool, false, &filesize);
                if (data)
                {
@@ -2202,9 +2202,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))
@@ -4061,7 +4061,7 @@ void Mod_Q1BSP_Load(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;
@@ -4980,7 +4980,7 @@ static void Mod_Q2BSP_Load(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;
@@ -5139,14 +5139,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
@@ -5364,7 +5364,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)
                {
@@ -7541,7 +7541,7 @@ static void Mod_Q3BSP_Load(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;
@@ -8386,7 +8386,7 @@ void Mod_OBJ_Load(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++)
                        {
@@ -8479,7 +8479,7 @@ void Mod_OBJ_Load(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);
                        }
                }
        }
@@ -8689,7 +8689,7 @@ void Mod_OBJ_Load(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;
index bcf683e33f5a6677f3ca4777d9fb814fd68b8dd7..11b0d61c8b124fa5d801cabecb28c0d9daac3921 100644 (file)
@@ -217,7 +217,7 @@ void Mod_UnloadModel (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)
@@ -246,7 +246,7 @@ void Mod_UnloadModel (model_t *mod)
        // clear the struct to make it available
        memset(mod, 0, sizeof(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;
@@ -315,7 +315,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);
                }
 
@@ -338,7 +338,7 @@ static void Mod_FrameGroupify_ParseGroups_Store (unsigned int i, int start, int
        model_t *mod = (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);
@@ -618,7 +618,7 @@ model_t *Mod_FindName(const char *name, const char *parentname)
 
        // no match found, create a new one
        mod = (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
@@ -1512,7 +1512,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);
@@ -1574,7 +1574,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);
@@ -1617,7 +1617,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))
@@ -1872,7 +1872,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))
@@ -1982,7 +1982,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
@@ -2041,14 +2041,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)
                                {
@@ -2268,7 +2268,7 @@ qbool Mod_LoadTextureFromQ3Shader(mempool_t *mempool, const char *modelname, tex
        shader_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;
 
@@ -2649,7 +2649,7 @@ void Mod_LoadCustomMaterial(mempool_t *mempool, texture_t *texture, const char *
        if (!(materialflags & (MATERIALFLAG_WALL | MATERIALFLAG_SKY)))
                Con_DPrintf("^1Custom texture ^3\"%s\" does not have MATERIALFLAG_WALL set\n", texture->name);
 
-       strlcpy(texture->name, name, sizeof(texture->name));
+       dp_strlcpy(texture->name, name, sizeof(texture->name));
        texture->basealpha = 1.0f;
        texture->basematerialflags = materialflags;
        texture->supercontents = supercontents;
@@ -2749,7 +2749,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;
                        }
@@ -2769,8 +2769,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]);
@@ -2788,8 +2788,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);
@@ -3058,7 +3058,7 @@ static void Mod_Decompile_OBJ(model_t *model, const char *filename, const char *
                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;
@@ -3333,7 +3333,7 @@ static void Mod_Decompile_f(cmd_state_t *cmd)
                return;
        }
 
-       strlcpy(inname, Cmd_Argv(cmd, 1), sizeof(inname));
+       dp_strlcpy(inname, Cmd_Argv(cmd, 1), sizeof(inname));
        FS_StripExtension(inname, basename, sizeof(basename));
 
        mod = Mod_ForName(inname, false, true, inname[0] == '*' ? cl.model_name[1] : NULL);
@@ -3374,7 +3374,7 @@ static void Mod_Decompile_f(cmd_state_t *cmd)
                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)
                        {
@@ -3395,7 +3395,7 @@ static void Mod_Decompile_f(cmd_state_t *cmd)
                                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;
@@ -3410,7 +3410,7 @@ static void Mod_Decompile_f(cmd_state_t *cmd)
                                }
                                // 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);
@@ -4437,7 +4437,7 @@ static void Mod_GenerateLightmaps_f(cmd_state_t *cmd)
 void Mod_Mesh_Create(model_t *mod, const char *name)
 {
        memset(mod, 0, sizeof(*mod));
-       strlcpy(mod->name, name, sizeof(mod->name));
+       dp_strlcpy(mod->name, name, sizeof(mod->name));
        mod->mempool = Mem_AllocPool(name, 0, NULL);
        mod->texturepool = R_AllocTexturePool();
        mod->Draw = R_Mod_Draw;
index 6202e8e24044b02c31ba6bfd25b15f156f10321d..218b0c8de2b08a909ad3b72c0fc1f78ee5d4b163 100644 (file)
@@ -331,25 +331,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 );
index 7e64682575466266e4d666df9463b62a1f4cb7d9..c1e8bb96f7c2e2e3d7d0deaed73718991750892a 100644 (file)
--- a/netconn.c
+++ b/netconn.c
@@ -195,7 +195,7 @@ void NetConn_UpdateFavorites_c(cvar_t *var)
                // 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 
@@ -1638,7 +1638,7 @@ static void NetConn_ConnectionEstablished(lhnetsocket_t *mysocket, lhnetaddress_
                CL_Disconnect();
        // allocate a net connection to keep track of things
        cls.netcon = NetConn_Open(mysocket, peeraddress);
-       strlcpy(cl_connect_status, "Connection established", sizeof(cl_connect_status));
+       dp_strlcpy(cl_connect_status, "Connection established", sizeof(cl_connect_status));
        crypto = &cls.netcon->crypto;
        if(cls.crypto.authenticated)
        {
@@ -1725,7 +1725,7 @@ static int NetConn_ClientParsePacket_ServerList_ProcessReply(const char *address
                entry = &serverlist_cache[n];
 
                memset(entry, 0, sizeof(*entry));
-               strlcpy(entry->info.cname, addressstring, sizeof(entry->info.cname));
+               dp_strlcpy(entry->info.cname, addressstring, sizeof(entry->info.cname));
 
                // use the broadcast as the first query, NetConn_QueryQueueFrame() will send more
                entry->querytime = masterquerytime;
@@ -1842,7 +1842,7 @@ static qbool NetConn_ClientParsePacket_ServerList_PrepareQuery(int protocol, con
        entry = &serverlist_cache[n];
        memset(entry, 0, sizeof(*entry));
        entry->protocol = protocol;
-       strlcpy(entry->info.cname, ipstring, sizeof(entry->info.cname));
+       dp_strlcpy(entry->info.cname, ipstring, sizeof(entry->info.cname));
        entry->info.isfavorite = isfavorite;
 
        serverlist_cachecount++;
@@ -2089,7 +2089,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;
@@ -2123,7 +2123,7 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
                                return true;
                        }
                        Con_DPrintf("\"%s\" received, sending connect request back to %s\n", string, addressstring2);
-                       strlcpy(cl_connect_status, "Connect: replying to challenge...", sizeof(cl_connect_status));
+                       dp_strlcpy(cl_connect_status, "Connect: replying to challenge...", sizeof(cl_connect_status));
 
                        Protocol_Names(protocolnames, sizeof(protocolnames));
                        // update the server IP in the userinfo (QW servers expect this, and it is used by the reconnect command)
@@ -2196,17 +2196,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;
 
@@ -2240,16 +2240,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;
 
@@ -2310,7 +2310,7 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
                                return true;
                        }
                        Con_DPrintf("challenge %s received, sending QuakeWorld connect request back to %s\n", string + 1, addressstring2);
-                       strlcpy(cl_connect_status, "Connect: replying to challenge...", sizeof(cl_connect_status));
+                       dp_strlcpy(cl_connect_status, "Connect: replying to challenge...", sizeof(cl_connect_status));
 
                        cls.qw_qport = qport.integer;
                        // update the server IP in the userinfo (QW servers expect this, and it is used by the reconnect command)
@@ -2347,10 +2347,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
@@ -2470,10 +2470,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);
@@ -2663,7 +2663,7 @@ void NetConn_ClientFrame(void)
 
                        cls.connect_trying = false;
                        LHNETADDRESS_ToString(&cls.connect_address, address, sizeof(address), true);
-                       strlcpy(cl_connect_status, "Connect: failed, no reply", sizeof(cl_connect_status));
+                       dp_strlcpy(cl_connect_status, "Connect: failed, no reply", sizeof(cl_connect_status));
                        Con_Printf(CON_ERROR "%s from %s\n", cl_connect_status, address);
                        return;
                }
@@ -2840,17 +2840,17 @@ static qbool NetConn_BuildStatusResponse(const char* challenge, char* out_msg, s
                                if (IS_NEXUIZ_DERIVED(gamemode) && (teamplay.integer > 0))
                                {
                                        if(client->frags == -666) // spectator
-                                               strlcpy(teambuf, " 0", sizeof(teambuf));
+                                               dp_strlcpy(teambuf, " 0", sizeof(teambuf));
                                        else if(client->colors == 0x44) // red team
-                                               strlcpy(teambuf, " 1", sizeof(teambuf));
+                                               dp_strlcpy(teambuf, " 1", sizeof(teambuf));
                                        else if(client->colors == 0xDD) // blue team
-                                               strlcpy(teambuf, " 2", sizeof(teambuf));
+                                               dp_strlcpy(teambuf, " 2", sizeof(teambuf));
                                        else if(client->colors == 0xCC) // yellow team
-                                               strlcpy(teambuf, " 3", sizeof(teambuf));
+                                               dp_strlcpy(teambuf, " 3", sizeof(teambuf));
                                        else if(client->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;
@@ -3034,7 +3034,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])  // Ignore empty entries due to leading/duplicate space.
                        if(comparator(peeraddress, buf, password, cs, cslen))
                                goto allow;
@@ -3053,7 +3053,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])  // Ignore empty entries due to leading/duplicate space.
                        if(comparator(peeraddress, buf, password, cs, cslen))
                                goto check;
@@ -3649,7 +3649,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
@@ -3797,8 +3797,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);
@@ -3943,7 +3943,7 @@ void NetConn_QueryMasters(qbool querydp, qbool queryqw)
        if (!masterquerycount)
        {
                Con_Print(CON_ERROR "Unable to query master servers, no suitable network sockets active.\n");
-               strlcpy(cl_connect_status, "No network", sizeof(cl_connect_status));
+               dp_strlcpy(cl_connect_status, "No network", sizeof(cl_connect_status));
        }
 }
 #endif
index 837ad97bed27445f804927f334b6b94440882747..d72e961571fb698cda74276421b2da6609caf224 100644 (file)
@@ -110,8 +110,8 @@ void Protocol_Names(char *buffer, size_t buffersize)
        for (i = 0;protocolversioninfo[i].name;i++)
        {
                if (i > 0)
-                       strlcat(buffer, " ", buffersize);
-               strlcat(buffer, protocolversioninfo[i].name, buffersize);
+                       dp_strlcat(buffer, " ", buffersize);
+               dp_strlcat(buffer, protocolversioninfo[i].name, buffersize);
        }
 }
 
index 2812f2c29dc106e3d69c7f4b05d57413973c509f..379b7d362bbebce76ad2417b09207424b365b504 100644 (file)
@@ -2626,7 +2626,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;
@@ -2657,7 +2657,7 @@ void VM_tokenize_console (prvm_prog_t *prog)
 
        VM_SAFEPARMCOUNT(1, VM_tokenize_console);
 
-       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;
@@ -2707,7 +2707,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;
@@ -3327,7 +3327,7 @@ void VM_findkeysforcommand(prvm_prog_t *prog)
 
        ret[0] = 0;
        for(i = 0; i < FKFC_NUMKEYS; i++)
-               strlcat(ret, va(vabuf, sizeof(vabuf), " \'%i\'", keys[i]), sizeof(ret));
+               dp_strlcat(ret, va(vabuf, sizeof(vabuf), " \'%i\'", keys[i]), sizeof(ret));
 
        PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(prog, ret);
 }
@@ -3713,7 +3713,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 );
 }
 
@@ -3752,7 +3752,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 );
 }
 
@@ -4104,8 +4104,8 @@ void VM_buf_implode (prvm_prog_t *prog)
                        l += (i > 0 ? strlen(sep) : 0) + strlen(stringbuffer->strings[i]);
                        if (l >= sizeof(k) - 1)
                                break;
-                       strlcat(k, sep, sizeof(k));
-                       strlcat(k, stringbuffer->strings[i], sizeof(k));
+                       dp_strlcat(k, sep, sizeof(k));
+                       dp_strlcat(k, stringbuffer->strings[i], sizeof(k));
                }
        }
        PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(prog, k);
@@ -4540,7 +4540,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);
@@ -4586,7 +4586,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);
        }
 
@@ -5043,7 +5043,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);
 
@@ -5462,7 +5462,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)
@@ -5482,7 +5482,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
@@ -5492,7 +5492,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)
index fa313eff12f2b9a6a0354a60d42ed93a373f78bf..a03d0bd1352a636b3d18b11edb51bb8b18017a29 100644 (file)
@@ -448,7 +448,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;
@@ -555,7 +555,7 @@ char *PRVM_UglyValueString (prvm_prog_t *prog, etype_t type, prvm_eval_t *val, c
                if ((unsigned int)val->function < (unsigned int)prog->progs_numfunctions)
                {
                        f = prog->functions + val->function;
-                       strlcpy (line, PRVM_GetString (prog, f->s_name), linelength);
+                       dp_strlcpy (line, PRVM_GetString (prog, f->s_name), linelength);
                }
                else
                        dpsnprintf (line, linelength, "bad function %" PRVM_PRIi " (invalid!)", val->function);
@@ -697,10 +697,10 @@ void PRVM_ED_Print(prvm_prog_t *prog, prvm_edict_t *ed, const char *wildcard_fie
                        tempstring2[sizeof(tempstring2)-1] = 0;
                        name = tempstring2;
                }
-               strlcat(tempstring, name, sizeof(tempstring));
+               dp_strlcat(tempstring, name, sizeof(tempstring));
                for (l = strlen(name);l < 14;l++)
-                       strlcat(tempstring, " ", sizeof(tempstring));
-               strlcat(tempstring, " ", sizeof(tempstring));
+                       dp_strlcat(tempstring, " ", sizeof(tempstring));
+               dp_strlcat(tempstring, " ", sizeof(tempstring));
 
                name = PRVM_ValueString(prog, (etype_t)d->type, val, valuebuf, sizeof(valuebuf));
                if (strlen(name) > sizeof(tempstring2)-4)
@@ -710,8 +710,8 @@ void PRVM_ED_Print(prvm_prog_t *prog, prvm_edict_t *ed, const char *wildcard_fie
                        tempstring2[sizeof(tempstring2)-1] = 0;
                        name = tempstring2;
                }
-               strlcat(tempstring, name, sizeof(tempstring));
-               strlcat(tempstring, "\n", sizeof(tempstring));
+               dp_strlcat(tempstring, name, sizeof(tempstring));
+               dp_strlcat(tempstring, "\n", sizeof(tempstring));
                if (strlen(tempstring) >= sizeof(tempstring)/2)
                {
                        Con_Print(tempstring);
@@ -946,7 +946,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))
@@ -1296,7 +1296,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
@@ -1304,9 +1304,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);
@@ -1346,7 +1346,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);
                }
 
@@ -1852,7 +1852,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')
@@ -1947,7 +1947,7 @@ static void PRVM_LoadLNO( prvm_prog_t *prog, const char *progname ) {
        char filename[512];
 
        FS_StripExtension( progname, filename, sizeof( filename ) );
-       strlcat( filename, ".lno", sizeof( filename ) );
+       dp_strlcat( filename, ".lno", sizeof( filename ) );
 
        lno = FS_LoadFile( filename, tempmempool, false, &filesize );
        if( !lno ) {
@@ -2782,32 +2782,32 @@ static void PRVM_Fields_f(cmd_state_t *cmd)
                switch(d->type & ~DEF_SAVEGLOBAL)
                {
                case ev_string:
-                       strlcat(tempstring, "string   ", sizeof(tempstring));
+                       dp_strlcat(tempstring, "string   ", sizeof(tempstring));
                        break;
                case ev_entity:
-                       strlcat(tempstring, "entity   ", sizeof(tempstring));
+                       dp_strlcat(tempstring, "entity   ", sizeof(tempstring));
                        break;
                case ev_function:
-                       strlcat(tempstring, "function ", sizeof(tempstring));
+                       dp_strlcat(tempstring, "function ", sizeof(tempstring));
                        break;
                case ev_field:
-                       strlcat(tempstring, "field    ", sizeof(tempstring));
+                       dp_strlcat(tempstring, "field    ", sizeof(tempstring));
                        break;
                case ev_void:
-                       strlcat(tempstring, "void     ", sizeof(tempstring));
+                       dp_strlcat(tempstring, "void     ", sizeof(tempstring));
                        break;
                case ev_float:
-                       strlcat(tempstring, "float    ", sizeof(tempstring));
+                       dp_strlcat(tempstring, "float    ", sizeof(tempstring));
                        break;
                case ev_vector:
-                       strlcat(tempstring, "vector   ", sizeof(tempstring));
+                       dp_strlcat(tempstring, "vector   ", sizeof(tempstring));
                        break;
                case ev_pointer:
-                       strlcat(tempstring, "pointer  ", sizeof(tempstring));
+                       dp_strlcat(tempstring, "pointer  ", sizeof(tempstring));
                        break;
                default:
                        dpsnprintf (tempstring2, sizeof(tempstring2), "bad type %i ", d->type & ~DEF_SAVEGLOBAL);
-                       strlcat(tempstring, tempstring2, sizeof(tempstring));
+                       dp_strlcat(tempstring, tempstring2, sizeof(tempstring));
                        break;
                }
                if (strlen(name) > sizeof(tempstring2)-4)
@@ -2817,12 +2817,12 @@ static void PRVM_Fields_f(cmd_state_t *cmd)
                        tempstring2[sizeof(tempstring2)-1] = 0;
                        name = tempstring2;
                }
-               strlcat(tempstring, name, sizeof(tempstring));
+               dp_strlcat(tempstring, name, sizeof(tempstring));
                for (j = (int)strlen(name);j < 25;j++)
-                       strlcat(tempstring, " ", sizeof(tempstring));
+                       dp_strlcat(tempstring, " ", sizeof(tempstring));
                dpsnprintf(tempstring2, sizeof(tempstring2), "%5d", counts[i]);
-               strlcat(tempstring, tempstring2, sizeof(tempstring));
-               strlcat(tempstring, "\n", sizeof(tempstring));
+               dp_strlcat(tempstring, tempstring2, sizeof(tempstring));
+               dp_strlcat(tempstring, "\n", sizeof(tempstring));
                if (strlen(tempstring) >= sizeof(tempstring)/2)
                {
                        Con_Print(tempstring);
@@ -3073,7 +3073,7 @@ static void PRVM_Breakpoint_f(cmd_state_t *cmd)
 
        {
                debug_data_t *debug = &debug_data[prog - prvm_prog_list];
-               strlcpy(debug->break_statement, Cmd_Argv(cmd, 2), sizeof(debug->break_statement));
+               dp_strlcpy(debug->break_statement, Cmd_Argv(cmd, 2), sizeof(debug->break_statement));
        }
        PRVM_UpdateBreakpoints(prog);
 }
@@ -3102,7 +3102,7 @@ static void PRVM_GlobalWatchpoint_f(cmd_state_t *cmd)
 
        {
                debug_data_t *debug = &debug_data[prog - prvm_prog_list];
-               strlcpy(debug->watch_global, Cmd_Argv(cmd, 2), sizeof(debug->watch_global));
+               dp_strlcpy(debug->watch_global, Cmd_Argv(cmd, 2), sizeof(debug->watch_global));
        }
        PRVM_UpdateBreakpoints(prog);
 }
@@ -3132,7 +3132,7 @@ static void PRVM_EdictWatchpoint_f(cmd_state_t *cmd)
        {
                debug_data_t *debug = &debug_data[prog - prvm_prog_list];
                debug->watch_edict = atoi(Cmd_Argv(cmd, 2));
-               strlcpy(debug->watch_field, Cmd_Argv(cmd, 3), sizeof(debug->watch_field));
+               dp_strlcpy(debug->watch_field, Cmd_Argv(cmd, 3), sizeof(debug->watch_field));
        }
        PRVM_UpdateBreakpoints(prog);
 }
index af71b3020e5cd76404902cb953c1a42e302a2b26..e3ad8a8283295907ee0b684eadae80ee268f9ff6 100644 (file)
@@ -441,7 +441,7 @@ void PRVM_ShortStackTrace(prvm_prog_t *prog, char *buf, size_t bufsize)
        }
        else
        {
-               strlcpy(buf, "<NO PROG>", bufsize);
+               dp_strlcpy(buf, "<NO PROG>", bufsize);
                return;
        }
 
@@ -451,7 +451,7 @@ void PRVM_ShortStackTrace(prvm_prog_t *prog, char *buf, size_t bufsize)
        {
                f = prog->stack[i].f;
 
-               if(strlcat(buf,
+               if(dp_strlcat(buf,
                        f
                                ? va(vabuf, sizeof(vabuf), "%s:%s(%i) ", PRVM_GetString(prog, f->s_file), PRVM_GetString(prog, f->s_name), prog->stack[i].s - f->first_statement)
                                : "<NULL> ",
index 8d24ebce7db48068f5393721b60a9225122886d9..2c5cecd34b75bbf65a2017dce825bf46ede3f39b 100644 (file)
@@ -2996,7 +2996,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;
@@ -4676,7 +4676,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;
@@ -5100,14 +5100,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))
@@ -5319,7 +5319,7 @@ void R_Shadow_EditLights_Reload_f(cmd_state_t *cmd)
 {
        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)
        {
@@ -5392,7 +5392,7 @@ static void R_Shadow_EditLights_Edit_f(cmd_state_t *cmd)
        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;
@@ -5596,7 +5596,7 @@ static void R_Shadow_EditLights_Edit_f(cmd_state_t *cmd)
                        return;
                }
                if (Cmd_Argc(cmd) == 3)
-                       strlcpy(cubemapname, Cmd_Argv(cmd, 2), sizeof(cubemapname));
+                       dp_strlcpy(cubemapname, Cmd_Argv(cmd, 2), sizeof(cubemapname));
                else
                        cubemapname[0] = 0;
        }
@@ -5927,7 +5927,7 @@ static void R_Shadow_EditLights_CopyInfo_f(cmd_state_t *cmd)
        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 8c29d32ef9b36f345768921b3a7e428b8ae5d398..67ece7289ce60c8d8bc4e89f31c0af1114216bce 100644 (file)
--- a/r_sky.c
+++ b/r_sky.c
@@ -157,7 +157,7 @@ int R_SetSkyBox(const char *sky)
                return false;
        }
 
-       strlcpy(skyname, sky, sizeof(skyname));
+       dp_strlcpy(skyname, sky, sizeof(skyname));
 
        return R_LoadSkyBox();
 }
index 6dfc7938f917c294aa551e31af936c77f44e1e26..55c43e7ed8a7272a689baa23a463c6c434091e98 100644 (file)
--- a/r_stats.c
+++ b/r_stats.c
@@ -218,10 +218,10 @@ void R_TimeReport(const char *desc)
 
        if (speedstringcount + length > (vid_conwidth.integer / 8))
        {
-               strlcat(r_speeds_timestring, "\n", sizeof(r_speeds_timestring));
+               dp_strlcat(r_speeds_timestring, "\n", sizeof(r_speeds_timestring));
                speedstringcount = 0;
        }
-       strlcat(r_speeds_timestring, tempbuf, sizeof(r_speeds_timestring));
+       dp_strlcat(r_speeds_timestring, tempbuf, sizeof(r_speeds_timestring));
        speedstringcount += length;
 }
 
diff --git a/sbar.c b/sbar.c
index 854c62a683e656bc01709e7a1c063e0d02f5679f..88ccfc3134e8d88b9df00d2ba053c830c08ec13c 100644 (file)
--- a/sbar.c
+++ b/sbar.c
@@ -620,7 +620,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;
@@ -1141,12 +1141,12 @@ void Sbar_ShowFPS(void)
        }
        if (cl_showtime.integer)
        {
-               strlcpy(timestring, Sys_TimeString(cl_showtime_format.string), sizeof(timestring));
+               dp_strlcpy(timestring, Sys_TimeString(cl_showtime_format.string), sizeof(timestring));
                fps_strings++;
        }
        if (cl_showdate.integer)
        {
-               strlcpy(datestring, Sys_TimeString(cl_showdate_format.string), sizeof(datestring));
+               dp_strlcpy(datestring, Sys_TimeString(cl_showdate_format.string), sizeof(datestring));
                fps_strings++;
        }
        if (cl_showblur.integer)
@@ -1218,9 +1218,9 @@ void Sbar_ShowFPS(void)
                        svtrace = SV_TraceLine(org, dest, MOVE_HITMODEL, NULL, SUPERCONTENTS_SOLID, 0, MATERIALFLAGMASK_TRANSLUCENT, collision_extendmovelength.value);
                cltrace = CL_TraceLine(org, dest, MOVE_HITMODEL, NULL, SUPERCONTENTS_SOLID, 0, MATERIALFLAGMASK_TRANSLUCENT, collision_extendmovelength.value, true, false, &hitnetentity, true, true);
                if (cltrace.hittexture)
-                       strlcpy(texstring, cltrace.hittexture->name, sizeof(texstring));
+                       dp_strlcpy(texstring, cltrace.hittexture->name, sizeof(texstring));
                else
-                       strlcpy(texstring, "(no texture hit)", sizeof(texstring));
+                       dp_strlcpy(texstring, "(no texture hit)", sizeof(texstring));
                fps_strings++;
                if (svtrace.fraction < cltrace.fraction)
                {
@@ -1230,7 +1230,7 @@ void Sbar_ShowFPS(void)
                                dpsnprintf(entstring, sizeof(entstring), "server entity %i", (int)PRVM_EDICT_TO_PROG(svtrace.ent));
                        }
                        else
-                               strlcpy(entstring, "(no entity hit)", sizeof(entstring));
+                               dp_strlcpy(entstring, "(no entity hit)", sizeof(entstring));
                }
                else
                {
@@ -1242,9 +1242,9 @@ void Sbar_ShowFPS(void)
                        else if (hitnetentity > 0)
                                dpsnprintf(entstring, sizeof(entstring), "network entity %i", hitnetentity);
                        else if (hitnetentity == 0)
-                               strlcpy(entstring, "world entity", sizeof(entstring));
+                               dp_strlcpy(entstring, "world entity", sizeof(entstring));
                        else
-                               strlcpy(entstring, "(no entity hit)", sizeof(entstring));
+                               dp_strlcpy(entstring, "(no entity hit)", sizeof(entstring));
                }
                fps_strings++;
        }
index 6f3bf31e1294bd9f313377db4c08ebd6b1c9c29e..53e4da999445bab2e4516f062afe1dcb8d7d0527 100644 (file)
@@ -276,9 +276,9 @@ static void S_Play_Common (cmd_state_t *cmd, float fvol, float attenuation)
        while (i < Cmd_Argc (cmd))
        {
                // Get the name, and appends ".wav" as an extension if there's none
-               strlcpy (name, Cmd_Argv(cmd, i), sizeof (name));
+               dp_strlcpy (name, Cmd_Argv(cmd, i), sizeof (name));
                if (!strrchr (name, '.'))
-                       strlcat (name, ".wav", sizeof (name));
+                       dp_strlcat (name, ".wav", sizeof (name));
                i++;
 
                // If we need to get the volume from the command line
@@ -927,7 +927,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;
index a28b07893d7dc971511275c3d3d677627f8ba19b..a210b1cb2342abd563eb22a2a8241a5f7dc44c70 100644 (file)
@@ -78,7 +78,7 @@ static void SV_Map_f(cmd_state_t *cmd)
                host.hook.ToggleMenu();
 
        svs.serverflags = 0;                    // haven't completed an episode yet
-       strlcpy(level, Cmd_Argv(cmd, 1), sizeof(level));
+       dp_strlcpy(level, Cmd_Argv(cmd, 1), sizeof(level));
        SV_SpawnServer(level);
 
        if(sv.active && host.hook.ConnectLocal != NULL)
@@ -112,7 +112,7 @@ static void SV_Changelevel_f(cmd_state_t *cmd)
                host.hook.ToggleMenu();
 
        SV_SaveSpawnparms ();
-       strlcpy(level, Cmd_Argv(cmd, 1), sizeof(level));
+       dp_strlcpy(level, Cmd_Argv(cmd, 1), sizeof(level));
        SV_SpawnServer(level);
        
        if(sv.active && host.hook.ConnectLocal != NULL)
@@ -144,7 +144,7 @@ static void SV_Restart_f(cmd_state_t *cmd)
        if(host.hook.ToggleMenu)
                host.hook.ToggleMenu();
 
-       strlcpy(mapname, sv.name, sizeof(mapname));
+       dp_strlcpy(mapname, sv.name, sizeof(mapname));
        SV_SpawnServer(mapname);
        
        if(sv.active && host.hook.ConnectLocal != NULL)
@@ -469,7 +469,7 @@ static void SV_Say(cmd_state_t *cmd, qbool teamonly)
                p2[-1] = 0;
                p2--;
        }
-       strlcat(text, "\n", sizeof(text));
+       dp_strlcat(text, "\n", sizeof(text));
 
        // note: save is not a valid edict if fromServer is true
        save = host_client;
@@ -780,9 +780,9 @@ static void SV_Status_f(cmd_state_t *cmd)
                }
 
                if(sv_status_privacy.integer && cmd->source != src_local && LHNETADDRESS_GetAddressType(&host_client->netconnection->peeraddress) != LHNETADDRESSTYPE_LOOP)
-                       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;
 
@@ -838,7 +838,7 @@ void SV_Name(int clientnum)
        {
                if (host_client->begun)
                        SV_BroadcastPrintf("\003%s ^7changed name to ^3%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, clientnum);
@@ -867,7 +867,7 @@ static void SV_Name_f(cmd_state_t *cmd)
        else
                newNameSource = Cmd_Args(cmd);
 
-       strlcpy(newName, newNameSource, sizeof(newName));
+       dp_strlcpy(newName, newNameSource, sizeof(newName));
 
        if (cmd->source == src_local)
                return;
@@ -881,7 +881,7 @@ static void SV_Name_f(cmd_state_t *cmd)
        host_client->nametime = host.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')
@@ -1139,9 +1139,9 @@ static void SV_Playermodel_f(cmd_state_t *cmd)
                return;
 
        if (Cmd_Argc (cmd) == 2)
-               strlcpy (newPath, Cmd_Argv(cmd, 1), sizeof (newPath));
+               dp_strlcpy (newPath, Cmd_Argv(cmd, 1), sizeof (newPath));
        else
-               strlcpy (newPath, Cmd_Args(cmd), sizeof (newPath));
+               dp_strlcpy (newPath, Cmd_Args(cmd), sizeof (newPath));
 
        for (i = 0, j = 0;newPath[i];i++)
                if (newPath[i] != '\r' && newPath[i] != '\n')
@@ -1159,11 +1159,11 @@ static void SV_Playermodel_f(cmd_state_t *cmd)
        */
 
        // 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);
@@ -1186,9 +1186,9 @@ static void SV_Playerskin_f(cmd_state_t *cmd)
                return;
 
        if (Cmd_Argc (cmd) == 2)
-               strlcpy (newPath, Cmd_Argv(cmd, 1), sizeof (newPath));
+               dp_strlcpy (newPath, Cmd_Argv(cmd, 1), sizeof (newPath));
        else
-               strlcpy (newPath, Cmd_Args(cmd), sizeof (newPath));
+               dp_strlcpy (newPath, Cmd_Args(cmd), sizeof (newPath));
 
        for (i = 0, j = 0;newPath[i];i++)
                if (newPath[i] != '\r' && newPath[i] != '\n')
@@ -1206,13 +1206,13 @@ static void SV_Playerskin_f(cmd_state_t *cmd)
        */
 
        // 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);
index 08ebe8411bb0e8615fef4bed77fd99d8ce0a8479..de267620568d8b404ac39e24be2488c7c9ecdc20 100644 (file)
--- 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);
index f656085c67ca1d8231ad957cd66caef0f6f8e48a..8dad80edb2893d46ee50fe21c9382567a81502f8 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -959,8 +959,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;
@@ -1237,7 +1237,7 @@ static void SV_Download_f(cmd_state_t *cmd)
 
        Download_CheckExtensions(cmd);
 
-       strlcpy(host_client->download_name, Cmd_Argv(cmd, 1), sizeof(host_client->download_name));
+       dp_strlcpy(host_client->download_name, Cmd_Argv(cmd, 1), sizeof(host_client->download_name));
        extension = FS_FileExtension(host_client->download_name);
 
        // host_client is asking to download a specified file
@@ -1250,7 +1250,7 @@ static void SV_Download_f(cmd_state_t *cmd)
                extensions[0] = '\0';
                
                if(host_client->download_deflate)
-                       strlcat(extensions, " deflate", sizeof(extensions));
+                       dp_strlcat(extensions, " deflate", sizeof(extensions));
                
                Con_DPrintf("Downloading %s to %s\n", host_client->download_name, host_client->name);
 
@@ -1405,7 +1405,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])
@@ -1419,7 +1419,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
@@ -1468,7 +1468,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])
@@ -1482,7 +1482,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);
@@ -1523,7 +1523,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)
@@ -1547,7 +1547,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++;
                                        }
                                }
@@ -1568,7 +1568,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;
                                                        }
                                                }
@@ -1721,7 +1721,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");
@@ -1922,10 +1922,10 @@ void SV_SpawnServer (const char *map)
        sv.active = true;
 
        // set level base name variables for later use
-       strlcpy (sv.name, map, sizeof (sv.name));
-       strlcpy(sv.worldname, modelname, sizeof(sv.worldname));
+       dp_strlcpy (sv.name, map, 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);
@@ -1976,10 +1976,10 @@ void SV_SpawnServer (const char *map)
        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);
@@ -2092,7 +2092,7 @@ void SV_SpawnServer (const char *map)
        }
 
        // 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_Printf("Server spawned.\n");
index 4c0eca7d3958f1185464c80efb84863967ffb3ac..db8764fcce492f83d0669590de3ff8e46a7e4620 100644 (file)
--- a/sv_save.c
+++ b/sv_save.c
@@ -231,7 +231,7 @@ void SV_Savegame_f(cmd_state_t *cmd)
                return;
        }
 
-       strlcpy (name, Cmd_Argv(cmd, 1), sizeof (name));
+       dp_strlcpy (name, Cmd_Argv(cmd, 1), sizeof (name));
        FS_DefaultExtension (name, ".sav", sizeof (name));
 
        SV_Savegame_to(prog, name);
@@ -265,7 +265,7 @@ void SV_Loadgame_f(cmd_state_t *cmd)
                return;
        }
 
-       strlcpy (filename, Cmd_Argv(cmd, 1), sizeof(filename));
+       dp_strlcpy (filename, Cmd_Argv(cmd, 1), sizeof(filename));
        FS_DefaultExtension (filename, ".sav", sizeof (filename));
 
        Con_Printf("Loading game from %s...\n", filename);
@@ -320,7 +320,7 @@ void SV_Loadgame_f(cmd_state_t *cmd)
 
        // 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("SV_Loadgame_f: loading time\n");
@@ -362,7 +362,7 @@ void SV_Loadgame_f(cmd_state_t *cmd)
                        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)
@@ -481,7 +481,7 @@ void SV_Loadgame_f(cmd_state_t *cmd)
                                        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);
                                }
@@ -492,7 +492,7 @@ void SV_Loadgame_f(cmd_state_t *cmd)
                                        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
@@ -504,7 +504,7 @@ void SV_Loadgame_f(cmd_state_t *cmd)
                                        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);
                                }
index b7491e4a266af178a4204e6536ae383fc1467b8f..a8a44347724791acfc0f179655e2c010ae2dd65a 100644 (file)
--- a/sv_send.c
+++ b/sv_send.c
@@ -1154,7 +1154,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);
        }
 
@@ -1614,7 +1614,7 @@ static void SV_UpdateToReliableMessages (void)
                // always point the string back at host_client->name to keep it safe
                //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));
                SV_Name(i);
 
                // DP_SV_CLIENTCOLORS
@@ -1635,7 +1635,7 @@ static void SV_UpdateToReliableMessages (void)
                // always point the string back at host_client->name to keep it safe
                //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
@@ -1645,7 +1645,7 @@ static void SV_UpdateToReliableMessages (void)
                // always point the string back at host_client->name to keep it safe
                //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]
index ccd7e6a99a2077d1b075b9cde0825d3cba273a42..90ee0787b6073eb44cc91ae6a3f17132b7a81263 100644 (file)
@@ -1300,7 +1300,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)
@@ -1740,7 +1740,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] = s[ 0] + s[ 1] * 256 + s[ 2] * 65536 + s[ 3] * 16777216;
                        stats[i+1] = s[ 4] + s[ 5] * 256 + s[ 6] * 65536 + s[ 7] * 16777216;
                        stats[i+2] = s[ 8] + s[ 9] * 256 + s[10] * 65536 + s[11] * 16777216;
index a876b38885f8a1bac4e4c2a9db3939140ef6a787..f96bc87eabfc7aa5dc15177c0e9f3b6f77477a39 100644 (file)
--- a/sys_sdl.c
+++ b/sys_sdl.c
@@ -42,7 +42,7 @@ char *Sys_SDL_GetClipboardData (void)
                size_t allocsize;
                allocsize = min(MAX_INPUTLINE, strlen(cliptext) + 1);
                data = (char *)Z_Malloc (allocsize);
-               strlcpy (data, cliptext, allocsize);
+               dp_strlcpy (data, cliptext, allocsize);
                SDL_free(cliptext);
        }
 
index 88454e62fe7b1d1d72d550ab1c1ad4e9c59a1776..f9f118bf5180e88a79d936e1a9421acc276d5bdc 100644 (file)
@@ -213,13 +213,13 @@ notfound:
        if (!dllhandle && strrchr(sys.argv[0], '/'))
        {
                char path[MAX_OSPATH];
-               strlcpy(path, sys.argv[0], sizeof(path));
+               dp_strlcpy(path, sys.argv[0], sizeof(path));
                strrchr(path, '/')[1] = 0;
                for (i = 0; dllnames[i] != NULL; i++)
                {
                        char temp[MAX_OSPATH];
-                       strlcpy(temp, path, sizeof(temp));
-                       strlcat(temp, dllnames[i], sizeof(temp));
+                       dp_strlcpy(temp, path, sizeof(temp));
+                       dp_strlcat(temp, dllnames[i], sizeof(temp));
                        Con_DPrintf (" \"%s\"", temp);
 
                        if(Sys_LoadLibrary(temp, &dllhandle))
index ab55661a6eff572af83f574e1c2f9f8be59b552a..a3d86d3ec060f0f55202662ef4712ac304584fbf 100644 (file)
@@ -700,8 +700,8 @@ void GL_InitFunctions(void)
                {
                        Con_DPrintf("GL context is missing required function \"%s\"!\n", func->name);
                        missingrequiredfuncs = true;
-                       strlcat(missingfuncs, " ", sizeof(missingfuncs));
-                       strlcat(missingfuncs, func->name, sizeof(missingfuncs));
+                       dp_strlcat(missingfuncs, " ", sizeof(missingfuncs));
+                       dp_strlcat(missingfuncs, func->name, sizeof(missingfuncs));
                }
        }
 
diff --git a/world.c b/world.c
index e37b24c01325f9ef136abef2ace19350ce2f5c0b..a95330fae99a4ba0ed9dc3d138d7038a6dcb9b78 100644 (file)
--- a/world.c
+++ b/world.c
@@ -119,7 +119,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 40708bd6913ed713811d61c4c8443446db09c806..1035eb96f264a6dd93909bae6d5a008f3585db7e 100644 (file)
--- a/zone.c
+++ b/zone.c
@@ -520,7 +520,7 @@ mempool_t *_Mem_AllocPool(const char *name, int flags, mempool_t *parent, const
        List_Create(&pool->chain);
        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;
@@ -870,7 +870,7 @@ char* _Mem_strdup (mempool_t *pool, const char* s, const char *filename, int fil
                return NULL;
        sz = strlen (s) + 1;
        p = (char*)_Mem_Alloc (pool, NULL, sz, 16, filename, fileline);
-       strlcpy (p, s, sz);
+       dp_strlcpy (p, s, sz);
        return p;
 }