1
0
mirror of https://github.com/golang/go synced 2024-11-25 22:57:58 -07:00

asn1: marshal true as 255, not 1.

OS X, at least, appears to test |byte == 255|, not |byte != 0| to
establish if a bool is true or false.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4128064
This commit is contained in:
Adam Langley 2011-02-05 13:55:37 -05:00
parent 5626bd9e38
commit 566d432f54

View File

@ -317,7 +317,7 @@ func marshalBody(out *forkableWriter, value reflect.Value, params fieldParameter
switch v := value.(type) { switch v := value.(type) {
case *reflect.BoolValue: case *reflect.BoolValue:
if v.Get() { if v.Get() {
return out.WriteByte(1) return out.WriteByte(255)
} else { } else {
return out.WriteByte(0) return out.WriteByte(0)
} }