mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
- renamed wstrappend() to wstrconcat().
be sure to replace wstrappend() with wstrconcat() anywhere in your code because a new wstrappend() function will be implemented that will have different semantics and if your code will use the new one instead of the old will break.
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -236,7 +236,7 @@ void *wretain(void *ptr);
|
||||
|
||||
char *wstrdup(char *str);
|
||||
|
||||
char *wstrappend(char *dst, char *src);
|
||||
char *wstrconcat(char *dst, char *src);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -228,7 +228,7 @@ wstrdup(char *str)
|
||||
|
||||
|
||||
char*
|
||||
wstrappend(char *dst, char *src)
|
||||
wstrconcat(char *dst, char *src)
|
||||
{
|
||||
char *str;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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."));
|
||||
|
||||
@@ -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."));
|
||||
|
||||
@@ -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);
|
||||
|
||||
10
src/main.c
10
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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user