How to parse values in block index leveldb?
A non-negative signed varint is just a normal varint but should be put into a signed integer rather than an unsigned integer as with normal varints. You just need to also check that it is a non-negative integer.

For example, instead of decoding a 32 bit varint as a uint32_t, you decode it as int32_t and check that it's value is &gt;= 0.



Your code looks like it is decoding things as signed integers already. Instead of using Python's conversions built into the various classes, I recommend that you use the struct module so that you can specify endianness and signedness of the bytes that you are decoding.