From: Christophe CURIS <christophe.cu...@free.fr>

Use a better name for local variable and allocate the (almost) correct
number of characters for the path instead of a fixed offset that could be
a problem if the constant part of the path were to be updated.

Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>
---
 util/getstyle.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/util/getstyle.c b/util/getstyle.c
index 7c8f00b..08909a8 100644
--- a/util/getstyle.c
+++ b/util/getstyle.c
@@ -181,6 +181,9 @@ static void findCopyFile(const char *dir, const char *file)
        free(fullPath);
 }
 
+#define THEME_SUBPATH "/Library/WindowMaker/Themes/"
+#define THEME_EXTDIR  ".themed/"
+
 static void makeThemePack(WMPropList * style, const char *themeName)
 {
        WMPropList *keys;
@@ -189,13 +192,16 @@ static void makeThemePack(WMPropList * style, const char 
*themeName)
        int i;
        size_t themeNameLen;
        char *themeDir;
-       const char *t;
+       const char *user_base;
 
-       if ((t = wusergnusteppath()) == NULL)
+       user_base = wusergnusteppath();
+       if (user_base == NULL)
                return;
-       themeNameLen = strlen(t) + strlen(themeName) + 50;
+       themeNameLen = strlen(user_base) + sizeof(THEME_SUBPATH) + 
strlen(themeName) + sizeof(THEME_EXTDIR) + 1;
        themeDir = wmalloc(themeNameLen);
-       snprintf(themeDir, themeNameLen, 
"%s/Library/WindowMaker/Themes/%s.themed/", t, themeName);
+       snprintf(themeDir, themeNameLen,
+                "%s" THEME_SUBPATH "%s" THEME_EXTDIR,
+                user_base, themeName);
        ThemePath = themeDir;
 
        if (!wmkdirhier(themeDir)) {
-- 
1.9.2


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to