src/cx/buffer.h

changeset 1129
cc60b7d07912
parent 1112
22dc2163fffd
equal deleted inserted replaced
1128:3672b89e606c 1129:cc60b7d07912
482 * 482 *
483 * If flushing is enabled and the buffer needs to flush, the data is flushed to 483 * If flushing is enabled and the buffer needs to flush, the data is flushed to
484 * the target until the target signals that it cannot take more data by 484 * the target until the target signals that it cannot take more data by
485 * returning zero via the respective write function. In that case, the remaining 485 * returning zero via the respective write function. In that case, the remaining
486 * data in this buffer is shifted to the beginning of this buffer so that the 486 * data in this buffer is shifted to the beginning of this buffer so that the
487 * newly available space can be used to append as much data as possible. This 487 * newly available space can be used to append as much data as possible.
488 * function only stops writing more elements, when the flush target and this 488 *
489 * This function only stops writing more elements, when the flush target and this
489 * buffer are both incapable of taking more data or all data has been written. 490 * buffer are both incapable of taking more data or all data has been written.
490 * If number of items that shall be written is larger than the buffer can hold, 491 *
491 * the first items from @c ptr are directly relayed to the flush target, if 492 * If, after flushing, the number of items that shall be written still exceeds
492 * possible. 493 * the capacity or flush threshold, this function tries to write all items directly
493 * The number returned by this function is only the number of elements from 494 * to the flush target, if possible.
494 * @c ptr that could be written to either the flush target or the buffer. 495 *
496 * The number returned by this function is the number of elements from
497 * @c ptr that could be written to either the flush target or the buffer
498 * (so it does not include the number of items that had been already in the buffer
499 * in were flushed during the process).
500 *
501 * @attention
502 * When @p size is larger than one and the contents of the buffer are not aligned
503 * with @p size, flushing stops after all complete items have been flushed, leaving
504 * the mis-aligned part in the buffer.
505 * Afterward, this function refuses to write any data to the buffer, until the
506 * mis-alignment has been resolved (e.g. by manually flushing with cxBufferFlush()).
495 * 507 *
496 * @note The signature is compatible with the fwrite() family of functions. 508 * @note The signature is compatible with the fwrite() family of functions.
497 * 509 *
498 * @param ptr a pointer to the memory area containing the bytes to be written 510 * @param ptr a pointer to the memory area containing the bytes to be written
499 * @param size the length of one element 511 * @param size the length of one element

mercurial