Overview
Comment: | Let -[OFStream flushWriteBuffer] return a bool |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
7faf776e26ba1f9f787587ae6a3dcc75 |
User & Date: | js on 2021-11-07 19:44:20 |
Other Links: | manifest | tags |
Context
2021-11-07
| ||
20:02 | Make SOCKS5 work with TLS sockets check-in: eb2bfc674b user: js tags: trunk | |
19:44 | Let -[OFStream flushWriteBuffer] return a bool check-in: 7faf776e26 user: js tags: trunk | |
19:39 | OFTLSSocket: Reduce methods to override check-in: 79ac3fe177 user: js tags: trunk | |
Changes
Modified src/OFStream.h from [0bf8c49ae4] to [cc6c0f009b].
︙ | ︙ | |||
963 964 965 966 967 968 969 970 | * stream has been reached. */ - (nullable OFString *)tryReadTillDelimiter: (OFString *)delimiter encoding: (OFStringEncoding)encoding; /** * @brief Writes everything in the write buffer to the stream. */ | > > > > | | 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 | * stream has been reached. */ - (nullable OFString *)tryReadTillDelimiter: (OFString *)delimiter encoding: (OFStringEncoding)encoding; /** * @brief Writes everything in the write buffer to the stream. * * @return Whether the write buffer was flushed entirely. On non-blocking * sockets, this can return `false` if flushing the write buffer in its * entirety would block. */ - (bool)flushWriteBuffer; /** * @brief Writes from a buffer into the stream. * * In non-blocking mode, if less than the specified length could be written, an * @ref OFWriteFailedException is thrown with @ref OFWriteFailedException#errNo * being set to `EWOULDBLOCK` and @ref OFWriteFailedException#bytesWritten |
︙ | ︙ |
Modified src/OFStream.m from [34c16029c3] to [ade6bc77e4].
︙ | ︙ | |||
1052 1053 1054 1055 1056 1057 1058 | - (OFString *)tryReadTillDelimiter: (OFString *)delimiter { return [self tryReadTillDelimiter: delimiter encoding: OFStringEncodingUTF8]; } | | | | > > > > | 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 | - (OFString *)tryReadTillDelimiter: (OFString *)delimiter { return [self tryReadTillDelimiter: delimiter encoding: OFStringEncodingUTF8]; } - (bool)flushWriteBuffer { size_t bytesWritten; if (_writeBuffer == NULL) return true; bytesWritten = [self lowlevelWriteBuffer: _writeBuffer length: _writeBufferLength]; if (bytesWritten == 0) return false; if (bytesWritten == _writeBufferLength) { OFFreeMemory(_writeBuffer); _writeBuffer = NULL; _writeBufferLength = 0; return true; } OFEnsure(bytesWritten <= _writeBufferLength); memmove(_writeBuffer, _writeBuffer + bytesWritten, _writeBufferLength - bytesWritten); _writeBufferLength -= bytesWritten; @try { _writeBuffer = OFResizeMemory(_writeBuffer, _writeBufferLength, 1); } @catch (OFOutOfMemoryException *e) { /* We don't care, as we only made it smaller. */ } return false; } - (void)writeBuffer: (const void *)buffer length: (size_t)length { if (!_buffersWrites) { size_t bytesWritten = [self lowlevelWriteBuffer: buffer length: length]; |
︙ | ︙ |