From 93c56550a45fb7061a16bbd50f0ee5efe5d49b6c Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 3 Jul 2020 11:30:48 +0200 Subject: lowlevelunit.pas: readALine() und readAnAndorString() sind nun function statt procedure - workaround für fpc-3.2.0 regression MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lowlevelunit.pas | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/lowlevelunit.pas b/lowlevelunit.pas index b9036e2..e87e383 100644 --- a/lowlevelunit.pas +++ b/lowlevelunit.pas @@ -171,9 +171,9 @@ function permutation(len,rest,maxBasis: longint; basen: tLongintArray): tLongint procedure llPermutation(len,offset: longint; var ar: tLongintArray); inline; procedure fuegeSortiertHinzu(x: extended; var xa: tExtendedArray); -procedure readALine(var f: file; out s: string); -procedure readAnAndorString(var f: file; out s: string; const len: int64; checkEOL: boolean); overload; -procedure readAnAndorString(var f: file; out s: string; checkEOL: boolean); overload; +function readALine(var f: file): string; +function readAnAndorString(var f: file; const len: int64; checkEOL: boolean): string; overload; +function readAnAndorString(var f: file; checkEOL: boolean): string; overload; procedure splitStrToInt(s: string; out ia: tLongintArray); function intArrayToStr(ia: tLongintArray): string; @@ -1383,43 +1383,43 @@ begin xa[mi]:=x; end; -procedure readALine(var f: file; out s: string); +function readALine(var f: file): string; var fPos,fSize,rLen: int64; begin fPos:=filePos(f); fSize:=fileSize(f); rLen:=0; - s:=''; - while (pos(#10,s)=0) and (rLen+fPos0 then begin - rLen:=pos(#10,s); - setLength(s,rLen-1); + if pos(#10,result)<>0 then begin + rLen:=pos(#10,result); + setLength(result,rLen-1); end; seek(f,fPos+rLen); end; -procedure readAnAndorString(var f: file; out s: string; const len: int64; checkEOL: boolean); +function readAnAndorString(var f: file; const len: int64; checkEOL: boolean): string; begin - setLength(s,len+2*byte(checkEOL)); - if length(s)>0 then - blockRead(f,s[1],length(s)); + setLength(result,len+2*byte(checkEOL)); + if length(result)>0 then + blockRead(f,result[1],length(result)); if checkEOL then begin - if rightStr(s,2)<>' '#10 then - raise exception.create('readAnAndorString: EOL check failed: '''+s+'''!'); - setLength(s,length(s)-2); + if rightStr(result,2)<>' '#10 then + raise exception.create('readAnAndorString: EOL check failed: '''+result+'''!'); + setLength(result,length(result)-2); end; end; -procedure readAnAndorString(var f: file; out s: string; checkEOL: boolean); +function readAnAndorString(var f: file; checkEOL: boolean): string; begin - readALine(f,s); - readAnAndorString(f,s,strToInt64(s),checkEOL); + result:=readALine(f); + result:=readAnAndorString(f,strToInt64(result),checkEOL); end; procedure splitStrToInt(s: string; out ia: tLongintArray); -- cgit v1.2.3-70-g09d2