View Issue Details

IDProjectCategoryView StatusLast Update
0016175LazarusLCLpublic2010-05-06 18:31
ReporterFlávio Etrusco (notifications not working)Assigned ToMarc Weustink 
PrioritynormalSeveritytrivialReproducibilityN/A
Status closedResolutionfixed 
Product Version0.9.29 (SVN)Product Build 
Target VersionFixed in Version0.9.29 (SVN) 
Summary0016175: [Patch] LCLProc.GetPart has unnecessary overloads
DescriptionLCLProc.GetPart has unnecessary overloads and yet doesn't have a version that takes strings and avoid changing ASource...
Additional Information
=== (+10,-24) lcl/lclproc.pas ===
@@ -264,11 +264,10 @@
 
 // some string manipulation functions
 function StripLN(const ALine: String): String;
-function GetPart(const ASkipTo, AnEnd: String; var ASource: String): String; overload;
-function GetPart(const ASkipTo, AnEnd: String; var ASource: String; const AnIgnoreCase: Boolean): String; overload;
-function GetPart(const ASkipTo, AnEnd: array of String; var ASource: String): String; overload;
-function GetPart(const ASkipTo, AnEnd: array of String; var ASource: String; const AnIgnoreCase: Boolean): String; overload;
-function GetPart(const ASkipTo, AnEnd: array of String; var ASource: String; const AnIgnoreCase, AnUpdateSource: Boolean): String; overload;
+function GetPart(const ASkipTo, AnEnd: String; var ASource: String;
+  const AnIgnoreCase: Boolean = False; const AnUpdateSource: Boolean = True): String;
+function GetPart(const ASkipTo, AnEnd: array of String; var ASource: String;
+  const AnIgnoreCase: Boolean = False; const AnUpdateSource: Boolean = True): String;
 function TextToSingleLine(const AText: string): string;
 
 // case..of utility functions
@@ -2862,27 +2861,14 @@
   Result := Copy(ALine, 1, idx - 1);
 end;
 
-function GetPart(const ASkipTo, AnEnd: String; var ASource: String): String;
+function GetPart(const ASkipTo, AnEnd: String; var ASource: String;
+  const AnIgnoreCase, AnUpdateSource: Boolean): String;
 begin
-  Result := GetPart([ASkipTo], [AnEnd], ASource, False, True);
+  Result := GetPart([ASkipTo], [AnEnd], ASource, AnIgnoreCase, AnUpdateSource);
 end;
 
-function GetPart(const ASkipTo, AnEnd: String; var ASource: String; const AnIgnoreCase: Boolean): String; overload;
-begin
-  Result := GetPart([ASkipTo], [AnEnd], ASource, AnIgnoreCase, True);
-end;
-
-function GetPart(const ASkipTo, AnEnd: array of String; var ASource: String): String; overload;
-begin
-  Result := GetPart(ASkipTo, AnEnd, ASource, False, True);
-end;
-
-function GetPart(const ASkipTo, AnEnd: array of String; var ASource: String; const AnIgnoreCase: Boolean): String; overload;
-begin
-  Result := GetPart(ASkipTo, AnEnd, ASource, AnIgnoreCase, True);
-end;
-
-function GetPart(const ASkipTo, AnEnd: array of String; var ASource: String; const AnIgnoreCase, AnUpdateSource: Boolean): String; overload;
+function GetPart(const ASkipTo, AnEnd: array of String; var ASource: String;
+  const AnIgnoreCase: Boolean = False; const AnUpdateSource: Boolean = True): String;
 var
   n, i, idx: Integer;
   S, Source, Match: String;
TagsNo tags attached.
Fixed in Revision25156
LazTarget0.9.30
WidgetsetGTK, GTK 2, Win32/Win64, WinCE, Carbon, QT, fpGUI
Attached Files

Activities

Paul Ishenin

2010-04-21 10:10

manager   ~0036871

Please create a patch in subversion format.

Marc Weustink

2010-04-21 10:34

administrator   ~0036873

GetPart comes from a time when FPC didn't support default arguments, so overloaded functions were the only option.

For me format of diff is ok, but next time attach it as separate file. This keeps the diff format and doesn't do some html stuff.

Flávio Etrusco (notifications not working)

2010-04-27 00:10

developer   ~0037040

Last edited: 2010-04-27 00:25

> GetPart comes from a time when FPC didn't
> support default arguments, so overloaded
> functions were the only option.

I imagined that, but I guessed you were tired of me guessing the explanations in my bug reports ;-)

> next time attach it as separate file.

I'll, I thought using the 'pre' would keep the format even when copying from the browser, but now I see it doesn't :-/ Editing the bug one can get the original patch, but this diff doesn't see to be accepted by 'patch' anyway. I copied it from tortoisehg because it looked alike svn diff and I knew people would complain about hg format - and I was too lazy to regenerate it against svn :-$

Marc Weustink

2010-05-04 02:04

administrator   ~0037206

Last edited: 2010-05-04 02:05

Thanks

(it is accepted by patch if you tell it to patch lcl/lclproc.pas)

Issue History

Date Modified Username Field Change
2010-03-31 21:49 Flávio Etrusco (notifications not working) New Issue
2010-03-31 21:49 Flávio Etrusco (notifications not working) LazTarget => -
2010-03-31 21:49 Flávio Etrusco (notifications not working) Widgetset => GTK, GTK 2, Win32/Win64, WinCE, Carbon, QT, fpGUI
2010-03-31 21:50 Flávio Etrusco (notifications not working) Description Updated
2010-03-31 21:50 Flávio Etrusco (notifications not working) Additional Information Updated
2010-03-31 22:02 Flávio Etrusco (notifications not working) Additional Information Updated
2010-03-31 22:05 Flávio Etrusco (notifications not working) Additional Information Updated
2010-03-31 22:46 Flávio Etrusco (notifications not working) Additional Information Updated
2010-04-01 06:29 Flávio Etrusco (notifications not working) Additional Information Updated
2010-04-01 06:29 Flávio Etrusco (notifications not working) Additional Information Updated
2010-04-07 07:36 Flávio Etrusco (notifications not working) LazTarget - => 0.9.30
2010-04-07 07:36 Flávio Etrusco (notifications not working) Status new => acknowledged
2010-04-21 10:10 Paul Ishenin Note Added: 0036871
2010-04-21 10:10 Paul Ishenin Status acknowledged => feedback
2010-04-21 10:30 Marc Weustink Status feedback => assigned
2010-04-21 10:30 Marc Weustink Assigned To => Marc Weustink
2010-04-21 10:34 Marc Weustink Note Added: 0036873
2010-04-27 00:10 Flávio Etrusco (notifications not working) Note Added: 0037040
2010-04-27 00:13 Flávio Etrusco (notifications not working) Note Edited: 0037040
2010-04-27 00:21 Flávio Etrusco (notifications not working) Note Edited: 0037040
2010-04-27 00:25 Flávio Etrusco (notifications not working) Note Edited: 0037040
2010-05-04 02:04 Marc Weustink Fixed in Revision => 25156
2010-05-04 02:04 Marc Weustink Status assigned => resolved
2010-05-04 02:04 Marc Weustink Fixed in Version => 0.9.29 (SVN)
2010-05-04 02:04 Marc Weustink Resolution open => fixed
2010-05-04 02:04 Marc Weustink Note Added: 0037206
2010-05-04 02:05 Marc Weustink Note Edited: 0037206
2010-05-06 18:31 Flávio Etrusco (notifications not working) Status resolved => closed