Forum > LCL

[SOLVED] Duplicate code removal in lcl/controls.pp

(1/1)

lagprogramming:
procedure TControlChildSizing.Assign(Source: TPersistent); has useless duplication of the following code:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---FEnlargeHorizontal:=SrcSizing.EnlargeHorizontal;    FEnlargeVertical:=SrcSizing.EnlargeVertical;    FShrinkHorizontal:=SrcSizing.ShrinkHorizontal;    FShrinkVertical:=SrcSizing.ShrinkVertical;   
function TControlChildSizing.IsEqual(Sizing: TControlChildSizing): boolean; has useless duplication of the following code:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---(FEnlargeHorizontal=Sizing.EnlargeHorizontal)      and (FEnlargeVertical=Sizing.EnlargeVertical)      and (FShrinkHorizontal=Sizing.ShrinkHorizontal)      and (FShrinkVertical=Sizing.ShrinkVertical)      
The following patch removes the duplicate code.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---diff --git a/lcl/controls.pp b/lcl/controls.ppindex 397076a37a..172b2e1e7f 100644--- a/lcl/controls.pp+++ b/lcl/controls.pp@@ -4033,10 +4033,6 @@ begin     SrcSizing:=TControlChildSizing(Source);     if IsEqual(SrcSizing) then exit; -    FEnlargeHorizontal:=SrcSizing.EnlargeHorizontal;-    FEnlargeVertical:=SrcSizing.EnlargeVertical;-    FShrinkHorizontal:=SrcSizing.ShrinkHorizontal;-    FShrinkVertical:=SrcSizing.ShrinkVertical;     FEnlargeHorizontal:=SrcSizing.EnlargeHorizontal;     FEnlargeVertical:=SrcSizing.EnlargeVertical;     FShrinkHorizontal:=SrcSizing.ShrinkHorizontal;@@ -4061,10 +4057,6 @@ end; function TControlChildSizing.IsEqual(Sizing: TControlChildSizing): Boolean; begin   Result:=(FEnlargeHorizontal=Sizing.EnlargeHorizontal)-      and (FEnlargeVertical=Sizing.EnlargeVertical)-      and (FShrinkHorizontal=Sizing.ShrinkHorizontal)-      and (FShrinkVertical=Sizing.ShrinkVertical)-      and (FEnlargeHorizontal=Sizing.EnlargeHorizontal)       and (FEnlargeVertical=Sizing.EnlargeVertical)       and (FShrinkHorizontal=Sizing.ShrinkHorizontal)       and (FShrinkVertical=Sizing.ShrinkVertical)

Martin_fr:
Please report on the bugtracker. Thanks

JuhaManninen:
I removed the duplicate lines. Thanks for noticing them.

Navigation

[0] Message Index

Go to full version