From 0fec9473ed64550d5c616a27c0b4069032a5f541 Mon Sep 17 00:00:00 2001 From: "M. Sz" Date: Mon, 1 Feb 2021 11:15:42 +0100 Subject: [PATCH] rename: PushBytes(b []byte) -> PushBytes(b ...byte) --- d2common/d2datautils/stream_writer.go | 2 +- d2common/d2fileformats/d2cof/cof.go | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/d2common/d2datautils/stream_writer.go b/d2common/d2datautils/stream_writer.go index d07e3e3e..b4cdb20d 100644 --- a/d2common/d2datautils/stream_writer.go +++ b/d2common/d2datautils/stream_writer.go @@ -27,7 +27,7 @@ func (v *StreamWriter) PushByte(val byte) { } // PushBytes writes a byte slince to the stream -func (v *StreamWriter) PushBytes(b []byte) { +func (v *StreamWriter) PushBytes(b ...byte) { for _, i := range b { v.PushByte(i) } diff --git a/d2common/d2fileformats/d2cof/cof.go b/d2common/d2fileformats/d2cof/cof.go index fc7a0950..6352aef8 100644 --- a/d2common/d2fileformats/d2cof/cof.go +++ b/d2common/d2fileformats/d2cof/cof.go @@ -50,6 +50,7 @@ type COF struct { } // Load loads a COF file. +// nolint:funlen // no need to change func Load(fileData []byte) (*COF, error) { result := &COF{} streamReader := d2datautils.CreateStreamReader(fileData) @@ -140,16 +141,16 @@ func Load(fileData []byte) (*COF, error) { return result, nil } -// Marshals encodes COF back into byte slince +// Marshal encodes COF back into byte slince func (c *COF) Marshal() []byte { sw := d2datautils.CreateStreamWriter() sw.PushByte(byte(c.NumberOfLayers)) sw.PushByte(byte(c.FramesPerDirection)) sw.PushByte(byte(c.NumberOfDirections)) - sw.PushBytes(c.unknownHeaderBytes) + sw.PushBytes(c.unknownHeaderBytes...) sw.PushByte(byte(c.Speed)) - sw.PushBytes(c.unknown1) + sw.PushBytes(c.unknown1...) for i := range c.CofLayers { sw.PushByte(byte(c.CofLayers[i].Type.Int())) @@ -169,7 +170,7 @@ func (c *COF) Marshal() []byte { sw.PushByte(byte(c.CofLayers[i].DrawEffect)) - sw.PushBytes(c.CofLayers[i].weaponClassByte) + sw.PushBytes(c.CofLayers[i].weaponClassByte...) } for _, i := range c.AnimationFrames {