X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=binapi%2Fhttp_static%2Fhttp_static.ba.go;h=2116a8bccda0e6f6ef5f4ad192f11b47c5e7e940;hb=43cd23926d5eec359d4b554a4330e1aa596c76de;hp=c1338ed051edcaa7245e720b2f43568644c7482d;hpb=d1f24d37bd447b64e402298bb8eb2479681facf9;p=govpp.git diff --git a/binapi/http_static/http_static.ba.go b/binapi/http_static/http_static.ba.go index c1338ed..2116a8b 100644 --- a/binapi/http_static/http_static.ba.go +++ b/binapi/http_static/http_static.ba.go @@ -45,11 +45,10 @@ func (*HTTPStaticEnable) GetMessageType() api.MessageType { return api.RequestMessage } -func (m *HTTPStaticEnable) Size() int { +func (m *HTTPStaticEnable) Size() (size int) { if m == nil { return 0 } - var size int size += 4 // m.FifoSize size += 4 // m.CacheSizeLimit size += 4 // m.PreallocFifos @@ -59,16 +58,14 @@ func (m *HTTPStaticEnable) Size() int { return size } func (m *HTTPStaticEnable) 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.FifoSize)) - buf.EncodeUint32(uint32(m.CacheSizeLimit)) - buf.EncodeUint32(uint32(m.PreallocFifos)) - buf.EncodeUint32(uint32(m.PrivateSegmentSize)) + buf := codec.NewBuffer(b) + buf.EncodeUint32(m.FifoSize) + buf.EncodeUint32(m.CacheSizeLimit) + buf.EncodeUint32(m.PreallocFifos) + buf.EncodeUint32(m.PrivateSegmentSize) buf.EncodeString(m.WwwRoot, 256) buf.EncodeString(m.URI, 256) return buf.Bytes(), nil @@ -96,27 +93,24 @@ func (*HTTPStaticEnableReply) GetMessageType() api.MessageType { return api.ReplyMessage } -func (m *HTTPStaticEnableReply) Size() int { +func (m *HTTPStaticEnableReply) Size() (size int) { if m == nil { return 0 } - var size int size += 4 // m.Retval return size } func (m *HTTPStaticEnableReply) 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 *HTTPStaticEnableReply) Unmarshal(b []byte) error { buf := codec.NewBuffer(b) - m.Retval = int32(buf.DecodeUint32()) + m.Retval = buf.DecodeInt32() return nil }