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:
+2
-2
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user