From fea7df6a8788eb8f089b73215a8c42a599e11e7e Mon Sep 17 00:00:00 2001 From: blikblum Date: Tue, 3 Apr 2012 09:55:36 +0000 Subject: [PATCH] lazreport: uppercase variable before comparing with hardcoded functions. Properly fix to 21624 git-svn-id: trunk@36539 - --- components/lazreport/source/lr_class.pas | 71 +++++++++++++----------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/components/lazreport/source/lr_class.pas b/components/lazreport/source/lr_class.pas index f99282c134..0266096be8 100644 --- a/components/lazreport/source/lr_class.pas +++ b/components/lazreport/source/lr_class.pas @@ -8107,6 +8107,7 @@ var Value: TfrValue; D: TfrTDataSet; F: TfrTField; + s1: String; function MasterBand: TfrBand; begin @@ -8165,43 +8166,47 @@ begin else if (D<>nil) and (roIgnoreFieldNotFound in FReportOptions) and lrValidFieldReference(s) then aValue := Null - else if s = 'VALUE' then - aValue:= CurValue - else if s = frSpecFuncs[0] then - aValue:= PageNo + 1 - else if s = frSpecFuncs[2] then - aValue := CurDate - else if s = frSpecFuncs[3] then - aValue:= CurTime - else if s = frSpecFuncs[4] then - aValue:= MasterBand.Positions[psLocal] - else if s = frSpecFuncs[5] then - aValue:= MasterBand.Positions[psGlobal] - else if s = frSpecFuncs[6] then - aValue:= CurPage.ColPos - else if s = frSpecFuncs[7] then - aValue:= CurPage.CurPos - else if s = frSpecFuncs[8] then - aValue:= SavedAllPages else begin - if frVariables.IndexOf(s) <> -1 then + s1 := AnsiUpperCase(s); + if s1 = 'VALUE' then + aValue:= CurValue + else if s1 = frSpecFuncs[0] then + aValue:= PageNo + 1 + else if s1 = frSpecFuncs[2] then + aValue := CurDate + else if s1 = frSpecFuncs[3] then + aValue:= CurTime + else if s1 = frSpecFuncs[4] then + aValue:= MasterBand.Positions[psLocal] + else if s1 = frSpecFuncs[5] then + aValue:= MasterBand.Positions[psGlobal] + else if s1 = frSpecFuncs[6] then + aValue:= CurPage.ColPos + else if s1 = frSpecFuncs[7] then + aValue:= CurPage.CurPos + else if s1 = frSpecFuncs[8] then + aValue:= SavedAllPages + else begin - aValue:= frVariables[s]; - Exit; - end else - if CompareText(s,'REPORTTITLE')=0 then - begin - aValue := Title; - Exit; + if frVariables.IndexOf(s) <> -1 then + begin + aValue:= frVariables[s]; + Exit; + end else + if s1 = 'REPORTTITLE' then + begin + aValue := Title; + Exit; + end; + if s <> SubValue then + begin + SubValue := s; + aValue:= frParser.Calc(s); + SubValue := ''; + end + else raise(EParserError.Create('Undefined symbol: ' + SubValue)); end; - if s <> SubValue then - begin - SubValue := s; - aValue:= frParser.Calc(s); - SubValue := ''; - end - else raise(EParserError.Create('Undefined symbol: ' + SubValue)); end; end; end;