From 2dc9914b5e6b74c353771e56e90dfd2dd33e0202 Mon Sep 17 00:00:00 2001 From: Andrew Gallant Date: Sat, 28 Dec 2013 09:33:09 -0500 Subject: When writing, don't pad the length of bytes produced from inner structs/unions. Each type should take care of its own padding. Close #14. --- nexgb/record/record.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'nexgb/record/record.go') diff --git a/nexgb/record/record.go b/nexgb/record/record.go index 2644f13..3777422 100644 --- a/nexgb/record/record.go +++ b/nexgb/record/record.go @@ -213,13 +213,13 @@ func (v ExtRange) Bytes() []byte { { structBytes := v.Major.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } { structBytes := v.Minor.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } return buf @@ -315,43 +315,43 @@ func (v Range) Bytes() []byte { { structBytes := v.CoreRequests.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } { structBytes := v.CoreReplies.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } { structBytes := v.ExtRequests.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } { structBytes := v.ExtReplies.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } { structBytes := v.DeliveredEvents.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } { structBytes := v.DeviceEvents.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } { structBytes := v.Errors.Bytes() copy(buf[b:], structBytes) - b += xgb.Pad(len(structBytes)) + b += len(structBytes) } if v.ClientStarted { -- cgit v1.2.3