aboutsummaryrefslogtreecommitdiff
path: root/nexgb/record
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2013-08-11 20:54:15 -0400
committerPřemysl Janouch <p@janouch.name>2018-09-08 16:49:18 +0200
commit38b293e74db6631873d5dfd74cf731eb7b76737d (patch)
treeaca66c5633a1c2e823318efdd05ff5ff996f4021 /nexgb/record
parentb06a8ca97625c1134449c3af65d9ac3fb251a613 (diff)
downloadhaven-38b293e74db6631873d5dfd74cf731eb7b76737d.tar.gz
haven-38b293e74db6631873d5dfd74cf731eb7b76737d.tar.xz
haven-38b293e74db6631873d5dfd74cf731eb7b76737d.zip
Padding on a list is on the length of the list.
There was a bug where padding was being computed on each element of the list. Close #5.
Diffstat (limited to 'nexgb/record')
-rw-r--r--nexgb/record/record.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/nexgb/record/record.go b/nexgb/record/record.go
index 8cb495e..2644f13 100644
--- a/nexgb/record/record.go
+++ b/nexgb/record/record.go
@@ -143,9 +143,9 @@ func ClientInfoListBytes(buf []byte, list []ClientInfo) int {
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ b += len(structBytes)
}
- return b
+ return xgb.Pad(b)
}
// ClientInfoListSize computes the size (bytes) of a list of ClientInfo values.
@@ -232,9 +232,9 @@ func ExtRangeListBytes(buf []byte, list []ExtRange) int {
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ b += len(structBytes)
}
- return b
+ return xgb.Pad(b)
}
const (
@@ -378,9 +378,9 @@ func RangeListBytes(buf []byte, list []Range) int {
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ b += len(structBytes)
}
- return b
+ return xgb.Pad(b)
}
type Range16 struct {
@@ -432,9 +432,9 @@ func Range16ListBytes(buf []byte, list []Range16) int {
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ b += len(structBytes)
}
- return b
+ return xgb.Pad(b)
}
type Range8 struct {
@@ -486,9 +486,9 @@ func Range8ListBytes(buf []byte, list []Range8) int {
for _, item := range list {
structBytes = item.Bytes()
copy(buf[b:], structBytes)
- b += xgb.Pad(len(structBytes))
+ b += len(structBytes)
}
- return b
+ return xgb.Pad(b)
}
// Skipping definition for base type 'Bool'