35 |
35 |
36 The `cx_stream_ncopy()` function behaves like `cx_stream_copy()` except, that it reads at most `n` bytes |
36 The `cx_stream_ncopy()` function behaves like `cx_stream_copy()` except, that it reads at most `n` bytes |
37 (and the same is true for `cx_stream_bncopy()` and `cx_stream_bcopy()`). |
37 (and the same is true for `cx_stream_bncopy()` and `cx_stream_bcopy()`). |
38 |
38 |
39 |
39 |
40 <warning> |
40 > When you are reading from a stream where you cannot track the position, there is the possibility that |
41 When you are reading from a stream where you cannot track the position, there is the possibility that |
41 > data gets lost when the destination does not accept all the bytes read from the source. |
42 data gets lost when the destination does not accept all the bytes read from the source. |
42 > While the stream copy functions do report how many bytes were _successfully_ copied |
43 While the stream copy functions do report how many bytes were <emphasis>successfully</emphasis> copied |
43 > to the destination, this might - in certain cases - not be the exact number of read items. |
44 to the destination, this might - in certain cases - not be the exact number of read items. |
44 > |
45 |
45 > To mitigate the risk, you should make sure that the destination can always accept all read bytes and |
46 To mitigate the risk, you should make sure that the destination can always accept all read bytes and |
46 > a possible bottleneck is only introduced by the source. |
47 a possible bottleneck is only introduced by the source. |
47 >{style="note"} |
48 </warning> |
|
49 |
48 |
50 > The size of the internal _stack_ buffer in `cx_stream_copy()` and `cx_stream_ncopy()` can be |
49 > The size of the internal _stack_ buffer in `cx_stream_copy()` and `cx_stream_ncopy()` can be |
51 > set during compilation via the `CX_STREAM_COPY_BUF_SIZE` macro. |
50 > set during compilation via the `CX_STREAM_COPY_BUF_SIZE` macro. |
52 > Similarly, the size for the implicitly allocated _heap_ buffer in can be |
51 > Similarly, the size for the implicitly allocated _heap_ buffer in can be |
53 > configured via the `CX_STREAM_BCOPY_BUF_SIZE` macro. |
52 > configured via the `CX_STREAM_BCOPY_BUF_SIZE` macro. |