From 139c50b7488ee2277be7d9b0eee8d807af628932 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Sun, 30 Sep 2018 16:46:08 +0200 Subject: nexgb: update to xcb-proto 1.13 --- nexgb/xproto/xproto.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'nexgb/xproto') diff --git a/nexgb/xproto/xproto.go b/nexgb/xproto/xproto.go index 82f893d..fc3bfe0 100644 --- a/nexgb/xproto/xproto.go +++ b/nexgb/xproto/xproto.go @@ -5882,7 +5882,9 @@ type SetupRequest struct { AuthorizationProtocolDataLen uint16 // padding: 2 bytes AuthorizationProtocolName string // size: xgb.Pad((int(AuthorizationProtocolNameLen) * 1)) + // alignment gap to multiple of 4 AuthorizationProtocolData string // size: xgb.Pad((int(AuthorizationProtocolDataLen) * 1)) + // alignment gap to multiple of 4 } // SetupRequestRead reads a byte slice into a SetupRequest value. @@ -5915,6 +5917,8 @@ func SetupRequestRead(buf []byte, v *SetupRequest) int { b += int(v.AuthorizationProtocolNameLen) } + b = (b + 3) & ^3 // alignment gap + { byteString := make([]byte, v.AuthorizationProtocolDataLen) copy(byteString[:v.AuthorizationProtocolDataLen], buf[b:]) @@ -5922,6 +5926,8 @@ func SetupRequestRead(buf []byte, v *SetupRequest) int { b += int(v.AuthorizationProtocolDataLen) } + b = (b + 3) & ^3 // alignment gap + return b } @@ -5937,7 +5943,7 @@ func SetupRequestReadList(buf []byte, dest []SetupRequest) int { // Bytes writes a SetupRequest value to a byte slice. func (v SetupRequest) Bytes() []byte { - buf := make([]byte, ((12 + xgb.Pad((int(v.AuthorizationProtocolNameLen) * 1))) + xgb.Pad((int(v.AuthorizationProtocolDataLen) * 1)))) + buf := make([]byte, ((((12 + xgb.Pad((int(v.AuthorizationProtocolNameLen) * 1))) + 4) + xgb.Pad((int(v.AuthorizationProtocolDataLen) * 1))) + 4)) b := 0 buf[b] = v.ByteOrder @@ -5962,9 +5968,13 @@ func (v SetupRequest) Bytes() []byte { copy(buf[b:], v.AuthorizationProtocolName[:v.AuthorizationProtocolNameLen]) b += int(v.AuthorizationProtocolNameLen) + b = (b + 3) & ^3 // alignment gap + copy(buf[b:], v.AuthorizationProtocolData[:v.AuthorizationProtocolDataLen]) b += int(v.AuthorizationProtocolDataLen) + b = (b + 3) & ^3 // alignment gap + return buf[:b] } @@ -5984,7 +5994,7 @@ func SetupRequestListBytes(buf []byte, list []SetupRequest) int { func SetupRequestListSize(list []SetupRequest) int { size := 0 for _, item := range list { - size += ((12 + xgb.Pad((int(item.AuthorizationProtocolNameLen) * 1))) + xgb.Pad((int(item.AuthorizationProtocolDataLen) * 1))) + size += ((((12 + xgb.Pad((int(item.AuthorizationProtocolNameLen) * 1))) + 4) + xgb.Pad((int(item.AuthorizationProtocolDataLen) * 1))) + 4) } return size } -- cgit v1.2.3-70-g09d2