From cf9bfd2160c0577351a8dfee6d537eeda71df9e2 Mon Sep 17 00:00:00 2001 From: Pavel <68122101+red-prig@users.noreply.github.com> Date: Wed, 16 Nov 2022 11:22:22 +0300 Subject: [PATCH] + --- chip/ps4_videodrv.pas | 2 +- sys/sys_dir.pas | 31 ++++++++++++++++--------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/chip/ps4_videodrv.pas b/chip/ps4_videodrv.pas index b7fa9453..4bb09499 100644 --- a/chip/ps4_videodrv.pas +++ b/chip/ps4_videodrv.pas @@ -2126,7 +2126,7 @@ begin if not GFXRing.CmdBuffer.BeginRenderPass(FRenderCmd) then begin Writeln(StdErr,'!BeginRenderPass'); - Assert(false); + Assert(false,'!BeginRenderPass'); end; end; diff --git a/sys/sys_dir.pas b/sys/sys_dir.pas index 5d7ff7a7..51949bcf 100644 --- a/sys/sys_dir.pas +++ b/sys/sys_dir.pas @@ -334,37 +334,38 @@ end; function TDirFile.getdirentries(buf:Pointer;nbytes:Int64;basep:PInt64):Int64; var - i,count:DWORD; + s,e,count:DWORD; begin count:=nbytes div SizeOf(dirent); + if (count=0) then Exit(-EINVAL); rwlock_wrlock(lock); - i:=pos+count; - if (i>Length(dirs)) then + s:=pos; + e:=s+count; + if (e>Length(dirs)) then begin - i:=Length(dirs); - if (pos>i) then + e:=Length(dirs); + if (s>e) then begin count:=0; end else begin - count:=(i-pos); + count:=(e-s); end; end; - - if (count<>0) then - begin - Move(dirs[pos],buf^,count*SizeOf(dirent)); - end; - - pos:=i; + pos:=e; rwlock_unlock(lock); - Writeln('getdirentries:',count,' ',i); + if (count<>0) then + begin + Move(dirs[s],buf^,count*SizeOf(dirent)); + end; + + Writeln('getdirentries:',count,' ',e); if (basep<>nil) then begin - basep^:=i; + basep^:=e; end; Result:=count*SizeOf(dirent);