ObjFW  Diff

Differences From Artifact [0bf8c49ae4]:

  • File src/OFStream.h — 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: 52835) [annotate] [blame] [check-ins using]

To Artifact [cc6c0f009b]:


963
964
965
966
967
968
969




970
971
972
973
974
975
976
977
978
 *	   stream has been reached.
 */
- (nullable OFString *)tryReadTillDelimiter: (OFString *)delimiter
				   encoding: (OFStringEncoding)encoding;

/**
 * @brief Writes everything in the write buffer to the stream.




 */
- (void)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







>
>
>
>

|







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