mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 14:39:13 +02:00
IDE: fixed comparing version numbers RC1 and RC2
git-svn-id: trunk@38310 -
This commit is contained in:
parent
a0ceb2b7ed
commit
121579ce8f
@ -236,18 +236,38 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function CompareLazarusVersion(V1, V2: string): integer;
|
function CompareLazarusVersion(V1, V2: string): integer;
|
||||||
|
// compare decimal numbers in strings
|
||||||
|
// For example
|
||||||
|
// '0.9.30' < '1.0'
|
||||||
|
// '1.0 RC1' < '1.0 RC2'
|
||||||
|
// '1.0 RC2' < '1.0'
|
||||||
|
// '1.0' < '1.1'
|
||||||
|
// '1.0' < '1.0-0'
|
||||||
|
// '1.0 RC2' < '1.0.1'
|
||||||
|
// '1.0-2' < '1.0.0'
|
||||||
|
|
||||||
|
// Rules: 'RC' < EndOfString < '-' < '.'
|
||||||
|
|
||||||
function ReadNumber(var p: PChar): integer;
|
function ReadNumber(var p: PChar): integer;
|
||||||
begin
|
begin
|
||||||
Result:=0;
|
if p^=#0 then exit(-1);
|
||||||
while not (p^ in [#0,'0'..'9']) do inc(p);
|
|
||||||
while (p^ in ['0'..'9']) do begin
|
if p^ in ['0'..'9'] then begin
|
||||||
if Result<100000 then
|
Result:=0;
|
||||||
Result:=Result*10+ord(p^)-ord('0');
|
while (p^ in ['0'..'9']) do begin
|
||||||
inc(p);
|
if Result<100000 then
|
||||||
|
Result:=Result*10+ord(p^)-ord('0');
|
||||||
|
inc(p);
|
||||||
|
end;
|
||||||
|
end else begin
|
||||||
|
while (p^ in [' ',#9]) do inc(p);
|
||||||
|
case p^ of
|
||||||
|
'-': Result:=1;
|
||||||
|
'.': Result:=2;
|
||||||
|
else Result:=-2; // for example 'RC'
|
||||||
|
end;
|
||||||
|
while not (p^ in [#0,'0'..'9']) do inc(p);
|
||||||
end;
|
end;
|
||||||
while not (p^ in ['.',#0]) do inc(p);
|
|
||||||
if p^='.' then inc(p);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
Loading…
Reference in New Issue
Block a user