diff options
author | aarzilli <alessandro.arzilli@gmail.com> | 2014-05-02 15:09:23 +0200 |
---|---|---|
committer | Přemysl Janouch <p@janouch.name> | 2018-09-08 16:49:22 +0200 |
commit | a548d9d0f7b889627c43b18811357fad88760b2d (patch) | |
tree | 0d4a0ad302d753638dfdb16159e03d1fb87b0872 /nexgb/res | |
parent | 1f8bd79abee5d96a41a934d1eb8c74e90ccbcc8f (diff) | |
download | haven-a548d9d0f7b889627c43b18811357fad88760b2d.tar.gz haven-a548d9d0f7b889627c43b18811357fad88760b2d.tar.xz haven-a548d9d0f7b889627c43b18811357fad88760b2d.zip |
Fix Issue #21: automatic calculation of alignment padding after lists
Diffstat (limited to 'nexgb/res')
-rw-r--r-- | nexgb/res/res.go | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/nexgb/res/res.go b/nexgb/res/res.go index 8311f95..dd53857 100644 --- a/nexgb/res/res.go +++ b/nexgb/res/res.go @@ -76,7 +76,7 @@ func (v Client) Bytes() []byte { xgb.Put32(buf[b:], v.ResourceMask) b += 4 - return buf + return buf[:b] } // ClientListBytes writes a list of Client values to a byte slice. @@ -135,7 +135,7 @@ func (v ClientIdSpec) Bytes() []byte { xgb.Put32(buf[b:], v.Mask) b += 4 - return buf + return buf[:b] } // ClientIdSpecListBytes writes a list of ClientIdSpec values to a byte slice. @@ -171,7 +171,6 @@ func ClientIdValueRead(buf []byte, v *ClientIdValue) int { v.Value[i] = xgb.Get32(buf[b:]) b += 4 } - b = xgb.Pad(b) return b } @@ -204,9 +203,8 @@ func (v ClientIdValue) Bytes() []byte { xgb.Put32(buf[b:], v.Value[i]) b += 4 } - b = xgb.Pad(b) - return buf + return buf[:b] } // ClientIdValueListBytes writes a list of ClientIdValue values to a byte slice. @@ -269,7 +267,7 @@ func (v ResourceIdSpec) Bytes() []byte { xgb.Put32(buf[b:], v.Type) b += 4 - return buf + return buf[:b] } // ResourceIdSpecListBytes writes a list of ResourceIdSpec values to a byte slice. @@ -340,7 +338,7 @@ func (v ResourceSizeSpec) Bytes() []byte { xgb.Put32(buf[b:], v.UseCount) b += 4 - return buf + return buf[:b] } // ResourceSizeSpecListBytes writes a list of ResourceSizeSpec values to a byte slice. @@ -403,7 +401,7 @@ func (v ResourceSizeValue) Bytes() []byte { b += ResourceSizeSpecListBytes(buf[b:], v.CrossReferences) - return buf + return buf[:b] } // ResourceSizeValueListBytes writes a list of ResourceSizeValue values to a byte slice. @@ -466,7 +464,7 @@ func (v Type) Bytes() []byte { xgb.Put32(buf[b:], v.Count) b += 4 - return buf + return buf[:b] } // TypeListBytes writes a list of Type values to a byte slice. |