diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-10-07 11:10:42 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-10-07 11:10:42 +0000 |
commit | aa907f2d51d9409635e5d1438b67efa6857a4c69 (patch) | |
tree | 71b12d2e25ec03bb713719c63d66ed464d54c599 /src/util/container_meta_data.c | |
parent | 3338a96cc71285d4bb2cf3fa4849734b29b63509 (diff) | |
download | gnunet-aa907f2d51d9409635e5d1438b67efa6857a4c69.tar.gz gnunet-aa907f2d51d9409635e5d1438b67efa6857a4c69.zip |
improving documentation
Diffstat (limited to 'src/util/container_meta_data.c')
-rw-r--r-- | src/util/container_meta_data.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/util/container_meta_data.c b/src/util/container_meta_data.c index 4cb4ea148..bbe6dad3b 100644 --- a/src/util/container_meta_data.c +++ b/src/util/container_meta_data.c | |||
@@ -247,6 +247,7 @@ GNUNET_CONTAINER_meta_data_get_first_by_types (const struct | |||
247 | /** | 247 | /** |
248 | * Get a thumbnail from the meta-data (if present). | 248 | * Get a thumbnail from the meta-data (if present). |
249 | * | 249 | * |
250 | * @param md metadata to get the thumbnail from | ||
250 | * @param thumb will be set to the thumbnail data. Must be | 251 | * @param thumb will be set to the thumbnail data. Must be |
251 | * freed by the caller! | 252 | * freed by the caller! |
252 | * @return number of bytes in thumbnail, 0 if not available | 253 | * @return number of bytes in thumbnail, 0 if not available |
@@ -333,6 +334,7 @@ GNUNET_CONTAINER_meta_data_extract_from_file (struct GNUNET_CONTAINER_MetaData | |||
333 | return ret; | 334 | return ret; |
334 | } | 335 | } |
335 | 336 | ||
337 | |||
336 | static unsigned int | 338 | static unsigned int |
337 | tryCompression (char *data, unsigned int oldSize) | 339 | tryCompression (char *data, unsigned int oldSize) |
338 | { | 340 | { |
@@ -434,7 +436,9 @@ struct MetaDataHeader | |||
434 | /** | 436 | /** |
435 | * Serialize meta-data to target. | 437 | * Serialize meta-data to target. |
436 | * | 438 | * |
437 | * @param size maximum number of bytes available | 439 | * @param md metadata to serialize |
440 | * @param target where to write the serialized metadata | ||
441 | * @param max maximum number of bytes available in target | ||
438 | * @param part is it ok to just write SOME of the | 442 | * @param part is it ok to just write SOME of the |
439 | * meta-data to match the size constraint, | 443 | * meta-data to match the size constraint, |
440 | * possibly discarding some data? | 444 | * possibly discarding some data? |
@@ -532,13 +536,19 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData | |||
532 | * Estimate (!) the size of the meta-data in | 536 | * Estimate (!) the size of the meta-data in |
533 | * serialized form. The estimate MAY be higher | 537 | * serialized form. The estimate MAY be higher |
534 | * than what is strictly needed. | 538 | * than what is strictly needed. |
539 | * | ||
540 | * @param md metadata to inspect | ||
541 | * @param opt is it ok to just write SOME of the | ||
542 | * meta-data to match the size constraint, | ||
543 | * possibly discarding some data? | ||
544 | * @return number of bytes needed for serialization, -1 on error | ||
535 | */ | 545 | */ |
536 | ssize_t | 546 | ssize_t |
537 | GNUNET_CONTAINER_meta_data_get_serialized_size (const struct | 547 | GNUNET_CONTAINER_meta_data_get_serialized_size (const struct |
538 | GNUNET_CONTAINER_MetaData *md, | 548 | GNUNET_CONTAINER_MetaData *md, |
539 | enum | 549 | enum |
540 | GNUNET_CONTAINER_MetaDataSerializationOptions | 550 | GNUNET_CONTAINER_MetaDataSerializationOptions |
541 | part) | 551 | opt) |
542 | { | 552 | { |
543 | struct MetaDataHeader *hdr; | 553 | struct MetaDataHeader *hdr; |
544 | size_t size; | 554 | size_t size; |
@@ -567,7 +577,7 @@ GNUNET_CONTAINER_meta_data_get_serialized_size (const struct | |||
567 | memcpy (&((char *) hdr)[pos], md->items[i].data, len); | 577 | memcpy (&((char *) hdr)[pos], md->items[i].data, len); |
568 | pos += len; | 578 | pos += len; |
569 | } | 579 | } |
570 | if ((part & GNUNET_CONTAINER_META_DATA_SERIALIZE_NO_COMPRESS) == 0) | 580 | if ((opt & GNUNET_CONTAINER_META_DATA_SERIALIZE_NO_COMPRESS) == 0) |
571 | { | 581 | { |
572 | pos = | 582 | pos = |
573 | tryCompression ((char *) &hdr[1], | 583 | tryCompression ((char *) &hdr[1], |
@@ -583,9 +593,12 @@ GNUNET_CONTAINER_meta_data_get_serialized_size (const struct | |||
583 | return size; | 593 | return size; |
584 | } | 594 | } |
585 | 595 | ||
596 | |||
586 | /** | 597 | /** |
587 | * Deserialize meta-data. Initializes md. | 598 | * Deserialize meta-data. Initializes md. |
588 | * @param size number of bytes available | 599 | * |
600 | * @param input buffer with the serialized metadata | ||
601 | * @param size number of bytes available in input | ||
589 | * @return MD on success, NULL on error (i.e. | 602 | * @return MD on success, NULL on error (i.e. |
590 | * bad format) | 603 | * bad format) |
591 | */ | 604 | */ |