Rewrite magic source

This commit is contained in:
Alexey Khit
2023-08-19 15:19:09 +03:00
parent a9118562a9
commit bc60cbefb8
11 changed files with 124 additions and 114 deletions
+4 -2
View File
@@ -70,8 +70,10 @@ func EncodeToAVCC(b []byte, safeAppend bool) []byte {
return b
}
func DecodeAVCC(b []byte) []byte {
b = bytes.Clone(b)
func DecodeAVCC(b []byte, safeClone bool) []byte {
if safeClone {
b = bytes.Clone(b)
}
for i := 0; i < len(b); {
size := int(binary.BigEndian.Uint32(b[i:]))
b[i] = 0