sc2ai 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -306,20 +306,38 @@ module Api
306
306
  # unexpected, so discard it and continue.
307
307
  if !found
308
308
  wire_type = tag & 0x7
309
+
310
+ unknown_bytes = +"".b
311
+ val = tag
312
+ while val != 0
313
+ byte = val & 0x7F
314
+
315
+ val >>= 7
316
+ # This drops the top bits,
317
+ # Otherwise, with a signed right shift,
318
+ # we get infinity one bits at the top
319
+ val &= (1 << 57) - 1
320
+
321
+ byte |= 0x80 if val != 0
322
+ unknown_bytes << byte
323
+ end
324
+
309
325
  case wire_type
310
326
  when 0
311
327
  i = 0
312
328
  while true
313
329
  newbyte = buff.getbyte(index)
314
330
  index += 1
315
- break if newbyte.nil? || newbyte < 0x80
331
+ break if newbyte.nil?
332
+ unknown_bytes << newbyte
333
+ break if newbyte < 0x80
316
334
  i += 1
317
335
  break if i > 9
318
336
  end
319
337
  when 1
338
+ unknown_bytes << buff.byteslice(index, 8)
320
339
  index += 8
321
340
  when 2
322
- ## PULL_BYTES
323
341
  value =
324
342
  if (byte0 = buff.getbyte(index)) < 0x80
325
343
  index += 1
@@ -375,15 +393,29 @@ module Api
375
393
  raise "integer decoding error"
376
394
  end
377
395
 
378
- buff.byteslice(index, value)
379
- index += value
396
+ val = value
397
+ while val != 0
398
+ byte = val & 0x7F
380
399
 
381
- ## END PULL_BYTES
400
+ val >>= 7
401
+ # This drops the top bits,
402
+ # Otherwise, with a signed right shift,
403
+ # we get infinity one bits at the top
404
+ val &= (1 << 57) - 1
405
+
406
+ byte |= 0x80 if val != 0
407
+ unknown_bytes << byte
408
+ end
409
+
410
+ unknown_bytes << buff.byteslice(index, value)
411
+ index += value
382
412
  when 5
413
+ unknown_bytes << buff.byteslice(index, 4)
383
414
  index += 4
384
415
  else
385
416
  raise "unknown wire type #{wire_type}"
386
417
  end
418
+ (@_unknown_fields ||= +"".b) << unknown_bytes
387
419
  return self if index >= len
388
420
  ## PULL_UINT64
389
421
  tag =
@@ -1437,7 +1469,7 @@ module Api
1437
1469
  end
1438
1470
  end
1439
1471
  end
1440
-
1472
+ buff << @_unknown_fields if @_unknown_fields
1441
1473
  buff
1442
1474
  end
1443
1475
 
@@ -1629,20 +1661,38 @@ module Api
1629
1661
  # unexpected, so discard it and continue.
1630
1662
  if !found
1631
1663
  wire_type = tag & 0x7
1664
+
1665
+ unknown_bytes = +"".b
1666
+ val = tag
1667
+ while val != 0
1668
+ byte = val & 0x7F
1669
+
1670
+ val >>= 7
1671
+ # This drops the top bits,
1672
+ # Otherwise, with a signed right shift,
1673
+ # we get infinity one bits at the top
1674
+ val &= (1 << 57) - 1
1675
+
1676
+ byte |= 0x80 if val != 0
1677
+ unknown_bytes << byte
1678
+ end
1679
+
1632
1680
  case wire_type
1633
1681
  when 0
1634
1682
  i = 0
1635
1683
  while true
1636
1684
  newbyte = buff.getbyte(index)
1637
1685
  index += 1
1638
- break if newbyte.nil? || newbyte < 0x80
1686
+ break if newbyte.nil?
1687
+ unknown_bytes << newbyte
1688
+ break if newbyte < 0x80
1639
1689
  i += 1
1640
1690
  break if i > 9
1641
1691
  end
1642
1692
  when 1
1693
+ unknown_bytes << buff.byteslice(index, 8)
1643
1694
  index += 8
1644
1695
  when 2
1645
- ## PULL_BYTES
1646
1696
  value =
1647
1697
  if (byte0 = buff.getbyte(index)) < 0x80
1648
1698
  index += 1
@@ -1698,15 +1748,29 @@ module Api
1698
1748
  raise "integer decoding error"
1699
1749
  end
1700
1750
 
1701
- buff.byteslice(index, value)
1702
- index += value
1751
+ val = value
1752
+ while val != 0
1753
+ byte = val & 0x7F
1754
+
1755
+ val >>= 7
1756
+ # This drops the top bits,
1757
+ # Otherwise, with a signed right shift,
1758
+ # we get infinity one bits at the top
1759
+ val &= (1 << 57) - 1
1703
1760
 
1704
- ## END PULL_BYTES
1761
+ byte |= 0x80 if val != 0
1762
+ unknown_bytes << byte
1763
+ end
1764
+
1765
+ unknown_bytes << buff.byteslice(index, value)
1766
+ index += value
1705
1767
  when 5
1768
+ unknown_bytes << buff.byteslice(index, 4)
1706
1769
  index += 4
1707
1770
  else
1708
1771
  raise "unknown wire type #{wire_type}"
1709
1772
  end
1773
+ (@_unknown_fields ||= +"".b) << unknown_bytes
1710
1774
  return self if index >= len
1711
1775
  ## PULL_UINT64
1712
1776
  tag =
@@ -2816,7 +2880,7 @@ module Api
2816
2880
  end
2817
2881
  end
2818
2882
  end
2819
-
2883
+ buff << @_unknown_fields if @_unknown_fields
2820
2884
  buff
2821
2885
  end
2822
2886
 
@@ -2955,20 +3019,38 @@ module Api
2955
3019
  # unexpected, so discard it and continue.
2956
3020
  if !found
2957
3021
  wire_type = tag & 0x7
3022
+
3023
+ unknown_bytes = +"".b
3024
+ val = tag
3025
+ while val != 0
3026
+ byte = val & 0x7F
3027
+
3028
+ val >>= 7
3029
+ # This drops the top bits,
3030
+ # Otherwise, with a signed right shift,
3031
+ # we get infinity one bits at the top
3032
+ val &= (1 << 57) - 1
3033
+
3034
+ byte |= 0x80 if val != 0
3035
+ unknown_bytes << byte
3036
+ end
3037
+
2958
3038
  case wire_type
2959
3039
  when 0
2960
3040
  i = 0
2961
3041
  while true
2962
3042
  newbyte = buff.getbyte(index)
2963
3043
  index += 1
2964
- break if newbyte.nil? || newbyte < 0x80
3044
+ break if newbyte.nil?
3045
+ unknown_bytes << newbyte
3046
+ break if newbyte < 0x80
2965
3047
  i += 1
2966
3048
  break if i > 9
2967
3049
  end
2968
3050
  when 1
3051
+ unknown_bytes << buff.byteslice(index, 8)
2969
3052
  index += 8
2970
3053
  when 2
2971
- ## PULL_BYTES
2972
3054
  value =
2973
3055
  if (byte0 = buff.getbyte(index)) < 0x80
2974
3056
  index += 1
@@ -3024,15 +3106,29 @@ module Api
3024
3106
  raise "integer decoding error"
3025
3107
  end
3026
3108
 
3027
- buff.byteslice(index, value)
3028
- index += value
3109
+ val = value
3110
+ while val != 0
3111
+ byte = val & 0x7F
3112
+
3113
+ val >>= 7
3114
+ # This drops the top bits,
3115
+ # Otherwise, with a signed right shift,
3116
+ # we get infinity one bits at the top
3117
+ val &= (1 << 57) - 1
3118
+
3119
+ byte |= 0x80 if val != 0
3120
+ unknown_bytes << byte
3121
+ end
3029
3122
 
3030
- ## END PULL_BYTES
3123
+ unknown_bytes << buff.byteslice(index, value)
3124
+ index += value
3031
3125
  when 5
3126
+ unknown_bytes << buff.byteslice(index, 4)
3032
3127
  index += 4
3033
3128
  else
3034
3129
  raise "unknown wire type #{wire_type}"
3035
3130
  end
3131
+ (@_unknown_fields ||= +"".b) << unknown_bytes
3036
3132
  return self if index >= len
3037
3133
  ## PULL_UINT64
3038
3134
  tag =
@@ -3317,7 +3413,7 @@ module Api
3317
3413
 
3318
3414
  [val].pack("e", buffer: buff)
3319
3415
  end
3320
-
3416
+ buff << @_unknown_fields if @_unknown_fields
3321
3417
  buff
3322
3418
  end
3323
3419
 
@@ -3480,20 +3576,38 @@ module Api
3480
3576
  # unexpected, so discard it and continue.
3481
3577
  if !found
3482
3578
  wire_type = tag & 0x7
3579
+
3580
+ unknown_bytes = +"".b
3581
+ val = tag
3582
+ while val != 0
3583
+ byte = val & 0x7F
3584
+
3585
+ val >>= 7
3586
+ # This drops the top bits,
3587
+ # Otherwise, with a signed right shift,
3588
+ # we get infinity one bits at the top
3589
+ val &= (1 << 57) - 1
3590
+
3591
+ byte |= 0x80 if val != 0
3592
+ unknown_bytes << byte
3593
+ end
3594
+
3483
3595
  case wire_type
3484
3596
  when 0
3485
3597
  i = 0
3486
3598
  while true
3487
3599
  newbyte = buff.getbyte(index)
3488
3600
  index += 1
3489
- break if newbyte.nil? || newbyte < 0x80
3601
+ break if newbyte.nil?
3602
+ unknown_bytes << newbyte
3603
+ break if newbyte < 0x80
3490
3604
  i += 1
3491
3605
  break if i > 9
3492
3606
  end
3493
3607
  when 1
3608
+ unknown_bytes << buff.byteslice(index, 8)
3494
3609
  index += 8
3495
3610
  when 2
3496
- ## PULL_BYTES
3497
3611
  value =
3498
3612
  if (byte0 = buff.getbyte(index)) < 0x80
3499
3613
  index += 1
@@ -3549,15 +3663,29 @@ module Api
3549
3663
  raise "integer decoding error"
3550
3664
  end
3551
3665
 
3552
- buff.byteslice(index, value)
3553
- index += value
3666
+ val = value
3667
+ while val != 0
3668
+ byte = val & 0x7F
3669
+
3670
+ val >>= 7
3671
+ # This drops the top bits,
3672
+ # Otherwise, with a signed right shift,
3673
+ # we get infinity one bits at the top
3674
+ val &= (1 << 57) - 1
3554
3675
 
3555
- ## END PULL_BYTES
3676
+ byte |= 0x80 if val != 0
3677
+ unknown_bytes << byte
3678
+ end
3679
+
3680
+ unknown_bytes << buff.byteslice(index, value)
3681
+ index += value
3556
3682
  when 5
3683
+ unknown_bytes << buff.byteslice(index, 4)
3557
3684
  index += 4
3558
3685
  else
3559
3686
  raise "unknown wire type #{wire_type}"
3560
3687
  end
3688
+ (@_unknown_fields ||= +"".b) << unknown_bytes
3561
3689
  return self if index >= len
3562
3690
  ## PULL_UINT64
3563
3691
  tag =
@@ -3962,7 +4090,7 @@ module Api
3962
4090
  buff << byte
3963
4091
  end
3964
4092
  end
3965
-
4093
+ buff << @_unknown_fields if @_unknown_fields
3966
4094
  buff
3967
4095
  end
3968
4096
 
@@ -4110,20 +4238,38 @@ module Api
4110
4238
  # unexpected, so discard it and continue.
4111
4239
  if !found
4112
4240
  wire_type = tag & 0x7
4241
+
4242
+ unknown_bytes = +"".b
4243
+ val = tag
4244
+ while val != 0
4245
+ byte = val & 0x7F
4246
+
4247
+ val >>= 7
4248
+ # This drops the top bits,
4249
+ # Otherwise, with a signed right shift,
4250
+ # we get infinity one bits at the top
4251
+ val &= (1 << 57) - 1
4252
+
4253
+ byte |= 0x80 if val != 0
4254
+ unknown_bytes << byte
4255
+ end
4256
+
4113
4257
  case wire_type
4114
4258
  when 0
4115
4259
  i = 0
4116
4260
  while true
4117
4261
  newbyte = buff.getbyte(index)
4118
4262
  index += 1
4119
- break if newbyte.nil? || newbyte < 0x80
4263
+ break if newbyte.nil?
4264
+ unknown_bytes << newbyte
4265
+ break if newbyte < 0x80
4120
4266
  i += 1
4121
4267
  break if i > 9
4122
4268
  end
4123
4269
  when 1
4270
+ unknown_bytes << buff.byteslice(index, 8)
4124
4271
  index += 8
4125
4272
  when 2
4126
- ## PULL_BYTES
4127
4273
  value =
4128
4274
  if (byte0 = buff.getbyte(index)) < 0x80
4129
4275
  index += 1
@@ -4179,15 +4325,29 @@ module Api
4179
4325
  raise "integer decoding error"
4180
4326
  end
4181
4327
 
4182
- buff.byteslice(index, value)
4183
- index += value
4328
+ val = value
4329
+ while val != 0
4330
+ byte = val & 0x7F
4184
4331
 
4185
- ## END PULL_BYTES
4332
+ val >>= 7
4333
+ # This drops the top bits,
4334
+ # Otherwise, with a signed right shift,
4335
+ # we get infinity one bits at the top
4336
+ val &= (1 << 57) - 1
4337
+
4338
+ byte |= 0x80 if val != 0
4339
+ unknown_bytes << byte
4340
+ end
4341
+
4342
+ unknown_bytes << buff.byteslice(index, value)
4343
+ index += value
4186
4344
  when 5
4345
+ unknown_bytes << buff.byteslice(index, 4)
4187
4346
  index += 4
4188
4347
  else
4189
4348
  raise "unknown wire type #{wire_type}"
4190
4349
  end
4350
+ (@_unknown_fields ||= +"".b) << unknown_bytes
4191
4351
  return self if index >= len
4192
4352
  ## PULL_UINT64
4193
4353
  tag =
@@ -4492,64 +4652,11 @@ module Api
4492
4652
 
4493
4653
  ## END PULL_UINT64
4494
4654
  end
4495
- if tag == 0x1a
4655
+ if tag == 0x18
4496
4656
  found = true
4497
- ## PULL_UINT64
4498
- value =
4499
- if (byte0 = buff.getbyte(index)) < 0x80
4500
- index += 1
4501
- byte0
4502
- elsif (byte1 = buff.getbyte(index + 1)) < 0x80
4503
- index += 2
4504
- (byte1 << 7) | (byte0 & 0x7F)
4505
- elsif (byte2 = buff.getbyte(index + 2)) < 0x80
4506
- index += 3
4507
- (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4508
- elsif (byte3 = buff.getbyte(index + 3)) < 0x80
4509
- index += 4
4510
- (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
4511
- (byte0 & 0x7F)
4512
- elsif (byte4 = buff.getbyte(index + 4)) < 0x80
4513
- index += 5
4514
- (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
4515
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4516
- elsif (byte5 = buff.getbyte(index + 5)) < 0x80
4517
- index += 6
4518
- (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
4519
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4520
- elsif (byte6 = buff.getbyte(index + 6)) < 0x80
4521
- index += 7
4522
- (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
4523
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
4524
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4525
- elsif (byte7 = buff.getbyte(index + 7)) < 0x80
4526
- index += 8
4527
- (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
4528
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
4529
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4530
- elsif (byte8 = buff.getbyte(index + 8)) < 0x80
4531
- index += 9
4532
- (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
4533
- ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
4534
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
4535
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4536
- elsif (byte9 = buff.getbyte(index + 9)) < 0x80
4537
- index += 10
4538
-
4539
- (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) |
4540
- ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
4541
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
4542
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4543
- else
4544
- raise "integer decoding error"
4545
- end
4546
-
4547
- ## END PULL_UINT64
4548
-
4549
- goal = index + value
4657
+ ## DECODE REPEATED
4550
4658
  list = @upgrade_ids
4551
4659
  while true
4552
- break if index >= goal
4553
4660
  ## PULL_UINT64
4554
4661
  list << if (byte0 = buff.getbyte(index)) < 0x80
4555
4662
  index += 1
@@ -4600,60 +4707,71 @@ module Api
4600
4707
  end
4601
4708
 
4602
4709
  ## END PULL_UINT64
4603
- end
4604
4710
 
4605
- return self if index >= len
4606
- ## PULL_UINT64
4607
- tag =
4608
- if (byte0 = buff.getbyte(index)) < 0x80
4609
- index += 1
4610
- byte0
4611
- elsif (byte1 = buff.getbyte(index + 1)) < 0x80
4612
- index += 2
4613
- (byte1 << 7) | (byte0 & 0x7F)
4614
- elsif (byte2 = buff.getbyte(index + 2)) < 0x80
4615
- index += 3
4616
- (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4617
- elsif (byte3 = buff.getbyte(index + 3)) < 0x80
4618
- index += 4
4619
- (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
4620
- (byte0 & 0x7F)
4621
- elsif (byte4 = buff.getbyte(index + 4)) < 0x80
4622
- index += 5
4623
- (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
4624
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4625
- elsif (byte5 = buff.getbyte(index + 5)) < 0x80
4626
- index += 6
4627
- (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
4628
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4629
- elsif (byte6 = buff.getbyte(index + 6)) < 0x80
4630
- index += 7
4631
- (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
4632
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
4633
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4634
- elsif (byte7 = buff.getbyte(index + 7)) < 0x80
4635
- index += 8
4636
- (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
4637
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
4638
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4639
- elsif (byte8 = buff.getbyte(index + 8)) < 0x80
4640
- index += 9
4641
- (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
4642
- ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
4643
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
4644
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4645
- elsif (byte9 = buff.getbyte(index + 9)) < 0x80
4646
- index += 10
4711
+ return self if index >= len
4712
+ ## PULL_UINT64
4713
+ tag =
4714
+ if (byte0 = buff.getbyte(index)) < 0x80
4715
+ index += 1
4716
+ byte0
4717
+ elsif (byte1 = buff.getbyte(index + 1)) < 0x80
4718
+ index += 2
4719
+ (byte1 << 7) | (byte0 & 0x7F)
4720
+ elsif (byte2 = buff.getbyte(index + 2)) < 0x80
4721
+ index += 3
4722
+ (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4723
+ elsif (byte3 = buff.getbyte(index + 3)) < 0x80
4724
+ index += 4
4725
+ (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
4726
+ (byte0 & 0x7F)
4727
+ elsif (byte4 = buff.getbyte(index + 4)) < 0x80
4728
+ index += 5
4729
+ (byte4 << 28) | ((byte3 & 0x7F) << 21) |
4730
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
4731
+ (byte0 & 0x7F)
4732
+ elsif (byte5 = buff.getbyte(index + 5)) < 0x80
4733
+ index += 6
4734
+ (byte5 << 35) | ((byte4 & 0x7F) << 28) |
4735
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
4736
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4737
+ elsif (byte6 = buff.getbyte(index + 6)) < 0x80
4738
+ index += 7
4739
+ (byte6 << 42) | ((byte5 & 0x7F) << 35) |
4740
+ ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
4741
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
4742
+ (byte0 & 0x7F)
4743
+ elsif (byte7 = buff.getbyte(index + 7)) < 0x80
4744
+ index += 8
4745
+ (byte7 << 49) | ((byte6 & 0x7F) << 42) |
4746
+ ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
4747
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
4748
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4749
+ elsif (byte8 = buff.getbyte(index + 8)) < 0x80
4750
+ index += 9
4751
+ (byte8 << 56) | ((byte7 & 0x7F) << 49) |
4752
+ ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
4753
+ ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
4754
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
4755
+ (byte0 & 0x7F)
4756
+ elsif (byte9 = buff.getbyte(index + 9)) < 0x80
4757
+ index += 10
4647
4758
 
4648
- (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) |
4649
- ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
4650
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
4651
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4652
- else
4653
- raise "integer decoding error"
4654
- end
4759
+ (byte9 << 63) | ((byte8 & 0x7F) << 56) |
4760
+ ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
4761
+ ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
4762
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
4763
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
4764
+ else
4765
+ raise "integer decoding error"
4766
+ end
4655
4767
 
4656
- ## END PULL_UINT64
4768
+ ## END PULL_UINT64
4769
+
4770
+ break unless tag == 0x18
4771
+ end
4772
+ ## END DECODE REPEATED
4773
+
4774
+ return self if index >= len
4657
4775
  end
4658
4776
 
4659
4777
  return self if index >= len
@@ -4763,18 +4881,11 @@ module Api
4763
4881
 
4764
4882
  list = @upgrade_ids
4765
4883
  if list.size > 0
4766
- buff << 0x1a
4767
-
4768
- # Save the buffer size before appending the repeated bytes
4769
- current_len = buff.bytesize
4770
-
4771
- # Write a single dummy byte to later store encoded length
4772
- buff << 42 # "*"
4773
-
4774
- # write each item
4775
4884
  list.each do |item|
4776
4885
  val = item
4777
4886
  if val != 0
4887
+ buff << 0x18
4888
+
4778
4889
  while val != 0
4779
4890
  byte = val & 0x7F
4780
4891
  val >>= 7
@@ -4783,44 +4894,10 @@ module Api
4783
4894
  end
4784
4895
  end
4785
4896
  end
4786
-
4787
- # Calculate the submessage's size
4788
- submessage_size = buff.bytesize - current_len - 1
4789
-
4790
- # Hope the size fits in one byte
4791
- byte = submessage_size & 0x7F
4792
- submessage_size >>= 7
4793
- byte |= 0x80 if submessage_size > 0
4794
- buff.setbyte(current_len, byte)
4795
-
4796
- # If the sub message was bigger
4797
- if submessage_size > 0
4798
- current_len += 1
4799
-
4800
- # compute how much we need to shift
4801
- encoded_int_len = 0
4802
- remaining_size = submessage_size
4803
- while remaining_size != 0
4804
- remaining_size >>= 7
4805
- encoded_int_len += 1
4806
- end
4807
-
4808
- # Make space in the string with dummy bytes
4809
- buff.bytesplice(current_len, 0, "*********", 0, encoded_int_len)
4810
-
4811
- # Overwrite the dummy bytes with the encoded length
4812
- while submessage_size != 0
4813
- byte = submessage_size & 0x7F
4814
- submessage_size >>= 7
4815
- byte |= 0x80 if submessage_size > 0
4816
- buff.setbyte(current_len, byte)
4817
- current_len += 1
4818
- end
4819
- end
4820
- end
4821
-
4822
- buff
4823
- end
4897
+ end
4898
+ buff << @_unknown_fields if @_unknown_fields
4899
+ buff
4900
+ end
4824
4901
 
4825
4902
  def to_h
4826
4903
  result = {}
@@ -5017,20 +5094,38 @@ module Api
5017
5094
  # unexpected, so discard it and continue.
5018
5095
  if !found
5019
5096
  wire_type = tag & 0x7
5097
+
5098
+ unknown_bytes = +"".b
5099
+ val = tag
5100
+ while val != 0
5101
+ byte = val & 0x7F
5102
+
5103
+ val >>= 7
5104
+ # This drops the top bits,
5105
+ # Otherwise, with a signed right shift,
5106
+ # we get infinity one bits at the top
5107
+ val &= (1 << 57) - 1
5108
+
5109
+ byte |= 0x80 if val != 0
5110
+ unknown_bytes << byte
5111
+ end
5112
+
5020
5113
  case wire_type
5021
5114
  when 0
5022
5115
  i = 0
5023
5116
  while true
5024
5117
  newbyte = buff.getbyte(index)
5025
5118
  index += 1
5026
- break if newbyte.nil? || newbyte < 0x80
5119
+ break if newbyte.nil?
5120
+ unknown_bytes << newbyte
5121
+ break if newbyte < 0x80
5027
5122
  i += 1
5028
5123
  break if i > 9
5029
5124
  end
5030
5125
  when 1
5126
+ unknown_bytes << buff.byteslice(index, 8)
5031
5127
  index += 8
5032
5128
  when 2
5033
- ## PULL_BYTES
5034
5129
  value =
5035
5130
  if (byte0 = buff.getbyte(index)) < 0x80
5036
5131
  index += 1
@@ -5086,15 +5181,29 @@ module Api
5086
5181
  raise "integer decoding error"
5087
5182
  end
5088
5183
 
5089
- buff.byteslice(index, value)
5090
- index += value
5184
+ val = value
5185
+ while val != 0
5186
+ byte = val & 0x7F
5187
+
5188
+ val >>= 7
5189
+ # This drops the top bits,
5190
+ # Otherwise, with a signed right shift,
5191
+ # we get infinity one bits at the top
5192
+ val &= (1 << 57) - 1
5193
+
5194
+ byte |= 0x80 if val != 0
5195
+ unknown_bytes << byte
5196
+ end
5091
5197
 
5092
- ## END PULL_BYTES
5198
+ unknown_bytes << buff.byteslice(index, value)
5199
+ index += value
5093
5200
  when 5
5201
+ unknown_bytes << buff.byteslice(index, 4)
5094
5202
  index += 4
5095
5203
  else
5096
5204
  raise "unknown wire type #{wire_type}"
5097
5205
  end
5206
+ (@_unknown_fields ||= +"".b) << unknown_bytes
5098
5207
  return self if index >= len
5099
5208
  ## PULL_UINT64
5100
5209
  tag =
@@ -5620,7 +5729,7 @@ module Api
5620
5729
 
5621
5730
  [val].pack("e", buffer: buff)
5622
5731
  end
5623
-
5732
+ buff << @_unknown_fields if @_unknown_fields
5624
5733
  buff
5625
5734
  end
5626
5735
 
@@ -5897,20 +6006,38 @@ module Api
5897
6006
  # unexpected, so discard it and continue.
5898
6007
  if !found
5899
6008
  wire_type = tag & 0x7
6009
+
6010
+ unknown_bytes = +"".b
6011
+ val = tag
6012
+ while val != 0
6013
+ byte = val & 0x7F
6014
+
6015
+ val >>= 7
6016
+ # This drops the top bits,
6017
+ # Otherwise, with a signed right shift,
6018
+ # we get infinity one bits at the top
6019
+ val &= (1 << 57) - 1
6020
+
6021
+ byte |= 0x80 if val != 0
6022
+ unknown_bytes << byte
6023
+ end
6024
+
5900
6025
  case wire_type
5901
6026
  when 0
5902
6027
  i = 0
5903
6028
  while true
5904
6029
  newbyte = buff.getbyte(index)
5905
6030
  index += 1
5906
- break if newbyte.nil? || newbyte < 0x80
6031
+ break if newbyte.nil?
6032
+ unknown_bytes << newbyte
6033
+ break if newbyte < 0x80
5907
6034
  i += 1
5908
6035
  break if i > 9
5909
6036
  end
5910
6037
  when 1
6038
+ unknown_bytes << buff.byteslice(index, 8)
5911
6039
  index += 8
5912
6040
  when 2
5913
- ## PULL_BYTES
5914
6041
  value =
5915
6042
  if (byte0 = buff.getbyte(index)) < 0x80
5916
6043
  index += 1
@@ -5966,15 +6093,29 @@ module Api
5966
6093
  raise "integer decoding error"
5967
6094
  end
5968
6095
 
5969
- buff.byteslice(index, value)
5970
- index += value
6096
+ val = value
6097
+ while val != 0
6098
+ byte = val & 0x7F
6099
+
6100
+ val >>= 7
6101
+ # This drops the top bits,
6102
+ # Otherwise, with a signed right shift,
6103
+ # we get infinity one bits at the top
6104
+ val &= (1 << 57) - 1
5971
6105
 
5972
- ## END PULL_BYTES
6106
+ byte |= 0x80 if val != 0
6107
+ unknown_bytes << byte
6108
+ end
6109
+
6110
+ unknown_bytes << buff.byteslice(index, value)
6111
+ index += value
5973
6112
  when 5
6113
+ unknown_bytes << buff.byteslice(index, 4)
5974
6114
  index += 4
5975
6115
  else
5976
6116
  raise "unknown wire type #{wire_type}"
5977
6117
  end
6118
+ (@_unknown_fields ||= +"".b) << unknown_bytes
5978
6119
  return self if index >= len
5979
6120
  ## PULL_UINT64
5980
6121
  tag =
@@ -6664,7 +6805,7 @@ module Api
6664
6805
  buff << byte
6665
6806
  end
6666
6807
  end
6667
-
6808
+ buff << @_unknown_fields if @_unknown_fields
6668
6809
  buff
6669
6810
  end
6670
6811
 
@@ -6814,20 +6955,38 @@ module Api
6814
6955
  # unexpected, so discard it and continue.
6815
6956
  if !found
6816
6957
  wire_type = tag & 0x7
6958
+
6959
+ unknown_bytes = +"".b
6960
+ val = tag
6961
+ while val != 0
6962
+ byte = val & 0x7F
6963
+
6964
+ val >>= 7
6965
+ # This drops the top bits,
6966
+ # Otherwise, with a signed right shift,
6967
+ # we get infinity one bits at the top
6968
+ val &= (1 << 57) - 1
6969
+
6970
+ byte |= 0x80 if val != 0
6971
+ unknown_bytes << byte
6972
+ end
6973
+
6817
6974
  case wire_type
6818
6975
  when 0
6819
6976
  i = 0
6820
6977
  while true
6821
6978
  newbyte = buff.getbyte(index)
6822
6979
  index += 1
6823
- break if newbyte.nil? || newbyte < 0x80
6980
+ break if newbyte.nil?
6981
+ unknown_bytes << newbyte
6982
+ break if newbyte < 0x80
6824
6983
  i += 1
6825
6984
  break if i > 9
6826
6985
  end
6827
6986
  when 1
6987
+ unknown_bytes << buff.byteslice(index, 8)
6828
6988
  index += 8
6829
6989
  when 2
6830
- ## PULL_BYTES
6831
6990
  value =
6832
6991
  if (byte0 = buff.getbyte(index)) < 0x80
6833
6992
  index += 1
@@ -6883,15 +7042,29 @@ module Api
6883
7042
  raise "integer decoding error"
6884
7043
  end
6885
7044
 
6886
- buff.byteslice(index, value)
6887
- index += value
7045
+ val = value
7046
+ while val != 0
7047
+ byte = val & 0x7F
6888
7048
 
6889
- ## END PULL_BYTES
7049
+ val >>= 7
7050
+ # This drops the top bits,
7051
+ # Otherwise, with a signed right shift,
7052
+ # we get infinity one bits at the top
7053
+ val &= (1 << 57) - 1
7054
+
7055
+ byte |= 0x80 if val != 0
7056
+ unknown_bytes << byte
7057
+ end
7058
+
7059
+ unknown_bytes << buff.byteslice(index, value)
7060
+ index += value
6890
7061
  when 5
7062
+ unknown_bytes << buff.byteslice(index, 4)
6891
7063
  index += 4
6892
7064
  else
6893
7065
  raise "unknown wire type #{wire_type}"
6894
7066
  end
7067
+ (@_unknown_fields ||= +"".b) << unknown_bytes
6895
7068
  return self if index >= len
6896
7069
  ## PULL_UINT64
6897
7070
  tag =
@@ -7232,7 +7405,7 @@ module Api
7232
7405
  buff << byte
7233
7406
  end
7234
7407
  end
7235
-
7408
+ buff << @_unknown_fields if @_unknown_fields
7236
7409
  buff
7237
7410
  end
7238
7411
 
@@ -8327,20 +8500,38 @@ module Api
8327
8500
  # unexpected, so discard it and continue.
8328
8501
  if !found
8329
8502
  wire_type = tag & 0x7
8503
+
8504
+ unknown_bytes = +"".b
8505
+ val = tag
8506
+ while val != 0
8507
+ byte = val & 0x7F
8508
+
8509
+ val >>= 7
8510
+ # This drops the top bits,
8511
+ # Otherwise, with a signed right shift,
8512
+ # we get infinity one bits at the top
8513
+ val &= (1 << 57) - 1
8514
+
8515
+ byte |= 0x80 if val != 0
8516
+ unknown_bytes << byte
8517
+ end
8518
+
8330
8519
  case wire_type
8331
8520
  when 0
8332
8521
  i = 0
8333
8522
  while true
8334
8523
  newbyte = buff.getbyte(index)
8335
8524
  index += 1
8336
- break if newbyte.nil? || newbyte < 0x80
8525
+ break if newbyte.nil?
8526
+ unknown_bytes << newbyte
8527
+ break if newbyte < 0x80
8337
8528
  i += 1
8338
8529
  break if i > 9
8339
8530
  end
8340
8531
  when 1
8532
+ unknown_bytes << buff.byteslice(index, 8)
8341
8533
  index += 8
8342
8534
  when 2
8343
- ## PULL_BYTES
8344
8535
  value =
8345
8536
  if (byte0 = buff.getbyte(index)) < 0x80
8346
8537
  index += 1
@@ -8396,15 +8587,29 @@ module Api
8396
8587
  raise "integer decoding error"
8397
8588
  end
8398
8589
 
8399
- buff.byteslice(index, value)
8400
- index += value
8590
+ val = value
8591
+ while val != 0
8592
+ byte = val & 0x7F
8593
+
8594
+ val >>= 7
8595
+ # This drops the top bits,
8596
+ # Otherwise, with a signed right shift,
8597
+ # we get infinity one bits at the top
8598
+ val &= (1 << 57) - 1
8401
8599
 
8402
- ## END PULL_BYTES
8600
+ byte |= 0x80 if val != 0
8601
+ unknown_bytes << byte
8602
+ end
8603
+
8604
+ unknown_bytes << buff.byteslice(index, value)
8605
+ index += value
8403
8606
  when 5
8607
+ unknown_bytes << buff.byteslice(index, 4)
8404
8608
  index += 4
8405
8609
  else
8406
8610
  raise "unknown wire type #{wire_type}"
8407
8611
  end
8612
+ (@_unknown_fields ||= +"".b) << unknown_bytes
8408
8613
  return self if index >= len
8409
8614
  ## PULL_UINT64
8410
8615
  tag =
@@ -9442,64 +9647,11 @@ module Api
9442
9647
 
9443
9648
  ## END PULL_UINT64
9444
9649
  end
9445
- if tag == 0xda
9650
+ if tag == 0xd8
9446
9651
  found = true
9447
- ## PULL_UINT64
9448
- value =
9449
- if (byte0 = buff.getbyte(index)) < 0x80
9450
- index += 1
9451
- byte0
9452
- elsif (byte1 = buff.getbyte(index + 1)) < 0x80
9453
- index += 2
9454
- (byte1 << 7) | (byte0 & 0x7F)
9455
- elsif (byte2 = buff.getbyte(index + 2)) < 0x80
9456
- index += 3
9457
- (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9458
- elsif (byte3 = buff.getbyte(index + 3)) < 0x80
9459
- index += 4
9460
- (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
9461
- (byte0 & 0x7F)
9462
- elsif (byte4 = buff.getbyte(index + 4)) < 0x80
9463
- index += 5
9464
- (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
9465
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9466
- elsif (byte5 = buff.getbyte(index + 5)) < 0x80
9467
- index += 6
9468
- (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
9469
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9470
- elsif (byte6 = buff.getbyte(index + 6)) < 0x80
9471
- index += 7
9472
- (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
9473
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
9474
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9475
- elsif (byte7 = buff.getbyte(index + 7)) < 0x80
9476
- index += 8
9477
- (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
9478
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
9479
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9480
- elsif (byte8 = buff.getbyte(index + 8)) < 0x80
9481
- index += 9
9482
- (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
9483
- ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
9484
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
9485
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9486
- elsif (byte9 = buff.getbyte(index + 9)) < 0x80
9487
- index += 10
9488
-
9489
- (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) |
9490
- ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
9491
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
9492
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9493
- else
9494
- raise "integer decoding error"
9495
- end
9496
-
9497
- ## END PULL_UINT64
9498
-
9499
- goal = index + value
9652
+ ## DECODE REPEATED
9500
9653
  list = @buff_ids
9501
9654
  while true
9502
- break if index >= goal
9503
9655
  ## PULL_UINT64
9504
9656
  list << if (byte0 = buff.getbyte(index)) < 0x80
9505
9657
  index += 1
@@ -9550,60 +9702,71 @@ module Api
9550
9702
  end
9551
9703
 
9552
9704
  ## END PULL_UINT64
9553
- end
9554
9705
 
9555
- return self if index >= len
9556
- ## PULL_UINT64
9557
- tag =
9558
- if (byte0 = buff.getbyte(index)) < 0x80
9559
- index += 1
9560
- byte0
9561
- elsif (byte1 = buff.getbyte(index + 1)) < 0x80
9562
- index += 2
9563
- (byte1 << 7) | (byte0 & 0x7F)
9564
- elsif (byte2 = buff.getbyte(index + 2)) < 0x80
9565
- index += 3
9566
- (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9567
- elsif (byte3 = buff.getbyte(index + 3)) < 0x80
9568
- index += 4
9569
- (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
9570
- (byte0 & 0x7F)
9571
- elsif (byte4 = buff.getbyte(index + 4)) < 0x80
9572
- index += 5
9573
- (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
9574
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9575
- elsif (byte5 = buff.getbyte(index + 5)) < 0x80
9576
- index += 6
9577
- (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
9578
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9579
- elsif (byte6 = buff.getbyte(index + 6)) < 0x80
9580
- index += 7
9581
- (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
9582
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
9583
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9584
- elsif (byte7 = buff.getbyte(index + 7)) < 0x80
9585
- index += 8
9586
- (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
9587
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
9588
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9589
- elsif (byte8 = buff.getbyte(index + 8)) < 0x80
9590
- index += 9
9591
- (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
9592
- ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
9593
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
9594
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9595
- elsif (byte9 = buff.getbyte(index + 9)) < 0x80
9596
- index += 10
9706
+ return self if index >= len
9707
+ ## PULL_UINT64
9708
+ tag =
9709
+ if (byte0 = buff.getbyte(index)) < 0x80
9710
+ index += 1
9711
+ byte0
9712
+ elsif (byte1 = buff.getbyte(index + 1)) < 0x80
9713
+ index += 2
9714
+ (byte1 << 7) | (byte0 & 0x7F)
9715
+ elsif (byte2 = buff.getbyte(index + 2)) < 0x80
9716
+ index += 3
9717
+ (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9718
+ elsif (byte3 = buff.getbyte(index + 3)) < 0x80
9719
+ index += 4
9720
+ (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
9721
+ (byte0 & 0x7F)
9722
+ elsif (byte4 = buff.getbyte(index + 4)) < 0x80
9723
+ index += 5
9724
+ (byte4 << 28) | ((byte3 & 0x7F) << 21) |
9725
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
9726
+ (byte0 & 0x7F)
9727
+ elsif (byte5 = buff.getbyte(index + 5)) < 0x80
9728
+ index += 6
9729
+ (byte5 << 35) | ((byte4 & 0x7F) << 28) |
9730
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
9731
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9732
+ elsif (byte6 = buff.getbyte(index + 6)) < 0x80
9733
+ index += 7
9734
+ (byte6 << 42) | ((byte5 & 0x7F) << 35) |
9735
+ ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
9736
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
9737
+ (byte0 & 0x7F)
9738
+ elsif (byte7 = buff.getbyte(index + 7)) < 0x80
9739
+ index += 8
9740
+ (byte7 << 49) | ((byte6 & 0x7F) << 42) |
9741
+ ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
9742
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
9743
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9744
+ elsif (byte8 = buff.getbyte(index + 8)) < 0x80
9745
+ index += 9
9746
+ (byte8 << 56) | ((byte7 & 0x7F) << 49) |
9747
+ ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
9748
+ ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
9749
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
9750
+ (byte0 & 0x7F)
9751
+ elsif (byte9 = buff.getbyte(index + 9)) < 0x80
9752
+ index += 10
9597
9753
 
9598
- (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) |
9599
- ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
9600
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
9601
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9602
- else
9603
- raise "integer decoding error"
9604
- end
9754
+ (byte9 << 63) | ((byte8 & 0x7F) << 56) |
9755
+ ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
9756
+ ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
9757
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
9758
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
9759
+ else
9760
+ raise "integer decoding error"
9761
+ end
9605
9762
 
9606
- ## END PULL_UINT64
9763
+ ## END PULL_UINT64
9764
+
9765
+ break unless tag == 0xd8
9766
+ end
9767
+ ## END DECODE REPEATED
9768
+
9769
+ return self if index >= len
9607
9770
  end
9608
9771
  if tag == 0xfd
9609
9772
  found = true
@@ -12731,19 +12894,12 @@ module Api
12731
12894
 
12732
12895
  list = @buff_ids
12733
12896
  if list.size > 0
12734
- buff << 0xda
12735
- buff << 0x01
12736
-
12737
- # Save the buffer size before appending the repeated bytes
12738
- current_len = buff.bytesize
12739
-
12740
- # Write a single dummy byte to later store encoded length
12741
- buff << 42 # "*"
12742
-
12743
- # write each item
12744
12897
  list.each do |item|
12745
12898
  val = item
12746
12899
  if val != 0
12900
+ buff << 0xd8
12901
+ buff << 0x01
12902
+
12747
12903
  while val != 0
12748
12904
  byte = val & 0x7F
12749
12905
  val >>= 7
@@ -12752,40 +12908,6 @@ module Api
12752
12908
  end
12753
12909
  end
12754
12910
  end
12755
-
12756
- # Calculate the submessage's size
12757
- submessage_size = buff.bytesize - current_len - 1
12758
-
12759
- # Hope the size fits in one byte
12760
- byte = submessage_size & 0x7F
12761
- submessage_size >>= 7
12762
- byte |= 0x80 if submessage_size > 0
12763
- buff.setbyte(current_len, byte)
12764
-
12765
- # If the sub message was bigger
12766
- if submessage_size > 0
12767
- current_len += 1
12768
-
12769
- # compute how much we need to shift
12770
- encoded_int_len = 0
12771
- remaining_size = submessage_size
12772
- while remaining_size != 0
12773
- remaining_size >>= 7
12774
- encoded_int_len += 1
12775
- end
12776
-
12777
- # Make space in the string with dummy bytes
12778
- buff.bytesplice(current_len, 0, "*********", 0, encoded_int_len)
12779
-
12780
- # Overwrite the dummy bytes with the encoded length
12781
- while submessage_size != 0
12782
- byte = submessage_size & 0x7F
12783
- submessage_size >>= 7
12784
- byte |= 0x80 if submessage_size > 0
12785
- buff.setbyte(current_len, byte)
12786
- current_len += 1
12787
- end
12788
- end
12789
12911
  end
12790
12912
 
12791
12913
  val = @detect_range
@@ -13347,7 +13469,7 @@ module Api
13347
13469
  end
13348
13470
  end
13349
13471
  end
13350
-
13472
+ buff << @_unknown_fields if @_unknown_fields
13351
13473
  buff
13352
13474
  end
13353
13475
 
@@ -13524,20 +13646,38 @@ module Api
13524
13646
  # unexpected, so discard it and continue.
13525
13647
  if !found
13526
13648
  wire_type = tag & 0x7
13649
+
13650
+ unknown_bytes = +"".b
13651
+ val = tag
13652
+ while val != 0
13653
+ byte = val & 0x7F
13654
+
13655
+ val >>= 7
13656
+ # This drops the top bits,
13657
+ # Otherwise, with a signed right shift,
13658
+ # we get infinity one bits at the top
13659
+ val &= (1 << 57) - 1
13660
+
13661
+ byte |= 0x80 if val != 0
13662
+ unknown_bytes << byte
13663
+ end
13664
+
13527
13665
  case wire_type
13528
13666
  when 0
13529
13667
  i = 0
13530
13668
  while true
13531
13669
  newbyte = buff.getbyte(index)
13532
13670
  index += 1
13533
- break if newbyte.nil? || newbyte < 0x80
13671
+ break if newbyte.nil?
13672
+ unknown_bytes << newbyte
13673
+ break if newbyte < 0x80
13534
13674
  i += 1
13535
13675
  break if i > 9
13536
13676
  end
13537
13677
  when 1
13678
+ unknown_bytes << buff.byteslice(index, 8)
13538
13679
  index += 8
13539
13680
  when 2
13540
- ## PULL_BYTES
13541
13681
  value =
13542
13682
  if (byte0 = buff.getbyte(index)) < 0x80
13543
13683
  index += 1
@@ -13593,15 +13733,29 @@ module Api
13593
13733
  raise "integer decoding error"
13594
13734
  end
13595
13735
 
13596
- buff.byteslice(index, value)
13597
- index += value
13736
+ val = value
13737
+ while val != 0
13738
+ byte = val & 0x7F
13739
+
13740
+ val >>= 7
13741
+ # This drops the top bits,
13742
+ # Otherwise, with a signed right shift,
13743
+ # we get infinity one bits at the top
13744
+ val &= (1 << 57) - 1
13745
+
13746
+ byte |= 0x80 if val != 0
13747
+ unknown_bytes << byte
13748
+ end
13598
13749
 
13599
- ## END PULL_BYTES
13750
+ unknown_bytes << buff.byteslice(index, value)
13751
+ index += value
13600
13752
  when 5
13753
+ unknown_bytes << buff.byteslice(index, 4)
13601
13754
  index += 4
13602
13755
  else
13603
13756
  raise "unknown wire type #{wire_type}"
13604
13757
  end
13758
+ (@_unknown_fields ||= +"".b) << unknown_bytes
13605
13759
  return self if index >= len
13606
13760
  ## PULL_UINT64
13607
13761
  tag =
@@ -13983,7 +14137,7 @@ module Api
13983
14137
 
13984
14138
  buff
13985
14139
  end
13986
-
14140
+ buff << @_unknown_fields if @_unknown_fields
13987
14141
  buff
13988
14142
  end
13989
14143
 
@@ -14093,20 +14247,38 @@ module Api
14093
14247
  # unexpected, so discard it and continue.
14094
14248
  if !found
14095
14249
  wire_type = tag & 0x7
14250
+
14251
+ unknown_bytes = +"".b
14252
+ val = tag
14253
+ while val != 0
14254
+ byte = val & 0x7F
14255
+
14256
+ val >>= 7
14257
+ # This drops the top bits,
14258
+ # Otherwise, with a signed right shift,
14259
+ # we get infinity one bits at the top
14260
+ val &= (1 << 57) - 1
14261
+
14262
+ byte |= 0x80 if val != 0
14263
+ unknown_bytes << byte
14264
+ end
14265
+
14096
14266
  case wire_type
14097
14267
  when 0
14098
14268
  i = 0
14099
14269
  while true
14100
14270
  newbyte = buff.getbyte(index)
14101
14271
  index += 1
14102
- break if newbyte.nil? || newbyte < 0x80
14272
+ break if newbyte.nil?
14273
+ unknown_bytes << newbyte
14274
+ break if newbyte < 0x80
14103
14275
  i += 1
14104
14276
  break if i > 9
14105
14277
  end
14106
14278
  when 1
14279
+ unknown_bytes << buff.byteslice(index, 8)
14107
14280
  index += 8
14108
14281
  when 2
14109
- ## PULL_BYTES
14110
14282
  value =
14111
14283
  if (byte0 = buff.getbyte(index)) < 0x80
14112
14284
  index += 1
@@ -14162,15 +14334,29 @@ module Api
14162
14334
  raise "integer decoding error"
14163
14335
  end
14164
14336
 
14165
- buff.byteslice(index, value)
14166
- index += value
14337
+ val = value
14338
+ while val != 0
14339
+ byte = val & 0x7F
14340
+
14341
+ val >>= 7
14342
+ # This drops the top bits,
14343
+ # Otherwise, with a signed right shift,
14344
+ # we get infinity one bits at the top
14345
+ val &= (1 << 57) - 1
14346
+
14347
+ byte |= 0x80 if val != 0
14348
+ unknown_bytes << byte
14349
+ end
14167
14350
 
14168
- ## END PULL_BYTES
14351
+ unknown_bytes << buff.byteslice(index, value)
14352
+ index += value
14169
14353
  when 5
14354
+ unknown_bytes << buff.byteslice(index, 4)
14170
14355
  index += 4
14171
14356
  else
14172
14357
  raise "unknown wire type #{wire_type}"
14173
14358
  end
14359
+ (@_unknown_fields ||= +"".b) << unknown_bytes
14174
14360
  return self if index >= len
14175
14361
  ## PULL_UINT64
14176
14362
  tag =
@@ -14226,64 +14412,11 @@ module Api
14226
14412
  end
14227
14413
  found = false
14228
14414
 
14229
- if tag == 0xa
14415
+ if tag == 0x8
14230
14416
  found = true
14231
- ## PULL_UINT64
14232
- value =
14233
- if (byte0 = buff.getbyte(index)) < 0x80
14234
- index += 1
14235
- byte0
14236
- elsif (byte1 = buff.getbyte(index + 1)) < 0x80
14237
- index += 2
14238
- (byte1 << 7) | (byte0 & 0x7F)
14239
- elsif (byte2 = buff.getbyte(index + 2)) < 0x80
14240
- index += 3
14241
- (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14242
- elsif (byte3 = buff.getbyte(index + 3)) < 0x80
14243
- index += 4
14244
- (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
14245
- (byte0 & 0x7F)
14246
- elsif (byte4 = buff.getbyte(index + 4)) < 0x80
14247
- index += 5
14248
- (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
14249
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14250
- elsif (byte5 = buff.getbyte(index + 5)) < 0x80
14251
- index += 6
14252
- (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
14253
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14254
- elsif (byte6 = buff.getbyte(index + 6)) < 0x80
14255
- index += 7
14256
- (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
14257
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
14258
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14259
- elsif (byte7 = buff.getbyte(index + 7)) < 0x80
14260
- index += 8
14261
- (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
14262
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
14263
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14264
- elsif (byte8 = buff.getbyte(index + 8)) < 0x80
14265
- index += 9
14266
- (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
14267
- ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
14268
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
14269
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14270
- elsif (byte9 = buff.getbyte(index + 9)) < 0x80
14271
- index += 10
14272
-
14273
- (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) |
14274
- ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
14275
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
14276
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14277
- else
14278
- raise "integer decoding error"
14279
- end
14280
-
14281
- ## END PULL_UINT64
14282
-
14283
- goal = index + value
14417
+ ## DECODE REPEATED
14284
14418
  list = @dead_units
14285
14419
  while true
14286
- break if index >= goal
14287
14420
  ## PULL_UINT64
14288
14421
  list << if (byte0 = buff.getbyte(index)) < 0x80
14289
14422
  index += 1
@@ -14334,60 +14467,71 @@ module Api
14334
14467
  end
14335
14468
 
14336
14469
  ## END PULL_UINT64
14337
- end
14338
14470
 
14339
- return self if index >= len
14340
- ## PULL_UINT64
14341
- tag =
14342
- if (byte0 = buff.getbyte(index)) < 0x80
14343
- index += 1
14344
- byte0
14345
- elsif (byte1 = buff.getbyte(index + 1)) < 0x80
14346
- index += 2
14347
- (byte1 << 7) | (byte0 & 0x7F)
14348
- elsif (byte2 = buff.getbyte(index + 2)) < 0x80
14349
- index += 3
14350
- (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14351
- elsif (byte3 = buff.getbyte(index + 3)) < 0x80
14352
- index += 4
14353
- (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
14354
- (byte0 & 0x7F)
14355
- elsif (byte4 = buff.getbyte(index + 4)) < 0x80
14356
- index += 5
14357
- (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
14358
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14359
- elsif (byte5 = buff.getbyte(index + 5)) < 0x80
14360
- index += 6
14361
- (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
14362
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14363
- elsif (byte6 = buff.getbyte(index + 6)) < 0x80
14364
- index += 7
14365
- (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
14366
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
14367
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14368
- elsif (byte7 = buff.getbyte(index + 7)) < 0x80
14369
- index += 8
14370
- (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
14371
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
14372
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14373
- elsif (byte8 = buff.getbyte(index + 8)) < 0x80
14374
- index += 9
14375
- (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
14376
- ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
14377
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
14378
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14379
- elsif (byte9 = buff.getbyte(index + 9)) < 0x80
14380
- index += 10
14471
+ return self if index >= len
14472
+ ## PULL_UINT64
14473
+ tag =
14474
+ if (byte0 = buff.getbyte(index)) < 0x80
14475
+ index += 1
14476
+ byte0
14477
+ elsif (byte1 = buff.getbyte(index + 1)) < 0x80
14478
+ index += 2
14479
+ (byte1 << 7) | (byte0 & 0x7F)
14480
+ elsif (byte2 = buff.getbyte(index + 2)) < 0x80
14481
+ index += 3
14482
+ (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14483
+ elsif (byte3 = buff.getbyte(index + 3)) < 0x80
14484
+ index += 4
14485
+ (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
14486
+ (byte0 & 0x7F)
14487
+ elsif (byte4 = buff.getbyte(index + 4)) < 0x80
14488
+ index += 5
14489
+ (byte4 << 28) | ((byte3 & 0x7F) << 21) |
14490
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
14491
+ (byte0 & 0x7F)
14492
+ elsif (byte5 = buff.getbyte(index + 5)) < 0x80
14493
+ index += 6
14494
+ (byte5 << 35) | ((byte4 & 0x7F) << 28) |
14495
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
14496
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14497
+ elsif (byte6 = buff.getbyte(index + 6)) < 0x80
14498
+ index += 7
14499
+ (byte6 << 42) | ((byte5 & 0x7F) << 35) |
14500
+ ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
14501
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
14502
+ (byte0 & 0x7F)
14503
+ elsif (byte7 = buff.getbyte(index + 7)) < 0x80
14504
+ index += 8
14505
+ (byte7 << 49) | ((byte6 & 0x7F) << 42) |
14506
+ ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
14507
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
14508
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14509
+ elsif (byte8 = buff.getbyte(index + 8)) < 0x80
14510
+ index += 9
14511
+ (byte8 << 56) | ((byte7 & 0x7F) << 49) |
14512
+ ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
14513
+ ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
14514
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
14515
+ (byte0 & 0x7F)
14516
+ elsif (byte9 = buff.getbyte(index + 9)) < 0x80
14517
+ index += 10
14381
14518
 
14382
- (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) |
14383
- ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
14384
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
14385
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14386
- else
14387
- raise "integer decoding error"
14388
- end
14519
+ (byte9 << 63) | ((byte8 & 0x7F) << 56) |
14520
+ ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
14521
+ ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
14522
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
14523
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
14524
+ else
14525
+ raise "integer decoding error"
14526
+ end
14389
14527
 
14390
- ## END PULL_UINT64
14528
+ ## END PULL_UINT64
14529
+
14530
+ break unless tag == 0x8
14531
+ end
14532
+ ## END DECODE REPEATED
14533
+
14534
+ return self if index >= len
14391
14535
  end
14392
14536
 
14393
14537
  return self if index >= len
@@ -14396,18 +14540,11 @@ module Api
14396
14540
  def _encode(buff)
14397
14541
  list = @dead_units
14398
14542
  if list.size > 0
14399
- buff << 0x0a
14400
-
14401
- # Save the buffer size before appending the repeated bytes
14402
- current_len = buff.bytesize
14403
-
14404
- # Write a single dummy byte to later store encoded length
14405
- buff << 42 # "*"
14406
-
14407
- # write each item
14408
14543
  list.each do |item|
14409
14544
  val = item
14410
14545
  if val != 0
14546
+ buff << 0x08
14547
+
14411
14548
  while val != 0
14412
14549
  byte = val & 0x7F
14413
14550
  val >>= 7
@@ -14416,55 +14553,21 @@ module Api
14416
14553
  end
14417
14554
  end
14418
14555
  end
14556
+ end
14557
+ buff << @_unknown_fields if @_unknown_fields
14558
+ buff
14559
+ end
14419
14560
 
14420
- # Calculate the submessage's size
14421
- submessage_size = buff.bytesize - current_len - 1
14422
-
14423
- # Hope the size fits in one byte
14424
- byte = submessage_size & 0x7F
14425
- submessage_size >>= 7
14426
- byte |= 0x80 if submessage_size > 0
14427
- buff.setbyte(current_len, byte)
14428
-
14429
- # If the sub message was bigger
14430
- if submessage_size > 0
14431
- current_len += 1
14432
-
14433
- # compute how much we need to shift
14434
- encoded_int_len = 0
14435
- remaining_size = submessage_size
14436
- while remaining_size != 0
14437
- remaining_size >>= 7
14438
- encoded_int_len += 1
14439
- end
14440
-
14441
- # Make space in the string with dummy bytes
14442
- buff.bytesplice(current_len, 0, "*********", 0, encoded_int_len)
14443
-
14444
- # Overwrite the dummy bytes with the encoded length
14445
- while submessage_size != 0
14446
- byte = submessage_size & 0x7F
14447
- submessage_size >>= 7
14448
- byte |= 0x80 if submessage_size > 0
14449
- buff.setbyte(current_len, byte)
14450
- current_len += 1
14451
- end
14452
- end
14453
- end
14454
-
14455
- buff
14456
- end
14457
-
14458
- def to_h
14459
- result = {}
14460
- result["dead_units".to_sym] = @dead_units
14461
- result
14462
- end
14463
- end
14464
- class Effect
14465
- def self.decode(buff)
14466
- allocate.decode_from(buff.b, 0, buff.bytesize)
14467
- end
14561
+ def to_h
14562
+ result = {}
14563
+ result["dead_units".to_sym] = @dead_units
14564
+ result
14565
+ end
14566
+ end
14567
+ class Effect
14568
+ def self.decode(buff)
14569
+ allocate.decode_from(buff.b, 0, buff.bytesize)
14570
+ end
14468
14571
 
14469
14572
  def self.encode(obj)
14470
14573
  obj._encode("".b)
@@ -14654,20 +14757,38 @@ module Api
14654
14757
  # unexpected, so discard it and continue.
14655
14758
  if !found
14656
14759
  wire_type = tag & 0x7
14760
+
14761
+ unknown_bytes = +"".b
14762
+ val = tag
14763
+ while val != 0
14764
+ byte = val & 0x7F
14765
+
14766
+ val >>= 7
14767
+ # This drops the top bits,
14768
+ # Otherwise, with a signed right shift,
14769
+ # we get infinity one bits at the top
14770
+ val &= (1 << 57) - 1
14771
+
14772
+ byte |= 0x80 if val != 0
14773
+ unknown_bytes << byte
14774
+ end
14775
+
14657
14776
  case wire_type
14658
14777
  when 0
14659
14778
  i = 0
14660
14779
  while true
14661
14780
  newbyte = buff.getbyte(index)
14662
14781
  index += 1
14663
- break if newbyte.nil? || newbyte < 0x80
14782
+ break if newbyte.nil?
14783
+ unknown_bytes << newbyte
14784
+ break if newbyte < 0x80
14664
14785
  i += 1
14665
14786
  break if i > 9
14666
14787
  end
14667
14788
  when 1
14789
+ unknown_bytes << buff.byteslice(index, 8)
14668
14790
  index += 8
14669
14791
  when 2
14670
- ## PULL_BYTES
14671
14792
  value =
14672
14793
  if (byte0 = buff.getbyte(index)) < 0x80
14673
14794
  index += 1
@@ -14723,15 +14844,29 @@ module Api
14723
14844
  raise "integer decoding error"
14724
14845
  end
14725
14846
 
14726
- buff.byteslice(index, value)
14727
- index += value
14847
+ val = value
14848
+ while val != 0
14849
+ byte = val & 0x7F
14850
+
14851
+ val >>= 7
14852
+ # This drops the top bits,
14853
+ # Otherwise, with a signed right shift,
14854
+ # we get infinity one bits at the top
14855
+ val &= (1 << 57) - 1
14856
+
14857
+ byte |= 0x80 if val != 0
14858
+ unknown_bytes << byte
14859
+ end
14728
14860
 
14729
- ## END PULL_BYTES
14861
+ unknown_bytes << buff.byteslice(index, value)
14862
+ index += value
14730
14863
  when 5
14864
+ unknown_bytes << buff.byteslice(index, 4)
14731
14865
  index += 4
14732
14866
  else
14733
14867
  raise "unknown wire type #{wire_type}"
14734
14868
  end
14869
+ (@_unknown_fields ||= +"".b) << unknown_bytes
14735
14870
  return self if index >= len
14736
14871
  ## PULL_UINT64
14737
14872
  tag =
@@ -15441,7 +15576,7 @@ module Api
15441
15576
 
15442
15577
  [val].pack("e", buffer: buff)
15443
15578
  end
15444
-
15579
+ buff << @_unknown_fields if @_unknown_fields
15445
15580
  buff
15446
15581
  end
15447
15582
 
@@ -15585,20 +15720,38 @@ module Api
15585
15720
  # unexpected, so discard it and continue.
15586
15721
  if !found
15587
15722
  wire_type = tag & 0x7
15723
+
15724
+ unknown_bytes = +"".b
15725
+ val = tag
15726
+ while val != 0
15727
+ byte = val & 0x7F
15728
+
15729
+ val >>= 7
15730
+ # This drops the top bits,
15731
+ # Otherwise, with a signed right shift,
15732
+ # we get infinity one bits at the top
15733
+ val &= (1 << 57) - 1
15734
+
15735
+ byte |= 0x80 if val != 0
15736
+ unknown_bytes << byte
15737
+ end
15738
+
15588
15739
  case wire_type
15589
15740
  when 0
15590
15741
  i = 0
15591
15742
  while true
15592
15743
  newbyte = buff.getbyte(index)
15593
15744
  index += 1
15594
- break if newbyte.nil? || newbyte < 0x80
15745
+ break if newbyte.nil?
15746
+ unknown_bytes << newbyte
15747
+ break if newbyte < 0x80
15595
15748
  i += 1
15596
15749
  break if i > 9
15597
15750
  end
15598
15751
  when 1
15752
+ unknown_bytes << buff.byteslice(index, 8)
15599
15753
  index += 8
15600
15754
  when 2
15601
- ## PULL_BYTES
15602
15755
  value =
15603
15756
  if (byte0 = buff.getbyte(index)) < 0x80
15604
15757
  index += 1
@@ -15654,15 +15807,29 @@ module Api
15654
15807
  raise "integer decoding error"
15655
15808
  end
15656
15809
 
15657
- buff.byteslice(index, value)
15658
- index += value
15810
+ val = value
15811
+ while val != 0
15812
+ byte = val & 0x7F
15813
+
15814
+ val >>= 7
15815
+ # This drops the top bits,
15816
+ # Otherwise, with a signed right shift,
15817
+ # we get infinity one bits at the top
15818
+ val &= (1 << 57) - 1
15819
+
15820
+ byte |= 0x80 if val != 0
15821
+ unknown_bytes << byte
15822
+ end
15659
15823
 
15660
- ## END PULL_BYTES
15824
+ unknown_bytes << buff.byteslice(index, value)
15825
+ index += value
15661
15826
  when 5
15827
+ unknown_bytes << buff.byteslice(index, 4)
15662
15828
  index += 4
15663
15829
  else
15664
15830
  raise "unknown wire type #{wire_type}"
15665
15831
  end
15832
+ (@_unknown_fields ||= +"".b) << unknown_bytes
15666
15833
  return self if index >= len
15667
15834
  ## PULL_UINT64
15668
15835
  tag =
@@ -16217,7 +16384,7 @@ module Api
16217
16384
 
16218
16385
  buff
16219
16386
  end
16220
-
16387
+ buff << @_unknown_fields if @_unknown_fields
16221
16388
  buff
16222
16389
  end
16223
16390
 
@@ -16437,20 +16604,38 @@ module Api
16437
16604
  # unexpected, so discard it and continue.
16438
16605
  if !found
16439
16606
  wire_type = tag & 0x7
16607
+
16608
+ unknown_bytes = +"".b
16609
+ val = tag
16610
+ while val != 0
16611
+ byte = val & 0x7F
16612
+
16613
+ val >>= 7
16614
+ # This drops the top bits,
16615
+ # Otherwise, with a signed right shift,
16616
+ # we get infinity one bits at the top
16617
+ val &= (1 << 57) - 1
16618
+
16619
+ byte |= 0x80 if val != 0
16620
+ unknown_bytes << byte
16621
+ end
16622
+
16440
16623
  case wire_type
16441
16624
  when 0
16442
16625
  i = 0
16443
16626
  while true
16444
16627
  newbyte = buff.getbyte(index)
16445
16628
  index += 1
16446
- break if newbyte.nil? || newbyte < 0x80
16629
+ break if newbyte.nil?
16630
+ unknown_bytes << newbyte
16631
+ break if newbyte < 0x80
16447
16632
  i += 1
16448
16633
  break if i > 9
16449
16634
  end
16450
16635
  when 1
16636
+ unknown_bytes << buff.byteslice(index, 8)
16451
16637
  index += 8
16452
16638
  when 2
16453
- ## PULL_BYTES
16454
16639
  value =
16455
16640
  if (byte0 = buff.getbyte(index)) < 0x80
16456
16641
  index += 1
@@ -16506,15 +16691,29 @@ module Api
16506
16691
  raise "integer decoding error"
16507
16692
  end
16508
16693
 
16509
- buff.byteslice(index, value)
16510
- index += value
16694
+ val = value
16695
+ while val != 0
16696
+ byte = val & 0x7F
16697
+
16698
+ val >>= 7
16699
+ # This drops the top bits,
16700
+ # Otherwise, with a signed right shift,
16701
+ # we get infinity one bits at the top
16702
+ val &= (1 << 57) - 1
16703
+
16704
+ byte |= 0x80 if val != 0
16705
+ unknown_bytes << byte
16706
+ end
16511
16707
 
16512
- ## END PULL_BYTES
16708
+ unknown_bytes << buff.byteslice(index, value)
16709
+ index += value
16513
16710
  when 5
16711
+ unknown_bytes << buff.byteslice(index, 4)
16514
16712
  index += 4
16515
16713
  else
16516
16714
  raise "unknown wire type #{wire_type}"
16517
16715
  end
16716
+ (@_unknown_fields ||= +"".b) << unknown_bytes
16518
16717
  return self if index >= len
16519
16718
  ## PULL_UINT64
16520
16719
  tag =
@@ -16911,64 +17110,11 @@ module Api
16911
17110
 
16912
17111
  ## END PULL_UINT64
16913
17112
  end
16914
- if tag == 0x22
17113
+ if tag == 0x20
16915
17114
  found = true
16916
- ## PULL_UINT64
16917
- value =
16918
- if (byte0 = buff.getbyte(index)) < 0x80
16919
- index += 1
16920
- byte0
16921
- elsif (byte1 = buff.getbyte(index + 1)) < 0x80
16922
- index += 2
16923
- (byte1 << 7) | (byte0 & 0x7F)
16924
- elsif (byte2 = buff.getbyte(index + 2)) < 0x80
16925
- index += 3
16926
- (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
16927
- elsif (byte3 = buff.getbyte(index + 3)) < 0x80
16928
- index += 4
16929
- (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
16930
- (byte0 & 0x7F)
16931
- elsif (byte4 = buff.getbyte(index + 4)) < 0x80
16932
- index += 5
16933
- (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
16934
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
16935
- elsif (byte5 = buff.getbyte(index + 5)) < 0x80
16936
- index += 6
16937
- (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
16938
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
16939
- elsif (byte6 = buff.getbyte(index + 6)) < 0x80
16940
- index += 7
16941
- (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
16942
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
16943
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
16944
- elsif (byte7 = buff.getbyte(index + 7)) < 0x80
16945
- index += 8
16946
- (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
16947
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
16948
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
16949
- elsif (byte8 = buff.getbyte(index + 8)) < 0x80
16950
- index += 9
16951
- (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
16952
- ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
16953
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
16954
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
16955
- elsif (byte9 = buff.getbyte(index + 9)) < 0x80
16956
- index += 10
16957
-
16958
- (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) |
16959
- ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
16960
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
16961
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
16962
- else
16963
- raise "integer decoding error"
16964
- end
16965
-
16966
- ## END PULL_UINT64
16967
-
16968
- goal = index + value
17115
+ ## DECODE REPEATED
16969
17116
  list = @unit_tags
16970
17117
  while true
16971
- break if index >= goal
16972
17118
  ## PULL_UINT64
16973
17119
  list << if (byte0 = buff.getbyte(index)) < 0x80
16974
17120
  index += 1
@@ -17019,60 +17165,71 @@ module Api
17019
17165
  end
17020
17166
 
17021
17167
  ## END PULL_UINT64
17022
- end
17023
17168
 
17024
- return self if index >= len
17025
- ## PULL_UINT64
17026
- tag =
17027
- if (byte0 = buff.getbyte(index)) < 0x80
17028
- index += 1
17029
- byte0
17030
- elsif (byte1 = buff.getbyte(index + 1)) < 0x80
17031
- index += 2
17032
- (byte1 << 7) | (byte0 & 0x7F)
17033
- elsif (byte2 = buff.getbyte(index + 2)) < 0x80
17034
- index += 3
17035
- (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
17036
- elsif (byte3 = buff.getbyte(index + 3)) < 0x80
17037
- index += 4
17038
- (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
17039
- (byte0 & 0x7F)
17040
- elsif (byte4 = buff.getbyte(index + 4)) < 0x80
17041
- index += 5
17042
- (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
17043
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
17044
- elsif (byte5 = buff.getbyte(index + 5)) < 0x80
17045
- index += 6
17046
- (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
17047
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
17048
- elsif (byte6 = buff.getbyte(index + 6)) < 0x80
17049
- index += 7
17050
- (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
17051
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
17052
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
17053
- elsif (byte7 = buff.getbyte(index + 7)) < 0x80
17054
- index += 8
17055
- (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
17056
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
17057
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
17058
- elsif (byte8 = buff.getbyte(index + 8)) < 0x80
17059
- index += 9
17060
- (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
17061
- ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
17062
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
17063
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
17064
- elsif (byte9 = buff.getbyte(index + 9)) < 0x80
17065
- index += 10
17169
+ return self if index >= len
17170
+ ## PULL_UINT64
17171
+ tag =
17172
+ if (byte0 = buff.getbyte(index)) < 0x80
17173
+ index += 1
17174
+ byte0
17175
+ elsif (byte1 = buff.getbyte(index + 1)) < 0x80
17176
+ index += 2
17177
+ (byte1 << 7) | (byte0 & 0x7F)
17178
+ elsif (byte2 = buff.getbyte(index + 2)) < 0x80
17179
+ index += 3
17180
+ (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
17181
+ elsif (byte3 = buff.getbyte(index + 3)) < 0x80
17182
+ index += 4
17183
+ (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
17184
+ (byte0 & 0x7F)
17185
+ elsif (byte4 = buff.getbyte(index + 4)) < 0x80
17186
+ index += 5
17187
+ (byte4 << 28) | ((byte3 & 0x7F) << 21) |
17188
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
17189
+ (byte0 & 0x7F)
17190
+ elsif (byte5 = buff.getbyte(index + 5)) < 0x80
17191
+ index += 6
17192
+ (byte5 << 35) | ((byte4 & 0x7F) << 28) |
17193
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
17194
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
17195
+ elsif (byte6 = buff.getbyte(index + 6)) < 0x80
17196
+ index += 7
17197
+ (byte6 << 42) | ((byte5 & 0x7F) << 35) |
17198
+ ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
17199
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
17200
+ (byte0 & 0x7F)
17201
+ elsif (byte7 = buff.getbyte(index + 7)) < 0x80
17202
+ index += 8
17203
+ (byte7 << 49) | ((byte6 & 0x7F) << 42) |
17204
+ ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
17205
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
17206
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
17207
+ elsif (byte8 = buff.getbyte(index + 8)) < 0x80
17208
+ index += 9
17209
+ (byte8 << 56) | ((byte7 & 0x7F) << 49) |
17210
+ ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
17211
+ ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
17212
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
17213
+ (byte0 & 0x7F)
17214
+ elsif (byte9 = buff.getbyte(index + 9)) < 0x80
17215
+ index += 10
17066
17216
 
17067
- (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) |
17068
- ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
17069
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
17070
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
17071
- else
17072
- raise "integer decoding error"
17073
- end
17217
+ (byte9 << 63) | ((byte8 & 0x7F) << 56) |
17218
+ ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
17219
+ ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
17220
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
17221
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
17222
+ else
17223
+ raise "integer decoding error"
17224
+ end
17074
17225
 
17075
- ## END PULL_UINT64
17226
+ ## END PULL_UINT64
17227
+
17228
+ break unless tag == 0x20
17229
+ end
17230
+ ## END DECODE REPEATED
17231
+
17232
+ return self if index >= len
17076
17233
  end
17077
17234
  if tag == 0x28
17078
17235
  found = true
@@ -17220,18 +17377,11 @@ module Api
17220
17377
 
17221
17378
  list = @unit_tags
17222
17379
  if list.size > 0
17223
- buff << 0x22
17224
-
17225
- # Save the buffer size before appending the repeated bytes
17226
- current_len = buff.bytesize
17227
-
17228
- # Write a single dummy byte to later store encoded length
17229
- buff << 42 # "*"
17230
-
17231
- # write each item
17232
17380
  list.each do |item|
17233
17381
  val = item
17234
17382
  if val != 0
17383
+ buff << 0x20
17384
+
17235
17385
  while val != 0
17236
17386
  byte = val & 0x7F
17237
17387
  val >>= 7
@@ -17240,40 +17390,6 @@ module Api
17240
17390
  end
17241
17391
  end
17242
17392
  end
17243
-
17244
- # Calculate the submessage's size
17245
- submessage_size = buff.bytesize - current_len - 1
17246
-
17247
- # Hope the size fits in one byte
17248
- byte = submessage_size & 0x7F
17249
- submessage_size >>= 7
17250
- byte |= 0x80 if submessage_size > 0
17251
- buff.setbyte(current_len, byte)
17252
-
17253
- # If the sub message was bigger
17254
- if submessage_size > 0
17255
- current_len += 1
17256
-
17257
- # compute how much we need to shift
17258
- encoded_int_len = 0
17259
- remaining_size = submessage_size
17260
- while remaining_size != 0
17261
- remaining_size >>= 7
17262
- encoded_int_len += 1
17263
- end
17264
-
17265
- # Make space in the string with dummy bytes
17266
- buff.bytesplice(current_len, 0, "*********", 0, encoded_int_len)
17267
-
17268
- # Overwrite the dummy bytes with the encoded length
17269
- while submessage_size != 0
17270
- byte = submessage_size & 0x7F
17271
- submessage_size >>= 7
17272
- byte |= 0x80 if submessage_size > 0
17273
- buff.setbyte(current_len, byte)
17274
- current_len += 1
17275
- end
17276
- end
17277
17393
  end
17278
17394
 
17279
17395
  val = @queue_command
@@ -17286,7 +17402,7 @@ module Api
17286
17402
  else
17287
17403
  raise "bool values should be true or false"
17288
17404
  end
17289
-
17405
+ buff << @_unknown_fields if @_unknown_fields
17290
17406
  buff
17291
17407
  end
17292
17408
 
@@ -17404,20 +17520,38 @@ module Api
17404
17520
  # unexpected, so discard it and continue.
17405
17521
  if !found
17406
17522
  wire_type = tag & 0x7
17523
+
17524
+ unknown_bytes = +"".b
17525
+ val = tag
17526
+ while val != 0
17527
+ byte = val & 0x7F
17528
+
17529
+ val >>= 7
17530
+ # This drops the top bits,
17531
+ # Otherwise, with a signed right shift,
17532
+ # we get infinity one bits at the top
17533
+ val &= (1 << 57) - 1
17534
+
17535
+ byte |= 0x80 if val != 0
17536
+ unknown_bytes << byte
17537
+ end
17538
+
17407
17539
  case wire_type
17408
17540
  when 0
17409
17541
  i = 0
17410
17542
  while true
17411
17543
  newbyte = buff.getbyte(index)
17412
17544
  index += 1
17413
- break if newbyte.nil? || newbyte < 0x80
17545
+ break if newbyte.nil?
17546
+ unknown_bytes << newbyte
17547
+ break if newbyte < 0x80
17414
17548
  i += 1
17415
17549
  break if i > 9
17416
17550
  end
17417
17551
  when 1
17552
+ unknown_bytes << buff.byteslice(index, 8)
17418
17553
  index += 8
17419
17554
  when 2
17420
- ## PULL_BYTES
17421
17555
  value =
17422
17556
  if (byte0 = buff.getbyte(index)) < 0x80
17423
17557
  index += 1
@@ -17473,15 +17607,29 @@ module Api
17473
17607
  raise "integer decoding error"
17474
17608
  end
17475
17609
 
17476
- buff.byteslice(index, value)
17477
- index += value
17610
+ val = value
17611
+ while val != 0
17612
+ byte = val & 0x7F
17478
17613
 
17479
- ## END PULL_BYTES
17614
+ val >>= 7
17615
+ # This drops the top bits,
17616
+ # Otherwise, with a signed right shift,
17617
+ # we get infinity one bits at the top
17618
+ val &= (1 << 57) - 1
17619
+
17620
+ byte |= 0x80 if val != 0
17621
+ unknown_bytes << byte
17622
+ end
17623
+
17624
+ unknown_bytes << buff.byteslice(index, value)
17625
+ index += value
17480
17626
  when 5
17627
+ unknown_bytes << buff.byteslice(index, 4)
17481
17628
  index += 4
17482
17629
  else
17483
17630
  raise "unknown wire type #{wire_type}"
17484
17631
  end
17632
+ (@_unknown_fields ||= +"".b) << unknown_bytes
17485
17633
  return self if index >= len
17486
17634
  ## PULL_UINT64
17487
17635
  tag =
@@ -17702,7 +17850,7 @@ module Api
17702
17850
 
17703
17851
  buff
17704
17852
  end
17705
-
17853
+ buff << @_unknown_fields if @_unknown_fields
17706
17854
  buff
17707
17855
  end
17708
17856
 
@@ -17848,20 +17996,38 @@ module Api
17848
17996
  # unexpected, so discard it and continue.
17849
17997
  if !found
17850
17998
  wire_type = tag & 0x7
17999
+
18000
+ unknown_bytes = +"".b
18001
+ val = tag
18002
+ while val != 0
18003
+ byte = val & 0x7F
18004
+
18005
+ val >>= 7
18006
+ # This drops the top bits,
18007
+ # Otherwise, with a signed right shift,
18008
+ # we get infinity one bits at the top
18009
+ val &= (1 << 57) - 1
18010
+
18011
+ byte |= 0x80 if val != 0
18012
+ unknown_bytes << byte
18013
+ end
18014
+
17851
18015
  case wire_type
17852
18016
  when 0
17853
18017
  i = 0
17854
18018
  while true
17855
18019
  newbyte = buff.getbyte(index)
17856
18020
  index += 1
17857
- break if newbyte.nil? || newbyte < 0x80
18021
+ break if newbyte.nil?
18022
+ unknown_bytes << newbyte
18023
+ break if newbyte < 0x80
17858
18024
  i += 1
17859
18025
  break if i > 9
17860
18026
  end
17861
18027
  when 1
18028
+ unknown_bytes << buff.byteslice(index, 8)
17862
18029
  index += 8
17863
18030
  when 2
17864
- ## PULL_BYTES
17865
18031
  value =
17866
18032
  if (byte0 = buff.getbyte(index)) < 0x80
17867
18033
  index += 1
@@ -17917,15 +18083,29 @@ module Api
17917
18083
  raise "integer decoding error"
17918
18084
  end
17919
18085
 
17920
- buff.byteslice(index, value)
17921
- index += value
18086
+ val = value
18087
+ while val != 0
18088
+ byte = val & 0x7F
18089
+
18090
+ val >>= 7
18091
+ # This drops the top bits,
18092
+ # Otherwise, with a signed right shift,
18093
+ # we get infinity one bits at the top
18094
+ val &= (1 << 57) - 1
17922
18095
 
17923
- ## END PULL_BYTES
18096
+ byte |= 0x80 if val != 0
18097
+ unknown_bytes << byte
18098
+ end
18099
+
18100
+ unknown_bytes << buff.byteslice(index, value)
18101
+ index += value
17924
18102
  when 5
18103
+ unknown_bytes << buff.byteslice(index, 4)
17925
18104
  index += 4
17926
18105
  else
17927
18106
  raise "unknown wire type #{wire_type}"
17928
18107
  end
18108
+ (@_unknown_fields ||= +"".b) << unknown_bytes
17929
18109
  return self if index >= len
17930
18110
  ## PULL_UINT64
17931
18111
  tag =
@@ -18101,64 +18281,11 @@ module Api
18101
18281
 
18102
18282
  ## END PULL_UINT64
18103
18283
  end
18104
- if tag == 0x12
18284
+ if tag == 0x10
18105
18285
  found = true
18106
- ## PULL_UINT64
18107
- value =
18108
- if (byte0 = buff.getbyte(index)) < 0x80
18109
- index += 1
18110
- byte0
18111
- elsif (byte1 = buff.getbyte(index + 1)) < 0x80
18112
- index += 2
18113
- (byte1 << 7) | (byte0 & 0x7F)
18114
- elsif (byte2 = buff.getbyte(index + 2)) < 0x80
18115
- index += 3
18116
- (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18117
- elsif (byte3 = buff.getbyte(index + 3)) < 0x80
18118
- index += 4
18119
- (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
18120
- (byte0 & 0x7F)
18121
- elsif (byte4 = buff.getbyte(index + 4)) < 0x80
18122
- index += 5
18123
- (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
18124
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18125
- elsif (byte5 = buff.getbyte(index + 5)) < 0x80
18126
- index += 6
18127
- (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
18128
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18129
- elsif (byte6 = buff.getbyte(index + 6)) < 0x80
18130
- index += 7
18131
- (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
18132
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
18133
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18134
- elsif (byte7 = buff.getbyte(index + 7)) < 0x80
18135
- index += 8
18136
- (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
18137
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
18138
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18139
- elsif (byte8 = buff.getbyte(index + 8)) < 0x80
18140
- index += 9
18141
- (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
18142
- ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
18143
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
18144
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18145
- elsif (byte9 = buff.getbyte(index + 9)) < 0x80
18146
- index += 10
18147
-
18148
- (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) |
18149
- ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
18150
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
18151
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18152
- else
18153
- raise "integer decoding error"
18154
- end
18155
-
18156
- ## END PULL_UINT64
18157
-
18158
- goal = index + value
18286
+ ## DECODE REPEATED
18159
18287
  list = @unit_tags
18160
18288
  while true
18161
- break if index >= goal
18162
18289
  ## PULL_UINT64
18163
18290
  list << if (byte0 = buff.getbyte(index)) < 0x80
18164
18291
  index += 1
@@ -18209,60 +18336,71 @@ module Api
18209
18336
  end
18210
18337
 
18211
18338
  ## END PULL_UINT64
18212
- end
18213
18339
 
18214
- return self if index >= len
18215
- ## PULL_UINT64
18216
- tag =
18217
- if (byte0 = buff.getbyte(index)) < 0x80
18218
- index += 1
18219
- byte0
18220
- elsif (byte1 = buff.getbyte(index + 1)) < 0x80
18221
- index += 2
18222
- (byte1 << 7) | (byte0 & 0x7F)
18223
- elsif (byte2 = buff.getbyte(index + 2)) < 0x80
18224
- index += 3
18225
- (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18226
- elsif (byte3 = buff.getbyte(index + 3)) < 0x80
18227
- index += 4
18228
- (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
18229
- (byte0 & 0x7F)
18230
- elsif (byte4 = buff.getbyte(index + 4)) < 0x80
18231
- index += 5
18232
- (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
18233
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18234
- elsif (byte5 = buff.getbyte(index + 5)) < 0x80
18235
- index += 6
18236
- (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
18237
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18238
- elsif (byte6 = buff.getbyte(index + 6)) < 0x80
18239
- index += 7
18240
- (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
18241
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
18242
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18243
- elsif (byte7 = buff.getbyte(index + 7)) < 0x80
18244
- index += 8
18245
- (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
18246
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
18247
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18248
- elsif (byte8 = buff.getbyte(index + 8)) < 0x80
18249
- index += 9
18250
- (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
18251
- ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
18252
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
18253
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18254
- elsif (byte9 = buff.getbyte(index + 9)) < 0x80
18255
- index += 10
18340
+ return self if index >= len
18341
+ ## PULL_UINT64
18342
+ tag =
18343
+ if (byte0 = buff.getbyte(index)) < 0x80
18344
+ index += 1
18345
+ byte0
18346
+ elsif (byte1 = buff.getbyte(index + 1)) < 0x80
18347
+ index += 2
18348
+ (byte1 << 7) | (byte0 & 0x7F)
18349
+ elsif (byte2 = buff.getbyte(index + 2)) < 0x80
18350
+ index += 3
18351
+ (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18352
+ elsif (byte3 = buff.getbyte(index + 3)) < 0x80
18353
+ index += 4
18354
+ (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
18355
+ (byte0 & 0x7F)
18356
+ elsif (byte4 = buff.getbyte(index + 4)) < 0x80
18357
+ index += 5
18358
+ (byte4 << 28) | ((byte3 & 0x7F) << 21) |
18359
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
18360
+ (byte0 & 0x7F)
18361
+ elsif (byte5 = buff.getbyte(index + 5)) < 0x80
18362
+ index += 6
18363
+ (byte5 << 35) | ((byte4 & 0x7F) << 28) |
18364
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
18365
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18366
+ elsif (byte6 = buff.getbyte(index + 6)) < 0x80
18367
+ index += 7
18368
+ (byte6 << 42) | ((byte5 & 0x7F) << 35) |
18369
+ ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
18370
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
18371
+ (byte0 & 0x7F)
18372
+ elsif (byte7 = buff.getbyte(index + 7)) < 0x80
18373
+ index += 8
18374
+ (byte7 << 49) | ((byte6 & 0x7F) << 42) |
18375
+ ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
18376
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
18377
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18378
+ elsif (byte8 = buff.getbyte(index + 8)) < 0x80
18379
+ index += 9
18380
+ (byte8 << 56) | ((byte7 & 0x7F) << 49) |
18381
+ ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
18382
+ ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
18383
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
18384
+ (byte0 & 0x7F)
18385
+ elsif (byte9 = buff.getbyte(index + 9)) < 0x80
18386
+ index += 10
18256
18387
 
18257
- (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) |
18258
- ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
18259
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
18260
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18261
- else
18262
- raise "integer decoding error"
18263
- end
18388
+ (byte9 << 63) | ((byte8 & 0x7F) << 56) |
18389
+ ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
18390
+ ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
18391
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
18392
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
18393
+ else
18394
+ raise "integer decoding error"
18395
+ end
18264
18396
 
18265
- ## END PULL_UINT64
18397
+ ## END PULL_UINT64
18398
+
18399
+ break unless tag == 0x10
18400
+ end
18401
+ ## END DECODE REPEATED
18402
+
18403
+ return self if index >= len
18266
18404
  end
18267
18405
 
18268
18406
  return self if index >= len
@@ -18289,18 +18427,11 @@ module Api
18289
18427
 
18290
18428
  list = @unit_tags
18291
18429
  if list.size > 0
18292
- buff << 0x12
18293
-
18294
- # Save the buffer size before appending the repeated bytes
18295
- current_len = buff.bytesize
18296
-
18297
- # Write a single dummy byte to later store encoded length
18298
- buff << 42 # "*"
18299
-
18300
- # write each item
18301
18430
  list.each do |item|
18302
18431
  val = item
18303
18432
  if val != 0
18433
+ buff << 0x10
18434
+
18304
18435
  while val != 0
18305
18436
  byte = val & 0x7F
18306
18437
  val >>= 7
@@ -18309,42 +18440,8 @@ module Api
18309
18440
  end
18310
18441
  end
18311
18442
  end
18312
-
18313
- # Calculate the submessage's size
18314
- submessage_size = buff.bytesize - current_len - 1
18315
-
18316
- # Hope the size fits in one byte
18317
- byte = submessage_size & 0x7F
18318
- submessage_size >>= 7
18319
- byte |= 0x80 if submessage_size > 0
18320
- buff.setbyte(current_len, byte)
18321
-
18322
- # If the sub message was bigger
18323
- if submessage_size > 0
18324
- current_len += 1
18325
-
18326
- # compute how much we need to shift
18327
- encoded_int_len = 0
18328
- remaining_size = submessage_size
18329
- while remaining_size != 0
18330
- remaining_size >>= 7
18331
- encoded_int_len += 1
18332
- end
18333
-
18334
- # Make space in the string with dummy bytes
18335
- buff.bytesplice(current_len, 0, "*********", 0, encoded_int_len)
18336
-
18337
- # Overwrite the dummy bytes with the encoded length
18338
- while submessage_size != 0
18339
- byte = submessage_size & 0x7F
18340
- submessage_size >>= 7
18341
- byte |= 0x80 if submessage_size > 0
18342
- buff.setbyte(current_len, byte)
18343
- current_len += 1
18344
- end
18345
- end
18346
18443
  end
18347
-
18444
+ buff << @_unknown_fields if @_unknown_fields
18348
18445
  buff
18349
18446
  end
18350
18447