59 * @param n a pointer to the size_t containing the size of the memory area |
60 * @param n a pointer to the size_t containing the size of the memory area |
60 * @return a pointer to a copy of the specified memory area that can |
61 * @return a pointer to a copy of the specified memory area that can |
61 * be passed to free(void*) |
62 * be passed to free(void*) |
62 */ |
63 */ |
63 void *ucx_memcpy(void *m, void *n); |
64 void *ucx_memcpy(void *m, void *n); |
|
65 |
|
66 |
|
67 /** |
|
68 * Reads data from a stream and writes it to another stream. |
|
69 * |
|
70 * @param src the source stream |
|
71 * @param dest the destination stream |
|
72 * @param rfnc the read function |
|
73 * @param wfnc the write function |
|
74 * @param buf a pointer to the copy buffer or <code>NULL</code> if a buffer |
|
75 * shall be implicitly created on the heap |
|
76 * @param bufsize the size of the copy buffer - if <code>NULL</code> was |
|
77 * provided for <code>buf</code>, this is the size of the buffer that shall be |
|
78 * implicitly created |
|
79 * @param n the maximum number of bytes that shall be copied |
|
80 * @return the total number of bytes copied |
|
81 */ |
|
82 size_t ucx_stream_copy(void *src, void *dest, read_func rfnc, write_func wfnc, |
|
83 char* buf, size_t bufsize, size_t n); |
|
84 |
|
85 /** |
|
86 * Shorthand for ucx_stream_copy using the default copy buffer. |
|
87 * |
|
88 * @param src the source stream |
|
89 * @param dest the destination stream |
|
90 * @param rfnc the read function |
|
91 * @param wfnc the write function |
|
92 * @return total number of bytes copied |
|
93 */ |
|
94 #define ucx_stream_hcopy(src,dest,rfnc,wfnc) ucx_stream_copy(\ |
|
95 src, dest, (read_func)rfnc, (write_func)wfnc, NULL, 0x100, SIZE_MAX) |
|
96 |
|
97 /** |
|
98 * Shorthand for ucx_stream_copy using the default copy buffer and a copy limit. |
|
99 * |
|
100 * @param src the source stream |
|
101 * @param dest the destination stream |
|
102 * @param rfnc the read function |
|
103 * @param wfnc the write function |
|
104 * @param n maximum number of bytes that shall be copied |
|
105 * @return total number of bytes copied |
|
106 */ |
|
107 #define ucx_stream_ncopy(src,dest,rfnc,wfnc, n) ucx_stream_copy(\ |
|
108 src, dest, (read_func)rfnc, (write_func)wfnc, NULL, 0x100, n) |
64 |
109 |
65 /** |
110 /** |
66 * Wraps the strcmp function. |
111 * Wraps the strcmp function. |
67 * @param s1 string one |
112 * @param s1 string one |
68 * @param s2 string two |
113 * @param s2 string two |