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/res/res.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'nexgb/res') diff --git a/nexgb/res/res.go b/nexgb/res/res.go index 6b1a807..6e686b6 100644 --- a/nexgb/res/res.go +++ b/nexgb/res/res.go @@ -157,7 +157,7 @@ func ClientIdSpecListBytes(buf []byte, list []ClientIdSpec) int { type ClientIdValue struct { Spec ClientIdSpec Length uint32 - Value []uint32 // size: xgb.Pad((int(Length) * 4)) + Value []uint32 // size: xgb.Pad(((int(Length) / 4) * 4)) } // ClientIdValueRead reads a byte slice into a ClientIdValue value. @@ -170,8 +170,8 @@ func ClientIdValueRead(buf []byte, v *ClientIdValue) int { v.Length = xgb.Get32(buf[b:]) b += 4 - v.Value = make([]uint32, v.Length) - for i := 0; i < int(v.Length); i++ { + v.Value = make([]uint32, (int(v.Length) / 4)) + for i := 0; i < int((int(v.Length) / 4)); i++ { v.Value[i] = xgb.Get32(buf[b:]) b += 4 } @@ -191,7 +191,7 @@ func ClientIdValueReadList(buf []byte, dest []ClientIdValue) int { // Bytes writes a ClientIdValue value to a byte slice. func (v ClientIdValue) Bytes() []byte { - buf := make([]byte, (12 + xgb.Pad((int(v.Length) * 4)))) + buf := make([]byte, (12 + xgb.Pad(((int(v.Length) / 4) * 4)))) b := 0 { @@ -203,7 +203,7 @@ func (v ClientIdValue) Bytes() []byte { xgb.Put32(buf[b:], v.Length) b += 4 - for i := 0; i < int(v.Length); i++ { + for i := 0; i < int((int(v.Length) / 4)); i++ { xgb.Put32(buf[b:], v.Value[i]) b += 4 } @@ -227,7 +227,7 @@ func ClientIdValueListBytes(buf []byte, list []ClientIdValue) int { func ClientIdValueListSize(list []ClientIdValue) int { size := 0 for _, item := range list { - size += (12 + xgb.Pad((int(item.Length) * 4))) + size += (12 + xgb.Pad(((int(item.Length) / 4) * 4))) } return size } -- cgit v1.2.3-70-g09d2