mirror of
https://github.com/gryf/wmaker.git
synced 2026-02-06 16:25:50 +01:00
- fixed problem with WINGs based apps exiting with a "X_RotateProperties"
related error when text was selected in a textfiled (this included WPrefs.app and Window Maker itself). - replaced some malloc's with wmalloc's
This commit is contained in:
@@ -38,8 +38,8 @@ char *ProgName;
|
||||
char*
|
||||
defaultsPathForDomain(char *domain)
|
||||
{
|
||||
char path[1024];
|
||||
char *gspath, *tmp;
|
||||
static char path[1024];
|
||||
char *gspath;
|
||||
|
||||
gspath = getenv("GNUSTEP_USER_ROOT");
|
||||
if (gspath) {
|
||||
@@ -60,10 +60,7 @@ defaultsPathForDomain(char *domain)
|
||||
strcat(path, "/");
|
||||
strcat(path, domain);
|
||||
|
||||
tmp = malloc(strlen(path)+2);
|
||||
strcpy(tmp, path);
|
||||
|
||||
return tmp;
|
||||
return path;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -114,24 +114,19 @@ print_help()
|
||||
char*
|
||||
globalDefaultsPathForDomain(char *domain)
|
||||
{
|
||||
char path[1024];
|
||||
char *tmp;
|
||||
static char path[1024];
|
||||
|
||||
sprintf(path, "%s/WindowMaker/%s", SYSCONFDIR, domain);
|
||||
|
||||
tmp = malloc(strlen(path)+2);
|
||||
assert(tmp!=NULL);
|
||||
strcpy(tmp, path);
|
||||
|
||||
return tmp;
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
char*
|
||||
defaultsPathForDomain(char *domain)
|
||||
{
|
||||
char path[1024];
|
||||
char *gspath, *tmp;
|
||||
static char path[1024];
|
||||
char *gspath;
|
||||
|
||||
gspath = getenv("GNUSTEP_USER_ROOT");
|
||||
if (gspath) {
|
||||
@@ -152,10 +147,7 @@ defaultsPathForDomain(char *domain)
|
||||
strcat(path, "/");
|
||||
strcat(path, domain);
|
||||
|
||||
tmp = malloc(strlen(path)+2);
|
||||
strcpy(tmp, path);
|
||||
|
||||
return tmp;
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
@@ -602,7 +594,6 @@ main(int argc, char **argv)
|
||||
ProgName, path);
|
||||
exit(1);
|
||||
}
|
||||
free(path);
|
||||
|
||||
/* get global value */
|
||||
path = globalDefaultsPathForDomain("WindowMaker");
|
||||
|
||||
@@ -36,8 +36,8 @@ char *ProgName;
|
||||
char*
|
||||
defaultsPathForDomain(char *domain)
|
||||
{
|
||||
char path[1024];
|
||||
char *gspath, *tmp;
|
||||
static char path[1024];
|
||||
char *gspath;
|
||||
|
||||
gspath = getenv("GNUSTEP_USER_ROOT");
|
||||
if (gspath) {
|
||||
@@ -59,10 +59,7 @@ defaultsPathForDomain(char *domain)
|
||||
strcat(path, "/");
|
||||
strcat(path, domain);
|
||||
|
||||
tmp = malloc(strlen(path)+2);
|
||||
strcpy(tmp, path);
|
||||
|
||||
return tmp;
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@ proplist_t readBlackBoxStyle(char *path);
|
||||
char*
|
||||
defaultsPathForDomain(char *domain)
|
||||
{
|
||||
char path[1024];
|
||||
char *gspath, *tmp;
|
||||
static char path[1024];
|
||||
char *gspath;
|
||||
|
||||
gspath = getenv("GNUSTEP_USER_ROOT");
|
||||
if (gspath) {
|
||||
@@ -87,10 +87,7 @@ defaultsPathForDomain(char *domain)
|
||||
strcat(path, "/");
|
||||
strcat(path, domain);
|
||||
|
||||
tmp = malloc(strlen(path)+2);
|
||||
strcpy(tmp, path);
|
||||
|
||||
return tmp;
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1156,9 +1156,8 @@ getFullPixmapPath(char *file)
|
||||
char *path = wmalloc(bsize);
|
||||
|
||||
while (!getcwd(path, bsize)) {
|
||||
wfree(path);
|
||||
bsize += bsize/2;
|
||||
path = malloc(bsize);
|
||||
path = wrealloc(path, bsize);
|
||||
}
|
||||
|
||||
tmp = wstrconcat(path, "/");
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* wxcopy.c- copy stdin or file into cutbuffer
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1997-1999 Alfredo K. Kojima
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
@@ -82,7 +82,7 @@ main(int argc, char **argv)
|
||||
if (i<argc-1) {
|
||||
i++;
|
||||
if (sscanf(argv[i],"%i", &buffer)!=1) {
|
||||
fprintf(stderr, "%s: could not convert '%s' to int\n",
|
||||
fprintf(stderr, "%s: could not convert '%s' to int\n",
|
||||
argv[0], argv[i]);
|
||||
exit(1);
|
||||
}
|
||||
@@ -136,17 +136,56 @@ main(int argc, char **argv)
|
||||
XDisplayName(display_name));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (buffer<0) {
|
||||
Atom *rootWinProps;
|
||||
int exists[8] = {0, 0, 0, 0, 0, 0, 0, 0};
|
||||
int i, count;
|
||||
|
||||
/* Create missing CUT_BUFFERs */
|
||||
rootWinProps = XListProperties(dpy, DefaultRootWindow(dpy), &count);
|
||||
for (i=0; i<count; i++) {
|
||||
switch(rootWinProps[i]) {
|
||||
case XA_CUT_BUFFER0:
|
||||
exists[0] = 1; break;
|
||||
case XA_CUT_BUFFER1:
|
||||
exists[1] = 1; break;
|
||||
case XA_CUT_BUFFER2:
|
||||
exists[2] = 1; break;
|
||||
case XA_CUT_BUFFER3:
|
||||
exists[3] = 1; break;
|
||||
case XA_CUT_BUFFER4:
|
||||
exists[4] = 1; break;
|
||||
case XA_CUT_BUFFER5:
|
||||
exists[5] = 1; break;
|
||||
case XA_CUT_BUFFER6:
|
||||
exists[6] = 1; break;
|
||||
case XA_CUT_BUFFER7:
|
||||
exists[7] = 1; break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (rootWinProps) {
|
||||
XFree(rootWinProps);
|
||||
}
|
||||
for (i=0; i<8; i++) {
|
||||
if (!exists[i]) {
|
||||
XStoreBuffer(dpy, "", 0, i);
|
||||
}
|
||||
}
|
||||
|
||||
XRotateBuffers(dpy, 1);
|
||||
buffer=0;
|
||||
}
|
||||
|
||||
while (!feof(file)) {
|
||||
char *nbuf;
|
||||
char tmp[LINESIZE+2];
|
||||
int nl=0;
|
||||
|
||||
/*
|
||||
* Use read() instead of fgets() to preserve NULs, since
|
||||
* Use read() instead of fgets() to preserve NULLs, since
|
||||
* especially since there's no reason to read one line at a time.
|
||||
*/
|
||||
if ((nl = fread(tmp, 1, LINESIZE, file)) <= 0) {
|
||||
@@ -154,21 +193,22 @@ main(int argc, char **argv)
|
||||
}
|
||||
if (buf_len == 0) {
|
||||
nbuf = malloc(buf_len = l+nl+1);
|
||||
}
|
||||
else {
|
||||
if (buf_len < l+nl+1) {
|
||||
/*
|
||||
* To avoid terrible performance on big input buffers,
|
||||
* grow by doubling, not by the minimum needed for the
|
||||
* current line.
|
||||
*/
|
||||
buf_len = 2 * buf_len + nl + 1;
|
||||
nbuf = realloc(buf, buf_len);
|
||||
}
|
||||
else {
|
||||
nbuf = buf;
|
||||
}
|
||||
}
|
||||
} else if (buf_len < l+nl+1) {
|
||||
/*
|
||||
* To avoid terrible performance on big input buffers,
|
||||
* grow by doubling, not by the minimum needed for the
|
||||
* current line.
|
||||
*/
|
||||
buf_len = 2 * buf_len + nl + 1;
|
||||
/* some realloc implementations don't do malloc if buf==NULL */
|
||||
if (buf == NULL) {
|
||||
nbuf = malloc(buf_len);
|
||||
} else {
|
||||
nbuf = realloc(buf, buf_len);
|
||||
}
|
||||
} else {
|
||||
nbuf = buf;
|
||||
}
|
||||
if (!nbuf) {
|
||||
fprintf(stderr, "%s: out of memory\n", argv[0]);
|
||||
exit(1);
|
||||
|
||||
Reference in New Issue
Block a user