git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@16554 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2003-04-27 08:27:28 +00:00
parent 6e7c341d1f
commit b88ca8d8a6
2 changed files with 14 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2003-04-27 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/xpbs.m: ([xSendData:format:items:type:to:]) Fix bug
calculating offset into data buffer. Prevent crashing and
provision of garbage data.
2003-04-10 12:12 Alexander Malmberg <alexander@malmberg.org>
* Source/x11/XWindowBuffer.m (-dealloc): Don't explicitly set the

View file

@ -996,18 +996,19 @@ xErrorHandler(Display *d, XErrorEvent *e)
int (*oldHandler)(Display*, XErrorEvent*);
int mode = PropModeReplace;
int pos = 0;
int maxItems = 4096 * 8 / format;
appendFailure = NO;
oldHandler = XSetErrorHandler(xErrorHandler);
while (appendFailure == NO && pos < numItems)
{
int maxItems = 4096 * 8 / format;
if (pos + maxItems > numItems)
{
maxItems = numItems - pos;
}
XChangeProperty(xDisplay, window, property,
xType, format, mode, &data[pos*format], maxItems);
xType, format, mode, &data[pos*format/8], maxItems);
mode = PropModeAppend;
pos += maxItems;
XSync(xDisplay, False);
@ -1015,8 +1016,10 @@ xErrorHandler(Display *d, XErrorEvent *e)
XFree(data);
XSetErrorHandler(oldHandler);
if (appendFailure == NO)
{
status = YES;
}
}
return status;
}