src/cx/streams.h

changeset 1675
36c0fb2b60b2
parent 1426
3a89b31f0724
equal deleted inserted replaced
1674:8b0f162ac88e 1675:36c0fb2b60b2
39 #ifndef UCX_STREAMS_H 39 #ifndef UCX_STREAMS_H
40 #define UCX_STREAMS_H 40 #define UCX_STREAMS_H
41 41
42 #include "common.h" 42 #include "common.h"
43 43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48 /** 44 /**
49 * Reads data from a stream and writes it to another stream. 45 * Reads data from a stream and writes it to another stream.
50 * 46 *
51 * @param src the source stream 47 * @param src the source stream
52 * @param dest the destination stream 48 * @param dest the destination stream
59 * @param n the maximum number of bytes that shall be copied. 55 * @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 56 * If this is larger than @p bufsize, the content is copied over multiple
61 * iterations. 57 * iterations.
62 * @return the total number of bytes copied 58 * @return the total number of bytes copied
63 */ 59 */
64 cx_attr_nonnull_arg(1, 2, 3, 4) 60 CX_EXTERN CX_NONNULL_ARG(1, 2, 3, 4)
65 cx_attr_access_r(1) cx_attr_access_w(2) cx_attr_access_w(5) 61 CX_ACCESS_R(1) CX_ACCESS_W(2) CX_ACCESS_W(5)
66 CX_EXPORT size_t cx_stream_bncopy(void *src, void *dest, 62 size_t cx_stream_bncopy(void *src, void *dest,
67 cx_read_func rfnc, cx_write_func wfnc, 63 cx_read_func rfnc, cx_write_func wfnc,
68 char *buf, size_t bufsize, size_t n); 64 char *buf, size_t bufsize, size_t n);
69 65
70 /** 66 /**
71 * Reads data from a stream and writes it to another stream. 67 * Reads data from a stream and writes it to another stream.
93 * @param rfnc the read function 89 * @param rfnc the read function
94 * @param wfnc the write function 90 * @param wfnc the write function
95 * @param n the maximum number of bytes that shall be copied. 91 * @param n the maximum number of bytes that shall be copied.
96 * @return total number of bytes copied 92 * @return total number of bytes copied
97 */ 93 */
98 cx_attr_nonnull cx_attr_access_r(1) cx_attr_access_w(2) 94 CX_EXTERN CX_NONNULL CX_ACCESS_R(1) CX_ACCESS_W(2)
99 CX_EXPORT size_t cx_stream_ncopy(void *src, void *dest, 95 size_t cx_stream_ncopy(void *src, void *dest,
100 cx_read_func rfnc, cx_write_func wfnc, size_t n); 96 cx_read_func rfnc, cx_write_func wfnc, size_t n);
101 97
102 /** 98 /**
103 * Reads data from a stream and writes it to another stream. 99 * Reads data from a stream and writes it to another stream.
104 * 100 *
111 * @return total number of bytes copied 107 * @return total number of bytes copied
112 */ 108 */
113 #define cx_stream_copy(src, dest, rfnc, wfnc) \ 109 #define cx_stream_copy(src, dest, rfnc, wfnc) \
114 cx_stream_ncopy(src, dest, rfnc, wfnc, SIZE_MAX) 110 cx_stream_ncopy(src, dest, rfnc, wfnc, SIZE_MAX)
115 111
116 #ifdef __cplusplus
117 }
118 #endif
119
120 #endif // UCX_STREAMS_H 112 #endif // UCX_STREAMS_H

mercurial