View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update | 
|---|---|---|---|---|---|
| 0005980 | JEDI VCL | 02 Installation | public | 2012-09-03 13:30 | 2015-09-21 17:47 | 
| Reporter | Arioch | Assigned To | AHUser | ||
| Priority | normal | Severity | trivial | Reproducibility | always | 
| Status | resolved | Resolution | fixed | ||
| Product Version | |||||
| Target Version | Fixed in Version | 3.49 | |||
| Summary | 0005980: redundant loop body | ||||
| Description | D:\DelphiProjects\Libs\JediVCL\jvcl\install\JVCLInstall\Utils.pas procedure AddPaths(List: TStrings; Add: Boolean; const Dir: string; const Paths: array of string); 1st loop is re-calculating Path local var when it did not changed. Additionally, either to use hardcoded '\' or x-platform PathDelim; | ||||
| Steps To Reproduce | Current code: for j := 0 to High(Paths) do for i := List.Count - 1 downto 0 do if Paths[j] <> '' then begin Path := Paths[j]; if (Pos(':', Path) = 0) and (Path[1] <> '$') then Path := PathDelim + ExtractFileName(Dir) + PathDelim + Paths[j]; if EndsWith(List[i], Path, True) then List.Delete(i) else if EndsWith(List[i], Path + '\', True) then List.Delete(i); end; | ||||
| Additional Information | Better code : for j := 0 to High(Paths) do begin Path := Paths[j]; if Path <> '' then begin if (Pos(':', Path) = 0) and (Path[1] <> '$') then Path := PathDelim + ExtractFileName(Dir) + PathDelim + Paths[j]; for i := List.Count - 1 downto 0 do begin if EndsWith(List[i], Path, True) then List.Delete(i) else if EndsWith(List[i], Path + PathDelim, True) then List.Delete(i); end; end; end; | ||||
| Tags | No tags attached. | ||||
|  | Please check with latest SVN content, Andreas may have changed it already. | 
|  | no, this both issues remain and file header still claims // $Id: Utils.pas 13148 2011-11-05 17:27:59Z ahuser $ | 
|  | Corrected in svn revision 13524. | 
| Date Modified | Username | Field | Change | 
|---|---|---|---|
| 2012-09-03 13:30 | Arioch | New Issue | |
| 2013-01-15 15:29 | obones | Note Added: 0020357 | |
| 2013-01-15 15:29 | obones | Status | new => acknowledged | 
| 2013-01-16 11:07 | Arioch | Note Added: 0020398 | |
| 2013-05-25 16:02 | AHUser | Note Added: 0020511 | |
| 2013-05-25 16:02 | AHUser | Status | acknowledged => resolved | 
| 2013-05-25 16:02 | AHUser | Fixed in Version | => Daily / SVN | 
| 2013-05-25 16:02 | AHUser | Resolution | open => fixed | 
| 2013-05-25 16:02 | AHUser | Assigned To | => AHUser | 
| 2015-09-21 17:47 | obones | Fixed in Version | Daily / GIT => 3.49 | 
