80 * provided for <code>buf</code>, this is the size of the buffer that shall be |
82 * provided for <code>buf</code>, this is the size of the buffer that shall be |
81 * implicitly created |
83 * implicitly created |
82 * @param n the maximum number of bytes that shall be copied |
84 * @param n the maximum number of bytes that shall be copied |
83 * @return the total number of bytes copied |
85 * @return the total number of bytes copied |
84 */ |
86 */ |
85 size_t ucx_stream_copy(void *src, void *dest, read_func rfnc, write_func wfnc, |
87 size_t ucx_stream_bncopy(void *src, void *dest, read_func rfnc, write_func wfnc, |
86 char* buf, size_t bufsize, size_t n); |
88 char* buf, size_t bufsize, size_t n); |
87 |
89 |
88 /** |
90 /** |
89 * Shorthand for ucx_stream_copy using the default copy buffer. |
91 * Shorthand for an unbounded ucx_stream_bncopy call using a default buffer. |
90 * |
92 * |
91 * @param src the source stream |
93 * @param src the source stream |
92 * @param dest the destination stream |
94 * @param dest the destination stream |
93 * @param rfnc the read function |
95 * @param rfnc the read function |
94 * @param wfnc the write function |
96 * @param wfnc the write function |
95 * @return total number of bytes copied |
97 * @return total number of bytes copied |
96 */ |
98 * |
97 #define ucx_stream_hcopy(src,dest,rfnc,wfnc) ucx_stream_copy(\ |
99 * @see #UCX_STREAM_COPY_BUFSIZE |
98 src, dest, (read_func)rfnc, (write_func)wfnc, NULL, 0x100, (size_t)-1) |
100 */ |
99 |
101 #define ucx_stream_copy(src,dest,rfnc,wfnc) ucx_stream_bncopy(\ |
100 /** |
102 src, dest, (read_func)rfnc, (write_func)wfnc, \ |
101 * Shorthand for ucx_stream_copy using the default copy buffer and a copy limit. |
103 NULL, UCX_STREAM_COPY_BUFSIZE, (size_t)-1) |
|
104 |
|
105 /** |
|
106 * Shorthand for ucx_stream_bncopy using a default copy buffer. |
102 * |
107 * |
103 * @param src the source stream |
108 * @param src the source stream |
104 * @param dest the destination stream |
109 * @param dest the destination stream |
105 * @param rfnc the read function |
110 * @param rfnc the read function |
106 * @param wfnc the write function |
111 * @param wfnc the write function |
107 * @param n maximum number of bytes that shall be copied |
112 * @param n maximum number of bytes that shall be copied |
108 * @return total number of bytes copied |
113 * @return total number of bytes copied |
109 */ |
114 */ |
110 #define ucx_stream_ncopy(src,dest,rfnc,wfnc, n) ucx_stream_copy(\ |
115 #define ucx_stream_ncopy(src,dest,rfnc,wfnc, n) ucx_stream_bncopy(\ |
111 src, dest, (read_func)rfnc, (write_func)wfnc, NULL, 0x100, n) |
116 src, dest, (read_func)rfnc, (write_func)wfnc, \ |
|
117 NULL, UCX_STREAM_COPY_BUFSIZE, n) |
|
118 |
|
119 /** |
|
120 * Shorthand for an unbounded ucx_stream_bncopy call using the specified buffer. |
|
121 * |
|
122 * @param src the source stream |
|
123 * @param dest the destination stream |
|
124 * @param rfnc the read function |
|
125 * @param wfnc the write function |
|
126 * @param buf a pointer to the copy buffer or <code>NULL</code> if a buffer |
|
127 * shall be implicitly created on the heap |
|
128 * @param bufsize the size of the copy buffer - if <code>NULL</code> was |
|
129 * provided for <code>buf</code>, this is the size of the buffer that shall be |
|
130 * implicitly created |
|
131 * @return total number of bytes copied |
|
132 */ |
|
133 #define ucx_stream_bcopy(src,dest,rfnc,wfnc, buf, bufsize) ucx_stream_bncopy(\ |
|
134 src, dest, (read_func)rfnc, (write_func)wfnc, \ |
|
135 buf, bufsize, (size_t)-1) |
112 |
136 |
113 /** |
137 /** |
114 * Wraps the strcmp function. |
138 * Wraps the strcmp function. |
115 * @param s1 string one |
139 * @param s1 string one |
116 * @param s2 string two |
140 * @param s2 string two |