diff --git a/WINGs/ChangeLog b/WINGs/ChangeLog index f03eabbb..45171b6c 100644 --- a/WINGs/ChangeLog +++ b/WINGs/ChangeLog @@ -43,6 +43,10 @@ changes since wmaker 0.62.1: - added WMScrollerDidScrollNotification to scroller - added WMGetScrollViewVisibleRect() - fixed a mem leak in the browser code. +- renamed wstrappend() to wstrconcat(). Be sure to rename all occurences of + wstrappend() in your own code with wstrconcat(), else weird things may + happen, because a new wstrappend() with different semantics is to be + implemented! changes since wmaker 0.62.0: diff --git a/WINGs/WUtil.h b/WINGs/WUtil.h index e396db57..51af1766 100644 --- a/WINGs/WUtil.h +++ b/WINGs/WUtil.h @@ -236,7 +236,7 @@ void *wretain(void *ptr); char *wstrdup(char *str); -char *wstrappend(char *dst, char *src); +char *wstrconcat(char *dst, char *src); diff --git a/WINGs/memory.c b/WINGs/memory.c index 4956ad7b..c7ca26dc 100644 --- a/WINGs/memory.c +++ b/WINGs/memory.c @@ -228,7 +228,7 @@ wstrdup(char *str) char* -wstrappend(char *dst, char *src) +wstrconcat(char *dst, char *src) { char *str; diff --git a/WINGs/wcolorpanel.c b/WINGs/wcolorpanel.c index f627dc41..9b12ee54 100644 --- a/WINGs/wcolorpanel.c +++ b/WINGs/wcolorpanel.c @@ -421,7 +421,7 @@ makeColorPanel(WMScreen *scrPtr, char *name) panel->mode = WMWheelModeColorPanel; panel->lastChanged = 0; panel->slidersmode = WMRGBModeColorPanel; - panel->configurationPath = wstrappend(wusergnusteppath(), + panel->configurationPath = wstrconcat(wusergnusteppath(), "/Library/Colors/"); /* Some General Purpose Widgets */ @@ -1249,7 +1249,7 @@ readConfiguration(W_ColorPanel *panel) while ((dp = readdir(dPtr)) != NULL) { unsigned int perm_mask; - char *path = wstrappend(panel->configurationPath, + char *path = wstrconcat(panel->configurationPath, dp->d_name); if (dp->d_name[0] != '.') { @@ -3163,7 +3163,7 @@ customPaletteMenuNewFromFile(W_ColorPanel *panel) filename = wstrdup(filepath + i); /* Check for duplicate files, and rename it if there are any */ - tmp = wstrappend(panel->configurationPath, filename); + tmp = wstrconcat(panel->configurationPath, filename); while (access (tmp, F_OK) == 0) { char *newName; @@ -3173,7 +3173,7 @@ customPaletteMenuNewFromFile(W_ColorPanel *panel) wfree(filename); filename = newName; - tmp = wstrappend(panel->configurationPath, filename); + tmp = wstrconcat(panel->configurationPath, filename); } wfree(tmp); @@ -3183,7 +3183,7 @@ customPaletteMenuNewFromFile(W_ColorPanel *panel) /* filepath is a "local" path now the file has been copied */ wfree(filepath); - filepath = wstrappend(panel->configurationPath, filename); + filepath = wstrconcat(panel->configurationPath, filename); /* load the image & add menu entries */ tmpImg = RLoadImage(scr->rcontext, filepath, 0); @@ -3202,7 +3202,7 @@ customPaletteMenuNewFromFile(W_ColorPanel *panel) panel->currentPalette); } } else { - tmp = wstrappend(panel->configurationPath, filename); + tmp = wstrconcat(panel->configurationPath, filename); i = remove(tmp); /* Delete the file, it doesn't belong here */ WMRunAlertPanel(scr, panel->win, "File Error", @@ -3249,8 +3249,8 @@ customPaletteMenuRename(W_ColorPanel *panel) } /* For normal people */ - fromPath = wstrappend(panel->configurationPath, fromName); - toPath = wstrappend(panel->configurationPath, toName); + fromPath = wstrconcat(panel->configurationPath, fromName); + toPath = wstrconcat(panel->configurationPath, toName); if (access (toPath, F_OK) == 0) { /* Careful, this palette exists already */ @@ -3313,9 +3313,9 @@ customPaletteMenuRemove(W_ColorPanel *panel) item = WMGetPopUpButtonSelectedItem(panel->customPaletteHistoryBtn); - tmp = wstrappend( "This will permanently remove the palette ", + tmp = wstrconcat( "This will permanently remove the palette ", WMGetPopUpButtonItem(panel->customPaletteHistoryBtn, item )); - text = wstrappend( tmp, + text = wstrconcat( tmp, ".\n\nAre you sure you want to remove this palette ?"); wfree(tmp); @@ -3326,7 +3326,7 @@ customPaletteMenuRemove(W_ColorPanel *panel) if (choice == 0) { - tmp = wstrappend(panel->configurationPath, + tmp = wstrconcat(panel->configurationPath, WMGetPopUpButtonItem(panel->customPaletteHistoryBtn, item )); if ( remove(tmp) == 0) { @@ -3372,7 +3372,7 @@ customPaletteHistoryCallback(WMWidget *w, void *data) False ); } else { /* Load file from configpath */ - filename = wstrappend( panel->configurationPath, + filename = wstrconcat( panel->configurationPath, WMGetPopUpButtonItem(panel->customPaletteHistoryBtn, item) ); /* If the file corresponding to the item does not exist, @@ -3650,7 +3650,7 @@ fetchFile(char *toPath, char *srcFile, char *destFile) return -1; } - tmp = wstrappend(toPath, destFile); + tmp = wstrconcat(toPath, destFile); if ((dest = open( tmp, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH)) == 0) { wsyserror("Could not create %s", tmp); @@ -3688,7 +3688,7 @@ generateNewFilename(char *curName) ptr = curName; if (((ptr = strrchr(ptr, '{'))==0) || sscanf(ptr, "{%i}%c", &n, &c)!=1) - return wstrappend(curName, " {1}"); + return wstrconcat(curName, " {1}"); baseLen = ptr - curName -1; diff --git a/WPrefs.app/Appearance.c b/WPrefs.app/Appearance.c index 647dfb7d..5e02fc79 100644 --- a/WPrefs.app/Appearance.c +++ b/WPrefs.app/Appearance.c @@ -933,7 +933,7 @@ makeFileName(char *prefix) wfree(fname); sprintf(buf, "%08lx.cache", time(NULL)); - fname = wstrappend(prefix, buf); + fname = wstrconcat(prefix, buf); } return fname; @@ -1695,7 +1695,7 @@ createPanel(Panel *p) char *tmp; Bool ok = True; - panel->fprefix = wstrappend(wusergnusteppath(), "/.AppInfo"); + panel->fprefix = wstrconcat(wusergnusteppath(), "/.AppInfo"); if (access(panel->fprefix, F_OK)!=0) { if (mkdir(panel->fprefix, 0755) < 0) { @@ -1704,7 +1704,7 @@ createPanel(Panel *p) } } if (ok) { - tmp = wstrappend(panel->fprefix, "/WPrefs/"); + tmp = wstrconcat(panel->fprefix, "/WPrefs/"); wfree(panel->fprefix); panel->fprefix = tmp; if (access(panel->fprefix, F_OK)!=0) { diff --git a/WPrefs.app/Menu.c b/WPrefs.app/Menu.c index 84713a10..842a6fca 100644 --- a/WPrefs.app/Menu.c +++ b/WPrefs.app/Menu.c @@ -1092,27 +1092,27 @@ updateFrameTitle(_Panel *panel, char *title, InfoType type) switch (type) { case ExecInfo: - tmp = wstrappend(title, _(": Execute Program")); + tmp = wstrconcat(title, _(": Execute Program")); break; case CommandInfo: - tmp = wstrappend(title, _(": Perform Internal Command")); + tmp = wstrconcat(title, _(": Perform Internal Command")); break; case ExternalInfo: - tmp = wstrappend(title, _(": Open a Submenu")); + tmp = wstrconcat(title, _(": Open a Submenu")); break; case PipeInfo: - tmp = wstrappend(title, _(": Program Generated Submenu")); + tmp = wstrconcat(title, _(": Program Generated Submenu")); break; case DirectoryInfo: - tmp = wstrappend(title, _(": Directory Contents Menu")); + tmp = wstrconcat(title, _(": Directory Contents Menu")); break; case WSMenuInfo: - tmp = wstrappend(title, _(": Open Workspaces Submenu")); + tmp = wstrconcat(title, _(": Open Workspaces Submenu")); break; default: @@ -1669,7 +1669,7 @@ processData(char *title, ItemData *data) case PipeInfo: PLAppendArrayElement(item, pomenu); - s1 = wstrappend("| ", data->param.pipe.command); + s1 = wstrconcat("| ", data->param.pipe.command); PLAppendArrayElement(item, PLMakeString(s1)); wfree(s1); break; diff --git a/WPrefs.app/MouseSettings.c b/WPrefs.app/MouseSettings.c index 83993a63..37324b6b 100644 --- a/WPrefs.app/MouseSettings.c +++ b/WPrefs.app/MouseSettings.c @@ -688,7 +688,7 @@ storeCommandInScript(char *cmd, char *line) FILE *f; char buffer[128]; - path = wstrappend(wusergnusteppath(), "/Library/WindowMaker/autostart"); + path = wstrconcat(wusergnusteppath(), "/Library/WindowMaker/autostart"); f = fopen(path, "r"); if (!f) { @@ -706,7 +706,7 @@ storeCommandInScript(char *cmd, char *line) char *tmppath; FILE *fo; - tmppath = wstrappend(wusergnusteppath(), + tmppath = wstrconcat(wusergnusteppath(), "/Library/WindowMaker/autostart.tmp"); fo = fopen(tmppath, "w"); if (!fo) { diff --git a/WPrefs.app/TexturePanel.c b/WPrefs.app/TexturePanel.c index b582c72d..6ccf7d20 100644 --- a/WPrefs.app/TexturePanel.c +++ b/WPrefs.app/TexturePanel.c @@ -602,7 +602,7 @@ updateImage(TexturePanel *panel, char *path) if (!image) { char *message; - message = wstrappend(_("Could not load the selected file: "), + message = wstrconcat(_("Could not load the selected file: "), (char*)RMessageForError(RErrorCode)); WMRunAlertPanel(scr, panel->win, _("Error"), message, diff --git a/WPrefs.app/WPrefs.c b/WPrefs.app/WPrefs.c index 375d37c1..ee534a8a 100644 --- a/WPrefs.app/WPrefs.c +++ b/WPrefs.app/WPrefs.c @@ -761,7 +761,7 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw) { char *command; - command = wstrappend(path, " --version"); + command = wstrconcat(path, " --version"); file = popen(command, "r"); wfree(command); } @@ -802,7 +802,7 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw) { char *command; - command = wstrappend(path, " --global_defaults_path"); + command = wstrconcat(path, " --global_defaults_path"); file = popen(command, "r"); wfree(command); } diff --git a/src/appicon.c b/src/appicon.c index f4f7c4eb..1b88d297 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -575,7 +575,7 @@ killCallback(WMenu *menu, WMenuEntry *entry) assert(entry->clientdata!=NULL); - buffer = wstrappend(wapp->app_icon ? wapp->app_icon->wm_class : NULL, + buffer = wstrconcat(wapp->app_icon ? wapp->app_icon->wm_class : NULL, _(" will be forcibly closed.\n" "Any unsaved changes will be lost.\n" "Please confirm.")); diff --git a/src/dock.c b/src/dock.c index 3166b792..2bb51975 100644 --- a/src/dock.c +++ b/src/dock.c @@ -273,7 +273,7 @@ killCallback(WMenu *menu, WMenuEntry *entry) tapplist = tapplist->next; } #else - buffer = wstrappend(icon->wm_class, + buffer = wstrconcat(icon->wm_class, _(" will be forcibly closed.\n" "Any unsaved changes will be lost.\n" "Please confirm.")); diff --git a/src/kwm.c b/src/kwm.c index 9a1f2284..f9def31a 100644 --- a/src/kwm.c +++ b/src/kwm.c @@ -1699,7 +1699,7 @@ connectKFM(WScreen *scr) int sock = 0; struct sockaddr_un addr; - path = wstrappend(wgethomedir(), "/.kde/share/apps/kfm/pid"); + path = wstrconcat(wgethomedir(), "/.kde/share/apps/kfm/pid"); strcpy(buffer, getenv("DISPLAY")); ptr = strchr(buffer, ':'); @@ -1716,7 +1716,7 @@ connectKFM(WScreen *scr) strcat(buffer, b); } ptr = path; - path = wstrappend(ptr, buffer); + path = wstrconcat(ptr, buffer); wfree(ptr); /* pid file */ @@ -1749,7 +1749,7 @@ connectKFM(WScreen *scr) return -1; } - path = wstrappend(wgethomedir(), "/.kde/share/apps/kfm/magic"); + path = wstrconcat(wgethomedir(), "/.kde/share/apps/kfm/magic"); f = fopen(path, "r"); if (!f) { return -1; @@ -1761,7 +1761,7 @@ connectKFM(WScreen *scr) } puts(buffer); - ptr = wstrappend("auth", buffer); + ptr = wstrconcat("auth", buffer); writeSocket(sock, ptr); wfree(ptr); diff --git a/src/main.c b/src/main.c index 6b4adea2..ac5891ca 100644 --- a/src/main.c +++ b/src/main.c @@ -249,7 +249,7 @@ shellCommandHandler(pid_t pid, unsigned char status, _tuple *data) if (status == 127) { char *buffer; - buffer = wstrappend(_("Could not execute command: "), data->command); + buffer = wstrconcat(_("Could not execute command: "), data->command); wMessageDialog(data->scr, _("Error"), buffer, _("OK"), NULL, NULL); wfree(buffer); @@ -464,7 +464,7 @@ static void execInitScript() { char *file; - char *paths = wstrappend(wusergnusteppath(), ":"DEF_CONFIG_PATHS); + char *paths = wstrconcat(wusergnusteppath(), ":"DEF_CONFIG_PATHS); file = wfindfile(paths, DEF_INIT_SCRIPT); wfree(paths); @@ -489,7 +489,7 @@ void ExecExitScript() { char *file; - char *paths = wstrappend(wusergnusteppath(), ":"DEF_CONFIG_PATHS); + char *paths = wstrconcat(wusergnusteppath(), ":"DEF_CONFIG_PATHS); file = wfindfile(paths, DEF_EXIT_SCRIPT); wfree(paths); @@ -540,7 +540,7 @@ getFullPath(char *path) } else { - return wstrappend(path); + return wstrconcat(path); } return tmp; @@ -562,7 +562,7 @@ main(int argc, char **argv) /* for telling WPrefs what's the name of the wmaker binary being ran */ - str = wstrappend("WMAKER_BIN_NAME=", argv[0]); + str = wstrconcat("WMAKER_BIN_NAME=", argv[0]); putenv(str); ArgCount = argc; diff --git a/src/misc.c b/src/misc.c index 8f53f67b..6bc3fe8c 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1029,7 +1029,7 @@ appendrealloc(char *a, char *b) if (a == NULL) return wstrdup(b); else { - char *c = wstrappend(a, b); + char *c = wstrconcat(a, b); wfree(a); return c; } @@ -1093,7 +1093,7 @@ GetShortcutString(char *text) /* ksym = XStringToKeysym(text); tmp = keysymToString(ksym, modmask); puts(tmp); - buffer = wstrappend(buffer, tmp); + buffer = wstrconcat(buffer, tmp); */ wfree(tmp); diff --git a/src/rootmenu.c b/src/rootmenu.c index 479869b9..bba945a4 100644 --- a/src/rootmenu.c +++ b/src/rootmenu.c @@ -806,7 +806,7 @@ addMenuEntry(WMenu *menu, char *title, char *shortcut, char *command, file_name, command); else { entry = wMenuAddCallback(menu, title, execCommand, - wstrappend("exec ", params)); + wstrconcat("exec ", params)); entry->free_cdata = free; shortcutOk = True; } diff --git a/src/winspector.c b/src/winspector.c index 7f13a045..283f503f 100644 --- a/src/winspector.c +++ b/src/winspector.c @@ -1266,8 +1266,8 @@ createInspectorForWindow(WWindow *wwin, int xpos, int ypos, if (wwin->wm_class && wwin->wm_instance) { char *str, *tmp; - tmp = wstrappend(wwin->wm_instance, "."); - str = wstrappend(tmp, wwin->wm_class); + tmp = wstrconcat(wwin->wm_instance, "."); + str = wstrconcat(tmp, wwin->wm_class); panel->bothRb = WMCreateRadioButton(panel->specFrm); WMMoveWidget(panel->bothRb, 10, 18); diff --git a/util/wmsetbg.c b/util/wmsetbg.c index e2d962ef..2da8c334 100644 --- a/util/wmsetbg.c +++ b/util/wmsetbg.c @@ -1011,8 +1011,8 @@ updateDomain(char *domain, char *key, char *texture) char *program = "wdwrite"; /* here is a mem leak */ - system(wstrappend("wdwrite ", - wstrappend(domain, smooth ? " SmoothWorkspaceBack YES" + system(wstrconcat("wdwrite ", + wstrconcat(domain, smooth ? " SmoothWorkspaceBack YES" : " SmoothWorkspaceBack NO"))); execlp(program, program, domain, key, texture, NULL); @@ -1161,9 +1161,9 @@ getFullPixmapPath(char *file) path = malloc(bsize); } - tmp = wstrappend(path, "/"); + tmp = wstrconcat(path, "/"); wfree(path); - path = wstrappend(tmp, file); + path = wstrconcat(tmp, file); wfree(tmp); return path;