Do a const-correct run.

This commit is contained in:
Bill Currie 2010-09-28 18:41:38 +09:00
parent 62c73b300e
commit 1b7be81f11
21 changed files with 131 additions and 146 deletions

View file

@ -16,27 +16,27 @@ typedef struct {
-initFromFile:(FILE *) fp; -initFromFile:(FILE *) fp;
-(id) parseMultipleFrom:(char *) value; -(id) parseMultipleFrom:(const char *) value;
-(int) getValueUnits:(char *) key; -(int) getValueUnits:(const char *) key;
-delString:(char *)string fromValue:(char *) key; -delString:(const char *)string fromValue:(const char *) key;
-addString:(char *)string toValue:(char *) key; -addString:(const char *)string toValue:(const char *) key;
-(char *) convertListToString:(id) list; -(char *) convertListToString:(id) list;
-(char *) getStringFor:(char *) name; -(const char *) getStringFor:(const char *) name;
-removeKeyword:(char *) key; -removeKeyword:(const char *) key;
-(unsigned int) getValueFor:(char *) name; -(unsigned int) getValueFor:(const char *) name;
-changeStringFor:(char *)key to:(char *) value; -changeStringFor:(const char *)key to:(const char *) value;
-(dict_t *) findKeyword:(char *) key; -(dict_t *) findKeyword:(const char *) key;
-writeBlockTo:(FILE *) fp; -writeBlockTo:(FILE *) fp;
-writeFile:(char *) path; -writeFile:(const char *) path;
// INTERNAL // INTERNAL
-init; -init;
-(id) parseBraceBlock:(FILE *) fp; -(id) parseBraceBlock:(FILE *) fp;
-setupMultiple:(char *) value; -setupMultiple:(const char *) value;
-(char *) getNextParameter; -(char *) getNextParameter;
@end @end

View file

@ -86,7 +86,7 @@ JDC
// //
// Write a single { } block out // Write a single { } block out
// //
-writeFile:(char *) path -writeFile:(const char *) path
{ {
FILE *fp; FILE *fp;
@ -114,7 +114,7 @@ JDC
// Find a keyword in storage // Find a keyword in storage
// Returns * to dict_t, otherwise NULL // Returns * to dict_t, otherwise NULL
// //
-(dict_t *) findKeyword:(char *) key -(dict_t *) findKeyword:(const char *) key
{ {
int max; int max;
int i; int i;
@ -133,8 +133,7 @@ JDC
// //
// Change a keyword's string // Change a keyword's string
// //
-changeStringFor:(char *) -changeStringFor:(const char *) key to:(const char *) value
key to:(char *) value
{ {
dict_t *d; dict_t *d;
dict_t newd; dict_t newd;
@ -157,7 +156,7 @@ key to:(char *) value
// //
// Search for keyword, return the string * // Search for keyword, return the string *
// //
-(char *) getStringFor:(char *) name -(const char *) getStringFor:(const char *) name
{ {
dict_t *d; dict_t *d;
@ -171,7 +170,7 @@ key to:(char *) value
// //
// Search for keyword, return the value // Search for keyword, return the value
// //
-(unsigned int) getValueFor:(char *) name -(unsigned int) getValueFor:(const char *) name
{ {
dict_t *d; dict_t *d;
@ -185,7 +184,7 @@ key to:(char *) value
// //
// Return # of units in keyword's value // Return # of units in keyword's value
// //
-(int) getValueUnits:(char *) key -(int) getValueUnits:(const char *) key
{ {
id temp; id temp;
int count; int count;
@ -224,7 +223,7 @@ key to:(char *) value
// //
// JDC: I wrote this to simplify removing vectors // JDC: I wrote this to simplify removing vectors
// //
-removeKeyword:(char *) key -removeKeyword:(const char *) key
{ {
dict_t *d; dict_t *d;
@ -238,8 +237,7 @@ key to:(char *) value
// //
// Delete string from keyword's value // Delete string from keyword's value
// //
-delString:(char *) -delString:(const char *) string fromValue:(const char *) key
string fromValue:(char *) key
{ {
id temp; id temp;
int count; int count;
@ -269,8 +267,7 @@ string fromValue:(char *) key
// //
// Add string to keyword's value // Add string to keyword's value
// //
-addString:(char *) -addString:(const char *) string toValue:(const char *) key
string toValue:(char *) key
{ {
char *newstr; char *newstr;
char spacing[] = "\t"; char spacing[] = "\t";
@ -295,10 +292,10 @@ string toValue:(char *) key
// Use these for multiple parameters in a keyword value // Use these for multiple parameters in a keyword value
// //
//=============================================== //===============================================
char *searchStr; const char *searchStr;
char item[4096]; char item[4096];
-setupMultiple:(char *) value -setupMultiple:(const char *) value
{ {
searchStr = value; searchStr = value;
return self; return self;
@ -324,12 +321,12 @@ char item[4096];
// //
// Parses a keyvalue string & returns a Storage full of those items // Parses a keyvalue string & returns a Storage full of those items
// //
-(id) parseMultipleFrom:(char *) key -(id) parseMultipleFrom:(const char *) key
{ {
#define ITEMSIZE 128 #define ITEMSIZE 128
id stuff; id stuff;
char string[ITEMSIZE]; char string[ITEMSIZE];
char *s; const char *s;
s =[self getStringFor:key]; s =[self getStringFor:key];
if (s == NULL) if (s == NULL)

View file

@ -9,8 +9,8 @@
} }
-initListFromFile:(FILE *) fp; -initListFromFile:(FILE *) fp;
-writeListFile:(char *) filename; -writeListFile:(const char *) filename;
-(id) findDictKeyword:(char *) key; -(id) findDictKeyword:(const char *) key;
@end @end
#endif // DictList_h #endif // DictList_h

View file

@ -28,7 +28,7 @@
// //
// Write out list file // Write out list file
// //
-writeListFile:(char *) filename -writeListFile:(const char *) filename
{ {
FILE *fp; FILE *fp;
int i; int i;
@ -52,7 +52,7 @@
// //
// Find the keyword in all the Dict objects // Find the keyword in all the Dict objects
// //
-(id) findDictKeyword:(char *) key -(id) findDictKeyword:(const char *) key
{ {
int i; int i;
dict_t *d; dict_t *d;

View file

@ -20,7 +20,7 @@ typedef struct epair_s {
BOOL modifiable; BOOL modifiable;
} }
-initClass:(char *) classname; -initClass:(const char *) classname;
-initFromScript:(struct script_s *) script; -initFromScript:(struct script_s *) script;
-(void) dealloc; -(void) dealloc;
@ -33,14 +33,13 @@ typedef struct epair_s {
-writeToFILE:(FILE *)f region:(BOOL) reg; -writeToFILE:(FILE *)f region:(BOOL) reg;
-(const char *) valueForQKey:(const char *) k; -(const char *) valueForQKey:(const char *) k;
-getVector:(vec3_t)v forKey:(char *) k; -getVector:(vec3_t)v forKey:(const char *) k;
-setKey:(const char *) -setKey:(const char *) k toValue:(const char *) v;
k toValue:(const char *) v;
-(int) numPairs; -(int) numPairs;
-(epair_t *) epairs; -(epair_t *) epairs;
-removeKeyPair:(char *) key; -removeKeyPair:(const char *) key;
@end @end
#endif // Entity_h #endif // Entity_h

View file

@ -51,7 +51,7 @@ vec3_t bad_maxs = { 8, 8, 8 };
return self; return self;
} }
-initClass:(char *) classname -initClass:(const char *) classname
{ {
id new; id new;
esize_t esize; esize_t esize;
@ -139,8 +139,7 @@ vec3_t bad_maxs = { 8, 8, 8 };
return ""; return "";
} }
-getVector:(vec3_t) -getVector:(vec3_t) v forKey:(const char *) k
v forKey:(char *) k
{ {
const char *c; const char *c;

View file

@ -21,13 +21,13 @@ typedef enum { esize_model, esize_fixed } esize_t;
-initFromText:(const char *)text source:(const char *) filename; -initFromText:(const char *)text source:(const char *) filename;
-(char *) classname; -(const char *) classname;
-(esize_t) esize; -(esize_t) esize;
-(float *) mins; // only for esize_fixed -(float *) mins; // only for esize_fixed
-(float *) maxs; // only for esize_fixed -(float *) maxs; // only for esize_fixed
-(float *) drawColor; -(float *) drawColor;
-(char *) comments; -(const char *) comments;
-(char *) flagName:(unsigned) flagnum; -(const char *) flagName:(unsigned) flagnum;
@end extern id entity_classes_i; @end extern id entity_classes_i;
@ -38,7 +38,7 @@ typedef enum { esize_model, esize_fixed } esize_t;
char *source_path; char *source_path;
} }
-initForSourceDirectory:(char *) path; -initForSourceDirectory:(const char *) path;
-(id) classForName:(const char *) name; -(id) classForName:(const char *) name;
-(void) scanDirectory; -(void) scanDirectory;

View file

@ -110,7 +110,7 @@ parse_vector (script_t * script, vec3_t vec)
return esize; return esize;
} }
-(char *) classname -(const char *) classname
{ {
return name; return name;
} }
@ -130,13 +130,13 @@ parse_vector (script_t * script, vec3_t vec)
return color; return color;
} }
-(char *) comments -(const char *) comments
{ {
return comments; return comments;
} }
-(char *) flagName:(unsigned) flagnum -(const char *) flagName:(unsigned) flagnum
{ {
if (flagnum >= MAX_FLAGS) if (flagnum >= MAX_FLAGS)
Sys_Error ("EntityClass flagName: bad number"); Sys_Error ("EntityClass flagName: bad number");
@ -157,7 +157,7 @@ insertEC:
*/ */
- (void) insertEC:ec - (void) insertEC:ec
{ {
char *name; const char *name;
int i; int i;
name =[ec classname]; name =[ec classname];
@ -176,7 +176,7 @@ insertEC:
scanFile scanFile
================= =================
*/ */
-(void) scanFile:(char *) filename -(void) scanFile:(const char *) filename
{ {
int size, line; int size, line;
char *data; char *data;
@ -242,12 +242,12 @@ scanDirectory
id entity_classes_i; id entity_classes_i;
-initForSourceDirectory:(char *) path -initForSourceDirectory:(const char *) path
{ {
self = [super init]; self = [super init];
array = [[NSMutableArray alloc] init]; array = [[NSMutableArray alloc] init];
source_path = path; source_path = strdup (path); //FIXME leak?
[self scanDirectory]; [self scanDirectory];
entity_classes_i = self; entity_classes_i = self;

View file

@ -21,8 +21,8 @@ extern id map_i;
-writeStats; -writeStats;
-readMapFile:(char *) fname; -readMapFile:(const char *) fname;
-writeMapFile:(char *)fname useRegion:(BOOL) reg; -writeMapFile:(const char *)fname useRegion:(BOOL) reg;
-entityConnect: (vec3_t) p1:(vec3_t) p2; -entityConnect: (vec3_t) p1:(vec3_t) p2;

View file

@ -222,7 +222,7 @@ FILE METHODS
readMapFile readMapFile
================= =================
*/ */
-readMapFile:(char *) fname -readMapFile:(const char *) fname
{ {
char *dat; char *dat;
const char *wad, *cl; const char *wad, *cl;
@ -297,7 +297,7 @@ readMapFile
writeMapFile writeMapFile
================= =================
*/ */
-writeMapFile:(char *) -writeMapFile:(const char *)
fname useRegion:(BOOL) reg fname useRegion:(BOOL) reg
{ {
FILE *f; FILE *f;

View file

@ -71,7 +71,7 @@ extern float lightaxis[3];
// //
-playBspSound; -playBspSound;
-(char *) getProjectPath; -(const char *) getProjectPath;
-(int) getBrushOffset; // get the state -(int) getBrushOffset; // get the state
-(int) getShowBSP; // get the state -(int) getShowBSP; // get the state

View file

@ -129,7 +129,7 @@ _atof (const char *c)
return self; return self;
} }
-(char *) getProjectPath -(const char *) getProjectPath
{ {
return projectpath; return projectpath;
} }

View file

@ -72,43 +72,40 @@ extern id project_i;
-initProject; -initProject;
-initVars; -initVars;
-(char *) currentProjectFile; -(const char *) currentProjectFile;
-setTextureWad:(const char *) wf; -setTextureWad:(const char *) wf;
-addToOutput:(char *) string; -addToOutput:(const char *) string;
-clearBspOutput:sender; -clearBspOutput:sender;
-initProjSettings; -initProjSettings;
-changeChar:(char) -changeChar:(char) f to:(char) t in:(id) obj;
f to:(char)
t in:(id) obj;
-(int) searchForString:(char *) -(int) searchForString:(const char *) str in:(id) obj;
str in:(id) obj;
-parseProjectFile; // read defaultsdatabase for project -parseProjectFile; // read defaultsdatabase for project
// path // path
-openProjectFile:(char *) path; // called by openProject and newProject -openProjectFile:(const char *) path; // called by openProject and newProject
-openProject; -openProject;
-clickedOnMap:sender; // called if clicked on map in browser -clickedOnMap:sender; // called if clicked on map in browser
-clickedOnWad:sender; // called if clicked on wad in browser -clickedOnWad:sender; // called if clicked on wad in browser
// methods to querie the project file // methods to querie the project file
-(char *) getMapDirectory; -(const char *) getMapDirectory;
-(char *) getFinalMapDirectory; -(const char *) getFinalMapDirectory;
-(char *) getProgDirectory; -(const char *) getProgDirectory;
-(char *) getWAD8; -(const char *) getWAD8;
-(char *) getWAD9; -(const char *) getWAD9;
-(char *) getWAD0; -(const char *) getWAD0;
-(char *) getFullVisCmd; -(const char *) getFullVisCmd;
-(char *) getFastVisCmd; -(const char *) getFastVisCmd;
-(char *) getNoVisCmd; -(const char *) getNoVisCmd;
-(char *) getRelightCmd; -(const char *) getRelightCmd;
-(char *) getLeaktestCmd; -(const char *) getLeaktestCmd;
-(char *) getEntitiesCmd; -(const char *) getEntitiesCmd;
@end void @end void
changeString (char cf, char ct, char *string); changeString (char cf, char ct, char *string);

View file

@ -36,24 +36,25 @@ id project_i;
//=========================================================== //===========================================================
-initVars -initVars
{ {
char *s; const char *s;
const char *pe; const char *pe;
char *ts;
s =[preferences_i getProjectPath]; ts = strdup ([preferences_i getProjectPath]);
pe = QFS_SkipPath (s); pe = QFS_SkipPath (ts);
s[pe - s] = 0; ts[pe - ts] = 0;
strcpy (path_basepath, s); strcpy (path_basepath, ts);
strcpy (path_progdir, s); strcpy (path_progdir, ts);
strcat (path_progdir, SUBDIR_ENT); strcat (path_progdir, SUBDIR_ENT);
strcpy (path_mapdirectory, s); strcpy (path_mapdirectory, ts);
strcat (path_mapdirectory, SUBDIR_MAPS); // source dir strcat (path_mapdirectory, SUBDIR_MAPS); // source dir
strcpy (path_finalmapdir, s); strcpy (path_finalmapdir, ts);
strcat (path_finalmapdir, SUBDIR_MAPS); // dest dir strcat (path_finalmapdir, SUBDIR_MAPS); // dest dir
[basepathinfo_i setStringValue: [NSString stringWithCString:s]]; [basepathinfo_i setStringValue: [NSString stringWithCString:ts]];
// in Project Inspector // in Project Inspector
#if 0 #if 0
@ -134,7 +135,7 @@ id project_i;
// //
// Add text to the BSP Output window // Add text to the BSP Output window
// //
-addToOutput:(char *) string -addToOutput:(const char *) string
{ {
int end; int end;
@ -184,9 +185,7 @@ id project_i;
// //
// Change a character to another in a Storage list of strings // Change a character to another in a Storage list of strings
// //
-changeChar:(char) -changeChar:(char) f to:(char) t in:(id) obj
f to:(char)
t in:(id) obj
{ {
int i; int i;
int max; int max;
@ -312,7 +311,7 @@ t in:(id) obj
// //
-parseProjectFile -parseProjectFile
{ {
char *path; const char *path;
int rtn; int rtn;
path =[preferences_i getProjectPath]; path =[preferences_i getProjectPath];
@ -333,7 +332,7 @@ t in:(id) obj
// //
// Loads and parses a project file // Loads and parses a project file
// //
-openProjectFile:(char *) path -openProjectFile:(const char *) path
{ {
FILE *fp; FILE *fp;
struct stat s; struct stat s;
@ -354,7 +353,7 @@ Sys_Printf ("openProjectFile: %s\n", path);
return self; return self;
} }
-(char *) currentProjectFile -(const char *) currentProjectFile
{ {
return path_projectinfo; return path_projectinfo;
} }
@ -392,8 +391,7 @@ Sys_Printf ("openProjectFile: %s\n", path);
// //
// Search for a string in a List of strings // Search for a string in a List of strings
// //
-(int) searchForString:(char *) -(int) searchForString:(const char *) str in:(id) obj
str in:(id) obj
{ {
int i; int i;
int max; int max;
@ -408,17 +406,17 @@ str in:(id) obj
return 0; return 0;
} }
-(char *) getMapDirectory -(const char *) getMapDirectory
{ {
return path_mapdirectory; return path_mapdirectory;
} }
-(char *) getFinalMapDirectory -(const char *) getFinalMapDirectory
{ {
return path_finalmapdir; return path_finalmapdir;
} }
-(char *) getProgDirectory -(const char *) getProgDirectory
{ {
return path_progdir; return path_progdir;
} }
@ -427,7 +425,7 @@ str in:(id) obj
// //
// Return the WAD name for cmd-8 // Return the WAD name for cmd-8
// //
-(char *) getWAD8 -(const char *) getWAD8
{ {
if (!path_wad8[0]) if (!path_wad8[0])
return NULL; return NULL;
@ -437,7 +435,7 @@ str in:(id) obj
// //
// Return the WAD name for cmd-9 // Return the WAD name for cmd-9
// //
-(char *) getWAD9 -(const char *) getWAD9
{ {
if (!path_wad9[0]) if (!path_wad9[0])
return NULL; return NULL;
@ -447,7 +445,7 @@ str in:(id) obj
// //
// Return the WAD name for cmd-0 // Return the WAD name for cmd-0
// //
-(char *) getWAD0 -(const char *) getWAD0
{ {
if (!path_wad0[0]) if (!path_wad0[0])
return NULL; return NULL;
@ -457,7 +455,7 @@ str in:(id) obj
// //
// Return the FULLVIS cmd string // Return the FULLVIS cmd string
// //
-(char *) getFullVisCmd -(const char *) getFullVisCmd
{ {
if (!string_fullvis[0]) if (!string_fullvis[0])
return NULL; return NULL;
@ -467,7 +465,7 @@ str in:(id) obj
// //
// Return the FASTVIS cmd string // Return the FASTVIS cmd string
// //
-(char *) getFastVisCmd -(const char *) getFastVisCmd
{ {
if (!string_fastvis[0]) if (!string_fastvis[0])
return NULL; return NULL;
@ -477,7 +475,7 @@ str in:(id) obj
// //
// Return the NOVIS cmd string // Return the NOVIS cmd string
// //
-(char *) getNoVisCmd -(const char *) getNoVisCmd
{ {
if (!string_novis[0]) if (!string_novis[0])
return NULL; return NULL;
@ -487,7 +485,7 @@ str in:(id) obj
// //
// Return the RELIGHT cmd string // Return the RELIGHT cmd string
// //
-(char *) getRelightCmd -(const char *) getRelightCmd
{ {
if (!string_relight[0]) if (!string_relight[0])
return NULL; return NULL;
@ -497,14 +495,14 @@ str in:(id) obj
// //
// Return the LEAKTEST cmd string // Return the LEAKTEST cmd string
// //
-(char *) getLeaktestCmd -(const char *) getLeaktestCmd
{ {
if (!string_leaktest[0]) if (!string_leaktest[0])
return NULL; return NULL;
return string_leaktest; return string_leaktest;
} }
-(char *) getEntitiesCmd -(const char *) getEntitiesCmd
{ {
if (!string_entities[0]) if (!string_entities[0])
return NULL; return NULL;

View file

@ -14,8 +14,6 @@ double I_FloatTime (void);
void NopSound (void); void NopSound (void);
void qprintf (char *fmt, ...); // prints text to cmd_out_i
@interface QuakeEd:NSWindow @interface QuakeEd:NSWindow
{ {
BOOL dirty; BOOL dirty;
@ -47,7 +45,7 @@ void qprintf (char *fmt, ...); // prints text to cmd_out_i
} }
-setDefaultFilename; -setDefaultFilename;
-(char *) currentFilename; -(const char *) currentFilename;
-updateAll; // when a model has been changed -updateAll; // when a model has been changed
-updateCamera; // when the camera has moved -updateCamera; // when the camera has moved
@ -87,9 +85,9 @@ void qprintf (char *fmt, ...); // prints text to cmd_out_i
-save:sender; -save:sender;
-saveAs:sender; -saveAs:sender;
-doOpen:(char *) fname; -doOpen:(const char *) fname;
-saveBSP:(char *)cmdline dialog:(BOOL)wt; -saveBSP:(const char *)cmdline dialog:(BOOL)wt;
-BSP_Full:sender; -BSP_Full:sender;
-BSP_FastVis:sender; -BSP_FastVis:sender;

View file

@ -636,7 +636,7 @@ BSP PROCESSING
*/ */
void void
ExpandCommand (char *in, char *out, char *src, char *dest) ExpandCommand (const char *in, char *out, char *src, char *dest)
{ {
while (*in) { while (*in) {
if (in[0] == '$') { if (in[0] == '$') {
@ -661,15 +661,14 @@ ExpandCommand (char *in, char *out, char *src, char *dest)
saveBSP saveBSP
============= =============
*/ */
-saveBSP:(char *) -saveBSP:(const char *) cmdline dialog:(BOOL) wt
cmdline dialog:(BOOL) wt
{ {
char expandedcmd[1024]; char expandedcmd[1024];
char mappath[1024]; char mappath[1024];
char bsppath[1024]; char bsppath[1024];
int oldLightFilter; int oldLightFilter;
int oldPathFilter; int oldPathFilter;
char *destdir; const char *destdir;
if (bsppid) { if (bsppid) {
NSBeep (); NSBeep ();
@ -799,7 +798,7 @@ doOpen:
Called by open or the project panel Called by open or the project panel
============== ==============
*/ */
-doOpen:(char *) fname; -doOpen:(const char *) fname;
{ {
strcpy (filename, fname); strcpy (filename, fname);
@ -904,7 +903,7 @@ saveAs
// //
// AJR - added this for Project info // AJR - added this for Project info
// //
-(char *) currentFilename -(const char *) currentFilename
{ {
return filename; return filename;
} }

View file

@ -43,8 +43,7 @@
/* Creating, freeing, initializing, and emptying */ /* Creating, freeing, initializing, and emptying */
-init; -init;
-initCount:(NSUInteger) -initCount:(NSUInteger) numSlots elementSize:(NSUInteger) sizeInBytes
numSlots elementSize:(NSUInteger) sizeInBytes
description:(const char *) elemDesc; description:(const char *) elemDesc;
-(void) dealloc; -(void) dealloc;
-empty; -empty;
@ -56,15 +55,13 @@ numSlots elementSize:(NSUInteger) sizeInBytes
-(const char *) description; -(const char *) description;
-(NSUInteger) count; -(NSUInteger) count;
-(void *) elementAt:(NSUInteger) index; -(void *) elementAt:(NSUInteger) index;
-replaceElementAt:(NSUInteger) -replaceElementAt:(NSUInteger) index with:(void *) anElement;
index with:(void *) anElement;
-setNumSlots:(NSUInteger) numSlots; -setNumSlots:(NSUInteger) numSlots;
-setAvailableCapacity:(NSUInteger) numSlots; -setAvailableCapacity:(NSUInteger) numSlots;
-addElement:(void *) anElement; -addElement:(void *) anElement;
-removeLastElement; -removeLastElement;
-insertElement:(void *) -insertElement:(void *) anElement at:(NSUInteger) index;
anElement at:(NSUInteger) index;
-removeElementAt:(NSUInteger) index; -removeElementAt:(NSUInteger) index;
@ -76,11 +73,12 @@ anElement at:(NSUInteger) index;
/* old-style creation */ /* old-style creation */
+new; +new;
+newCount:(NSUInteger) +newCount:(NSUInteger) count elementSize:(NSUInteger) sizeInBytes
count elementSize:(NSUInteger) sizeInBytes
description:(const char *) descriptor; description:(const char *) descriptor;
@end typedef struct { @end
typedef struct {
@defs (Storage) @defs (Storage)
} NXStorageId; } NXStorageId;

View file

@ -35,7 +35,7 @@ extern int tex_count;
extern qtexture_t qtextures[MAX_TEXTURES]; extern qtexture_t qtextures[MAX_TEXTURES];
void TEX_InitFromWad (const char *path); void TEX_InitFromWad (const char *path);
qtexture_t *TEX_ForName (char *name); qtexture_t *TEX_ForName (const char *name);
typedef struct { typedef struct {
@ -70,7 +70,7 @@ extern id texturepalette_i;
int selectedTexture; int selectedTexture;
} }
-(char *) currentWad; -(const char *) currentWad;
-initPaletteFromWadfile:(const char *) wf; -initPaletteFromWadfile:(const char *) wf;
-computeTextureViewSize; -computeTextureViewSize;
-alphabetize; -alphabetize;
@ -80,8 +80,8 @@ extern id texturepalette_i;
-(int) getSelectedTexIndex; -(int) getSelectedTexIndex;
// Called externally // Called externally
-(char *) getSelTextureName; -(const char *) getSelTextureName;
-setTextureByName:(char *) name; -setTextureByName:(const char *) name;
// New methods to replace the 2 above ones // New methods to replace the 2 above ones
-setTextureDef:(texturedef_t *) td; -setTextureDef:(texturedef_t *) td;
@ -109,11 +109,8 @@ extern id texturepalette_i;
-texturedefChanged:sender; -texturedefChanged:sender;
-onlyShowMapTextures:sender; -onlyShowMapTextures:sender;
-(int) searchForTextureInPalette:(char *) texture; -(int) searchForTextureInPalette:(const char *) texture;
-setDisplayFlag:(int) -setDisplayFlag:(int) index to:(int) value;
index
to:(int)
value;
@end @end
#endif // TexturePalette_h #endif // TexturePalette_h

View file

@ -228,7 +228,7 @@ TEX_NumForName
================= =================
*/ */
qtexture_t * qtexture_t *
TEX_ForName (char *name) TEX_ForName (const char *name)
{ {
char newname[16]; char newname[16];
int i; int i;
@ -263,7 +263,7 @@ TEX_ForName (char *name)
} }
-(char *) currentWad -(const char *) currentWad
{ {
return currentwad; return currentwad;
} }
@ -488,7 +488,7 @@ TEX_ForName (char *name)
// //
// Return the name of the selected texture // Return the name of the selected texture
// //
-(char *) getSelTextureName -(const char *) getSelTextureName
{ {
texpal_t *t; texpal_t *t;
@ -501,21 +501,24 @@ TEX_ForName (char *name)
// //
// Set selected texture by texture name // Set selected texture by texture name
// //
-setTextureByName:(char *) name -setTextureByName:(const char *) name
{ {
texpal_t *t; texpal_t *t;
int i; int i;
int max; int max;
char *nm = strdup (name);
max =[textureList_i count]; max =[textureList_i count];
CleanupName(name,name); CleanupName(nm,nm);
for (i = 0; i < max; i++) { for (i = 0; i < max; i++) {
t =[textureList_i elementAt:i]; t =[textureList_i elementAt:i];
if (!strcmp (t->name, name)) { if (!strcmp (t->name, nm)) {
free (nm);
[self setSelectedTexture:i]; [self setSelectedTexture:i];
return self; return self;
} }
} }
free (nm);
return self; return self;
} }
@ -717,7 +720,7 @@ field by:(int) amount
// Search for texture in entire palette // Search for texture in entire palette
// Return index of texturedef, or -1 if unsuccessful // Return index of texturedef, or -1 if unsuccessful
// //
-(int) searchForTextureInPalette:(char *) texture -(int) searchForTextureInPalette:(const char *) texture
{ {
int i; int i;
int max; int max;

View file

@ -29,7 +29,7 @@ extern id things_i;
-setSelectedKey:(epair_t *) ep; -setSelectedKey:(epair_t *) ep;
-clearInputs; -clearInputs;
-(char *) spawnName; -(const char *) spawnName;
// UI targets // UI targets
-reloadEntityClasses:sender; -reloadEntityClasses:sender;

View file

@ -43,7 +43,7 @@ id things_i;
-initEntities -initEntities
{ {
char *path; const char *path;
path =[project_i getProgDirectory]; path =[project_i getProgDirectory];
@ -79,7 +79,7 @@ id things_i;
return self; return self;
} }
-(char *) spawnName -(const char *) spawnName
{ {
return[[entity_classes_i objectAtIndex:lastSelected] classname]; return[[entity_classes_i objectAtIndex:lastSelected] classname];
} }
@ -91,7 +91,7 @@ id things_i;
-reloadEntityClasses:sender -reloadEntityClasses:sender
{ {
EntityClass *ent; EntityClass *ent;
char *path; const char *path;
path = (char *)[prog_path_i stringValue]; path = (char *)[prog_path_i stringValue];
if (!path || !path[0]) { if (!path || !path[0]) {