Make common boot file_loadraw name parameter const

Fix compiler warnings about dropping const qualifier by changing file_loadraw
name param to const, and updating method to make that the case (it was
abusing the variable).

MFC after:	2 weeks
X-MFC-With:	r293268
Sponsored by:	Multiplay
This commit is contained in:
Steven Hartland 2016-01-15 00:55:36 +00:00
parent c7e732ae61
commit dc9ba0270b
2 changed files with 7 additions and 8 deletions

View File

@ -237,7 +237,7 @@ void unload(void);
struct preloaded_file *file_alloc(void);
struct preloaded_file *file_findfile(const char *name, const char *type);
struct file_metadata *file_findmetadata(struct preloaded_file *fp, int type);
struct preloaded_file *file_loadraw(char *name, char *type, int insert);
struct preloaded_file *file_loadraw(const char *name, char *type, int insert);
void file_discard(struct preloaded_file *fp);
void file_addmetadata(struct preloaded_file *fp, int type, size_t size, void *p);
int file_addmodule(struct preloaded_file *fp, char *modname, int version,

View File

@ -388,14 +388,14 @@ file_load_dependencies(struct preloaded_file *base_file)
}
/*
* We've been asked to load (name) as (type), so just suck it in,
* We've been asked to load (fname) as (type), so just suck it in,
* no arguments or anything.
*/
struct preloaded_file *
file_loadraw(char *name, char *type, int insert)
file_loadraw(const char *fname, char *type, int insert)
{
struct preloaded_file *fp;
char *cp;
char *name;
int fd, got;
vm_offset_t laddr;
@ -406,12 +406,11 @@ file_loadraw(char *name, char *type, int insert)
}
/* locate the file on the load path */
cp = file_search(name, NULL);
if (cp == NULL) {
sprintf(command_errbuf, "can't find '%s'", name);
name = file_search(fname, NULL);
if (name == NULL) {
sprintf(command_errbuf, "can't find '%s'", fname);
return(NULL);
}
name = cp;
if ((fd = open(name, O_RDONLY)) < 0) {
sprintf(command_errbuf, "can't open '%s': %s", name, strerror(errno));