From 24c3a3a248f370e40809b0edc5010d0a83148e85 Mon Sep 17 00:00:00 2001 From: Juha Date: Sun, 4 Dec 2022 08:53:37 +0200 Subject: [PATCH] IDE: Recognize warning msgs case-insensitively. Eliminate a PChar->String conversion. --- ide/etfpcmsgparser.pas | 4 +--- ide/etmakemsgparser.pas | 12 ++++-------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/ide/etfpcmsgparser.pas b/ide/etfpcmsgparser.pas index 5a9f910f52..a7a89680a6 100644 --- a/ide/etfpcmsgparser.pas +++ b/ide/etfpcmsgparser.pas @@ -1565,14 +1565,12 @@ end; function TIDEFPCParser.CheckForUnspecificStdErr(p: PChar): boolean; var MsgLine: TMessageLine; - s: string; begin if not fMsgIsStdErr then exit(false); Result:=true; MsgLine:=CreateMsgLine; MsgLine.SubTool:=SubToolFPC; - s:=p; - if Pos('warning',s)>0 then + if FindSubStrI('warning',p)<>nil then MsgLine.Urgency:=mluWarning else MsgLine.Urgency:=mluError; diff --git a/ide/etmakemsgparser.pas b/ide/etmakemsgparser.pas index ffcc09b5f2..1efe99796f 100644 --- a/ide/etmakemsgparser.pas +++ b/ide/etmakemsgparser.pas @@ -114,10 +114,8 @@ begin if (SubStr='') or (p=nil) then exit; s:=PChar(SubStr); while p^<>#0 do begin - if (UpChars[p^]=UpChars[s^]) and CompStrI(SubStr,p) then begin - Result:=p; - exit; - end; + if (UpChars[p^]=UpChars[s^]) and CompStrI(SubStr,p) then + exit(p); inc(p); end; end; @@ -151,10 +149,8 @@ begin Negated:=false; while p^ in ['0'..'9'] do begin i:=i*10+ord(p^)-ord('0'); - if (i>High(Result)) then begin - Result:=Default; - exit; - end; + if (i>High(Result)) then + exit(Default); inc(p); end; Result:=i;