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