1
2
3
4 package setextensionbytes
5
6 import (
7 bytes "bytes"
8 fmt "fmt"
9 _ "github.com/gogo/protobuf/gogoproto"
10 github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
11 proto "github.com/gogo/protobuf/proto"
12 io "io"
13 math "math"
14 math_bits "math/bits"
15 reflect "reflect"
16 strings "strings"
17 )
18
19
20 var _ = proto.Marshal
21 var _ = fmt.Errorf
22 var _ = math.Inf
23
24
25
26
27
28 const _ = proto.GoGoProtoPackageIsVersion2
29
30 type MyExtendable struct {
31 XXX_NoUnkeyedLiteral struct{} `json:"-"`
32 XXX_extensions []byte `protobuf:"bytes,0,opt" json:"-"`
33 XXX_unrecognized []byte `json:"-"`
34 XXX_sizecache int32 `json:"-"`
35 }
36
37 func (m *MyExtendable) Reset() { *m = MyExtendable{} }
38 func (*MyExtendable) ProtoMessage() {}
39 func (*MyExtendable) Descriptor() ([]byte, []int) {
40 return fileDescriptor_41b8000ad7d06fe7, []int{0}
41 }
42
43 var extRange_MyExtendable = []proto.ExtensionRange{
44 {Start: 1, End: 10},
45 }
46
47 func (*MyExtendable) ExtensionRangeArray() []proto.ExtensionRange {
48 return extRange_MyExtendable
49 }
50
51 func (m *MyExtendable) GetExtensions() *[]byte {
52 if m.XXX_extensions == nil {
53 m.XXX_extensions = make([]byte, 0)
54 }
55 return &m.XXX_extensions
56 }
57 func (m *MyExtendable) XXX_Unmarshal(b []byte) error {
58 return xxx_messageInfo_MyExtendable.Unmarshal(m, b)
59 }
60 func (m *MyExtendable) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
61 if deterministic {
62 return xxx_messageInfo_MyExtendable.Marshal(b, m, deterministic)
63 } else {
64 b = b[:cap(b)]
65 n, err := m.MarshalTo(b)
66 if err != nil {
67 return nil, err
68 }
69 return b[:n], nil
70 }
71 }
72 func (m *MyExtendable) XXX_Merge(src proto.Message) {
73 xxx_messageInfo_MyExtendable.Merge(m, src)
74 }
75 func (m *MyExtendable) XXX_Size() int {
76 return m.Size()
77 }
78 func (m *MyExtendable) XXX_DiscardUnknown() {
79 xxx_messageInfo_MyExtendable.DiscardUnknown(m)
80 }
81
82 var xxx_messageInfo_MyExtendable proto.InternalMessageInfo
83
84 type Foo struct {
85 IntFoo int64 `protobuf:"varint,1,opt,name=intFoo" json:"intFoo"`
86 XXX_NoUnkeyedLiteral struct{} `json:"-"`
87 XXX_unrecognized []byte `json:"-"`
88 XXX_sizecache int32 `json:"-"`
89 }
90
91 func (m *Foo) Reset() { *m = Foo{} }
92 func (*Foo) ProtoMessage() {}
93 func (*Foo) Descriptor() ([]byte, []int) {
94 return fileDescriptor_41b8000ad7d06fe7, []int{1}
95 }
96 func (m *Foo) XXX_Unmarshal(b []byte) error {
97 return xxx_messageInfo_Foo.Unmarshal(m, b)
98 }
99 func (m *Foo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
100 if deterministic {
101 return xxx_messageInfo_Foo.Marshal(b, m, deterministic)
102 } else {
103 b = b[:cap(b)]
104 n, err := m.MarshalTo(b)
105 if err != nil {
106 return nil, err
107 }
108 return b[:n], nil
109 }
110 }
111 func (m *Foo) XXX_Merge(src proto.Message) {
112 xxx_messageInfo_Foo.Merge(m, src)
113 }
114 func (m *Foo) XXX_Size() int {
115 return m.Size()
116 }
117 func (m *Foo) XXX_DiscardUnknown() {
118 xxx_messageInfo_Foo.DiscardUnknown(m)
119 }
120
121 var xxx_messageInfo_Foo proto.InternalMessageInfo
122
123 var E_Foos = &proto.ExtensionDesc{
124 ExtendedType: (*MyExtendable)(nil),
125 ExtensionType: (*Foo)(nil),
126 Field: 2,
127 Name: "setextensionbytes.Foos",
128 Tag: "bytes,2,opt,name=Foos",
129 Filename: "setextensionbytes.proto",
130 }
131
132 func init() {
133 proto.RegisterType((*MyExtendable)(nil), "setextensionbytes.MyExtendable")
134 proto.RegisterType((*Foo)(nil), "setextensionbytes.Foo")
135 proto.RegisterExtension(E_Foos)
136 }
137
138 func init() { proto.RegisterFile("setextensionbytes.proto", fileDescriptor_41b8000ad7d06fe7) }
139
140 var fileDescriptor_41b8000ad7d06fe7 = []byte{
141
142 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2f, 0x4e, 0x2d, 0x49,
143 0xad, 0x28, 0x49, 0xcd, 0x2b, 0xce, 0xcc, 0xcf, 0x4b, 0xaa, 0x2c, 0x49, 0x2d, 0xd6, 0x2b, 0x28,
144 0xca, 0x2f, 0xc9, 0x17, 0x12, 0xc4, 0x90, 0x90, 0xd2, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2,
145 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0x4f, 0xcf, 0xd7, 0x07, 0xab, 0x4c, 0x2a, 0x4d, 0x03, 0xf3,
146 0xc0, 0x1c, 0x30, 0x0b, 0x62, 0x82, 0x92, 0x1c, 0x17, 0x8f, 0x6f, 0xa5, 0x2b, 0xc8, 0x88, 0x94,
147 0xc4, 0xa4, 0x9c, 0x54, 0x2d, 0x16, 0x0e, 0x46, 0x01, 0x6e, 0x2b, 0x8e, 0x0d, 0x0b, 0xe4, 0x19,
148 0x4e, 0x2c, 0x94, 0x67, 0x50, 0x52, 0xe6, 0x62, 0x76, 0xcb, 0xcf, 0x17, 0x92, 0xe1, 0x62, 0xcb,
149 0xcc, 0x2b, 0x71, 0xcb, 0xcf, 0x97, 0x60, 0x54, 0x60, 0xd4, 0x60, 0x76, 0x62, 0x39, 0x71, 0x4f,
150 0x9e, 0x21, 0x08, 0x2a, 0x66, 0xe5, 0xcd, 0xc5, 0xe2, 0x96, 0x9f, 0x5f, 0x2c, 0x24, 0xaf, 0x87,
151 0xe9, 0x50, 0x64, 0xd3, 0x25, 0x98, 0x14, 0x18, 0x35, 0xb8, 0x8d, 0xc4, 0xb0, 0x28, 0x73, 0xcb,
152 0xcf, 0x0f, 0x02, 0x1b, 0xe2, 0x24, 0x73, 0xe2, 0xa1, 0x1c, 0xc3, 0x8d, 0x87, 0x72, 0x0c, 0x0d,
153 0x8f, 0xe4, 0x18, 0x57, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0xf1, 0xc7, 0x23, 0x39, 0xc6,
154 0x86, 0xc7, 0x72, 0x8c, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x32, 0xc1, 0xe9, 0x65, 0x0b, 0x01,
155 0x00, 0x00,
156 }
157
158 func (this *MyExtendable) Equal(that interface{}) bool {
159 if that == nil {
160 return this == nil
161 }
162
163 that1, ok := that.(*MyExtendable)
164 if !ok {
165 that2, ok := that.(MyExtendable)
166 if ok {
167 that1 = &that2
168 } else {
169 return false
170 }
171 }
172 if that1 == nil {
173 return this == nil
174 } else if this == nil {
175 return false
176 }
177 if !bytes.Equal(this.XXX_extensions, that1.XXX_extensions) {
178 return false
179 }
180 if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
181 return false
182 }
183 return true
184 }
185 func (this *Foo) Equal(that interface{}) bool {
186 if that == nil {
187 return this == nil
188 }
189
190 that1, ok := that.(*Foo)
191 if !ok {
192 that2, ok := that.(Foo)
193 if ok {
194 that1 = &that2
195 } else {
196 return false
197 }
198 }
199 if that1 == nil {
200 return this == nil
201 } else if this == nil {
202 return false
203 }
204 if this.IntFoo != that1.IntFoo {
205 return false
206 }
207 if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
208 return false
209 }
210 return true
211 }
212 func (m *MyExtendable) Marshal() (dAtA []byte, err error) {
213 size := m.Size()
214 dAtA = make([]byte, size)
215 n, err := m.MarshalTo(dAtA)
216 if err != nil {
217 return nil, err
218 }
219 return dAtA[:n], nil
220 }
221
222 func (m *MyExtendable) MarshalTo(dAtA []byte) (int, error) {
223 var i int
224 _ = i
225 var l int
226 _ = l
227 if m.XXX_extensions != nil {
228 i += copy(dAtA[i:], m.XXX_extensions)
229 }
230 if m.XXX_unrecognized != nil {
231 i += copy(dAtA[i:], m.XXX_unrecognized)
232 }
233 return i, nil
234 }
235
236 func (m *Foo) Marshal() (dAtA []byte, err error) {
237 size := m.Size()
238 dAtA = make([]byte, size)
239 n, err := m.MarshalTo(dAtA)
240 if err != nil {
241 return nil, err
242 }
243 return dAtA[:n], nil
244 }
245
246 func (m *Foo) MarshalTo(dAtA []byte) (int, error) {
247 var i int
248 _ = i
249 var l int
250 _ = l
251 dAtA[i] = 0x8
252 i++
253 i = encodeVarintSetextensionbytes(dAtA, i, uint64(m.IntFoo))
254 if m.XXX_unrecognized != nil {
255 i += copy(dAtA[i:], m.XXX_unrecognized)
256 }
257 return i, nil
258 }
259
260 func encodeVarintSetextensionbytes(dAtA []byte, offset int, v uint64) int {
261 for v >= 1<<7 {
262 dAtA[offset] = uint8(v&0x7f | 0x80)
263 v >>= 7
264 offset++
265 }
266 dAtA[offset] = uint8(v)
267 return offset + 1
268 }
269 func (m *MyExtendable) Size() (n int) {
270 if m == nil {
271 return 0
272 }
273 var l int
274 _ = l
275 if m.XXX_extensions != nil {
276 n += len(m.XXX_extensions)
277 }
278 if m.XXX_unrecognized != nil {
279 n += len(m.XXX_unrecognized)
280 }
281 return n
282 }
283
284 func (m *Foo) Size() (n int) {
285 if m == nil {
286 return 0
287 }
288 var l int
289 _ = l
290 n += 1 + sovSetextensionbytes(uint64(m.IntFoo))
291 if m.XXX_unrecognized != nil {
292 n += len(m.XXX_unrecognized)
293 }
294 return n
295 }
296
297 func sovSetextensionbytes(x uint64) (n int) {
298 return (math_bits.Len64(x|1) + 6) / 7
299 }
300 func sozSetextensionbytes(x uint64) (n int) {
301 return sovSetextensionbytes(uint64((x << 1) ^ uint64((int64(x) >> 63))))
302 }
303 func (this *MyExtendable) String() string {
304 if this == nil {
305 return "nil"
306 }
307 s := strings.Join([]string{`&MyExtendable{`,
308 `XXX_extensions:` + github_com_gogo_protobuf_proto.StringFromExtensionsBytes(this.XXX_extensions) + `,`,
309 `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
310 `}`,
311 }, "")
312 return s
313 }
314 func (this *Foo) String() string {
315 if this == nil {
316 return "nil"
317 }
318 s := strings.Join([]string{`&Foo{`,
319 `IntFoo:` + fmt.Sprintf("%v", this.IntFoo) + `,`,
320 `XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
321 `}`,
322 }, "")
323 return s
324 }
325 func valueToStringSetextensionbytes(v interface{}) string {
326 rv := reflect.ValueOf(v)
327 if rv.IsNil() {
328 return "nil"
329 }
330 pv := reflect.Indirect(rv).Interface()
331 return fmt.Sprintf("*%v", pv)
332 }
333 func (m *MyExtendable) Unmarshal(dAtA []byte) error {
334 l := len(dAtA)
335 iNdEx := 0
336 for iNdEx < l {
337 preIndex := iNdEx
338 var wire uint64
339 for shift := uint(0); ; shift += 7 {
340 if shift >= 64 {
341 return ErrIntOverflowSetextensionbytes
342 }
343 if iNdEx >= l {
344 return io.ErrUnexpectedEOF
345 }
346 b := dAtA[iNdEx]
347 iNdEx++
348 wire |= uint64(b&0x7F) << shift
349 if b < 0x80 {
350 break
351 }
352 }
353 fieldNum := int32(wire >> 3)
354 wireType := int(wire & 0x7)
355 if wireType == 4 {
356 return fmt.Errorf("proto: MyExtendable: wiretype end group for non-group")
357 }
358 if fieldNum <= 0 {
359 return fmt.Errorf("proto: MyExtendable: illegal tag %d (wire type %d)", fieldNum, wire)
360 }
361 switch fieldNum {
362 default:
363 if (fieldNum >= 1) && (fieldNum < 11) {
364 var sizeOfWire int
365 for {
366 sizeOfWire++
367 wire >>= 7
368 if wire == 0 {
369 break
370 }
371 }
372 iNdEx -= sizeOfWire
373 skippy, err := skipSetextensionbytes(dAtA[iNdEx:])
374 if err != nil {
375 return err
376 }
377 if skippy < 0 {
378 return ErrInvalidLengthSetextensionbytes
379 }
380 if (iNdEx + skippy) < 0 {
381 return ErrInvalidLengthSetextensionbytes
382 }
383 if (iNdEx + skippy) > l {
384 return io.ErrUnexpectedEOF
385 }
386 github_com_gogo_protobuf_proto.AppendExtension(m, int32(fieldNum), dAtA[iNdEx:iNdEx+skippy])
387 iNdEx += skippy
388 } else {
389 iNdEx = preIndex
390 skippy, err := skipSetextensionbytes(dAtA[iNdEx:])
391 if err != nil {
392 return err
393 }
394 if skippy < 0 {
395 return ErrInvalidLengthSetextensionbytes
396 }
397 if (iNdEx + skippy) < 0 {
398 return ErrInvalidLengthSetextensionbytes
399 }
400 if (iNdEx + skippy) > l {
401 return io.ErrUnexpectedEOF
402 }
403 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
404 iNdEx += skippy
405 }
406 }
407 }
408
409 if iNdEx > l {
410 return io.ErrUnexpectedEOF
411 }
412 return nil
413 }
414 func (m *Foo) Unmarshal(dAtA []byte) error {
415 l := len(dAtA)
416 iNdEx := 0
417 for iNdEx < l {
418 preIndex := iNdEx
419 var wire uint64
420 for shift := uint(0); ; shift += 7 {
421 if shift >= 64 {
422 return ErrIntOverflowSetextensionbytes
423 }
424 if iNdEx >= l {
425 return io.ErrUnexpectedEOF
426 }
427 b := dAtA[iNdEx]
428 iNdEx++
429 wire |= uint64(b&0x7F) << shift
430 if b < 0x80 {
431 break
432 }
433 }
434 fieldNum := int32(wire >> 3)
435 wireType := int(wire & 0x7)
436 if wireType == 4 {
437 return fmt.Errorf("proto: Foo: wiretype end group for non-group")
438 }
439 if fieldNum <= 0 {
440 return fmt.Errorf("proto: Foo: illegal tag %d (wire type %d)", fieldNum, wire)
441 }
442 switch fieldNum {
443 case 1:
444 if wireType != 0 {
445 return fmt.Errorf("proto: wrong wireType = %d for field IntFoo", wireType)
446 }
447 m.IntFoo = 0
448 for shift := uint(0); ; shift += 7 {
449 if shift >= 64 {
450 return ErrIntOverflowSetextensionbytes
451 }
452 if iNdEx >= l {
453 return io.ErrUnexpectedEOF
454 }
455 b := dAtA[iNdEx]
456 iNdEx++
457 m.IntFoo |= int64(b&0x7F) << shift
458 if b < 0x80 {
459 break
460 }
461 }
462 default:
463 iNdEx = preIndex
464 skippy, err := skipSetextensionbytes(dAtA[iNdEx:])
465 if err != nil {
466 return err
467 }
468 if skippy < 0 {
469 return ErrInvalidLengthSetextensionbytes
470 }
471 if (iNdEx + skippy) < 0 {
472 return ErrInvalidLengthSetextensionbytes
473 }
474 if (iNdEx + skippy) > l {
475 return io.ErrUnexpectedEOF
476 }
477 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
478 iNdEx += skippy
479 }
480 }
481
482 if iNdEx > l {
483 return io.ErrUnexpectedEOF
484 }
485 return nil
486 }
487 func skipSetextensionbytes(dAtA []byte) (n int, err error) {
488 l := len(dAtA)
489 iNdEx := 0
490 for iNdEx < l {
491 var wire uint64
492 for shift := uint(0); ; shift += 7 {
493 if shift >= 64 {
494 return 0, ErrIntOverflowSetextensionbytes
495 }
496 if iNdEx >= l {
497 return 0, io.ErrUnexpectedEOF
498 }
499 b := dAtA[iNdEx]
500 iNdEx++
501 wire |= (uint64(b) & 0x7F) << shift
502 if b < 0x80 {
503 break
504 }
505 }
506 wireType := int(wire & 0x7)
507 switch wireType {
508 case 0:
509 for shift := uint(0); ; shift += 7 {
510 if shift >= 64 {
511 return 0, ErrIntOverflowSetextensionbytes
512 }
513 if iNdEx >= l {
514 return 0, io.ErrUnexpectedEOF
515 }
516 iNdEx++
517 if dAtA[iNdEx-1] < 0x80 {
518 break
519 }
520 }
521 return iNdEx, nil
522 case 1:
523 iNdEx += 8
524 return iNdEx, nil
525 case 2:
526 var length int
527 for shift := uint(0); ; shift += 7 {
528 if shift >= 64 {
529 return 0, ErrIntOverflowSetextensionbytes
530 }
531 if iNdEx >= l {
532 return 0, io.ErrUnexpectedEOF
533 }
534 b := dAtA[iNdEx]
535 iNdEx++
536 length |= (int(b) & 0x7F) << shift
537 if b < 0x80 {
538 break
539 }
540 }
541 if length < 0 {
542 return 0, ErrInvalidLengthSetextensionbytes
543 }
544 iNdEx += length
545 if iNdEx < 0 {
546 return 0, ErrInvalidLengthSetextensionbytes
547 }
548 return iNdEx, nil
549 case 3:
550 for {
551 var innerWire uint64
552 var start int = iNdEx
553 for shift := uint(0); ; shift += 7 {
554 if shift >= 64 {
555 return 0, ErrIntOverflowSetextensionbytes
556 }
557 if iNdEx >= l {
558 return 0, io.ErrUnexpectedEOF
559 }
560 b := dAtA[iNdEx]
561 iNdEx++
562 innerWire |= (uint64(b) & 0x7F) << shift
563 if b < 0x80 {
564 break
565 }
566 }
567 innerWireType := int(innerWire & 0x7)
568 if innerWireType == 4 {
569 break
570 }
571 next, err := skipSetextensionbytes(dAtA[start:])
572 if err != nil {
573 return 0, err
574 }
575 iNdEx = start + next
576 if iNdEx < 0 {
577 return 0, ErrInvalidLengthSetextensionbytes
578 }
579 }
580 return iNdEx, nil
581 case 4:
582 return iNdEx, nil
583 case 5:
584 iNdEx += 4
585 return iNdEx, nil
586 default:
587 return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
588 }
589 }
590 panic("unreachable")
591 }
592
593 var (
594 ErrInvalidLengthSetextensionbytes = fmt.Errorf("proto: negative length found during unmarshaling")
595 ErrIntOverflowSetextensionbytes = fmt.Errorf("proto: integer overflow")
596 )
597
View as plain text