encoding/protowire: make package publicly available
Change-Id: I95e293c208e787a91d50e29817620535dfeaa7f2
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/219838
Reviewed-by: Damien Neil <dneil@google.com>
diff --git a/cmd/protoc-gen-go/internal_gengo/init.go b/cmd/protoc-gen-go/internal_gengo/init.go
index ffa7f00..369df13 100644
--- a/cmd/protoc-gen-go/internal_gengo/init.go
+++ b/cmd/protoc-gen-go/internal_gengo/init.go
@@ -9,7 +9,7 @@
"unicode/utf8"
"google.golang.org/protobuf/compiler/protogen"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/types/descriptorpb"
)
@@ -146,13 +146,13 @@
// annotation proto from protoc-gen-go.
b := m.Desc.Options().(*descriptorpb.MessageOptions).ProtoReflect().GetUnknown()
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
- if num == trackFieldUse_fieldNumber && typ == wire.VarintType {
- v, _ := wire.ConsumeVarint(b)
- tracked = wire.DecodeBool(v)
+ if num == trackFieldUse_fieldNumber && typ == protowire.VarintType {
+ v, _ := protowire.ConsumeVarint(b)
+ tracked = protowire.DecodeBool(v)
}
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
return tracked
diff --git a/encoding/prototext/encode.go b/encoding/prototext/encode.go
index 7801791..83b65a6 100644
--- a/encoding/prototext/encode.go
+++ b/encoding/prototext/encode.go
@@ -10,9 +10,9 @@
"strconv"
"unicode/utf8"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/encoding/messageset"
"google.golang.org/protobuf/internal/encoding/text"
- "google.golang.org/protobuf/internal/encoding/wire"
"google.golang.org/protobuf/internal/errors"
"google.golang.org/protobuf/internal/fieldnum"
"google.golang.org/protobuf/internal/flags"
@@ -336,31 +336,31 @@
const dec = 10
const hex = 16
for len(b) > 0 {
- num, wtype, n := wire.ConsumeTag(b)
+ num, wtype, n := protowire.ConsumeTag(b)
b = b[n:]
e.WriteName(strconv.FormatInt(int64(num), dec))
switch wtype {
- case wire.VarintType:
+ case protowire.VarintType:
var v uint64
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
e.WriteUint(v)
- case wire.Fixed32Type:
+ case protowire.Fixed32Type:
var v uint32
- v, n = wire.ConsumeFixed32(b)
+ v, n = protowire.ConsumeFixed32(b)
e.WriteLiteral("0x" + strconv.FormatUint(uint64(v), hex))
- case wire.Fixed64Type:
+ case protowire.Fixed64Type:
var v uint64
- v, n = wire.ConsumeFixed64(b)
+ v, n = protowire.ConsumeFixed64(b)
e.WriteLiteral("0x" + strconv.FormatUint(v, hex))
- case wire.BytesType:
+ case protowire.BytesType:
var v []byte
- v, n = wire.ConsumeBytes(b)
+ v, n = protowire.ConsumeBytes(b)
e.WriteString(string(v))
- case wire.StartGroupType:
+ case protowire.StartGroupType:
e.StartMessage()
var v []byte
- v, n = wire.ConsumeGroup(num, b)
+ v, n = protowire.ConsumeGroup(num, b)
e.marshalUnknown(v)
e.EndMessage()
default:
diff --git a/internal/encoding/wire/wire.go b/encoding/protowire/wire.go
similarity index 98%
rename from internal/encoding/wire/wire.go
rename to encoding/protowire/wire.go
index e624ff8..a427f8b 100644
--- a/internal/encoding/wire/wire.go
+++ b/encoding/protowire/wire.go
@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// Package wire parses and formats the protobuf wire encoding.
-//
+// Package protowire parses and formats the raw wire encoding.
// See https://developers.google.com/protocol-buffers/docs/encoding.
-package wire
+//
+// For marshaling and unmarshaling entire protobuf messages,
+// use the "google.golang.org/protobuf/proto" package instead.
+package protowire
import (
"io"
diff --git a/internal/encoding/wire/wire_test.go b/encoding/protowire/wire_test.go
similarity index 99%
rename from internal/encoding/wire/wire_test.go
rename to encoding/protowire/wire_test.go
index f82a526..10ec7f8 100644
--- a/internal/encoding/wire/wire_test.go
+++ b/encoding/protowire/wire_test.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-package wire
+package protowire
import (
"bytes"
diff --git a/internal/cmd/generate-types/impl.go b/internal/cmd/generate-types/impl.go
index 2328de2..932c8b0 100644
--- a/internal/cmd/generate-types/impl.go
+++ b/internal/cmd/generate-types/impl.go
@@ -31,21 +31,21 @@
*/ -}}
{{- define "Size" -}}
{{- if .WireType.ConstSize -}}
-wire.Size{{.WireType}}()
+protowire.Size{{.WireType}}()
{{- else if eq .WireType "Bytes" -}}
-wire.SizeBytes(len({{.FromGoType}}))
+protowire.SizeBytes(len({{.FromGoType}}))
{{- else -}}
-wire.Size{{.WireType}}({{.FromGoType}})
+protowire.Size{{.WireType}}({{.FromGoType}})
{{- end -}}
{{- end -}}
{{- define "SizeValue" -}}
{{- if .WireType.ConstSize -}}
-wire.Size{{.WireType}}()
+protowire.Size{{.WireType}}()
{{- else if eq .WireType "Bytes" -}}
-wire.SizeBytes(len({{.FromValue}}))
+protowire.SizeBytes(len({{.FromValue}}))
{{- else -}}
-wire.Size{{.WireType}}({{.FromValue}})
+protowire.Size{{.WireType}}({{.FromValue}})
{{- end -}}
{{- end -}}
@@ -54,23 +54,23 @@
*/ -}}
{{- define "Append" -}}
{{- if eq .Name "String" -}}
-b = wire.AppendString(b, {{.FromGoType}})
+b = protowire.AppendString(b, {{.FromGoType}})
{{- else -}}
-b = wire.Append{{.WireType}}(b, {{.FromGoType}})
+b = protowire.Append{{.WireType}}(b, {{.FromGoType}})
{{- end -}}
{{- end -}}
{{- define "AppendValue" -}}
{{- if eq .Name "String" -}}
-b = wire.AppendString(b, {{.FromValue}})
+b = protowire.AppendString(b, {{.FromValue}})
{{- else -}}
-b = wire.Append{{.WireType}}(b, {{.FromValue}})
+b = protowire.Append{{.WireType}}(b, {{.FromValue}})
{{- end -}}
{{- end -}}
{{- define "Consume" -}}
{{- if eq .Name "String" -}}
-v, n := wire.ConsumeString(b)
+v, n := protowire.ConsumeString(b)
{{- else if eq .WireType "Varint" -}}
var v uint64
var n int
@@ -81,10 +81,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
{{- else -}}
-v, n := wire.Consume{{.WireType}}(b)
+v, n := protowire.Consume{{.WireType}}(b)
{{- end -}}
{{- end -}}
@@ -102,19 +102,19 @@
// append{{.Name}} wire encodes a {{.GoType}} pointer as a {{.Name}}.
func append{{.Name}}(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.{{.GoType.PointerMethod}}()
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
{{template "Append" .}}
return b, nil
}
// consume{{.Name}} wire decodes a {{.GoType}} pointer as a {{.Name}}.
-func consume{{.Name}}(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consume{{.Name}}(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
if wtyp != {{.WireType.Expr}} {
return out, errUnknown
}
{{template "Consume" .}}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*p.{{.GoType.PointerMethod}}() = {{.ToGoType}}
out.n = n
@@ -132,7 +132,7 @@
// append{{.Name}}ValidateUTF8 wire encodes a {{.GoType}} pointer as a {{.Name}}.
func append{{.Name}}ValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.{{.GoType.PointerMethod}}()
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
{{template "Append" .}}
if !utf8.Valid{{if eq .Name "String"}}String{{end}}(v) {
return b, errInvalidUTF8{}
@@ -141,13 +141,13 @@
}
// consume{{.Name}}ValidateUTF8 wire decodes a {{.GoType}} pointer as a {{.Name}}.
-func consume{{.Name}}ValidateUTF8(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consume{{.Name}}ValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
if wtyp != {{.WireType.Expr}} {
return out, errUnknown
}
{{template "Consume" .}}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
if !utf8.Valid{{if eq .Name "String"}}String{{end}}(v) {
return out, errInvalidUTF8{}
@@ -182,7 +182,7 @@
if {{template "IsZero" .}} {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
{{template "Append" .}}
return b, nil
}
@@ -190,13 +190,13 @@
{{if .ToGoTypeNoZero}}
// consume{{.Name}}NoZero wire decodes a {{.GoType}} pointer as a {{.Name}}.
// The zero value is not decoded.
-func consume{{.Name}}NoZero(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consume{{.Name}}NoZero(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
if wtyp != {{.WireType.Expr}} {
return out, errUnknown
}
{{template "Consume" .}}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*p.{{.GoType.PointerMethod}}() = {{.ToGoTypeNoZero}}
out.n = n
@@ -219,7 +219,7 @@
if {{template "IsZero" .}} {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
{{template "Append" .}}
if !utf8.Valid{{if eq .Name "String"}}String{{end}}(v) {
return b, errInvalidUTF8{}
@@ -229,13 +229,13 @@
{{if .ToGoTypeNoZero}}
// consume{{.Name}}NoZeroValidateUTF8 wire decodes a {{.GoType}} pointer as a {{.Name}}.
-func consume{{.Name}}NoZeroValidateUTF8(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consume{{.Name}}NoZeroValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
if wtyp != {{.WireType.Expr}} {
return out, errUnknown
}
{{template "Consume" .}}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
if !utf8.Valid{{if eq .Name "String"}}String{{end}}(v) {
return out, errInvalidUTF8{}
@@ -268,19 +268,19 @@
// It panics if the pointer is nil.
func append{{.Name}}Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := **p.{{.GoType.PointerMethod}}Ptr()
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
{{template "Append" .}}
return b, nil
}
// consume{{.Name}}Ptr wire decodes a *{{.GoType}} pointer as a {{.Name}}.
-func consume{{.Name}}Ptr(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consume{{.Name}}Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
if wtyp != {{.WireType.Expr}} {
return out, errUnknown
}
{{template "Consume" .}}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
vp := p.{{.GoType.PointerMethod}}Ptr()
if *vp == nil {
@@ -316,26 +316,26 @@
func append{{.Name}}Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.{{.GoType.PointerMethod}}Slice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
{{template "Append" .}}
}
return b, nil
}
// consume{{.Name}}Slice wire decodes a []{{.GoType}} pointer as a repeated {{.Name}}.
-func consume{{.Name}}Slice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consume{{.Name}}Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.{{.GoType.PointerMethod}}Slice()
{{- if .WireType.Packable}}
- if wtyp == wire.BytesType {
+ if wtyp == protowire.BytesType {
s := *sp
- b, n := wire.ConsumeBytes(b)
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
for len(b) > 0 {
{{template "Consume" .}}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
s = append(s, {{.ToGoType}})
b = b[n:]
@@ -350,7 +350,7 @@
}
{{template "Consume" .}}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*sp = append(*sp, {{.ToGoType}})
out.n = n
@@ -369,7 +369,7 @@
func append{{.Name}}SliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.{{.GoType.PointerMethod}}Slice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
{{template "Append" .}}
if !utf8.Valid{{if eq .Name "String"}}String{{end}}(v) {
return b, errInvalidUTF8{}
@@ -379,14 +379,14 @@
}
// consume{{.Name}}SliceValidateUTF8 wire decodes a []{{.GoType}} pointer as a repeated {{.Name}}.
-func consume{{.Name}}SliceValidateUTF8(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consume{{.Name}}SliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.{{.GoType.PointerMethod}}Slice()
if wtyp != {{.WireType.Expr}} {
return out, errUnknown
}
{{template "Consume" .}}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
if !utf8.Valid{{if eq .Name "String"}}String{{end}}(v) {
return out, errInvalidUTF8{}
@@ -419,7 +419,7 @@
n += {{template "Size" .}}
}
{{- end}}
- return f.tagsize + wire.SizeBytes(n)
+ return f.tagsize + protowire.SizeBytes(n)
}
// append{{.Name}}PackedSlice encodes a []{{.GoType}} pointer as a packed repeated {{.Name}}.
@@ -428,7 +428,7 @@
if len(s) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
{{if .WireType.ConstSize -}}
n := len(s) * {{template "Size" .}}
{{- else -}}
@@ -437,7 +437,7 @@
n += {{template "Size" .}}
}
{{- end}}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for _, v := range s {
{{template "Append" .}}
}
@@ -462,19 +462,19 @@
// append{{.Name}}Value encodes a {{.GoType}} value as a {{.Name}}.
func append{{.Name}}Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, wiretag)
{{template "AppendValue" .}}
return b, nil
}
// consume{{.Name}}Value decodes a {{.GoType}} value as a {{.Name}}.
-func consume{{.Name}}Value(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consume{{.Name}}Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
if wtyp != {{.WireType.Expr}} {
return protoreflect.Value{}, out, errUnknown
}
{{template "Consume" .}}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
return {{.ToValue}}, out, nil
@@ -494,7 +494,7 @@
{{if (eq .Name "String")}}
// append{{.Name}}ValueValidateUTF8 encodes a {{.GoType}} value as a {{.Name}}.
func append{{.Name}}ValueValidateUTF8(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, wiretag)
{{template "AppendValue" .}}
if !utf8.ValidString({{.FromValue}}) {
return b, errInvalidUTF8{}
@@ -503,13 +503,13 @@
}
// consume{{.Name}}ValueValidateUTF8 decodes a {{.GoType}} value as a {{.Name}}.
-func consume{{.Name}}ValueValidateUTF8(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consume{{.Name}}ValueValidateUTF8(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
if wtyp != {{.WireType.Expr}} {
return protoreflect.Value{}, out, errUnknown
}
{{template "Consume" .}}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
if !utf8.ValidString(v) {
return protoreflect.Value{}, out, errInvalidUTF8{}
@@ -545,25 +545,25 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, wiretag)
{{template "AppendValue" .}}
}
return b, nil
}
// consume{{.Name}}SliceValue wire decodes a []{{.GoType}} value as a repeated {{.Name}}.
-func consume{{.Name}}SliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consume{{.Name}}SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
{{- if .WireType.Packable}}
- if wtyp == wire.BytesType {
- b, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
for len(b) > 0 {
{{template "Consume" .}}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append({{.ToValue}})
b = b[n:]
@@ -577,7 +577,7 @@
}
{{template "Consume" .}}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append({{.ToValue}})
out.n = n
@@ -612,7 +612,7 @@
n += {{template "SizeValue" .}}
}
{{- end}}
- return tagsize + wire.SizeBytes(n)
+ return tagsize + protowire.SizeBytes(n)
}
// append{{.Name}}PackedSliceValue encodes a []{{.GoType}} value as a packed repeated {{.Name}}.
@@ -622,7 +622,7 @@
if llen == 0 {
return b, nil
}
- b = wire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, wiretag)
{{if .WireType.ConstSize -}}
n := llen * {{template "SizeValue" .}}
{{- else -}}
@@ -632,7 +632,7 @@
n += {{template "SizeValue" .}}
}
{{- end}}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for i := 0; i < llen; i++ {
v := list.Get(i)
{{template "AppendValue" .}}
@@ -655,7 +655,7 @@
// We append to an empty array rather than a nil []byte to get non-nil zero-length byte slices.
var emptyBuf [0]byte
-var wireTypes = map[protoreflect.Kind]wire.Type{
+var wireTypes = map[protoreflect.Kind]protowire.Type{
{{range . -}}
protoreflect.{{.Name}}Kind: {{.WireType.Expr}},
{{end}}
diff --git a/internal/cmd/generate-types/main.go b/internal/cmd/generate-types/main.go
index bf1da2b..0d3e731 100644
--- a/internal/cmd/generate-types/main.go
+++ b/internal/cmd/generate-types/main.go
@@ -190,7 +190,7 @@
"unicode/utf8",
"",
"google.golang.org/protobuf/internal/descfmt",
- "google.golang.org/protobuf/internal/encoding/wire",
+ "google.golang.org/protobuf/encoding/protowire",
"google.golang.org/protobuf/internal/errors",
"google.golang.org/protobuf/internal/strs",
"google.golang.org/protobuf/internal/pragma",
diff --git a/internal/cmd/generate-types/proto.go b/internal/cmd/generate-types/proto.go
index 682f5f6..8ea491b 100644
--- a/internal/cmd/generate-types/proto.go
+++ b/internal/cmd/generate-types/proto.go
@@ -21,9 +21,9 @@
func (w WireType) Expr() Expr {
if w == WireGroup {
- return "wire.StartGroupType"
+ return "protowire.StartGroupType"
}
- return "wire." + Expr(w) + "Type"
+ return "protowire." + Expr(w) + "Type"
}
func (w WireType) Packable() bool {
@@ -113,11 +113,11 @@
{
Name: "Bool",
WireType: WireVarint,
- ToValue: "protoreflect.ValueOfBool(wire.DecodeBool(v))",
- FromValue: "wire.EncodeBool(v.Bool())",
+ ToValue: "protoreflect.ValueOfBool(protowire.DecodeBool(v))",
+ FromValue: "protowire.EncodeBool(v.Bool())",
GoType: GoBool,
- ToGoType: "wire.DecodeBool(v)",
- FromGoType: "wire.EncodeBool(v)",
+ ToGoType: "protowire.DecodeBool(v)",
+ FromGoType: "protowire.EncodeBool(v)",
},
{
Name: "Enum",
@@ -137,11 +137,11 @@
{
Name: "Sint32",
WireType: WireVarint,
- ToValue: "protoreflect.ValueOfInt32(int32(wire.DecodeZigZag(v & math.MaxUint32)))",
- FromValue: "wire.EncodeZigZag(int64(int32(v.Int())))",
+ ToValue: "protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32)))",
+ FromValue: "protowire.EncodeZigZag(int64(int32(v.Int())))",
GoType: GoInt32,
- ToGoType: "int32(wire.DecodeZigZag(v & math.MaxUint32))",
- FromGoType: "wire.EncodeZigZag(int64(v))",
+ ToGoType: "int32(protowire.DecodeZigZag(v & math.MaxUint32))",
+ FromGoType: "protowire.EncodeZigZag(int64(v))",
},
{
Name: "Uint32",
@@ -164,11 +164,11 @@
{
Name: "Sint64",
WireType: WireVarint,
- ToValue: "protoreflect.ValueOfInt64(wire.DecodeZigZag(v))",
- FromValue: "wire.EncodeZigZag(v.Int())",
+ ToValue: "protoreflect.ValueOfInt64(protowire.DecodeZigZag(v))",
+ FromValue: "protowire.EncodeZigZag(v.Int())",
GoType: GoInt64,
- ToGoType: "wire.DecodeZigZag(v)",
- FromGoType: "wire.EncodeZigZag(v)",
+ ToGoType: "protowire.DecodeZigZag(v)",
+ FromGoType: "protowire.EncodeZigZag(v)",
},
{
Name: "Uint64",
@@ -277,7 +277,7 @@
// unmarshalScalar decodes a value of the given kind.
//
// Message values are decoded into a []byte which aliases the input data.
-func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp wire.Type, fd protoreflect.FieldDescriptor) (val protoreflect.Value, n int, err error) {
+func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd protoreflect.FieldDescriptor) (val protoreflect.Value, n int, err error) {
switch fd.Kind() {
{{- range .}}
case {{.Expr}}:
@@ -285,12 +285,12 @@
return val, 0, errUnknown
}
{{if (eq .WireType "Group") -}}
- v, n := wire.ConsumeGroup(fd.Number(), b)
+ v, n := protowire.ConsumeGroup(fd.Number(), b)
{{- else -}}
- v, n := wire.Consume{{.WireType}}(b)
+ v, n := protowire.Consume{{.WireType}}(b)
{{- end}}
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
{{if (eq .Name "String") -}}
if strs.EnforceUTF8(fd) && !utf8.Valid(v) {
@@ -304,20 +304,20 @@
}
}
-func (o UnmarshalOptions) unmarshalList(b []byte, wtyp wire.Type, list protoreflect.List, fd protoreflect.FieldDescriptor) (n int, err error) {
+func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list protoreflect.List, fd protoreflect.FieldDescriptor) (n int, err error) {
switch fd.Kind() {
{{- range .}}
case {{.Expr}}:
{{- if .WireType.Packable}}
- if wtyp == wire.BytesType {
- buf, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ buf, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
for len(buf) > 0 {
- v, n := wire.Consume{{.WireType}}(buf)
+ v, n := protowire.Consume{{.WireType}}(buf)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
buf = buf[n:]
list.Append({{.ToValue}})
@@ -329,12 +329,12 @@
return 0, errUnknown
}
{{if (eq .WireType "Group") -}}
- v, n := wire.ConsumeGroup(fd.Number(), b)
+ v, n := protowire.ConsumeGroup(fd.Number(), b)
{{- else -}}
- v, n := wire.Consume{{.WireType}}(b)
+ v, n := protowire.Consume{{.WireType}}(b)
{{- end}}
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
{{if (eq .Name "String") -}}
if strs.EnforceUTF8(fd) && !utf8.Valid(v) {
@@ -366,7 +366,7 @@
}
var protoEncodeTemplate = template.Must(template.New("").Parse(`
-var wireTypes = map[protoreflect.Kind]wire.Type{
+var wireTypes = map[protoreflect.Kind]protowire.Type{
{{- range .}}
{{.Expr}}: {{.WireType.Expr}},
{{- end}}
@@ -380,7 +380,7 @@
if strs.EnforceUTF8(fd) && !utf8.ValidString(v.String()) {
return b, errors.InvalidUTF8(string(fd.FullName()))
}
- b = wire.AppendString(b, {{.FromValue}})
+ b = protowire.AppendString(b, {{.FromValue}})
{{- else if (eq .Name "Message") -}}
var pos int
var err error
@@ -396,9 +396,9 @@
if err != nil {
return b, err
}
- b = wire.AppendVarint(b, wire.EncodeTag(fd.Number(), wire.EndGroupType))
+ b = protowire.AppendVarint(b, protowire.EncodeTag(fd.Number(), protowire.EndGroupType))
{{- else -}}
- b = wire.Append{{.WireType}}(b, {{.FromValue}})
+ b = protowire.Append{{.WireType}}(b, {{.FromValue}})
{{- end}}
{{- end}}
default:
@@ -413,20 +413,20 @@
}
var protoSizeTemplate = template.Must(template.New("").Parse(`
-func sizeSingular(num wire.Number, kind protoreflect.Kind, v protoreflect.Value) int {
+func sizeSingular(num protowire.Number, kind protoreflect.Kind, v protoreflect.Value) int {
switch kind {
{{- range .}}
case {{.Expr}}:
{{if (eq .Name "Message") -}}
- return wire.SizeBytes(sizeMessage(v.Message()))
+ return protowire.SizeBytes(sizeMessage(v.Message()))
{{- else if or (eq .WireType "Fixed32") (eq .WireType "Fixed64") -}}
- return wire.Size{{.WireType}}()
+ return protowire.Size{{.WireType}}()
{{- else if (eq .WireType "Bytes") -}}
- return wire.Size{{.WireType}}(len({{.FromValue}}))
+ return protowire.Size{{.WireType}}(len({{.FromValue}}))
{{- else if (eq .WireType "Group") -}}
- return wire.Size{{.WireType}}(num, sizeMessage(v.Message()))
+ return protowire.Size{{.WireType}}(num, sizeMessage(v.Message()))
{{- else -}}
- return wire.Size{{.WireType}}({{.FromValue}})
+ return protowire.Size{{.WireType}}({{.FromValue}})
{{- end}}
{{- end}}
default:
diff --git a/internal/cmd/pbdump/pbdump.go b/internal/cmd/pbdump/pbdump.go
index 62e3a27..456fdb6 100644
--- a/internal/cmd/pbdump/pbdump.go
+++ b/internal/cmd/pbdump/pbdump.go
@@ -17,8 +17,8 @@
"strconv"
"strings"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/encoding/pack"
- "google.golang.org/protobuf/internal/encoding/wire"
"google.golang.org/protobuf/internal/errors"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protodesc"
@@ -142,7 +142,7 @@
// fields is a tree of fields, keyed by a field number.
// Fields representing messages or groups have sub-fields.
-type fields map[wire.Number]*field
+type fields map[protowire.Number]*field
type field struct {
kind protoreflect.Kind
sub fields // only for MessageKind or GroupKind
@@ -173,8 +173,8 @@
}
prefix = strings.TrimPrefix(prefix+"."+s[:i], ".")
n, _ := strconv.ParseInt(s[:i], 10, 32)
- num := wire.Number(n)
- if num < wire.MinValidNumber || wire.MaxValidNumber < num {
+ num := protowire.Number(n)
+ if num < protowire.MinValidNumber || protowire.MaxValidNumber < num {
return errors.New("invalid field: %v", prefix)
}
s = strings.TrimPrefix(s[i:], ".")
@@ -244,7 +244,7 @@
return m
}
-func (fs fields) sortedNums() (ns []wire.Number) {
+func (fs fields) sortedNums() (ns []protowire.Number) {
for n := range fs {
ns = append(ns, n)
}
diff --git a/internal/encoding/messageset/messageset.go b/internal/encoding/messageset/messageset.go
index 67c6173..b1eeea5 100644
--- a/internal/encoding/messageset/messageset.go
+++ b/internal/encoding/messageset/messageset.go
@@ -8,7 +8,7 @@
import (
"math"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/errors"
pref "google.golang.org/protobuf/reflect/protoreflect"
preg "google.golang.org/protobuf/reflect/protoregistry"
@@ -26,9 +26,9 @@
// }
// }
const (
- FieldItem = wire.Number(1)
- FieldTypeID = wire.Number(2)
- FieldMessage = wire.Number(3)
+ FieldItem = protowire.Number(1)
+ FieldTypeID = protowire.Number(2)
+ FieldMessage = protowire.Number(3)
)
// ExtensionName is the field name for extensions of MessageSet.
@@ -79,8 +79,8 @@
// SizeField returns the size of a MessageSet item field containing an extension
// with the given field number, not counting the contents of the message subfield.
-func SizeField(num wire.Number) int {
- return 2*wire.SizeTag(FieldItem) + wire.SizeTag(FieldTypeID) + wire.SizeVarint(uint64(num))
+func SizeField(num protowire.Number) int {
+ return 2*protowire.SizeTag(FieldItem) + protowire.SizeTag(FieldTypeID) + protowire.SizeVarint(uint64(num))
}
// Unmarshal parses a MessageSet.
@@ -90,17 +90,17 @@
//
// If wantLen is true, the item values include the varint length prefix.
// This is ugly, but simplifies the fast-path decoder in internal/impl.
-func Unmarshal(b []byte, wantLen bool, fn func(typeID wire.Number, value []byte) error) error {
+func Unmarshal(b []byte, wantLen bool, fn func(typeID protowire.Number, value []byte) error) error {
for len(b) > 0 {
- num, wtyp, n := wire.ConsumeTag(b)
+ num, wtyp, n := protowire.ConsumeTag(b)
if n < 0 {
- return wire.ParseError(n)
+ return protowire.ParseError(n)
}
b = b[n:]
- if num != FieldItem || wtyp != wire.StartGroupType {
- n := wire.ConsumeFieldValue(num, wtyp, b)
+ if num != FieldItem || wtyp != protowire.StartGroupType {
+ n := protowire.ConsumeFieldValue(num, wtyp, b)
if n < 0 {
- return wire.ParseError(n)
+ return protowire.ParseError(n)
}
b = b[n:]
continue
@@ -126,36 +126,36 @@
// item length.
//
// If wantLen is true, the returned message value includes the length prefix.
-func ConsumeFieldValue(b []byte, wantLen bool) (typeid wire.Number, message []byte, n int, err error) {
+func ConsumeFieldValue(b []byte, wantLen bool) (typeid protowire.Number, message []byte, n int, err error) {
ilen := len(b)
for {
- num, wtyp, n := wire.ConsumeTag(b)
+ num, wtyp, n := protowire.ConsumeTag(b)
if n < 0 {
- return 0, nil, 0, wire.ParseError(n)
+ return 0, nil, 0, protowire.ParseError(n)
}
b = b[n:]
switch {
- case num == FieldItem && wtyp == wire.EndGroupType:
+ case num == FieldItem && wtyp == protowire.EndGroupType:
if wantLen && len(message) == 0 {
// The message field was missing, which should never happen.
// Be prepared for this case anyway.
- message = wire.AppendVarint(message, 0)
+ message = protowire.AppendVarint(message, 0)
}
return typeid, message, ilen - len(b), nil
- case num == FieldTypeID && wtyp == wire.VarintType:
- v, n := wire.ConsumeVarint(b)
+ case num == FieldTypeID && wtyp == protowire.VarintType:
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return 0, nil, 0, wire.ParseError(n)
+ return 0, nil, 0, protowire.ParseError(n)
}
b = b[n:]
if v < 1 || v > math.MaxInt32 {
return 0, nil, 0, errors.New("invalid type_id in message set")
}
- typeid = wire.Number(v)
- case num == FieldMessage && wtyp == wire.BytesType:
- m, n := wire.ConsumeBytes(b)
+ typeid = protowire.Number(v)
+ case num == FieldMessage && wtyp == protowire.BytesType:
+ m, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, nil, 0, wire.ParseError(n)
+ return 0, nil, 0, protowire.ParseError(n)
}
if message == nil {
if wantLen {
@@ -172,10 +172,10 @@
// quite inefficient since we need to strip the length off
// the existing data and reconstruct it with the combined length.
if wantLen {
- _, nn := wire.ConsumeVarint(message)
+ _, nn := protowire.ConsumeVarint(message)
m0 := message[nn:]
message = nil
- message = wire.AppendVarint(message, uint64(len(m0)+len(m)))
+ message = protowire.AppendVarint(message, uint64(len(m0)+len(m)))
message = append(message, m0...)
message = append(message, m...)
} else {
@@ -185,9 +185,9 @@
b = b[n:]
default:
// We have no place to put it, so we just ignore unknown fields.
- n := wire.ConsumeFieldValue(num, wtyp, b)
+ n := protowire.ConsumeFieldValue(num, wtyp, b)
if n < 0 {
- return 0, nil, 0, wire.ParseError(n)
+ return 0, nil, 0, protowire.ParseError(n)
}
b = b[n:]
}
@@ -197,16 +197,16 @@
// AppendFieldStart appends the start of a MessageSet item field containing
// an extension with the given number. The caller must add the message
// subfield (including the tag).
-func AppendFieldStart(b []byte, num wire.Number) []byte {
- b = wire.AppendTag(b, FieldItem, wire.StartGroupType)
- b = wire.AppendTag(b, FieldTypeID, wire.VarintType)
- b = wire.AppendVarint(b, uint64(num))
+func AppendFieldStart(b []byte, num protowire.Number) []byte {
+ b = protowire.AppendTag(b, FieldItem, protowire.StartGroupType)
+ b = protowire.AppendTag(b, FieldTypeID, protowire.VarintType)
+ b = protowire.AppendVarint(b, uint64(num))
return b
}
// AppendFieldEnd appends the trailing end group marker for a MessageSet item field.
func AppendFieldEnd(b []byte) []byte {
- return wire.AppendTag(b, FieldItem, wire.EndGroupType)
+ return protowire.AppendTag(b, FieldItem, protowire.EndGroupType)
}
// SizeUnknown returns the size of an unknown fields section in MessageSet format.
@@ -214,17 +214,17 @@
// See AppendUnknown.
func SizeUnknown(unknown []byte) (size int) {
for len(unknown) > 0 {
- num, typ, n := wire.ConsumeTag(unknown)
- if n < 0 || typ != wire.BytesType {
+ num, typ, n := protowire.ConsumeTag(unknown)
+ if n < 0 || typ != protowire.BytesType {
return 0
}
unknown = unknown[n:]
- _, n = wire.ConsumeBytes(unknown)
+ _, n = protowire.ConsumeBytes(unknown)
if n < 0 {
return 0
}
unknown = unknown[n:]
- size += SizeField(num) + wire.SizeTag(FieldMessage) + n
+ size += SizeField(num) + protowire.SizeTag(FieldMessage) + n
}
return size
}
@@ -239,17 +239,17 @@
// This function converts the unknown fields back into MessageSet form.
func AppendUnknown(b, unknown []byte) ([]byte, error) {
for len(unknown) > 0 {
- num, typ, n := wire.ConsumeTag(unknown)
- if n < 0 || typ != wire.BytesType {
+ num, typ, n := protowire.ConsumeTag(unknown)
+ if n < 0 || typ != protowire.BytesType {
return nil, errors.New("invalid data in message set unknown fields")
}
unknown = unknown[n:]
- _, n = wire.ConsumeBytes(unknown)
+ _, n = protowire.ConsumeBytes(unknown)
if n < 0 {
return nil, errors.New("invalid data in message set unknown fields")
}
b = AppendFieldStart(b, num)
- b = wire.AppendTag(b, FieldMessage, wire.BytesType)
+ b = protowire.AppendTag(b, FieldMessage, protowire.BytesType)
b = append(b, unknown[:n]...)
b = AppendFieldEnd(b)
unknown = unknown[n:]
diff --git a/internal/encoding/pack/pack.go b/internal/encoding/pack/pack.go
index 4e172e6..163002f 100644
--- a/internal/encoding/pack/pack.go
+++ b/internal/encoding/pack/pack.go
@@ -21,32 +21,32 @@
"unicode"
"unicode/utf8"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/reflect/protoreflect"
)
// Number is the field number; aliased from the wire package for convenience.
-type Number = wire.Number
+type Number = protowire.Number
// Number type constants; copied from the wire package for convenience.
const (
- MinValidNumber Number = wire.MinValidNumber
- FirstReservedNumber Number = wire.FirstReservedNumber
- LastReservedNumber Number = wire.LastReservedNumber
- MaxValidNumber Number = wire.MaxValidNumber
+ MinValidNumber Number = protowire.MinValidNumber
+ FirstReservedNumber Number = protowire.FirstReservedNumber
+ LastReservedNumber Number = protowire.LastReservedNumber
+ MaxValidNumber Number = protowire.MaxValidNumber
)
// Type is the wire type; aliased from the wire package for convenience.
-type Type = wire.Type
+type Type = protowire.Type
// Wire type constants; copied from the wire package for convenience.
const (
- VarintType Type = wire.VarintType
- Fixed32Type Type = wire.Fixed32Type
- Fixed64Type Type = wire.Fixed64Type
- BytesType Type = wire.BytesType
- StartGroupType Type = wire.StartGroupType
- EndGroupType Type = wire.EndGroupType
+ VarintType Type = protowire.VarintType
+ Fixed32Type Type = protowire.Fixed32Type
+ Fixed64Type Type = protowire.Fixed64Type
+ BytesType Type = protowire.BytesType
+ StartGroupType Type = protowire.StartGroupType
+ EndGroupType Type = protowire.EndGroupType
)
type (
@@ -140,25 +140,25 @@
case Message:
n += v.Size()
case Tag:
- n += wire.SizeTag(v.Number)
+ n += protowire.SizeTag(v.Number)
case Bool:
- n += wire.SizeVarint(wire.EncodeBool(false))
+ n += protowire.SizeVarint(protowire.EncodeBool(false))
case Varint:
- n += wire.SizeVarint(uint64(v))
+ n += protowire.SizeVarint(uint64(v))
case Svarint:
- n += wire.SizeVarint(wire.EncodeZigZag(int64(v)))
+ n += protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
case Uvarint:
- n += wire.SizeVarint(uint64(v))
+ n += protowire.SizeVarint(uint64(v))
case Int32, Uint32, Float32:
- n += wire.SizeFixed32()
+ n += protowire.SizeFixed32()
case Int64, Uint64, Float64:
- n += wire.SizeFixed64()
+ n += protowire.SizeFixed64()
case String:
- n += wire.SizeBytes(len(v))
+ n += protowire.SizeBytes(len(v))
case Bytes:
- n += wire.SizeBytes(len(v))
+ n += protowire.SizeBytes(len(v))
case LengthPrefix:
- n += wire.SizeBytes(Message(v).Size())
+ n += protowire.SizeBytes(Message(v).Size())
case Denormalized:
n += int(v.Count) + Message{v.Value}.Size()
case Raw:
@@ -199,36 +199,36 @@
case Message:
out = append(out, v.Marshal()...)
case Tag:
- out = wire.AppendTag(out, v.Number, v.Type)
+ out = protowire.AppendTag(out, v.Number, v.Type)
case Bool:
- out = wire.AppendVarint(out, wire.EncodeBool(bool(v)))
+ out = protowire.AppendVarint(out, protowire.EncodeBool(bool(v)))
case Varint:
- out = wire.AppendVarint(out, uint64(v))
+ out = protowire.AppendVarint(out, uint64(v))
case Svarint:
- out = wire.AppendVarint(out, wire.EncodeZigZag(int64(v)))
+ out = protowire.AppendVarint(out, protowire.EncodeZigZag(int64(v)))
case Uvarint:
- out = wire.AppendVarint(out, uint64(v))
+ out = protowire.AppendVarint(out, uint64(v))
case Int32:
- out = wire.AppendFixed32(out, uint32(v))
+ out = protowire.AppendFixed32(out, uint32(v))
case Uint32:
- out = wire.AppendFixed32(out, uint32(v))
+ out = protowire.AppendFixed32(out, uint32(v))
case Float32:
- out = wire.AppendFixed32(out, math.Float32bits(float32(v)))
+ out = protowire.AppendFixed32(out, math.Float32bits(float32(v)))
case Int64:
- out = wire.AppendFixed64(out, uint64(v))
+ out = protowire.AppendFixed64(out, uint64(v))
case Uint64:
- out = wire.AppendFixed64(out, uint64(v))
+ out = protowire.AppendFixed64(out, uint64(v))
case Float64:
- out = wire.AppendFixed64(out, math.Float64bits(float64(v)))
+ out = protowire.AppendFixed64(out, math.Float64bits(float64(v)))
case String:
- out = wire.AppendBytes(out, []byte(v))
+ out = protowire.AppendBytes(out, []byte(v))
case Bytes:
- out = wire.AppendBytes(out, []byte(v))
+ out = protowire.AppendBytes(out, []byte(v))
case LengthPrefix:
- out = wire.AppendBytes(out, Message(v).Marshal())
+ out = protowire.AppendBytes(out, Message(v).Marshal())
case Denormalized:
b := Message{v.Value}.Marshal()
- _, n := wire.ConsumeVarint(b)
+ _, n := protowire.ConsumeVarint(b)
out = append(out, b[:n]...)
for i := uint(0); i < v.Count; i++ {
out[len(out)-1] |= 0x80 // set continuation bit on previous
@@ -301,8 +301,8 @@
func (p *parser) parseMessage(msgDesc protoreflect.MessageDescriptor, group bool) {
for len(p.in) > 0 {
- v, n := wire.ConsumeVarint(p.in)
- num, typ := wire.DecodeTag(v)
+ v, n := protowire.ConsumeVarint(p.in)
+ num, typ := protowire.DecodeTag(v)
if n < 0 || num < 0 || v > math.MaxUint32 {
p.out, p.in = append(p.out, Raw(p.in)), nil
return
@@ -311,7 +311,7 @@
return // if inside a group, then stop
}
p.out, p.in = append(p.out, Tag{num, typ}), p.in[n:]
- if m := n - wire.SizeVarint(v); m > 0 {
+ if m := n - protowire.SizeVarint(v); m > 0 {
p.out[len(p.out)-1] = Denormalized{uint(m), p.out[len(p.out)-1]}
}
@@ -353,7 +353,7 @@
}
func (p *parser) parseVarint(kind protoreflect.Kind) {
- v, n := wire.ConsumeVarint(p.in)
+ v, n := protowire.ConsumeVarint(p.in)
if n < 0 {
p.out, p.in = append(p.out, Raw(p.in)), nil
return
@@ -371,17 +371,17 @@
case protoreflect.Int32Kind, protoreflect.Int64Kind:
p.out, p.in = append(p.out, Varint(v)), p.in[n:]
case protoreflect.Sint32Kind, protoreflect.Sint64Kind:
- p.out, p.in = append(p.out, Svarint(wire.DecodeZigZag(v))), p.in[n:]
+ p.out, p.in = append(p.out, Svarint(protowire.DecodeZigZag(v))), p.in[n:]
default:
p.out, p.in = append(p.out, Uvarint(v)), p.in[n:]
}
- if m := n - wire.SizeVarint(v); m > 0 {
+ if m := n - protowire.SizeVarint(v); m > 0 {
p.out[len(p.out)-1] = Denormalized{uint(m), p.out[len(p.out)-1]}
}
}
func (p *parser) parseFixed32(kind protoreflect.Kind) {
- v, n := wire.ConsumeFixed32(p.in)
+ v, n := protowire.ConsumeFixed32(p.in)
if n < 0 {
p.out, p.in = append(p.out, Raw(p.in)), nil
return
@@ -397,7 +397,7 @@
}
func (p *parser) parseFixed64(kind protoreflect.Kind) {
- v, n := wire.ConsumeFixed64(p.in)
+ v, n := protowire.ConsumeFixed64(p.in)
if n < 0 {
p.out, p.in = append(p.out, Raw(p.in)), nil
return
@@ -413,13 +413,13 @@
}
func (p *parser) parseBytes(isPacked bool, kind protoreflect.Kind, desc protoreflect.MessageDescriptor) {
- v, n := wire.ConsumeVarint(p.in)
+ v, n := protowire.ConsumeVarint(p.in)
if n < 0 {
p.out, p.in = append(p.out, Raw(p.in)), nil
return
}
p.out, p.in = append(p.out, Uvarint(v)), p.in[n:]
- if m := n - wire.SizeVarint(v); m > 0 {
+ if m := n - protowire.SizeVarint(v); m > 0 {
p.out[len(p.out)-1] = Denormalized{uint(m), p.out[len(p.out)-1]}
}
if v > uint64(len(p.in)) {
@@ -442,7 +442,7 @@
p.out, p.in = append(p.out, Bytes(p.in[:v])), p.in[v:]
}
}
- if m := n - wire.SizeVarint(v); m > 0 {
+ if m := n - protowire.SizeVarint(v); m > 0 {
p.out[len(p.out)-1] = Denormalized{uint(m), p.out[len(p.out)-1]}
}
}
@@ -475,10 +475,10 @@
p.in = p2.in
// Append the trailing end group.
- v, n := wire.ConsumeVarint(p.in)
- if num, typ := wire.DecodeTag(v); typ == EndGroupType {
+ v, n := protowire.ConsumeVarint(p.in)
+ if num, typ := protowire.DecodeTag(v); typ == EndGroupType {
p.out, p.in = append(p.out, Tag{num, typ}), p.in[n:]
- if m := n - wire.SizeVarint(v); m > 0 {
+ if m := n - protowire.SizeVarint(v); m > 0 {
p.out[len(p.out)-1] = Denormalized{uint(m), p.out[len(p.out)-1]}
}
}
diff --git a/internal/filedesc/build.go b/internal/filedesc/build.go
index f4af7ad..462d384 100644
--- a/internal/filedesc/build.go
+++ b/internal/filedesc/build.go
@@ -6,7 +6,7 @@
package filedesc
import (
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/fieldnum"
"google.golang.org/protobuf/reflect/protoreflect"
pref "google.golang.org/protobuf/reflect/protoreflect"
@@ -118,11 +118,11 @@
// or a MessageDescriptorProto depending on whether isFile is set.
func (db *Builder) unmarshalCounts(b []byte, isFile bool) {
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
if isFile {
switch num {
@@ -148,7 +148,7 @@
}
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
diff --git a/internal/filedesc/desc_init.go b/internal/filedesc/desc_init.go
index 249021f..c0cddf8 100644
--- a/internal/filedesc/desc_init.go
+++ b/internal/filedesc/desc_init.go
@@ -7,7 +7,7 @@
import (
"sync"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/fieldnum"
"google.golang.org/protobuf/internal/strs"
pref "google.golang.org/protobuf/reflect/protoreflect"
@@ -100,11 +100,11 @@
var posEnums, posMessages, posExtensions, posServices int
b0 := b
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
case fieldnum.FileDescriptorProto_Syntax:
@@ -155,7 +155,7 @@
}
prevField = num
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
prevField = -1 // ignore known field numbers of unknown wire type
}
@@ -184,8 +184,8 @@
if numEnums > 0 {
b := b0[posEnums:]
for i := range fd.L1.Enums.List {
- _, n := wire.ConsumeVarint(b)
- v, m := wire.ConsumeBytes(b[n:])
+ _, n := protowire.ConsumeVarint(b)
+ v, m := protowire.ConsumeBytes(b[n:])
fd.L1.Enums.List[i].unmarshalSeed(v, sb, fd, fd, i)
b = b[n+m:]
}
@@ -193,8 +193,8 @@
if numMessages > 0 {
b := b0[posMessages:]
for i := range fd.L1.Messages.List {
- _, n := wire.ConsumeVarint(b)
- v, m := wire.ConsumeBytes(b[n:])
+ _, n := protowire.ConsumeVarint(b)
+ v, m := protowire.ConsumeBytes(b[n:])
fd.L1.Messages.List[i].unmarshalSeed(v, sb, fd, fd, i)
b = b[n+m:]
}
@@ -202,8 +202,8 @@
if numExtensions > 0 {
b := b0[posExtensions:]
for i := range fd.L1.Extensions.List {
- _, n := wire.ConsumeVarint(b)
- v, m := wire.ConsumeBytes(b[n:])
+ _, n := protowire.ConsumeVarint(b)
+ v, m := protowire.ConsumeBytes(b[n:])
fd.L1.Extensions.List[i].unmarshalSeed(v, sb, fd, fd, i)
b = b[n+m:]
}
@@ -211,8 +211,8 @@
if numServices > 0 {
b := b0[posServices:]
for i := range fd.L1.Services.List {
- _, n := wire.ConsumeVarint(b)
- v, m := wire.ConsumeBytes(b[n:])
+ _, n := protowire.ConsumeVarint(b)
+ v, m := protowire.ConsumeBytes(b[n:])
fd.L1.Services.List[i].unmarshalSeed(v, sb, fd, fd, i)
b = b[n+m:]
}
@@ -226,11 +226,11 @@
var numValues int
for b := b; len(b) > 0; {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
case fieldnum.EnumDescriptorProto_Name:
@@ -239,7 +239,7 @@
numValues++
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -253,11 +253,11 @@
ed.L2 = new(EnumL2)
ed.L2.Values.List = make([]EnumValue, numValues)
for i := 0; len(b) > 0; {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
case fieldnum.EnumDescriptorProto_Value:
@@ -265,7 +265,7 @@
i++
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -281,11 +281,11 @@
var posEnums, posMessages, posExtensions int
b0 := b
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
case fieldnum.DescriptorProto_Name:
@@ -319,7 +319,7 @@
}
prevField = num
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
prevField = -1 // ignore known field numbers of unknown wire type
}
@@ -340,8 +340,8 @@
if numEnums > 0 {
b := b0[posEnums:]
for i := range md.L1.Enums.List {
- _, n := wire.ConsumeVarint(b)
- v, m := wire.ConsumeBytes(b[n:])
+ _, n := protowire.ConsumeVarint(b)
+ v, m := protowire.ConsumeBytes(b[n:])
md.L1.Enums.List[i].unmarshalSeed(v, sb, pf, md, i)
b = b[n+m:]
}
@@ -349,8 +349,8 @@
if numMessages > 0 {
b := b0[posMessages:]
for i := range md.L1.Messages.List {
- _, n := wire.ConsumeVarint(b)
- v, m := wire.ConsumeBytes(b[n:])
+ _, n := protowire.ConsumeVarint(b)
+ v, m := protowire.ConsumeBytes(b[n:])
md.L1.Messages.List[i].unmarshalSeed(v, sb, pf, md, i)
b = b[n+m:]
}
@@ -358,8 +358,8 @@
if numExtensions > 0 {
b := b0[posExtensions:]
for i := range md.L1.Extensions.List {
- _, n := wire.ConsumeVarint(b)
- v, m := wire.ConsumeBytes(b[n:])
+ _, n := protowire.ConsumeVarint(b)
+ v, m := protowire.ConsumeBytes(b[n:])
md.L1.Extensions.List[i].unmarshalSeed(v, sb, pf, md, i)
b = b[n+m:]
}
@@ -368,20 +368,20 @@
func (md *Message) unmarshalSeedOptions(b []byte) {
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.VarintType:
- v, m := wire.ConsumeVarint(b)
+ case protowire.VarintType:
+ v, m := protowire.ConsumeVarint(b)
b = b[m:]
switch num {
case fieldnum.MessageOptions_MapEntry:
- md.L1.IsMapEntry = wire.DecodeBool(v)
+ md.L1.IsMapEntry = protowire.DecodeBool(v)
case fieldnum.MessageOptions_MessageSetWireFormat:
- md.L1.IsMessageSet = wire.DecodeBool(v)
+ md.L1.IsMessageSet = protowire.DecodeBool(v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -393,11 +393,11 @@
xd.L0.Index = i
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.VarintType:
- v, m := wire.ConsumeVarint(b)
+ case protowire.VarintType:
+ v, m := protowire.ConsumeVarint(b)
b = b[m:]
switch num {
case fieldnum.FieldDescriptorProto_Number:
@@ -407,8 +407,8 @@
case fieldnum.FieldDescriptorProto_Type:
xd.L1.Kind = pref.Kind(v)
}
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
case fieldnum.FieldDescriptorProto_Name:
@@ -417,7 +417,7 @@
xd.L1.Extendee = PlaceholderMessage(makeFullName(sb, v))
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -429,18 +429,18 @@
sd.L0.Index = i
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
case fieldnum.ServiceDescriptorProto_Name:
sd.L0.FullName = appendFullName(sb, pd.FullName(), v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
diff --git a/internal/filedesc/desc_lazy.go b/internal/filedesc/desc_lazy.go
index c43b3e2..cdf3164 100644
--- a/internal/filedesc/desc_lazy.go
+++ b/internal/filedesc/desc_lazy.go
@@ -8,8 +8,8 @@
"reflect"
"sync"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/descopts"
- "google.golang.org/protobuf/internal/encoding/wire"
"google.golang.org/protobuf/internal/fieldnum"
"google.golang.org/protobuf/internal/strs"
"google.golang.org/protobuf/proto"
@@ -136,11 +136,11 @@
var rawOptions []byte
fd.L2 = new(FileL2)
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.VarintType:
- v, m := wire.ConsumeVarint(b)
+ case protowire.VarintType:
+ v, m := protowire.ConsumeVarint(b)
b = b[m:]
switch num {
case fieldnum.FileDescriptorProto_PublicDependency:
@@ -148,8 +148,8 @@
case fieldnum.FileDescriptorProto_WeakDependency:
fd.L2.Imports[v].IsWeak = true
}
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
case fieldnum.FileDescriptorProto_Dependency:
@@ -175,7 +175,7 @@
rawOptions = appendOptions(rawOptions, v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -189,11 +189,11 @@
ed.L2 = new(EnumL2)
}
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
case fieldnum.EnumDescriptorProto_Value:
@@ -206,7 +206,7 @@
rawOptions = appendOptions(rawOptions, v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -221,11 +221,11 @@
func unmarshalEnumReservedRange(b []byte) (r [2]pref.EnumNumber) {
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.VarintType:
- v, m := wire.ConsumeVarint(b)
+ case protowire.VarintType:
+ v, m := protowire.ConsumeVarint(b)
b = b[m:]
switch num {
case fieldnum.EnumDescriptorProto_EnumReservedRange_Start:
@@ -234,7 +234,7 @@
r[1] = pref.EnumNumber(v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -248,18 +248,18 @@
var rawOptions []byte
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.VarintType:
- v, m := wire.ConsumeVarint(b)
+ case protowire.VarintType:
+ v, m := protowire.ConsumeVarint(b)
b = b[m:]
switch num {
case fieldnum.EnumValueDescriptorProto_Number:
vd.L1.Number = pref.EnumNumber(v)
}
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
case fieldnum.EnumValueDescriptorProto_Name:
@@ -269,7 +269,7 @@
rawOptions = appendOptions(rawOptions, v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -282,11 +282,11 @@
var rawOptions []byte
md.L2 = new(MessageL2)
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
case fieldnum.DescriptorProto_Field:
@@ -316,7 +316,7 @@
rawOptions = appendOptions(rawOptions, v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -340,20 +340,20 @@
func (md *Message) unmarshalOptions(b []byte) {
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.VarintType:
- v, m := wire.ConsumeVarint(b)
+ case protowire.VarintType:
+ v, m := protowire.ConsumeVarint(b)
b = b[m:]
switch num {
case fieldnum.MessageOptions_MapEntry:
- md.L1.IsMapEntry = wire.DecodeBool(v)
+ md.L1.IsMapEntry = protowire.DecodeBool(v)
case fieldnum.MessageOptions_MessageSetWireFormat:
- md.L1.IsMessageSet = wire.DecodeBool(v)
+ md.L1.IsMessageSet = protowire.DecodeBool(v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -361,11 +361,11 @@
func unmarshalMessageReservedRange(b []byte) (r [2]pref.FieldNumber) {
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.VarintType:
- v, m := wire.ConsumeVarint(b)
+ case protowire.VarintType:
+ v, m := protowire.ConsumeVarint(b)
b = b[m:]
switch num {
case fieldnum.DescriptorProto_ReservedRange_Start:
@@ -374,7 +374,7 @@
r[1] = pref.FieldNumber(v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -383,11 +383,11 @@
func unmarshalMessageExtensionRange(b []byte) (r [2]pref.FieldNumber, rawOptions []byte) {
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.VarintType:
- v, m := wire.ConsumeVarint(b)
+ case protowire.VarintType:
+ v, m := protowire.ConsumeVarint(b)
b = b[m:]
switch num {
case fieldnum.DescriptorProto_ExtensionRange_Start:
@@ -395,15 +395,15 @@
case fieldnum.DescriptorProto_ExtensionRange_End:
r[1] = pref.FieldNumber(v)
}
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
case fieldnum.DescriptorProto_ExtensionRange_Options:
rawOptions = appendOptions(rawOptions, v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -418,11 +418,11 @@
var rawTypeName []byte
var rawOptions []byte
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.VarintType:
- v, m := wire.ConsumeVarint(b)
+ case protowire.VarintType:
+ v, m := protowire.ConsumeVarint(b)
b = b[m:]
switch num {
case fieldnum.FieldDescriptorProto_Number:
@@ -442,8 +442,8 @@
}
fd.L1.ContainingOneof = od
}
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
case fieldnum.FieldDescriptorProto_Name:
@@ -459,7 +459,7 @@
rawOptions = appendOptions(rawOptions, v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -479,24 +479,24 @@
const FieldOptions_EnforceUTF8 = 13
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.VarintType:
- v, m := wire.ConsumeVarint(b)
+ case protowire.VarintType:
+ v, m := protowire.ConsumeVarint(b)
b = b[m:]
switch num {
case fieldnum.FieldOptions_Packed:
fd.L1.HasPacked = true
- fd.L1.IsPacked = wire.DecodeBool(v)
+ fd.L1.IsPacked = protowire.DecodeBool(v)
case fieldnum.FieldOptions_Weak:
- fd.L1.IsWeak = wire.DecodeBool(v)
+ fd.L1.IsWeak = protowire.DecodeBool(v)
case FieldOptions_EnforceUTF8:
fd.L1.HasEnforceUTF8 = true
- fd.L1.EnforceUTF8 = wire.DecodeBool(v)
+ fd.L1.EnforceUTF8 = protowire.DecodeBool(v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -509,11 +509,11 @@
var rawOptions []byte
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
case fieldnum.OneofDescriptorProto_Name:
@@ -522,7 +522,7 @@
rawOptions = appendOptions(rawOptions, v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -534,11 +534,11 @@
var rawOptions []byte
xd.L2 = new(ExtensionL2)
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
case fieldnum.FieldDescriptorProto_JsonName:
@@ -552,7 +552,7 @@
rawOptions = appendOptions(rawOptions, v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -570,18 +570,18 @@
func (xd *Extension) unmarshalOptions(b []byte) {
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.VarintType:
- v, m := wire.ConsumeVarint(b)
+ case protowire.VarintType:
+ v, m := protowire.ConsumeVarint(b)
b = b[m:]
switch num {
case fieldnum.FieldOptions_Packed:
- xd.L2.IsPacked = wire.DecodeBool(v)
+ xd.L2.IsPacked = protowire.DecodeBool(v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -592,11 +592,11 @@
var rawOptions []byte
sd.L2 = new(ServiceL2)
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
case fieldnum.ServiceDescriptorProto_Method:
@@ -605,7 +605,7 @@
rawOptions = appendOptions(rawOptions, v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
@@ -625,20 +625,20 @@
var rawOptions []byte
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
+ num, typ, n := protowire.ConsumeTag(b)
b = b[n:]
switch typ {
- case wire.VarintType:
- v, m := wire.ConsumeVarint(b)
+ case protowire.VarintType:
+ v, m := protowire.ConsumeVarint(b)
b = b[m:]
switch num {
case fieldnum.MethodDescriptorProto_ClientStreaming:
- md.L1.IsStreamingClient = wire.DecodeBool(v)
+ md.L1.IsStreamingClient = protowire.DecodeBool(v)
case fieldnum.MethodDescriptorProto_ServerStreaming:
- md.L1.IsStreamingServer = wire.DecodeBool(v)
+ md.L1.IsStreamingServer = protowire.DecodeBool(v)
}
- case wire.BytesType:
- v, m := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, m := protowire.ConsumeBytes(b)
b = b[m:]
switch num {
case fieldnum.MethodDescriptorProto_Name:
@@ -651,7 +651,7 @@
rawOptions = appendOptions(rawOptions, v)
}
default:
- m := wire.ConsumeFieldValue(num, typ, b)
+ m := protowire.ConsumeFieldValue(num, typ, b)
b = b[m:]
}
}
diff --git a/internal/filedesc/desc_list.go b/internal/filedesc/desc_list.go
index d251991..1b7089b 100644
--- a/internal/filedesc/desc_list.go
+++ b/internal/filedesc/desc_list.go
@@ -10,8 +10,8 @@
"sort"
"sync"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/descfmt"
- "google.golang.org/protobuf/internal/encoding/wire"
"google.golang.org/protobuf/internal/errors"
"google.golang.org/protobuf/internal/pragma"
"google.golang.org/protobuf/reflect/protoreflect"
@@ -186,9 +186,9 @@
// reserved number range.
func isValidFieldNumber(n protoreflect.FieldNumber, isMessageSet bool) bool {
if isMessageSet {
- return wire.MinValidNumber <= n && n <= math.MaxInt32
+ return protowire.MinValidNumber <= n && n <= math.MaxInt32
}
- return wire.MinValidNumber <= n && n <= wire.MaxValidNumber
+ return protowire.MinValidNumber <= n && n <= protowire.MaxValidNumber
}
// CheckOverlap reports an error if p and q overlap.
diff --git a/internal/impl/codec_extension.go b/internal/impl/codec_extension.go
index efeea2f..da67a01 100644
--- a/internal/impl/codec_extension.go
+++ b/internal/impl/codec_extension.go
@@ -8,7 +8,7 @@
"sync"
"sync/atomic"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/errors"
pref "google.golang.org/protobuf/reflect/protoreflect"
)
@@ -46,13 +46,13 @@
func makeExtensionFieldInfo(xd pref.ExtensionDescriptor) *extensionFieldInfo {
var wiretag uint64
if !xd.IsPacked() {
- wiretag = wire.EncodeTag(xd.Number(), wireTypes[xd.Kind()])
+ wiretag = protowire.EncodeTag(xd.Number(), wireTypes[xd.Kind()])
} else {
- wiretag = wire.EncodeTag(xd.Number(), wire.BytesType)
+ wiretag = protowire.EncodeTag(xd.Number(), protowire.BytesType)
}
e := &extensionFieldInfo{
wiretag: wiretag,
- tagsize: wire.SizeVarint(wiretag),
+ tagsize: protowire.SizeVarint(wiretag),
funcs: encoderFuncsForValue(xd),
}
// Does the unmarshal function need a value passed to it?
@@ -87,13 +87,13 @@
lazy *lazyExtensionValue
}
-func (f *ExtensionField) appendLazyBytes(xt pref.ExtensionType, xi *extensionFieldInfo, num wire.Number, wtyp wire.Type, b []byte) {
+func (f *ExtensionField) appendLazyBytes(xt pref.ExtensionType, xi *extensionFieldInfo, num protowire.Number, wtyp protowire.Type, b []byte) {
if f.lazy == nil {
f.lazy = &lazyExtensionValue{xi: xi}
}
f.typ = xt
f.lazy.xi = xi
- f.lazy.b = wire.AppendTag(f.lazy.b, num, wtyp)
+ f.lazy.b = protowire.AppendTag(f.lazy.b, num, wtyp)
f.lazy.b = append(f.lazy.b, b...)
}
@@ -126,14 +126,14 @@
b = b[2:]
} else {
var n int
- tag, n = wire.ConsumeVarint(b)
+ tag, n = protowire.ConsumeVarint(b)
if n < 0 {
panic(errors.New("bad tag in lazy extension decoding"))
}
b = b[n:]
}
- num := wire.Number(tag >> 3)
- wtyp := wire.Type(tag & 7)
+ num := protowire.Number(tag >> 3)
+ wtyp := protowire.Type(tag & 7)
var out unmarshalOutput
var err error
val, out, err = f.lazy.xi.funcs.unmarshal(b, val, num, wtyp, lazyUnmarshalOptions)
diff --git a/internal/impl/codec_field.go b/internal/impl/codec_field.go
index f9b6836..9497707 100644
--- a/internal/impl/codec_field.go
+++ b/internal/impl/codec_field.go
@@ -9,7 +9,7 @@
"reflect"
"sync"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/proto"
pref "google.golang.org/protobuf/reflect/protoreflect"
preg "google.golang.org/protobuf/reflect/protoregistry"
@@ -51,7 +51,7 @@
if cf.funcs.isInit != nil {
needIsInit = true
}
- mi.coderFields[num].funcs.unmarshal = func(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
+ mi.coderFields[num].funcs.unmarshal = func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
var vw reflect.Value // pointer to wrapper type
vi := p.AsValueOf(ft).Elem() // oneof field value of interface kind
if !vi.IsNil() && !vi.Elem().IsNil() && vi.Elem().Elem().Type() == ot {
@@ -149,7 +149,7 @@
}
return appendMessage(b, m, f.wiretag, opts)
},
- unmarshal: func(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
+ unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
fs := p.WeakFields()
m, ok := fs.get(f.num)
if !ok {
@@ -210,7 +210,7 @@
m := asMessage(p.AsValueOf(ft).Elem())
return appendMessage(b, m, f.wiretag, opts)
},
- unmarshal: func(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
+ unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
mp := p.AsValueOf(ft).Elem()
if mp.IsNil() {
mp.Set(reflect.New(ft.Elem()))
@@ -227,22 +227,22 @@
}
func sizeMessageInfo(p pointer, f *coderFieldInfo, opts marshalOptions) int {
- return wire.SizeBytes(f.mi.sizePointer(p.Elem(), opts)) + f.tagsize
+ return protowire.SizeBytes(f.mi.sizePointer(p.Elem(), opts)) + f.tagsize
}
func appendMessageInfo(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, uint64(f.mi.sizePointer(p.Elem(), opts)))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, uint64(f.mi.sizePointer(p.Elem(), opts)))
return f.mi.marshalAppendPointer(b, p.Elem(), opts)
}
-func consumeMessageInfo(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.BytesType {
+func consumeMessageInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
if p.Elem().IsNil() {
p.SetPointer(pointerOfValue(reflect.New(f.mi.GoReflectType.Elem())))
@@ -261,22 +261,22 @@
}
func sizeMessage(m proto.Message, tagsize int, _ marshalOptions) int {
- return wire.SizeBytes(proto.Size(m)) + tagsize
+ return protowire.SizeBytes(proto.Size(m)) + tagsize
}
func appendMessage(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, uint64(proto.Size(m)))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, uint64(proto.Size(m)))
return opts.Options().MarshalAppend(b, m)
}
-func consumeMessage(b []byte, m proto.Message, wtyp wire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.BytesType {
+func consumeMessage(b []byte, m proto.Message, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
Buf: v,
@@ -300,7 +300,7 @@
return appendMessage(b, m, wiretag, opts)
}
-func consumeMessageValue(b []byte, v pref.Value, _ wire.Number, wtyp wire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) {
+func consumeMessageValue(b []byte, v pref.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) {
m := v.Message().Interface()
out, err := consumeMessage(b, m, wtyp, opts)
return v, out, err
@@ -329,7 +329,7 @@
return appendGroup(b, m, wiretag, opts)
}
-func consumeGroupValue(b []byte, v pref.Value, num wire.Number, wtyp wire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) {
+func consumeGroupValue(b []byte, v pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error) {
m := v.Message().Interface()
out, err := consumeGroup(b, m, num, wtyp, opts)
return v, out, err
@@ -366,7 +366,7 @@
m := asMessage(p.AsValueOf(ft).Elem())
return appendGroup(b, m, f.wiretag, opts)
},
- unmarshal: func(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
+ unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
mp := p.AsValueOf(ft).Elem()
if mp.IsNil() {
mp.Set(reflect.New(ft.Elem()))
@@ -387,14 +387,14 @@
}
func appendGroupType(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, f.wiretag) // start group
+ b = protowire.AppendVarint(b, f.wiretag) // start group
b, err := f.mi.marshalAppendPointer(b, p.Elem(), opts)
- b = wire.AppendVarint(b, f.wiretag+1) // end group
+ b = protowire.AppendVarint(b, f.wiretag+1) // end group
return b, err
}
-func consumeGroupType(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.StartGroupType {
+func consumeGroupType(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.StartGroupType {
return out, errUnknown
}
if p.Elem().IsNil() {
@@ -408,19 +408,19 @@
}
func appendGroup(b []byte, m proto.Message, wiretag uint64, opts marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag) // start group
+ b = protowire.AppendVarint(b, wiretag) // start group
b, err := opts.Options().MarshalAppend(b, m)
- b = wire.AppendVarint(b, wiretag+1) // end group
+ b = protowire.AppendVarint(b, wiretag+1) // end group
return b, err
}
-func consumeGroup(b []byte, m proto.Message, num wire.Number, wtyp wire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.StartGroupType {
+func consumeGroup(b []byte, m proto.Message, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.StartGroupType {
return out, errUnknown
}
- b, n := wire.ConsumeGroup(num, b)
+ b, n := protowire.ConsumeGroup(num, b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
Buf: b,
@@ -454,7 +454,7 @@
marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
return appendMessageSlice(b, p, f.wiretag, ft, opts)
},
- unmarshal: func(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
+ unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
return consumeMessageSlice(b, p, ft, wtyp, opts)
},
isInit: func(p pointer, f *coderFieldInfo) error {
@@ -468,7 +468,7 @@
s := p.PointerSlice()
n := 0
for _, v := range s {
- n += wire.SizeBytes(f.mi.sizePointer(v, opts)) + f.tagsize
+ n += protowire.SizeBytes(f.mi.sizePointer(v, opts)) + f.tagsize
}
return n
}
@@ -477,9 +477,9 @@
s := p.PointerSlice()
var err error
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
siz := f.mi.sizePointer(v, opts)
- b = wire.AppendVarint(b, uint64(siz))
+ b = protowire.AppendVarint(b, uint64(siz))
b, err = f.mi.marshalAppendPointer(b, v, opts)
if err != nil {
return b, err
@@ -488,13 +488,13 @@
return b, nil
}
-func consumeMessageSliceInfo(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.BytesType {
+func consumeMessageSliceInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
m := reflect.New(f.mi.GoReflectType.Elem()).Interface()
mp := pointerOfIface(m)
@@ -523,7 +523,7 @@
n := 0
for _, v := range s {
m := asMessage(v.AsValueOf(goType.Elem()))
- n += wire.SizeBytes(proto.Size(m)) + tagsize
+ n += protowire.SizeBytes(proto.Size(m)) + tagsize
}
return n
}
@@ -533,9 +533,9 @@
var err error
for _, v := range s {
m := asMessage(v.AsValueOf(goType.Elem()))
- b = wire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, wiretag)
siz := proto.Size(m)
- b = wire.AppendVarint(b, uint64(siz))
+ b = protowire.AppendVarint(b, uint64(siz))
b, err = opts.Options().MarshalAppend(b, m)
if err != nil {
return b, err
@@ -544,13 +544,13 @@
return b, nil
}
-func consumeMessageSlice(b []byte, p pointer, goType reflect.Type, wtyp wire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.BytesType {
+func consumeMessageSlice(b []byte, p pointer, goType reflect.Type, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
mp := reflect.New(goType.Elem())
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
@@ -584,7 +584,7 @@
n := 0
for i, llen := 0, list.Len(); i < llen; i++ {
m := list.Get(i).Message().Interface()
- n += wire.SizeBytes(proto.Size(m)) + tagsize
+ n += protowire.SizeBytes(proto.Size(m)) + tagsize
}
return n
}
@@ -594,9 +594,9 @@
mopts := opts.Options()
for i, llen := 0, list.Len(); i < llen; i++ {
m := list.Get(i).Message().Interface()
- b = wire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, wiretag)
siz := proto.Size(m)
- b = wire.AppendVarint(b, uint64(siz))
+ b = protowire.AppendVarint(b, uint64(siz))
var err error
b, err = mopts.MarshalAppend(b, m)
if err != nil {
@@ -606,14 +606,14 @@
return b, nil
}
-func consumeMessageSliceValue(b []byte, listv pref.Value, _ wire.Number, wtyp wire.Type, opts unmarshalOptions) (_ pref.Value, out unmarshalOutput, err error) {
+func consumeMessageSliceValue(b []byte, listv pref.Value, _ protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ pref.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp != wire.BytesType {
+ if wtyp != protowire.BytesType {
return pref.Value{}, out, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return pref.Value{}, out, wire.ParseError(n)
+ return pref.Value{}, out, protowire.ParseError(n)
}
m := list.NewElement()
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
@@ -663,25 +663,25 @@
mopts := opts.Options()
for i, llen := 0, list.Len(); i < llen; i++ {
m := list.Get(i).Message().Interface()
- b = wire.AppendVarint(b, wiretag) // start group
+ b = protowire.AppendVarint(b, wiretag) // start group
var err error
b, err = mopts.MarshalAppend(b, m)
if err != nil {
return b, err
}
- b = wire.AppendVarint(b, wiretag+1) // end group
+ b = protowire.AppendVarint(b, wiretag+1) // end group
}
return b, nil
}
-func consumeGroupSliceValue(b []byte, listv pref.Value, num wire.Number, wtyp wire.Type, opts unmarshalOptions) (_ pref.Value, out unmarshalOutput, err error) {
+func consumeGroupSliceValue(b []byte, listv pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (_ pref.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp != wire.StartGroupType {
+ if wtyp != protowire.StartGroupType {
return pref.Value{}, out, errUnknown
}
- b, n := wire.ConsumeGroup(num, b)
+ b, n := protowire.ConsumeGroup(num, b)
if n < 0 {
- return pref.Value{}, out, wire.ParseError(n)
+ return pref.Value{}, out, protowire.ParseError(n)
}
m := list.NewElement()
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
@@ -726,7 +726,7 @@
marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
return appendGroupSlice(b, p, f.wiretag, ft, opts)
},
- unmarshal: func(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
+ unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
return consumeGroupSlice(b, p, num, wtyp, ft, opts)
},
isInit: func(p pointer, f *coderFieldInfo) error {
@@ -751,23 +751,23 @@
var err error
for _, v := range s {
m := asMessage(v.AsValueOf(messageType.Elem()))
- b = wire.AppendVarint(b, wiretag) // start group
+ b = protowire.AppendVarint(b, wiretag) // start group
b, err = opts.Options().MarshalAppend(b, m)
if err != nil {
return b, err
}
- b = wire.AppendVarint(b, wiretag+1) // end group
+ b = protowire.AppendVarint(b, wiretag+1) // end group
}
return b, nil
}
-func consumeGroupSlice(b []byte, p pointer, num wire.Number, wtyp wire.Type, goType reflect.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.StartGroupType {
+func consumeGroupSlice(b []byte, p pointer, num protowire.Number, wtyp protowire.Type, goType reflect.Type, opts unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.StartGroupType {
return out, errUnknown
}
- b, n := wire.ConsumeGroup(num, b)
+ b, n := protowire.ConsumeGroup(num, b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
mp := reflect.New(goType.Elem())
o, err := opts.Options().UnmarshalState(piface.UnmarshalInput{
@@ -796,18 +796,18 @@
s := p.PointerSlice()
var err error
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag) // start group
+ b = protowire.AppendVarint(b, f.wiretag) // start group
b, err = f.mi.marshalAppendPointer(b, v, opts)
if err != nil {
return b, err
}
- b = wire.AppendVarint(b, f.wiretag+1) // end group
+ b = protowire.AppendVarint(b, f.wiretag+1) // end group
}
return b, nil
}
-func consumeGroupSliceInfo(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
- if wtyp != wire.StartGroupType {
+func consumeGroupSliceInfo(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
+ if wtyp != protowire.StartGroupType {
return unmarshalOutput{}, errUnknown
}
m := reflect.New(f.mi.GoReflectType.Elem()).Interface()
diff --git a/internal/impl/codec_gen.go b/internal/impl/codec_gen.go
index 6036b66..2c43b11 100644
--- a/internal/impl/codec_gen.go
+++ b/internal/impl/codec_gen.go
@@ -10,27 +10,27 @@
"math"
"unicode/utf8"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/reflect/protoreflect"
)
// sizeBool returns the size of wire encoding a bool pointer as a Bool.
func sizeBool(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := *p.Bool()
- return f.tagsize + wire.SizeVarint(wire.EncodeBool(v))
+ return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
}
// appendBool wire encodes a bool pointer as a Bool.
func appendBool(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.Bool()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, wire.EncodeBool(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeBool(v))
return b, nil
}
// consumeBool wire decodes a bool pointer as a Bool.
-func consumeBool(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeBool(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -42,12 +42,12 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
- *p.Bool() = wire.DecodeBool(v)
+ *p.Bool() = protowire.DecodeBool(v)
out.n = n
return out, nil
}
@@ -66,7 +66,7 @@
if v == false {
return 0
}
- return f.tagsize + wire.SizeVarint(wire.EncodeBool(v))
+ return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
}
// appendBoolNoZero wire encodes a bool pointer as a Bool.
@@ -76,8 +76,8 @@
if v == false {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, wire.EncodeBool(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeBool(v))
return b, nil
}
@@ -92,21 +92,21 @@
// It panics if the pointer is nil.
func sizeBoolPtr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := **p.BoolPtr()
- return f.tagsize + wire.SizeVarint(wire.EncodeBool(v))
+ return f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
}
// appendBoolPtr wire encodes a *bool pointer as a Bool.
// It panics if the pointer is nil.
func appendBoolPtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := **p.BoolPtr()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, wire.EncodeBool(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeBool(v))
return b, nil
}
// consumeBoolPtr wire decodes a *bool pointer as a Bool.
-func consumeBoolPtr(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeBoolPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -118,16 +118,16 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
vp := p.BoolPtr()
if *vp == nil {
*vp = new(bool)
}
- **vp = wire.DecodeBool(v)
+ **vp = protowire.DecodeBool(v)
out.n = n
return out, nil
}
@@ -143,7 +143,7 @@
func sizeBoolSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
s := *p.BoolSlice()
for _, v := range s {
- size += f.tagsize + wire.SizeVarint(wire.EncodeBool(v))
+ size += f.tagsize + protowire.SizeVarint(protowire.EncodeBool(v))
}
return size
}
@@ -152,20 +152,20 @@
func appendBoolSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.BoolSlice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, wire.EncodeBool(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeBool(v))
}
return b, nil
}
// consumeBoolSlice wire decodes a []bool pointer as a repeated Bool.
-func consumeBoolSlice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeBoolSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.BoolSlice()
- if wtyp == wire.BytesType {
+ if wtyp == protowire.BytesType {
s := *sp
- b, n := wire.ConsumeBytes(b)
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
for len(b) > 0 {
var v uint64
@@ -177,19 +177,19 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
- s = append(s, wire.DecodeBool(v))
+ s = append(s, protowire.DecodeBool(v))
b = b[n:]
}
*sp = s
out.n = n
return out, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -201,12 +201,12 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
- *sp = append(*sp, wire.DecodeBool(v))
+ *sp = append(*sp, protowire.DecodeBool(v))
out.n = n
return out, nil
}
@@ -226,9 +226,9 @@
}
n := 0
for _, v := range s {
- n += wire.SizeVarint(wire.EncodeBool(v))
+ n += protowire.SizeVarint(protowire.EncodeBool(v))
}
- return f.tagsize + wire.SizeBytes(n)
+ return f.tagsize + protowire.SizeBytes(n)
}
// appendBoolPackedSlice encodes a []bool pointer as a packed repeated Bool.
@@ -237,14 +237,14 @@
if len(s) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
n := 0
for _, v := range s {
- n += wire.SizeVarint(wire.EncodeBool(v))
+ n += protowire.SizeVarint(protowire.EncodeBool(v))
}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for _, v := range s {
- b = wire.AppendVarint(b, wire.EncodeBool(v))
+ b = protowire.AppendVarint(b, protowire.EncodeBool(v))
}
return b, nil
}
@@ -258,19 +258,19 @@
// sizeBoolValue returns the size of wire encoding a bool value as a Bool.
func sizeBoolValue(v protoreflect.Value, tagsize int, _ marshalOptions) int {
- return tagsize + wire.SizeVarint(wire.EncodeBool(v.Bool()))
+ return tagsize + protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
}
// appendBoolValue encodes a bool value as a Bool.
func appendBoolValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, wire.EncodeBool(v.Bool()))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))
return b, nil
}
// consumeBoolValue decodes a bool value as a Bool.
-func consumeBoolValue(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeBoolValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return protoreflect.Value{}, out, errUnknown
}
var v uint64
@@ -282,13 +282,13 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
- return protoreflect.ValueOfBool(wire.DecodeBool(v)), out, nil
+ return protoreflect.ValueOfBool(protowire.DecodeBool(v)), out, nil
}
var coderBoolValue = valueCoderFuncs{
@@ -303,7 +303,7 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- size += tagsize + wire.SizeVarint(wire.EncodeBool(v.Bool()))
+ size += tagsize + protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
}
return size
}
@@ -313,19 +313,19 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, wire.EncodeBool(v.Bool()))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))
}
return b, nil
}
// consumeBoolSliceValue wire decodes a []bool value as a repeated Bool.
-func consumeBoolSliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consumeBoolSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp == wire.BytesType {
- b, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
for len(b) > 0 {
var v uint64
@@ -337,18 +337,18 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
- list.Append(protoreflect.ValueOfBool(wire.DecodeBool(v)))
+ list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))
b = b[n:]
}
out.n = n
return listv, out, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return protoreflect.Value{}, out, errUnknown
}
var v uint64
@@ -360,12 +360,12 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
- list.Append(protoreflect.ValueOfBool(wire.DecodeBool(v)))
+ list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))
out.n = n
return listv, out, nil
}
@@ -387,9 +387,9 @@
n := 0
for i, llen := 0, llen; i < llen; i++ {
v := list.Get(i)
- n += wire.SizeVarint(wire.EncodeBool(v.Bool()))
+ n += protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
}
- return tagsize + wire.SizeBytes(n)
+ return tagsize + protowire.SizeBytes(n)
}
// appendBoolPackedSliceValue encodes a []bool value as a packed repeated Bool.
@@ -399,16 +399,16 @@
if llen == 0 {
return b, nil
}
- b = wire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, wiretag)
n := 0
for i := 0; i < llen; i++ {
v := list.Get(i)
- n += wire.SizeVarint(wire.EncodeBool(v.Bool()))
+ n += protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for i := 0; i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wire.EncodeBool(v.Bool()))
+ b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))
}
return b, nil
}
@@ -422,19 +422,19 @@
// sizeEnumValue returns the size of wire encoding a value as a Enum.
func sizeEnumValue(v protoreflect.Value, tagsize int, _ marshalOptions) int {
- return tagsize + wire.SizeVarint(uint64(v.Enum()))
+ return tagsize + protowire.SizeVarint(uint64(v.Enum()))
}
// appendEnumValue encodes a value as a Enum.
func appendEnumValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, uint64(v.Enum()))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, uint64(v.Enum()))
return b, nil
}
// consumeEnumValue decodes a value as a Enum.
-func consumeEnumValue(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeEnumValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return protoreflect.Value{}, out, errUnknown
}
var v uint64
@@ -446,10 +446,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), out, nil
@@ -467,7 +467,7 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- size += tagsize + wire.SizeVarint(uint64(v.Enum()))
+ size += tagsize + protowire.SizeVarint(uint64(v.Enum()))
}
return size
}
@@ -477,19 +477,19 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, uint64(v.Enum()))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, uint64(v.Enum()))
}
return b, nil
}
// consumeEnumSliceValue wire decodes a [] value as a repeated Enum.
-func consumeEnumSliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consumeEnumSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp == wire.BytesType {
- b, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
for len(b) > 0 {
var v uint64
@@ -501,10 +501,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))
b = b[n:]
@@ -512,7 +512,7 @@
out.n = n
return listv, out, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return protoreflect.Value{}, out, errUnknown
}
var v uint64
@@ -524,10 +524,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))
out.n = n
@@ -551,9 +551,9 @@
n := 0
for i, llen := 0, llen; i < llen; i++ {
v := list.Get(i)
- n += wire.SizeVarint(uint64(v.Enum()))
+ n += protowire.SizeVarint(uint64(v.Enum()))
}
- return tagsize + wire.SizeBytes(n)
+ return tagsize + protowire.SizeBytes(n)
}
// appendEnumPackedSliceValue encodes a [] value as a packed repeated Enum.
@@ -563,16 +563,16 @@
if llen == 0 {
return b, nil
}
- b = wire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, wiretag)
n := 0
for i := 0; i < llen; i++ {
v := list.Get(i)
- n += wire.SizeVarint(uint64(v.Enum()))
+ n += protowire.SizeVarint(uint64(v.Enum()))
}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for i := 0; i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, uint64(v.Enum()))
+ b = protowire.AppendVarint(b, uint64(v.Enum()))
}
return b, nil
}
@@ -587,20 +587,20 @@
// sizeInt32 returns the size of wire encoding a int32 pointer as a Int32.
func sizeInt32(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := *p.Int32()
- return f.tagsize + wire.SizeVarint(uint64(v))
+ return f.tagsize + protowire.SizeVarint(uint64(v))
}
// appendInt32 wire encodes a int32 pointer as a Int32.
func appendInt32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.Int32()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, uint64(v))
return b, nil
}
// consumeInt32 wire decodes a int32 pointer as a Int32.
-func consumeInt32(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeInt32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -612,10 +612,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*p.Int32() = int32(v)
out.n = n
@@ -636,7 +636,7 @@
if v == 0 {
return 0
}
- return f.tagsize + wire.SizeVarint(uint64(v))
+ return f.tagsize + protowire.SizeVarint(uint64(v))
}
// appendInt32NoZero wire encodes a int32 pointer as a Int32.
@@ -646,8 +646,8 @@
if v == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, uint64(v))
return b, nil
}
@@ -662,21 +662,21 @@
// It panics if the pointer is nil.
func sizeInt32Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := **p.Int32Ptr()
- return f.tagsize + wire.SizeVarint(uint64(v))
+ return f.tagsize + protowire.SizeVarint(uint64(v))
}
// appendInt32Ptr wire encodes a *int32 pointer as a Int32.
// It panics if the pointer is nil.
func appendInt32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := **p.Int32Ptr()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, uint64(v))
return b, nil
}
// consumeInt32Ptr wire decodes a *int32 pointer as a Int32.
-func consumeInt32Ptr(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeInt32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -688,10 +688,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
vp := p.Int32Ptr()
if *vp == nil {
@@ -713,7 +713,7 @@
func sizeInt32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
s := *p.Int32Slice()
for _, v := range s {
- size += f.tagsize + wire.SizeVarint(uint64(v))
+ size += f.tagsize + protowire.SizeVarint(uint64(v))
}
return size
}
@@ -722,20 +722,20 @@
func appendInt32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.Int32Slice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, uint64(v))
}
return b, nil
}
// consumeInt32Slice wire decodes a []int32 pointer as a repeated Int32.
-func consumeInt32Slice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeInt32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.Int32Slice()
- if wtyp == wire.BytesType {
+ if wtyp == protowire.BytesType {
s := *sp
- b, n := wire.ConsumeBytes(b)
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
for len(b) > 0 {
var v uint64
@@ -747,10 +747,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
s = append(s, int32(v))
b = b[n:]
@@ -759,7 +759,7 @@
out.n = n
return out, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -771,10 +771,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*sp = append(*sp, int32(v))
out.n = n
@@ -796,9 +796,9 @@
}
n := 0
for _, v := range s {
- n += wire.SizeVarint(uint64(v))
+ n += protowire.SizeVarint(uint64(v))
}
- return f.tagsize + wire.SizeBytes(n)
+ return f.tagsize + protowire.SizeBytes(n)
}
// appendInt32PackedSlice encodes a []int32 pointer as a packed repeated Int32.
@@ -807,14 +807,14 @@
if len(s) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
n := 0
for _, v := range s {
- n += wire.SizeVarint(uint64(v))
+ n += protowire.SizeVarint(uint64(v))
}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for _, v := range s {
- b = wire.AppendVarint(b, uint64(v))
+ b = protowire.AppendVarint(b, uint64(v))
}
return b, nil
}
@@ -828,19 +828,19 @@
// sizeInt32Value returns the size of wire encoding a int32 value as a Int32.
func sizeInt32Value(v protoreflect.Value, tagsize int, _ marshalOptions) int {
- return tagsize + wire.SizeVarint(uint64(int32(v.Int())))
+ return tagsize + protowire.SizeVarint(uint64(int32(v.Int())))
}
// appendInt32Value encodes a int32 value as a Int32.
func appendInt32Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, uint64(int32(v.Int())))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, uint64(int32(v.Int())))
return b, nil
}
// consumeInt32Value decodes a int32 value as a Int32.
-func consumeInt32Value(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeInt32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return protoreflect.Value{}, out, errUnknown
}
var v uint64
@@ -852,10 +852,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
return protoreflect.ValueOfInt32(int32(v)), out, nil
@@ -873,7 +873,7 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- size += tagsize + wire.SizeVarint(uint64(int32(v.Int())))
+ size += tagsize + protowire.SizeVarint(uint64(int32(v.Int())))
}
return size
}
@@ -883,19 +883,19 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, uint64(int32(v.Int())))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, uint64(int32(v.Int())))
}
return b, nil
}
// consumeInt32SliceValue wire decodes a []int32 value as a repeated Int32.
-func consumeInt32SliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consumeInt32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp == wire.BytesType {
- b, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
for len(b) > 0 {
var v uint64
@@ -907,10 +907,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfInt32(int32(v)))
b = b[n:]
@@ -918,7 +918,7 @@
out.n = n
return listv, out, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return protoreflect.Value{}, out, errUnknown
}
var v uint64
@@ -930,10 +930,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfInt32(int32(v)))
out.n = n
@@ -957,9 +957,9 @@
n := 0
for i, llen := 0, llen; i < llen; i++ {
v := list.Get(i)
- n += wire.SizeVarint(uint64(int32(v.Int())))
+ n += protowire.SizeVarint(uint64(int32(v.Int())))
}
- return tagsize + wire.SizeBytes(n)
+ return tagsize + protowire.SizeBytes(n)
}
// appendInt32PackedSliceValue encodes a []int32 value as a packed repeated Int32.
@@ -969,16 +969,16 @@
if llen == 0 {
return b, nil
}
- b = wire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, wiretag)
n := 0
for i := 0; i < llen; i++ {
v := list.Get(i)
- n += wire.SizeVarint(uint64(int32(v.Int())))
+ n += protowire.SizeVarint(uint64(int32(v.Int())))
}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for i := 0; i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, uint64(int32(v.Int())))
+ b = protowire.AppendVarint(b, uint64(int32(v.Int())))
}
return b, nil
}
@@ -993,20 +993,20 @@
// sizeSint32 returns the size of wire encoding a int32 pointer as a Sint32.
func sizeSint32(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := *p.Int32()
- return f.tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(v)))
+ return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
}
// appendSint32 wire encodes a int32 pointer as a Sint32.
func appendSint32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.Int32()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
return b, nil
}
// consumeSint32 wire decodes a int32 pointer as a Sint32.
-func consumeSint32(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeSint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -1018,12 +1018,12 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
- *p.Int32() = int32(wire.DecodeZigZag(v & math.MaxUint32))
+ *p.Int32() = int32(protowire.DecodeZigZag(v & math.MaxUint32))
out.n = n
return out, nil
}
@@ -1042,7 +1042,7 @@
if v == 0 {
return 0
}
- return f.tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(v)))
+ return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
}
// appendSint32NoZero wire encodes a int32 pointer as a Sint32.
@@ -1052,8 +1052,8 @@
if v == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
return b, nil
}
@@ -1068,21 +1068,21 @@
// It panics if the pointer is nil.
func sizeSint32Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := **p.Int32Ptr()
- return f.tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(v)))
+ return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
}
// appendSint32Ptr wire encodes a *int32 pointer as a Sint32.
// It panics if the pointer is nil.
func appendSint32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := **p.Int32Ptr()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
return b, nil
}
// consumeSint32Ptr wire decodes a *int32 pointer as a Sint32.
-func consumeSint32Ptr(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeSint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -1094,16 +1094,16 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
vp := p.Int32Ptr()
if *vp == nil {
*vp = new(int32)
}
- **vp = int32(wire.DecodeZigZag(v & math.MaxUint32))
+ **vp = int32(protowire.DecodeZigZag(v & math.MaxUint32))
out.n = n
return out, nil
}
@@ -1119,7 +1119,7 @@
func sizeSint32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
s := *p.Int32Slice()
for _, v := range s {
- size += f.tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(v)))
+ size += f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
}
return size
}
@@ -1128,20 +1128,20 @@
func appendSint32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.Int32Slice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
}
return b, nil
}
// consumeSint32Slice wire decodes a []int32 pointer as a repeated Sint32.
-func consumeSint32Slice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeSint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.Int32Slice()
- if wtyp == wire.BytesType {
+ if wtyp == protowire.BytesType {
s := *sp
- b, n := wire.ConsumeBytes(b)
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
for len(b) > 0 {
var v uint64
@@ -1153,19 +1153,19 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
- s = append(s, int32(wire.DecodeZigZag(v&math.MaxUint32)))
+ s = append(s, int32(protowire.DecodeZigZag(v&math.MaxUint32)))
b = b[n:]
}
*sp = s
out.n = n
return out, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -1177,12 +1177,12 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
- *sp = append(*sp, int32(wire.DecodeZigZag(v&math.MaxUint32)))
+ *sp = append(*sp, int32(protowire.DecodeZigZag(v&math.MaxUint32)))
out.n = n
return out, nil
}
@@ -1202,9 +1202,9 @@
}
n := 0
for _, v := range s {
- n += wire.SizeVarint(wire.EncodeZigZag(int64(v)))
+ n += protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
}
- return f.tagsize + wire.SizeBytes(n)
+ return f.tagsize + protowire.SizeBytes(n)
}
// appendSint32PackedSlice encodes a []int32 pointer as a packed repeated Sint32.
@@ -1213,14 +1213,14 @@
if len(s) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
n := 0
for _, v := range s {
- n += wire.SizeVarint(wire.EncodeZigZag(int64(v)))
+ n += protowire.SizeVarint(protowire.EncodeZigZag(int64(v)))
}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for _, v := range s {
- b = wire.AppendVarint(b, wire.EncodeZigZag(int64(v)))
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(v)))
}
return b, nil
}
@@ -1234,19 +1234,19 @@
// sizeSint32Value returns the size of wire encoding a int32 value as a Sint32.
func sizeSint32Value(v protoreflect.Value, tagsize int, _ marshalOptions) int {
- return tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(int32(v.Int()))))
+ return tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
}
// appendSint32Value encodes a int32 value as a Sint32.
func appendSint32Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, wire.EncodeZigZag(int64(int32(v.Int()))))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))
return b, nil
}
// consumeSint32Value decodes a int32 value as a Sint32.
-func consumeSint32Value(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeSint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return protoreflect.Value{}, out, errUnknown
}
var v uint64
@@ -1258,13 +1258,13 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
- return protoreflect.ValueOfInt32(int32(wire.DecodeZigZag(v & math.MaxUint32))), out, nil
+ return protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))), out, nil
}
var coderSint32Value = valueCoderFuncs{
@@ -1279,7 +1279,7 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- size += tagsize + wire.SizeVarint(wire.EncodeZigZag(int64(int32(v.Int()))))
+ size += tagsize + protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
}
return size
}
@@ -1289,19 +1289,19 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, wire.EncodeZigZag(int64(int32(v.Int()))))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))
}
return b, nil
}
// consumeSint32SliceValue wire decodes a []int32 value as a repeated Sint32.
-func consumeSint32SliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consumeSint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp == wire.BytesType {
- b, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
for len(b) > 0 {
var v uint64
@@ -1313,18 +1313,18 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
- list.Append(protoreflect.ValueOfInt32(int32(wire.DecodeZigZag(v & math.MaxUint32))))
+ list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))
b = b[n:]
}
out.n = n
return listv, out, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return protoreflect.Value{}, out, errUnknown
}
var v uint64
@@ -1336,12 +1336,12 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
- list.Append(protoreflect.ValueOfInt32(int32(wire.DecodeZigZag(v & math.MaxUint32))))
+ list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))
out.n = n
return listv, out, nil
}
@@ -1363,9 +1363,9 @@
n := 0
for i, llen := 0, llen; i < llen; i++ {
v := list.Get(i)
- n += wire.SizeVarint(wire.EncodeZigZag(int64(int32(v.Int()))))
+ n += protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
}
- return tagsize + wire.SizeBytes(n)
+ return tagsize + protowire.SizeBytes(n)
}
// appendSint32PackedSliceValue encodes a []int32 value as a packed repeated Sint32.
@@ -1375,16 +1375,16 @@
if llen == 0 {
return b, nil
}
- b = wire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, wiretag)
n := 0
for i := 0; i < llen; i++ {
v := list.Get(i)
- n += wire.SizeVarint(wire.EncodeZigZag(int64(int32(v.Int()))))
+ n += protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for i := 0; i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wire.EncodeZigZag(int64(int32(v.Int()))))
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))
}
return b, nil
}
@@ -1399,20 +1399,20 @@
// sizeUint32 returns the size of wire encoding a uint32 pointer as a Uint32.
func sizeUint32(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := *p.Uint32()
- return f.tagsize + wire.SizeVarint(uint64(v))
+ return f.tagsize + protowire.SizeVarint(uint64(v))
}
// appendUint32 wire encodes a uint32 pointer as a Uint32.
func appendUint32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.Uint32()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, uint64(v))
return b, nil
}
// consumeUint32 wire decodes a uint32 pointer as a Uint32.
-func consumeUint32(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeUint32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -1424,10 +1424,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*p.Uint32() = uint32(v)
out.n = n
@@ -1448,7 +1448,7 @@
if v == 0 {
return 0
}
- return f.tagsize + wire.SizeVarint(uint64(v))
+ return f.tagsize + protowire.SizeVarint(uint64(v))
}
// appendUint32NoZero wire encodes a uint32 pointer as a Uint32.
@@ -1458,8 +1458,8 @@
if v == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, uint64(v))
return b, nil
}
@@ -1474,21 +1474,21 @@
// It panics if the pointer is nil.
func sizeUint32Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := **p.Uint32Ptr()
- return f.tagsize + wire.SizeVarint(uint64(v))
+ return f.tagsize + protowire.SizeVarint(uint64(v))
}
// appendUint32Ptr wire encodes a *uint32 pointer as a Uint32.
// It panics if the pointer is nil.
func appendUint32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := **p.Uint32Ptr()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, uint64(v))
return b, nil
}
// consumeUint32Ptr wire decodes a *uint32 pointer as a Uint32.
-func consumeUint32Ptr(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeUint32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -1500,10 +1500,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
vp := p.Uint32Ptr()
if *vp == nil {
@@ -1525,7 +1525,7 @@
func sizeUint32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
s := *p.Uint32Slice()
for _, v := range s {
- size += f.tagsize + wire.SizeVarint(uint64(v))
+ size += f.tagsize + protowire.SizeVarint(uint64(v))
}
return size
}
@@ -1534,20 +1534,20 @@
func appendUint32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.Uint32Slice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, uint64(v))
}
return b, nil
}
// consumeUint32Slice wire decodes a []uint32 pointer as a repeated Uint32.
-func consumeUint32Slice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeUint32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.Uint32Slice()
- if wtyp == wire.BytesType {
+ if wtyp == protowire.BytesType {
s := *sp
- b, n := wire.ConsumeBytes(b)
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
for len(b) > 0 {
var v uint64
@@ -1559,10 +1559,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
s = append(s, uint32(v))
b = b[n:]
@@ -1571,7 +1571,7 @@
out.n = n
return out, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -1583,10 +1583,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*sp = append(*sp, uint32(v))
out.n = n
@@ -1608,9 +1608,9 @@
}
n := 0
for _, v := range s {
- n += wire.SizeVarint(uint64(v))
+ n += protowire.SizeVarint(uint64(v))
}
- return f.tagsize + wire.SizeBytes(n)
+ return f.tagsize + protowire.SizeBytes(n)
}
// appendUint32PackedSlice encodes a []uint32 pointer as a packed repeated Uint32.
@@ -1619,14 +1619,14 @@
if len(s) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
n := 0
for _, v := range s {
- n += wire.SizeVarint(uint64(v))
+ n += protowire.SizeVarint(uint64(v))
}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for _, v := range s {
- b = wire.AppendVarint(b, uint64(v))
+ b = protowire.AppendVarint(b, uint64(v))
}
return b, nil
}
@@ -1640,19 +1640,19 @@
// sizeUint32Value returns the size of wire encoding a uint32 value as a Uint32.
func sizeUint32Value(v protoreflect.Value, tagsize int, _ marshalOptions) int {
- return tagsize + wire.SizeVarint(uint64(uint32(v.Uint())))
+ return tagsize + protowire.SizeVarint(uint64(uint32(v.Uint())))
}
// appendUint32Value encodes a uint32 value as a Uint32.
func appendUint32Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, uint64(uint32(v.Uint())))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, uint64(uint32(v.Uint())))
return b, nil
}
// consumeUint32Value decodes a uint32 value as a Uint32.
-func consumeUint32Value(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeUint32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return protoreflect.Value{}, out, errUnknown
}
var v uint64
@@ -1664,10 +1664,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
return protoreflect.ValueOfUint32(uint32(v)), out, nil
@@ -1685,7 +1685,7 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- size += tagsize + wire.SizeVarint(uint64(uint32(v.Uint())))
+ size += tagsize + protowire.SizeVarint(uint64(uint32(v.Uint())))
}
return size
}
@@ -1695,19 +1695,19 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, uint64(uint32(v.Uint())))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, uint64(uint32(v.Uint())))
}
return b, nil
}
// consumeUint32SliceValue wire decodes a []uint32 value as a repeated Uint32.
-func consumeUint32SliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consumeUint32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp == wire.BytesType {
- b, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
for len(b) > 0 {
var v uint64
@@ -1719,10 +1719,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfUint32(uint32(v)))
b = b[n:]
@@ -1730,7 +1730,7 @@
out.n = n
return listv, out, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return protoreflect.Value{}, out, errUnknown
}
var v uint64
@@ -1742,10 +1742,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfUint32(uint32(v)))
out.n = n
@@ -1769,9 +1769,9 @@
n := 0
for i, llen := 0, llen; i < llen; i++ {
v := list.Get(i)
- n += wire.SizeVarint(uint64(uint32(v.Uint())))
+ n += protowire.SizeVarint(uint64(uint32(v.Uint())))
}
- return tagsize + wire.SizeBytes(n)
+ return tagsize + protowire.SizeBytes(n)
}
// appendUint32PackedSliceValue encodes a []uint32 value as a packed repeated Uint32.
@@ -1781,16 +1781,16 @@
if llen == 0 {
return b, nil
}
- b = wire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, wiretag)
n := 0
for i := 0; i < llen; i++ {
v := list.Get(i)
- n += wire.SizeVarint(uint64(uint32(v.Uint())))
+ n += protowire.SizeVarint(uint64(uint32(v.Uint())))
}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for i := 0; i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, uint64(uint32(v.Uint())))
+ b = protowire.AppendVarint(b, uint64(uint32(v.Uint())))
}
return b, nil
}
@@ -1805,20 +1805,20 @@
// sizeInt64 returns the size of wire encoding a int64 pointer as a Int64.
func sizeInt64(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := *p.Int64()
- return f.tagsize + wire.SizeVarint(uint64(v))
+ return f.tagsize + protowire.SizeVarint(uint64(v))
}
// appendInt64 wire encodes a int64 pointer as a Int64.
func appendInt64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.Int64()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, uint64(v))
return b, nil
}
// consumeInt64 wire decodes a int64 pointer as a Int64.
-func consumeInt64(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeInt64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -1830,10 +1830,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*p.Int64() = int64(v)
out.n = n
@@ -1854,7 +1854,7 @@
if v == 0 {
return 0
}
- return f.tagsize + wire.SizeVarint(uint64(v))
+ return f.tagsize + protowire.SizeVarint(uint64(v))
}
// appendInt64NoZero wire encodes a int64 pointer as a Int64.
@@ -1864,8 +1864,8 @@
if v == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, uint64(v))
return b, nil
}
@@ -1880,21 +1880,21 @@
// It panics if the pointer is nil.
func sizeInt64Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := **p.Int64Ptr()
- return f.tagsize + wire.SizeVarint(uint64(v))
+ return f.tagsize + protowire.SizeVarint(uint64(v))
}
// appendInt64Ptr wire encodes a *int64 pointer as a Int64.
// It panics if the pointer is nil.
func appendInt64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := **p.Int64Ptr()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, uint64(v))
return b, nil
}
// consumeInt64Ptr wire decodes a *int64 pointer as a Int64.
-func consumeInt64Ptr(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeInt64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -1906,10 +1906,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
vp := p.Int64Ptr()
if *vp == nil {
@@ -1931,7 +1931,7 @@
func sizeInt64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
s := *p.Int64Slice()
for _, v := range s {
- size += f.tagsize + wire.SizeVarint(uint64(v))
+ size += f.tagsize + protowire.SizeVarint(uint64(v))
}
return size
}
@@ -1940,20 +1940,20 @@
func appendInt64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.Int64Slice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, uint64(v))
}
return b, nil
}
// consumeInt64Slice wire decodes a []int64 pointer as a repeated Int64.
-func consumeInt64Slice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeInt64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.Int64Slice()
- if wtyp == wire.BytesType {
+ if wtyp == protowire.BytesType {
s := *sp
- b, n := wire.ConsumeBytes(b)
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
for len(b) > 0 {
var v uint64
@@ -1965,10 +1965,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
s = append(s, int64(v))
b = b[n:]
@@ -1977,7 +1977,7 @@
out.n = n
return out, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -1989,10 +1989,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*sp = append(*sp, int64(v))
out.n = n
@@ -2014,9 +2014,9 @@
}
n := 0
for _, v := range s {
- n += wire.SizeVarint(uint64(v))
+ n += protowire.SizeVarint(uint64(v))
}
- return f.tagsize + wire.SizeBytes(n)
+ return f.tagsize + protowire.SizeBytes(n)
}
// appendInt64PackedSlice encodes a []int64 pointer as a packed repeated Int64.
@@ -2025,14 +2025,14 @@
if len(s) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
n := 0
for _, v := range s {
- n += wire.SizeVarint(uint64(v))
+ n += protowire.SizeVarint(uint64(v))
}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for _, v := range s {
- b = wire.AppendVarint(b, uint64(v))
+ b = protowire.AppendVarint(b, uint64(v))
}
return b, nil
}
@@ -2046,19 +2046,19 @@
// sizeInt64Value returns the size of wire encoding a int64 value as a Int64.
func sizeInt64Value(v protoreflect.Value, tagsize int, _ marshalOptions) int {
- return tagsize + wire.SizeVarint(uint64(v.Int()))
+ return tagsize + protowire.SizeVarint(uint64(v.Int()))
}
// appendInt64Value encodes a int64 value as a Int64.
func appendInt64Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, uint64(v.Int()))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, uint64(v.Int()))
return b, nil
}
// consumeInt64Value decodes a int64 value as a Int64.
-func consumeInt64Value(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeInt64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return protoreflect.Value{}, out, errUnknown
}
var v uint64
@@ -2070,10 +2070,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
return protoreflect.ValueOfInt64(int64(v)), out, nil
@@ -2091,7 +2091,7 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- size += tagsize + wire.SizeVarint(uint64(v.Int()))
+ size += tagsize + protowire.SizeVarint(uint64(v.Int()))
}
return size
}
@@ -2101,19 +2101,19 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, uint64(v.Int()))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, uint64(v.Int()))
}
return b, nil
}
// consumeInt64SliceValue wire decodes a []int64 value as a repeated Int64.
-func consumeInt64SliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consumeInt64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp == wire.BytesType {
- b, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
for len(b) > 0 {
var v uint64
@@ -2125,10 +2125,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfInt64(int64(v)))
b = b[n:]
@@ -2136,7 +2136,7 @@
out.n = n
return listv, out, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return protoreflect.Value{}, out, errUnknown
}
var v uint64
@@ -2148,10 +2148,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfInt64(int64(v)))
out.n = n
@@ -2175,9 +2175,9 @@
n := 0
for i, llen := 0, llen; i < llen; i++ {
v := list.Get(i)
- n += wire.SizeVarint(uint64(v.Int()))
+ n += protowire.SizeVarint(uint64(v.Int()))
}
- return tagsize + wire.SizeBytes(n)
+ return tagsize + protowire.SizeBytes(n)
}
// appendInt64PackedSliceValue encodes a []int64 value as a packed repeated Int64.
@@ -2187,16 +2187,16 @@
if llen == 0 {
return b, nil
}
- b = wire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, wiretag)
n := 0
for i := 0; i < llen; i++ {
v := list.Get(i)
- n += wire.SizeVarint(uint64(v.Int()))
+ n += protowire.SizeVarint(uint64(v.Int()))
}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for i := 0; i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, uint64(v.Int()))
+ b = protowire.AppendVarint(b, uint64(v.Int()))
}
return b, nil
}
@@ -2211,20 +2211,20 @@
// sizeSint64 returns the size of wire encoding a int64 pointer as a Sint64.
func sizeSint64(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := *p.Int64()
- return f.tagsize + wire.SizeVarint(wire.EncodeZigZag(v))
+ return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))
}
// appendSint64 wire encodes a int64 pointer as a Sint64.
func appendSint64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.Int64()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, wire.EncodeZigZag(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
return b, nil
}
// consumeSint64 wire decodes a int64 pointer as a Sint64.
-func consumeSint64(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeSint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -2236,12 +2236,12 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
- *p.Int64() = wire.DecodeZigZag(v)
+ *p.Int64() = protowire.DecodeZigZag(v)
out.n = n
return out, nil
}
@@ -2260,7 +2260,7 @@
if v == 0 {
return 0
}
- return f.tagsize + wire.SizeVarint(wire.EncodeZigZag(v))
+ return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))
}
// appendSint64NoZero wire encodes a int64 pointer as a Sint64.
@@ -2270,8 +2270,8 @@
if v == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, wire.EncodeZigZag(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
return b, nil
}
@@ -2286,21 +2286,21 @@
// It panics if the pointer is nil.
func sizeSint64Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := **p.Int64Ptr()
- return f.tagsize + wire.SizeVarint(wire.EncodeZigZag(v))
+ return f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))
}
// appendSint64Ptr wire encodes a *int64 pointer as a Sint64.
// It panics if the pointer is nil.
func appendSint64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := **p.Int64Ptr()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, wire.EncodeZigZag(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
return b, nil
}
// consumeSint64Ptr wire decodes a *int64 pointer as a Sint64.
-func consumeSint64Ptr(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeSint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -2312,16 +2312,16 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
vp := p.Int64Ptr()
if *vp == nil {
*vp = new(int64)
}
- **vp = wire.DecodeZigZag(v)
+ **vp = protowire.DecodeZigZag(v)
out.n = n
return out, nil
}
@@ -2337,7 +2337,7 @@
func sizeSint64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
s := *p.Int64Slice()
for _, v := range s {
- size += f.tagsize + wire.SizeVarint(wire.EncodeZigZag(v))
+ size += f.tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v))
}
return size
}
@@ -2346,20 +2346,20 @@
func appendSint64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.Int64Slice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, wire.EncodeZigZag(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
}
return b, nil
}
// consumeSint64Slice wire decodes a []int64 pointer as a repeated Sint64.
-func consumeSint64Slice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeSint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.Int64Slice()
- if wtyp == wire.BytesType {
+ if wtyp == protowire.BytesType {
s := *sp
- b, n := wire.ConsumeBytes(b)
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
for len(b) > 0 {
var v uint64
@@ -2371,19 +2371,19 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
- s = append(s, wire.DecodeZigZag(v))
+ s = append(s, protowire.DecodeZigZag(v))
b = b[n:]
}
*sp = s
out.n = n
return out, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -2395,12 +2395,12 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
- *sp = append(*sp, wire.DecodeZigZag(v))
+ *sp = append(*sp, protowire.DecodeZigZag(v))
out.n = n
return out, nil
}
@@ -2420,9 +2420,9 @@
}
n := 0
for _, v := range s {
- n += wire.SizeVarint(wire.EncodeZigZag(v))
+ n += protowire.SizeVarint(protowire.EncodeZigZag(v))
}
- return f.tagsize + wire.SizeBytes(n)
+ return f.tagsize + protowire.SizeBytes(n)
}
// appendSint64PackedSlice encodes a []int64 pointer as a packed repeated Sint64.
@@ -2431,14 +2431,14 @@
if len(s) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
n := 0
for _, v := range s {
- n += wire.SizeVarint(wire.EncodeZigZag(v))
+ n += protowire.SizeVarint(protowire.EncodeZigZag(v))
}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for _, v := range s {
- b = wire.AppendVarint(b, wire.EncodeZigZag(v))
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(v))
}
return b, nil
}
@@ -2452,19 +2452,19 @@
// sizeSint64Value returns the size of wire encoding a int64 value as a Sint64.
func sizeSint64Value(v protoreflect.Value, tagsize int, _ marshalOptions) int {
- return tagsize + wire.SizeVarint(wire.EncodeZigZag(v.Int()))
+ return tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
}
// appendSint64Value encodes a int64 value as a Sint64.
func appendSint64Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, wire.EncodeZigZag(v.Int()))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))
return b, nil
}
// consumeSint64Value decodes a int64 value as a Sint64.
-func consumeSint64Value(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeSint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return protoreflect.Value{}, out, errUnknown
}
var v uint64
@@ -2476,13 +2476,13 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
- return protoreflect.ValueOfInt64(wire.DecodeZigZag(v)), out, nil
+ return protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)), out, nil
}
var coderSint64Value = valueCoderFuncs{
@@ -2497,7 +2497,7 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- size += tagsize + wire.SizeVarint(wire.EncodeZigZag(v.Int()))
+ size += tagsize + protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
}
return size
}
@@ -2507,19 +2507,19 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, wire.EncodeZigZag(v.Int()))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))
}
return b, nil
}
// consumeSint64SliceValue wire decodes a []int64 value as a repeated Sint64.
-func consumeSint64SliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consumeSint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp == wire.BytesType {
- b, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
for len(b) > 0 {
var v uint64
@@ -2531,18 +2531,18 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
- list.Append(protoreflect.ValueOfInt64(wire.DecodeZigZag(v)))
+ list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))
b = b[n:]
}
out.n = n
return listv, out, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return protoreflect.Value{}, out, errUnknown
}
var v uint64
@@ -2554,12 +2554,12 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
- list.Append(protoreflect.ValueOfInt64(wire.DecodeZigZag(v)))
+ list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))
out.n = n
return listv, out, nil
}
@@ -2581,9 +2581,9 @@
n := 0
for i, llen := 0, llen; i < llen; i++ {
v := list.Get(i)
- n += wire.SizeVarint(wire.EncodeZigZag(v.Int()))
+ n += protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
}
- return tagsize + wire.SizeBytes(n)
+ return tagsize + protowire.SizeBytes(n)
}
// appendSint64PackedSliceValue encodes a []int64 value as a packed repeated Sint64.
@@ -2593,16 +2593,16 @@
if llen == 0 {
return b, nil
}
- b = wire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, wiretag)
n := 0
for i := 0; i < llen; i++ {
v := list.Get(i)
- n += wire.SizeVarint(wire.EncodeZigZag(v.Int()))
+ n += protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for i := 0; i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wire.EncodeZigZag(v.Int()))
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))
}
return b, nil
}
@@ -2617,20 +2617,20 @@
// sizeUint64 returns the size of wire encoding a uint64 pointer as a Uint64.
func sizeUint64(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := *p.Uint64()
- return f.tagsize + wire.SizeVarint(v)
+ return f.tagsize + protowire.SizeVarint(v)
}
// appendUint64 wire encodes a uint64 pointer as a Uint64.
func appendUint64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.Uint64()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, v)
return b, nil
}
// consumeUint64 wire decodes a uint64 pointer as a Uint64.
-func consumeUint64(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeUint64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -2642,10 +2642,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*p.Uint64() = v
out.n = n
@@ -2666,7 +2666,7 @@
if v == 0 {
return 0
}
- return f.tagsize + wire.SizeVarint(v)
+ return f.tagsize + protowire.SizeVarint(v)
}
// appendUint64NoZero wire encodes a uint64 pointer as a Uint64.
@@ -2676,8 +2676,8 @@
if v == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, v)
return b, nil
}
@@ -2692,21 +2692,21 @@
// It panics if the pointer is nil.
func sizeUint64Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := **p.Uint64Ptr()
- return f.tagsize + wire.SizeVarint(v)
+ return f.tagsize + protowire.SizeVarint(v)
}
// appendUint64Ptr wire encodes a *uint64 pointer as a Uint64.
// It panics if the pointer is nil.
func appendUint64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := **p.Uint64Ptr()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, v)
return b, nil
}
// consumeUint64Ptr wire decodes a *uint64 pointer as a Uint64.
-func consumeUint64Ptr(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeUint64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -2718,10 +2718,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
vp := p.Uint64Ptr()
if *vp == nil {
@@ -2743,7 +2743,7 @@
func sizeUint64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
s := *p.Uint64Slice()
for _, v := range s {
- size += f.tagsize + wire.SizeVarint(v)
+ size += f.tagsize + protowire.SizeVarint(v)
}
return size
}
@@ -2752,20 +2752,20 @@
func appendUint64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.Uint64Slice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, v)
}
return b, nil
}
// consumeUint64Slice wire decodes a []uint64 pointer as a repeated Uint64.
-func consumeUint64Slice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeUint64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.Uint64Slice()
- if wtyp == wire.BytesType {
+ if wtyp == protowire.BytesType {
s := *sp
- b, n := wire.ConsumeBytes(b)
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
for len(b) > 0 {
var v uint64
@@ -2777,10 +2777,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
s = append(s, v)
b = b[n:]
@@ -2789,7 +2789,7 @@
out.n = n
return out, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
var v uint64
@@ -2801,10 +2801,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*sp = append(*sp, v)
out.n = n
@@ -2826,9 +2826,9 @@
}
n := 0
for _, v := range s {
- n += wire.SizeVarint(v)
+ n += protowire.SizeVarint(v)
}
- return f.tagsize + wire.SizeBytes(n)
+ return f.tagsize + protowire.SizeBytes(n)
}
// appendUint64PackedSlice encodes a []uint64 pointer as a packed repeated Uint64.
@@ -2837,14 +2837,14 @@
if len(s) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
n := 0
for _, v := range s {
- n += wire.SizeVarint(v)
+ n += protowire.SizeVarint(v)
}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for _, v := range s {
- b = wire.AppendVarint(b, v)
+ b = protowire.AppendVarint(b, v)
}
return b, nil
}
@@ -2858,19 +2858,19 @@
// sizeUint64Value returns the size of wire encoding a uint64 value as a Uint64.
func sizeUint64Value(v protoreflect.Value, tagsize int, _ marshalOptions) int {
- return tagsize + wire.SizeVarint(v.Uint())
+ return tagsize + protowire.SizeVarint(v.Uint())
}
// appendUint64Value encodes a uint64 value as a Uint64.
func appendUint64Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, v.Uint())
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, v.Uint())
return b, nil
}
// consumeUint64Value decodes a uint64 value as a Uint64.
-func consumeUint64Value(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeUint64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return protoreflect.Value{}, out, errUnknown
}
var v uint64
@@ -2882,10 +2882,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
return protoreflect.ValueOfUint64(v), out, nil
@@ -2903,7 +2903,7 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- size += tagsize + wire.SizeVarint(v.Uint())
+ size += tagsize + protowire.SizeVarint(v.Uint())
}
return size
}
@@ -2913,19 +2913,19 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendVarint(b, v.Uint())
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, v.Uint())
}
return b, nil
}
// consumeUint64SliceValue wire decodes a []uint64 value as a repeated Uint64.
-func consumeUint64SliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consumeUint64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp == wire.BytesType {
- b, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
for len(b) > 0 {
var v uint64
@@ -2937,10 +2937,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfUint64(v))
b = b[n:]
@@ -2948,7 +2948,7 @@
out.n = n
return listv, out, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return protoreflect.Value{}, out, errUnknown
}
var v uint64
@@ -2960,10 +2960,10 @@
v = uint64(b[0]&0x7f) + uint64(b[1])<<7
n = 2
} else {
- v, n = wire.ConsumeVarint(b)
+ v, n = protowire.ConsumeVarint(b)
}
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfUint64(v))
out.n = n
@@ -2987,9 +2987,9 @@
n := 0
for i, llen := 0, llen; i < llen; i++ {
v := list.Get(i)
- n += wire.SizeVarint(v.Uint())
+ n += protowire.SizeVarint(v.Uint())
}
- return tagsize + wire.SizeBytes(n)
+ return tagsize + protowire.SizeBytes(n)
}
// appendUint64PackedSliceValue encodes a []uint64 value as a packed repeated Uint64.
@@ -2999,16 +2999,16 @@
if llen == 0 {
return b, nil
}
- b = wire.AppendVarint(b, wiretag)
+ b = protowire.AppendVarint(b, wiretag)
n := 0
for i := 0; i < llen; i++ {
v := list.Get(i)
- n += wire.SizeVarint(v.Uint())
+ n += protowire.SizeVarint(v.Uint())
}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for i := 0; i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, v.Uint())
+ b = protowire.AppendVarint(b, v.Uint())
}
return b, nil
}
@@ -3023,25 +3023,25 @@
// sizeSfixed32 returns the size of wire encoding a int32 pointer as a Sfixed32.
func sizeSfixed32(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
- return f.tagsize + wire.SizeFixed32()
+ return f.tagsize + protowire.SizeFixed32()
}
// appendSfixed32 wire encodes a int32 pointer as a Sfixed32.
func appendSfixed32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.Int32()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed32(b, uint32(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed32(b, uint32(v))
return b, nil
}
// consumeSfixed32 wire decodes a int32 pointer as a Sfixed32.
-func consumeSfixed32(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.Fixed32Type {
+func consumeSfixed32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed32Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*p.Int32() = int32(v)
out.n = n
@@ -3062,7 +3062,7 @@
if v == 0 {
return 0
}
- return f.tagsize + wire.SizeFixed32()
+ return f.tagsize + protowire.SizeFixed32()
}
// appendSfixed32NoZero wire encodes a int32 pointer as a Sfixed32.
@@ -3072,8 +3072,8 @@
if v == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed32(b, uint32(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed32(b, uint32(v))
return b, nil
}
@@ -3087,26 +3087,26 @@
// sizeSfixed32Ptr returns the size of wire encoding a *int32 pointer as a Sfixed32.
// It panics if the pointer is nil.
func sizeSfixed32Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
- return f.tagsize + wire.SizeFixed32()
+ return f.tagsize + protowire.SizeFixed32()
}
// appendSfixed32Ptr wire encodes a *int32 pointer as a Sfixed32.
// It panics if the pointer is nil.
func appendSfixed32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := **p.Int32Ptr()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed32(b, uint32(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed32(b, uint32(v))
return b, nil
}
// consumeSfixed32Ptr wire decodes a *int32 pointer as a Sfixed32.
-func consumeSfixed32Ptr(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.Fixed32Type {
+func consumeSfixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed32Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
vp := p.Int32Ptr()
if *vp == nil {
@@ -3127,7 +3127,7 @@
// sizeSfixed32Slice returns the size of wire encoding a []int32 pointer as a repeated Sfixed32.
func sizeSfixed32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
s := *p.Int32Slice()
- size = len(s) * (f.tagsize + wire.SizeFixed32())
+ size = len(s) * (f.tagsize + protowire.SizeFixed32())
return size
}
@@ -3135,25 +3135,25 @@
func appendSfixed32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.Int32Slice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed32(b, uint32(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed32(b, uint32(v))
}
return b, nil
}
// consumeSfixed32Slice wire decodes a []int32 pointer as a repeated Sfixed32.
-func consumeSfixed32Slice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeSfixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.Int32Slice()
- if wtyp == wire.BytesType {
+ if wtyp == protowire.BytesType {
s := *sp
- b, n := wire.ConsumeBytes(b)
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
for len(b) > 0 {
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
s = append(s, int32(v))
b = b[n:]
@@ -3162,12 +3162,12 @@
out.n = n
return out, nil
}
- if wtyp != wire.Fixed32Type {
+ if wtyp != protowire.Fixed32Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*sp = append(*sp, int32(v))
out.n = n
@@ -3187,8 +3187,8 @@
if len(s) == 0 {
return 0
}
- n := len(s) * wire.SizeFixed32()
- return f.tagsize + wire.SizeBytes(n)
+ n := len(s) * protowire.SizeFixed32()
+ return f.tagsize + protowire.SizeBytes(n)
}
// appendSfixed32PackedSlice encodes a []int32 pointer as a packed repeated Sfixed32.
@@ -3197,11 +3197,11 @@
if len(s) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- n := len(s) * wire.SizeFixed32()
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, f.wiretag)
+ n := len(s) * protowire.SizeFixed32()
+ b = protowire.AppendVarint(b, uint64(n))
for _, v := range s {
- b = wire.AppendFixed32(b, uint32(v))
+ b = protowire.AppendFixed32(b, uint32(v))
}
return b, nil
}
@@ -3215,24 +3215,24 @@
// sizeSfixed32Value returns the size of wire encoding a int32 value as a Sfixed32.
func sizeSfixed32Value(v protoreflect.Value, tagsize int, _ marshalOptions) int {
- return tagsize + wire.SizeFixed32()
+ return tagsize + protowire.SizeFixed32()
}
// appendSfixed32Value encodes a int32 value as a Sfixed32.
func appendSfixed32Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendFixed32(b, uint32(v.Int()))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendFixed32(b, uint32(v.Int()))
return b, nil
}
// consumeSfixed32Value decodes a int32 value as a Sfixed32.
-func consumeSfixed32Value(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.Fixed32Type {
+func consumeSfixed32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed32Type {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
return protoreflect.ValueOfInt32(int32(v)), out, nil
@@ -3248,7 +3248,7 @@
// sizeSfixed32SliceValue returns the size of wire encoding a []int32 value as a repeated Sfixed32.
func sizeSfixed32SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) {
list := listv.List()
- size = list.Len() * (tagsize + wire.SizeFixed32())
+ size = list.Len() * (tagsize + protowire.SizeFixed32())
return size
}
@@ -3257,24 +3257,24 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendFixed32(b, uint32(v.Int()))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendFixed32(b, uint32(v.Int()))
}
return b, nil
}
// consumeSfixed32SliceValue wire decodes a []int32 value as a repeated Sfixed32.
-func consumeSfixed32SliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consumeSfixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp == wire.BytesType {
- b, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
for len(b) > 0 {
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfInt32(int32(v)))
b = b[n:]
@@ -3282,12 +3282,12 @@
out.n = n
return listv, out, nil
}
- if wtyp != wire.Fixed32Type {
+ if wtyp != protowire.Fixed32Type {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfInt32(int32(v)))
out.n = n
@@ -3308,8 +3308,8 @@
if llen == 0 {
return 0
}
- n := llen * wire.SizeFixed32()
- return tagsize + wire.SizeBytes(n)
+ n := llen * protowire.SizeFixed32()
+ return tagsize + protowire.SizeBytes(n)
}
// appendSfixed32PackedSliceValue encodes a []int32 value as a packed repeated Sfixed32.
@@ -3319,12 +3319,12 @@
if llen == 0 {
return b, nil
}
- b = wire.AppendVarint(b, wiretag)
- n := llen * wire.SizeFixed32()
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, wiretag)
+ n := llen * protowire.SizeFixed32()
+ b = protowire.AppendVarint(b, uint64(n))
for i := 0; i < llen; i++ {
v := list.Get(i)
- b = wire.AppendFixed32(b, uint32(v.Int()))
+ b = protowire.AppendFixed32(b, uint32(v.Int()))
}
return b, nil
}
@@ -3339,25 +3339,25 @@
// sizeFixed32 returns the size of wire encoding a uint32 pointer as a Fixed32.
func sizeFixed32(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
- return f.tagsize + wire.SizeFixed32()
+ return f.tagsize + protowire.SizeFixed32()
}
// appendFixed32 wire encodes a uint32 pointer as a Fixed32.
func appendFixed32(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.Uint32()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed32(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed32(b, v)
return b, nil
}
// consumeFixed32 wire decodes a uint32 pointer as a Fixed32.
-func consumeFixed32(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.Fixed32Type {
+func consumeFixed32(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed32Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*p.Uint32() = v
out.n = n
@@ -3378,7 +3378,7 @@
if v == 0 {
return 0
}
- return f.tagsize + wire.SizeFixed32()
+ return f.tagsize + protowire.SizeFixed32()
}
// appendFixed32NoZero wire encodes a uint32 pointer as a Fixed32.
@@ -3388,8 +3388,8 @@
if v == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed32(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed32(b, v)
return b, nil
}
@@ -3403,26 +3403,26 @@
// sizeFixed32Ptr returns the size of wire encoding a *uint32 pointer as a Fixed32.
// It panics if the pointer is nil.
func sizeFixed32Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
- return f.tagsize + wire.SizeFixed32()
+ return f.tagsize + protowire.SizeFixed32()
}
// appendFixed32Ptr wire encodes a *uint32 pointer as a Fixed32.
// It panics if the pointer is nil.
func appendFixed32Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := **p.Uint32Ptr()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed32(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed32(b, v)
return b, nil
}
// consumeFixed32Ptr wire decodes a *uint32 pointer as a Fixed32.
-func consumeFixed32Ptr(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.Fixed32Type {
+func consumeFixed32Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed32Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
vp := p.Uint32Ptr()
if *vp == nil {
@@ -3443,7 +3443,7 @@
// sizeFixed32Slice returns the size of wire encoding a []uint32 pointer as a repeated Fixed32.
func sizeFixed32Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
s := *p.Uint32Slice()
- size = len(s) * (f.tagsize + wire.SizeFixed32())
+ size = len(s) * (f.tagsize + protowire.SizeFixed32())
return size
}
@@ -3451,25 +3451,25 @@
func appendFixed32Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.Uint32Slice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed32(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed32(b, v)
}
return b, nil
}
// consumeFixed32Slice wire decodes a []uint32 pointer as a repeated Fixed32.
-func consumeFixed32Slice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeFixed32Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.Uint32Slice()
- if wtyp == wire.BytesType {
+ if wtyp == protowire.BytesType {
s := *sp
- b, n := wire.ConsumeBytes(b)
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
for len(b) > 0 {
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
s = append(s, v)
b = b[n:]
@@ -3478,12 +3478,12 @@
out.n = n
return out, nil
}
- if wtyp != wire.Fixed32Type {
+ if wtyp != protowire.Fixed32Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*sp = append(*sp, v)
out.n = n
@@ -3503,8 +3503,8 @@
if len(s) == 0 {
return 0
}
- n := len(s) * wire.SizeFixed32()
- return f.tagsize + wire.SizeBytes(n)
+ n := len(s) * protowire.SizeFixed32()
+ return f.tagsize + protowire.SizeBytes(n)
}
// appendFixed32PackedSlice encodes a []uint32 pointer as a packed repeated Fixed32.
@@ -3513,11 +3513,11 @@
if len(s) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- n := len(s) * wire.SizeFixed32()
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, f.wiretag)
+ n := len(s) * protowire.SizeFixed32()
+ b = protowire.AppendVarint(b, uint64(n))
for _, v := range s {
- b = wire.AppendFixed32(b, v)
+ b = protowire.AppendFixed32(b, v)
}
return b, nil
}
@@ -3531,24 +3531,24 @@
// sizeFixed32Value returns the size of wire encoding a uint32 value as a Fixed32.
func sizeFixed32Value(v protoreflect.Value, tagsize int, _ marshalOptions) int {
- return tagsize + wire.SizeFixed32()
+ return tagsize + protowire.SizeFixed32()
}
// appendFixed32Value encodes a uint32 value as a Fixed32.
func appendFixed32Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendFixed32(b, uint32(v.Uint()))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendFixed32(b, uint32(v.Uint()))
return b, nil
}
// consumeFixed32Value decodes a uint32 value as a Fixed32.
-func consumeFixed32Value(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.Fixed32Type {
+func consumeFixed32Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed32Type {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
return protoreflect.ValueOfUint32(uint32(v)), out, nil
@@ -3564,7 +3564,7 @@
// sizeFixed32SliceValue returns the size of wire encoding a []uint32 value as a repeated Fixed32.
func sizeFixed32SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) {
list := listv.List()
- size = list.Len() * (tagsize + wire.SizeFixed32())
+ size = list.Len() * (tagsize + protowire.SizeFixed32())
return size
}
@@ -3573,24 +3573,24 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendFixed32(b, uint32(v.Uint()))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendFixed32(b, uint32(v.Uint()))
}
return b, nil
}
// consumeFixed32SliceValue wire decodes a []uint32 value as a repeated Fixed32.
-func consumeFixed32SliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consumeFixed32SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp == wire.BytesType {
- b, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
for len(b) > 0 {
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfUint32(uint32(v)))
b = b[n:]
@@ -3598,12 +3598,12 @@
out.n = n
return listv, out, nil
}
- if wtyp != wire.Fixed32Type {
+ if wtyp != protowire.Fixed32Type {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfUint32(uint32(v)))
out.n = n
@@ -3624,8 +3624,8 @@
if llen == 0 {
return 0
}
- n := llen * wire.SizeFixed32()
- return tagsize + wire.SizeBytes(n)
+ n := llen * protowire.SizeFixed32()
+ return tagsize + protowire.SizeBytes(n)
}
// appendFixed32PackedSliceValue encodes a []uint32 value as a packed repeated Fixed32.
@@ -3635,12 +3635,12 @@
if llen == 0 {
return b, nil
}
- b = wire.AppendVarint(b, wiretag)
- n := llen * wire.SizeFixed32()
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, wiretag)
+ n := llen * protowire.SizeFixed32()
+ b = protowire.AppendVarint(b, uint64(n))
for i := 0; i < llen; i++ {
v := list.Get(i)
- b = wire.AppendFixed32(b, uint32(v.Uint()))
+ b = protowire.AppendFixed32(b, uint32(v.Uint()))
}
return b, nil
}
@@ -3655,25 +3655,25 @@
// sizeFloat returns the size of wire encoding a float32 pointer as a Float.
func sizeFloat(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
- return f.tagsize + wire.SizeFixed32()
+ return f.tagsize + protowire.SizeFixed32()
}
// appendFloat wire encodes a float32 pointer as a Float.
func appendFloat(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.Float32()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed32(b, math.Float32bits(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed32(b, math.Float32bits(v))
return b, nil
}
// consumeFloat wire decodes a float32 pointer as a Float.
-func consumeFloat(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.Fixed32Type {
+func consumeFloat(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed32Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*p.Float32() = math.Float32frombits(v)
out.n = n
@@ -3694,7 +3694,7 @@
if v == 0 && !math.Signbit(float64(v)) {
return 0
}
- return f.tagsize + wire.SizeFixed32()
+ return f.tagsize + protowire.SizeFixed32()
}
// appendFloatNoZero wire encodes a float32 pointer as a Float.
@@ -3704,8 +3704,8 @@
if v == 0 && !math.Signbit(float64(v)) {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed32(b, math.Float32bits(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed32(b, math.Float32bits(v))
return b, nil
}
@@ -3719,26 +3719,26 @@
// sizeFloatPtr returns the size of wire encoding a *float32 pointer as a Float.
// It panics if the pointer is nil.
func sizeFloatPtr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
- return f.tagsize + wire.SizeFixed32()
+ return f.tagsize + protowire.SizeFixed32()
}
// appendFloatPtr wire encodes a *float32 pointer as a Float.
// It panics if the pointer is nil.
func appendFloatPtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := **p.Float32Ptr()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed32(b, math.Float32bits(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed32(b, math.Float32bits(v))
return b, nil
}
// consumeFloatPtr wire decodes a *float32 pointer as a Float.
-func consumeFloatPtr(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.Fixed32Type {
+func consumeFloatPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed32Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
vp := p.Float32Ptr()
if *vp == nil {
@@ -3759,7 +3759,7 @@
// sizeFloatSlice returns the size of wire encoding a []float32 pointer as a repeated Float.
func sizeFloatSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
s := *p.Float32Slice()
- size = len(s) * (f.tagsize + wire.SizeFixed32())
+ size = len(s) * (f.tagsize + protowire.SizeFixed32())
return size
}
@@ -3767,25 +3767,25 @@
func appendFloatSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.Float32Slice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed32(b, math.Float32bits(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed32(b, math.Float32bits(v))
}
return b, nil
}
// consumeFloatSlice wire decodes a []float32 pointer as a repeated Float.
-func consumeFloatSlice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeFloatSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.Float32Slice()
- if wtyp == wire.BytesType {
+ if wtyp == protowire.BytesType {
s := *sp
- b, n := wire.ConsumeBytes(b)
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
for len(b) > 0 {
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
s = append(s, math.Float32frombits(v))
b = b[n:]
@@ -3794,12 +3794,12 @@
out.n = n
return out, nil
}
- if wtyp != wire.Fixed32Type {
+ if wtyp != protowire.Fixed32Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*sp = append(*sp, math.Float32frombits(v))
out.n = n
@@ -3819,8 +3819,8 @@
if len(s) == 0 {
return 0
}
- n := len(s) * wire.SizeFixed32()
- return f.tagsize + wire.SizeBytes(n)
+ n := len(s) * protowire.SizeFixed32()
+ return f.tagsize + protowire.SizeBytes(n)
}
// appendFloatPackedSlice encodes a []float32 pointer as a packed repeated Float.
@@ -3829,11 +3829,11 @@
if len(s) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- n := len(s) * wire.SizeFixed32()
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, f.wiretag)
+ n := len(s) * protowire.SizeFixed32()
+ b = protowire.AppendVarint(b, uint64(n))
for _, v := range s {
- b = wire.AppendFixed32(b, math.Float32bits(v))
+ b = protowire.AppendFixed32(b, math.Float32bits(v))
}
return b, nil
}
@@ -3847,24 +3847,24 @@
// sizeFloatValue returns the size of wire encoding a float32 value as a Float.
func sizeFloatValue(v protoreflect.Value, tagsize int, _ marshalOptions) int {
- return tagsize + wire.SizeFixed32()
+ return tagsize + protowire.SizeFixed32()
}
// appendFloatValue encodes a float32 value as a Float.
func appendFloatValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendFixed32(b, math.Float32bits(float32(v.Float())))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))
return b, nil
}
// consumeFloatValue decodes a float32 value as a Float.
-func consumeFloatValue(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.Fixed32Type {
+func consumeFloatValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed32Type {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
return protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))), out, nil
@@ -3880,7 +3880,7 @@
// sizeFloatSliceValue returns the size of wire encoding a []float32 value as a repeated Float.
func sizeFloatSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) {
list := listv.List()
- size = list.Len() * (tagsize + wire.SizeFixed32())
+ size = list.Len() * (tagsize + protowire.SizeFixed32())
return size
}
@@ -3889,24 +3889,24 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendFixed32(b, math.Float32bits(float32(v.Float())))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))
}
return b, nil
}
// consumeFloatSliceValue wire decodes a []float32 value as a repeated Float.
-func consumeFloatSliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consumeFloatSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp == wire.BytesType {
- b, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
for len(b) > 0 {
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))
b = b[n:]
@@ -3914,12 +3914,12 @@
out.n = n
return listv, out, nil
}
- if wtyp != wire.Fixed32Type {
+ if wtyp != protowire.Fixed32Type {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))
out.n = n
@@ -3940,8 +3940,8 @@
if llen == 0 {
return 0
}
- n := llen * wire.SizeFixed32()
- return tagsize + wire.SizeBytes(n)
+ n := llen * protowire.SizeFixed32()
+ return tagsize + protowire.SizeBytes(n)
}
// appendFloatPackedSliceValue encodes a []float32 value as a packed repeated Float.
@@ -3951,12 +3951,12 @@
if llen == 0 {
return b, nil
}
- b = wire.AppendVarint(b, wiretag)
- n := llen * wire.SizeFixed32()
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, wiretag)
+ n := llen * protowire.SizeFixed32()
+ b = protowire.AppendVarint(b, uint64(n))
for i := 0; i < llen; i++ {
v := list.Get(i)
- b = wire.AppendFixed32(b, math.Float32bits(float32(v.Float())))
+ b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))
}
return b, nil
}
@@ -3971,25 +3971,25 @@
// sizeSfixed64 returns the size of wire encoding a int64 pointer as a Sfixed64.
func sizeSfixed64(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
- return f.tagsize + wire.SizeFixed64()
+ return f.tagsize + protowire.SizeFixed64()
}
// appendSfixed64 wire encodes a int64 pointer as a Sfixed64.
func appendSfixed64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.Int64()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed64(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed64(b, uint64(v))
return b, nil
}
// consumeSfixed64 wire decodes a int64 pointer as a Sfixed64.
-func consumeSfixed64(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.Fixed64Type {
+func consumeSfixed64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed64Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*p.Int64() = int64(v)
out.n = n
@@ -4010,7 +4010,7 @@
if v == 0 {
return 0
}
- return f.tagsize + wire.SizeFixed64()
+ return f.tagsize + protowire.SizeFixed64()
}
// appendSfixed64NoZero wire encodes a int64 pointer as a Sfixed64.
@@ -4020,8 +4020,8 @@
if v == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed64(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed64(b, uint64(v))
return b, nil
}
@@ -4035,26 +4035,26 @@
// sizeSfixed64Ptr returns the size of wire encoding a *int64 pointer as a Sfixed64.
// It panics if the pointer is nil.
func sizeSfixed64Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
- return f.tagsize + wire.SizeFixed64()
+ return f.tagsize + protowire.SizeFixed64()
}
// appendSfixed64Ptr wire encodes a *int64 pointer as a Sfixed64.
// It panics if the pointer is nil.
func appendSfixed64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := **p.Int64Ptr()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed64(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed64(b, uint64(v))
return b, nil
}
// consumeSfixed64Ptr wire decodes a *int64 pointer as a Sfixed64.
-func consumeSfixed64Ptr(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.Fixed64Type {
+func consumeSfixed64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed64Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
vp := p.Int64Ptr()
if *vp == nil {
@@ -4075,7 +4075,7 @@
// sizeSfixed64Slice returns the size of wire encoding a []int64 pointer as a repeated Sfixed64.
func sizeSfixed64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
s := *p.Int64Slice()
- size = len(s) * (f.tagsize + wire.SizeFixed64())
+ size = len(s) * (f.tagsize + protowire.SizeFixed64())
return size
}
@@ -4083,25 +4083,25 @@
func appendSfixed64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.Int64Slice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed64(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed64(b, uint64(v))
}
return b, nil
}
// consumeSfixed64Slice wire decodes a []int64 pointer as a repeated Sfixed64.
-func consumeSfixed64Slice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeSfixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.Int64Slice()
- if wtyp == wire.BytesType {
+ if wtyp == protowire.BytesType {
s := *sp
- b, n := wire.ConsumeBytes(b)
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
for len(b) > 0 {
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
s = append(s, int64(v))
b = b[n:]
@@ -4110,12 +4110,12 @@
out.n = n
return out, nil
}
- if wtyp != wire.Fixed64Type {
+ if wtyp != protowire.Fixed64Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*sp = append(*sp, int64(v))
out.n = n
@@ -4135,8 +4135,8 @@
if len(s) == 0 {
return 0
}
- n := len(s) * wire.SizeFixed64()
- return f.tagsize + wire.SizeBytes(n)
+ n := len(s) * protowire.SizeFixed64()
+ return f.tagsize + protowire.SizeBytes(n)
}
// appendSfixed64PackedSlice encodes a []int64 pointer as a packed repeated Sfixed64.
@@ -4145,11 +4145,11 @@
if len(s) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- n := len(s) * wire.SizeFixed64()
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, f.wiretag)
+ n := len(s) * protowire.SizeFixed64()
+ b = protowire.AppendVarint(b, uint64(n))
for _, v := range s {
- b = wire.AppendFixed64(b, uint64(v))
+ b = protowire.AppendFixed64(b, uint64(v))
}
return b, nil
}
@@ -4163,24 +4163,24 @@
// sizeSfixed64Value returns the size of wire encoding a int64 value as a Sfixed64.
func sizeSfixed64Value(v protoreflect.Value, tagsize int, _ marshalOptions) int {
- return tagsize + wire.SizeFixed64()
+ return tagsize + protowire.SizeFixed64()
}
// appendSfixed64Value encodes a int64 value as a Sfixed64.
func appendSfixed64Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendFixed64(b, uint64(v.Int()))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendFixed64(b, uint64(v.Int()))
return b, nil
}
// consumeSfixed64Value decodes a int64 value as a Sfixed64.
-func consumeSfixed64Value(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.Fixed64Type {
+func consumeSfixed64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed64Type {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
return protoreflect.ValueOfInt64(int64(v)), out, nil
@@ -4196,7 +4196,7 @@
// sizeSfixed64SliceValue returns the size of wire encoding a []int64 value as a repeated Sfixed64.
func sizeSfixed64SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) {
list := listv.List()
- size = list.Len() * (tagsize + wire.SizeFixed64())
+ size = list.Len() * (tagsize + protowire.SizeFixed64())
return size
}
@@ -4205,24 +4205,24 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendFixed64(b, uint64(v.Int()))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendFixed64(b, uint64(v.Int()))
}
return b, nil
}
// consumeSfixed64SliceValue wire decodes a []int64 value as a repeated Sfixed64.
-func consumeSfixed64SliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consumeSfixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp == wire.BytesType {
- b, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
for len(b) > 0 {
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfInt64(int64(v)))
b = b[n:]
@@ -4230,12 +4230,12 @@
out.n = n
return listv, out, nil
}
- if wtyp != wire.Fixed64Type {
+ if wtyp != protowire.Fixed64Type {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfInt64(int64(v)))
out.n = n
@@ -4256,8 +4256,8 @@
if llen == 0 {
return 0
}
- n := llen * wire.SizeFixed64()
- return tagsize + wire.SizeBytes(n)
+ n := llen * protowire.SizeFixed64()
+ return tagsize + protowire.SizeBytes(n)
}
// appendSfixed64PackedSliceValue encodes a []int64 value as a packed repeated Sfixed64.
@@ -4267,12 +4267,12 @@
if llen == 0 {
return b, nil
}
- b = wire.AppendVarint(b, wiretag)
- n := llen * wire.SizeFixed64()
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, wiretag)
+ n := llen * protowire.SizeFixed64()
+ b = protowire.AppendVarint(b, uint64(n))
for i := 0; i < llen; i++ {
v := list.Get(i)
- b = wire.AppendFixed64(b, uint64(v.Int()))
+ b = protowire.AppendFixed64(b, uint64(v.Int()))
}
return b, nil
}
@@ -4287,25 +4287,25 @@
// sizeFixed64 returns the size of wire encoding a uint64 pointer as a Fixed64.
func sizeFixed64(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
- return f.tagsize + wire.SizeFixed64()
+ return f.tagsize + protowire.SizeFixed64()
}
// appendFixed64 wire encodes a uint64 pointer as a Fixed64.
func appendFixed64(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.Uint64()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed64(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed64(b, v)
return b, nil
}
// consumeFixed64 wire decodes a uint64 pointer as a Fixed64.
-func consumeFixed64(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.Fixed64Type {
+func consumeFixed64(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed64Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*p.Uint64() = v
out.n = n
@@ -4326,7 +4326,7 @@
if v == 0 {
return 0
}
- return f.tagsize + wire.SizeFixed64()
+ return f.tagsize + protowire.SizeFixed64()
}
// appendFixed64NoZero wire encodes a uint64 pointer as a Fixed64.
@@ -4336,8 +4336,8 @@
if v == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed64(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed64(b, v)
return b, nil
}
@@ -4351,26 +4351,26 @@
// sizeFixed64Ptr returns the size of wire encoding a *uint64 pointer as a Fixed64.
// It panics if the pointer is nil.
func sizeFixed64Ptr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
- return f.tagsize + wire.SizeFixed64()
+ return f.tagsize + protowire.SizeFixed64()
}
// appendFixed64Ptr wire encodes a *uint64 pointer as a Fixed64.
// It panics if the pointer is nil.
func appendFixed64Ptr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := **p.Uint64Ptr()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed64(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed64(b, v)
return b, nil
}
// consumeFixed64Ptr wire decodes a *uint64 pointer as a Fixed64.
-func consumeFixed64Ptr(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.Fixed64Type {
+func consumeFixed64Ptr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed64Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
vp := p.Uint64Ptr()
if *vp == nil {
@@ -4391,7 +4391,7 @@
// sizeFixed64Slice returns the size of wire encoding a []uint64 pointer as a repeated Fixed64.
func sizeFixed64Slice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
s := *p.Uint64Slice()
- size = len(s) * (f.tagsize + wire.SizeFixed64())
+ size = len(s) * (f.tagsize + protowire.SizeFixed64())
return size
}
@@ -4399,25 +4399,25 @@
func appendFixed64Slice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.Uint64Slice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed64(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed64(b, v)
}
return b, nil
}
// consumeFixed64Slice wire decodes a []uint64 pointer as a repeated Fixed64.
-func consumeFixed64Slice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeFixed64Slice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.Uint64Slice()
- if wtyp == wire.BytesType {
+ if wtyp == protowire.BytesType {
s := *sp
- b, n := wire.ConsumeBytes(b)
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
for len(b) > 0 {
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
s = append(s, v)
b = b[n:]
@@ -4426,12 +4426,12 @@
out.n = n
return out, nil
}
- if wtyp != wire.Fixed64Type {
+ if wtyp != protowire.Fixed64Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*sp = append(*sp, v)
out.n = n
@@ -4451,8 +4451,8 @@
if len(s) == 0 {
return 0
}
- n := len(s) * wire.SizeFixed64()
- return f.tagsize + wire.SizeBytes(n)
+ n := len(s) * protowire.SizeFixed64()
+ return f.tagsize + protowire.SizeBytes(n)
}
// appendFixed64PackedSlice encodes a []uint64 pointer as a packed repeated Fixed64.
@@ -4461,11 +4461,11 @@
if len(s) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- n := len(s) * wire.SizeFixed64()
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, f.wiretag)
+ n := len(s) * protowire.SizeFixed64()
+ b = protowire.AppendVarint(b, uint64(n))
for _, v := range s {
- b = wire.AppendFixed64(b, v)
+ b = protowire.AppendFixed64(b, v)
}
return b, nil
}
@@ -4479,24 +4479,24 @@
// sizeFixed64Value returns the size of wire encoding a uint64 value as a Fixed64.
func sizeFixed64Value(v protoreflect.Value, tagsize int, _ marshalOptions) int {
- return tagsize + wire.SizeFixed64()
+ return tagsize + protowire.SizeFixed64()
}
// appendFixed64Value encodes a uint64 value as a Fixed64.
func appendFixed64Value(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendFixed64(b, v.Uint())
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendFixed64(b, v.Uint())
return b, nil
}
// consumeFixed64Value decodes a uint64 value as a Fixed64.
-func consumeFixed64Value(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.Fixed64Type {
+func consumeFixed64Value(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed64Type {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
return protoreflect.ValueOfUint64(v), out, nil
@@ -4512,7 +4512,7 @@
// sizeFixed64SliceValue returns the size of wire encoding a []uint64 value as a repeated Fixed64.
func sizeFixed64SliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) {
list := listv.List()
- size = list.Len() * (tagsize + wire.SizeFixed64())
+ size = list.Len() * (tagsize + protowire.SizeFixed64())
return size
}
@@ -4521,24 +4521,24 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendFixed64(b, v.Uint())
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendFixed64(b, v.Uint())
}
return b, nil
}
// consumeFixed64SliceValue wire decodes a []uint64 value as a repeated Fixed64.
-func consumeFixed64SliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consumeFixed64SliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp == wire.BytesType {
- b, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
for len(b) > 0 {
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfUint64(v))
b = b[n:]
@@ -4546,12 +4546,12 @@
out.n = n
return listv, out, nil
}
- if wtyp != wire.Fixed64Type {
+ if wtyp != protowire.Fixed64Type {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfUint64(v))
out.n = n
@@ -4572,8 +4572,8 @@
if llen == 0 {
return 0
}
- n := llen * wire.SizeFixed64()
- return tagsize + wire.SizeBytes(n)
+ n := llen * protowire.SizeFixed64()
+ return tagsize + protowire.SizeBytes(n)
}
// appendFixed64PackedSliceValue encodes a []uint64 value as a packed repeated Fixed64.
@@ -4583,12 +4583,12 @@
if llen == 0 {
return b, nil
}
- b = wire.AppendVarint(b, wiretag)
- n := llen * wire.SizeFixed64()
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, wiretag)
+ n := llen * protowire.SizeFixed64()
+ b = protowire.AppendVarint(b, uint64(n))
for i := 0; i < llen; i++ {
v := list.Get(i)
- b = wire.AppendFixed64(b, v.Uint())
+ b = protowire.AppendFixed64(b, v.Uint())
}
return b, nil
}
@@ -4603,25 +4603,25 @@
// sizeDouble returns the size of wire encoding a float64 pointer as a Double.
func sizeDouble(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
- return f.tagsize + wire.SizeFixed64()
+ return f.tagsize + protowire.SizeFixed64()
}
// appendDouble wire encodes a float64 pointer as a Double.
func appendDouble(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.Float64()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed64(b, math.Float64bits(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed64(b, math.Float64bits(v))
return b, nil
}
// consumeDouble wire decodes a float64 pointer as a Double.
-func consumeDouble(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.Fixed64Type {
+func consumeDouble(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed64Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*p.Float64() = math.Float64frombits(v)
out.n = n
@@ -4642,7 +4642,7 @@
if v == 0 && !math.Signbit(float64(v)) {
return 0
}
- return f.tagsize + wire.SizeFixed64()
+ return f.tagsize + protowire.SizeFixed64()
}
// appendDoubleNoZero wire encodes a float64 pointer as a Double.
@@ -4652,8 +4652,8 @@
if v == 0 && !math.Signbit(float64(v)) {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed64(b, math.Float64bits(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed64(b, math.Float64bits(v))
return b, nil
}
@@ -4667,26 +4667,26 @@
// sizeDoublePtr returns the size of wire encoding a *float64 pointer as a Double.
// It panics if the pointer is nil.
func sizeDoublePtr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
- return f.tagsize + wire.SizeFixed64()
+ return f.tagsize + protowire.SizeFixed64()
}
// appendDoublePtr wire encodes a *float64 pointer as a Double.
// It panics if the pointer is nil.
func appendDoublePtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := **p.Float64Ptr()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed64(b, math.Float64bits(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed64(b, math.Float64bits(v))
return b, nil
}
// consumeDoublePtr wire decodes a *float64 pointer as a Double.
-func consumeDoublePtr(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.Fixed64Type {
+func consumeDoublePtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed64Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
vp := p.Float64Ptr()
if *vp == nil {
@@ -4707,7 +4707,7 @@
// sizeDoubleSlice returns the size of wire encoding a []float64 pointer as a repeated Double.
func sizeDoubleSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
s := *p.Float64Slice()
- size = len(s) * (f.tagsize + wire.SizeFixed64())
+ size = len(s) * (f.tagsize + protowire.SizeFixed64())
return size
}
@@ -4715,25 +4715,25 @@
func appendDoubleSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.Float64Slice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendFixed64(b, math.Float64bits(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendFixed64(b, math.Float64bits(v))
}
return b, nil
}
// consumeDoubleSlice wire decodes a []float64 pointer as a repeated Double.
-func consumeDoubleSlice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeDoubleSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.Float64Slice()
- if wtyp == wire.BytesType {
+ if wtyp == protowire.BytesType {
s := *sp
- b, n := wire.ConsumeBytes(b)
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
for len(b) > 0 {
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
s = append(s, math.Float64frombits(v))
b = b[n:]
@@ -4742,12 +4742,12 @@
out.n = n
return out, nil
}
- if wtyp != wire.Fixed64Type {
+ if wtyp != protowire.Fixed64Type {
return out, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*sp = append(*sp, math.Float64frombits(v))
out.n = n
@@ -4767,8 +4767,8 @@
if len(s) == 0 {
return 0
}
- n := len(s) * wire.SizeFixed64()
- return f.tagsize + wire.SizeBytes(n)
+ n := len(s) * protowire.SizeFixed64()
+ return f.tagsize + protowire.SizeBytes(n)
}
// appendDoublePackedSlice encodes a []float64 pointer as a packed repeated Double.
@@ -4777,11 +4777,11 @@
if len(s) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- n := len(s) * wire.SizeFixed64()
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, f.wiretag)
+ n := len(s) * protowire.SizeFixed64()
+ b = protowire.AppendVarint(b, uint64(n))
for _, v := range s {
- b = wire.AppendFixed64(b, math.Float64bits(v))
+ b = protowire.AppendFixed64(b, math.Float64bits(v))
}
return b, nil
}
@@ -4795,24 +4795,24 @@
// sizeDoubleValue returns the size of wire encoding a float64 value as a Double.
func sizeDoubleValue(v protoreflect.Value, tagsize int, _ marshalOptions) int {
- return tagsize + wire.SizeFixed64()
+ return tagsize + protowire.SizeFixed64()
}
// appendDoubleValue encodes a float64 value as a Double.
func appendDoubleValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendFixed64(b, math.Float64bits(v.Float()))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendFixed64(b, math.Float64bits(v.Float()))
return b, nil
}
// consumeDoubleValue decodes a float64 value as a Double.
-func consumeDoubleValue(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.Fixed64Type {
+func consumeDoubleValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.Fixed64Type {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
return protoreflect.ValueOfFloat64(math.Float64frombits(v)), out, nil
@@ -4828,7 +4828,7 @@
// sizeDoubleSliceValue returns the size of wire encoding a []float64 value as a repeated Double.
func sizeDoubleSliceValue(listv protoreflect.Value, tagsize int, _ marshalOptions) (size int) {
list := listv.List()
- size = list.Len() * (tagsize + wire.SizeFixed64())
+ size = list.Len() * (tagsize + protowire.SizeFixed64())
return size
}
@@ -4837,24 +4837,24 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendFixed64(b, math.Float64bits(v.Float()))
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendFixed64(b, math.Float64bits(v.Float()))
}
return b, nil
}
// consumeDoubleSliceValue wire decodes a []float64 value as a repeated Double.
-func consumeDoubleSliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consumeDoubleSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp == wire.BytesType {
- b, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
for len(b) > 0 {
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))
b = b[n:]
@@ -4862,12 +4862,12 @@
out.n = n
return listv, out, nil
}
- if wtyp != wire.Fixed64Type {
+ if wtyp != protowire.Fixed64Type {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))
out.n = n
@@ -4888,8 +4888,8 @@
if llen == 0 {
return 0
}
- n := llen * wire.SizeFixed64()
- return tagsize + wire.SizeBytes(n)
+ n := llen * protowire.SizeFixed64()
+ return tagsize + protowire.SizeBytes(n)
}
// appendDoublePackedSliceValue encodes a []float64 value as a packed repeated Double.
@@ -4899,12 +4899,12 @@
if llen == 0 {
return b, nil
}
- b = wire.AppendVarint(b, wiretag)
- n := llen * wire.SizeFixed64()
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, wiretag)
+ n := llen * protowire.SizeFixed64()
+ b = protowire.AppendVarint(b, uint64(n))
for i := 0; i < llen; i++ {
v := list.Get(i)
- b = wire.AppendFixed64(b, math.Float64bits(v.Float()))
+ b = protowire.AppendFixed64(b, math.Float64bits(v.Float()))
}
return b, nil
}
@@ -4919,25 +4919,25 @@
// sizeString returns the size of wire encoding a string pointer as a String.
func sizeString(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := *p.String()
- return f.tagsize + wire.SizeBytes(len(v))
+ return f.tagsize + protowire.SizeBytes(len(v))
}
// appendString wire encodes a string pointer as a String.
func appendString(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.String()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendString(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendString(b, v)
return b, nil
}
// consumeString wire decodes a string pointer as a String.
-func consumeString(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.BytesType {
+func consumeString(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- v, n := wire.ConsumeString(b)
+ v, n := protowire.ConsumeString(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*p.String() = v
out.n = n
@@ -4954,8 +4954,8 @@
// appendStringValidateUTF8 wire encodes a string pointer as a String.
func appendStringValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.String()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendString(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendString(b, v)
if !utf8.ValidString(v) {
return b, errInvalidUTF8{}
}
@@ -4963,13 +4963,13 @@
}
// consumeStringValidateUTF8 wire decodes a string pointer as a String.
-func consumeStringValidateUTF8(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.BytesType {
+func consumeStringValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- v, n := wire.ConsumeString(b)
+ v, n := protowire.ConsumeString(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
if !utf8.ValidString(v) {
return out, errInvalidUTF8{}
@@ -4993,7 +4993,7 @@
if len(v) == 0 {
return 0
}
- return f.tagsize + wire.SizeBytes(len(v))
+ return f.tagsize + protowire.SizeBytes(len(v))
}
// appendStringNoZero wire encodes a string pointer as a String.
@@ -5003,8 +5003,8 @@
if len(v) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendString(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendString(b, v)
return b, nil
}
@@ -5022,8 +5022,8 @@
if len(v) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendString(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendString(b, v)
if !utf8.ValidString(v) {
return b, errInvalidUTF8{}
}
@@ -5041,26 +5041,26 @@
// It panics if the pointer is nil.
func sizeStringPtr(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := **p.StringPtr()
- return f.tagsize + wire.SizeBytes(len(v))
+ return f.tagsize + protowire.SizeBytes(len(v))
}
// appendStringPtr wire encodes a *string pointer as a String.
// It panics if the pointer is nil.
func appendStringPtr(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := **p.StringPtr()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendString(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendString(b, v)
return b, nil
}
// consumeStringPtr wire decodes a *string pointer as a String.
-func consumeStringPtr(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.BytesType {
+func consumeStringPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- v, n := wire.ConsumeString(b)
+ v, n := protowire.ConsumeString(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
vp := p.StringPtr()
if *vp == nil {
@@ -5082,7 +5082,7 @@
func sizeStringSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
s := *p.StringSlice()
for _, v := range s {
- size += f.tagsize + wire.SizeBytes(len(v))
+ size += f.tagsize + protowire.SizeBytes(len(v))
}
return size
}
@@ -5091,21 +5091,21 @@
func appendStringSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.StringSlice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendString(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendString(b, v)
}
return b, nil
}
// consumeStringSlice wire decodes a []string pointer as a repeated String.
-func consumeStringSlice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeStringSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.StringSlice()
- if wtyp != wire.BytesType {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- v, n := wire.ConsumeString(b)
+ v, n := protowire.ConsumeString(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*sp = append(*sp, v)
out.n = n
@@ -5123,8 +5123,8 @@
func appendStringSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.StringSlice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendString(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendString(b, v)
if !utf8.ValidString(v) {
return b, errInvalidUTF8{}
}
@@ -5133,14 +5133,14 @@
}
// consumeStringSliceValidateUTF8 wire decodes a []string pointer as a repeated String.
-func consumeStringSliceValidateUTF8(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeStringSliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.StringSlice()
- if wtyp != wire.BytesType {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- v, n := wire.ConsumeString(b)
+ v, n := protowire.ConsumeString(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
if !utf8.ValidString(v) {
return out, errInvalidUTF8{}
@@ -5159,24 +5159,24 @@
// sizeStringValue returns the size of wire encoding a string value as a String.
func sizeStringValue(v protoreflect.Value, tagsize int, _ marshalOptions) int {
- return tagsize + wire.SizeBytes(len(v.String()))
+ return tagsize + protowire.SizeBytes(len(v.String()))
}
// appendStringValue encodes a string value as a String.
func appendStringValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendString(b, v.String())
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendString(b, v.String())
return b, nil
}
// consumeStringValue decodes a string value as a String.
-func consumeStringValue(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.BytesType {
+func consumeStringValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.BytesType {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeString(b)
+ v, n := protowire.ConsumeString(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
return protoreflect.ValueOfString(string(v)), out, nil
@@ -5191,8 +5191,8 @@
// appendStringValueValidateUTF8 encodes a string value as a String.
func appendStringValueValidateUTF8(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendString(b, v.String())
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendString(b, v.String())
if !utf8.ValidString(v.String()) {
return b, errInvalidUTF8{}
}
@@ -5200,13 +5200,13 @@
}
// consumeStringValueValidateUTF8 decodes a string value as a String.
-func consumeStringValueValidateUTF8(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.BytesType {
+func consumeStringValueValidateUTF8(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.BytesType {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeString(b)
+ v, n := protowire.ConsumeString(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
if !utf8.ValidString(v) {
return protoreflect.Value{}, out, errInvalidUTF8{}
@@ -5227,7 +5227,7 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- size += tagsize + wire.SizeBytes(len(v.String()))
+ size += tagsize + protowire.SizeBytes(len(v.String()))
}
return size
}
@@ -5237,21 +5237,21 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendString(b, v.String())
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendString(b, v.String())
}
return b, nil
}
// consumeStringSliceValue wire decodes a []string value as a repeated String.
-func consumeStringSliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consumeStringSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp != wire.BytesType {
+ if wtyp != protowire.BytesType {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeString(b)
+ v, n := protowire.ConsumeString(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfString(string(v)))
out.n = n
@@ -5268,25 +5268,25 @@
// sizeBytes returns the size of wire encoding a []byte pointer as a Bytes.
func sizeBytes(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := *p.Bytes()
- return f.tagsize + wire.SizeBytes(len(v))
+ return f.tagsize + protowire.SizeBytes(len(v))
}
// appendBytes wire encodes a []byte pointer as a Bytes.
func appendBytes(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.Bytes()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendBytes(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendBytes(b, v)
return b, nil
}
// consumeBytes wire decodes a []byte pointer as a Bytes.
-func consumeBytes(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.BytesType {
+func consumeBytes(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*p.Bytes() = append(emptyBuf[:], v...)
out.n = n
@@ -5303,8 +5303,8 @@
// appendBytesValidateUTF8 wire encodes a []byte pointer as a Bytes.
func appendBytesValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
v := *p.Bytes()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendBytes(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendBytes(b, v)
if !utf8.Valid(v) {
return b, errInvalidUTF8{}
}
@@ -5312,13 +5312,13 @@
}
// consumeBytesValidateUTF8 wire decodes a []byte pointer as a Bytes.
-func consumeBytesValidateUTF8(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.BytesType {
+func consumeBytesValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
if !utf8.Valid(v) {
return out, errInvalidUTF8{}
@@ -5342,7 +5342,7 @@
if len(v) == 0 {
return 0
}
- return f.tagsize + wire.SizeBytes(len(v))
+ return f.tagsize + protowire.SizeBytes(len(v))
}
// appendBytesNoZero wire encodes a []byte pointer as a Bytes.
@@ -5352,20 +5352,20 @@
if len(v) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendBytes(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendBytes(b, v)
return b, nil
}
// consumeBytesNoZero wire decodes a []byte pointer as a Bytes.
// The zero value is not decoded.
-func consumeBytesNoZero(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.BytesType {
+func consumeBytesNoZero(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*p.Bytes() = append(([]byte)(nil), v...)
out.n = n
@@ -5386,8 +5386,8 @@
if len(v) == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendBytes(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendBytes(b, v)
if !utf8.Valid(v) {
return b, errInvalidUTF8{}
}
@@ -5395,13 +5395,13 @@
}
// consumeBytesNoZeroValidateUTF8 wire decodes a []byte pointer as a Bytes.
-func consumeBytesNoZeroValidateUTF8(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.BytesType {
+func consumeBytesNoZeroValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
if !utf8.Valid(v) {
return out, errInvalidUTF8{}
@@ -5422,7 +5422,7 @@
func sizeBytesSlice(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
s := *p.BytesSlice()
for _, v := range s {
- size += f.tagsize + wire.SizeBytes(len(v))
+ size += f.tagsize + protowire.SizeBytes(len(v))
}
return size
}
@@ -5431,21 +5431,21 @@
func appendBytesSlice(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.BytesSlice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendBytes(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendBytes(b, v)
}
return b, nil
}
// consumeBytesSlice wire decodes a [][]byte pointer as a repeated Bytes.
-func consumeBytesSlice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeBytesSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.BytesSlice()
- if wtyp != wire.BytesType {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
*sp = append(*sp, append(emptyBuf[:], v...))
out.n = n
@@ -5463,8 +5463,8 @@
func appendBytesSliceValidateUTF8(b []byte, p pointer, f *coderFieldInfo, _ marshalOptions) ([]byte, error) {
s := *p.BytesSlice()
for _, v := range s {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendBytes(b, v)
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendBytes(b, v)
if !utf8.Valid(v) {
return b, errInvalidUTF8{}
}
@@ -5473,14 +5473,14 @@
}
// consumeBytesSliceValidateUTF8 wire decodes a [][]byte pointer as a repeated Bytes.
-func consumeBytesSliceValidateUTF8(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeBytesSliceValidateUTF8(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
sp := p.BytesSlice()
- if wtyp != wire.BytesType {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
if !utf8.Valid(v) {
return out, errInvalidUTF8{}
@@ -5499,24 +5499,24 @@
// sizeBytesValue returns the size of wire encoding a []byte value as a Bytes.
func sizeBytesValue(v protoreflect.Value, tagsize int, _ marshalOptions) int {
- return tagsize + wire.SizeBytes(len(v.Bytes()))
+ return tagsize + protowire.SizeBytes(len(v.Bytes()))
}
// appendBytesValue encodes a []byte value as a Bytes.
func appendBytesValue(b []byte, v protoreflect.Value, wiretag uint64, _ marshalOptions) ([]byte, error) {
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendBytes(b, v.Bytes())
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendBytes(b, v.Bytes())
return b, nil
}
// consumeBytesValue decodes a []byte value as a Bytes.
-func consumeBytesValue(b []byte, _ protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
- if wtyp != wire.BytesType {
+func consumeBytesValue(b []byte, _ protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+ if wtyp != protowire.BytesType {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
out.n = n
return protoreflect.ValueOfBytes(append(emptyBuf[:], v...)), out, nil
@@ -5534,7 +5534,7 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- size += tagsize + wire.SizeBytes(len(v.Bytes()))
+ size += tagsize + protowire.SizeBytes(len(v.Bytes()))
}
return size
}
@@ -5544,21 +5544,21 @@
list := listv.List()
for i, llen := 0, list.Len(); i < llen; i++ {
v := list.Get(i)
- b = wire.AppendVarint(b, wiretag)
- b = wire.AppendBytes(b, v.Bytes())
+ b = protowire.AppendVarint(b, wiretag)
+ b = protowire.AppendBytes(b, v.Bytes())
}
return b, nil
}
// consumeBytesSliceValue wire decodes a [][]byte value as a repeated Bytes.
-func consumeBytesSliceValue(b []byte, listv protoreflect.Value, _ wire.Number, wtyp wire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
+func consumeBytesSliceValue(b []byte, listv protoreflect.Value, _ protowire.Number, wtyp protowire.Type, _ unmarshalOptions) (_ protoreflect.Value, out unmarshalOutput, err error) {
list := listv.List()
- if wtyp != wire.BytesType {
+ if wtyp != protowire.BytesType {
return protoreflect.Value{}, out, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return protoreflect.Value{}, out, wire.ParseError(n)
+ return protoreflect.Value{}, out, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfBytes(append(emptyBuf[:], v...)))
out.n = n
@@ -5575,23 +5575,23 @@
// We append to an empty array rather than a nil []byte to get non-nil zero-length byte slices.
var emptyBuf [0]byte
-var wireTypes = map[protoreflect.Kind]wire.Type{
- protoreflect.BoolKind: wire.VarintType,
- protoreflect.EnumKind: wire.VarintType,
- protoreflect.Int32Kind: wire.VarintType,
- protoreflect.Sint32Kind: wire.VarintType,
- protoreflect.Uint32Kind: wire.VarintType,
- protoreflect.Int64Kind: wire.VarintType,
- protoreflect.Sint64Kind: wire.VarintType,
- protoreflect.Uint64Kind: wire.VarintType,
- protoreflect.Sfixed32Kind: wire.Fixed32Type,
- protoreflect.Fixed32Kind: wire.Fixed32Type,
- protoreflect.FloatKind: wire.Fixed32Type,
- protoreflect.Sfixed64Kind: wire.Fixed64Type,
- protoreflect.Fixed64Kind: wire.Fixed64Type,
- protoreflect.DoubleKind: wire.Fixed64Type,
- protoreflect.StringKind: wire.BytesType,
- protoreflect.BytesKind: wire.BytesType,
- protoreflect.MessageKind: wire.BytesType,
- protoreflect.GroupKind: wire.StartGroupType,
+var wireTypes = map[protoreflect.Kind]protowire.Type{
+ protoreflect.BoolKind: protowire.VarintType,
+ protoreflect.EnumKind: protowire.VarintType,
+ protoreflect.Int32Kind: protowire.VarintType,
+ protoreflect.Sint32Kind: protowire.VarintType,
+ protoreflect.Uint32Kind: protowire.VarintType,
+ protoreflect.Int64Kind: protowire.VarintType,
+ protoreflect.Sint64Kind: protowire.VarintType,
+ protoreflect.Uint64Kind: protowire.VarintType,
+ protoreflect.Sfixed32Kind: protowire.Fixed32Type,
+ protoreflect.Fixed32Kind: protowire.Fixed32Type,
+ protoreflect.FloatKind: protowire.Fixed32Type,
+ protoreflect.Sfixed64Kind: protowire.Fixed64Type,
+ protoreflect.Fixed64Kind: protowire.Fixed64Type,
+ protoreflect.DoubleKind: protowire.Fixed64Type,
+ protoreflect.StringKind: protowire.BytesType,
+ protoreflect.BytesKind: protowire.BytesType,
+ protoreflect.MessageKind: protowire.BytesType,
+ protoreflect.GroupKind: protowire.StartGroupType,
}
diff --git a/internal/impl/codec_map.go b/internal/impl/codec_map.go
index dd5f8c7..35a67c2 100644
--- a/internal/impl/codec_map.go
+++ b/internal/impl/codec_map.go
@@ -9,7 +9,7 @@
"reflect"
"sort"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
pref "google.golang.org/protobuf/reflect/protoreflect"
)
@@ -28,8 +28,8 @@
// TODO: Consider generating specialized map coders.
keyField := fd.MapKey()
valField := fd.MapValue()
- keyWiretag := wire.EncodeTag(1, wireTypes[keyField.Kind()])
- valWiretag := wire.EncodeTag(2, wireTypes[valField.Kind()])
+ keyWiretag := protowire.EncodeTag(1, wireTypes[keyField.Kind()])
+ valWiretag := protowire.EncodeTag(2, wireTypes[valField.Kind()])
keyFuncs := encoderFuncsForValue(keyField)
valFuncs := encoderFuncsForValue(valField)
conv := newMapConverter(ft, fd)
@@ -55,7 +55,7 @@
marshal: func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
return appendMap(b, p.AsValueOf(ft).Elem(), mapi, f, opts)
},
- unmarshal: func(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
+ unmarshal: func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error) {
mp := p.AsValueOf(ft)
if mp.Elem().IsNil() {
mp.Elem().Set(reflect.MakeMap(mapi.goType))
@@ -104,31 +104,31 @@
} else {
p := pointerOfValue(iter.Value())
valSize += mapValTagSize
- valSize += wire.SizeBytes(f.mi.sizePointer(p, opts))
+ valSize += protowire.SizeBytes(f.mi.sizePointer(p, opts))
}
- n += f.tagsize + wire.SizeBytes(keySize+valSize)
+ n += f.tagsize + protowire.SizeBytes(keySize+valSize)
}
return n
}
-func consumeMap(b []byte, mapv reflect.Value, wtyp wire.Type, mapi *mapInfo, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.BytesType {
+func consumeMap(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- b, n := wire.ConsumeBytes(b)
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
var (
key = mapi.keyZero
val = mapi.conv.valConv.New()
)
for len(b) > 0 {
- num, wtyp, n := wire.ConsumeTag(b)
+ num, wtyp, n := protowire.ConsumeTag(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
- if num > wire.MaxValidNumber {
+ if num > protowire.MaxValidNumber {
return out, errors.New("invalid field number")
}
b = b[n:]
@@ -154,9 +154,9 @@
n = o.n
}
if err == errUnknown {
- n = wire.ConsumeFieldValue(num, wtyp, b)
+ n = protowire.ConsumeFieldValue(num, wtyp, b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
} else if err != nil {
return out, err
@@ -168,24 +168,24 @@
return out, nil
}
-func consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp wire.Type, mapi *mapInfo, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.BytesType {
+func consumeMapOfMessage(b []byte, mapv reflect.Value, wtyp protowire.Type, mapi *mapInfo, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.BytesType {
return out, errUnknown
}
- b, n := wire.ConsumeBytes(b)
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
var (
key = mapi.keyZero
val = reflect.New(f.mi.GoReflectType.Elem())
)
for len(b) > 0 {
- num, wtyp, n := wire.ConsumeTag(b)
+ num, wtyp, n := protowire.ConsumeTag(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
- if num > wire.MaxValidNumber {
+ if num > protowire.MaxValidNumber {
return out, errors.New("invalid field number")
}
b = b[n:]
@@ -201,13 +201,13 @@
key = v
n = o.n
case 2:
- if wtyp != wire.BytesType {
+ if wtyp != protowire.BytesType {
break
}
var v []byte
- v, n = wire.ConsumeBytes(b)
+ v, n = protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
var o unmarshalOutput
o, err = f.mi.unmarshalPointer(v, pointerOfValue(val), 0, opts)
@@ -218,9 +218,9 @@
}
}
if err == errUnknown {
- n = wire.ConsumeFieldValue(num, wtyp, b)
+ n = protowire.ConsumeFieldValue(num, wtyp, b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
} else if err != nil {
return out, err
@@ -239,7 +239,7 @@
size := 0
size += mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts)
size += mapi.valFuncs.size(val, mapValTagSize, opts)
- b = wire.AppendVarint(b, uint64(size))
+ b = protowire.AppendVarint(b, uint64(size))
b, err := mapi.keyFuncs.marshal(b, key.Value(), mapi.keyWiretag, opts)
if err != nil {
return nil, err
@@ -251,14 +251,14 @@
valSize := f.mi.sizePointer(val, opts)
size := 0
size += mapi.keyFuncs.size(key.Value(), mapKeyTagSize, opts)
- size += mapValTagSize + wire.SizeBytes(valSize)
- b = wire.AppendVarint(b, uint64(size))
+ size += mapValTagSize + protowire.SizeBytes(valSize)
+ b = protowire.AppendVarint(b, uint64(size))
b, err := mapi.keyFuncs.marshal(b, key.Value(), mapi.keyWiretag, opts)
if err != nil {
return nil, err
}
- b = wire.AppendVarint(b, mapi.valWiretag)
- b = wire.AppendVarint(b, uint64(valSize))
+ b = protowire.AppendVarint(b, mapi.valWiretag)
+ b = protowire.AppendVarint(b, uint64(valSize))
return f.mi.marshalAppendPointer(b, val, opts)
}
}
@@ -273,7 +273,7 @@
iter := mapRange(mapv)
for iter.Next() {
var err error
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
b, err = appendMapItem(b, iter.Key(), iter.Value(), mapi, f, opts)
if err != nil {
return b, err
@@ -302,7 +302,7 @@
})
for _, key := range keys {
var err error
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
b, err = appendMapItem(b, key, mapv.MapIndex(key), mapi, f, opts)
if err != nil {
return b, err
diff --git a/internal/impl/codec_message.go b/internal/impl/codec_message.go
index a86468a..370ec65 100644
--- a/internal/impl/codec_message.go
+++ b/internal/impl/codec_message.go
@@ -9,8 +9,8 @@
"reflect"
"sort"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/internal/encoding/wire"
"google.golang.org/protobuf/internal/fieldsort"
pref "google.golang.org/protobuf/reflect/protoreflect"
piface "google.golang.org/protobuf/runtime/protoiface"
@@ -24,7 +24,7 @@
orderedCoderFields []*coderFieldInfo
denseCoderFields []*coderFieldInfo
- coderFields map[wire.Number]*coderFieldInfo
+ coderFields map[protowire.Number]*coderFieldInfo
sizecacheOffset offset
unknownOffset offset
extensionOffset offset
@@ -51,7 +51,7 @@
mi.unknownOffset = si.unknownOffset
mi.extensionOffset = si.extensionOffset
- mi.coderFields = make(map[wire.Number]*coderFieldInfo)
+ mi.coderFields = make(map[protowire.Number]*coderFieldInfo)
fields := mi.Desc.Fields()
for i := 0; i < fields.Len(); i++ {
fd := fields.Get(i)
@@ -63,9 +63,9 @@
ft := fs.Type
var wiretag uint64
if !fd.IsPacked() {
- wiretag = wire.EncodeTag(fd.Number(), wireTypes[fd.Kind()])
+ wiretag = protowire.EncodeTag(fd.Number(), wireTypes[fd.Kind()])
} else {
- wiretag = wire.EncodeTag(fd.Number(), wire.BytesType)
+ wiretag = protowire.EncodeTag(fd.Number(), protowire.BytesType)
}
var fieldOffset offset
var funcs pointerCoderFuncs
@@ -85,7 +85,7 @@
offset: fieldOffset,
wiretag: wiretag,
ft: ft,
- tagsize: wire.SizeVarint(wiretag),
+ tagsize: protowire.SizeVarint(wiretag),
funcs: funcs,
mi: childMessage,
validation: newFieldValidationInfo(mi, si, fd, ft),
diff --git a/internal/impl/codec_messageset.go b/internal/impl/codec_messageset.go
index 432cb49..cfb68e1 100644
--- a/internal/impl/codec_messageset.go
+++ b/internal/impl/codec_messageset.go
@@ -7,8 +7,8 @@
import (
"sort"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/internal/encoding/wire"
"google.golang.org/protobuf/internal/errors"
"google.golang.org/protobuf/internal/flags"
)
@@ -24,9 +24,9 @@
if xi.funcs.size == nil {
continue
}
- num, _ := wire.DecodeTag(xi.wiretag)
+ num, _ := protowire.DecodeTag(xi.wiretag)
size += messageset.SizeField(num)
- size += xi.funcs.size(x.Value(), wire.SizeTag(messageset.FieldMessage), opts)
+ size += xi.funcs.size(x.Value(), protowire.SizeTag(messageset.FieldMessage), opts)
}
unknown := *p.Apply(mi.unknownOffset).Bytes()
@@ -80,9 +80,9 @@
func marshalMessageSetField(mi *MessageInfo, b []byte, x ExtensionField, opts marshalOptions) ([]byte, error) {
xi := getExtensionFieldInfo(x.Type())
- num, _ := wire.DecodeTag(xi.wiretag)
+ num, _ := protowire.DecodeTag(xi.wiretag)
b = messageset.AppendFieldStart(b, num)
- b, err := xi.funcs.marshal(b, x.Value(), wire.EncodeTag(messageset.FieldMessage, wire.BytesType), opts)
+ b, err := xi.funcs.marshal(b, x.Value(), protowire.EncodeTag(messageset.FieldMessage, protowire.BytesType), opts)
if err != nil {
return b, err
}
@@ -102,10 +102,10 @@
ext := *ep
unknown := p.Apply(mi.unknownOffset).Bytes()
initialized := true
- err = messageset.Unmarshal(b, true, func(num wire.Number, v []byte) error {
- o, err := mi.unmarshalExtension(v, num, wire.BytesType, ext, opts)
+ err = messageset.Unmarshal(b, true, func(num protowire.Number, v []byte) error {
+ o, err := mi.unmarshalExtension(v, num, protowire.BytesType, ext, opts)
if err == errUnknown {
- *unknown = wire.AppendTag(*unknown, num, wire.BytesType)
+ *unknown = protowire.AppendTag(*unknown, num, protowire.BytesType)
*unknown = append(*unknown, v...)
return nil
}
diff --git a/internal/impl/codec_reflect.go b/internal/impl/codec_reflect.go
index 85811b0..86f7dc3 100644
--- a/internal/impl/codec_reflect.go
+++ b/internal/impl/codec_reflect.go
@@ -9,28 +9,28 @@
import (
"reflect"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
)
func sizeEnum(p pointer, f *coderFieldInfo, _ marshalOptions) (size int) {
v := p.v.Elem().Int()
- return f.tagsize + wire.SizeVarint(uint64(v))
+ return f.tagsize + protowire.SizeVarint(uint64(v))
}
func appendEnum(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
v := p.v.Elem().Int()
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, uint64(v))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, uint64(v))
return b, nil
}
-func consumeEnum(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeEnum(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, _ unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
p.v.Elem().SetInt(int64(v))
out.n = n
@@ -83,8 +83,8 @@
return appendEnum(b, pointer{p.v.Elem()}, f, opts)
}
-func consumeEnumPtr(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
- if wtyp != wire.VarintType {
+func consumeEnumPtr(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
if p.v.Elem().IsNil() {
@@ -111,7 +111,7 @@
func sizeEnumSlice(p pointer, f *coderFieldInfo, opts marshalOptions) (size int) {
s := p.v.Elem()
for i, llen := 0, s.Len(); i < llen; i++ {
- size += wire.SizeVarint(uint64(s.Index(i).Int())) + f.tagsize
+ size += protowire.SizeVarint(uint64(s.Index(i).Int())) + f.tagsize
}
return size
}
@@ -119,23 +119,23 @@
func appendEnumSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
s := p.v.Elem()
for i, llen := 0, s.Len(); i < llen; i++ {
- b = wire.AppendVarint(b, f.wiretag)
- b = wire.AppendVarint(b, uint64(s.Index(i).Int()))
+ b = protowire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, uint64(s.Index(i).Int()))
}
return b, nil
}
-func consumeEnumSlice(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
+func consumeEnumSlice(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (out unmarshalOutput, err error) {
s := p.v.Elem()
- if wtyp == wire.BytesType {
- b, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ b, n := protowire.ConsumeBytes(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
for len(b) > 0 {
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
rv := reflect.New(s.Type().Elem()).Elem()
rv.SetInt(int64(v))
@@ -145,12 +145,12 @@
out.n = n
return out, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return out, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
rv := reflect.New(s.Type().Elem()).Elem()
rv.SetInt(int64(v))
@@ -178,9 +178,9 @@
}
n := 0
for i := 0; i < llen; i++ {
- n += wire.SizeVarint(uint64(s.Index(i).Int()))
+ n += protowire.SizeVarint(uint64(s.Index(i).Int()))
}
- return f.tagsize + wire.SizeBytes(n)
+ return f.tagsize + protowire.SizeBytes(n)
}
func appendEnumPackedSlice(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error) {
@@ -189,14 +189,14 @@
if llen == 0 {
return b, nil
}
- b = wire.AppendVarint(b, f.wiretag)
+ b = protowire.AppendVarint(b, f.wiretag)
n := 0
for i := 0; i < llen; i++ {
- n += wire.SizeVarint(uint64(s.Index(i).Int()))
+ n += protowire.SizeVarint(uint64(s.Index(i).Int()))
}
- b = wire.AppendVarint(b, uint64(n))
+ b = protowire.AppendVarint(b, uint64(n))
for i := 0; i < llen; i++ {
- b = wire.AppendVarint(b, uint64(s.Index(i).Int()))
+ b = protowire.AppendVarint(b, uint64(s.Index(i).Int()))
}
return b, nil
}
diff --git a/internal/impl/codec_tables.go b/internal/impl/codec_tables.go
index ef30356..c934c8d 100644
--- a/internal/impl/codec_tables.go
+++ b/internal/impl/codec_tables.go
@@ -8,7 +8,7 @@
"fmt"
"reflect"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/strs"
pref "google.golang.org/protobuf/reflect/protoreflect"
)
@@ -18,7 +18,7 @@
mi *MessageInfo
size func(p pointer, f *coderFieldInfo, opts marshalOptions) int
marshal func(b []byte, p pointer, f *coderFieldInfo, opts marshalOptions) ([]byte, error)
- unmarshal func(b []byte, p pointer, wtyp wire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error)
+ unmarshal func(b []byte, p pointer, wtyp protowire.Type, f *coderFieldInfo, opts unmarshalOptions) (unmarshalOutput, error)
isInit func(p pointer, f *coderFieldInfo) error
merge func(dst, src pointer, f *coderFieldInfo, opts mergeOptions)
}
@@ -27,7 +27,7 @@
type valueCoderFuncs struct {
size func(v pref.Value, tagsize int, opts marshalOptions) int
marshal func(b []byte, v pref.Value, wiretag uint64, opts marshalOptions) ([]byte, error)
- unmarshal func(b []byte, v pref.Value, num wire.Number, wtyp wire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error)
+ unmarshal func(b []byte, v pref.Value, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (pref.Value, unmarshalOutput, error)
isInit func(v pref.Value) error
merge func(dst, src pref.Value, opts mergeOptions) pref.Value
}
diff --git a/internal/impl/decode.go b/internal/impl/decode.go
index 5a19f23..85ba1d3 100644
--- a/internal/impl/decode.go
+++ b/internal/impl/decode.go
@@ -7,7 +7,7 @@
import (
"math/bits"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/errors"
"google.golang.org/protobuf/internal/flags"
"google.golang.org/protobuf/proto"
@@ -78,7 +78,7 @@
// This is a sentinel error which should never be visible to the user.
var errUnknown = errors.New("unknown")
-func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag wire.Number, opts unmarshalOptions) (out unmarshalOutput, err error) {
+func (mi *MessageInfo) unmarshalPointer(b []byte, p pointer, groupTag protowire.Number, opts unmarshalOptions) (out unmarshalOutput, err error) {
mi.init()
if flags.ProtoLegacy && mi.isMessageSet {
return unmarshalMessageSet(mi, b, p, opts)
@@ -98,21 +98,21 @@
b = b[2:]
} else {
var n int
- tag, n = wire.ConsumeVarint(b)
+ tag, n = protowire.ConsumeVarint(b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
b = b[n:]
}
- var num wire.Number
- if n := tag >> 3; n < uint64(wire.MinValidNumber) || n > uint64(wire.MaxValidNumber) {
+ var num protowire.Number
+ if n := tag >> 3; n < uint64(protowire.MinValidNumber) || n > uint64(protowire.MaxValidNumber) {
return out, errors.New("invalid field number")
} else {
- num = wire.Number(n)
+ num = protowire.Number(n)
}
- wtyp := wire.Type(tag & 7)
+ wtyp := protowire.Type(tag & 7)
- if wtyp == wire.EndGroupType {
+ if wtyp == protowire.EndGroupType {
if num != groupTag {
return out, errors.New("mismatching end group marker")
}
@@ -168,13 +168,13 @@
if err != errUnknown {
return out, err
}
- n = wire.ConsumeFieldValue(num, wtyp, b)
+ n = protowire.ConsumeFieldValue(num, wtyp, b)
if n < 0 {
- return out, wire.ParseError(n)
+ return out, protowire.ParseError(n)
}
if !opts.DiscardUnknown() && mi.unknownOffset.IsValid() {
u := p.Apply(mi.unknownOffset).Bytes()
- *u = wire.AppendTag(*u, num, wtyp)
+ *u = protowire.AppendTag(*u, num, wtyp)
*u = append(*u, b[:n]...)
}
}
@@ -193,7 +193,7 @@
return out, nil
}
-func (mi *MessageInfo) unmarshalExtension(b []byte, num wire.Number, wtyp wire.Type, exts map[int32]ExtensionField, opts unmarshalOptions) (out unmarshalOutput, err error) {
+func (mi *MessageInfo) unmarshalExtension(b []byte, num protowire.Number, wtyp protowire.Type, exts map[int32]ExtensionField, opts unmarshalOptions) (out unmarshalOutput, err error) {
x := exts[int32(num)]
xt := x.Type()
if xt == nil {
@@ -245,17 +245,17 @@
return out, nil
}
-func skipExtension(b []byte, xi *extensionFieldInfo, num wire.Number, wtyp wire.Type, opts unmarshalOptions) (out unmarshalOutput, _ ValidationStatus) {
+func skipExtension(b []byte, xi *extensionFieldInfo, num protowire.Number, wtyp protowire.Type, opts unmarshalOptions) (out unmarshalOutput, _ ValidationStatus) {
if xi.validation.mi == nil {
return out, ValidationUnknown
}
xi.validation.mi.init()
switch xi.validation.typ {
case validationTypeMessage:
- if wtyp != wire.BytesType {
+ if wtyp != protowire.BytesType {
return out, ValidationUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
return out, ValidationUnknown
}
@@ -263,7 +263,7 @@
out.n = n
return out, st
case validationTypeGroup:
- if wtyp != wire.StartGroupType {
+ if wtyp != protowire.StartGroupType {
return out, ValidationUnknown
}
out, st := xi.validation.mi.validate(b, num, opts)
diff --git a/internal/impl/validate.go b/internal/impl/validate.go
index c0148ab..39d62fd 100644
--- a/internal/impl/validate.go
+++ b/internal/impl/validate.go
@@ -11,8 +11,8 @@
"reflect"
"unicode/utf8"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/internal/encoding/wire"
"google.golang.org/protobuf/internal/flags"
"google.golang.org/protobuf/internal/strs"
pref "google.golang.org/protobuf/reflect/protoreflect"
@@ -163,11 +163,11 @@
}
default:
switch wireTypes[fd.Kind()] {
- case wire.VarintType:
+ case protowire.VarintType:
vi.typ = validationTypeRepeatedVarint
- case wire.Fixed32Type:
+ case protowire.Fixed32Type:
vi.typ = validationTypeRepeatedFixed32
- case wire.Fixed64Type:
+ case protowire.Fixed64Type:
vi.typ = validationTypeRepeatedFixed64
}
}
@@ -207,13 +207,13 @@
}
default:
switch wireTypes[fd.Kind()] {
- case wire.VarintType:
+ case protowire.VarintType:
vi.typ = validationTypeVarint
- case wire.Fixed32Type:
+ case protowire.Fixed32Type:
vi.typ = validationTypeFixed32
- case wire.Fixed64Type:
+ case protowire.Fixed64Type:
vi.typ = validationTypeFixed64
- case wire.BytesType:
+ case protowire.BytesType:
vi.typ = validationTypeBytes
}
}
@@ -221,12 +221,12 @@
return vi
}
-func (mi *MessageInfo) validate(b []byte, groupTag wire.Number, opts unmarshalOptions) (out unmarshalOutput, result ValidationStatus) {
+func (mi *MessageInfo) validate(b []byte, groupTag protowire.Number, opts unmarshalOptions) (out unmarshalOutput, result ValidationStatus) {
mi.init()
type validationState struct {
typ validationType
keyType, valType validationType
- endGroup wire.Number
+ endGroup protowire.Number
mi *MessageInfo
tail []byte
requiredMask uint64
@@ -258,21 +258,21 @@
b = b[2:]
} else {
var n int
- tag, n = wire.ConsumeVarint(b)
+ tag, n = protowire.ConsumeVarint(b)
if n < 0 {
return out, ValidationInvalid
}
b = b[n:]
}
- var num wire.Number
- if n := tag >> 3; n < uint64(wire.MinValidNumber) || n > uint64(wire.MaxValidNumber) {
+ var num protowire.Number
+ if n := tag >> 3; n < uint64(protowire.MinValidNumber) || n > uint64(protowire.MaxValidNumber) {
return out, ValidationInvalid
} else {
- num = wire.Number(n)
+ num = protowire.Number(n)
}
- wtyp := wire.Type(tag & 7)
+ wtyp := protowire.Type(tag & 7)
- if wtyp == wire.EndGroupType {
+ if wtyp == protowire.EndGroupType {
if st.endGroup == num {
goto PopState
}
@@ -348,15 +348,15 @@
ok := false
switch vi.typ {
case validationTypeVarint:
- ok = wtyp == wire.VarintType
+ ok = wtyp == protowire.VarintType
case validationTypeFixed32:
- ok = wtyp == wire.Fixed32Type
+ ok = wtyp == protowire.Fixed32Type
case validationTypeFixed64:
- ok = wtyp == wire.Fixed64Type
+ ok = wtyp == protowire.Fixed64Type
case validationTypeBytes, validationTypeUTF8String, validationTypeMessage:
- ok = wtyp == wire.BytesType
+ ok = wtyp == protowire.BytesType
case validationTypeGroup:
- ok = wtyp == wire.StartGroupType
+ ok = wtyp == protowire.StartGroupType
}
if ok {
st.requiredMask |= vi.requiredBit
@@ -364,7 +364,7 @@
}
switch wtyp {
- case wire.VarintType:
+ case protowire.VarintType:
if len(b) >= 10 {
switch {
case b[0] < 0x80:
@@ -417,7 +417,7 @@
}
}
continue State
- case wire.BytesType:
+ case protowire.BytesType:
var size uint64
if len(b) >= 1 && b[0] < 0x80 {
size = uint64(b[0])
@@ -427,7 +427,7 @@
b = b[2:]
} else {
var n int
- size, n = wire.ConsumeVarint(b)
+ size, n = protowire.ConsumeVarint(b)
if n < 0 {
return out, ValidationInvalid
}
@@ -461,7 +461,7 @@
case validationTypeRepeatedVarint:
// Packed field.
for len(v) > 0 {
- _, n := wire.ConsumeVarint(v)
+ _, n := protowire.ConsumeVarint(v)
if n < 0 {
return out, ValidationInvalid
}
@@ -482,17 +482,17 @@
return out, ValidationInvalid
}
}
- case wire.Fixed32Type:
+ case protowire.Fixed32Type:
if len(b) < 4 {
return out, ValidationInvalid
}
b = b[4:]
- case wire.Fixed64Type:
+ case protowire.Fixed64Type:
if len(b) < 8 {
return out, ValidationInvalid
}
b = b[8:]
- case wire.StartGroupType:
+ case protowire.StartGroupType:
switch {
case vi.typ == validationTypeGroup:
if vi.mi == nil {
@@ -530,7 +530,7 @@
continue State
}
default:
- n := wire.ConsumeFieldValue(num, wtyp, b)
+ n := protowire.ConsumeFieldValue(num, wtyp, b)
if n < 0 {
return out, ValidationInvalid
}
diff --git a/proto/decode.go b/proto/decode.go
index 536491b..1282147 100644
--- a/proto/decode.go
+++ b/proto/decode.go
@@ -5,8 +5,8 @@
package proto
import (
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/internal/encoding/wire"
"google.golang.org/protobuf/internal/errors"
"google.golang.org/protobuf/internal/flags"
"google.golang.org/protobuf/internal/pragma"
@@ -110,11 +110,11 @@
fields := md.Fields()
for len(b) > 0 {
// Parse the tag (field number and wire type).
- num, wtyp, tagLen := wire.ConsumeTag(b)
+ num, wtyp, tagLen := protowire.ConsumeTag(b)
if tagLen < 0 {
- return wire.ParseError(tagLen)
+ return protowire.ParseError(tagLen)
}
- if num > wire.MaxValidNumber {
+ if num > protowire.MaxValidNumber {
return errors.New("invalid field number")
}
@@ -153,9 +153,9 @@
if err != errUnknown {
return err
}
- valLen = wire.ConsumeFieldValue(num, wtyp, b[tagLen:])
+ valLen = protowire.ConsumeFieldValue(num, wtyp, b[tagLen:])
if valLen < 0 {
- return wire.ParseError(valLen)
+ return protowire.ParseError(valLen)
}
if !o.DiscardUnknown {
m.SetUnknown(append(m.GetUnknown(), b[:tagLen+valLen]...))
@@ -166,7 +166,7 @@
return nil
}
-func (o UnmarshalOptions) unmarshalSingular(b []byte, wtyp wire.Type, m protoreflect.Message, fd protoreflect.FieldDescriptor) (n int, err error) {
+func (o UnmarshalOptions) unmarshalSingular(b []byte, wtyp protowire.Type, m protoreflect.Message, fd protoreflect.FieldDescriptor) (n int, err error) {
v, n, err := o.unmarshalScalar(b, wtyp, fd)
if err != nil {
return 0, err
@@ -184,13 +184,13 @@
return n, nil
}
-func (o UnmarshalOptions) unmarshalMap(b []byte, wtyp wire.Type, mapv protoreflect.Map, fd protoreflect.FieldDescriptor) (n int, err error) {
- if wtyp != wire.BytesType {
+func (o UnmarshalOptions) unmarshalMap(b []byte, wtyp protowire.Type, mapv protoreflect.Map, fd protoreflect.FieldDescriptor) (n int, err error) {
+ if wtyp != protowire.BytesType {
return 0, errUnknown
}
- b, n = wire.ConsumeBytes(b)
+ b, n = protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
var (
keyField = fd.MapKey()
@@ -207,11 +207,11 @@
// Map entries are represented as a two-element message with fields
// containing the key and value.
for len(b) > 0 {
- num, wtyp, n := wire.ConsumeTag(b)
+ num, wtyp, n := protowire.ConsumeTag(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
- if num > wire.MaxValidNumber {
+ if num > protowire.MaxValidNumber {
return 0, errors.New("invalid field number")
}
b = b[n:]
@@ -240,9 +240,9 @@
haveVal = true
}
if err == errUnknown {
- n = wire.ConsumeFieldValue(num, wtyp, b)
+ n = protowire.ConsumeFieldValue(num, wtyp, b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
} else if err != nil {
return 0, err
diff --git a/proto/decode_gen.go b/proto/decode_gen.go
index b850fb4..d6dc904 100644
--- a/proto/decode_gen.go
+++ b/proto/decode_gen.go
@@ -10,7 +10,7 @@
"math"
"unicode/utf8"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/errors"
"google.golang.org/protobuf/internal/strs"
"google.golang.org/protobuf/reflect/protoreflect"
@@ -19,171 +19,171 @@
// unmarshalScalar decodes a value of the given kind.
//
// Message values are decoded into a []byte which aliases the input data.
-func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp wire.Type, fd protoreflect.FieldDescriptor) (val protoreflect.Value, n int, err error) {
+func (o UnmarshalOptions) unmarshalScalar(b []byte, wtyp protowire.Type, fd protoreflect.FieldDescriptor) (val protoreflect.Value, n int, err error) {
switch fd.Kind() {
case protoreflect.BoolKind:
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return val, 0, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
- return protoreflect.ValueOfBool(wire.DecodeBool(v)), n, nil
+ return protoreflect.ValueOfBool(protowire.DecodeBool(v)), n, nil
case protoreflect.EnumKind:
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return val, 0, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
return protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)), n, nil
case protoreflect.Int32Kind:
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return val, 0, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
return protoreflect.ValueOfInt32(int32(v)), n, nil
case protoreflect.Sint32Kind:
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return val, 0, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
- return protoreflect.ValueOfInt32(int32(wire.DecodeZigZag(v & math.MaxUint32))), n, nil
+ return protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))), n, nil
case protoreflect.Uint32Kind:
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return val, 0, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
return protoreflect.ValueOfUint32(uint32(v)), n, nil
case protoreflect.Int64Kind:
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return val, 0, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
return protoreflect.ValueOfInt64(int64(v)), n, nil
case protoreflect.Sint64Kind:
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return val, 0, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
- return protoreflect.ValueOfInt64(wire.DecodeZigZag(v)), n, nil
+ return protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)), n, nil
case protoreflect.Uint64Kind:
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return val, 0, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
return protoreflect.ValueOfUint64(v), n, nil
case protoreflect.Sfixed32Kind:
- if wtyp != wire.Fixed32Type {
+ if wtyp != protowire.Fixed32Type {
return val, 0, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
return protoreflect.ValueOfInt32(int32(v)), n, nil
case protoreflect.Fixed32Kind:
- if wtyp != wire.Fixed32Type {
+ if wtyp != protowire.Fixed32Type {
return val, 0, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
return protoreflect.ValueOfUint32(uint32(v)), n, nil
case protoreflect.FloatKind:
- if wtyp != wire.Fixed32Type {
+ if wtyp != protowire.Fixed32Type {
return val, 0, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
return protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))), n, nil
case protoreflect.Sfixed64Kind:
- if wtyp != wire.Fixed64Type {
+ if wtyp != protowire.Fixed64Type {
return val, 0, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
return protoreflect.ValueOfInt64(int64(v)), n, nil
case protoreflect.Fixed64Kind:
- if wtyp != wire.Fixed64Type {
+ if wtyp != protowire.Fixed64Type {
return val, 0, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
return protoreflect.ValueOfUint64(v), n, nil
case protoreflect.DoubleKind:
- if wtyp != wire.Fixed64Type {
+ if wtyp != protowire.Fixed64Type {
return val, 0, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
return protoreflect.ValueOfFloat64(math.Float64frombits(v)), n, nil
case protoreflect.StringKind:
- if wtyp != wire.BytesType {
+ if wtyp != protowire.BytesType {
return val, 0, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
if strs.EnforceUTF8(fd) && !utf8.Valid(v) {
return protoreflect.Value{}, 0, errors.InvalidUTF8(string(fd.FullName()))
}
return protoreflect.ValueOfString(string(v)), n, nil
case protoreflect.BytesKind:
- if wtyp != wire.BytesType {
+ if wtyp != protowire.BytesType {
return val, 0, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
return protoreflect.ValueOfBytes(append(emptyBuf[:], v...)), n, nil
case protoreflect.MessageKind:
- if wtyp != wire.BytesType {
+ if wtyp != protowire.BytesType {
return val, 0, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
return protoreflect.ValueOfBytes(v), n, nil
case protoreflect.GroupKind:
- if wtyp != wire.StartGroupType {
+ if wtyp != protowire.StartGroupType {
return val, 0, errUnknown
}
- v, n := wire.ConsumeGroup(fd.Number(), b)
+ v, n := protowire.ConsumeGroup(fd.Number(), b)
if n < 0 {
- return val, 0, wire.ParseError(n)
+ return val, 0, protowire.ParseError(n)
}
return protoreflect.ValueOfBytes(v), n, nil
default:
@@ -191,365 +191,365 @@
}
}
-func (o UnmarshalOptions) unmarshalList(b []byte, wtyp wire.Type, list protoreflect.List, fd protoreflect.FieldDescriptor) (n int, err error) {
+func (o UnmarshalOptions) unmarshalList(b []byte, wtyp protowire.Type, list protoreflect.List, fd protoreflect.FieldDescriptor) (n int, err error) {
switch fd.Kind() {
case protoreflect.BoolKind:
- if wtyp == wire.BytesType {
- buf, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ buf, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
for len(buf) > 0 {
- v, n := wire.ConsumeVarint(buf)
+ v, n := protowire.ConsumeVarint(buf)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
buf = buf[n:]
- list.Append(protoreflect.ValueOfBool(wire.DecodeBool(v)))
+ list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))
}
return n, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return 0, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
- list.Append(protoreflect.ValueOfBool(wire.DecodeBool(v)))
+ list.Append(protoreflect.ValueOfBool(protowire.DecodeBool(v)))
return n, nil
case protoreflect.EnumKind:
- if wtyp == wire.BytesType {
- buf, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ buf, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
for len(buf) > 0 {
- v, n := wire.ConsumeVarint(buf)
+ v, n := protowire.ConsumeVarint(buf)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
buf = buf[n:]
list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))
}
return n, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return 0, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfEnum(protoreflect.EnumNumber(v)))
return n, nil
case protoreflect.Int32Kind:
- if wtyp == wire.BytesType {
- buf, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ buf, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
for len(buf) > 0 {
- v, n := wire.ConsumeVarint(buf)
+ v, n := protowire.ConsumeVarint(buf)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
buf = buf[n:]
list.Append(protoreflect.ValueOfInt32(int32(v)))
}
return n, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return 0, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfInt32(int32(v)))
return n, nil
case protoreflect.Sint32Kind:
- if wtyp == wire.BytesType {
- buf, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ buf, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
for len(buf) > 0 {
- v, n := wire.ConsumeVarint(buf)
+ v, n := protowire.ConsumeVarint(buf)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
buf = buf[n:]
- list.Append(protoreflect.ValueOfInt32(int32(wire.DecodeZigZag(v & math.MaxUint32))))
+ list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))
}
return n, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return 0, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
- list.Append(protoreflect.ValueOfInt32(int32(wire.DecodeZigZag(v & math.MaxUint32))))
+ list.Append(protoreflect.ValueOfInt32(int32(protowire.DecodeZigZag(v & math.MaxUint32))))
return n, nil
case protoreflect.Uint32Kind:
- if wtyp == wire.BytesType {
- buf, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ buf, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
for len(buf) > 0 {
- v, n := wire.ConsumeVarint(buf)
+ v, n := protowire.ConsumeVarint(buf)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
buf = buf[n:]
list.Append(protoreflect.ValueOfUint32(uint32(v)))
}
return n, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return 0, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfUint32(uint32(v)))
return n, nil
case protoreflect.Int64Kind:
- if wtyp == wire.BytesType {
- buf, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ buf, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
for len(buf) > 0 {
- v, n := wire.ConsumeVarint(buf)
+ v, n := protowire.ConsumeVarint(buf)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
buf = buf[n:]
list.Append(protoreflect.ValueOfInt64(int64(v)))
}
return n, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return 0, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfInt64(int64(v)))
return n, nil
case protoreflect.Sint64Kind:
- if wtyp == wire.BytesType {
- buf, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ buf, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
for len(buf) > 0 {
- v, n := wire.ConsumeVarint(buf)
+ v, n := protowire.ConsumeVarint(buf)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
buf = buf[n:]
- list.Append(protoreflect.ValueOfInt64(wire.DecodeZigZag(v)))
+ list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))
}
return n, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return 0, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
- list.Append(protoreflect.ValueOfInt64(wire.DecodeZigZag(v)))
+ list.Append(protoreflect.ValueOfInt64(protowire.DecodeZigZag(v)))
return n, nil
case protoreflect.Uint64Kind:
- if wtyp == wire.BytesType {
- buf, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ buf, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
for len(buf) > 0 {
- v, n := wire.ConsumeVarint(buf)
+ v, n := protowire.ConsumeVarint(buf)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
buf = buf[n:]
list.Append(protoreflect.ValueOfUint64(v))
}
return n, nil
}
- if wtyp != wire.VarintType {
+ if wtyp != protowire.VarintType {
return 0, errUnknown
}
- v, n := wire.ConsumeVarint(b)
+ v, n := protowire.ConsumeVarint(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfUint64(v))
return n, nil
case protoreflect.Sfixed32Kind:
- if wtyp == wire.BytesType {
- buf, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ buf, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
for len(buf) > 0 {
- v, n := wire.ConsumeFixed32(buf)
+ v, n := protowire.ConsumeFixed32(buf)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
buf = buf[n:]
list.Append(protoreflect.ValueOfInt32(int32(v)))
}
return n, nil
}
- if wtyp != wire.Fixed32Type {
+ if wtyp != protowire.Fixed32Type {
return 0, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfInt32(int32(v)))
return n, nil
case protoreflect.Fixed32Kind:
- if wtyp == wire.BytesType {
- buf, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ buf, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
for len(buf) > 0 {
- v, n := wire.ConsumeFixed32(buf)
+ v, n := protowire.ConsumeFixed32(buf)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
buf = buf[n:]
list.Append(protoreflect.ValueOfUint32(uint32(v)))
}
return n, nil
}
- if wtyp != wire.Fixed32Type {
+ if wtyp != protowire.Fixed32Type {
return 0, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfUint32(uint32(v)))
return n, nil
case protoreflect.FloatKind:
- if wtyp == wire.BytesType {
- buf, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ buf, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
for len(buf) > 0 {
- v, n := wire.ConsumeFixed32(buf)
+ v, n := protowire.ConsumeFixed32(buf)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
buf = buf[n:]
list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))
}
return n, nil
}
- if wtyp != wire.Fixed32Type {
+ if wtyp != protowire.Fixed32Type {
return 0, errUnknown
}
- v, n := wire.ConsumeFixed32(b)
+ v, n := protowire.ConsumeFixed32(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfFloat32(math.Float32frombits(uint32(v))))
return n, nil
case protoreflect.Sfixed64Kind:
- if wtyp == wire.BytesType {
- buf, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ buf, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
for len(buf) > 0 {
- v, n := wire.ConsumeFixed64(buf)
+ v, n := protowire.ConsumeFixed64(buf)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
buf = buf[n:]
list.Append(protoreflect.ValueOfInt64(int64(v)))
}
return n, nil
}
- if wtyp != wire.Fixed64Type {
+ if wtyp != protowire.Fixed64Type {
return 0, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfInt64(int64(v)))
return n, nil
case protoreflect.Fixed64Kind:
- if wtyp == wire.BytesType {
- buf, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ buf, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
for len(buf) > 0 {
- v, n := wire.ConsumeFixed64(buf)
+ v, n := protowire.ConsumeFixed64(buf)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
buf = buf[n:]
list.Append(protoreflect.ValueOfUint64(v))
}
return n, nil
}
- if wtyp != wire.Fixed64Type {
+ if wtyp != protowire.Fixed64Type {
return 0, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfUint64(v))
return n, nil
case protoreflect.DoubleKind:
- if wtyp == wire.BytesType {
- buf, n := wire.ConsumeBytes(b)
+ if wtyp == protowire.BytesType {
+ buf, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
for len(buf) > 0 {
- v, n := wire.ConsumeFixed64(buf)
+ v, n := protowire.ConsumeFixed64(buf)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
buf = buf[n:]
list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))
}
return n, nil
}
- if wtyp != wire.Fixed64Type {
+ if wtyp != protowire.Fixed64Type {
return 0, errUnknown
}
- v, n := wire.ConsumeFixed64(b)
+ v, n := protowire.ConsumeFixed64(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfFloat64(math.Float64frombits(v)))
return n, nil
case protoreflect.StringKind:
- if wtyp != wire.BytesType {
+ if wtyp != protowire.BytesType {
return 0, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
if strs.EnforceUTF8(fd) && !utf8.Valid(v) {
return 0, errors.InvalidUTF8(string(fd.FullName()))
@@ -557,22 +557,22 @@
list.Append(protoreflect.ValueOfString(string(v)))
return n, nil
case protoreflect.BytesKind:
- if wtyp != wire.BytesType {
+ if wtyp != protowire.BytesType {
return 0, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
list.Append(protoreflect.ValueOfBytes(append(emptyBuf[:], v...)))
return n, nil
case protoreflect.MessageKind:
- if wtyp != wire.BytesType {
+ if wtyp != protowire.BytesType {
return 0, errUnknown
}
- v, n := wire.ConsumeBytes(b)
+ v, n := protowire.ConsumeBytes(b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
m := list.NewElement()
if err := o.unmarshalMessage(v, m.Message()); err != nil {
@@ -581,12 +581,12 @@
list.Append(m)
return n, nil
case protoreflect.GroupKind:
- if wtyp != wire.StartGroupType {
+ if wtyp != protowire.StartGroupType {
return 0, errUnknown
}
- v, n := wire.ConsumeGroup(fd.Number(), b)
+ v, n := protowire.ConsumeGroup(fd.Number(), b)
if n < 0 {
- return 0, wire.ParseError(n)
+ return 0, protowire.ParseError(n)
}
m := list.NewElement()
if err := o.unmarshalMessage(v, m.Message()); err != nil {
diff --git a/proto/encode.go b/proto/encode.go
index 999aa7b..fa738a1 100644
--- a/proto/encode.go
+++ b/proto/encode.go
@@ -7,8 +7,8 @@
import (
"sort"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/internal/encoding/wire"
"google.golang.org/protobuf/internal/fieldsort"
"google.golang.org/protobuf/internal/mapsort"
"google.golang.org/protobuf/internal/pragma"
@@ -219,14 +219,14 @@
case fd.IsMap():
return o.marshalMap(b, fd, value.Map())
default:
- b = wire.AppendTag(b, fd.Number(), wireTypes[fd.Kind()])
+ b = protowire.AppendTag(b, fd.Number(), wireTypes[fd.Kind()])
return o.marshalSingular(b, fd, value)
}
}
func (o MarshalOptions) marshalList(b []byte, fd protoreflect.FieldDescriptor, list protoreflect.List) ([]byte, error) {
if fd.IsPacked() && list.Len() > 0 {
- b = wire.AppendTag(b, fd.Number(), wire.BytesType)
+ b = protowire.AppendTag(b, fd.Number(), protowire.BytesType)
b, pos := appendSpeculativeLength(b)
for i, llen := 0, list.Len(); i < llen; i++ {
var err error
@@ -242,7 +242,7 @@
kind := fd.Kind()
for i, llen := 0, list.Len(); i < llen; i++ {
var err error
- b = wire.AppendTag(b, fd.Number(), wireTypes[kind])
+ b = protowire.AppendTag(b, fd.Number(), wireTypes[kind])
b, err = o.marshalSingular(b, fd, list.Get(i))
if err != nil {
return b, err
@@ -256,7 +256,7 @@
valf := fd.MapValue()
var err error
o.rangeMap(mapv, keyf.Kind(), func(key protoreflect.MapKey, value protoreflect.Value) bool {
- b = wire.AppendTag(b, fd.Number(), wire.BytesType)
+ b = protowire.AppendTag(b, fd.Number(), protowire.BytesType)
var pos int
b, pos = appendSpeculativeLength(b)
@@ -295,7 +295,7 @@
func finishSpeculativeLength(b []byte, pos int) []byte {
mlen := len(b) - pos - speculativeLength
- msiz := wire.SizeVarint(uint64(mlen))
+ msiz := protowire.SizeVarint(uint64(mlen))
if msiz != speculativeLength {
for i := 0; i < msiz-speculativeLength; i++ {
b = append(b, 0)
@@ -303,6 +303,6 @@
copy(b[pos+msiz:], b[pos+speculativeLength:])
b = b[:pos+msiz+mlen]
}
- wire.AppendVarint(b[:pos], uint64(mlen))
+ protowire.AppendVarint(b[:pos], uint64(mlen))
return b
}
diff --git a/proto/encode_gen.go b/proto/encode_gen.go
index 1b54088..185dacf 100644
--- a/proto/encode_gen.go
+++ b/proto/encode_gen.go
@@ -10,70 +10,70 @@
"math"
"unicode/utf8"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/errors"
"google.golang.org/protobuf/internal/strs"
"google.golang.org/protobuf/reflect/protoreflect"
)
-var wireTypes = map[protoreflect.Kind]wire.Type{
- protoreflect.BoolKind: wire.VarintType,
- protoreflect.EnumKind: wire.VarintType,
- protoreflect.Int32Kind: wire.VarintType,
- protoreflect.Sint32Kind: wire.VarintType,
- protoreflect.Uint32Kind: wire.VarintType,
- protoreflect.Int64Kind: wire.VarintType,
- protoreflect.Sint64Kind: wire.VarintType,
- protoreflect.Uint64Kind: wire.VarintType,
- protoreflect.Sfixed32Kind: wire.Fixed32Type,
- protoreflect.Fixed32Kind: wire.Fixed32Type,
- protoreflect.FloatKind: wire.Fixed32Type,
- protoreflect.Sfixed64Kind: wire.Fixed64Type,
- protoreflect.Fixed64Kind: wire.Fixed64Type,
- protoreflect.DoubleKind: wire.Fixed64Type,
- protoreflect.StringKind: wire.BytesType,
- protoreflect.BytesKind: wire.BytesType,
- protoreflect.MessageKind: wire.BytesType,
- protoreflect.GroupKind: wire.StartGroupType,
+var wireTypes = map[protoreflect.Kind]protowire.Type{
+ protoreflect.BoolKind: protowire.VarintType,
+ protoreflect.EnumKind: protowire.VarintType,
+ protoreflect.Int32Kind: protowire.VarintType,
+ protoreflect.Sint32Kind: protowire.VarintType,
+ protoreflect.Uint32Kind: protowire.VarintType,
+ protoreflect.Int64Kind: protowire.VarintType,
+ protoreflect.Sint64Kind: protowire.VarintType,
+ protoreflect.Uint64Kind: protowire.VarintType,
+ protoreflect.Sfixed32Kind: protowire.Fixed32Type,
+ protoreflect.Fixed32Kind: protowire.Fixed32Type,
+ protoreflect.FloatKind: protowire.Fixed32Type,
+ protoreflect.Sfixed64Kind: protowire.Fixed64Type,
+ protoreflect.Fixed64Kind: protowire.Fixed64Type,
+ protoreflect.DoubleKind: protowire.Fixed64Type,
+ protoreflect.StringKind: protowire.BytesType,
+ protoreflect.BytesKind: protowire.BytesType,
+ protoreflect.MessageKind: protowire.BytesType,
+ protoreflect.GroupKind: protowire.StartGroupType,
}
func (o MarshalOptions) marshalSingular(b []byte, fd protoreflect.FieldDescriptor, v protoreflect.Value) ([]byte, error) {
switch fd.Kind() {
case protoreflect.BoolKind:
- b = wire.AppendVarint(b, wire.EncodeBool(v.Bool()))
+ b = protowire.AppendVarint(b, protowire.EncodeBool(v.Bool()))
case protoreflect.EnumKind:
- b = wire.AppendVarint(b, uint64(v.Enum()))
+ b = protowire.AppendVarint(b, uint64(v.Enum()))
case protoreflect.Int32Kind:
- b = wire.AppendVarint(b, uint64(int32(v.Int())))
+ b = protowire.AppendVarint(b, uint64(int32(v.Int())))
case protoreflect.Sint32Kind:
- b = wire.AppendVarint(b, wire.EncodeZigZag(int64(int32(v.Int()))))
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(int64(int32(v.Int()))))
case protoreflect.Uint32Kind:
- b = wire.AppendVarint(b, uint64(uint32(v.Uint())))
+ b = protowire.AppendVarint(b, uint64(uint32(v.Uint())))
case protoreflect.Int64Kind:
- b = wire.AppendVarint(b, uint64(v.Int()))
+ b = protowire.AppendVarint(b, uint64(v.Int()))
case protoreflect.Sint64Kind:
- b = wire.AppendVarint(b, wire.EncodeZigZag(v.Int()))
+ b = protowire.AppendVarint(b, protowire.EncodeZigZag(v.Int()))
case protoreflect.Uint64Kind:
- b = wire.AppendVarint(b, v.Uint())
+ b = protowire.AppendVarint(b, v.Uint())
case protoreflect.Sfixed32Kind:
- b = wire.AppendFixed32(b, uint32(v.Int()))
+ b = protowire.AppendFixed32(b, uint32(v.Int()))
case protoreflect.Fixed32Kind:
- b = wire.AppendFixed32(b, uint32(v.Uint()))
+ b = protowire.AppendFixed32(b, uint32(v.Uint()))
case protoreflect.FloatKind:
- b = wire.AppendFixed32(b, math.Float32bits(float32(v.Float())))
+ b = protowire.AppendFixed32(b, math.Float32bits(float32(v.Float())))
case protoreflect.Sfixed64Kind:
- b = wire.AppendFixed64(b, uint64(v.Int()))
+ b = protowire.AppendFixed64(b, uint64(v.Int()))
case protoreflect.Fixed64Kind:
- b = wire.AppendFixed64(b, v.Uint())
+ b = protowire.AppendFixed64(b, v.Uint())
case protoreflect.DoubleKind:
- b = wire.AppendFixed64(b, math.Float64bits(v.Float()))
+ b = protowire.AppendFixed64(b, math.Float64bits(v.Float()))
case protoreflect.StringKind:
if strs.EnforceUTF8(fd) && !utf8.ValidString(v.String()) {
return b, errors.InvalidUTF8(string(fd.FullName()))
}
- b = wire.AppendString(b, v.String())
+ b = protowire.AppendString(b, v.String())
case protoreflect.BytesKind:
- b = wire.AppendBytes(b, v.Bytes())
+ b = protowire.AppendBytes(b, v.Bytes())
case protoreflect.MessageKind:
var pos int
var err error
@@ -89,7 +89,7 @@
if err != nil {
return b, err
}
- b = wire.AppendVarint(b, wire.EncodeTag(fd.Number(), wire.EndGroupType))
+ b = protowire.AppendVarint(b, protowire.EncodeTag(fd.Number(), protowire.EndGroupType))
default:
return b, errors.New("invalid kind %v", fd.Kind())
}
diff --git a/proto/encode_test.go b/proto/encode_test.go
index 80e8f5d..d8aabd9 100644
--- a/proto/encode_test.go
+++ b/proto/encode_test.go
@@ -14,7 +14,7 @@
"github.com/google/go-cmp/cmp"
"google.golang.org/protobuf/encoding/prototext"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/proto"
pref "google.golang.org/protobuf/reflect/protoreflect"
@@ -212,9 +212,9 @@
}
var got []pref.FieldNumber
for len(b) > 0 {
- num, _, n := wire.ConsumeField(b)
+ num, _, n := protowire.ConsumeField(b)
if n < 0 {
- t.Fatal(wire.ParseError(n))
+ t.Fatal(protowire.ParseError(n))
}
b = b[n:]
got = append(got, num)
diff --git a/proto/equal.go b/proto/equal.go
index d314232..10902bd 100644
--- a/proto/equal.go
+++ b/proto/equal.go
@@ -9,7 +9,7 @@
"math"
"reflect"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
pref "google.golang.org/protobuf/reflect/protoreflect"
)
@@ -141,12 +141,12 @@
mx := make(map[pref.FieldNumber]pref.RawFields)
my := make(map[pref.FieldNumber]pref.RawFields)
for len(x) > 0 {
- fnum, _, n := wire.ConsumeField(x)
+ fnum, _, n := protowire.ConsumeField(x)
mx[fnum] = append(mx[fnum], x[:n]...)
x = x[n:]
}
for len(y) > 0 {
- fnum, _, n := wire.ConsumeField(y)
+ fnum, _, n := protowire.ConsumeField(y)
my[fnum] = append(my[fnum], y[:n]...)
y = y[n:]
}
diff --git a/proto/messageset.go b/proto/messageset.go
index 6d0a0c2..b6b3de5 100644
--- a/proto/messageset.go
+++ b/proto/messageset.go
@@ -5,8 +5,8 @@
package proto
import (
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/internal/encoding/wire"
"google.golang.org/protobuf/internal/errors"
"google.golang.org/protobuf/internal/flags"
"google.golang.org/protobuf/reflect/protoreflect"
@@ -16,8 +16,8 @@
func sizeMessageSet(m protoreflect.Message) (size int) {
m.Range(func(fd protoreflect.FieldDescriptor, v protoreflect.Value) bool {
size += messageset.SizeField(fd.Number())
- size += wire.SizeTag(messageset.FieldMessage)
- size += wire.SizeBytes(sizeMessage(v.Message()))
+ size += protowire.SizeTag(messageset.FieldMessage)
+ size += protowire.SizeBytes(sizeMessage(v.Message()))
return true
})
size += messageset.SizeUnknown(m.GetUnknown())
@@ -41,8 +41,8 @@
func marshalMessageSetField(b []byte, fd protoreflect.FieldDescriptor, value protoreflect.Value, o MarshalOptions) ([]byte, error) {
b = messageset.AppendFieldStart(b, fd.Number())
- b = wire.AppendTag(b, messageset.FieldMessage, wire.BytesType)
- b = wire.AppendVarint(b, uint64(o.Size(value.Message().Interface())))
+ b = protowire.AppendTag(b, messageset.FieldMessage, protowire.BytesType)
+ b = protowire.AppendVarint(b, uint64(o.Size(value.Message().Interface())))
b, err := o.marshalMessage(b, value.Message())
if err != nil {
return b, err
@@ -55,12 +55,12 @@
if !flags.ProtoLegacy {
return errors.New("no support for message_set_wire_format")
}
- return messageset.Unmarshal(b, false, func(num wire.Number, v []byte) error {
+ return messageset.Unmarshal(b, false, func(num protowire.Number, v []byte) error {
err := unmarshalMessageSetField(m, num, v, o)
if err == errUnknown {
unknown := m.GetUnknown()
- unknown = wire.AppendTag(unknown, num, wire.BytesType)
- unknown = wire.AppendBytes(unknown, v)
+ unknown = protowire.AppendTag(unknown, num, protowire.BytesType)
+ unknown = protowire.AppendBytes(unknown, v)
m.SetUnknown(unknown)
return nil
}
@@ -68,7 +68,7 @@
})
}
-func unmarshalMessageSetField(m protoreflect.Message, num wire.Number, v []byte, o UnmarshalOptions) error {
+func unmarshalMessageSetField(m protoreflect.Message, num protowire.Number, v []byte, o UnmarshalOptions) error {
md := m.Descriptor()
if !md.ExtensionRanges().Has(num) {
return errUnknown
diff --git a/proto/messageset_test.go b/proto/messageset_test.go
index 1eedcc9..1418f4a 100644
--- a/proto/messageset_test.go
+++ b/proto/messageset_test.go
@@ -5,8 +5,8 @@
package proto_test
import (
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/encoding/pack"
- "google.golang.org/protobuf/internal/encoding/wire"
"google.golang.org/protobuf/internal/flags"
"google.golang.org/protobuf/proto"
@@ -192,7 +192,7 @@
wire: pack.Message{
pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{
pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(wire.MaxValidNumber + 1),
+ pack.Tag{2, pack.VarintType}, pack.Varint(protowire.MaxValidNumber + 1),
pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
pack.Tag{1, pack.EndGroupType},
}),
@@ -204,7 +204,7 @@
m := &messagesetpb.MessageSetContainer{MessageSet: &messagesetpb.MessageSet{}}
m.MessageSet.ProtoReflect().SetUnknown(
pack.Message{
- pack.Tag{wire.MaxValidNumber + 2, pack.BytesType}, pack.LengthPrefix{},
+ pack.Tag{protowire.MaxValidNumber + 2, pack.BytesType}, pack.LengthPrefix{},
}.Marshal(),
)
return m
@@ -212,7 +212,7 @@
wire: pack.Message{
pack.Tag{1, pack.BytesType}, pack.LengthPrefix(pack.Message{
pack.Tag{1, pack.StartGroupType},
- pack.Tag{2, pack.VarintType}, pack.Varint(wire.MaxValidNumber + 2),
+ pack.Tag{2, pack.VarintType}, pack.Varint(protowire.MaxValidNumber + 2),
pack.Tag{3, pack.BytesType}, pack.LengthPrefix(pack.Message{}),
pack.Tag{1, pack.EndGroupType},
}),
diff --git a/proto/size.go b/proto/size.go
index 32620a9..a4e72bd 100644
--- a/proto/size.go
+++ b/proto/size.go
@@ -5,8 +5,8 @@
package proto
import (
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/encoding/messageset"
- "google.golang.org/protobuf/internal/encoding/wire"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/runtime/protoiface"
)
@@ -60,29 +60,29 @@
case fd.IsMap():
return sizeMap(num, fd, value.Map())
default:
- return wire.SizeTag(num) + sizeSingular(num, fd.Kind(), value)
+ return protowire.SizeTag(num) + sizeSingular(num, fd.Kind(), value)
}
}
-func sizeList(num wire.Number, fd protoreflect.FieldDescriptor, list protoreflect.List) (size int) {
+func sizeList(num protowire.Number, fd protoreflect.FieldDescriptor, list protoreflect.List) (size int) {
if fd.IsPacked() && list.Len() > 0 {
content := 0
for i, llen := 0, list.Len(); i < llen; i++ {
content += sizeSingular(num, fd.Kind(), list.Get(i))
}
- return wire.SizeTag(num) + wire.SizeBytes(content)
+ return protowire.SizeTag(num) + protowire.SizeBytes(content)
}
for i, llen := 0, list.Len(); i < llen; i++ {
- size += wire.SizeTag(num) + sizeSingular(num, fd.Kind(), list.Get(i))
+ size += protowire.SizeTag(num) + sizeSingular(num, fd.Kind(), list.Get(i))
}
return size
}
-func sizeMap(num wire.Number, fd protoreflect.FieldDescriptor, mapv protoreflect.Map) (size int) {
+func sizeMap(num protowire.Number, fd protoreflect.FieldDescriptor, mapv protoreflect.Map) (size int) {
mapv.Range(func(key protoreflect.MapKey, value protoreflect.Value) bool {
- size += wire.SizeTag(num)
- size += wire.SizeBytes(sizeField(fd.MapKey(), key.Value()) + sizeField(fd.MapValue(), value))
+ size += protowire.SizeTag(num)
+ size += protowire.SizeBytes(sizeField(fd.MapKey(), key.Value()) + sizeField(fd.MapValue(), value))
return true
})
return size
diff --git a/proto/size_gen.go b/proto/size_gen.go
index 576e2c6..1118460 100644
--- a/proto/size_gen.go
+++ b/proto/size_gen.go
@@ -7,48 +7,48 @@
package proto
import (
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/reflect/protoreflect"
)
-func sizeSingular(num wire.Number, kind protoreflect.Kind, v protoreflect.Value) int {
+func sizeSingular(num protowire.Number, kind protoreflect.Kind, v protoreflect.Value) int {
switch kind {
case protoreflect.BoolKind:
- return wire.SizeVarint(wire.EncodeBool(v.Bool()))
+ return protowire.SizeVarint(protowire.EncodeBool(v.Bool()))
case protoreflect.EnumKind:
- return wire.SizeVarint(uint64(v.Enum()))
+ return protowire.SizeVarint(uint64(v.Enum()))
case protoreflect.Int32Kind:
- return wire.SizeVarint(uint64(int32(v.Int())))
+ return protowire.SizeVarint(uint64(int32(v.Int())))
case protoreflect.Sint32Kind:
- return wire.SizeVarint(wire.EncodeZigZag(int64(int32(v.Int()))))
+ return protowire.SizeVarint(protowire.EncodeZigZag(int64(int32(v.Int()))))
case protoreflect.Uint32Kind:
- return wire.SizeVarint(uint64(uint32(v.Uint())))
+ return protowire.SizeVarint(uint64(uint32(v.Uint())))
case protoreflect.Int64Kind:
- return wire.SizeVarint(uint64(v.Int()))
+ return protowire.SizeVarint(uint64(v.Int()))
case protoreflect.Sint64Kind:
- return wire.SizeVarint(wire.EncodeZigZag(v.Int()))
+ return protowire.SizeVarint(protowire.EncodeZigZag(v.Int()))
case protoreflect.Uint64Kind:
- return wire.SizeVarint(v.Uint())
+ return protowire.SizeVarint(v.Uint())
case protoreflect.Sfixed32Kind:
- return wire.SizeFixed32()
+ return protowire.SizeFixed32()
case protoreflect.Fixed32Kind:
- return wire.SizeFixed32()
+ return protowire.SizeFixed32()
case protoreflect.FloatKind:
- return wire.SizeFixed32()
+ return protowire.SizeFixed32()
case protoreflect.Sfixed64Kind:
- return wire.SizeFixed64()
+ return protowire.SizeFixed64()
case protoreflect.Fixed64Kind:
- return wire.SizeFixed64()
+ return protowire.SizeFixed64()
case protoreflect.DoubleKind:
- return wire.SizeFixed64()
+ return protowire.SizeFixed64()
case protoreflect.StringKind:
- return wire.SizeBytes(len(v.String()))
+ return protowire.SizeBytes(len(v.String()))
case protoreflect.BytesKind:
- return wire.SizeBytes(len(v.Bytes()))
+ return protowire.SizeBytes(len(v.Bytes()))
case protoreflect.MessageKind:
- return wire.SizeBytes(sizeMessage(v.Message()))
+ return protowire.SizeBytes(sizeMessage(v.Message()))
case protoreflect.GroupKind:
- return wire.SizeGroup(num, sizeMessage(v.Message()))
+ return protowire.SizeGroup(num, sizeMessage(v.Message()))
default:
return 0
}
diff --git a/proto/testmessages_test.go b/proto/testmessages_test.go
index b0f568f..680faf6 100644
--- a/proto/testmessages_test.go
+++ b/proto/testmessages_test.go
@@ -5,8 +5,8 @@
package proto_test
import (
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/encoding/pack"
- "google.golang.org/protobuf/internal/encoding/wire"
"google.golang.org/protobuf/internal/impl"
"google.golang.org/protobuf/internal/protobuild"
"google.golang.org/protobuf/proto"
@@ -1674,7 +1674,7 @@
(*testpb.TestAllExtensions)(nil),
},
wire: pack.Message{
- pack.Tag{wire.MaxValidNumber + 1, pack.VarintType}, pack.Varint(0),
+ pack.Tag{protowire.MaxValidNumber + 1, pack.VarintType}, pack.Varint(0),
}.Marshal(),
},
{
diff --git a/reflect/protodesc/desc_validate.go b/reflect/protodesc/desc_validate.go
index cf172a2..2a2bf75 100644
--- a/reflect/protodesc/desc_validate.go
+++ b/reflect/protodesc/desc_validate.go
@@ -8,7 +8,7 @@
"strings"
"unicode"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/errors"
"google.golang.org/protobuf/internal/filedesc"
"google.golang.org/protobuf/internal/flags"
@@ -210,7 +210,7 @@
// may have a field number higher than normal. This check only verifies
// that the number is not negative or reserved. We check again later
// if we know that the extendee is definitely not a MessageSet.
- if n := x.Number(); n < 0 || (wire.FirstReservedNumber <= n && n <= wire.LastReservedNumber) {
+ if n := x.Number(); n < 0 || (protowire.FirstReservedNumber <= n && n <= protowire.LastReservedNumber) {
return errors.New("extension field %q has an invalid number: %d", x.FullName(), x.Number())
}
if !x.Cardinality().IsValid() || x.Cardinality() == protoreflect.Required {
diff --git a/reflect/protoreflect/proto.go b/reflect/protoreflect/proto.go
index eb5d289..1b89bed 100644
--- a/reflect/protoreflect/proto.go
+++ b/reflect/protoreflect/proto.go
@@ -130,7 +130,7 @@
"regexp"
"strings"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/pragma"
)
@@ -366,7 +366,7 @@
}
// FieldNumber is the field number in a message.
-type FieldNumber = wire.Number
+type FieldNumber = protowire.Number
// FieldNumbers represent a list of field numbers.
type FieldNumbers interface {
diff --git a/reflect/protoreflect/value.go b/reflect/protoreflect/value.go
index 2149446..a352ed9 100644
--- a/reflect/protoreflect/value.go
+++ b/reflect/protoreflect/value.go
@@ -4,7 +4,7 @@
package protoreflect
-import "google.golang.org/protobuf/internal/encoding/wire"
+import "google.golang.org/protobuf/encoding/protowire"
// Enum is a reflection interface for a concrete enum value,
// which provides type information and a getter for the enum number.
@@ -165,7 +165,7 @@
// IsValid reports whether b is syntactically correct wire format.
func (b RawFields) IsValid() bool {
for len(b) > 0 {
- _, _, n := wire.ConsumeField(b)
+ _, _, n := protowire.ConsumeField(b)
if n < 0 {
return false
}
diff --git a/testing/protocmp/format.go b/testing/protocmp/format.go
index f329357..2be6903 100644
--- a/testing/protocmp/format.go
+++ b/testing/protocmp/format.go
@@ -12,8 +12,8 @@
"strconv"
"strings"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/internal/detrand"
- "google.golang.org/protobuf/internal/encoding/wire"
"google.golang.org/protobuf/reflect/protoreflect"
)
@@ -134,8 +134,8 @@
func transformRawFields(b protoreflect.RawFields) interface{} {
var vs []interface{}
for len(b) > 0 {
- num, typ, n := wire.ConsumeTag(b)
- m := wire.ConsumeFieldValue(num, typ, b[n:])
+ num, typ, n := protowire.ConsumeTag(b)
+ m := protowire.ConsumeFieldValue(num, typ, b[n:])
vs = append(vs, transformRawField(typ, b[n:][:m]))
b = b[n+m:]
}
@@ -145,28 +145,28 @@
return vs
}
-func transformRawField(typ wire.Type, b protoreflect.RawFields) interface{} {
+func transformRawField(typ protowire.Type, b protoreflect.RawFields) interface{} {
switch typ {
- case wire.VarintType:
- v, _ := wire.ConsumeVarint(b)
+ case protowire.VarintType:
+ v, _ := protowire.ConsumeVarint(b)
return v
- case wire.Fixed32Type:
- v, _ := wire.ConsumeFixed32(b)
+ case protowire.Fixed32Type:
+ v, _ := protowire.ConsumeFixed32(b)
return v
- case wire.Fixed64Type:
- v, _ := wire.ConsumeFixed64(b)
+ case protowire.Fixed64Type:
+ v, _ := protowire.ConsumeFixed64(b)
return v
- case wire.BytesType:
- v, _ := wire.ConsumeBytes(b)
+ case protowire.BytesType:
+ v, _ := protowire.ConsumeBytes(b)
return v
- case wire.StartGroupType:
+ case protowire.StartGroupType:
v := Message{}
for {
- num2, typ2, n := wire.ConsumeTag(b)
- if typ2 == wire.EndGroupType {
+ num2, typ2, n := protowire.ConsumeTag(b)
+ if typ2 == protowire.EndGroupType {
return v
}
- m := wire.ConsumeFieldValue(num2, typ2, b[n:])
+ m := protowire.ConsumeFieldValue(num2, typ2, b[n:])
s := strconv.Itoa(int(num2))
b2, _ := v[s].(protoreflect.RawFields)
v[s] = append(b2, b[:n+m]...)
diff --git a/testing/protocmp/xform.go b/testing/protocmp/xform.go
index 8f26aa7..53dd8e6 100644
--- a/testing/protocmp/xform.go
+++ b/testing/protocmp/xform.go
@@ -16,7 +16,7 @@
"github.com/google/go-cmp/cmp"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"
@@ -238,7 +238,7 @@
// Handle unknown fields.
for b := m.GetUnknown(); len(b) > 0; {
- num, _, n := wire.ConsumeField(b)
+ num, _, n := protowire.ConsumeField(b)
s := strconv.Itoa(int(num))
b2, _ := mx[s].(protoreflect.RawFields)
mx[s] = append(b2, b[:n]...)
diff --git a/testing/prototest/prototest.go b/testing/prototest/prototest.go
index 4fccb70..55a61ae 100644
--- a/testing/prototest/prototest.go
+++ b/testing/prototest/prototest.go
@@ -14,7 +14,7 @@
"testing"
"google.golang.org/protobuf/encoding/prototext"
- "google.golang.org/protobuf/internal/encoding/wire"
+ "google.golang.org/protobuf/encoding/protowire"
"google.golang.org/protobuf/proto"
pref "google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"
@@ -488,8 +488,8 @@
// testUnknown tests the behavior of unknown fields.
func testUnknown(t testing.TB, m pref.Message) {
var b []byte
- b = wire.AppendTag(b, 1000, wire.VarintType)
- b = wire.AppendVarint(b, 1001)
+ b = protowire.AppendTag(b, 1000, protowire.VarintType)
+ b = protowire.AppendVarint(b, 1001)
m.SetUnknown(pref.RawFields(b))
if got, want := []byte(m.GetUnknown()), b; !bytes.Equal(got, want) {
t.Errorf("after setting unknown fields:\nGetUnknown() = %v, want %v", got, want)