diff options
Diffstat (limited to 'binapi/cdp/cdp.ba.go')
-rw-r--r-- | binapi/cdp/cdp.ba.go | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/binapi/cdp/cdp.ba.go b/binapi/cdp/cdp.ba.go index afd8c46..5430d74 100644 --- a/binapi/cdp/cdp.ba.go +++ b/binapi/cdp/cdp.ba.go @@ -40,21 +40,18 @@ func (*CdpEnableDisable) GetMessageType() api.MessageType { return api.RequestMessage } -func (m *CdpEnableDisable) Size() int { +func (m *CdpEnableDisable) Size() (size int) { if m == nil { return 0 } - var size int size += 1 // m.EnableDisable return size } func (m *CdpEnableDisable) 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.EncodeBool(m.EnableDisable) return buf.Bytes(), nil } @@ -76,27 +73,24 @@ func (*CdpEnableDisableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -func (m *CdpEnableDisableReply) Size() int { +func (m *CdpEnableDisableReply) Size() (size int) { if m == nil { return 0 } - var size int size += 4 // m.Retval return size } func (m *CdpEnableDisableReply) 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 *CdpEnableDisableReply) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) - m.Retval = int32(buf.DecodeUint32()) + m.Retval = buf.DecodeInt32() return nil } |