Skip to content

Commit

Permalink
Silence MSVC warnings about possible loss of data
Browse files Browse the repository at this point in the history
The encode functions return size_ts so we should match that.
  • Loading branch information
blawrence-ont committed Dec 3, 2024
1 parent bc29d55 commit 07829bc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/streamvbyte.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ size_t streamvbyte_decode_0124(const uint8_t* in, uint32_t* out, uint32_t length
// etc...) has a valid length stored alongside it.
// "inLength" is the size of the encoded data "in", and "outLength" is the expected number
// of integers that were compressed.
bool streamvbyte_validate_stream(const uint8_t* in, uint32_t inLength, uint32_t outLength);
bool streamvbyte_validate_stream(const uint8_t* in, size_t inLength, uint32_t outLength);

// Same as streamvbyte_validate_stream but is meant to be used for streams encoded with
// streamvbyte_encode_0124.
bool streamvbyte_validate_stream_0124(const uint8_t* in, uint32_t inLength, uint32_t outLength);
bool streamvbyte_validate_stream_0124(const uint8_t* in, size_t inLength, uint32_t outLength);

#ifdef __cplusplus
}
Expand Down
2 changes: 1 addition & 1 deletion src/streamvbyte_0124_decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ size_t streamvbyte_decode_0124(const uint8_t *in, uint32_t *out, uint32_t count)
return (size_t)(svb_decode_scalar(out, keyPtr, dataPtr, count) - in);
}

bool streamvbyte_validate_stream_0124(const uint8_t *in, uint32_t inCount,
bool streamvbyte_validate_stream_0124(const uint8_t *in, size_t inCount,
uint32_t outCount) {
if (inCount == 0 || outCount == 0)
return inCount == outCount;
Expand Down
2 changes: 1 addition & 1 deletion src/streamvbyte_decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ size_t streamvbyte_decode(const uint8_t *in, uint32_t *out, uint32_t count) {
return (size_t)(svb_decode_scalar(out, keyPtr, dataPtr, count) - in);
}

bool streamvbyte_validate_stream(const uint8_t *in, uint32_t inCount,
bool streamvbyte_validate_stream(const uint8_t *in, size_t inCount,
uint32_t outCount) {
if (inCount == 0 || outCount == 0)
return inCount == outCount;
Expand Down

0 comments on commit 07829bc

Please sign in to comment.