diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:46:35 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:46:35 +0000 |
commit | 502af2167f7c218366666ca4944bd7cc54b5b19a (patch) | |
tree | a91fec5cc9769d260640bd91c6633cb9cf395524 /src/include/gnunet_bio_lib.h | |
parent | 03af5a603b7cc53432249d5854cd412aa90dde0d (diff) | |
download | gnunet-502af2167f7c218366666ca4944bd7cc54b5b19a.tar.gz gnunet-502af2167f7c218366666ca4944bd7cc54b5b19a.zip |
indentation
Diffstat (limited to 'src/include/gnunet_bio_lib.h')
-rw-r--r-- | src/include/gnunet_bio_lib.h | 74 |
1 files changed, 31 insertions, 43 deletions
diff --git a/src/include/gnunet_bio_lib.h b/src/include/gnunet_bio_lib.h index 15924f1ef..f0b486fd2 100644 --- a/src/include/gnunet_bio_lib.h +++ b/src/include/gnunet_bio_lib.h | |||
@@ -60,8 +60,7 @@ struct GNUNET_BIO_ReadHandle *GNUNET_BIO_read_open (const char *fn); | |||
60 | * @param emsg set to the error message | 60 | * @param emsg set to the error message |
61 | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise | 61 | * @return GNUNET_OK on success, GNUNET_SYSERR otherwise |
62 | */ | 62 | */ |
63 | int GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, | 63 | int GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, char **emsg); |
64 | char **emsg); | ||
65 | 64 | ||
66 | 65 | ||
67 | /** | 66 | /** |
@@ -73,10 +72,8 @@ int GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, | |||
73 | * @param len the number of bytes to read | 72 | * @param len the number of bytes to read |
74 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 73 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure |
75 | */ | 74 | */ |
76 | int GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, | 75 | int GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, |
77 | const char *what, | 76 | const char *what, void *result, size_t len); |
78 | void *result, | ||
79 | size_t len); | ||
80 | 77 | ||
81 | 78 | ||
82 | /** | 79 | /** |
@@ -89,10 +86,8 @@ int GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, | |||
89 | * @param len the number of bytes to read | 86 | * @param len the number of bytes to read |
90 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 87 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure |
91 | */ | 88 | */ |
92 | int GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, | 89 | int GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, |
93 | const char *file, int line, | 90 | const char *file, int line, void *result, size_t len); |
94 | void *result, | ||
95 | size_t len); | ||
96 | 91 | ||
97 | /** | 92 | /** |
98 | * Read 0-terminated string from a file. | 93 | * Read 0-terminated string from a file. |
@@ -105,9 +100,7 @@ int GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, | |||
105 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 100 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure |
106 | */ | 101 | */ |
107 | int GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, | 102 | int GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, |
108 | const char *what, | 103 | const char *what, char **result, size_t maxLen); |
109 | char **result, | ||
110 | size_t maxLen); | ||
111 | 104 | ||
112 | 105 | ||
113 | /** | 106 | /** |
@@ -118,9 +111,9 @@ int GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, | |||
118 | * @param result the buffer to store a pointer to the (allocated) metadata | 111 | * @param result the buffer to store a pointer to the (allocated) metadata |
119 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 112 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure |
120 | */ | 113 | */ |
121 | int GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, | 114 | int GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, |
122 | const char *what, | 115 | const char *what, |
123 | struct GNUNET_CONTAINER_MetaData **result); | 116 | struct GNUNET_CONTAINER_MetaData **result); |
124 | 117 | ||
125 | 118 | ||
126 | /** | 119 | /** |
@@ -128,7 +121,7 @@ int GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, | |||
128 | * | 121 | * |
129 | * @param h hande to open file | 122 | * @param h hande to open file |
130 | * @param f address of float to read | 123 | * @param f address of float to read |
131 | */ | 124 | */ |
132 | #define GNUNET_BIO_read_float(h, f) (GNUNET_BIO_read_fn (h, __FILE__, __LINE__, f, sizeof(float))) | 125 | #define GNUNET_BIO_read_float(h, f) (GNUNET_BIO_read_fn (h, __FILE__, __LINE__, f, sizeof(float))) |
133 | 126 | ||
134 | 127 | ||
@@ -138,7 +131,7 @@ int GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, | |||
138 | * | 131 | * |
139 | * @param h hande to open file | 132 | * @param h hande to open file |
140 | * @param f address of double to read | 133 | * @param f address of double to read |
141 | */ | 134 | */ |
142 | #define GNUNET_BIO_read_double(h, f) (GNUNET_BIO_read_fn (h, __FILE__, __LINE__, f, sizeof(double))) | 135 | #define GNUNET_BIO_read_double(h, f) (GNUNET_BIO_read_fn (h, __FILE__, __LINE__, f, sizeof(double))) |
143 | 136 | ||
144 | 137 | ||
@@ -150,10 +143,9 @@ int GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, | |||
150 | * @param line line number in the code | 143 | * @param line line number in the code |
151 | * @param i address of 32-bit integer to read | 144 | * @param i address of 32-bit integer to read |
152 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 145 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
153 | */ | 146 | */ |
154 | int GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, | 147 | int GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, |
155 | const char *file, int line, | 148 | const char *file, int line, int32_t * i); |
156 | int32_t *i); | ||
157 | 149 | ||
158 | 150 | ||
159 | /** | 151 | /** |
@@ -161,7 +153,7 @@ int GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, | |||
161 | * | 153 | * |
162 | * @param h hande to open file | 154 | * @param h hande to open file |
163 | * @param i address of 32-bit integer to read | 155 | * @param i address of 32-bit integer to read |
164 | */ | 156 | */ |
165 | #define GNUNET_BIO_read_int32(h, i) GNUNET_BIO_read_int32__ (h, __FILE__, __LINE__, (int32_t*) i) | 157 | #define GNUNET_BIO_read_int32(h, i) GNUNET_BIO_read_int32__ (h, __FILE__, __LINE__, (int32_t*) i) |
166 | 158 | ||
167 | 159 | ||
@@ -173,10 +165,9 @@ int GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, | |||
173 | * @param line line number in the code | 165 | * @param line line number in the code |
174 | * @param i address of 64-bit integer to read | 166 | * @param i address of 64-bit integer to read |
175 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 167 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
176 | */ | 168 | */ |
177 | int GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, | 169 | int GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, |
178 | const char *file, int line, | 170 | const char *file, int line, int64_t * i); |
179 | int64_t *i); | ||
180 | 171 | ||
181 | 172 | ||
182 | /** | 173 | /** |
@@ -184,7 +175,7 @@ int GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, | |||
184 | * | 175 | * |
185 | * @param h hande to open file | 176 | * @param h hande to open file |
186 | * @param i address of 64-bit integer to read | 177 | * @param i address of 64-bit integer to read |
187 | */ | 178 | */ |
188 | #define GNUNET_BIO_read_int64(h, i) GNUNET_BIO_read_int64__ (h, __FILE__, __LINE__, (int64_t*) i) | 179 | #define GNUNET_BIO_read_int64(h, i) GNUNET_BIO_read_int64__ (h, __FILE__, __LINE__, (int64_t*) i) |
189 | 180 | ||
190 | 181 | ||
@@ -192,6 +183,7 @@ int GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, | |||
192 | * Handle for buffered writing. | 183 | * Handle for buffered writing. |
193 | */ | 184 | */ |
194 | struct GNUNET_BIO_WriteHandle; | 185 | struct GNUNET_BIO_WriteHandle; |
186 | |||
195 | /** | 187 | /** |
196 | * Open a file for writing. | 188 | * Open a file for writing. |
197 | * | 189 | * |
@@ -218,9 +210,8 @@ int GNUNET_BIO_write_close (struct GNUNET_BIO_WriteHandle *h); | |||
218 | * @param n number of bytes to write | 210 | * @param n number of bytes to write |
219 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 211 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
220 | */ | 212 | */ |
221 | int GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, | 213 | int GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, |
222 | const void *buffer, | 214 | const void *buffer, size_t n); |
223 | size_t n); | ||
224 | 215 | ||
225 | 216 | ||
226 | /** | 217 | /** |
@@ -230,8 +221,7 @@ int GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, | |||
230 | * @param s string to write (can be NULL) | 221 | * @param s string to write (can be NULL) |
231 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 222 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
232 | */ | 223 | */ |
233 | int GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, | 224 | int GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, const char *s); |
234 | const char *s); | ||
235 | 225 | ||
236 | 226 | ||
237 | 227 | ||
@@ -243,8 +233,8 @@ int GNUNET_BIO_write_string (struct GNUNET_BIO_WriteHandle *h, | |||
243 | * @param m metadata to write | 233 | * @param m metadata to write |
244 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 234 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
245 | */ | 235 | */ |
246 | int GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, | 236 | int GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, |
247 | const struct GNUNET_CONTAINER_MetaData *m); | 237 | const struct GNUNET_CONTAINER_MetaData *m); |
248 | 238 | ||
249 | 239 | ||
250 | 240 | ||
@@ -253,7 +243,7 @@ int GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, | |||
253 | * | 243 | * |
254 | * @param h hande to open file | 244 | * @param h hande to open file |
255 | * @param f float to write (must be a variable) | 245 | * @param f float to write (must be a variable) |
256 | */ | 246 | */ |
257 | #define GNUNET_BIO_write_float(h, f) GNUNET_BIO_write (h, &f, sizeof(float)) | 247 | #define GNUNET_BIO_write_float(h, f) GNUNET_BIO_write (h, &f, sizeof(float)) |
258 | 248 | ||
259 | 249 | ||
@@ -263,7 +253,7 @@ int GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, | |||
263 | * | 253 | * |
264 | * @param h hande to open file | 254 | * @param h hande to open file |
265 | * @param f double to write (must be a variable) | 255 | * @param f double to write (must be a variable) |
266 | */ | 256 | */ |
267 | #define GNUNET_BIO_write_double(h, f) GNUNET_BIO_write (h, &f, sizeof(double)) | 257 | #define GNUNET_BIO_write_double(h, f) GNUNET_BIO_write (h, &f, sizeof(double)) |
268 | 258 | ||
269 | 259 | ||
@@ -273,9 +263,8 @@ int GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, | |||
273 | * @param h hande to open file | 263 | * @param h hande to open file |
274 | * @param i address of 32-bit integer to write | 264 | * @param i address of 32-bit integer to write |
275 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 265 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
276 | */ | 266 | */ |
277 | int GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, | 267 | int GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, int32_t i); |
278 | int32_t i); | ||
279 | 268 | ||
280 | 269 | ||
281 | /** | 270 | /** |
@@ -284,9 +273,8 @@ int GNUNET_BIO_write_int32 (struct GNUNET_BIO_WriteHandle *h, | |||
284 | * @param h hande to open file | 273 | * @param h hande to open file |
285 | * @param i address of 64-bit integer to write | 274 | * @param i address of 64-bit integer to write |
286 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 275 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
287 | */ | 276 | */ |
288 | int GNUNET_BIO_write_int64 (struct GNUNET_BIO_WriteHandle *h, | 277 | int GNUNET_BIO_write_int64 (struct GNUNET_BIO_WriteHandle *h, int64_t i); |
289 | int64_t i); | ||
290 | 278 | ||
291 | 279 | ||
292 | #if 0 /* keep Emacsens' auto-indent happy */ | 280 | #if 0 /* keep Emacsens' auto-indent happy */ |