From cb59bfdc634819865a35d076781b344b6f5f4a12 Mon Sep 17 00:00:00 2001 From: Kevin Shanahan Date: Mon, 11 Feb 2013 20:05:30 +1030 Subject: [PATCH] qbsp: trivial constification of a few strings/args Signed-off-by: Kevin Shanahan --- qbsp/cmdlib.c | 4 ++-- qbsp/file.c | 2 +- qbsp/file.h | 2 +- qbsp/globals.c | 4 ++-- qbsp/map.c | 6 +++--- qbsp/qbsp.h | 14 +++++++------- qbsp/util.c | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/qbsp/cmdlib.c b/qbsp/cmdlib.c index 18390794..6f9c67e5 100644 --- a/qbsp/cmdlib.c +++ b/qbsp/cmdlib.c @@ -36,7 +36,7 @@ char * -copystring(char *s) +copystring(const char *s) { char *b; @@ -73,7 +73,7 @@ I_FloatTime(void) void -DefaultExtension(char *path, char *extension) +DefaultExtension(char *path, const char *extension) { char *src; diff --git a/qbsp/file.c b/qbsp/file.c index e0ed3342..66650d15 100644 --- a/qbsp/file.c +++ b/qbsp/file.c @@ -31,7 +31,7 @@ LoadFile ============== */ size_t -LoadFile(char *filename, void **buf, bool nofail) +LoadFile(const char *filename, void **buf, bool nofail) { size_t len; FILE *f; diff --git a/qbsp/file.h b/qbsp/file.h index 33e9b189..d036c3bd 100644 --- a/qbsp/file.h +++ b/qbsp/file.h @@ -24,6 +24,6 @@ #include -size_t LoadFile(char *filename, void **buf, bool nofail); +size_t LoadFile(const char *filename, void **buf, bool nofail); #endif diff --git a/qbsp/globals.c b/qbsp/globals.c index 9283ed95..14c6da97 100644 --- a/qbsp/globals.c +++ b/qbsp/globals.c @@ -55,7 +55,7 @@ vec3_t vec3_origin = { 0, 0, 0 }; // util.c FILE *logfile; -char *rgszWarnings[cWarnings] = { +const char *rgszWarnings[cWarnings] = { "No wad or _wad key exists in the worldmodel", "No valid WAD filenames in worldmodel", "Multiple info_player_start entities", @@ -85,7 +85,7 @@ char *rgszWarnings[cWarnings] = { "line %d: Face with degenerate QuArK-style texture axes", }; -char *rgszErrors[cErrors] = { +const char *rgszErrors[cErrors] = { "No leak node in WriteLeakNode", "Unknown option '%s'", "line %d: Entity key or value too long", diff --git a/qbsp/map.c b/qbsp/map.c index 4a2303f5..831f599c 100644 --- a/qbsp/map.c +++ b/qbsp/map.c @@ -627,7 +627,7 @@ PrintEntity(int iEntity) const char * -ValueForKey(int iEntity, char *key) +ValueForKey(int iEntity, const char *key) { epair_t *ep; @@ -640,7 +640,7 @@ ValueForKey(int iEntity, char *key) void -SetKeyValue(int iEntity, char *key, char *value) +SetKeyValue(int iEntity, const char *key, const char *value) { epair_t *ep; @@ -659,7 +659,7 @@ SetKeyValue(int iEntity, char *key, char *value) void -GetVectorForKey(int iEntity, char *szKey, vec3_t vec) +GetVectorForKey(int iEntity, const char *szKey, vec3_t vec) { const char *value; double v1, v2, v3; diff --git a/qbsp/qbsp.h b/qbsp/qbsp.h index 529fc23e..cc147ac4 100644 --- a/qbsp/qbsp.h +++ b/qbsp/qbsp.h @@ -174,12 +174,12 @@ typedef unsigned char byte; double I_FloatTime(void); -void DefaultExtension(char *path, char *extension); +void DefaultExtension(char *path, const char *extension); void StripExtension(char *path); void StripFilename(char *path); int IsAbsolutePath(const char *path); -char *copystring(char *s); +char *copystring(const char *s); //===== mathlib.h @@ -634,9 +634,9 @@ void LoadMapFile(void); int FindMiptex(char *name); void PrintEntity(int iEntity); -const char *ValueForKey(int iEntity, char *key); -void SetKeyValue(int iEntity, char *key, char *value); -void GetVectorForKey(int iEntity, char *szKey, vec3_t vec); +const char *ValueForKey(int iEntity, const char *key); +void SetKeyValue(int iEntity, const char *key, const char *value); +void GetVectorForKey(int iEntity, const char *szKey, vec3_t vec); void WriteEntitiesToString(void); @@ -659,8 +659,8 @@ void ExportDrawNodes(mapentity_t *ent, node_t *headnode); #define msgScreen 6 #define msgPercent 7 -extern char *rgszWarnings[cWarnings]; -extern char *rgszErrors[cErrors]; +extern const char *rgszWarnings[cWarnings]; +extern const char *rgszErrors[cErrors]; extern const int rgcMemSize[]; extern void *AllocMem(int Type, int cSize, bool fZero); diff --git a/qbsp/util.c b/qbsp/util.c index 29d6e487..041b3585 100644 --- a/qbsp/util.c +++ b/qbsp/util.c @@ -137,7 +137,7 @@ PrintMem void PrintMem(void) { - char *rgszMemTypes[] = { + const char *rgszMemTypes[] = { "BSPEntity", "BSPPlane", "BSPTex", "BSPVertex", "BSPVis", "BSPNode", "BSPTexinfo", "BSPFace", "BSPLight", "BSPClipnode", "BSPLeaf", "BSPMarksurface", "BSPEdge", "BSPSurfedge", "BSPModel", "Mapface",