1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +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:
dan
2000-11-01 15:40:15 +00:00
parent 1a8c578a1c
commit 2bd2b72af9
17 changed files with 55 additions and 51 deletions

View File

@@ -43,6 +43,10 @@ changes since wmaker 0.62.1:
- added WMScrollerDidScrollNotification to scroller - added WMScrollerDidScrollNotification to scroller
- added WMGetScrollViewVisibleRect() - added WMGetScrollViewVisibleRect()
- fixed a mem leak in the browser code. - 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: changes since wmaker 0.62.0:

View File

@@ -236,7 +236,7 @@ void *wretain(void *ptr);
char *wstrdup(char *str); char *wstrdup(char *str);
char *wstrappend(char *dst, char *src); char *wstrconcat(char *dst, char *src);

View File

@@ -228,7 +228,7 @@ wstrdup(char *str)
char* char*
wstrappend(char *dst, char *src) wstrconcat(char *dst, char *src)
{ {
char *str; char *str;

View File

@@ -421,7 +421,7 @@ makeColorPanel(WMScreen *scrPtr, char *name)
panel->mode = WMWheelModeColorPanel; panel->mode = WMWheelModeColorPanel;
panel->lastChanged = 0; panel->lastChanged = 0;
panel->slidersmode = WMRGBModeColorPanel; panel->slidersmode = WMRGBModeColorPanel;
panel->configurationPath = wstrappend(wusergnusteppath(), panel->configurationPath = wstrconcat(wusergnusteppath(),
"/Library/Colors/"); "/Library/Colors/");
/* Some General Purpose Widgets */ /* Some General Purpose Widgets */
@@ -1249,7 +1249,7 @@ readConfiguration(W_ColorPanel *panel)
while ((dp = readdir(dPtr)) != NULL) { while ((dp = readdir(dPtr)) != NULL) {
unsigned int perm_mask; unsigned int perm_mask;
char *path = wstrappend(panel->configurationPath, char *path = wstrconcat(panel->configurationPath,
dp->d_name); dp->d_name);
if (dp->d_name[0] != '.') { if (dp->d_name[0] != '.') {
@@ -3163,7 +3163,7 @@ customPaletteMenuNewFromFile(W_ColorPanel *panel)
filename = wstrdup(filepath + i); filename = wstrdup(filepath + i);
/* Check for duplicate files, and rename it if there are any */ /* 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) { while (access (tmp, F_OK) == 0) {
char *newName; char *newName;
@@ -3173,7 +3173,7 @@ customPaletteMenuNewFromFile(W_ColorPanel *panel)
wfree(filename); wfree(filename);
filename = newName; filename = newName;
tmp = wstrappend(panel->configurationPath, filename); tmp = wstrconcat(panel->configurationPath, filename);
} }
wfree(tmp); wfree(tmp);
@@ -3183,7 +3183,7 @@ customPaletteMenuNewFromFile(W_ColorPanel *panel)
/* filepath is a "local" path now the file has been copied */ /* filepath is a "local" path now the file has been copied */
wfree(filepath); wfree(filepath);
filepath = wstrappend(panel->configurationPath, filename); filepath = wstrconcat(panel->configurationPath, filename);
/* load the image & add menu entries */ /* load the image & add menu entries */
tmpImg = RLoadImage(scr->rcontext, filepath, 0); tmpImg = RLoadImage(scr->rcontext, filepath, 0);
@@ -3202,7 +3202,7 @@ customPaletteMenuNewFromFile(W_ColorPanel *panel)
panel->currentPalette); panel->currentPalette);
} }
} else { } else {
tmp = wstrappend(panel->configurationPath, filename); tmp = wstrconcat(panel->configurationPath, filename);
i = remove(tmp); /* Delete the file, it doesn't belong here */ i = remove(tmp); /* Delete the file, it doesn't belong here */
WMRunAlertPanel(scr, panel->win, "File Error", WMRunAlertPanel(scr, panel->win, "File Error",
@@ -3249,8 +3249,8 @@ customPaletteMenuRename(W_ColorPanel *panel)
} }
/* For normal people */ /* For normal people */
fromPath = wstrappend(panel->configurationPath, fromName); fromPath = wstrconcat(panel->configurationPath, fromName);
toPath = wstrappend(panel->configurationPath, toName); toPath = wstrconcat(panel->configurationPath, toName);
if (access (toPath, F_OK) == 0) { if (access (toPath, F_OK) == 0) {
/* Careful, this palette exists already */ /* Careful, this palette exists already */
@@ -3313,9 +3313,9 @@ customPaletteMenuRemove(W_ColorPanel *panel)
item = WMGetPopUpButtonSelectedItem(panel->customPaletteHistoryBtn); item = WMGetPopUpButtonSelectedItem(panel->customPaletteHistoryBtn);
tmp = wstrappend( "This will permanently remove the palette ", tmp = wstrconcat( "This will permanently remove the palette ",
WMGetPopUpButtonItem(panel->customPaletteHistoryBtn, item )); WMGetPopUpButtonItem(panel->customPaletteHistoryBtn, item ));
text = wstrappend( tmp, text = wstrconcat( tmp,
".\n\nAre you sure you want to remove this palette ?"); ".\n\nAre you sure you want to remove this palette ?");
wfree(tmp); wfree(tmp);
@@ -3326,7 +3326,7 @@ customPaletteMenuRemove(W_ColorPanel *panel)
if (choice == 0) { if (choice == 0) {
tmp = wstrappend(panel->configurationPath, tmp = wstrconcat(panel->configurationPath,
WMGetPopUpButtonItem(panel->customPaletteHistoryBtn, item )); WMGetPopUpButtonItem(panel->customPaletteHistoryBtn, item ));
if ( remove(tmp) == 0) { if ( remove(tmp) == 0) {
@@ -3372,7 +3372,7 @@ customPaletteHistoryCallback(WMWidget *w, void *data)
False ); False );
} else { } else {
/* Load file from configpath */ /* Load file from configpath */
filename = wstrappend( panel->configurationPath, filename = wstrconcat( panel->configurationPath,
WMGetPopUpButtonItem(panel->customPaletteHistoryBtn, item) ); WMGetPopUpButtonItem(panel->customPaletteHistoryBtn, item) );
/* If the file corresponding to the item does not exist, /* If the file corresponding to the item does not exist,
@@ -3650,7 +3650,7 @@ fetchFile(char *toPath, char *srcFile, char *destFile)
return -1; 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)) if ((dest = open( tmp, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH))
== 0) { == 0) {
wsyserror("Could not create %s", tmp); wsyserror("Could not create %s", tmp);
@@ -3688,7 +3688,7 @@ generateNewFilename(char *curName)
ptr = curName; ptr = curName;
if (((ptr = strrchr(ptr, '{'))==0) || sscanf(ptr, "{%i}%c", &n, &c)!=1) if (((ptr = strrchr(ptr, '{'))==0) || sscanf(ptr, "{%i}%c", &n, &c)!=1)
return wstrappend(curName, " {1}"); return wstrconcat(curName, " {1}");
baseLen = ptr - curName -1; baseLen = ptr - curName -1;

View File

@@ -933,7 +933,7 @@ makeFileName(char *prefix)
wfree(fname); wfree(fname);
sprintf(buf, "%08lx.cache", time(NULL)); sprintf(buf, "%08lx.cache", time(NULL));
fname = wstrappend(prefix, buf); fname = wstrconcat(prefix, buf);
} }
return fname; return fname;
@@ -1695,7 +1695,7 @@ createPanel(Panel *p)
char *tmp; char *tmp;
Bool ok = True; Bool ok = True;
panel->fprefix = wstrappend(wusergnusteppath(), "/.AppInfo"); panel->fprefix = wstrconcat(wusergnusteppath(), "/.AppInfo");
if (access(panel->fprefix, F_OK)!=0) { if (access(panel->fprefix, F_OK)!=0) {
if (mkdir(panel->fprefix, 0755) < 0) { if (mkdir(panel->fprefix, 0755) < 0) {
@@ -1704,7 +1704,7 @@ createPanel(Panel *p)
} }
} }
if (ok) { if (ok) {
tmp = wstrappend(panel->fprefix, "/WPrefs/"); tmp = wstrconcat(panel->fprefix, "/WPrefs/");
wfree(panel->fprefix); wfree(panel->fprefix);
panel->fprefix = tmp; panel->fprefix = tmp;
if (access(panel->fprefix, F_OK)!=0) { if (access(panel->fprefix, F_OK)!=0) {

View File

@@ -1092,27 +1092,27 @@ updateFrameTitle(_Panel *panel, char *title, InfoType type)
switch (type) { switch (type) {
case ExecInfo: case ExecInfo:
tmp = wstrappend(title, _(": Execute Program")); tmp = wstrconcat(title, _(": Execute Program"));
break; break;
case CommandInfo: case CommandInfo:
tmp = wstrappend(title, _(": Perform Internal Command")); tmp = wstrconcat(title, _(": Perform Internal Command"));
break; break;
case ExternalInfo: case ExternalInfo:
tmp = wstrappend(title, _(": Open a Submenu")); tmp = wstrconcat(title, _(": Open a Submenu"));
break; break;
case PipeInfo: case PipeInfo:
tmp = wstrappend(title, _(": Program Generated Submenu")); tmp = wstrconcat(title, _(": Program Generated Submenu"));
break; break;
case DirectoryInfo: case DirectoryInfo:
tmp = wstrappend(title, _(": Directory Contents Menu")); tmp = wstrconcat(title, _(": Directory Contents Menu"));
break; break;
case WSMenuInfo: case WSMenuInfo:
tmp = wstrappend(title, _(": Open Workspaces Submenu")); tmp = wstrconcat(title, _(": Open Workspaces Submenu"));
break; break;
default: default:
@@ -1669,7 +1669,7 @@ processData(char *title, ItemData *data)
case PipeInfo: case PipeInfo:
PLAppendArrayElement(item, pomenu); PLAppendArrayElement(item, pomenu);
s1 = wstrappend("| ", data->param.pipe.command); s1 = wstrconcat("| ", data->param.pipe.command);
PLAppendArrayElement(item, PLMakeString(s1)); PLAppendArrayElement(item, PLMakeString(s1));
wfree(s1); wfree(s1);
break; break;

View File

@@ -688,7 +688,7 @@ storeCommandInScript(char *cmd, char *line)
FILE *f; FILE *f;
char buffer[128]; char buffer[128];
path = wstrappend(wusergnusteppath(), "/Library/WindowMaker/autostart"); path = wstrconcat(wusergnusteppath(), "/Library/WindowMaker/autostart");
f = fopen(path, "r"); f = fopen(path, "r");
if (!f) { if (!f) {
@@ -706,7 +706,7 @@ storeCommandInScript(char *cmd, char *line)
char *tmppath; char *tmppath;
FILE *fo; FILE *fo;
tmppath = wstrappend(wusergnusteppath(), tmppath = wstrconcat(wusergnusteppath(),
"/Library/WindowMaker/autostart.tmp"); "/Library/WindowMaker/autostart.tmp");
fo = fopen(tmppath, "w"); fo = fopen(tmppath, "w");
if (!fo) { if (!fo) {

View File

@@ -602,7 +602,7 @@ updateImage(TexturePanel *panel, char *path)
if (!image) { if (!image) {
char *message; char *message;
message = wstrappend(_("Could not load the selected file: "), message = wstrconcat(_("Could not load the selected file: "),
(char*)RMessageForError(RErrorCode)); (char*)RMessageForError(RErrorCode));
WMRunAlertPanel(scr, panel->win, _("Error"), message, WMRunAlertPanel(scr, panel->win, _("Error"), message,

View File

@@ -761,7 +761,7 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
{ {
char *command; char *command;
command = wstrappend(path, " --version"); command = wstrconcat(path, " --version");
file = popen(command, "r"); file = popen(command, "r");
wfree(command); wfree(command);
} }
@@ -802,7 +802,7 @@ loadConfigurations(WMScreen *scr, WMWindow *mainw)
{ {
char *command; char *command;
command = wstrappend(path, " --global_defaults_path"); command = wstrconcat(path, " --global_defaults_path");
file = popen(command, "r"); file = popen(command, "r");
wfree(command); wfree(command);
} }

View File

@@ -575,7 +575,7 @@ killCallback(WMenu *menu, WMenuEntry *entry)
assert(entry->clientdata!=NULL); 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" _(" will be forcibly closed.\n"
"Any unsaved changes will be lost.\n" "Any unsaved changes will be lost.\n"
"Please confirm.")); "Please confirm."));

View File

@@ -273,7 +273,7 @@ killCallback(WMenu *menu, WMenuEntry *entry)
tapplist = tapplist->next; tapplist = tapplist->next;
} }
#else #else
buffer = wstrappend(icon->wm_class, buffer = wstrconcat(icon->wm_class,
_(" will be forcibly closed.\n" _(" will be forcibly closed.\n"
"Any unsaved changes will be lost.\n" "Any unsaved changes will be lost.\n"
"Please confirm.")); "Please confirm."));

View File

@@ -1699,7 +1699,7 @@ connectKFM(WScreen *scr)
int sock = 0; int sock = 0;
struct sockaddr_un addr; struct sockaddr_un addr;
path = wstrappend(wgethomedir(), "/.kde/share/apps/kfm/pid"); path = wstrconcat(wgethomedir(), "/.kde/share/apps/kfm/pid");
strcpy(buffer, getenv("DISPLAY")); strcpy(buffer, getenv("DISPLAY"));
ptr = strchr(buffer, ':'); ptr = strchr(buffer, ':');
@@ -1716,7 +1716,7 @@ connectKFM(WScreen *scr)
strcat(buffer, b); strcat(buffer, b);
} }
ptr = path; ptr = path;
path = wstrappend(ptr, buffer); path = wstrconcat(ptr, buffer);
wfree(ptr); wfree(ptr);
/* pid file */ /* pid file */
@@ -1749,7 +1749,7 @@ connectKFM(WScreen *scr)
return -1; return -1;
} }
path = wstrappend(wgethomedir(), "/.kde/share/apps/kfm/magic"); path = wstrconcat(wgethomedir(), "/.kde/share/apps/kfm/magic");
f = fopen(path, "r"); f = fopen(path, "r");
if (!f) { if (!f) {
return -1; return -1;
@@ -1761,7 +1761,7 @@ connectKFM(WScreen *scr)
} }
puts(buffer); puts(buffer);
ptr = wstrappend("auth", buffer); ptr = wstrconcat("auth", buffer);
writeSocket(sock, ptr); writeSocket(sock, ptr);
wfree(ptr); wfree(ptr);

View File

@@ -249,7 +249,7 @@ shellCommandHandler(pid_t pid, unsigned char status, _tuple *data)
if (status == 127) { if (status == 127) {
char *buffer; 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); wMessageDialog(data->scr, _("Error"), buffer, _("OK"), NULL, NULL);
wfree(buffer); wfree(buffer);
@@ -464,7 +464,7 @@ static void
execInitScript() execInitScript()
{ {
char *file; char *file;
char *paths = wstrappend(wusergnusteppath(), ":"DEF_CONFIG_PATHS); char *paths = wstrconcat(wusergnusteppath(), ":"DEF_CONFIG_PATHS);
file = wfindfile(paths, DEF_INIT_SCRIPT); file = wfindfile(paths, DEF_INIT_SCRIPT);
wfree(paths); wfree(paths);
@@ -489,7 +489,7 @@ void
ExecExitScript() ExecExitScript()
{ {
char *file; char *file;
char *paths = wstrappend(wusergnusteppath(), ":"DEF_CONFIG_PATHS); char *paths = wstrconcat(wusergnusteppath(), ":"DEF_CONFIG_PATHS);
file = wfindfile(paths, DEF_EXIT_SCRIPT); file = wfindfile(paths, DEF_EXIT_SCRIPT);
wfree(paths); wfree(paths);
@@ -540,7 +540,7 @@ getFullPath(char *path)
} else { } else {
return wstrappend(path); return wstrconcat(path);
} }
return tmp; return tmp;
@@ -562,7 +562,7 @@ main(int argc, char **argv)
/* for telling WPrefs what's the name of the wmaker binary being ran */ /* 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); putenv(str);
ArgCount = argc; ArgCount = argc;

View File

@@ -1029,7 +1029,7 @@ appendrealloc(char *a, char *b)
if (a == NULL) if (a == NULL)
return wstrdup(b); return wstrdup(b);
else { else {
char *c = wstrappend(a, b); char *c = wstrconcat(a, b);
wfree(a); wfree(a);
return c; return c;
} }
@@ -1093,7 +1093,7 @@ GetShortcutString(char *text)
/* ksym = XStringToKeysym(text); /* ksym = XStringToKeysym(text);
tmp = keysymToString(ksym, modmask); tmp = keysymToString(ksym, modmask);
puts(tmp); puts(tmp);
buffer = wstrappend(buffer, tmp); buffer = wstrconcat(buffer, tmp);
*/ */
wfree(tmp); wfree(tmp);

View File

@@ -806,7 +806,7 @@ addMenuEntry(WMenu *menu, char *title, char *shortcut, char *command,
file_name, command); file_name, command);
else { else {
entry = wMenuAddCallback(menu, title, execCommand, entry = wMenuAddCallback(menu, title, execCommand,
wstrappend("exec ", params)); wstrconcat("exec ", params));
entry->free_cdata = free; entry->free_cdata = free;
shortcutOk = True; shortcutOk = True;
} }

View File

@@ -1266,8 +1266,8 @@ createInspectorForWindow(WWindow *wwin, int xpos, int ypos,
if (wwin->wm_class && wwin->wm_instance) { if (wwin->wm_class && wwin->wm_instance) {
char *str, *tmp; char *str, *tmp;
tmp = wstrappend(wwin->wm_instance, "."); tmp = wstrconcat(wwin->wm_instance, ".");
str = wstrappend(tmp, wwin->wm_class); str = wstrconcat(tmp, wwin->wm_class);
panel->bothRb = WMCreateRadioButton(panel->specFrm); panel->bothRb = WMCreateRadioButton(panel->specFrm);
WMMoveWidget(panel->bothRb, 10, 18); WMMoveWidget(panel->bothRb, 10, 18);

View File

@@ -1011,8 +1011,8 @@ updateDomain(char *domain, char *key, char *texture)
char *program = "wdwrite"; char *program = "wdwrite";
/* here is a mem leak */ /* here is a mem leak */
system(wstrappend("wdwrite ", system(wstrconcat("wdwrite ",
wstrappend(domain, smooth ? " SmoothWorkspaceBack YES" wstrconcat(domain, smooth ? " SmoothWorkspaceBack YES"
: " SmoothWorkspaceBack NO"))); : " SmoothWorkspaceBack NO")));
execlp(program, program, domain, key, texture, NULL); execlp(program, program, domain, key, texture, NULL);
@@ -1161,9 +1161,9 @@ getFullPixmapPath(char *file)
path = malloc(bsize); path = malloc(bsize);
} }
tmp = wstrappend(path, "/"); tmp = wstrconcat(path, "/");
wfree(path); wfree(path);
path = wstrappend(tmp, file); path = wstrconcat(tmp, file);
wfree(tmp); wfree(tmp);
return path; return path;