]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sbar.c
SVVM: fully shut down when stopping a server to avoid segfaulting later
[xonotic/darkplaces.git] / sbar.c
diff --git a/sbar.c b/sbar.c
index 854c62a683e656bc01709e7a1c063e0d02f5679f..1a0b4a905ac72a5770b3827af46f4869e932c14c 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;
@@ -682,7 +682,7 @@ static void Sbar_SoloScoreboard (void)
                Sbar_DrawString(8+22*8, 4, va(vabuf, sizeof(vabuf), "Secrets:%3i", cl.stats[STAT_SECRETS]));
 
        // format is like this: e1m1:The Sligpate Complex
-       dpsnprintf(str, sizeof(str), "%s:%s", cl.worldbasename, cl.worldmessage);
+       dpsnprintf(str, sizeof(str), "%s:%.39s", cl.worldbasename, cl.worldmessage);
 
        // if there's a newline character, terminate the string there
        if (strchr(str, '\n'))
@@ -891,7 +891,7 @@ static void Sbar_DrawInventory (void)
 
        // items
        for (i=0 ; i<6 ; i++)
-               if (cl.stats[STAT_ITEMS] & (1<<(17+i)))
+               if (cl.stats[STAT_ITEMS] & (1u<<(17+i)))
                {
                        //MED 01/04/97 changed keys
                        if (!(gamemode == GAME_HIPNOTIC || gamemode == GAME_QUOTH) || (i>1))
@@ -903,7 +903,7 @@ static void Sbar_DrawInventory (void)
        if (gamemode == GAME_HIPNOTIC || gamemode == GAME_QUOTH)
        {
                for (i=0 ; i<2 ; i++)
-                       if (cl.stats[STAT_ITEMS] & (1<<(24+i)))
+                       if (cl.stats[STAT_ITEMS] & (1u<<(24+i)))
                                Sbar_DrawPic (288 + i*16, -16, hsb_items[i]);
        }
 
@@ -911,14 +911,14 @@ static void Sbar_DrawInventory (void)
        {
                // new rogue items
                for (i=0 ; i<2 ; i++)
-                       if (cl.stats[STAT_ITEMS] & (1<<(29+i)))
+                       if (cl.stats[STAT_ITEMS] & (1u<<(29+i)))
                                Sbar_DrawPic (288 + i*16, -16, rsb_items[i]);
        }
        else
        {
                // sigils
                for (i=0 ; i<4 ; i++)
-                       if (cl.stats[STAT_ITEMS] & (1<<(28+i)))
+                       if (cl.stats[STAT_ITEMS] & (1u<<(28+i)))
                                Sbar_DrawPic (320-32 + i*8, -16, sb_sigil[i]);
        }
 }
@@ -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++;
        }