Differences From Artifact [651ec2f405]:
- File
src/OFTarArchive.m
— part of check-in
[d1d36ae522]
at
2021-11-06 15:57:29
on branch trunk
— OFStream: New write API
The old write API made it too easy to lose bytes when a stream is set to
non-blocking mode. The new API always throws when not all bytes were
written, which forces handling the number of bytes being written being
smaller than the number of bytes requested to be written. (user: js, size: 10235) [annotate] [blame] [check-ins using]
To Artifact [80091b13c1]:
- File src/OFTarArchive.m — part of check-in [0eb7274946] at 2021-11-06 17:00:13 on branch trunk — Fix too strict OFEnsure introduced in last checkin (user: js, size: 10274) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
if ((uint64_t)length > _toWrite)
@throw [OFOutOfRangeException exception];
@try {
[_stream writeBuffer: buffer length: length];
} @catch (OFWriteFailedException *e) {
_toWrite -= e.bytesWritten;
if (e.errNo == EWOULDBLOCK)
return e.bytesWritten;
@throw e;
}
| > > | 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 |
if ((uint64_t)length > _toWrite)
@throw [OFOutOfRangeException exception];
@try {
[_stream writeBuffer: buffer length: length];
} @catch (OFWriteFailedException *e) {
OFEnsure(e.bytesWritten <= length);
_toWrite -= e.bytesWritten;
if (e.errNo == EWOULDBLOCK)
return e.bytesWritten;
@throw e;
}
|
| ︙ | ︙ |