Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 60581
Collapse All | Expand All

(-)xclib.c.orig (-11 / +8 lines)
Lines 107-115 Link Here
107
	unsigned char *buffer;
107
	unsigned char *buffer;
108
	unsigned long pty_size, pty_items;
108
	unsigned long pty_size, pty_items;
109
109
110
	/* local buffer of text to return */
111
	unsigned char *ltxt;
112
113
	pty = XInternAtom(dpy, "XCLIP_OUT", False);
110
	pty = XInternAtom(dpy, "XCLIP_OUT", False);
114
111
115
	switch (*context)
112
	switch (*context)
Lines 197-208 Link Here
197
			XDeleteProperty(dpy, win, pty);
194
			XDeleteProperty(dpy, win, pty);
198
		
195
		
199
			/* copy the buffer to the pointer for returned data */
196
			/* copy the buffer to the pointer for returned data */
200
			ltxt = (unsigned char *)xcmalloc(pty_items);
197
			(*txt) = (unsigned char *)xcmalloc(pty_items);
201
			memcpy(ltxt, buffer, pty_items);
198
			memcpy((*txt), buffer, pty_items);
202
199
203
			/* set the length of the returned data */
200
			/* set the length of the returned data */
204
			*len = pty_items;
201
			*len = pty_items;
205
			*txt = ltxt;
202
			*txt = (*txt);
206
203
207
			/* free the buffer */
204
			/* free the buffer */
208
			XFree(buffer);
205
			XFree(buffer);
Lines 289-309 Link Here
289
			if (*len == 0)
286
			if (*len == 0)
290
			{
287
			{
291
				*len = pty_items;
288
				*len = pty_items;
292
				ltxt = (unsigned char *)xcmalloc(*len);
289
				(*txt) = (unsigned char *)xcmalloc(*len);
293
			} else
290
			} else
294
			{
291
			{
295
				*len += pty_items;
292
				*len += pty_items;
296
				ltxt = (unsigned char *)xcrealloc(ltxt, *len);
293
				(*txt) = (unsigned char *)xcrealloc((*txt), *len);
297
			}
294
			}
298
295
299
			/* add data to ltxt */
296
			/* add data to (*txt) */
300
			memcpy(
297
			memcpy(
301
				&ltxt[*len - pty_items],
298
				&(*txt)[*len - pty_items],
302
				buffer,
299
				buffer,
303
				pty_items
300
				pty_items
304
			);
301
			);
305
302
306
			*txt = ltxt;
303
			*txt = (*txt);
307
			
304
			
308
			/* delete property to get the next item */
305
			/* delete property to get the next item */
309
			XDeleteProperty(dpy, win, pty);
306
			XDeleteProperty(dpy, win, pty);

Return to bug 60581