Skip to content

Commit e86e848

Browse files
authored
Merge pull request #406 from TarsCloud/fix/read/bool
fixbug: cpp calling go service bool reads as false when default is true
2 parents 8c6b567 + 4a2b703 commit e86e848

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tars/protocol/codec/codec.go

+3
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,9 @@ func (b *Reader) ReadUint8(data *uint8, tag byte, require bool) error {
642642
// ReadBool reads the bool value for the tag and the require or optional sign.
643643
func (b *Reader) ReadBool(data *bool, tag byte, require bool) error {
644644
var tmp int8
645+
if *data {
646+
tmp = 1
647+
}
645648
err := b.ReadInt8(&tmp, tag, require)
646649
if err != nil {
647650
return err

0 commit comments

Comments
 (0)