Differences From Artifact [952e87c05c]:
- File src/OFZIPArchive.m — part of check-in [fc4697adbf] at 2021-04-28 20:56:58 on branch trunk — OF{LHA,ZIP}Archive: Make mode enum private (user: js, size: 23495) [annotate] [blame] [check-ins using] [more...]
To Artifact [a5dd4c3dce]:
- File
src/OFZIPArchive.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: 23736) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #import "OFNotImplementedException.h" #import "OFNotOpenException.h" #import "OFOpenItemFailedException.h" #import "OFOutOfRangeException.h" #import "OFSeekFailedException.h" #import "OFTruncatedDataException.h" #import "OFUnsupportedVersionException.h" /* * FIXME: Current limitations: * - Split archives are not supported. * - Encrypted files cannot be read. */ | > | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #import "OFNotImplementedException.h" #import "OFNotOpenException.h" #import "OFOpenItemFailedException.h" #import "OFOutOfRangeException.h" #import "OFSeekFailedException.h" #import "OFTruncatedDataException.h" #import "OFUnsupportedVersionException.h" #import "OFWriteFailedException.h" /* * FIXME: Current limitations: * - Split archives are not supported. * - Encrypted files cannot be read. */ |
︙ | ︙ | |||
872 873 874 875 876 877 878 | [_entry release]; [super dealloc]; } - (size_t)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { | < < > | > > | | > | > > > > > > > > | 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 | [_entry release]; [super dealloc]; } - (size_t)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length { #if SIZE_MAX >= INT64_MAX if (length > INT64_MAX) @throw [OFOutOfRangeException exception]; #endif if (INT64_MAX - _bytesWritten < (int64_t)length) @throw [OFOutOfRangeException exception]; @try { [_stream writeBuffer: buffer length: length]; } @catch (OFWriteFailedException *e) { OFEnsure(e.bytesWritten < length); _bytesWritten += (int64_t)e.bytesWritten; _CRC32 = OFCRC32(_CRC32, buffer, e.bytesWritten); if (e.errNo == EWOULDBLOCK) return e.bytesWritten; @throw e; } _bytesWritten += (int64_t)length; _CRC32 = OFCRC32(_CRC32, buffer, length); return length; } - (void)close { if (_stream == nil) @throw [OFNotOpenException exceptionWithObject: self]; |
︙ | ︙ |