diff options
-rw-r--r-- | nexgb/examples/randr/main.go | 3 | ||||
-rw-r--r-- | nexgb/xgbgen/aligngap.go | 24 | ||||
-rw-r--r-- | nexgb/xgbgen/go_request_reply.go | 3 |
3 files changed, 11 insertions, 19 deletions
diff --git a/nexgb/examples/randr/main.go b/nexgb/examples/randr/main.go index ac6fb7a..01ad594 100644 --- a/nexgb/examples/randr/main.go +++ b/nexgb/examples/randr/main.go @@ -49,7 +49,8 @@ func main() { bestMode := info.Modes[0] for _, mode := range resources.Modes { if mode.Id == uint32(bestMode) { - fmt.Printf("Width: %d, Height: %d\n", mode.Width, mode.Height) + fmt.Printf("Width: %d, Height: %d\n", + mode.Width, mode.Height) } } } diff --git a/nexgb/xgbgen/aligngap.go b/nexgb/xgbgen/aligngap.go index 1e07e18..0cd7ac4 100644 --- a/nexgb/xgbgen/aligngap.go +++ b/nexgb/xgbgen/aligngap.go @@ -20,9 +20,11 @@ func (p *Protocol) AddAlignGaps() { } } for i := range p.Requests { - p.Requests[i].Fields = addAlignGapsToFields(p.Requests[i].xmlName, p.Requests[i].Fields) + p.Requests[i].Fields = addAlignGapsToFields( + p.Requests[i].xmlName, p.Requests[i].Fields) if p.Requests[i].Reply != nil { - p.Requests[i].Reply.Fields = addAlignGapsToFields(p.Requests[i].xmlName, p.Requests[i].Reply.Fields) + p.Requests[i].Reply.Fields = addAlignGapsToFields( + p.Requests[i].xmlName, p.Requests[i].Reply.Fields) } } } @@ -57,17 +59,16 @@ func addAlignGapsToFields(name string, fields []Field) []Field { case sz >= 4: r = append(r, &PadField{0, 4}) } - case *LocalField: // nothing - default: - fmt.Fprintf(os.Stderr, "Can't add alignment gaps, mix of list and non-list fields: %s\n", name) + fmt.Fprintf(os.Stderr, + "Can't add alignment gaps, mix of list and non-list "+ + "fields: %s\n", name) return fields } r = append(r, fields[i]) } - return r } @@ -75,22 +76,16 @@ func xcbSizeOfField(fld Field) int { switch f := fld.(type) { case *PadField: return int(f.Bytes) - case *SingleField: return xcbSizeOfType(f.Type) - case *ListField: return 0 - case *ExprField: return xcbSizeOfType(f.Type) - case *ValueField: return xcbSizeOfType(f.MaskType) - case *SwitchField: return 0 - default: return 0 } @@ -100,20 +95,16 @@ func xcbSizeOfType(typ Type) int { switch t := typ.(type) { case *Resource: return 4 - case *TypeDef: return t.Size().Eval() - case *Base: return t.Size().Eval() - case *Struct: sz := 0 for i := range t.Fields { sz += xcbSizeOfField(t.Fields[i]) } return sz - case *Union: sz := 0 for i := range t.Fields { @@ -123,7 +114,6 @@ func xcbSizeOfType(typ Type) int { } } return sz - default: return 0 } diff --git a/nexgb/xgbgen/go_request_reply.go b/nexgb/xgbgen/go_request_reply.go index d82e157..c1b9ee9 100644 --- a/nexgb/xgbgen/go_request_reply.go +++ b/nexgb/xgbgen/go_request_reply.go @@ -155,7 +155,8 @@ func (r *Request) WriteRequest(c *Context) { return } c.Putln("b = xgb.Pad(b)") - c.Putln("xgb.Put16(buf[blen:], uint16(b / 4)) // write request size in 4-byte units") + c.Putln("xgb.Put16(buf[blen:], uint16(b / 4)) " + + "// write request size in 4-byte units") c.Putln("return buf[:b]") } c.Putln("// Write request to wire for %s", r.SrcName()) |