gdi: fix broken return type checks
authorBernhard Miklautz <bernhard.miklautz@thincast.com>
Mon, 20 Apr 2015 09:43:44 +0000 (11:43 +0200)
committerBernhard Miklautz <bernhard.miklautz@thincast.com>
Tue, 21 Apr 2015 12:18:07 +0000 (14:18 +0200)
Integrates comments from pull request.

client/X11/xf_gdi.c
libfreerdp/gdi/gdi.c

index dfc66f8..f3952cf 100644 (file)
@@ -422,6 +422,11 @@ BOOL xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
 
                image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
                                (char*) pSrcData, nWidth, nHeight, xfc->scanline_pad, 0);
+               if (!image)
+               {
+                       xf_unlock_x11(xfc, FALSE);
+                       return FALSE;
+               }
 
                nWidth = bitmap->destRight - bitmap->destLeft + 1; /* clip width */
                nHeight = bitmap->destBottom - bitmap->destTop + 1; /* clip height */
@@ -434,6 +439,9 @@ BOOL xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
                ret = gdi_InvalidateRegion(xfc->hdc, nXDst, nYDst, nWidth, nHeight);
 
                xf_unlock_x11(xfc, FALSE);
+
+               if (!ret)
+                       break;
        }
        return ret;
 }
@@ -665,7 +673,10 @@ BOOL xf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* mult
                                rectangle->width, rectangle->height);
 
                if (xfc->drawing == xfc->primary)
-                       ret = gdi_InvalidateRegion(xfc->hdc, rectangle->left, rectangle->top, rectangle->width, rectangle->height);
+               {
+                       if (!(ret = gdi_InvalidateRegion(xfc->hdc, rectangle->left, rectangle->top, rectangle->width, rectangle->height)))
+                               break;
+               }
        }
 
        xf_unlock_x11(xfc, FALSE);
@@ -716,7 +727,6 @@ BOOL xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
 static BOOL xf_gdi_invalidate_poly_region(xfContext* xfc, XPoint* points, int npoints, BOOL autoclose)
 {
        int i, x, y, x1, y1, x2, y2, w, h;
-       BOOL ret = TRUE;
 
        x1 = points[0].x;
        y1 = points[0].y;
@@ -749,9 +759,10 @@ static BOOL xf_gdi_invalidate_poly_region(xfContext* xfc, XPoint* points, int np
                x1 = x2;
                y1 = y2;
 
-               ret = gdi_InvalidateRegion(xfc->hdc, x, y, w, h);
+               if (!gdi_InvalidateRegion(xfc->hdc, x, y, w, h))
+                       return FALSE;
        }
-       return ret;
+       return TRUE;
 }
 
 BOOL xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
index e153aba..972e0f2 100644 (file)
@@ -529,7 +529,8 @@ static BOOL gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
                status = freerdp_image_copy(pDstData, gdi->format, nDstStep, nXDst, nYDst,
                                nWidth, nHeight, pSrcData, gdi->format, nSrcStep, nXSrc, nYSrc, gdi->palette);
 
-               return gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst, nWidth, nHeight);
+               if (!gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst, nWidth, nHeight))
+                       return FALSE;
        }
        return TRUE;
 }