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.
This commit is contained in:
Andrew Gallant
2013-12-28 09:33:09 -05:00
committed by Přemysl Janouch
parent f0385db3a7
commit 2dc9914b5e
10 changed files with 57 additions and 57 deletions

View File

@@ -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 {