From: Christophe CURIS <[email protected]>

As a side note, in 'wfindfileinlist' the first argument should be:
  const char * const *path_list

However, due to limited support for const in plain C, that would
introduce warnings in user code. For compatibility issues, this
was not implemented.
---
 WINGs/WINGs/WUtil.h |   10 +++++-----
 WINGs/findfile.c    |   18 +++++++++---------
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/WINGs/WINGs/WUtil.h b/WINGs/WINGs/WUtil.h
index d993e58..78c38ae 100644
--- a/WINGs/WINGs/WUtil.h
+++ b/WINGs/WINGs/WUtil.h
@@ -193,15 +193,15 @@ void __wmessage(const char *func, const char *file, int 
line, int type, const ch
 
 /* ---[ WINGs/findfile.c ]------------------------------------------------ */
 
-char* wfindfile(char *paths, char *file);
+char* wfindfile(const char *paths, const char *file);
 
-char* wfindfileinlist(char **path_list, char *file);
+char* wfindfileinlist(char *const *path_list, const char *file);
 
-char* wfindfileinarray(WMPropList* array, char *file);
+char* wfindfileinarray(WMPropList* array, const char *file);
 
-char* wexpandpath(char *path);
+char* wexpandpath(const char *path);
 
-int wcopy_file(char *toPath, char *srcFile, char *destFile);
+int wcopy_file(const char *toPath, const char *srcFile, const char *destFile);
 
 /* don't free the returned string */
 char* wgethomedir(void);
diff --git a/WINGs/findfile.c b/WINGs/findfile.c
index 3418c8e..f18aa3a 100644
--- a/WINGs/findfile.c
+++ b/WINGs/findfile.c
@@ -88,9 +88,9 @@ static char *getuserhomedir(const char *username)
        return home;
 }
 
-char *wexpandpath(char *path)
+char *wexpandpath(const char *path)
 {
-       char *origpath = path;
+       const char *origpath = path;
        char buffer2[PATH_MAX + 2];
        char buffer[PATH_MAX + 2];
        int i;
@@ -200,7 +200,7 @@ error:
 }
 
 /* return address of next char != tok or end of string whichever comes first */
-static char *skipchar(char *string, char tok)
+static const char *skipchar(const char *string, char tok)
 {
        while (*string != 0 && *string == tok)
                string++;
@@ -209,7 +209,7 @@ static char *skipchar(char *string, char tok)
 }
 
 /* return address of next char == tok or end of string whichever comes first */
-static char *nextchar(char *string, char tok)
+static const char *nextchar(const char *string, char tok)
 {
        while (*string != 0 && *string != tok)
                string++;
@@ -232,10 +232,10 @@ static char *nextchar(char *string, char tok)
  *
  *----------------------------------------------------------------------
  */
-char *wfindfile(char *paths, char *file)
+char *wfindfile(const char *paths, const char *file)
 {
        char *path;
-       char *tmp, *tmp2;
+       const char *tmp, *tmp2;
        int len, flen;
        char *fullpath;
 
@@ -296,7 +296,7 @@ char *wfindfile(char *paths, char *file)
        return NULL;
 }
 
-char *wfindfileinlist(char **path_list, char *file)
+char *wfindfileinlist(char *const *path_list, const char *file)
 {
        int i;
        char *path;
@@ -349,7 +349,7 @@ char *wfindfileinlist(char **path_list, char *file)
        return NULL;
 }
 
-char *wfindfileinarray(WMPropList * array, char *file)
+char *wfindfileinarray(WMPropList *array, const char *file)
 {
        int i;
        char *path;
@@ -409,7 +409,7 @@ char *wfindfileinarray(WMPropList * array, char *file)
        return NULL;
 }
 
-int wcopy_file(char *dir, char *src_file, char *dest_file)
+int wcopy_file(const char *dir, const char *src_file, const char *dest_file)
 {
        FILE *src, *dst;
        size_t nread, nwritten;
-- 
1.7.10.4


-- 
To unsubscribe, send mail to [email protected].

Reply via email to