diff options
| author | jEzEk <[email protected]> | 2022-11-05 21:22:59 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-11-05 21:22:59 +0100 |
| commit | a57abb570aeba12f867c58afe22ce49ac5db4872 (patch) | |
| tree | 41f7f8fdc1ec903272515c18a0751041702da69e /res/res.go | |
| parent | 7effddcf465f2b8e142c828c90951614922d9b32 (diff) | |
| parent | ba0b8dd42f220cde96737bbd61d87f1bc136824e (diff) | |
Merge pull request #10 from gen2brain/masterv1.1.0
Support for xcb-proto version 1.15.2, #issue 9
Diffstat (limited to 'res/res.go')
| -rw-r--r-- | res/res.go | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -152,7 +152,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. @@ -165,8 +165,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 } @@ -186,7 +186,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 { @@ -198,7 +198,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 } @@ -222,7 +222,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 } |
