fix openbsd
This commit is contained in:
parent
022e46f65e
commit
6476ebc781
524 changed files with 36106 additions and 11790 deletions
22
vendor/google.golang.org/protobuf/proto/decode.go
generated
vendored
22
vendor/google.golang.org/protobuf/proto/decode.go
generated
vendored
|
|
@ -47,10 +47,18 @@ type UnmarshalOptions struct {
|
|||
// RecursionLimit limits how deeply messages may be nested.
|
||||
// If zero, a default limit is applied.
|
||||
RecursionLimit int
|
||||
|
||||
//
|
||||
// NoLazyDecoding turns off lazy decoding, which otherwise is enabled by
|
||||
// default. Lazy decoding only affects submessages (annotated with [lazy =
|
||||
// true] in the .proto file) within messages that use the Opaque API.
|
||||
NoLazyDecoding bool
|
||||
}
|
||||
|
||||
// Unmarshal parses the wire-format message in b and places the result in m.
|
||||
// The provided message must be mutable (e.g., a non-nil pointer to a message).
|
||||
//
|
||||
// See the [UnmarshalOptions] type if you need more control.
|
||||
func Unmarshal(b []byte, m Message) error {
|
||||
_, err := UnmarshalOptions{RecursionLimit: protowire.DefaultRecursionLimit}.unmarshal(b, m.ProtoReflect())
|
||||
return err
|
||||
|
|
@ -69,7 +77,7 @@ func (o UnmarshalOptions) Unmarshal(b []byte, m Message) error {
|
|||
// UnmarshalState parses a wire-format message and places the result in m.
|
||||
//
|
||||
// This method permits fine-grained control over the unmarshaler.
|
||||
// Most users should use Unmarshal instead.
|
||||
// Most users should use [Unmarshal] instead.
|
||||
func (o UnmarshalOptions) UnmarshalState(in protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
|
||||
if o.RecursionLimit == 0 {
|
||||
o.RecursionLimit = protowire.DefaultRecursionLimit
|
||||
|
|
@ -102,6 +110,16 @@ func (o UnmarshalOptions) unmarshal(b []byte, m protoreflect.Message) (out proto
|
|||
if o.DiscardUnknown {
|
||||
in.Flags |= protoiface.UnmarshalDiscardUnknown
|
||||
}
|
||||
|
||||
if !allowPartial {
|
||||
// This does not affect how current unmarshal functions work, it just allows them
|
||||
// to record this for lazy the decoding case.
|
||||
in.Flags |= protoiface.UnmarshalCheckRequired
|
||||
}
|
||||
if o.NoLazyDecoding {
|
||||
in.Flags |= protoiface.UnmarshalNoLazyDecoding
|
||||
}
|
||||
|
||||
out, err = methods.Unmarshal(in)
|
||||
} else {
|
||||
o.RecursionLimit--
|
||||
|
|
@ -154,7 +172,7 @@ func (o UnmarshalOptions) unmarshalMessageSlow(b []byte, m protoreflect.Message)
|
|||
var err error
|
||||
if fd == nil {
|
||||
err = errUnknown
|
||||
} else if flags.ProtoLegacy {
|
||||
} else if flags.ProtoLegacyWeak {
|
||||
if fd.IsWeak() && fd.Message().IsPlaceholder() {
|
||||
err = errUnknown // weak referent is not linked in
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue