aboutsummaryrefslogtreecommitdiff
path: root/nexgb/xgbgen/go_single_field.go
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2013-12-28 09:33:09 -0500
committerPřemysl Janouch <p@janouch.name>2018-09-08 16:49:20 +0200
commit2dc9914b5e6b74c353771e56e90dfd2dd33e0202 (patch)
tree8b9c5a460be7a11c23d46be1887ebcaee1eb33b7 /nexgb/xgbgen/go_single_field.go
parentf0385db3a71c33f19d27dafb2a5d158a8a875200 (diff)
downloadhaven-2dc9914b5e6b74c353771e56e90dfd2dd33e0202.tar.gz
haven-2dc9914b5e6b74c353771e56e90dfd2dd33e0202.tar.xz
haven-2dc9914b5e6b74c353771e56e90dfd2dd33e0202.zip
When writing, don't pad the length of bytes produced from inner
structs/unions. Each type should take care of its own padding. Close #14.
Diffstat (limited to 'nexgb/xgbgen/go_single_field.go')
-rw-r--r--nexgb/xgbgen/go_single_field.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/nexgb/xgbgen/go_single_field.go b/nexgb/xgbgen/go_single_field.go
index 3e3fa53..6c7218e 100644
--- a/nexgb/xgbgen/go_single_field.go
+++ b/nexgb/xgbgen/go_single_field.go
@@ -152,13 +152,13 @@ func (f *SingleField) Write(c *Context, prefix string) {
c.Putln("{")
c.Putln("unionBytes := %s%s.Bytes()", prefix, f.SrcName())
c.Putln("copy(buf[b:], unionBytes)")
- c.Putln("b += xgb.Pad(len(unionBytes))")
+ c.Putln("b += len(unionBytes)")
c.Putln("}")
case *Struct:
c.Putln("{")
c.Putln("structBytes := %s%s.Bytes()", prefix, f.SrcName())
c.Putln("copy(buf[b:], structBytes)")
- c.Putln("b += xgb.Pad(len(structBytes))")
+ c.Putln("b += len(structBytes)")
c.Putln("}")
default:
log.Fatalf("Cannot read field '%s' with %T type.", f.XmlName(), f.Type)