X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=binapi%2Ffeature%2Ffeature.ba.go;h=cc543645eebbf247dbf382a9bf1ee1fbf585fadb;hb=43cd23926d5eec359d4b554a4330e1aa596c76de;hp=4d16ce82ce377fd5c9df7d1ea65d3d44a1f3066d;hpb=d1f24d37bd447b64e402298bb8eb2479681facf9;p=govpp.git diff --git a/binapi/feature/feature.ba.go b/binapi/feature/feature.ba.go index 4d16ce8..cc54364 100644 --- a/binapi/feature/feature.ba.go +++ b/binapi/feature/feature.ba.go @@ -44,11 +44,10 @@ func (*FeatureEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -func (m *FeatureEnableDisable) Size() int { +func (m *FeatureEnableDisable) Size() (size int) { if m == nil { return 0 } - var size int size += 4 // m.SwIfIndex size += 1 // m.Enable size += 64 // m.ArcName @@ -56,12 +55,10 @@ func (m *FeatureEnableDisable) Size() int { return size } func (m *FeatureEnableDisable) Marshal(b []byte) ([]byte, error) { - var buf *codec.Buffer if b == nil { - buf = codec.NewBuffer(make([]byte, m.Size())) - } else { - buf = codec.NewBuffer(b) + b = make([]byte, m.Size()) } + buf := codec.NewBuffer(b) buf.EncodeUint32(uint32(m.SwIfIndex)) buf.EncodeBool(m.Enable) buf.EncodeString(m.ArcName, 64) @@ -89,27 +86,24 @@ func (*FeatureEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -func (m *FeatureEnableDisableReply) Size() int { +func (m *FeatureEnableDisableReply) Size() (size int) { if m == nil { return 0 } - var size int size += 4 // m.Retval return size } func (m *FeatureEnableDisableReply) Marshal(b []byte) ([]byte, error) { - var buf *codec.Buffer if b == nil { - buf = codec.NewBuffer(make([]byte, m.Size())) - } else { - buf = codec.NewBuffer(b) + b = make([]byte, m.Size()) } - buf.EncodeUint32(uint32(m.Retval)) + buf := codec.NewBuffer(b) + buf.EncodeInt32(m.Retval) return buf.Bytes(), nil } func (m *FeatureEnableDisableReply) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) - m.Retval = int32(buf.DecodeUint32()) + m.Retval = buf.DecodeInt32() return nil }