This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.

The branch, next has been updated
       via  9ab6368b334f204bc073ecf4476a22f7fd885e63 (commit)
       via  033e3eaa5417cdbae232d91a8b0835b5339ecb16 (commit)
       via  a18fd7cd69b880969a40c0efa4f11719b31e1190 (commit)
       via  cd1c55d63ce306ad43c1e601a60502f9c2b28435 (commit)
       via  fd02f5f0832dd524352d11f77bc0fccf6ecc0047 (commit)
       via  f386e34d297adf8e515ff5a2d1a21bfad2cd4e9b (commit)
       via  32ecd4ee583127defc6e0e54dbe6e4408648475e (commit)
       via  98e3c7e3477cb1b241a5f4df8917ab7961e8fbb2 (commit)
       via  74c17bffae9552911aa7a04cf5e2c9e587635856 (commit)
       via  d40fa69b92546a8da44e531ba3974f30ca8a59c0 (commit)
       via  ea9d3e643f65b122d4414ed5feafff6e1f533dcc (commit)
       via  bbf84eb0e8cfeb554def2487e91bdcbee15ae976 (commit)
      from  ac89706859250ba5eb93aad10a5a5b77b77da09c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/9ab6368b334f204bc073ecf4476a22f7fd885e63

commit 9ab6368b334f204bc073ecf4476a22f7fd885e63
Author: Christophe CURIS <[email protected]>
Date:   Sat May 4 15:43:32 2013 +0200

    WUtil: Increased version number for the library
    
    The addition of the const attributes is actually an API change, so
    we have to reflect this for the next official release.
    
    Because the change on 'wusergnusteppath' may impact users of the API,
    we won't only change REVISION like it was done for WRaster lib.

diff --git a/configure.ac b/configure.ac
index 3479a4b..957568d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -54,7 +54,7 @@ WINGS_VERSION=$WINGS_CURRENT:$WINGS_REVISION:$WINGS_AGE
 AC_SUBST(WINGS_VERSION)
 dnl
 dnl libWUtil
-WUTIL_CURRENT=2
+WUTIL_CURRENT=3
 WUTIL_REVISION=0
 WUTIL_AGE=0
 WUTIL_VERSION=$WUTIL_CURRENT:$WUTIL_REVISION:$WUTIL_AGE

http://repo.or.cz/w/wmaker-crm.git/commit/033e3eaa5417cdbae232d91a8b0835b5339ecb16

commit 033e3eaa5417cdbae232d91a8b0835b5339ecb16
Author: Christophe CURIS <[email protected]>
Date:   Sat May 4 15:43:31 2013 +0200

    WUtil: Rewrote 'wusergnusteppath' to be more efficient
    
    The first optimisation is to compute only once the path, and then
    always re-use the value which did not change anyway.
    The second optimisation is to avoid a lot of excessive function
    calls, including alloc+free that are not necessary and participate
    in memory fragmentation.

diff --git a/WINGs/userdefaults.c b/WINGs/userdefaults.c
index c1b4652..4cfd55a 100644
--- a/WINGs/userdefaults.c
+++ b/WINGs/userdefaults.c
@@ -48,35 +48,34 @@ extern char *WMGetApplicationName();
 
 const char *wusergnusteppath()
 {
+       static const char subdir[] = "/GNUstep";
        static char *path = NULL;
-       char *gspath;
+       char *gspath, *h;
        int pathlen;
 
+       if (path)
+               /* Value have been already computed, re-use it */
+               return path;
+
        gspath = getenv("GNUSTEP_USER_ROOT");
        if (gspath) {
                gspath = wexpandpath(gspath);
                if (gspath) {
-                       pathlen = strlen(gspath) + 4;
-                       path = wmalloc(pathlen);
-                       if (wstrlcpy(path, gspath, pathlen) >= pathlen) {
-                               wfree(gspath);
-                               return NULL;
-                       }
-                       wfree(gspath);
-               }
-       } else {
-               char *h = wgethomedir();
-               if (!h)
-                       return NULL;
-               pathlen = strlen(h) + 8 /* /GNUstep */ + 1;
-               path = wmalloc(pathlen);
-               if (wstrlcpy(path, h, pathlen) >= pathlen ||
-                   wstrlcat(path, "/GNUstep", pathlen) >= pathlen) {
-                       wfree(path);
-                       return NULL;
+                       path = gspath;
+                       return path;
                }
+               wwarning(_("variable GNUSTEP_USER_ROOT defined with invalid 
path, not used"));
        }
 
+       h = wgethomedir();
+       if (!h)
+               return NULL;
+
+       pathlen = strlen(h);
+       path = wmalloc(pathlen + sizeof(subdir));
+       strcpy(path, h);
+       strcpy(path + pathlen, subdir);
+
        return path;
 }
 

http://repo.or.cz/w/wmaker-crm.git/commit/a18fd7cd69b880969a40c0efa4f11719b31e1190

commit a18fd7cd69b880969a40c0efa4f11719b31e1190
Author: Christophe CURIS <[email protected]>
Date:   Sat May 4 15:43:30 2013 +0200

    Fixed const correctness in functions using 'wusergnusteppath'
    
    The change introduced in previous commit for const correctness has
    a small impact on WindowMaker's code, this patch fixes all the new
    warnings.

diff --git a/WINGs/proplist.c b/WINGs/proplist.c
index bb5e057..bd452e3 100644
--- a/WINGs/proplist.c
+++ b/WINGs/proplist.c
@@ -1706,7 +1706,8 @@ Bool WMWritePropListToFile(WMPropList * plist, const char 
*path)
  */
 int wmkdirhier(const char *path)
 {
-       char *t, *thePath = NULL, buf[1024];
+       const char *t;
+       char *thePath = NULL, buf[1024];
        size_t p, plen;
        struct stat st;
 
@@ -1799,7 +1800,7 @@ int wrmdirhier(const char *path)
 {
        struct stat st;
        int error;
-       char *t;
+       const char *t;
 
        /* Only remove directories under $GNUSTEP_USER_ROOT */
        if ((t = wusergnusteppath()) == NULL)
diff --git a/WINGs/userdefaults.c b/WINGs/userdefaults.c
index 112f1f7..c1b4652 100644
--- a/WINGs/userdefaults.c
+++ b/WINGs/userdefaults.c
@@ -83,7 +83,7 @@ const char *wusergnusteppath()
 char *wdefaultspathfordomain(const char *domain)
 {
        char *path;
-       char *gspath;
+       const char *gspath;
        size_t slen;
 
        gspath = wusergnusteppath();
diff --git a/WINGs/wapplication.c b/WINGs/wapplication.c
index 070e0a9..974441f 100644
--- a/WINGs/wapplication.c
+++ b/WINGs/wapplication.c
@@ -61,7 +61,7 @@ char *WMGetApplicationName()
        return WMApplication.applicationName;
 }
 
-static char *checkFile(char *path, char *folder, char *ext, char *resource)
+static char *checkFile(const char *path, const char *folder, const char *ext, 
const char *resource)
 {
        char *ret;
        int extralen;
diff --git a/WPrefs.app/Menu.c b/WPrefs.app/Menu.c
index 3edb84a..7780df1 100644
--- a/WPrefs.app/Menu.c
+++ b/WPrefs.app/Menu.c
@@ -1478,7 +1478,7 @@ static WMPropList *getDefaultMenu(_Panel * panel)
 
 static void showData(_Panel * panel)
 {
-       char *gspath;
+       const char *gspath;
        char *menuPath;
        WMPropList *pmenu;
 
diff --git a/src/icon.c b/src/icon.c
index 1033734..95d3dd7 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -416,7 +416,8 @@ char *get_name_for_instance_class(char *wm_instance, char 
*wm_class)
 
 static char *get_icon_cache_path(void)
 {
-       char *prefix, *path;
+       const char *prefix;
+       char *path;
        int len, ret;
 
        prefix = wusergnusteppath();
diff --git a/util/getstyle.c b/util/getstyle.c
index e9ee696..6c397b4 100644
--- a/util/getstyle.c
+++ b/util/getstyle.c
@@ -185,7 +185,8 @@ void makeThemePack(WMPropList * style, char *themeName)
        WMPropList *value;
        int i;
        size_t themeNameLen;
-       char *themeDir, *t;
+       char *themeDir;
+       const char *t;
 
        if ((t = wusergnusteppath()) == NULL)
                return;

http://repo.or.cz/w/wmaker-crm.git/commit/cd1c55d63ce306ad43c1e601a60502f9c2b28435

commit cd1c55d63ce306ad43c1e601a60502f9c2b28435
Author: Christophe CURIS <[email protected]>
Date:   Sat May 4 15:43:29 2013 +0200

    WUtil: Changed declaration of 'wusergnusteppath' to return a CONST string
    
    According to the way its value is being used everywhere, that is
    what would be expected, so let's make it official.
    
    Please note that this may introduce warnings on user code using
    this function ("...discard const...") but that's an opportunity
    for them to check that their code is not doing anything wrong.

diff --git a/WINGs/WINGs/WUtil.h b/WINGs/WINGs/WUtil.h
index a4e8f27..515bd18 100644
--- a/WINGs/WINGs/WUtil.h
+++ b/WINGs/WINGs/WUtil.h
@@ -816,7 +816,7 @@ Bool WMWritePropListToFile(WMPropList *plist, const char 
*path);
 /* ---[ WINGs/userdefaults.c ]-------------------------------------------- */
 
 /* don't free the returned string */
-char* wusergnusteppath(void);
+const char* wusergnusteppath(void);
 
 /* Free the returned string when you no longer need it */
 char* wdefaultspathfordomain(const char *domain);
diff --git a/WINGs/userdefaults.c b/WINGs/userdefaults.c
index 7dd9931..112f1f7 100644
--- a/WINGs/userdefaults.c
+++ b/WINGs/userdefaults.c
@@ -46,7 +46,7 @@ extern char *WMGetApplicationName();
 #define UD_SYNC_INTERVAL       2000
 #endif
 
-char *wusergnusteppath()
+const char *wusergnusteppath()
 {
        static char *path = NULL;
        char *gspath;

http://repo.or.cz/w/wmaker-crm.git/commit/fd02f5f0832dd524352d11f77bc0fccf6ecc0047

commit fd02f5f0832dd524352d11f77bc0fccf6ecc0047
Author: Christophe CURIS <[email protected]>
Date:   Sat May 4 15:43:28 2013 +0200

    WUtil: Fixed risky code for de-escaping of strings
    
    The internal function 'unescapestr' is used to transform strings which
    may contain escape sequences (x) into their plain representation.
    
    There are a few cases where the function can misbehave (typically parse
    after the end of string, thus writing past the end of the reserved
    result area) which can be a source of problem later. The new code
    should be safer.

diff --git a/WINGs/proplist.c b/WINGs/proplist.c
index 1243354..bb5e057 100644
--- a/WINGs/proplist.c
+++ b/WINGs/proplist.c
@@ -508,16 +508,33 @@ static char *unescapestr(const char *src)
        char *dPtr;
        char ch;
 
-       for (dPtr = dest; *src; src++, dPtr++) {
-               if (*src != '\') {
-                       *dPtr = *src;
-               } else {
-                       ch = *(++src);
-                       if ((ch >= '0') && (ch <= '3')) {
-                               /* assume next 2 chars are octal too */
-                               *dPtr = ((ch & 07) << 6);
-                               *dPtr |= ((*(++src) & 07) << 3);
-                               *dPtr |= *(++src) & 07;
+       for (dPtr = dest; ; dPtr++) {
+               ch = *src++;
+               if (ch == '0')
+                       break;
+               else if (ch != '\')
+                       *dPtr = ch;
+               else {
+                       ch = *(src++);
+                       if (ch == '0') {
+                               *dPtr = '\';
+                               break;
+                       } else if ((ch >= '0') && (ch <= '7')) {
+                               char wch;
+
+                               /* Convert octal number to character */
+                               wch = (ch & 07);
+                               ch = *src;
+                               if ((ch >= '0') && (ch <= '7')) {
+                                       src++;
+                                       wch = (wch << 3) | (ch & 07);
+                                       ch = *src;
+                                       if ((ch >= '0') && (ch <= '7')) {
+                                               src++;
+                                               wch = (wch << 3) | (ch & 07);
+                                       }
+                               }
+                               *dPtr = wch;
                        } else {
                                switch (ch) {
                                case 'a':
@@ -542,7 +559,7 @@ static char *unescapestr(const char *src)
                                        *dPtr = 'f';
                                        break;
                                default:
-                                       *dPtr = *src;
+                                       *dPtr = ch;
                                }
                        }
                }

http://repo.or.cz/w/wmaker-crm.git/commit/f386e34d297adf8e515ff5a2d1a21bfad2cd4e9b

commit f386e34d297adf8e515ff5a2d1a21bfad2cd4e9b
Author: Christophe CURIS <[email protected]>
Date:   Sat May 4 15:43:27 2013 +0200

    WUtil: Fixed wrong type recast
    
    The previous syntax used an explicit cast to remove the CONST
    attribute, but the right way is to keep the attribute and store
    the result in a variable which is defined properly.

diff --git a/WINGs/string.c b/WINGs/string.c
index 8403d62..0fbead4 100644
--- a/WINGs/string.c
+++ b/WINGs/string.c
@@ -167,14 +167,14 @@ void wtokenfree(char **tokens, int count)
 
 char *wtrimspace(const char *s)
 {
-       char *t;
+       const char *t;
 
        if (s == NULL)
                return NULL;
 
        while (isspace(*s) && *s)
                s++;
-       t = (char *)s + strlen(s) - 1;
+       t = s + strlen(s) - 1;
        while (t > s && isspace(*t))
                t--;
 

http://repo.or.cz/w/wmaker-crm.git/commit/32ecd4ee583127defc6e0e54dbe6e4408648475e

commit 32ecd4ee583127defc6e0e54dbe6e4408648475e
Author: Christophe CURIS <[email protected]>
Date:   Sat May 4 15:43:26 2013 +0200

    WUtil: Avoid unnecessary strdup + free
    
    It is not good for memory fragmentation to duplicate a string and
    then free the original; changed code to only keep originaly allocated
    string.

diff --git a/WINGs/string.c b/WINGs/string.c
index 4db9981..8403d62 100644
--- a/WINGs/string.c
+++ b/WINGs/string.c
@@ -78,19 +78,17 @@ char *wtokennext(char *word, char **next)
                }
        }
 
-       if (*ret == 0)
-               t = NULL;
-       else
-               t = wstrdup(ret);
-
-       wfree(ret);
+       if (*ret == 0) {
+               wfree(ret);
+               ret = NULL;
+       }
 
        if (ctype == PRC_EOS)
                *next = NULL;
        else
                *next = ptr;
 
-       return t;
+       return ret;
 }
 
 /* separate a string in tokens, taking " and ' into account */

http://repo.or.cz/w/wmaker-crm.git/commit/98e3c7e3477cb1b241a5f4df8917ab7961e8fbb2

commit 98e3c7e3477cb1b241a5f4df8917ab7961e8fbb2
Author: Christophe CURIS <[email protected]>
Date:   Sat May 4 15:43:25 2013 +0200

    WUtil: Added comment about values returned by API functions
    
    This is mainly to be consistent with what's done in the rest of
    the file, but it is better to have it there that nowhere at all
    anyway...

diff --git a/WINGs/WINGs/WUtil.h b/WINGs/WINGs/WUtil.h
index 2b462db..a4e8f27 100644
--- a/WINGs/WINGs/WUtil.h
+++ b/WINGs/WINGs/WUtil.h
@@ -193,6 +193,8 @@ void __wmessage(const char *func, const char *file, int 
line, int type, const ch
 
 /* ---[ WINGs/findfile.c ]------------------------------------------------ */
 
+/* For the 4 function below, you have to free the returned string when you no 
longer need it */
+
 char* wfindfile(const char *paths, const char *file);
 
 char* wfindfileinlist(char *const *path_list, const char *file);
@@ -813,10 +815,13 @@ Bool WMWritePropListToFile(WMPropList *plist, const char 
*path);
 
 /* ---[ WINGs/userdefaults.c ]-------------------------------------------- */
 
+/* don't free the returned string */
 char* wusergnusteppath(void);
 
+/* Free the returned string when you no longer need it */
 char* wdefaultspathfordomain(const char *domain);
 
+/* Free the returned string when you no longer need it */
 char* wglobaldefaultspathfordomain(const char *domain);
 
 WMUserDefaults* WMGetStandardUserDefaults(void);
@@ -841,6 +846,7 @@ void WMSetUDObjectForKey(WMUserDefaults *database, 
WMPropList *object,
 
 void WMRemoveUDObjectForKey(WMUserDefaults *database, const char *defaultName);
 
+/* Returns a reference. Do not free it! */
 char* WMGetUDStringForKey(WMUserDefaults *database, const char *defaultName);
 
 int WMGetUDIntegerForKey(WMUserDefaults *database, const char *defaultName);

http://repo.or.cz/w/wmaker-crm.git/commit/74c17bffae9552911aa7a04cf5e2c9e587635856

commit 74c17bffae9552911aa7a04cf5e2c9e587635856
Author: Christophe CURIS <[email protected]>
Date:   Sat May 4 15:43:24 2013 +0200

    WUtil: Added 'const' attribute to all remaining functions where applicable
    
    This makes the WUtil API as much const-correct as possible for
    the arguments being given to its functions.
    
    This does not make it totally correct as it does not changes the
    const-ness on returned values because the goal of this patch is
    to make no visible change to existing program that would use this
    library.

diff --git a/WINGs/WINGs/WUtil.h b/WINGs/WINGs/WUtil.h
index 6c26f61..2b462db 100644
--- a/WINGs/WINGs/WUtil.h
+++ b/WINGs/WINGs/WUtil.h
@@ -553,7 +553,7 @@ WMData* WMCreateDataWithCapacity(unsigned capacity);
 
 WMData* WMCreateDataWithLength(unsigned length);
 
-WMData* WMCreateDataWithBytes(void *bytes, unsigned length);
+WMData* WMCreateDataWithBytes(const void *bytes, unsigned length);
 
 /* destructor is a function called to free the data when releasing the data
  * object, or NULL if no freeing of data is necesary. */
@@ -594,13 +594,13 @@ unsigned WMGetDataLength(WMData *aData);
 
 /* Adding data */
 
-void WMAppendDataBytes(WMData *aData, void *bytes, unsigned length);
+void WMAppendDataBytes(WMData *aData, const void *bytes, unsigned length);
 
 void WMAppendData(WMData *aData, WMData *anotherData);
 
 /* Modifying data */
 
-void WMReplaceDataBytesInRange(WMData *aData, WMRange aRange, void *bytes);
+void WMReplaceDataBytesInRange(WMData *aData, WMRange aRange, const void 
*bytes);
 
 void WMResetDataBytesInRange(WMData *aData, WMRange aRange);
 
@@ -713,11 +713,11 @@ void WMEnqueueCoalesceNotification(WMNotificationQueue 
*queue,
 
 void WMPLSetCaseSensitive(Bool caseSensitive);
 
-WMPropList* WMCreatePLString(char *str);
+WMPropList* WMCreatePLString(const char *str);
 
 WMPropList* WMCreatePLData(WMData *data);
 
-WMPropList* WMCreatePLDataWithBytes(unsigned char *bytes, unsigned int length);
+WMPropList* WMCreatePLDataWithBytes(const unsigned char *bytes, unsigned int 
length);
 
 WMPropList* WMCreatePLDataWithBytesNoCopy(unsigned char *bytes,
                                           unsigned int length,
@@ -821,7 +821,7 @@ char* wglobaldefaultspathfordomain(const char *domain);
 
 WMUserDefaults* WMGetStandardUserDefaults(void);
 
-WMUserDefaults* WMGetDefaultsFromPath(char *path);
+WMUserDefaults* WMGetDefaultsFromPath(const char *path);
 
 void WMSynchronizeUserDefaults(WMUserDefaults *database);
 
@@ -834,32 +834,32 @@ void WMEnableUDPeriodicSynchronization(WMUserDefaults 
*database, Bool enable);
  * Keys in array are just retained references to the original keys */
 WMPropList* WMGetUDKeys(WMUserDefaults *database);
 
-WMPropList* WMGetUDObjectForKey(WMUserDefaults *database, char *defaultName);
+WMPropList* WMGetUDObjectForKey(WMUserDefaults *database, const char 
*defaultName);
 
 void WMSetUDObjectForKey(WMUserDefaults *database, WMPropList *object,
-                         char *defaultName);
+                         const char *defaultName);
 
-void WMRemoveUDObjectForKey(WMUserDefaults *database, char *defaultName);
+void WMRemoveUDObjectForKey(WMUserDefaults *database, const char *defaultName);
 
-char* WMGetUDStringForKey(WMUserDefaults *database, char *defaultName);
+char* WMGetUDStringForKey(WMUserDefaults *database, const char *defaultName);
 
-int WMGetUDIntegerForKey(WMUserDefaults *database, char *defaultName);
+int WMGetUDIntegerForKey(WMUserDefaults *database, const char *defaultName);
 
-float WMGetUDFloatForKey(WMUserDefaults *database, char *defaultName);
+float WMGetUDFloatForKey(WMUserDefaults *database, const char *defaultName);
 
-Bool WMGetUDBoolForKey(WMUserDefaults *database, char *defaultName);
+Bool WMGetUDBoolForKey(WMUserDefaults *database, const char *defaultName);
 
-void WMSetUDStringForKey(WMUserDefaults *database, char *value,
-                         char *defaultName);
+void WMSetUDStringForKey(WMUserDefaults *database, const char *value,
+                         const char *defaultName);
 
 void WMSetUDIntegerForKey(WMUserDefaults *database, int value,
-                          char *defaultName);
+                          const char *defaultName);
 
 void WMSetUDFloatForKey(WMUserDefaults *database, float value,
-                        char *defaultName);
+                        const char *defaultName);
 
 void WMSetUDBoolForKey(WMUserDefaults *database, Bool value,
-                       char *defaultName);
+                       const char *defaultName);
 
 WMPropList* WMGetUDSearchList(WMUserDefaults *database);
 
diff --git a/WINGs/data.c b/WINGs/data.c
index c1c11a6..f448909 100644
--- a/WINGs/data.c
+++ b/WINGs/data.c
@@ -67,7 +67,7 @@ WMData *WMCreateDataWithLength(unsigned length)
        return aData;
 }
 
-WMData *WMCreateDataWithBytes(void *bytes, unsigned length)
+WMData *WMCreateDataWithBytes(const void *bytes, unsigned length)
 {
        WMData *aData;
 
@@ -230,7 +230,7 @@ unsigned WMGetDataLength(WMData * aData)
 }
 
 /* Adding data */
-void WMAppendDataBytes(WMData * aData, void *bytes, unsigned length)
+void WMAppendDataBytes(WMData * aData, const void *bytes, unsigned length)
 {
        unsigned oldLength = aData->length;
        unsigned newLength = oldLength + length;
@@ -260,7 +260,7 @@ void WMAppendData(WMData * aData, WMData * anotherData)
 
 /* Modifying data */
 
-void WMReplaceDataBytesInRange(WMData * aData, WMRange aRange, void *bytes)
+void WMReplaceDataBytesInRange(WMData * aData, WMRange aRange, const void 
*bytes)
 {
        wassertr(aRange.position < aData->length);
        wassertr(aRange.count <= aData->length - aRange.position);
diff --git a/WINGs/proplist.c b/WINGs/proplist.c
index 7e8ff2c..1243354 100644
--- a/WINGs/proplist.c
+++ b/WINGs/proplist.c
@@ -885,7 +885,7 @@ void WMPLSetCaseSensitive(Bool caseSensitiveness)
        caseSensitive = caseSensitiveness;
 }
 
-WMPropList *WMCreatePLString(char *str)
+WMPropList *WMCreatePLString(const char *str)
 {
        WMPropList *plist;
 
@@ -913,7 +913,7 @@ WMPropList *WMCreatePLData(WMData * data)
        return plist;
 }
 
-WMPropList *WMCreatePLDataWithBytes(unsigned char *bytes, unsigned int length)
+WMPropList *WMCreatePLDataWithBytes(const unsigned char *bytes, unsigned int 
length)
 {
        WMPropList *plist;
 
diff --git a/WINGs/userdefaults.c b/WINGs/userdefaults.c
index 96575a0..7dd9931 100644
--- a/WINGs/userdefaults.c
+++ b/WINGs/userdefaults.c
@@ -340,13 +340,13 @@ WMUserDefaults *WMGetStandardUserDefaults(void)
        return defaults;
 }
 
-WMUserDefaults *WMGetDefaultsFromPath(char *path)
+WMUserDefaults *WMGetDefaultsFromPath(const char *path)
 {
        WMUserDefaults *defaults;
        WMPropList *domain;
        WMPropList *key;
        struct stat stbuf;
-       char *name;
+       const char *name;
        int i;
 
        assert(path != NULL);
@@ -421,7 +421,7 @@ WMPropList *WMGetUDKeys(WMUserDefaults * database)
        return WMGetPLDictionaryKeys(database->appDomain);
 }
 
-WMPropList *WMGetUDObjectForKey(WMUserDefaults * database, char *defaultName)
+WMPropList *WMGetUDObjectForKey(WMUserDefaults * database, const char 
*defaultName)
 {
        WMPropList *domainName, *domain;
        WMPropList *object = NULL;
@@ -441,7 +441,7 @@ WMPropList *WMGetUDObjectForKey(WMUserDefaults * database, 
char *defaultName)
        return object;
 }
 
-void WMSetUDObjectForKey(WMUserDefaults * database, WMPropList * object, char 
*defaultName)
+void WMSetUDObjectForKey(WMUserDefaults * database, WMPropList * object, const 
char *defaultName)
 {
        WMPropList *key = WMCreatePLString(defaultName);
 
@@ -451,7 +451,7 @@ void WMSetUDObjectForKey(WMUserDefaults * database, 
WMPropList * object, char *d
        WMReleasePropList(key);
 }
 
-void WMRemoveUDObjectForKey(WMUserDefaults * database, char *defaultName)
+void WMRemoveUDObjectForKey(WMUserDefaults * database, const char *defaultName)
 {
        WMPropList *key = WMCreatePLString(defaultName);
 
@@ -462,7 +462,7 @@ void WMRemoveUDObjectForKey(WMUserDefaults * database, char 
*defaultName)
        WMReleasePropList(key);
 }
 
-char *WMGetUDStringForKey(WMUserDefaults * database, char *defaultName)
+char *WMGetUDStringForKey(WMUserDefaults * database, const char *defaultName)
 {
        WMPropList *val;
 
@@ -477,7 +477,7 @@ char *WMGetUDStringForKey(WMUserDefaults * database, char 
*defaultName)
        return WMGetFromPLString(val);
 }
 
-int WMGetUDIntegerForKey(WMUserDefaults * database, char *defaultName)
+int WMGetUDIntegerForKey(WMUserDefaults * database, const char *defaultName)
 {
        WMPropList *val;
        char *str;
@@ -501,7 +501,7 @@ int WMGetUDIntegerForKey(WMUserDefaults * database, char 
*defaultName)
        return value;
 }
 
-float WMGetUDFloatForKey(WMUserDefaults * database, char *defaultName)
+float WMGetUDFloatForKey(WMUserDefaults * database, const char *defaultName)
 {
        WMPropList *val;
        char *str;
@@ -521,7 +521,7 @@ float WMGetUDFloatForKey(WMUserDefaults * database, char 
*defaultName)
        return value;
 }
 
-Bool WMGetUDBoolForKey(WMUserDefaults * database, char *defaultName)
+Bool WMGetUDBoolForKey(WMUserDefaults * database, const char *defaultName)
 {
        WMPropList *val;
        int value;
@@ -551,7 +551,7 @@ Bool WMGetUDBoolForKey(WMUserDefaults * database, char 
*defaultName)
        return False;
 }
 
-void WMSetUDIntegerForKey(WMUserDefaults * database, int value, char 
*defaultName)
+void WMSetUDIntegerForKey(WMUserDefaults * database, int value, const char 
*defaultName)
 {
        WMPropList *object;
        char buffer[128];
@@ -563,7 +563,7 @@ void WMSetUDIntegerForKey(WMUserDefaults * database, int 
value, char *defaultNam
        WMReleasePropList(object);
 }
 
-void WMSetUDStringForKey(WMUserDefaults * database, char *value, char 
*defaultName)
+void WMSetUDStringForKey(WMUserDefaults * database, const char *value, const 
char *defaultName)
 {
        WMPropList *object;
 
@@ -573,7 +573,7 @@ void WMSetUDStringForKey(WMUserDefaults * database, char 
*value, char *defaultNa
        WMReleasePropList(object);
 }
 
-void WMSetUDFloatForKey(WMUserDefaults * database, float value, char 
*defaultName)
+void WMSetUDFloatForKey(WMUserDefaults * database, float value, const char 
*defaultName)
 {
        WMPropList *object;
        char buffer[128];
@@ -585,7 +585,7 @@ void WMSetUDFloatForKey(WMUserDefaults * database, float 
value, char *defaultNam
        WMReleasePropList(object);
 }
 
-void WMSetUDBoolForKey(WMUserDefaults * database, Bool value, char 
*defaultName)
+void WMSetUDBoolForKey(WMUserDefaults * database, Bool value, const char 
*defaultName)
 {
        static WMPropList *yes = NULL, *no = NULL;
 

http://repo.or.cz/w/wmaker-crm.git/commit/d40fa69b92546a8da44e531ba3974f30ca8a59c0

commit d40fa69b92546a8da44e531ba3974f30ca8a59c0
Author: Christophe CURIS <[email protected]>
Date:   Sat May 4 15:43:23 2013 +0200

    WUtil: Added 'const' attribute to the filename on WM(Read|Write)PropList*
    
    Note that the argument is also stored as-is in the PLData structure
    but only for debugging purpose (warning display to user), hence the
    choice to not duplicate it. As a side effect, it was 'const'-ified
    too to reflect that.

diff --git a/WINGs/WINGs/WUtil.h b/WINGs/WINGs/WUtil.h
index 78c38ae..6c26f61 100644
--- a/WINGs/WINGs/WUtil.h
+++ b/WINGs/WINGs/WUtil.h
@@ -805,11 +805,11 @@ WMPropList* WMCreatePropListFromDescription(char *desc);
 /* Free the returned string when you no longer need it */
 char* WMGetPropListDescription(WMPropList *plist, Bool indented);
 
-WMPropList* WMReadPropListFromFile(char *file);
+WMPropList* WMReadPropListFromFile(const char *file);
 
-WMPropList* WMReadPropListFromPipe(char *command);
+WMPropList* WMReadPropListFromPipe(const char *command);
 
-Bool WMWritePropListToFile(WMPropList *plist, char *path);
+Bool WMWritePropListToFile(WMPropList *plist, const char *path);
 
 /* ---[ WINGs/userdefaults.c ]-------------------------------------------- */
 
diff --git a/WINGs/proplist.c b/WINGs/proplist.c
index ee80500..7e8ff2c 100644
--- a/WINGs/proplist.c
+++ b/WINGs/proplist.c
@@ -38,7 +38,7 @@ typedef struct W_PropList {
 typedef struct PLData {
        char *ptr;
        int pos;
-       char *filename;
+       const char *filename;
        int lineNumber;
 } PLData;
 
@@ -1485,7 +1485,7 @@ char *WMGetPropListDescription(WMPropList * plist, Bool 
indented)
        return (indented ? indentedDescription(plist, 0) : description(plist));
 }
 
-WMPropList *WMReadPropListFromFile(char *file)
+WMPropList *WMReadPropListFromFile(const char *file)
 {
        WMPropList *plist = NULL;
        PLData *pldata;
@@ -1545,7 +1545,7 @@ WMPropList *WMReadPropListFromFile(char *file)
        return plist;
 }
 
-WMPropList *WMReadPropListFromPipe(char *command)
+WMPropList *WMReadPropListFromPipe(const char *command)
 {
        FILE *file;
        WMPropList *plist;
@@ -1601,7 +1601,7 @@ WMPropList *WMReadPropListFromPipe(char *command)
 
 /* TODO: review this function's code */
 
-Bool WMWritePropListToFile(WMPropList * plist, char *path)
+Bool WMWritePropListToFile(WMPropList * plist, const char *path)
 {
        char *thePath = NULL;
        char *desc;

http://repo.or.cz/w/wmaker-crm.git/commit/ea9d3e643f65b122d4414ed5feafff6e1f533dcc

commit ea9d3e643f65b122d4414ed5feafff6e1f533dcc
Author: Christophe CURIS <[email protected]>
Date:   Sat May 4 15:43:22 2013 +0200

    WUtil: Added 'const' attribute to parameters for file related API
    
    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.

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;

http://repo.or.cz/w/wmaker-crm.git/commit/bbf84eb0e8cfeb554def2487e91bdcbee15ae976

commit bbf84eb0e8cfeb554def2487e91bdcbee15ae976
Author: Christophe CURIS <[email protected]>
Date:   Sat May 4 15:43:21 2013 +0200

    WUtil: Added 'const' attribute on non-modified arguments to functions
    
    A number of functions do not actually modify the strings given as
    parameter, but only read or duplicate it. In this case it is a good
    practice to mark that parameter as pointer-to-const to let the
    compiler known about it, to be able to perform appropriate
    optimisations.

diff --git a/WINGs/WINGs/WUtil.h b/WINGs/WINGs/WUtil.h
index 84f60b9..d993e58 100644
--- a/WINGs/WINGs/WUtil.h
+++ b/WINGs/WINGs/WUtil.h
@@ -220,7 +220,7 @@ char* wstrndup(const char *str, size_t len);
  * str1 and str2 can be any strings including static and constant strings.
  * str1 and str2 will not be modified.
  * Free the returned string when you're done with it. */
-char* wstrconcat(char *str1, char *str2);
+char* wstrconcat(const char *str1, const char *str2);
 
 /* This will append src to dst, and return dst. dst MUST be either NULL
  * or a string that was a result of a dynamic allocation (malloc, realloc
@@ -229,7 +229,7 @@ char* wstrconcat(char *str1, char *str2);
  * it is equivalent to calling wstrdup(src) ).
  * The returned address may be different from the original address of dst,
  * so always assign the returned address to avoid dangling pointers. */
-char* wstrappend(char *dst, char *src);
+char* wstrappend(char *dst, const char *src);
 
 size_t wstrlcpy(char *, const char *, size_t);
 size_t wstrlcat(char *, const char *, size_t);
@@ -815,7 +815,7 @@ Bool WMWritePropListToFile(WMPropList *plist, char *path);
 
 char* wusergnusteppath(void);
 
-char* wdefaultspathfordomain(char *domain);
+char* wdefaultspathfordomain(const char *domain);
 
 char* wglobaldefaultspathfordomain(const char *domain);
 
diff --git a/WINGs/proplist.c b/WINGs/proplist.c
index 1f50546..ee80500 100644
--- a/WINGs/proplist.c
+++ b/WINGs/proplist.c
@@ -502,22 +502,22 @@ static INLINE int getNonSpaceChar(PLData * pldata)
        return c;
 }
 
-static char *unescapestr(char *src)
+static char *unescapestr(const char *src)
 {
        char *dest = wmalloc(strlen(src) + 1);
-       char *sPtr, *dPtr;
+       char *dPtr;
        char ch;
 
-       for (sPtr = src, dPtr = dest; *sPtr; sPtr++, dPtr++) {
-               if (*sPtr != '\') {
-                       *dPtr = *sPtr;
+       for (dPtr = dest; *src; src++, dPtr++) {
+               if (*src != '\') {
+                       *dPtr = *src;
                } else {
-                       ch = *(++sPtr);
+                       ch = *(++src);
                        if ((ch >= '0') && (ch <= '3')) {
                                /* assume next 2 chars are octal too */
                                *dPtr = ((ch & 07) << 6);
-                               *dPtr |= ((*(++sPtr) & 07) << 3);
-                               *dPtr |= *(++sPtr) & 07;
+                               *dPtr |= ((*(++src) & 07) << 3);
+                               *dPtr |= *(++src) & 07;
                        } else {
                                switch (ch) {
                                case 'a':
@@ -542,7 +542,7 @@ static char *unescapestr(char *src)
                                        *dPtr = 'f';
                                        break;
                                default:
-                                       *dPtr = *sPtr;
+                                       *dPtr = *src;
                                }
                        }
                }
diff --git a/WINGs/string.c b/WINGs/string.c
index 8da008f..4db9981 100644
--- a/WINGs/string.c
+++ b/WINGs/string.c
@@ -203,7 +203,7 @@ char *wstrndup(const char *str, size_t len)
        return copy;
 }
 
-char *wstrconcat(char *str1, char *str2)
+char *wstrconcat(const char *str1, const char *str2)
 {
        char *str;
        size_t slen;
@@ -226,7 +226,7 @@ char *wstrconcat(char *str1, char *str2)
        return str;
 }
 
-char *wstrappend(char *dst, char *src)
+char *wstrappend(char *dst, const char *src)
 {
        size_t slen;
 
diff --git a/WINGs/userdefaults.c b/WINGs/userdefaults.c
index 6de410e..96575a0 100644
--- a/WINGs/userdefaults.c
+++ b/WINGs/userdefaults.c
@@ -80,7 +80,7 @@ char *wusergnusteppath()
        return path;
 }
 
-char *wdefaultspathfordomain(char *domain)
+char *wdefaultspathfordomain(const char *domain)
 {
        char *path;
        char *gspath;

-----------------------------------------------------------------------

Summary of changes:
 WINGs/WINGs/WUtil.h  |   66 ++++++++++++++++++++++++++---------------------
 WINGs/data.c         |    6 ++--
 WINGs/findfile.c     |   18 ++++++------
 WINGs/proplist.c     |   60 ++++++++++++++++++++++++++++---------------
 WINGs/string.c       |   20 ++++++--------
 WINGs/userdefaults.c |   69 ++++++++++++++++++++++++-------------------------
 WINGs/wapplication.c |    2 +-
 WPrefs.app/Menu.c    |    2 +-
 configure.ac         |    2 +-
 src/icon.c           |    3 +-
 util/getstyle.c      |    3 +-
 11 files changed, 137 insertions(+), 114 deletions(-)


repo.or.cz automatic notification. Contact project admin [email protected]
if you want to unsubscribe, or site admin [email protected] if you receive
no reply.
-- 
wmaker-crm.git ("The Window Maker window manager")


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

Reply via email to