shithub: choc

Download patch

ref: 2f44d86ea23a7737147c1d01622adaf7b7d7f2fe
parent: f1c16b2d0a97c54e154997f54cb1dac26e0d6510
author: Turo Lamminen <turotl@gmail.com>
date: Sat May 19 10:45:43 EDT 2018

dehacked: Make DEH_String parameter and return value const

This can't be broken into smaller pieces because of this kind of code:

        lumpname = DEH_String(lumpname);

--- a/src/deh_str.c
+++ b/src/deh_str.c
@@ -80,7 +80,7 @@
 // Look up a string to see if it has been replaced with something else
 // This will be used throughout the program to substitute text
 
-char *DEH_String(char *s)
+const char *DEH_String(const char *s)
 {
     deh_substitution_t *subst;
 
@@ -368,7 +368,7 @@
 
 static const char *FormatStringReplacement(char *s)
 {
-    char *repl;
+    const char *repl;
 
     repl = DEH_String(s);
 
--- a/src/deh_str.h
+++ b/src/deh_str.h
@@ -24,7 +24,7 @@
 
 // Used to do dehacked text substitutions throughout the program
 
-char *DEH_String(char *s) PRINTF_ARG_ATTR(1);
+const char *DEH_String(const char *s) PRINTF_ARG_ATTR(1);
 void DEH_printf(char *fmt, ...) PRINTF_ATTR(1, 2);
 void DEH_fprintf(FILE *fstream, char *fmt, ...) PRINTF_ATTR(2, 3);
 void DEH_snprintf(char *buffer, size_t len, char *fmt, ...) PRINTF_ATTR(3, 4);
--- a/src/doom/f_finale.c
+++ b/src/doom/f_finale.c
@@ -94,8 +94,8 @@
     { pack_plut, 1, 31, "RROCK19",   P6TEXT},
 };
 
-char*	finaletext;
-char*	finaleflat;
+const char *finaletext;
+const char *finaleflat;
 
 void	F_StartCast (void);
 void	F_CastTicker (void);
@@ -660,7 +660,7 @@
 
 static void F_ArtScreenDrawer(void)
 {
-    char *lumpname;
+    const char *lumpname;
     
     if (gameepisode == 3)
     {
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -618,7 +618,7 @@
     if ((gamemode == commercial)
      && (gameversion == exe_final2 || gameversion == exe_chex))
     {
-        char *skytexturename;
+        const char *skytexturename;
 
         if (gamemap < 12)
         {
@@ -1742,7 +1742,7 @@
   int		episode,
   int		map )
 {
-    char *skytexturename;
+    const char *skytexturename;
     int             i;
 
     if (paused)
--- a/src/doom/hu_stuff.c
+++ b/src/doom/hu_stuff.c
@@ -370,7 +370,7 @@
 {
 
     int		i;
-    char*	s;
+    const char *s;
 
     if (headsupactive)
 	HU_Stop();
--- a/src/strife/g_game.c
+++ b/src/strife/g_game.c
@@ -1934,7 +1934,7 @@
 ( skill_t       skill,
   int           map ) 
 { 
-    char *skytexturename;
+    const char *skytexturename;
     int             i; 
 
     if (paused) 
--- a/src/strife/hu_stuff.c
+++ b/src/strife/hu_stuff.c
@@ -214,7 +214,7 @@
 void HU_Start(void)
 {
     int         i;
-    char*       s;
+    const char *s;
 
     // haleyjd 20120211: [STRIFE] not called here.
     //if (headsupactive)