diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 21:54:06 +0000 |
commit | 5746309cb4be2073d550ad7a6885e918631dbc38 (patch) | |
tree | 89455bc4aadf977816b38df13f990372cd81d71a /src/util/bio.c | |
parent | 6fd3e715cae09fa6e657c96f1c6f9711ee51f42f (diff) | |
download | gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.tar.gz gnunet-5746309cb4be2073d550ad7a6885e918631dbc38.zip |
indentation
Diffstat (limited to 'src/util/bio.c')
-rw-r--r-- | src/util/bio.c | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/src/util/bio.c b/src/util/bio.c index b29d75eb9..404b7aa3b 100644 --- a/src/util/bio.c +++ b/src/util/bio.c | |||
@@ -101,8 +101,8 @@ GNUNET_BIO_read_close (struct GNUNET_BIO_ReadHandle *h, char **emsg) | |||
101 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 101 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure |
102 | */ | 102 | */ |
103 | int | 103 | int |
104 | GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, | 104 | GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, const char *what, |
105 | const char *what, void *result, size_t len) | 105 | void *result, size_t len) |
106 | { | 106 | { |
107 | char *dst = result; | 107 | char *dst = result; |
108 | size_t min; | 108 | size_t min; |
@@ -131,14 +131,14 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, | |||
131 | ret = GNUNET_DISK_file_read (h->fd, h->buffer, h->size); | 131 | ret = GNUNET_DISK_file_read (h->fd, h->buffer, h->size); |
132 | if (ret == -1) | 132 | if (ret == -1) |
133 | { | 133 | { |
134 | GNUNET_asprintf (&h->emsg, | 134 | GNUNET_asprintf (&h->emsg, _("Error reading `%s': %s"), what, |
135 | _("Error reading `%s': %s"), what, STRERROR (errno)); | 135 | STRERROR (errno)); |
136 | return GNUNET_SYSERR; | 136 | return GNUNET_SYSERR; |
137 | } | 137 | } |
138 | if (ret == 0) | 138 | if (ret == 0) |
139 | { | 139 | { |
140 | GNUNET_asprintf (&h->emsg, | 140 | GNUNET_asprintf (&h->emsg, _("Error reading `%s': %s"), what, |
141 | _("Error reading `%s': %s"), what, _("End of file")); | 141 | _("End of file")); |
142 | return GNUNET_SYSERR; | 142 | return GNUNET_SYSERR; |
143 | } | 143 | } |
144 | h->pos = 0; | 144 | h->pos = 0; |
@@ -160,8 +160,8 @@ GNUNET_BIO_read (struct GNUNET_BIO_ReadHandle *h, | |||
160 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 160 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure |
161 | */ | 161 | */ |
162 | int | 162 | int |
163 | GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, | 163 | GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, const char *file, int line, |
164 | const char *file, int line, void *result, size_t len) | 164 | void *result, size_t len) |
165 | { | 165 | { |
166 | char what[1024]; | 166 | char what[1024]; |
167 | 167 | ||
@@ -181,8 +181,8 @@ GNUNET_BIO_read_fn (struct GNUNET_BIO_ReadHandle *h, | |||
181 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 181 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure |
182 | */ | 182 | */ |
183 | int | 183 | int |
184 | GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, | 184 | GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, const char *what, |
185 | const char *what, char **result, size_t maxLen) | 185 | char **result, size_t maxLen) |
186 | { | 186 | { |
187 | char *buf; | 187 | char *buf; |
188 | uint32_t big; | 188 | uint32_t big; |
@@ -200,8 +200,7 @@ GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, | |||
200 | } | 200 | } |
201 | if (big > maxLen) | 201 | if (big > maxLen) |
202 | { | 202 | { |
203 | GNUNET_asprintf (&h->emsg, | 203 | GNUNET_asprintf (&h->emsg, _("String `%s' longer than allowed (%u > %u)"), |
204 | _("String `%s' longer than allowed (%u > %u)"), | ||
205 | what, big, maxLen); | 204 | what, big, maxLen); |
206 | return GNUNET_SYSERR; | 205 | return GNUNET_SYSERR; |
207 | } | 206 | } |
@@ -229,8 +228,7 @@ GNUNET_BIO_read_string (struct GNUNET_BIO_ReadHandle *h, | |||
229 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 228 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure |
230 | */ | 229 | */ |
231 | int | 230 | int |
232 | GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, | 231 | GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, const char *what, |
233 | const char *what, | ||
234 | struct GNUNET_CONTAINER_MetaData **result) | 232 | struct GNUNET_CONTAINER_MetaData **result) |
235 | { | 233 | { |
236 | uint32_t size; | 234 | uint32_t size; |
@@ -280,8 +278,8 @@ GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, | |||
280 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 278 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
281 | */ | 279 | */ |
282 | int | 280 | int |
283 | GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, | 281 | GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, const char *file, |
284 | const char *file, int line, int32_t * i) | 282 | int line, int32_t * i) |
285 | { | 283 | { |
286 | int32_t big; | 284 | int32_t big; |
287 | 285 | ||
@@ -302,8 +300,8 @@ GNUNET_BIO_read_int32__ (struct GNUNET_BIO_ReadHandle *h, | |||
302 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 300 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
303 | */ | 301 | */ |
304 | int | 302 | int |
305 | GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, | 303 | GNUNET_BIO_read_int64__ (struct GNUNET_BIO_ReadHandle *h, const char *file, |
306 | const char *file, int line, int64_t * i) | 304 | int line, int64_t * i) |
307 | { | 305 | { |
308 | int64_t big; | 306 | int64_t big; |
309 | 307 | ||
@@ -339,9 +337,8 @@ GNUNET_BIO_write_open (const char *fn) | |||
339 | struct GNUNET_BIO_WriteHandle *h; | 337 | struct GNUNET_BIO_WriteHandle *h; |
340 | 338 | ||
341 | fd = GNUNET_DISK_file_open (fn, | 339 | fd = GNUNET_DISK_file_open (fn, |
342 | GNUNET_DISK_OPEN_WRITE | | 340 | GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_TRUNCATE |
343 | GNUNET_DISK_OPEN_TRUNCATE | | 341 | | GNUNET_DISK_OPEN_CREATE, |
344 | GNUNET_DISK_OPEN_CREATE, | ||
345 | GNUNET_DISK_PERM_USER_READ | | 342 | GNUNET_DISK_PERM_USER_READ | |
346 | GNUNET_DISK_PERM_USER_WRITE); | 343 | GNUNET_DISK_PERM_USER_WRITE); |
347 | if (NULL == fd) | 344 | if (NULL == fd) |
@@ -394,8 +391,8 @@ GNUNET_BIO_write_close (struct GNUNET_BIO_WriteHandle *h) | |||
394 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 391 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
395 | */ | 392 | */ |
396 | int | 393 | int |
397 | GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, | 394 | GNUNET_BIO_write (struct GNUNET_BIO_WriteHandle *h, const void *buffer, |
398 | const void *buffer, size_t n) | 395 | size_t n) |
399 | { | 396 | { |
400 | const char *src = buffer; | 397 | const char *src = buffer; |
401 | size_t min; | 398 | size_t min; |
@@ -470,10 +467,9 @@ GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, | |||
470 | if (m == NULL) | 467 | if (m == NULL) |
471 | return GNUNET_BIO_write_int32 (h, 0); | 468 | return GNUNET_BIO_write_int32 (h, 0); |
472 | buf = NULL; | 469 | buf = NULL; |
473 | size = GNUNET_CONTAINER_meta_data_serialize (m, | 470 | size = |
474 | &buf, | 471 | GNUNET_CONTAINER_meta_data_serialize (m, &buf, MAX_META_DATA, |
475 | MAX_META_DATA, | 472 | GNUNET_CONTAINER_META_DATA_SERIALIZE_PART); |
476 | GNUNET_CONTAINER_META_DATA_SERIALIZE_PART); | ||
477 | if (size == -1) | 473 | if (size == -1) |
478 | { | 474 | { |
479 | GNUNET_free (buf); | 475 | GNUNET_free (buf); |