Skip to content

Commit

Permalink
fix(jce): ToByes lost some fields of SvcReqRegisterNew (Mrs4s#217)
Browse files Browse the repository at this point in the history
  • Loading branch information
fumiama committed Dec 11, 2021
1 parent 416a6c1 commit 45692b7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions binary/jce/gen/structs_parser_tmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ func writeObject(w io.Writer, v reflect.Value, tag byte, name string) {
w.Write([]byte(fmt.Sprintf("\tw.WriteInt64(int64(pkt.%s), %d)\n", name, tag)))
case reflect.String:
w.Write([]byte(fmt.Sprintf("\tw.WriteString(pkt.%s, %d)\n", name, tag)))
case reflect.Interface, reflect.Ptr:
w.Write([]byte(fmt.Sprintf("\tw.writeHead(10, %d)\n", tag)))
w.Write([]byte(fmt.Sprintf("\tw.buf.Write(pkt.%s.ToBytes())\n", name)))
w.Write([]byte("\tw.writeHead(11, 0)\n"))
default:
switch v.Interface().(type) {
case float32:
w.Write([]byte(fmt.Sprintf("\tw.WriteFloat32(pkt.%s, %d)\n", name, tag)))
case float64:
w.Write([]byte(fmt.Sprintf("\tw.WriteFloat64(pkt.%s, %d)\n", name, tag)))
case IJceStruct:
w.Write([]byte(fmt.Sprintf("\tw.writeHead(10, %d)\n", tag)))
w.Write([]byte(fmt.Sprintf("\tw.buf.Write(pkt.%s.ToBytes())\n", name)))
w.Write([]byte("\tw.writeHead(11, 0)\n"))
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions binary/jce/structs_tobytes.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 45692b7

Please sign in to comment.