diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2016-01-30 10:54:43 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2016-01-30 10:54:43 +0100 |
commit | a9301a1a1f2ac0c73aff2075c2361d54a6fc8675 (patch) | |
tree | f12b465a403dc925bb279f138784594ae92ce1c7 /include/osmocom/core | |
parent | 912bc6ff5047f08bb55c1d08be5fe4485e37e5d6 (diff) |
bitvec: Test and fix regression for C++->C conversion
bitvec_read_field/bitvec_write_field in the PCU used a C++ reference
and when porting to C it was decided to pass the parameter by value
and this lost the "back propagation" of the new index. Change the
parameter to be an in/out parameter and this way do not have a silent
semantic break in the osmo-pcu (where we copy the reference in csn.1
by value) and have a true compile failure.
Add Max's simple test for bitvec_unhex function leaving the checking
of bitvec_read_field and the side effect in the datastructure about
the number of bits still open.
Diffstat (limited to 'include/osmocom/core')
-rw-r--r-- | include/osmocom/core/bitvec.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/osmocom/core/bitvec.h b/include/osmocom/core/bitvec.h index d64d69dc..a7e6fc4d 100644 --- a/include/osmocom/core/bitvec.h +++ b/include/osmocom/core/bitvec.h @@ -80,7 +80,7 @@ void bitvec_free(struct bitvec *bv); int bitvec_unhex(struct bitvec *bv, const char *src); unsigned int bitvec_pack(const struct bitvec *bv, uint8_t *buffer); unsigned int bitvec_unpack(struct bitvec *bv, const uint8_t *buffer); -uint64_t bitvec_read_field(struct bitvec *bv, unsigned int read_index, unsigned int len); -int bitvec_write_field(struct bitvec *bv, unsigned int write_index, uint64_t val, unsigned int len); +uint64_t bitvec_read_field(struct bitvec *bv, unsigned int *read_index, unsigned int len); +int bitvec_write_field(struct bitvec *bv, unsigned int *write_index, uint64_t val, unsigned int len); /*! @} */ |