aboutsummaryrefslogtreecommitdiffstats
path: root/binapigen/gen_encoding.go
diff options
context:
space:
mode:
Diffstat (limited to 'binapigen/gen_encoding.go')
-rw-r--r--binapigen/gen_encoding.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/binapigen/gen_encoding.go b/binapigen/gen_encoding.go
index d946771..ca1e848 100644
--- a/binapigen/gen_encoding.go
+++ b/binapigen/gen_encoding.go
@@ -21,10 +21,6 @@ import (
"github.com/sirupsen/logrus"
)
-func init() {
- //RegisterPlugin("encoding", GenerateEncoding)
-}
-
func genMessageSize(g *GenFile, name string, fields []*Field) {
g.P("func (m *", name, ") Size() (size int) {")
g.P("if m == nil { return 0 }")
@@ -230,7 +226,7 @@ func encodeBaseType(g *GenFile, typ, orig, name string, length int, sizefrom str
g.P("buf.EncodeBytes(", name, "[:], ", length, ")")
}
return
- case I8, I16, U16, I32, U32, I64, U64, F64:
+ case I8, I16, U16, I32, U32, I64, U64, F64, BOOL:
gotype := BaseTypesGo[typ]
if length != 0 {
g.P("for i := 0; i < ", length, "; i++ {")
@@ -268,7 +264,7 @@ func encodeBaseType(g *GenFile, typ, orig, name string, length int, sizefrom str
}
if isArray {
switch typ {
- case I8, U8, I16, U16, I32, U32, I64, U64, F64:
+ case I8, U8, I16, U16, I32, U32, I64, U64, F64, BOOL:
g.P("}")
}
}
@@ -369,7 +365,7 @@ func decodeBaseType(g *GenFile, typ, orig, name string, length int, sizefrom str
g.P("copy(", name, "[:], buf.DecodeBytes(", size, "))")
}
return
- case I8, I16, U16, I32, U32, I64, U64, F64:
+ case I8, I16, U16, I32, U32, I64, U64, F64, BOOL:
if alloc {
g.P(name, " = make([]", orig, ", ", size, ")")
}
@@ -401,7 +397,7 @@ func decodeBaseType(g *GenFile, typ, orig, name string, length int, sizefrom str
}
if isArray {
switch typ {
- case I8, U8, I16, U16, I32, U32, I64, U64, F64:
+ case I8, U8, I16, U16, I32, U32, I64, U64, F64, BOOL:
g.P("}")
}
}