fix(go): repair migration wire contracts and runtime lifecycle; document incomplete port
This commit is contained in:
1 parent
e43a310617
commit
32e47014b5
35 files changed
+16826
-438
No files matched your search
+14
-10
@@ -103,18 +103,22 @@ func (r *UxReader) F64() (float64, error) {
|
||||
}
|
||||
|
||||
func (r *UxReader) ReadVarInt() (int, error) {
|
||||
shift := 0
|
||||
result := 0
|
||||
for r.pos < len(r.data) {
|
||||
b := r.data[r.pos]
|
||||
r.pos++
|
||||
result |= int(b&0x7F) << shift
|
||||
if (b & 0x80) == 0 {
|
||||
return result, nil
|
||||
// UX lengths/counts are nonnegative Int32 values, at most five bytes.
|
||||
var result uint32
|
||||
for shift := uint(0); shift < 35; shift += 7 {
|
||||
b, err := r.U8()
|
||||
if err != nil {
|
||||
return 0, errors.New("unterminated varint")
|
||||
}
|
||||
if shift == 28 && b > 7 {
|
||||
return 0, errors.New("varint exceeds Int32")
|
||||
}
|
||||
result |= uint32(b&0x7f) << shift
|
||||
if b&0x80 == 0 {
|
||||
return int(result), nil
|
||||
}
|
||||
shift += 7
|
||||
}
|
||||
return result, errors.New("unterminated varint")
|
||||
return 0, errors.New("varint exceeds Int32")
|
||||
}
|
||||
|
||||
func (r *UxReader) Int7() (int, error) {
|
||||
|
||||
Reference in new issue
Block a user