52 * @param dest the destination stream |
52 * @param dest the destination stream |
53 * @param rfnc the read function |
53 * @param rfnc the read function |
54 * @param wfnc the write function |
54 * @param wfnc the write function |
55 * @param buf a pointer to the copy buffer or @c NULL if a buffer |
55 * @param buf a pointer to the copy buffer or @c NULL if a buffer |
56 * shall be implicitly created on the heap |
56 * shall be implicitly created on the heap |
57 * @param bufsize the size of the copy buffer - if @p buf is @c NULL you can |
57 * @param bufsize the size of the copy buffer - if @p buf is @c NULL, you can |
58 * set this to zero to let the implementation decide |
58 * set this to zero to let the implementation decide |
59 * @param n the maximum number of bytes that shall be copied. |
59 * @param n the maximum number of bytes that shall be copied. |
60 * If this is larger than @p bufsize, the content is copied over multiple |
60 * If this is larger than @p bufsize, the content is copied over multiple |
61 * iterations. |
61 * iterations. |
62 * @return the total number of bytes copied |
62 * @return the total number of bytes copied |
84 * @param rfnc (@c cx_read_func) the read function |
84 * @param rfnc (@c cx_read_func) the read function |
85 * @param wfnc (@c cx_write_func) the write function |
85 * @param wfnc (@c cx_write_func) the write function |
86 * @param buf (@c char*) a pointer to the copy buffer or @c NULL if a buffer |
86 * @param buf (@c char*) a pointer to the copy buffer or @c NULL if a buffer |
87 * shall be implicitly created on the heap |
87 * shall be implicitly created on the heap |
88 * @param bufsize (@c size_t) the size of the copy buffer - if @p buf is |
88 * @param bufsize (@c size_t) the size of the copy buffer - if @p buf is |
89 * @c NULL you can set this to zero to let the implementation decide |
89 * @c NULL, you can set this to zero to let the implementation decide |
90 * @return total number of bytes copied |
90 * @return total number of bytes copied |
91 */ |
91 */ |
92 #define cx_stream_bcopy(src, dest, rfnc, wfnc, buf, bufsize) \ |
92 #define cx_stream_bcopy(src, dest, rfnc, wfnc, buf, bufsize) \ |
93 cx_stream_bncopy(src, dest, rfnc, wfnc, buf, bufsize, SIZE_MAX) |
93 cx_stream_bncopy(src, dest, rfnc, wfnc, buf, bufsize, SIZE_MAX) |
94 |
94 |
95 /** |
95 /** |
96 * Reads data from a stream and writes it to another stream. |
96 * Reads data from a stream and writes it to another stream. |
97 * |
97 * |
98 * The data is temporarily stored in a stack allocated buffer. |
98 * The data is temporarily stored in a stack-allocated buffer. |
99 * |
99 * |
100 * @param src the source stream |
100 * @param src the source stream |
101 * @param dest the destination stream |
101 * @param dest the destination stream |
102 * @param rfnc the read function |
102 * @param rfnc the read function |
103 * @param wfnc the write function |
103 * @param wfnc the write function |
117 ); |
117 ); |
118 |
118 |
119 /** |
119 /** |
120 * Reads data from a stream and writes it to another stream. |
120 * Reads data from a stream and writes it to another stream. |
121 * |
121 * |
122 * The data is temporarily stored in a stack allocated buffer. |
122 * The data is temporarily stored in a stack-allocated buffer. |
123 * |
123 * |
124 * @param src (@c void*) the source stream |
124 * @param src (@c void*) the source stream |
125 * @param dest (@c void*) the destination stream |
125 * @param dest (@c void*) the destination stream |
126 * @param rfnc (@c cx_read_func) the read function |
126 * @param rfnc (@c cx_read_func) the read function |
127 * @param wfnc (@c cx_write_func) the write function |
127 * @param wfnc (@c cx_write_func) the write function |