PageRenderTime 44ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/github.com/gogo/protobuf/test/protosize/protosize.pb.go

https://gitlab.com/0072016/syncthing
Go | 616 lines | 578 code | 22 blank | 16 comment | 200 complexity | 050ca38baecda70597556215d2156669 MD5 | raw file
  1. // Code generated by protoc-gen-gogo.
  2. // source: protosize.proto
  3. // DO NOT EDIT!
  4. /*
  5. Package protosize is a generated protocol buffer package.
  6. It is generated from these files:
  7. protosize.proto
  8. It has these top-level messages:
  9. SizeMessage
  10. */
  11. package protosize
  12. import proto "github.com/gogo/protobuf/proto"
  13. import fmt "fmt"
  14. import math "math"
  15. import _ "github.com/gogo/protobuf/gogoproto"
  16. import bytes "bytes"
  17. import io "io"
  18. // Reference imports to suppress errors if they are not otherwise used.
  19. var _ = proto.Marshal
  20. var _ = fmt.Errorf
  21. var _ = math.Inf
  22. // This is a compile-time assertion to ensure that this generated file
  23. // is compatible with the proto package it is being compiled against.
  24. const _ = proto.GoGoProtoPackageIsVersion1
  25. type SizeMessage struct {
  26. Size *int64 `protobuf:"varint,1,opt,name=size" json:"size,omitempty"`
  27. ProtoSize_ *int64 `protobuf:"varint,2,opt,name=proto_size,json=protoSize" json:"proto_size,omitempty"`
  28. Equal_ *bool `protobuf:"varint,3,opt,name=Equal,json=equal" json:"Equal,omitempty"`
  29. String_ *string `protobuf:"bytes,4,opt,name=String,json=string" json:"String,omitempty"`
  30. XXX_unrecognized []byte `json:"-"`
  31. }
  32. func (m *SizeMessage) Reset() { *m = SizeMessage{} }
  33. func (m *SizeMessage) String() string { return proto.CompactTextString(m) }
  34. func (*SizeMessage) ProtoMessage() {}
  35. func (*SizeMessage) Descriptor() ([]byte, []int) { return fileDescriptorProtosize, []int{0} }
  36. func (m *SizeMessage) GetSize() int64 {
  37. if m != nil && m.Size != nil {
  38. return *m.Size
  39. }
  40. return 0
  41. }
  42. func (m *SizeMessage) GetProtoSize_() int64 {
  43. if m != nil && m.ProtoSize_ != nil {
  44. return *m.ProtoSize_
  45. }
  46. return 0
  47. }
  48. func (m *SizeMessage) GetEqual_() bool {
  49. if m != nil && m.Equal_ != nil {
  50. return *m.Equal_
  51. }
  52. return false
  53. }
  54. func (m *SizeMessage) GetString_() string {
  55. if m != nil && m.String_ != nil {
  56. return *m.String_
  57. }
  58. return ""
  59. }
  60. func init() {
  61. proto.RegisterType((*SizeMessage)(nil), "protosize.SizeMessage")
  62. }
  63. func (this *SizeMessage) Equal(that interface{}) bool {
  64. if that == nil {
  65. if this == nil {
  66. return true
  67. }
  68. return false
  69. }
  70. that1, ok := that.(*SizeMessage)
  71. if !ok {
  72. that2, ok := that.(SizeMessage)
  73. if ok {
  74. that1 = &that2
  75. } else {
  76. return false
  77. }
  78. }
  79. if that1 == nil {
  80. if this == nil {
  81. return true
  82. }
  83. return false
  84. } else if this == nil {
  85. return false
  86. }
  87. if this.Size != nil && that1.Size != nil {
  88. if *this.Size != *that1.Size {
  89. return false
  90. }
  91. } else if this.Size != nil {
  92. return false
  93. } else if that1.Size != nil {
  94. return false
  95. }
  96. if this.ProtoSize_ != nil && that1.ProtoSize_ != nil {
  97. if *this.ProtoSize_ != *that1.ProtoSize_ {
  98. return false
  99. }
  100. } else if this.ProtoSize_ != nil {
  101. return false
  102. } else if that1.ProtoSize_ != nil {
  103. return false
  104. }
  105. if this.Equal_ != nil && that1.Equal_ != nil {
  106. if *this.Equal_ != *that1.Equal_ {
  107. return false
  108. }
  109. } else if this.Equal_ != nil {
  110. return false
  111. } else if that1.Equal_ != nil {
  112. return false
  113. }
  114. if this.String_ != nil && that1.String_ != nil {
  115. if *this.String_ != *that1.String_ {
  116. return false
  117. }
  118. } else if this.String_ != nil {
  119. return false
  120. } else if that1.String_ != nil {
  121. return false
  122. }
  123. if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
  124. return false
  125. }
  126. return true
  127. }
  128. func (m *SizeMessage) Marshal() (data []byte, err error) {
  129. size := m.ProtoSize()
  130. data = make([]byte, size)
  131. n, err := m.MarshalTo(data)
  132. if err != nil {
  133. return nil, err
  134. }
  135. return data[:n], nil
  136. }
  137. func (m *SizeMessage) MarshalTo(data []byte) (int, error) {
  138. var i int
  139. _ = i
  140. var l int
  141. _ = l
  142. if m.Size != nil {
  143. data[i] = 0x8
  144. i++
  145. i = encodeVarintProtosize(data, i, uint64(*m.Size))
  146. }
  147. if m.ProtoSize_ != nil {
  148. data[i] = 0x10
  149. i++
  150. i = encodeVarintProtosize(data, i, uint64(*m.ProtoSize_))
  151. }
  152. if m.Equal_ != nil {
  153. data[i] = 0x18
  154. i++
  155. if *m.Equal_ {
  156. data[i] = 1
  157. } else {
  158. data[i] = 0
  159. }
  160. i++
  161. }
  162. if m.String_ != nil {
  163. data[i] = 0x22
  164. i++
  165. i = encodeVarintProtosize(data, i, uint64(len(*m.String_)))
  166. i += copy(data[i:], *m.String_)
  167. }
  168. if m.XXX_unrecognized != nil {
  169. i += copy(data[i:], m.XXX_unrecognized)
  170. }
  171. return i, nil
  172. }
  173. func encodeFixed64Protosize(data []byte, offset int, v uint64) int {
  174. data[offset] = uint8(v)
  175. data[offset+1] = uint8(v >> 8)
  176. data[offset+2] = uint8(v >> 16)
  177. data[offset+3] = uint8(v >> 24)
  178. data[offset+4] = uint8(v >> 32)
  179. data[offset+5] = uint8(v >> 40)
  180. data[offset+6] = uint8(v >> 48)
  181. data[offset+7] = uint8(v >> 56)
  182. return offset + 8
  183. }
  184. func encodeFixed32Protosize(data []byte, offset int, v uint32) int {
  185. data[offset] = uint8(v)
  186. data[offset+1] = uint8(v >> 8)
  187. data[offset+2] = uint8(v >> 16)
  188. data[offset+3] = uint8(v >> 24)
  189. return offset + 4
  190. }
  191. func encodeVarintProtosize(data []byte, offset int, v uint64) int {
  192. for v >= 1<<7 {
  193. data[offset] = uint8(v&0x7f | 0x80)
  194. v >>= 7
  195. offset++
  196. }
  197. data[offset] = uint8(v)
  198. return offset + 1
  199. }
  200. func NewPopulatedSizeMessage(r randyProtosize, easy bool) *SizeMessage {
  201. this := &SizeMessage{}
  202. if r.Intn(10) != 0 {
  203. v1 := int64(r.Int63())
  204. if r.Intn(2) == 0 {
  205. v1 *= -1
  206. }
  207. this.Size = &v1
  208. }
  209. if r.Intn(10) != 0 {
  210. v2 := int64(r.Int63())
  211. if r.Intn(2) == 0 {
  212. v2 *= -1
  213. }
  214. this.ProtoSize_ = &v2
  215. }
  216. if r.Intn(10) != 0 {
  217. v3 := bool(bool(r.Intn(2) == 0))
  218. this.Equal_ = &v3
  219. }
  220. if r.Intn(10) != 0 {
  221. v4 := randStringProtosize(r)
  222. this.String_ = &v4
  223. }
  224. if !easy && r.Intn(10) != 0 {
  225. this.XXX_unrecognized = randUnrecognizedProtosize(r, 5)
  226. }
  227. return this
  228. }
  229. type randyProtosize interface {
  230. Float32() float32
  231. Float64() float64
  232. Int63() int64
  233. Int31() int32
  234. Uint32() uint32
  235. Intn(n int) int
  236. }
  237. func randUTF8RuneProtosize(r randyProtosize) rune {
  238. ru := r.Intn(62)
  239. if ru < 10 {
  240. return rune(ru + 48)
  241. } else if ru < 36 {
  242. return rune(ru + 55)
  243. }
  244. return rune(ru + 61)
  245. }
  246. func randStringProtosize(r randyProtosize) string {
  247. v5 := r.Intn(100)
  248. tmps := make([]rune, v5)
  249. for i := 0; i < v5; i++ {
  250. tmps[i] = randUTF8RuneProtosize(r)
  251. }
  252. return string(tmps)
  253. }
  254. func randUnrecognizedProtosize(r randyProtosize, maxFieldNumber int) (data []byte) {
  255. l := r.Intn(5)
  256. for i := 0; i < l; i++ {
  257. wire := r.Intn(4)
  258. if wire == 3 {
  259. wire = 5
  260. }
  261. fieldNumber := maxFieldNumber + r.Intn(100)
  262. data = randFieldProtosize(data, r, fieldNumber, wire)
  263. }
  264. return data
  265. }
  266. func randFieldProtosize(data []byte, r randyProtosize, fieldNumber int, wire int) []byte {
  267. key := uint32(fieldNumber)<<3 | uint32(wire)
  268. switch wire {
  269. case 0:
  270. data = encodeVarintPopulateProtosize(data, uint64(key))
  271. v6 := r.Int63()
  272. if r.Intn(2) == 0 {
  273. v6 *= -1
  274. }
  275. data = encodeVarintPopulateProtosize(data, uint64(v6))
  276. case 1:
  277. data = encodeVarintPopulateProtosize(data, uint64(key))
  278. 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)))
  279. case 2:
  280. data = encodeVarintPopulateProtosize(data, uint64(key))
  281. ll := r.Intn(100)
  282. data = encodeVarintPopulateProtosize(data, uint64(ll))
  283. for j := 0; j < ll; j++ {
  284. data = append(data, byte(r.Intn(256)))
  285. }
  286. default:
  287. data = encodeVarintPopulateProtosize(data, uint64(key))
  288. data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
  289. }
  290. return data
  291. }
  292. func encodeVarintPopulateProtosize(data []byte, v uint64) []byte {
  293. for v >= 1<<7 {
  294. data = append(data, uint8(uint64(v)&0x7f|0x80))
  295. v >>= 7
  296. }
  297. data = append(data, uint8(v))
  298. return data
  299. }
  300. func (m *SizeMessage) ProtoSize() (n int) {
  301. var l int
  302. _ = l
  303. if m.Size != nil {
  304. n += 1 + sovProtosize(uint64(*m.Size))
  305. }
  306. if m.ProtoSize_ != nil {
  307. n += 1 + sovProtosize(uint64(*m.ProtoSize_))
  308. }
  309. if m.Equal_ != nil {
  310. n += 2
  311. }
  312. if m.String_ != nil {
  313. l = len(*m.String_)
  314. n += 1 + l + sovProtosize(uint64(l))
  315. }
  316. if m.XXX_unrecognized != nil {
  317. n += len(m.XXX_unrecognized)
  318. }
  319. return n
  320. }
  321. func sovProtosize(x uint64) (n int) {
  322. for {
  323. n++
  324. x >>= 7
  325. if x == 0 {
  326. break
  327. }
  328. }
  329. return n
  330. }
  331. func sozProtosize(x uint64) (n int) {
  332. return sovProtosize(uint64((x << 1) ^ uint64((int64(x) >> 63))))
  333. }
  334. func (m *SizeMessage) Unmarshal(data []byte) error {
  335. l := len(data)
  336. iNdEx := 0
  337. for iNdEx < l {
  338. preIndex := iNdEx
  339. var wire uint64
  340. for shift := uint(0); ; shift += 7 {
  341. if shift >= 64 {
  342. return ErrIntOverflowProtosize
  343. }
  344. if iNdEx >= l {
  345. return io.ErrUnexpectedEOF
  346. }
  347. b := data[iNdEx]
  348. iNdEx++
  349. wire |= (uint64(b) & 0x7F) << shift
  350. if b < 0x80 {
  351. break
  352. }
  353. }
  354. fieldNum := int32(wire >> 3)
  355. wireType := int(wire & 0x7)
  356. if wireType == 4 {
  357. return fmt.Errorf("proto: SizeMessage: wiretype end group for non-group")
  358. }
  359. if fieldNum <= 0 {
  360. return fmt.Errorf("proto: SizeMessage: illegal tag %d (wire type %d)", fieldNum, wire)
  361. }
  362. switch fieldNum {
  363. case 1:
  364. if wireType != 0 {
  365. return fmt.Errorf("proto: wrong wireType = %d for field Size", wireType)
  366. }
  367. var v int64
  368. for shift := uint(0); ; shift += 7 {
  369. if shift >= 64 {
  370. return ErrIntOverflowProtosize
  371. }
  372. if iNdEx >= l {
  373. return io.ErrUnexpectedEOF
  374. }
  375. b := data[iNdEx]
  376. iNdEx++
  377. v |= (int64(b) & 0x7F) << shift
  378. if b < 0x80 {
  379. break
  380. }
  381. }
  382. m.Size = &v
  383. case 2:
  384. if wireType != 0 {
  385. return fmt.Errorf("proto: wrong wireType = %d for field ProtoSize_", wireType)
  386. }
  387. var v int64
  388. for shift := uint(0); ; shift += 7 {
  389. if shift >= 64 {
  390. return ErrIntOverflowProtosize
  391. }
  392. if iNdEx >= l {
  393. return io.ErrUnexpectedEOF
  394. }
  395. b := data[iNdEx]
  396. iNdEx++
  397. v |= (int64(b) & 0x7F) << shift
  398. if b < 0x80 {
  399. break
  400. }
  401. }
  402. m.ProtoSize_ = &v
  403. case 3:
  404. if wireType != 0 {
  405. return fmt.Errorf("proto: wrong wireType = %d for field Equal_", wireType)
  406. }
  407. var v int
  408. for shift := uint(0); ; shift += 7 {
  409. if shift >= 64 {
  410. return ErrIntOverflowProtosize
  411. }
  412. if iNdEx >= l {
  413. return io.ErrUnexpectedEOF
  414. }
  415. b := data[iNdEx]
  416. iNdEx++
  417. v |= (int(b) & 0x7F) << shift
  418. if b < 0x80 {
  419. break
  420. }
  421. }
  422. b := bool(v != 0)
  423. m.Equal_ = &b
  424. case 4:
  425. if wireType != 2 {
  426. return fmt.Errorf("proto: wrong wireType = %d for field String_", wireType)
  427. }
  428. var stringLen uint64
  429. for shift := uint(0); ; shift += 7 {
  430. if shift >= 64 {
  431. return ErrIntOverflowProtosize
  432. }
  433. if iNdEx >= l {
  434. return io.ErrUnexpectedEOF
  435. }
  436. b := data[iNdEx]
  437. iNdEx++
  438. stringLen |= (uint64(b) & 0x7F) << shift
  439. if b < 0x80 {
  440. break
  441. }
  442. }
  443. intStringLen := int(stringLen)
  444. if intStringLen < 0 {
  445. return ErrInvalidLengthProtosize
  446. }
  447. postIndex := iNdEx + intStringLen
  448. if postIndex > l {
  449. return io.ErrUnexpectedEOF
  450. }
  451. s := string(data[iNdEx:postIndex])
  452. m.String_ = &s
  453. iNdEx = postIndex
  454. default:
  455. iNdEx = preIndex
  456. skippy, err := skipProtosize(data[iNdEx:])
  457. if err != nil {
  458. return err
  459. }
  460. if skippy < 0 {
  461. return ErrInvalidLengthProtosize
  462. }
  463. if (iNdEx + skippy) > l {
  464. return io.ErrUnexpectedEOF
  465. }
  466. m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...)
  467. iNdEx += skippy
  468. }
  469. }
  470. if iNdEx > l {
  471. return io.ErrUnexpectedEOF
  472. }
  473. return nil
  474. }
  475. func skipProtosize(data []byte) (n int, err error) {
  476. l := len(data)
  477. iNdEx := 0
  478. for iNdEx < l {
  479. var wire uint64
  480. for shift := uint(0); ; shift += 7 {
  481. if shift >= 64 {
  482. return 0, ErrIntOverflowProtosize
  483. }
  484. if iNdEx >= l {
  485. return 0, io.ErrUnexpectedEOF
  486. }
  487. b := data[iNdEx]
  488. iNdEx++
  489. wire |= (uint64(b) & 0x7F) << shift
  490. if b < 0x80 {
  491. break
  492. }
  493. }
  494. wireType := int(wire & 0x7)
  495. switch wireType {
  496. case 0:
  497. for shift := uint(0); ; shift += 7 {
  498. if shift >= 64 {
  499. return 0, ErrIntOverflowProtosize
  500. }
  501. if iNdEx >= l {
  502. return 0, io.ErrUnexpectedEOF
  503. }
  504. iNdEx++
  505. if data[iNdEx-1] < 0x80 {
  506. break
  507. }
  508. }
  509. return iNdEx, nil
  510. case 1:
  511. iNdEx += 8
  512. return iNdEx, nil
  513. case 2:
  514. var length int
  515. for shift := uint(0); ; shift += 7 {
  516. if shift >= 64 {
  517. return 0, ErrIntOverflowProtosize
  518. }
  519. if iNdEx >= l {
  520. return 0, io.ErrUnexpectedEOF
  521. }
  522. b := data[iNdEx]
  523. iNdEx++
  524. length |= (int(b) & 0x7F) << shift
  525. if b < 0x80 {
  526. break
  527. }
  528. }
  529. iNdEx += length
  530. if length < 0 {
  531. return 0, ErrInvalidLengthProtosize
  532. }
  533. return iNdEx, nil
  534. case 3:
  535. for {
  536. var innerWire uint64
  537. var start int = iNdEx
  538. for shift := uint(0); ; shift += 7 {
  539. if shift >= 64 {
  540. return 0, ErrIntOverflowProtosize
  541. }
  542. if iNdEx >= l {
  543. return 0, io.ErrUnexpectedEOF
  544. }
  545. b := data[iNdEx]
  546. iNdEx++
  547. innerWire |= (uint64(b) & 0x7F) << shift
  548. if b < 0x80 {
  549. break
  550. }
  551. }
  552. innerWireType := int(innerWire & 0x7)
  553. if innerWireType == 4 {
  554. break
  555. }
  556. next, err := skipProtosize(data[start:])
  557. if err != nil {
  558. return 0, err
  559. }
  560. iNdEx = start + next
  561. }
  562. return iNdEx, nil
  563. case 4:
  564. return iNdEx, nil
  565. case 5:
  566. iNdEx += 4
  567. return iNdEx, nil
  568. default:
  569. return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
  570. }
  571. }
  572. panic("unreachable")
  573. }
  574. var (
  575. ErrInvalidLengthProtosize = fmt.Errorf("proto: negative length found during unmarshaling")
  576. ErrIntOverflowProtosize = fmt.Errorf("proto: integer overflow")
  577. )
  578. var fileDescriptorProtosize = []byte{
  579. // 177 bytes of a gzipped FileDescriptorProto
  580. 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0xe2, 0x2f, 0x28, 0xca, 0x2f,
  581. 0xc9, 0x2f, 0xce, 0xac, 0x4a, 0xd5, 0x03, 0xb3, 0x84, 0x38, 0xe1, 0x02, 0x52, 0xba, 0xe9, 0x99,
  582. 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0xe9, 0xf9, 0xfa, 0x60, 0xa9,
  583. 0xa4, 0xd2, 0x34, 0x30, 0x0f, 0xcc, 0x01, 0xb3, 0x20, 0x3a, 0x95, 0xf2, 0xb8, 0xb8, 0x83, 0x81,
  584. 0xda, 0x7c, 0x53, 0x8b, 0x8b, 0x13, 0xd3, 0x53, 0x85, 0x84, 0xb8, 0x58, 0x40, 0xa6, 0x48, 0x30,
  585. 0x2a, 0x30, 0x6a, 0x30, 0x07, 0x81, 0xd9, 0x42, 0xb2, 0x5c, 0x5c, 0x60, 0xb5, 0xf1, 0x60, 0x19,
  586. 0x26, 0xb0, 0x0c, 0xc4, 0x42, 0x90, 0x4e, 0x21, 0x11, 0x2e, 0x56, 0xd7, 0xc2, 0xd2, 0xc4, 0x1c,
  587. 0x09, 0x66, 0xa0, 0x0c, 0x47, 0x10, 0x6b, 0x2a, 0x88, 0x23, 0x24, 0xc6, 0xc5, 0x16, 0x5c, 0x52,
  588. 0x94, 0x99, 0x97, 0x2e, 0xc1, 0x02, 0x14, 0xe6, 0x0c, 0x62, 0x2b, 0x06, 0xf3, 0x9c, 0x24, 0x7e,
  589. 0x3c, 0x94, 0x63, 0x5c, 0xf1, 0x48, 0x8e, 0x71, 0x07, 0x10, 0x9f, 0x00, 0xe2, 0x0b, 0x40, 0xbc,
  590. 0xe0, 0xb1, 0x1c, 0x23, 0x20, 0x00, 0x00, 0xff, 0xff, 0xdf, 0x5d, 0x65, 0x12, 0xd5, 0x00, 0x00,
  591. 0x00,
  592. }