summaryrefslogtreecommitdiff
path: root/vendor/github.com/ugorji/go/codec/gen.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-06-01 22:20:16 +0100
committerLibravatar GitHub <noreply@github.com>2023-06-01 22:20:16 +0100
commit55aacaf4b07c1921061245cbaa3d307e97cf3c29 (patch)
treed969c5d9728566de1e794e19c5b19d3b660f790e /vendor/github.com/ugorji/go/codec/gen.go
parent[chore/frontend] refactor header templating, add apple-touch-icon (#1850) (diff)
downloadgotosocial-55aacaf4b07c1921061245cbaa3d307e97cf3c29.tar.xz
[chore]: Bump github.com/gin-gonic/gin from 1.9.0 to 1.9.1 (#1855)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/ugorji/go/codec/gen.go')
-rw-r--r--vendor/github.com/ugorji/go/codec/gen.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/vendor/github.com/ugorji/go/codec/gen.go b/vendor/github.com/ugorji/go/codec/gen.go
index d0cec1972..de7ee72f1 100644
--- a/vendor/github.com/ugorji/go/codec/gen.go
+++ b/vendor/github.com/ugorji/go/codec/gen.go
@@ -151,7 +151,9 @@ import (
// v24: 20210226 robust handling for Canonical|CheckCircularRef flags and MissingFielder implementations
// v25: 20210406 pass base reflect.Type to side(En|De)code and (En|De)codeExt calls
// v26: 20230201 genHelper changes for more inlining and consequent performance
-const genVersion = 26
+// v27: 20230219 fix error decoding struct from array - due to misplaced counter increment
+// v28: 20230224 fix decoding missing fields of struct from array, due to double counter increment
+const genVersion = 28
const (
genCodecPkg = "codec1978" // MARKER: keep in sync with codecgen/gen.go
@@ -2090,7 +2092,6 @@ func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid
x.linef("var %shl%s bool = %s >= 0", tpfx, i, lenvarname) // has length
var newbuf, nilbuf genBuf
for _, si := range tisfi {
- x.linef("%sj%s++", tpfx, i)
x.linef("%sb%s = !z.DecContainerNext(%sj%s, %s, %shl%s)", tpfx, i, tpfx, i, lenvarname, tpfx, i)
x.linef("if %sb%s { z.DecReadArrayEnd(); %s }", tpfx, i, breakString)
x.line("z.DecReadArrayElem()")
@@ -2104,10 +2105,11 @@ func (x *genRunner) decStructArray(varname, lenvarname, breakString string, rtid
if len(newbuf.buf) > 0 {
x.line("}")
}
+ x.linef("%sj%s++", tpfx, i)
}
// read remaining values and throw away.
- x.linef("for %sj%s++; z.DecContainerNext(%sj%s, %s, %shl%s); %sj%s++ {",
- tpfx, i, tpfx, i, lenvarname, tpfx, i, tpfx, i)
+ x.linef("for ; z.DecContainerNext(%sj%s, %s, %shl%s); %sj%s++ {",
+ tpfx, i, lenvarname, tpfx, i, tpfx, i)
x.line("z.DecReadArrayElem()")
x.linef(`z.DecStructFieldNotFound(%sj%s - 1, "")`, tpfx, i)
x.line("}")