2
0
Эх сурвалжийг харах

* types.pp, applied a fix similar to r16224,16226 also to UnionRect function. It is very similar to IntersectRect and parameter aliasing issue applies to it as well (see Mantis #17722).

git-svn-id: trunk@16235 -
sergei 14 жил өмнө
parent
commit
12f6eb2c4e
1 өөрчлөгдсөн 17 нэмэгдсэн , 14 устгасан
  1. 17 14
      rtl/objpas/types.pp

+ 17 - 14
rtl/objpas/types.pp

@@ -373,26 +373,29 @@ begin
 end;
 end;
 
 
 function UnionRect(var Rect : TRect;const R1,R2 : TRect) : Boolean;
 function UnionRect(var Rect : TRect;const R1,R2 : TRect) : Boolean;
+var
+  lRect: TRect;
 begin
 begin
-  Rect:=R1;
-  with R2 do
-    begin
-    if Left<R1.Left then
-      Rect.Left:=Left;
-    if Top<R1.Top then
-      Rect.Top:=Top;
-    if Right>R1.Right then
-      Rect.Right:=Right;
-    if Bottom>R1.Bottom then
-      Rect.Bottom:=Bottom;
-    end;
+  lRect:=R1;
+  if R2.Left<R1.Left then
+    lRect.Left:=R2.Left;
+  if R2.Top<R1.Top then
+    lRect.Top:=R2.Top;
+  if R2.Right>R1.Right then
+    lRect.Right:=R2.Right;
+  if R2.Bottom>R1.Bottom then
+    lRect.Bottom:=R2.Bottom;
+
   if IsRectEmpty(Rect) then
   if IsRectEmpty(Rect) then
-    begin
+  begin
     FillChar(Rect,SizeOf(Rect),0);
     FillChar(Rect,SizeOf(Rect),0);
     UnionRect:=false;
     UnionRect:=false;
-    end
+  end
   else
   else
+  begin
+    Rect:=lRect;
     UnionRect:=true;
     UnionRect:=true;
+  end;  
 end;
 end;
 
 
 function IsRectEmpty(const Rect : TRect) : Boolean;
 function IsRectEmpty(const Rect : TRect) : Boolean;