diff options
author | Andrew Gallant <jamslam@gmail.com> | 2013-08-11 20:54:15 -0400 |
---|---|---|
committer | Přemysl Janouch <p@janouch.name> | 2018-09-08 16:49:18 +0200 |
commit | 38b293e74db6631873d5dfd74cf731eb7b76737d (patch) | |
tree | aca66c5633a1c2e823318efdd05ff5ff996f4021 /nexgb/xv | |
parent | b06a8ca97625c1134449c3af65d9ac3fb251a613 (diff) | |
download | haven-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/xv')
-rw-r--r-- | nexgb/xv/xv.go | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/nexgb/xv/xv.go b/nexgb/xv/xv.go index 0a88632..5eefe77 100644 --- a/nexgb/xv/xv.go +++ b/nexgb/xv/xv.go @@ -130,9 +130,9 @@ func AdaptorInfoListBytes(buf []byte, list []AdaptorInfo) 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) } // AdaptorInfoListSize computes the size (bytes) of a list of AdaptorInfo values. @@ -223,9 +223,9 @@ func AttributeInfoListBytes(buf []byte, list []AttributeInfo) 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) } // AttributeInfoListSize computes the size (bytes) of a list of AttributeInfo values. @@ -474,9 +474,9 @@ func EncodingInfoListBytes(buf []byte, list []EncodingInfo) 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) } // EncodingInfoListSize computes the size (bytes) of a list of EncodingInfo values. @@ -542,9 +542,9 @@ func FormatListBytes(buf []byte, list []Format) 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 ( @@ -662,9 +662,9 @@ func ImageListBytes(buf []byte, list []Image) 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) } // ImageListSize computes the size (bytes) of a list of Image values. @@ -892,9 +892,9 @@ func ImageFormatInfoListBytes(buf []byte, list []ImageFormatInfo) 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) } // ImageFormatInfoListSize computes the size (bytes) of a list of ImageFormatInfo values. @@ -1062,9 +1062,9 @@ func RationalListBytes(buf []byte, list []Rational) 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 ( |