1
2
3
4 package importing
5
6 import (
7 bytes "bytes"
8 fmt "fmt"
9 _ "github.com/gogo/protobuf/gogoproto"
10 proto "github.com/gogo/protobuf/proto"
11 _ "github.com/gogo/protobuf/test/importcustom-issue389/imported"
12 github_com_gogo_protobuf_test_importcustom_issue389_imported "github.com/gogo/protobuf/test/importcustom-issue389/imported"
13 io "io"
14 math "math"
15 math_bits "math/bits"
16 )
17
18
19 var _ = proto.Marshal
20 var _ = fmt.Errorf
21 var _ = math.Inf
22
23
24
25
26
27 const _ = proto.GoGoProtoPackageIsVersion3
28
29 type C struct {
30 F2 *github_com_gogo_protobuf_test_importcustom_issue389_imported.B `protobuf:"bytes,1,opt,name=f2,proto3,customtype=github.com/gogo/protobuf/test/importcustom-issue389/imported.B" json:"f2,omitempty"`
31 XXX_NoUnkeyedLiteral struct{} `json:"-"`
32 XXX_unrecognized []byte `json:"-"`
33 XXX_sizecache int32 `json:"-"`
34 }
35
36 func (m *C) Reset() { *m = C{} }
37 func (m *C) String() string { return proto.CompactTextString(m) }
38 func (*C) ProtoMessage() {}
39 func (*C) Descriptor() ([]byte, []int) {
40 return fileDescriptor_7086c139101e99ef, []int{0}
41 }
42 func (m *C) XXX_Unmarshal(b []byte) error {
43 return m.Unmarshal(b)
44 }
45 func (m *C) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
46 if deterministic {
47 return xxx_messageInfo_C.Marshal(b, m, deterministic)
48 } else {
49 b = b[:cap(b)]
50 n, err := m.MarshalToSizedBuffer(b)
51 if err != nil {
52 return nil, err
53 }
54 return b[:n], nil
55 }
56 }
57 func (m *C) XXX_Merge(src proto.Message) {
58 xxx_messageInfo_C.Merge(m, src)
59 }
60 func (m *C) XXX_Size() int {
61 return m.Size()
62 }
63 func (m *C) XXX_DiscardUnknown() {
64 xxx_messageInfo_C.DiscardUnknown(m)
65 }
66
67 var xxx_messageInfo_C proto.InternalMessageInfo
68
69 func init() {
70 proto.RegisterType((*C)(nil), "importing.C")
71 }
72
73 func init() { proto.RegisterFile("c.proto", fileDescriptor_7086c139101e99ef) }
74
75 var fileDescriptor_7086c139101e99ef = []byte{
76
77 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x62, 0x4f, 0xd6, 0x2b, 0x28,
78 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0xcc, 0xcc, 0x2d, 0xc8, 0x2f, 0x2a, 0xc9, 0xcc, 0x4b, 0x97, 0xd2,
79 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0x4f, 0xcf, 0xd7,
80 0x07, 0xab, 0x48, 0x2a, 0x4d, 0x03, 0xf3, 0xc0, 0x1c, 0x30, 0x0b, 0xa2, 0x53, 0xca, 0x05, 0xa7,
81 0xf2, 0x92, 0xd4, 0xe2, 0x12, 0x7d, 0x88, 0xb9, 0xc9, 0xa5, 0xc5, 0x25, 0xf9, 0xb9, 0xba, 0x99,
82 0xc5, 0xc5, 0xa5, 0xa9, 0xc6, 0x16, 0x96, 0x50, 0xd1, 0xd4, 0x14, 0xfd, 0x44, 0x88, 0x29, 0x4a,
83 0x29, 0x5c, 0x8c, 0xce, 0x42, 0xf1, 0x5c, 0x4c, 0x69, 0x46, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0xdc,
84 0x46, 0xdc, 0x7a, 0x30, 0x35, 0x7a, 0x8e, 0x4e, 0x4e, 0xb7, 0xee, 0xc9, 0xdb, 0x51, 0x62, 0x8f,
85 0x9e, 0x53, 0x10, 0x53, 0x9a, 0x91, 0x93, 0xc4, 0x8f, 0x87, 0x72, 0x8c, 0x2b, 0x1e, 0xc9, 0x31,
86 0xee, 0x78, 0x24, 0xc7, 0x78, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9,
87 0x31, 0x26, 0xb1, 0x81, 0x4d, 0x33, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x06, 0x70, 0x86, 0x94,
88 0x11, 0x01, 0x00, 0x00,
89 }
90
91 func (this *C) Equal(that interface{}) bool {
92 if that == nil {
93 return this == nil
94 }
95
96 that1, ok := that.(*C)
97 if !ok {
98 that2, ok := that.(C)
99 if ok {
100 that1 = &that2
101 } else {
102 return false
103 }
104 }
105 if that1 == nil {
106 return this == nil
107 } else if this == nil {
108 return false
109 }
110 if that1.F2 == nil {
111 if this.F2 != nil {
112 return false
113 }
114 } else if !this.F2.Equal(*that1.F2) {
115 return false
116 }
117 if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
118 return false
119 }
120 return true
121 }
122 func (m *C) Marshal() (dAtA []byte, err error) {
123 size := m.Size()
124 dAtA = make([]byte, size)
125 n, err := m.MarshalToSizedBuffer(dAtA[:size])
126 if err != nil {
127 return nil, err
128 }
129 return dAtA[:n], nil
130 }
131
132 func (m *C) MarshalTo(dAtA []byte) (int, error) {
133 size := m.Size()
134 return m.MarshalToSizedBuffer(dAtA[:size])
135 }
136
137 func (m *C) MarshalToSizedBuffer(dAtA []byte) (int, error) {
138 i := len(dAtA)
139 _ = i
140 var l int
141 _ = l
142 if m.XXX_unrecognized != nil {
143 i -= len(m.XXX_unrecognized)
144 copy(dAtA[i:], m.XXX_unrecognized)
145 }
146 if m.F2 != nil {
147 {
148 size := m.F2.Size()
149 i -= size
150 if _, err := m.F2.MarshalTo(dAtA[i:]); err != nil {
151 return 0, err
152 }
153 i = encodeVarintC(dAtA, i, uint64(size))
154 }
155 i--
156 dAtA[i] = 0xa
157 }
158 return len(dAtA) - i, nil
159 }
160
161 func encodeVarintC(dAtA []byte, offset int, v uint64) int {
162 offset -= sovC(v)
163 base := offset
164 for v >= 1<<7 {
165 dAtA[offset] = uint8(v&0x7f | 0x80)
166 v >>= 7
167 offset++
168 }
169 dAtA[offset] = uint8(v)
170 return base
171 }
172 func NewPopulatedC(r randyC, easy bool) *C {
173 this := &C{}
174 if r.Intn(5) != 0 {
175 this.F2 = github_com_gogo_protobuf_test_importcustom_issue389_imported.NewPopulatedB(r)
176 }
177 if !easy && r.Intn(10) != 0 {
178 this.XXX_unrecognized = randUnrecognizedC(r, 2)
179 }
180 return this
181 }
182
183 type randyC interface {
184 Float32() float32
185 Float64() float64
186 Int63() int64
187 Int31() int32
188 Uint32() uint32
189 Intn(n int) int
190 }
191
192 func randUTF8RuneC(r randyC) rune {
193 ru := r.Intn(62)
194 if ru < 10 {
195 return rune(ru + 48)
196 } else if ru < 36 {
197 return rune(ru + 55)
198 }
199 return rune(ru + 61)
200 }
201 func randStringC(r randyC) string {
202 v1 := r.Intn(100)
203 tmps := make([]rune, v1)
204 for i := 0; i < v1; i++ {
205 tmps[i] = randUTF8RuneC(r)
206 }
207 return string(tmps)
208 }
209 func randUnrecognizedC(r randyC, maxFieldNumber int) (dAtA []byte) {
210 l := r.Intn(5)
211 for i := 0; i < l; i++ {
212 wire := r.Intn(4)
213 if wire == 3 {
214 wire = 5
215 }
216 fieldNumber := maxFieldNumber + r.Intn(100)
217 dAtA = randFieldC(dAtA, r, fieldNumber, wire)
218 }
219 return dAtA
220 }
221 func randFieldC(dAtA []byte, r randyC, fieldNumber int, wire int) []byte {
222 key := uint32(fieldNumber)<<3 | uint32(wire)
223 switch wire {
224 case 0:
225 dAtA = encodeVarintPopulateC(dAtA, uint64(key))
226 v2 := r.Int63()
227 if r.Intn(2) == 0 {
228 v2 *= -1
229 }
230 dAtA = encodeVarintPopulateC(dAtA, uint64(v2))
231 case 1:
232 dAtA = encodeVarintPopulateC(dAtA, uint64(key))
233 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
234 case 2:
235 dAtA = encodeVarintPopulateC(dAtA, uint64(key))
236 ll := r.Intn(100)
237 dAtA = encodeVarintPopulateC(dAtA, uint64(ll))
238 for j := 0; j < ll; j++ {
239 dAtA = append(dAtA, byte(r.Intn(256)))
240 }
241 default:
242 dAtA = encodeVarintPopulateC(dAtA, uint64(key))
243 dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
244 }
245 return dAtA
246 }
247 func encodeVarintPopulateC(dAtA []byte, v uint64) []byte {
248 for v >= 1<<7 {
249 dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
250 v >>= 7
251 }
252 dAtA = append(dAtA, uint8(v))
253 return dAtA
254 }
255 func (m *C) Size() (n int) {
256 if m == nil {
257 return 0
258 }
259 var l int
260 _ = l
261 if m.F2 != nil {
262 l = m.F2.Size()
263 n += 1 + l + sovC(uint64(l))
264 }
265 if m.XXX_unrecognized != nil {
266 n += len(m.XXX_unrecognized)
267 }
268 return n
269 }
270
271 func sovC(x uint64) (n int) {
272 return (math_bits.Len64(x|1) + 6) / 7
273 }
274 func sozC(x uint64) (n int) {
275 return sovC(uint64((x << 1) ^ uint64((int64(x) >> 63))))
276 }
277 func (m *C) Unmarshal(dAtA []byte) error {
278 l := len(dAtA)
279 iNdEx := 0
280 for iNdEx < l {
281 preIndex := iNdEx
282 var wire uint64
283 for shift := uint(0); ; shift += 7 {
284 if shift >= 64 {
285 return ErrIntOverflowC
286 }
287 if iNdEx >= l {
288 return io.ErrUnexpectedEOF
289 }
290 b := dAtA[iNdEx]
291 iNdEx++
292 wire |= uint64(b&0x7F) << shift
293 if b < 0x80 {
294 break
295 }
296 }
297 fieldNum := int32(wire >> 3)
298 wireType := int(wire & 0x7)
299 if wireType == 4 {
300 return fmt.Errorf("proto: C: wiretype end group for non-group")
301 }
302 if fieldNum <= 0 {
303 return fmt.Errorf("proto: C: illegal tag %d (wire type %d)", fieldNum, wire)
304 }
305 switch fieldNum {
306 case 1:
307 if wireType != 2 {
308 return fmt.Errorf("proto: wrong wireType = %d for field F2", wireType)
309 }
310 var msglen int
311 for shift := uint(0); ; shift += 7 {
312 if shift >= 64 {
313 return ErrIntOverflowC
314 }
315 if iNdEx >= l {
316 return io.ErrUnexpectedEOF
317 }
318 b := dAtA[iNdEx]
319 iNdEx++
320 msglen |= int(b&0x7F) << shift
321 if b < 0x80 {
322 break
323 }
324 }
325 if msglen < 0 {
326 return ErrInvalidLengthC
327 }
328 postIndex := iNdEx + msglen
329 if postIndex < 0 {
330 return ErrInvalidLengthC
331 }
332 if postIndex > l {
333 return io.ErrUnexpectedEOF
334 }
335 if m.F2 == nil {
336 m.F2 = &github_com_gogo_protobuf_test_importcustom_issue389_imported.B{}
337 }
338 if err := m.F2.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
339 return err
340 }
341 iNdEx = postIndex
342 default:
343 iNdEx = preIndex
344 skippy, err := skipC(dAtA[iNdEx:])
345 if err != nil {
346 return err
347 }
348 if (skippy < 0) || (iNdEx+skippy) < 0 {
349 return ErrInvalidLengthC
350 }
351 if (iNdEx + skippy) > l {
352 return io.ErrUnexpectedEOF
353 }
354 m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
355 iNdEx += skippy
356 }
357 }
358
359 if iNdEx > l {
360 return io.ErrUnexpectedEOF
361 }
362 return nil
363 }
364 func skipC(dAtA []byte) (n int, err error) {
365 l := len(dAtA)
366 iNdEx := 0
367 depth := 0
368 for iNdEx < l {
369 var wire uint64
370 for shift := uint(0); ; shift += 7 {
371 if shift >= 64 {
372 return 0, ErrIntOverflowC
373 }
374 if iNdEx >= l {
375 return 0, io.ErrUnexpectedEOF
376 }
377 b := dAtA[iNdEx]
378 iNdEx++
379 wire |= (uint64(b) & 0x7F) << shift
380 if b < 0x80 {
381 break
382 }
383 }
384 wireType := int(wire & 0x7)
385 switch wireType {
386 case 0:
387 for shift := uint(0); ; shift += 7 {
388 if shift >= 64 {
389 return 0, ErrIntOverflowC
390 }
391 if iNdEx >= l {
392 return 0, io.ErrUnexpectedEOF
393 }
394 iNdEx++
395 if dAtA[iNdEx-1] < 0x80 {
396 break
397 }
398 }
399 case 1:
400 iNdEx += 8
401 case 2:
402 var length int
403 for shift := uint(0); ; shift += 7 {
404 if shift >= 64 {
405 return 0, ErrIntOverflowC
406 }
407 if iNdEx >= l {
408 return 0, io.ErrUnexpectedEOF
409 }
410 b := dAtA[iNdEx]
411 iNdEx++
412 length |= (int(b) & 0x7F) << shift
413 if b < 0x80 {
414 break
415 }
416 }
417 if length < 0 {
418 return 0, ErrInvalidLengthC
419 }
420 iNdEx += length
421 case 3:
422 depth++
423 case 4:
424 if depth == 0 {
425 return 0, ErrUnexpectedEndOfGroupC
426 }
427 depth--
428 case 5:
429 iNdEx += 4
430 default:
431 return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
432 }
433 if iNdEx < 0 {
434 return 0, ErrInvalidLengthC
435 }
436 if depth == 0 {
437 return iNdEx, nil
438 }
439 }
440 return 0, io.ErrUnexpectedEOF
441 }
442
443 var (
444 ErrInvalidLengthC = fmt.Errorf("proto: negative length found during unmarshaling")
445 ErrIntOverflowC = fmt.Errorf("proto: integer overflow")
446 ErrUnexpectedEndOfGroupC = fmt.Errorf("proto: unexpected end of group")
447 )
448
View as plain text