shithub: choc

Download patch

ref: 6a14787a8a25bf37aacecbd7c42e69ed35e7ad09
parent: cd7cc921f38545a47ed8bc16620ce58c816639e1
author: Fabian Greffrath <fabian@greffrath.com>
date: Wed Oct 28 11:36:30 EDT 2020

heretic: allow for arbitrarily long demo file names (#1328)


--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -109,7 +109,7 @@
 
 int mouseSensitivity;
 
-char demoname[32];
+char *demoname;
 boolean demorecording;
 boolean longtics;               // specify high resolution turning in demos
 boolean lowres_turn;
@@ -1858,6 +1858,7 @@
 void G_RecordDemo(skill_t skill, int numplayers, int episode, int map,
                   const char *name)
 {
+    size_t demoname_size;
     int i;
     int maxsize;
 
@@ -1884,8 +1885,9 @@
 
     G_InitNew(skill, episode, map);
     usergame = false;
-    M_StringCopy(demoname, name, sizeof(demoname));
-    M_StringConcat(demoname, ".lmp", sizeof(demoname));
+    demoname_size = strlen(name) + 5;
+    demoname = Z_Malloc(demoname_size, PU_STATIC, NULL);
+    M_snprintf(demoname, demoname_size, "%s.lmp", name);
     maxsize = 0x20000;
 
     //!