diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-10-05 22:20:55 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-10-05 22:32:53 +0300 |
commit | 2eec23b402e467c4997cae5f4fea19abad3195a6 (patch) | |
tree | 7bd2721e854318523c28c0915c235407f78cdfef /contrib/libs/croaring/include/roaring/roaring64.h | |
parent | c3797467c201a8de261c9da5475b2386197cb4b0 (diff) | |
download | ydb-2eec23b402e467c4997cae5f4fea19abad3195a6.tar.gz |
Intermediate changes
commit_hash:89e9af18f838d98d46029c1a50881e032a4efa72
Diffstat (limited to 'contrib/libs/croaring/include/roaring/roaring64.h')
-rw-r--r-- | contrib/libs/croaring/include/roaring/roaring64.h | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/contrib/libs/croaring/include/roaring/roaring64.h b/contrib/libs/croaring/include/roaring/roaring64.h index fd89feb5e0..c1f574d605 100644 --- a/contrib/libs/croaring/include/roaring/roaring64.h +++ b/contrib/libs/croaring/include/roaring/roaring64.h @@ -1,13 +1,13 @@ #ifndef ROARING64_H #define ROARING64_H -#include <roaring.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <roaring/memory.h> #include <roaring/portability.h> +#include <roaring/roaring.h> #include <roaring/roaring_types.h> #ifdef __cplusplus @@ -511,6 +511,10 @@ size_t roaring64_bitmap_portable_size_in_bytes(const roaring64_bitmap_t *r); * This function is endian-sensitive. If you have a big-endian system (e.g., a * mainframe IBM s390x), the data format is going to be big-endian and not * compatible with little-endian systems. + * + * When serializing data to a file, we recommend that you also use + * checksums so that, at deserialization, you can be confident + * that you are recovering the correct data. */ size_t roaring64_bitmap_portable_serialize(const roaring64_bitmap_t *r, char *buf); @@ -525,14 +529,17 @@ size_t roaring64_bitmap_portable_deserialize_size(const char *buf, size_t maxbytes); /** - * Read a bitmap from a serialized buffer safely (reading up to maxbytes). + * Read a bitmap from a serialized buffer (reading up to maxbytes). * In case of failure, NULL is returned. * * This is meant to be compatible with other languages * https://github.com/RoaringBitmap/RoaringFormatSpec#extension-for-64-bit-implementations * * The function itself is safe in the sense that it will not cause buffer - * overflows. However, for correct operations, it is assumed that the bitmap + * overflows: it will not read beyond the scope of the provided buffer + * (buf,maxbytes). + * + * However, for correct operations, it is assumed that the bitmap * read was once serialized from a valid bitmap (i.e., it follows the format * specification). If you provided an incorrect input (garbage), then the bitmap * read may not be in a valid state and following operations may not lead to @@ -541,6 +548,12 @@ size_t roaring64_bitmap_portable_deserialize_size(const char *buf, * order. This is is guaranteed to happen when serializing an existing bitmap, * but not for random inputs. * + * You may use roaring64_bitmap_internal_validate to check the validity of the + * bitmap prior to using it. + * + * We recommend that you use checksums to check that serialized data corresponds + * to a serialized bitmap. + * * This function is endian-sensitive. If you have a big-endian system (e.g., a * mainframe IBM s390x), the data format is going to be big-endian and not * compatible with little-endian systems. |