Path: utzoo!attcan!uunet!snorkelwacker!bloom-beacon!ANDREW.CMU.EDU!wjh+ From: wjh+@ANDREW.CMU.EDU (Fred Hansen) Newsgroups: comp.windows.x Subject: Bugs in XFetchBytes/XStoreBytes Message-ID: Date: 1 Dec 89 19:28:13 GMT Sender: root@athena.mit.edu (Wizard A. Root) Organization: The Internet Lines: 25 The implementations of XFetchBytes and XStoreBytes ignore display->max_request_size, so they fail if the string argument is too large. Here is a sketch of what XStoreBytes ought to look like: Display *xDisplay = /*** the display ***/ ; Window window = RootWindow(xDisplay, 0); long l; char *x; int mode = PropModeReplace; int maxxfer = xDisplay->max_requestsize - 100; l = /*** length to send ***/ ; x = /*** source location ***/ ; while (l > 0) { /* send a chunk of bytes */ XChangeProperty(xDisplay, window, XA_CUT_BUFFER0, XA_STRING, 8, mode, (unsigned char *) x, (l > maxxfer) ? maxxfer : l); l -= maxxfer; x += maxxfer; mode = PropModeAppend; /* mode for subsequent transfers */ }