aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xproto/xproto.go
diff options
context:
space:
mode:
Diffstat (limited to 'nexgb/xproto/xproto.go')
-rw-r--r--nexgb/xproto/xproto.go14
1 files changed, 12 insertions, 2 deletions
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
}