diff options
author | Richard van der Hoff <richard@matrix.org> | 2016-05-17 18:45:28 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2016-05-23 18:55:05 +0100 |
commit | 07b33acee5463c64ca5fa0021128f821dc5aa104 (patch) | |
tree | 641dcccd9fd292b49e77e4fdd125acd4c1f48d16 /src/pickle.cpp | |
parent | 294cf482ea49f690ac9eaad52f2574a90b2e51e6 (diff) |
C bindings for pickle functions
Diffstat (limited to 'src/pickle.cpp')
-rw-r--r-- | src/pickle.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/pickle.cpp b/src/pickle.cpp index 00f7cd4..1158306 100644 --- a/src/pickle.cpp +++ b/src/pickle.cpp @@ -13,6 +13,7 @@ * limitations under the License. */ #include "olm/pickle.hh" +#include "olm/pickle.h" std::uint8_t * olm::pickle( std::uint8_t * pos, @@ -196,3 +197,37 @@ std::uint8_t const * olm::unpickle( ); return pos; } + +////// pickle.h implementations + +uint8_t * olm_pickle_uint32(uint8_t * pos, uint32_t value) { + return olm::pickle(pos, value); +} + +uint8_t const * olm_unpickle_uint32( + uint8_t const * pos, uint8_t const * end, + uint32_t *value +) { + return olm::unpickle(pos, end, *value); +} + +uint8_t * olm_pickle_bool(uint8_t * pos, int value) { + return olm::pickle(pos, (bool)value); +} + +uint8_t const * olm_unpickle_bool( + uint8_t const * pos, uint8_t const * end, + int *value +) { + return olm::unpickle(pos, end, *reinterpret_cast<bool *>(value)); +} + +uint8_t * olm_pickle_bytes(uint8_t * pos, uint8_t const * bytes, + size_t bytes_length) { + return olm::pickle_bytes(pos, bytes, bytes_length); +} + +uint8_t const * olm_unpickle_bytes(uint8_t const * pos, uint8_t const * end, + uint8_t * bytes, size_t bytes_length) { + return olm::unpickle_bytes(pos, end, bytes, bytes_length); +} |