From: Minetest-j45 <55553015+Minetest-j45@users.noreply.github.com> Date: Wed, 1 Jun 2022 16:36:56 +0000 (+0100) Subject: fix errors in usage of zstd X-Git-Tag: v0.0.1~17 X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=7cbf2ab623ba1743f4d46a989bc0918e6d0cf186;p=mt.git fix errors in usage of zstd --- diff --git a/internal/mkserialize/mkserialize.go b/internal/mkserialize/mkserialize.go index a3bd657..23a9d39 100644 --- a/internal/mkserialize/mkserialize.go +++ b/internal/mkserialize/mkserialize.go @@ -82,10 +82,10 @@ func structPragma(c *ast.Comment, sp *[]func(), expr string, de bool) { if de { fmt.Println("{ r, err := zstd.NewReader(byteReader{r}); chk(err)") *sp = append(*sp, func() { - fmt.Println("chk(r.Close()) }") + fmt.Println("r.Close() }") }) } else { - fmt.Println("{ w := zstd.NewWriter(w)") + fmt.Println("{ w, err := zstd.NewWriter(w); chk(err)") *sp = append(*sp, func() { fmt.Println("chk(w.Close()) }") }) diff --git a/serialize.go b/serialize.go index 9c6d826..686dd63 100644 --- a/serialize.go +++ b/serialize.go @@ -22881,7 +22881,8 @@ func (obj *MapBlk) serialize(w io.Writer) { } } { - w := zstd.NewWriter(w) + w, err := zstd.NewWriter(w) + chk(err) for local285 := range (*(*(struct { Flags MapBlkFlags LitFrom LitFromBlks @@ -23124,7 +23125,7 @@ func (obj *MapBlk) deserialize(r io.Reader) { }))(obj)).Param2)[:]) chk(err) } - chk(r.Close()) + r.Close() } { p := &(*(*(struct {