From: Elton Chung Subject: [PATCH] gdiplus: fixing identical sub-expressions Message-Id: Date: Sat, 6 Jul 2013 18:32:15 +0800 From dd1b2a40e37a4569ec6baf8785e0f04ebaf05d83 Mon Sep 17 00:00:00 2001 From: Elton Chung Date: Sat, 6 Jul 2013 18:25:18 +0800 Subject: [PATCH] gdiplus: fixing identical sub-expressions There are identical sub-expressions '!(types[i + 1] & PathPointTypeBezier)' to the left and to the right of the '||' operator. Credits to PVS-Studio: http://www.viva64.com/en/b/0192/#ID0EYFAG Solution given by Vincent Povirk. --- dlls/gdiplus/graphics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index dcdc29e..89bb4f5 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -1748,7 +1748,7 @@ static GpStatus draw_poly(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF * for(i = 1; i < count; i++){ if((types[i] & PathPointTypePathTypeMask) == PathPointTypeBezier){ if((i + 2 >= count) || !(types[i + 1] & PathPointTypeBezier) - || !(types[i + 1] & PathPointTypeBezier)){ + || !(types[i + 2] & PathPointTypeBezier)){ ERR("Bad bezier points\n"); goto end; } -- 1.8.1.msysgit.1
From dd1b2a40e37a4569ec6baf8785e0f04ebaf05d83 Mon Sep 17 00:00:00 2001
From: Elton Chung <elton+wine@elton.tk>
Date: Sat, 6 Jul 2013 18:25:18 +0800
Subject: [PATCH] gdiplus: fixing identical sub-expressions

There are identical sub-expressions '!(types[i + 1] &
 PathPointTypeBezier)' to the left and to the right of the '||' operator.

Credits to PVS-Studio:
http://www.viva64.com/en/b/0192/#ID0EYFAG

Solution given by Vincent Povirk.
---
 dlls/gdiplus/graphics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index dcdc29e..89bb4f5 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -1748,7 +1748,7 @@ static GpStatus draw_poly(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *
     for(i = 1; i < count; i++){
         if((types[i] & PathPointTypePathTypeMask) == PathPointTypeBezier){
             if((i + 2 >= count) || !(types[i + 1] & PathPointTypeBezier)
-                || !(types[i + 1] & PathPointTypeBezier)){
+                || !(types[i + 2] & PathPointTypeBezier)){
                 ERR("Bad bezier points\n");
                 goto end;
             }
-- 
1.8.1.msysgit.1