Skip to content
Snippets Groups Projects
Commit 7aa4720f authored by rswindell's avatar rswindell
Browse files

Updated function prototypes to use const char* to indicate read-only strings.

parent b42240c2
No related branches found
No related tags found
No related merge requests found
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
/****************************************************************************/ /****************************************************************************/
/* Return the filename portion of a full pathname */ /* Return the filename portion of a full pathname */
/****************************************************************************/ /****************************************************************************/
char* DLLCALL getfname(char* path) char* DLLCALL getfname(const char* path)
{ {
char *fname; char *fname;
...@@ -85,7 +85,7 @@ char* DLLCALL getfname(char* path) ...@@ -85,7 +85,7 @@ char* DLLCALL getfname(char* path)
if(fname!=NULL) if(fname!=NULL)
fname++; fname++;
else else
fname=path; fname=(char*)path;
return(fname); return(fname);
} }
...@@ -161,7 +161,7 @@ int DLLCALL glob(const char *pattern, int flags, void* unused, glob_t* glob) ...@@ -161,7 +161,7 @@ int DLLCALL glob(const char *pattern, int flags, void* unused, glob_t* glob)
glob->gl_pathv=new_pathv; glob->gl_pathv=new_pathv;
/* build the full pathname */ /* build the full pathname */
strcpy(path,pattern); SAFECOPY(path,pattern);
p=getfname(path); p=getfname(path);
*p=0; *p=0;
strcat(path,ff.name); strcat(path,ff.name);
...@@ -271,7 +271,7 @@ void rewinddir(DIR* dir) ...@@ -271,7 +271,7 @@ void rewinddir(DIR* dir)
/****************************************************************************/ /****************************************************************************/
/* Returns the time/date of the file in 'filename' in time_t (unix) format */ /* Returns the time/date of the file in 'filename' in time_t (unix) format */
/****************************************************************************/ /****************************************************************************/
time_t DLLCALL fdate(char *filename) time_t DLLCALL fdate(const char *filename)
{ {
struct stat st; struct stat st;
...@@ -287,7 +287,7 @@ time_t DLLCALL fdate(char *filename) ...@@ -287,7 +287,7 @@ time_t DLLCALL fdate(char *filename)
/****************************************************************************/ /****************************************************************************/
/* Returns the length of the file in 'filename' */ /* Returns the length of the file in 'filename' */
/****************************************************************************/ /****************************************************************************/
long DLLCALL flength(char *filename) long DLLCALL flength(const char *filename)
{ {
#if defined(__BORLANDC__) && !defined(__unix__) /* stat() doesn't work right */ #if defined(__BORLANDC__) && !defined(__unix__) /* stat() doesn't work right */
...@@ -324,7 +324,7 @@ long DLLCALL flength(char *filename) ...@@ -324,7 +324,7 @@ long DLLCALL flength(char *filename)
/* Returns TRUE if it exists, FALSE if it doesn't. */ /* Returns TRUE if it exists, FALSE if it doesn't. */
/* 'filespec' may contain wildcards! */ /* 'filespec' may contain wildcards! */
/****************************************************************************/ /****************************************************************************/
BOOL DLLCALL fexist(char *filespec) BOOL DLLCALL fexist(const char *filespec)
{ {
#if defined(_WIN32) #if defined(_WIN32)
...@@ -419,7 +419,7 @@ BOOL DLLCALL fexistcase(char *path) ...@@ -419,7 +419,7 @@ BOOL DLLCALL fexistcase(char *path)
/****************************************************************************/ /****************************************************************************/
/* Returns TRUE if the filename specified is a directory */ /* Returns TRUE if the filename specified is a directory */
/****************************************************************************/ /****************************************************************************/
BOOL DLLCALL isdir(char *filename) BOOL DLLCALL isdir(const char *filename)
{ {
struct stat st; struct stat st;
...@@ -432,7 +432,7 @@ BOOL DLLCALL isdir(char *filename) ...@@ -432,7 +432,7 @@ BOOL DLLCALL isdir(char *filename)
/****************************************************************************/ /****************************************************************************/
/* Returns the attributes (mode) for specified 'filename' */ /* Returns the attributes (mode) for specified 'filename' */
/****************************************************************************/ /****************************************************************************/
int DLLCALL getfattr(char* filename) int DLLCALL getfattr(const char* filename)
{ {
#if defined(_WIN32) #if defined(_WIN32)
long handle; long handle;
...@@ -464,7 +464,7 @@ int DLLCALL getfattr(char* filename) ...@@ -464,7 +464,7 @@ int DLLCALL getfattr(char* filename)
(LPCTSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER); (LPCTSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER);
#endif #endif
ulong DLLCALL getfreediskspace(char* path) ulong DLLCALL getfreediskspace(const char* path)
{ {
#if defined(_WIN32) #if defined(_WIN32)
char root[16]; char root[16];
......
...@@ -162,14 +162,14 @@ extern "C" { ...@@ -162,14 +162,14 @@ extern "C" {
#endif #endif
/* General file system wrappers for all platforms and compilers */ /* General file system wrappers for all platforms and compilers */
DLLEXPORT BOOL DLLCALL fexist(char *filespec); DLLEXPORT BOOL DLLCALL fexist(const char *filespec);
DLLEXPORT BOOL DLLCALL fexistcase(char *filespec); /* fixes upr/lwr case fname */ DLLEXPORT BOOL DLLCALL fexistcase(char *filespec); /* fixes upr/lwr case fname */
DLLEXPORT long DLLCALL flength(char *filename); DLLEXPORT long DLLCALL flength(const char *filename);
DLLEXPORT time_t DLLCALL fdate(char *filename); DLLEXPORT time_t DLLCALL fdate(const char *filename);
DLLEXPORT BOOL DLLCALL isdir(char *filename); DLLEXPORT BOOL DLLCALL isdir(const char *filename);
DLLEXPORT char* DLLCALL getfname(char* path); DLLEXPORT char* DLLCALL getfname(const char* path);
DLLEXPORT int DLLCALL getfattr(char* filename); DLLEXPORT int DLLCALL getfattr(const char* filename);
DLLEXPORT ulong DLLCALL getfreediskspace(char* path); DLLEXPORT ulong DLLCALL getfreediskspace(const char* path);
#if defined(__unix__) #if defined(__unix__)
DLLEXPORT void DLLCALL _splitpath(const char *path, char *drive, char *dir, DLLEXPORT void DLLCALL _splitpath(const char *path, char *drive, char *dir,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment