Changed leb128 related functions to operate on uint32_t

So unsigned instead of signed. The original intention of using int32_t
was to hint that the sign bit should be reserved, but this may just
confuse if our leb128 encoding has a sign representation, which it does
not.
This commit is contained in:
Christopher Haster
2024-02-09 14:20:56 -06:00
parent 9f9653eb79
commit 6f1d110e01
3 changed files with 34 additions and 35 deletions
+2 -2
View File
@@ -16,7 +16,7 @@
// Convert to/from leb128 encoding
ssize_t lfs_toleb128(int32_t word, void *buffer, size_t size) {
ssize_t lfs_toleb128(uint32_t word, void *buffer, size_t size) {
uint8_t *data = buffer;
for (size_t i = 0; i < size; i++) {
@@ -33,7 +33,7 @@ ssize_t lfs_toleb128(int32_t word, void *buffer, size_t size) {
return LFS_ERR_CORRUPT;
}
ssize_t lfs_fromleb128(int32_t *word, const void *buffer, size_t size) {
ssize_t lfs_fromleb128(uint32_t *word, const void *buffer, size_t size) {
const uint8_t *data = buffer;
int32_t word_ = 0;