Merge pull request #37 from nineties/fix_bug_of_write_file

fixed a bug of write-file
This commit is contained in:
Koichi NAKAMURA 2021-12-19 23:25:31 +09:00 committed by GitHub
commit 67c4b25adc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1793,13 +1793,13 @@ end-struct file%
dup writable? unless WRITE-FILE-ERROR exit then dup writable? unless WRITE-FILE-ERROR exit then
over 0<= if 3drop WRITE-FILE-ERROR exit then over 0<= if 3drop WRITE-FILE-ERROR exit then
dup write-buffer-content BUFSIZE swap - ( buf space ) dup write-buffer-content nip BUFSIZE swap - ( space )
3 pick 2 pick
( c-addr u file buf space u ) ( c-addr u file space u )
>= if >= if
\ enogu space, copy u-bytes from c-addr to buf \ enogu space, copy u-bytes from c-addr to buf
( c-addr u file buf ) ( c-addr u file )
3 pick swap 3 pick memcpy 2 pick over file>wbeg @ 3 pick memcpy
\ increment wbeg \ increment wbeg
swap succ-write-buffer drop success exit swap succ-write-buffer drop success exit
then then
@ -2477,7 +2477,7 @@ BLOCK-SIZE remaining-size !
: (write) ( c-addr u1 fd -- n ) : (write) ( c-addr u1 fd -- n )
>r swap r> \ ( u1 u1 c-addr fd ) >r swap r> \ ( u1 u1 c-addr fd )
SYS-WRITE syscall3 \ ( u1 u2 ) SYS-WRITE syscall3 \ ( u2 )
; ;
[then] \ End of environment dependent code [then] \ End of environment dependent code