aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/PutImage.c
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-10-19 22:15:01 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-10-19 22:15:01 +0200
commit70ac75f4ab184c21d11b9840a47362610aaef481 (patch)
tree183b9ec7e6897fb2cea7296b461a35ca93dfce6e /nx-X11/lib/X11/PutImage.c
parent6c303d9e4ffd162b8c7f59a4b135e592d923a656 (diff)
parent70e9d346fe34af127d2c827c3678e53d0f4312ae (diff)
downloadnx-libs-70ac75f4ab184c21d11b9840a47362610aaef481.tar.gz
nx-libs-70ac75f4ab184c21d11b9840a47362610aaef481.tar.bz2
nx-libs-70ac75f4ab184c21d11b9840a47362610aaef481.zip
Merge branch 'uli42-pr/libX11_further_backports' into 3.6.x
Attributes GH PR #222: https://github.com/ArcticaProject/nx-libs/pull/222
Diffstat (limited to 'nx-X11/lib/X11/PutImage.c')
-rw-r--r--nx-X11/lib/X11/PutImage.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/nx-X11/lib/X11/PutImage.c b/nx-X11/lib/X11/PutImage.c
index 6dad4f13a..de085bcde 100644
--- a/nx-X11/lib/X11/PutImage.c
+++ b/nx-X11/lib/X11/PutImage.c
@@ -600,15 +600,9 @@ static int const HalfOrderWord[12] = {
/* Cancel a GetReq operation, before doing _XSend or Data */
-#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP)
#define UnGetReq(name)\
dpy->bufptr -= SIZEOF(x##name##Req);\
dpy->request--
-#else
-#define UnGetReq(name)\
- dpy->bufptr -= SIZEOF(x/**/name/**/Req);\
- dpy->request--
-#endif
static void
SendXYImage(
@@ -680,7 +674,7 @@ SendXYImage(
length = ROUNDUP(length, 4);
if ((dpy->bufptr + length) > dpy->bufmax) {
- if ((buf = _XAllocScratch(dpy, (unsigned long) (length))) == NULL) {
+ if ((buf = _XAllocScratch(dpy, length)) == NULL) {
UnGetReq(PutImage);
return;
}
@@ -703,13 +697,13 @@ SendXYImage(
bytes_per_temp_plane = bytes_per_line * req->height;
temp_length = ROUNDUP(bytes_per_temp_plane * image->depth, 4);
if (buf == dpy->bufptr) {
- if (! (temp = _XAllocScratch(dpy, (unsigned long) temp_length))) {
+ if (! (temp = _XAllocScratch(dpy, temp_length))) {
UnGetReq(PutImage);
return;
}
}
else
- if ((extra = temp = Xmalloc((unsigned) temp_length)) == NULL) {
+ if ((extra = temp = Xmalloc(temp_length)) == NULL) {
UnGetReq(PutImage);
return;
}
@@ -746,8 +740,7 @@ SendXYImage(
bytes_per_src, bytes_per_line,
bytes_per_dest, req->height, half_order);
- if (extra)
- Xfree(extra);
+ Xfree(extra);
if (buf == dpy->bufptr)
dpy->bufptr += length;
@@ -778,8 +771,7 @@ SendZImage(
(req_yoffset * image->bytes_per_line) +
((req_xoffset * image->bits_per_pixel) >> 3);
if ((image->bits_per_pixel == 4) && ((unsigned int) req_xoffset & 0x01)) {
- if (! (shifted_src = (unsigned char *)
- Xmalloc((unsigned) (req->height * image->bytes_per_line)))) {
+ if (! (shifted_src = Xmalloc(req->height * image->bytes_per_line))) {
UnGetReq(PutImage);
return;
}
@@ -800,8 +792,7 @@ SendZImage(
((req_xoffset == 0) ||
((req_yoffset + req->height) < (unsigned)image->height))) {
Data(dpy, (char *)src, length);
- if (shifted_src)
- Xfree((char *)shifted_src);
+ Xfree(shifted_src);
return;
}
@@ -810,8 +801,8 @@ SendZImage(
dest = (unsigned char *)dpy->bufptr;
else
if ((dest = (unsigned char *)
- _XAllocScratch(dpy, (unsigned long)(length))) == NULL) {
- if (shifted_src) Xfree((char *) shifted_src);
+ _XAllocScratch(dpy, length)) == NULL) {
+ Xfree(shifted_src);
UnGetReq(PutImage);
return;
}
@@ -838,8 +829,7 @@ SendZImage(
else
_XSend(dpy, (char *)dest, length);
- if (shifted_src)
- Xfree((char *)shifted_src);
+ Xfree(shifted_src);
}
static void
@@ -1001,7 +991,7 @@ XPutImage (
img.bits_per_pixel = dest_bits_per_pixel;
img.bytes_per_line = ROUNDUP((dest_bits_per_pixel * width),
dest_scanline_pad) >> 3;
- img.data = Xmalloc((unsigned) (img.bytes_per_line * height));
+ img.data = Xmalloc(img.bytes_per_line * height);
if (img.data == NULL)
return 0;
_XInitImageFuncPtrs(&img);