sc2ai 0.4.1 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -293,20 +293,38 @@ module Api
293
293
  # unexpected, so discard it and continue.
294
294
  if !found
295
295
  wire_type = tag & 0x7
296
+
297
+ unknown_bytes = +"".b
298
+ val = tag
299
+ while val != 0
300
+ byte = val & 0x7F
301
+
302
+ val >>= 7
303
+ # This drops the top bits,
304
+ # Otherwise, with a signed right shift,
305
+ # we get infinity one bits at the top
306
+ val &= (1 << 57) - 1
307
+
308
+ byte |= 0x80 if val != 0
309
+ unknown_bytes << byte
310
+ end
311
+
296
312
  case wire_type
297
313
  when 0
298
314
  i = 0
299
315
  while true
300
316
  newbyte = buff.getbyte(index)
301
317
  index += 1
302
- break if newbyte.nil? || newbyte < 0x80
318
+ break if newbyte.nil?
319
+ unknown_bytes << newbyte
320
+ break if newbyte < 0x80
303
321
  i += 1
304
322
  break if i > 9
305
323
  end
306
324
  when 1
325
+ unknown_bytes << buff.byteslice(index, 8)
307
326
  index += 8
308
327
  when 2
309
- ## PULL_BYTES
310
328
  value =
311
329
  if (byte0 = buff.getbyte(index)) < 0x80
312
330
  index += 1
@@ -362,15 +380,29 @@ module Api
362
380
  raise "integer decoding error"
363
381
  end
364
382
 
365
- buff.byteslice(index, value)
366
- index += value
383
+ val = value
384
+ while val != 0
385
+ byte = val & 0x7F
386
+
387
+ val >>= 7
388
+ # This drops the top bits,
389
+ # Otherwise, with a signed right shift,
390
+ # we get infinity one bits at the top
391
+ val &= (1 << 57) - 1
367
392
 
368
- ## END PULL_BYTES
393
+ byte |= 0x80 if val != 0
394
+ unknown_bytes << byte
395
+ end
396
+
397
+ unknown_bytes << buff.byteslice(index, value)
398
+ index += value
369
399
  when 5
400
+ unknown_bytes << buff.byteslice(index, 4)
370
401
  index += 4
371
402
  else
372
403
  raise "unknown wire type #{wire_type}"
373
404
  end
405
+ (@_unknown_fields ||= +"".b) << unknown_bytes
374
406
  return self if index >= len
375
407
  ## PULL_UINT64
376
408
  tag =
@@ -1719,7 +1751,7 @@ module Api
1719
1751
 
1720
1752
  buff
1721
1753
  end
1722
-
1754
+ buff << @_unknown_fields if @_unknown_fields
1723
1755
  buff
1724
1756
  end
1725
1757
 
@@ -1842,20 +1874,38 @@ module Api
1842
1874
  # unexpected, so discard it and continue.
1843
1875
  if !found
1844
1876
  wire_type = tag & 0x7
1877
+
1878
+ unknown_bytes = +"".b
1879
+ val = tag
1880
+ while val != 0
1881
+ byte = val & 0x7F
1882
+
1883
+ val >>= 7
1884
+ # This drops the top bits,
1885
+ # Otherwise, with a signed right shift,
1886
+ # we get infinity one bits at the top
1887
+ val &= (1 << 57) - 1
1888
+
1889
+ byte |= 0x80 if val != 0
1890
+ unknown_bytes << byte
1891
+ end
1892
+
1845
1893
  case wire_type
1846
1894
  when 0
1847
1895
  i = 0
1848
1896
  while true
1849
1897
  newbyte = buff.getbyte(index)
1850
1898
  index += 1
1851
- break if newbyte.nil? || newbyte < 0x80
1899
+ break if newbyte.nil?
1900
+ unknown_bytes << newbyte
1901
+ break if newbyte < 0x80
1852
1902
  i += 1
1853
1903
  break if i > 9
1854
1904
  end
1855
1905
  when 1
1906
+ unknown_bytes << buff.byteslice(index, 8)
1856
1907
  index += 8
1857
1908
  when 2
1858
- ## PULL_BYTES
1859
1909
  value =
1860
1910
  if (byte0 = buff.getbyte(index)) < 0x80
1861
1911
  index += 1
@@ -1911,15 +1961,29 @@ module Api
1911
1961
  raise "integer decoding error"
1912
1962
  end
1913
1963
 
1914
- buff.byteslice(index, value)
1915
- index += value
1964
+ val = value
1965
+ while val != 0
1966
+ byte = val & 0x7F
1967
+
1968
+ val >>= 7
1969
+ # This drops the top bits,
1970
+ # Otherwise, with a signed right shift,
1971
+ # we get infinity one bits at the top
1972
+ val &= (1 << 57) - 1
1973
+
1974
+ byte |= 0x80 if val != 0
1975
+ unknown_bytes << byte
1976
+ end
1916
1977
 
1917
- ## END PULL_BYTES
1978
+ unknown_bytes << buff.byteslice(index, value)
1979
+ index += value
1918
1980
  when 5
1981
+ unknown_bytes << buff.byteslice(index, 4)
1919
1982
  index += 4
1920
1983
  else
1921
1984
  raise "unknown wire type #{wire_type}"
1922
1985
  end
1986
+ (@_unknown_fields ||= +"".b) << unknown_bytes
1923
1987
  return self if index >= len
1924
1988
  ## PULL_UINT64
1925
1989
  tag =
@@ -2735,7 +2799,7 @@ module Api
2735
2799
  end
2736
2800
  end
2737
2801
  end
2738
-
2802
+ buff << @_unknown_fields if @_unknown_fields
2739
2803
  buff
2740
2804
  end
2741
2805
 
@@ -2872,20 +2936,38 @@ module Api
2872
2936
  # unexpected, so discard it and continue.
2873
2937
  if !found
2874
2938
  wire_type = tag & 0x7
2939
+
2940
+ unknown_bytes = +"".b
2941
+ val = tag
2942
+ while val != 0
2943
+ byte = val & 0x7F
2944
+
2945
+ val >>= 7
2946
+ # This drops the top bits,
2947
+ # Otherwise, with a signed right shift,
2948
+ # we get infinity one bits at the top
2949
+ val &= (1 << 57) - 1
2950
+
2951
+ byte |= 0x80 if val != 0
2952
+ unknown_bytes << byte
2953
+ end
2954
+
2875
2955
  case wire_type
2876
2956
  when 0
2877
2957
  i = 0
2878
2958
  while true
2879
2959
  newbyte = buff.getbyte(index)
2880
2960
  index += 1
2881
- break if newbyte.nil? || newbyte < 0x80
2961
+ break if newbyte.nil?
2962
+ unknown_bytes << newbyte
2963
+ break if newbyte < 0x80
2882
2964
  i += 1
2883
2965
  break if i > 9
2884
2966
  end
2885
2967
  when 1
2968
+ unknown_bytes << buff.byteslice(index, 8)
2886
2969
  index += 8
2887
2970
  when 2
2888
- ## PULL_BYTES
2889
2971
  value =
2890
2972
  if (byte0 = buff.getbyte(index)) < 0x80
2891
2973
  index += 1
@@ -2941,15 +3023,29 @@ module Api
2941
3023
  raise "integer decoding error"
2942
3024
  end
2943
3025
 
2944
- buff.byteslice(index, value)
2945
- index += value
3026
+ val = value
3027
+ while val != 0
3028
+ byte = val & 0x7F
2946
3029
 
2947
- ## END PULL_BYTES
3030
+ val >>= 7
3031
+ # This drops the top bits,
3032
+ # Otherwise, with a signed right shift,
3033
+ # we get infinity one bits at the top
3034
+ val &= (1 << 57) - 1
3035
+
3036
+ byte |= 0x80 if val != 0
3037
+ unknown_bytes << byte
3038
+ end
3039
+
3040
+ unknown_bytes << buff.byteslice(index, value)
3041
+ index += value
2948
3042
  when 5
3043
+ unknown_bytes << buff.byteslice(index, 4)
2949
3044
  index += 4
2950
3045
  else
2951
3046
  raise "unknown wire type #{wire_type}"
2952
3047
  end
3048
+ (@_unknown_fields ||= +"".b) << unknown_bytes
2953
3049
  return self if index >= len
2954
3050
  ## PULL_UINT64
2955
3051
  tag =
@@ -3329,7 +3425,7 @@ module Api
3329
3425
 
3330
3426
  buff
3331
3427
  end
3332
-
3428
+ buff << @_unknown_fields if @_unknown_fields
3333
3429
  buff
3334
3430
  end
3335
3431
 
@@ -3510,20 +3606,38 @@ module Api
3510
3606
  # unexpected, so discard it and continue.
3511
3607
  if !found
3512
3608
  wire_type = tag & 0x7
3609
+
3610
+ unknown_bytes = +"".b
3611
+ val = tag
3612
+ while val != 0
3613
+ byte = val & 0x7F
3614
+
3615
+ val >>= 7
3616
+ # This drops the top bits,
3617
+ # Otherwise, with a signed right shift,
3618
+ # we get infinity one bits at the top
3619
+ val &= (1 << 57) - 1
3620
+
3621
+ byte |= 0x80 if val != 0
3622
+ unknown_bytes << byte
3623
+ end
3624
+
3513
3625
  case wire_type
3514
3626
  when 0
3515
3627
  i = 0
3516
3628
  while true
3517
3629
  newbyte = buff.getbyte(index)
3518
3630
  index += 1
3519
- break if newbyte.nil? || newbyte < 0x80
3631
+ break if newbyte.nil?
3632
+ unknown_bytes << newbyte
3633
+ break if newbyte < 0x80
3520
3634
  i += 1
3521
3635
  break if i > 9
3522
3636
  end
3523
3637
  when 1
3638
+ unknown_bytes << buff.byteslice(index, 8)
3524
3639
  index += 8
3525
3640
  when 2
3526
- ## PULL_BYTES
3527
3641
  value =
3528
3642
  if (byte0 = buff.getbyte(index)) < 0x80
3529
3643
  index += 1
@@ -3579,15 +3693,29 @@ module Api
3579
3693
  raise "integer decoding error"
3580
3694
  end
3581
3695
 
3582
- buff.byteslice(index, value)
3583
- index += value
3696
+ val = value
3697
+ while val != 0
3698
+ byte = val & 0x7F
3699
+
3700
+ val >>= 7
3701
+ # This drops the top bits,
3702
+ # Otherwise, with a signed right shift,
3703
+ # we get infinity one bits at the top
3704
+ val &= (1 << 57) - 1
3705
+
3706
+ byte |= 0x80 if val != 0
3707
+ unknown_bytes << byte
3708
+ end
3584
3709
 
3585
- ## END PULL_BYTES
3710
+ unknown_bytes << buff.byteslice(index, value)
3711
+ index += value
3586
3712
  when 5
3713
+ unknown_bytes << buff.byteslice(index, 4)
3587
3714
  index += 4
3588
3715
  else
3589
3716
  raise "unknown wire type #{wire_type}"
3590
3717
  end
3718
+ (@_unknown_fields ||= +"".b) << unknown_bytes
3591
3719
  return self if index >= len
3592
3720
  ## PULL_UINT64
3593
3721
  tag =
@@ -4007,7 +4135,7 @@ module Api
4007
4135
  buff << byte
4008
4136
  end
4009
4137
  end
4010
-
4138
+ buff << @_unknown_fields if @_unknown_fields
4011
4139
  buff
4012
4140
  end
4013
4141
 
@@ -4215,20 +4343,38 @@ module Api
4215
4343
  # unexpected, so discard it and continue.
4216
4344
  if !found
4217
4345
  wire_type = tag & 0x7
4346
+
4347
+ unknown_bytes = +"".b
4348
+ val = tag
4349
+ while val != 0
4350
+ byte = val & 0x7F
4351
+
4352
+ val >>= 7
4353
+ # This drops the top bits,
4354
+ # Otherwise, with a signed right shift,
4355
+ # we get infinity one bits at the top
4356
+ val &= (1 << 57) - 1
4357
+
4358
+ byte |= 0x80 if val != 0
4359
+ unknown_bytes << byte
4360
+ end
4361
+
4218
4362
  case wire_type
4219
4363
  when 0
4220
4364
  i = 0
4221
4365
  while true
4222
4366
  newbyte = buff.getbyte(index)
4223
4367
  index += 1
4224
- break if newbyte.nil? || newbyte < 0x80
4368
+ break if newbyte.nil?
4369
+ unknown_bytes << newbyte
4370
+ break if newbyte < 0x80
4225
4371
  i += 1
4226
4372
  break if i > 9
4227
4373
  end
4228
4374
  when 1
4375
+ unknown_bytes << buff.byteslice(index, 8)
4229
4376
  index += 8
4230
4377
  when 2
4231
- ## PULL_BYTES
4232
4378
  value =
4233
4379
  if (byte0 = buff.getbyte(index)) < 0x80
4234
4380
  index += 1
@@ -4284,15 +4430,29 @@ module Api
4284
4430
  raise "integer decoding error"
4285
4431
  end
4286
4432
 
4287
- buff.byteslice(index, value)
4288
- index += value
4433
+ val = value
4434
+ while val != 0
4435
+ byte = val & 0x7F
4289
4436
 
4290
- ## END PULL_BYTES
4437
+ val >>= 7
4438
+ # This drops the top bits,
4439
+ # Otherwise, with a signed right shift,
4440
+ # we get infinity one bits at the top
4441
+ val &= (1 << 57) - 1
4442
+
4443
+ byte |= 0x80 if val != 0
4444
+ unknown_bytes << byte
4445
+ end
4446
+
4447
+ unknown_bytes << buff.byteslice(index, value)
4448
+ index += value
4291
4449
  when 5
4450
+ unknown_bytes << buff.byteslice(index, 4)
4292
4451
  index += 4
4293
4452
  else
4294
4453
  raise "unknown wire type #{wire_type}"
4295
4454
  end
4455
+ (@_unknown_fields ||= +"".b) << unknown_bytes
4296
4456
  return self if index >= len
4297
4457
  ## PULL_UINT64
4298
4458
  tag =
@@ -5079,7 +5239,7 @@ module Api
5079
5239
  buff << byte
5080
5240
  end
5081
5241
  end
5082
-
5242
+ buff << @_unknown_fields if @_unknown_fields
5083
5243
  buff
5084
5244
  end
5085
5245
 
@@ -5217,20 +5377,38 @@ module Api
5217
5377
  # unexpected, so discard it and continue.
5218
5378
  if !found
5219
5379
  wire_type = tag & 0x7
5380
+
5381
+ unknown_bytes = +"".b
5382
+ val = tag
5383
+ while val != 0
5384
+ byte = val & 0x7F
5385
+
5386
+ val >>= 7
5387
+ # This drops the top bits,
5388
+ # Otherwise, with a signed right shift,
5389
+ # we get infinity one bits at the top
5390
+ val &= (1 << 57) - 1
5391
+
5392
+ byte |= 0x80 if val != 0
5393
+ unknown_bytes << byte
5394
+ end
5395
+
5220
5396
  case wire_type
5221
5397
  when 0
5222
5398
  i = 0
5223
5399
  while true
5224
5400
  newbyte = buff.getbyte(index)
5225
5401
  index += 1
5226
- break if newbyte.nil? || newbyte < 0x80
5402
+ break if newbyte.nil?
5403
+ unknown_bytes << newbyte
5404
+ break if newbyte < 0x80
5227
5405
  i += 1
5228
5406
  break if i > 9
5229
5407
  end
5230
5408
  when 1
5409
+ unknown_bytes << buff.byteslice(index, 8)
5231
5410
  index += 8
5232
5411
  when 2
5233
- ## PULL_BYTES
5234
5412
  value =
5235
5413
  if (byte0 = buff.getbyte(index)) < 0x80
5236
5414
  index += 1
@@ -5286,15 +5464,29 @@ module Api
5286
5464
  raise "integer decoding error"
5287
5465
  end
5288
5466
 
5289
- buff.byteslice(index, value)
5290
- index += value
5467
+ val = value
5468
+ while val != 0
5469
+ byte = val & 0x7F
5470
+
5471
+ val >>= 7
5472
+ # This drops the top bits,
5473
+ # Otherwise, with a signed right shift,
5474
+ # we get infinity one bits at the top
5475
+ val &= (1 << 57) - 1
5291
5476
 
5292
- ## END PULL_BYTES
5477
+ byte |= 0x80 if val != 0
5478
+ unknown_bytes << byte
5479
+ end
5480
+
5481
+ unknown_bytes << buff.byteslice(index, value)
5482
+ index += value
5293
5483
  when 5
5484
+ unknown_bytes << buff.byteslice(index, 4)
5294
5485
  index += 4
5295
5486
  else
5296
5487
  raise "unknown wire type #{wire_type}"
5297
5488
  end
5489
+ (@_unknown_fields ||= +"".b) << unknown_bytes
5298
5490
  return self if index >= len
5299
5491
  ## PULL_UINT64
5300
5492
  tag =
@@ -5675,7 +5867,7 @@ module Api
5675
5867
 
5676
5868
  buff
5677
5869
  end
5678
-
5870
+ buff << @_unknown_fields if @_unknown_fields
5679
5871
  buff
5680
5872
  end
5681
5873
 
@@ -5829,20 +6021,38 @@ module Api
5829
6021
  # unexpected, so discard it and continue.
5830
6022
  if !found
5831
6023
  wire_type = tag & 0x7
6024
+
6025
+ unknown_bytes = +"".b
6026
+ val = tag
6027
+ while val != 0
6028
+ byte = val & 0x7F
6029
+
6030
+ val >>= 7
6031
+ # This drops the top bits,
6032
+ # Otherwise, with a signed right shift,
6033
+ # we get infinity one bits at the top
6034
+ val &= (1 << 57) - 1
6035
+
6036
+ byte |= 0x80 if val != 0
6037
+ unknown_bytes << byte
6038
+ end
6039
+
5832
6040
  case wire_type
5833
6041
  when 0
5834
6042
  i = 0
5835
6043
  while true
5836
6044
  newbyte = buff.getbyte(index)
5837
6045
  index += 1
5838
- break if newbyte.nil? || newbyte < 0x80
6046
+ break if newbyte.nil?
6047
+ unknown_bytes << newbyte
6048
+ break if newbyte < 0x80
5839
6049
  i += 1
5840
6050
  break if i > 9
5841
6051
  end
5842
6052
  when 1
6053
+ unknown_bytes << buff.byteslice(index, 8)
5843
6054
  index += 8
5844
6055
  when 2
5845
- ## PULL_BYTES
5846
6056
  value =
5847
6057
  if (byte0 = buff.getbyte(index)) < 0x80
5848
6058
  index += 1
@@ -5898,15 +6108,29 @@ module Api
5898
6108
  raise "integer decoding error"
5899
6109
  end
5900
6110
 
5901
- buff.byteslice(index, value)
5902
- index += value
6111
+ val = value
6112
+ while val != 0
6113
+ byte = val & 0x7F
6114
+
6115
+ val >>= 7
6116
+ # This drops the top bits,
6117
+ # Otherwise, with a signed right shift,
6118
+ # we get infinity one bits at the top
6119
+ val &= (1 << 57) - 1
6120
+
6121
+ byte |= 0x80 if val != 0
6122
+ unknown_bytes << byte
6123
+ end
5903
6124
 
5904
- ## END PULL_BYTES
6125
+ unknown_bytes << buff.byteslice(index, value)
6126
+ index += value
5905
6127
  when 5
6128
+ unknown_bytes << buff.byteslice(index, 4)
5906
6129
  index += 4
5907
6130
  else
5908
6131
  raise "unknown wire type #{wire_type}"
5909
6132
  end
6133
+ (@_unknown_fields ||= +"".b) << unknown_bytes
5910
6134
  return self if index >= len
5911
6135
  ## PULL_UINT64
5912
6136
  tag =
@@ -6447,7 +6671,7 @@ module Api
6447
6671
 
6448
6672
  buff
6449
6673
  end
6450
-
6674
+ buff << @_unknown_fields if @_unknown_fields
6451
6675
  buff
6452
6676
  end
6453
6677
 
@@ -6602,20 +6826,38 @@ module Api
6602
6826
  # unexpected, so discard it and continue.
6603
6827
  if !found
6604
6828
  wire_type = tag & 0x7
6829
+
6830
+ unknown_bytes = +"".b
6831
+ val = tag
6832
+ while val != 0
6833
+ byte = val & 0x7F
6834
+
6835
+ val >>= 7
6836
+ # This drops the top bits,
6837
+ # Otherwise, with a signed right shift,
6838
+ # we get infinity one bits at the top
6839
+ val &= (1 << 57) - 1
6840
+
6841
+ byte |= 0x80 if val != 0
6842
+ unknown_bytes << byte
6843
+ end
6844
+
6605
6845
  case wire_type
6606
6846
  when 0
6607
6847
  i = 0
6608
6848
  while true
6609
6849
  newbyte = buff.getbyte(index)
6610
6850
  index += 1
6611
- break if newbyte.nil? || newbyte < 0x80
6851
+ break if newbyte.nil?
6852
+ unknown_bytes << newbyte
6853
+ break if newbyte < 0x80
6612
6854
  i += 1
6613
6855
  break if i > 9
6614
6856
  end
6615
6857
  when 1
6858
+ unknown_bytes << buff.byteslice(index, 8)
6616
6859
  index += 8
6617
6860
  when 2
6618
- ## PULL_BYTES
6619
6861
  value =
6620
6862
  if (byte0 = buff.getbyte(index)) < 0x80
6621
6863
  index += 1
@@ -6671,15 +6913,29 @@ module Api
6671
6913
  raise "integer decoding error"
6672
6914
  end
6673
6915
 
6674
- buff.byteslice(index, value)
6675
- index += value
6916
+ val = value
6917
+ while val != 0
6918
+ byte = val & 0x7F
6676
6919
 
6677
- ## END PULL_BYTES
6920
+ val >>= 7
6921
+ # This drops the top bits,
6922
+ # Otherwise, with a signed right shift,
6923
+ # we get infinity one bits at the top
6924
+ val &= (1 << 57) - 1
6925
+
6926
+ byte |= 0x80 if val != 0
6927
+ unknown_bytes << byte
6928
+ end
6929
+
6930
+ unknown_bytes << buff.byteslice(index, value)
6931
+ index += value
6678
6932
  when 5
6933
+ unknown_bytes << buff.byteslice(index, 4)
6679
6934
  index += 4
6680
6935
  else
6681
6936
  raise "unknown wire type #{wire_type}"
6682
6937
  end
6938
+ (@_unknown_fields ||= +"".b) << unknown_bytes
6683
6939
  return self if index >= len
6684
6940
  ## PULL_UINT64
6685
6941
  tag =
@@ -7125,7 +7381,7 @@ module Api
7125
7381
 
7126
7382
  [val].pack("e", buffer: buff)
7127
7383
  end
7128
-
7384
+ buff << @_unknown_fields if @_unknown_fields
7129
7385
  buff
7130
7386
  end
7131
7387
 
@@ -7326,20 +7582,38 @@ module Api
7326
7582
  # unexpected, so discard it and continue.
7327
7583
  if !found
7328
7584
  wire_type = tag & 0x7
7585
+
7586
+ unknown_bytes = +"".b
7587
+ val = tag
7588
+ while val != 0
7589
+ byte = val & 0x7F
7590
+
7591
+ val >>= 7
7592
+ # This drops the top bits,
7593
+ # Otherwise, with a signed right shift,
7594
+ # we get infinity one bits at the top
7595
+ val &= (1 << 57) - 1
7596
+
7597
+ byte |= 0x80 if val != 0
7598
+ unknown_bytes << byte
7599
+ end
7600
+
7329
7601
  case wire_type
7330
7602
  when 0
7331
7603
  i = 0
7332
7604
  while true
7333
7605
  newbyte = buff.getbyte(index)
7334
7606
  index += 1
7335
- break if newbyte.nil? || newbyte < 0x80
7607
+ break if newbyte.nil?
7608
+ unknown_bytes << newbyte
7609
+ break if newbyte < 0x80
7336
7610
  i += 1
7337
7611
  break if i > 9
7338
7612
  end
7339
7613
  when 1
7614
+ unknown_bytes << buff.byteslice(index, 8)
7340
7615
  index += 8
7341
7616
  when 2
7342
- ## PULL_BYTES
7343
7617
  value =
7344
7618
  if (byte0 = buff.getbyte(index)) < 0x80
7345
7619
  index += 1
@@ -7395,15 +7669,29 @@ module Api
7395
7669
  raise "integer decoding error"
7396
7670
  end
7397
7671
 
7398
- buff.byteslice(index, value)
7399
- index += value
7672
+ val = value
7673
+ while val != 0
7674
+ byte = val & 0x7F
7675
+
7676
+ val >>= 7
7677
+ # This drops the top bits,
7678
+ # Otherwise, with a signed right shift,
7679
+ # we get infinity one bits at the top
7680
+ val &= (1 << 57) - 1
7400
7681
 
7401
- ## END PULL_BYTES
7682
+ byte |= 0x80 if val != 0
7683
+ unknown_bytes << byte
7684
+ end
7685
+
7686
+ unknown_bytes << buff.byteslice(index, value)
7687
+ index += value
7402
7688
  when 5
7689
+ unknown_bytes << buff.byteslice(index, 4)
7403
7690
  index += 4
7404
7691
  else
7405
7692
  raise "unknown wire type #{wire_type}"
7406
7693
  end
7694
+ (@_unknown_fields ||= +"".b) << unknown_bytes
7407
7695
  return self if index >= len
7408
7696
  ## PULL_UINT64
7409
7697
  tag =
@@ -8002,7 +8290,7 @@ module Api
8002
8290
  buff << byte
8003
8291
  end
8004
8292
  end
8005
-
8293
+ buff << @_unknown_fields if @_unknown_fields
8006
8294
  buff
8007
8295
  end
8008
8296
 
@@ -8114,20 +8402,38 @@ module Api
8114
8402
  # unexpected, so discard it and continue.
8115
8403
  if !found
8116
8404
  wire_type = tag & 0x7
8405
+
8406
+ unknown_bytes = +"".b
8407
+ val = tag
8408
+ while val != 0
8409
+ byte = val & 0x7F
8410
+
8411
+ val >>= 7
8412
+ # This drops the top bits,
8413
+ # Otherwise, with a signed right shift,
8414
+ # we get infinity one bits at the top
8415
+ val &= (1 << 57) - 1
8416
+
8417
+ byte |= 0x80 if val != 0
8418
+ unknown_bytes << byte
8419
+ end
8420
+
8117
8421
  case wire_type
8118
8422
  when 0
8119
8423
  i = 0
8120
8424
  while true
8121
8425
  newbyte = buff.getbyte(index)
8122
8426
  index += 1
8123
- break if newbyte.nil? || newbyte < 0x80
8427
+ break if newbyte.nil?
8428
+ unknown_bytes << newbyte
8429
+ break if newbyte < 0x80
8124
8430
  i += 1
8125
8431
  break if i > 9
8126
8432
  end
8127
8433
  when 1
8434
+ unknown_bytes << buff.byteslice(index, 8)
8128
8435
  index += 8
8129
8436
  when 2
8130
- ## PULL_BYTES
8131
8437
  value =
8132
8438
  if (byte0 = buff.getbyte(index)) < 0x80
8133
8439
  index += 1
@@ -8183,15 +8489,29 @@ module Api
8183
8489
  raise "integer decoding error"
8184
8490
  end
8185
8491
 
8186
- buff.byteslice(index, value)
8187
- index += value
8492
+ val = value
8493
+ while val != 0
8494
+ byte = val & 0x7F
8188
8495
 
8189
- ## END PULL_BYTES
8496
+ val >>= 7
8497
+ # This drops the top bits,
8498
+ # Otherwise, with a signed right shift,
8499
+ # we get infinity one bits at the top
8500
+ val &= (1 << 57) - 1
8501
+
8502
+ byte |= 0x80 if val != 0
8503
+ unknown_bytes << byte
8504
+ end
8505
+
8506
+ unknown_bytes << buff.byteslice(index, value)
8507
+ index += value
8190
8508
  when 5
8509
+ unknown_bytes << buff.byteslice(index, 4)
8191
8510
  index += 4
8192
8511
  else
8193
8512
  raise "unknown wire type #{wire_type}"
8194
8513
  end
8514
+ (@_unknown_fields ||= +"".b) << unknown_bytes
8195
8515
  return self if index >= len
8196
8516
  ## PULL_UINT64
8197
8517
  tag =
@@ -8247,64 +8567,11 @@ module Api
8247
8567
  end
8248
8568
  found = false
8249
8569
 
8250
- if tag == 0xa
8570
+ if tag == 0x8
8251
8571
  found = true
8252
- ## PULL_UINT64
8253
- value =
8254
- if (byte0 = buff.getbyte(index)) < 0x80
8255
- index += 1
8256
- byte0
8257
- elsif (byte1 = buff.getbyte(index + 1)) < 0x80
8258
- index += 2
8259
- (byte1 << 7) | (byte0 & 0x7F)
8260
- elsif (byte2 = buff.getbyte(index + 2)) < 0x80
8261
- index += 3
8262
- (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8263
- elsif (byte3 = buff.getbyte(index + 3)) < 0x80
8264
- index += 4
8265
- (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
8266
- (byte0 & 0x7F)
8267
- elsif (byte4 = buff.getbyte(index + 4)) < 0x80
8268
- index += 5
8269
- (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
8270
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8271
- elsif (byte5 = buff.getbyte(index + 5)) < 0x80
8272
- index += 6
8273
- (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
8274
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8275
- elsif (byte6 = buff.getbyte(index + 6)) < 0x80
8276
- index += 7
8277
- (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
8278
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
8279
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8280
- elsif (byte7 = buff.getbyte(index + 7)) < 0x80
8281
- index += 8
8282
- (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
8283
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
8284
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8285
- elsif (byte8 = buff.getbyte(index + 8)) < 0x80
8286
- index += 9
8287
- (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
8288
- ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
8289
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
8290
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8291
- elsif (byte9 = buff.getbyte(index + 9)) < 0x80
8292
- index += 10
8293
-
8294
- (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) |
8295
- ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
8296
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
8297
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8298
- else
8299
- raise "integer decoding error"
8300
- end
8301
-
8302
- ## END PULL_UINT64
8303
-
8304
- goal = index + value
8572
+ ## DECODE REPEATED
8305
8573
  list = @tag
8306
8574
  while true
8307
- break if index >= goal
8308
8575
  ## PULL_UINT64
8309
8576
  list << if (byte0 = buff.getbyte(index)) < 0x80
8310
8577
  index += 1
@@ -8355,60 +8622,71 @@ module Api
8355
8622
  end
8356
8623
 
8357
8624
  ## END PULL_UINT64
8358
- end
8359
8625
 
8360
- return self if index >= len
8361
- ## PULL_UINT64
8362
- tag =
8363
- if (byte0 = buff.getbyte(index)) < 0x80
8364
- index += 1
8365
- byte0
8366
- elsif (byte1 = buff.getbyte(index + 1)) < 0x80
8367
- index += 2
8368
- (byte1 << 7) | (byte0 & 0x7F)
8369
- elsif (byte2 = buff.getbyte(index + 2)) < 0x80
8370
- index += 3
8371
- (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8372
- elsif (byte3 = buff.getbyte(index + 3)) < 0x80
8373
- index += 4
8374
- (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
8375
- (byte0 & 0x7F)
8376
- elsif (byte4 = buff.getbyte(index + 4)) < 0x80
8377
- index += 5
8378
- (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
8379
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8380
- elsif (byte5 = buff.getbyte(index + 5)) < 0x80
8381
- index += 6
8382
- (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
8383
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8384
- elsif (byte6 = buff.getbyte(index + 6)) < 0x80
8385
- index += 7
8386
- (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
8387
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
8388
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8389
- elsif (byte7 = buff.getbyte(index + 7)) < 0x80
8390
- index += 8
8391
- (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
8392
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
8393
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8394
- elsif (byte8 = buff.getbyte(index + 8)) < 0x80
8395
- index += 9
8396
- (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
8397
- ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
8398
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
8399
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8400
- elsif (byte9 = buff.getbyte(index + 9)) < 0x80
8401
- index += 10
8626
+ return self if index >= len
8627
+ ## PULL_UINT64
8628
+ tag =
8629
+ if (byte0 = buff.getbyte(index)) < 0x80
8630
+ index += 1
8631
+ byte0
8632
+ elsif (byte1 = buff.getbyte(index + 1)) < 0x80
8633
+ index += 2
8634
+ (byte1 << 7) | (byte0 & 0x7F)
8635
+ elsif (byte2 = buff.getbyte(index + 2)) < 0x80
8636
+ index += 3
8637
+ (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8638
+ elsif (byte3 = buff.getbyte(index + 3)) < 0x80
8639
+ index += 4
8640
+ (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
8641
+ (byte0 & 0x7F)
8642
+ elsif (byte4 = buff.getbyte(index + 4)) < 0x80
8643
+ index += 5
8644
+ (byte4 << 28) | ((byte3 & 0x7F) << 21) |
8645
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
8646
+ (byte0 & 0x7F)
8647
+ elsif (byte5 = buff.getbyte(index + 5)) < 0x80
8648
+ index += 6
8649
+ (byte5 << 35) | ((byte4 & 0x7F) << 28) |
8650
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
8651
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8652
+ elsif (byte6 = buff.getbyte(index + 6)) < 0x80
8653
+ index += 7
8654
+ (byte6 << 42) | ((byte5 & 0x7F) << 35) |
8655
+ ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
8656
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
8657
+ (byte0 & 0x7F)
8658
+ elsif (byte7 = buff.getbyte(index + 7)) < 0x80
8659
+ index += 8
8660
+ (byte7 << 49) | ((byte6 & 0x7F) << 42) |
8661
+ ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
8662
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
8663
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8664
+ elsif (byte8 = buff.getbyte(index + 8)) < 0x80
8665
+ index += 9
8666
+ (byte8 << 56) | ((byte7 & 0x7F) << 49) |
8667
+ ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
8668
+ ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
8669
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
8670
+ (byte0 & 0x7F)
8671
+ elsif (byte9 = buff.getbyte(index + 9)) < 0x80
8672
+ index += 10
8402
8673
 
8403
- (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) |
8404
- ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
8405
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
8406
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8407
- else
8408
- raise "integer decoding error"
8409
- end
8674
+ (byte9 << 63) | ((byte8 & 0x7F) << 56) |
8675
+ ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
8676
+ ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
8677
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
8678
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
8679
+ else
8680
+ raise "integer decoding error"
8681
+ end
8410
8682
 
8411
- ## END PULL_UINT64
8683
+ ## END PULL_UINT64
8684
+
8685
+ break unless tag == 0x8
8686
+ end
8687
+ ## END DECODE REPEATED
8688
+
8689
+ return self if index >= len
8412
8690
  end
8413
8691
 
8414
8692
  return self if index >= len
@@ -8417,18 +8695,11 @@ module Api
8417
8695
  def _encode(buff)
8418
8696
  list = @tag
8419
8697
  if list.size > 0
8420
- buff << 0x0a
8421
-
8422
- # Save the buffer size before appending the repeated bytes
8423
- current_len = buff.bytesize
8424
-
8425
- # Write a single dummy byte to later store encoded length
8426
- buff << 42 # "*"
8427
-
8428
- # write each item
8429
8698
  list.each do |item|
8430
8699
  val = item
8431
8700
  if val != 0
8701
+ buff << 0x08
8702
+
8432
8703
  while val != 0
8433
8704
  byte = val & 0x7F
8434
8705
  val >>= 7
@@ -8437,42 +8708,8 @@ module Api
8437
8708
  end
8438
8709
  end
8439
8710
  end
8440
-
8441
- # Calculate the submessage's size
8442
- submessage_size = buff.bytesize - current_len - 1
8443
-
8444
- # Hope the size fits in one byte
8445
- byte = submessage_size & 0x7F
8446
- submessage_size >>= 7
8447
- byte |= 0x80 if submessage_size > 0
8448
- buff.setbyte(current_len, byte)
8449
-
8450
- # If the sub message was bigger
8451
- if submessage_size > 0
8452
- current_len += 1
8453
-
8454
- # compute how much we need to shift
8455
- encoded_int_len = 0
8456
- remaining_size = submessage_size
8457
- while remaining_size != 0
8458
- remaining_size >>= 7
8459
- encoded_int_len += 1
8460
- end
8461
-
8462
- # Make space in the string with dummy bytes
8463
- buff.bytesplice(current_len, 0, "*********", 0, encoded_int_len)
8464
-
8465
- # Overwrite the dummy bytes with the encoded length
8466
- while submessage_size != 0
8467
- byte = submessage_size & 0x7F
8468
- submessage_size >>= 7
8469
- byte |= 0x80 if submessage_size > 0
8470
- buff.setbyte(current_len, byte)
8471
- current_len += 1
8472
- end
8473
- end
8474
8711
  end
8475
-
8712
+ buff << @_unknown_fields if @_unknown_fields
8476
8713
  buff
8477
8714
  end
8478
8715
 
@@ -8643,20 +8880,38 @@ module Api
8643
8880
  # unexpected, so discard it and continue.
8644
8881
  if !found
8645
8882
  wire_type = tag & 0x7
8883
+
8884
+ unknown_bytes = +"".b
8885
+ val = tag
8886
+ while val != 0
8887
+ byte = val & 0x7F
8888
+
8889
+ val >>= 7
8890
+ # This drops the top bits,
8891
+ # Otherwise, with a signed right shift,
8892
+ # we get infinity one bits at the top
8893
+ val &= (1 << 57) - 1
8894
+
8895
+ byte |= 0x80 if val != 0
8896
+ unknown_bytes << byte
8897
+ end
8898
+
8646
8899
  case wire_type
8647
8900
  when 0
8648
8901
  i = 0
8649
8902
  while true
8650
8903
  newbyte = buff.getbyte(index)
8651
8904
  index += 1
8652
- break if newbyte.nil? || newbyte < 0x80
8905
+ break if newbyte.nil?
8906
+ unknown_bytes << newbyte
8907
+ break if newbyte < 0x80
8653
8908
  i += 1
8654
8909
  break if i > 9
8655
8910
  end
8656
8911
  when 1
8912
+ unknown_bytes << buff.byteslice(index, 8)
8657
8913
  index += 8
8658
8914
  when 2
8659
- ## PULL_BYTES
8660
8915
  value =
8661
8916
  if (byte0 = buff.getbyte(index)) < 0x80
8662
8917
  index += 1
@@ -8712,15 +8967,29 @@ module Api
8712
8967
  raise "integer decoding error"
8713
8968
  end
8714
8969
 
8715
- buff.byteslice(index, value)
8716
- index += value
8970
+ val = value
8971
+ while val != 0
8972
+ byte = val & 0x7F
8973
+
8974
+ val >>= 7
8975
+ # This drops the top bits,
8976
+ # Otherwise, with a signed right shift,
8977
+ # we get infinity one bits at the top
8978
+ val &= (1 << 57) - 1
8717
8979
 
8718
- ## END PULL_BYTES
8980
+ byte |= 0x80 if val != 0
8981
+ unknown_bytes << byte
8982
+ end
8983
+
8984
+ unknown_bytes << buff.byteslice(index, value)
8985
+ index += value
8719
8986
  when 5
8987
+ unknown_bytes << buff.byteslice(index, 4)
8720
8988
  index += 4
8721
8989
  else
8722
8990
  raise "unknown wire type #{wire_type}"
8723
8991
  end
8992
+ (@_unknown_fields ||= +"".b) << unknown_bytes
8724
8993
  return self if index >= len
8725
8994
  ## PULL_UINT64
8726
8995
  tag =
@@ -9056,7 +9325,7 @@ module Api
9056
9325
  buff << byte
9057
9326
  end
9058
9327
  end
9059
-
9328
+ buff << @_unknown_fields if @_unknown_fields
9060
9329
  buff
9061
9330
  end
9062
9331
 
@@ -9172,20 +9441,38 @@ module Api
9172
9441
  # unexpected, so discard it and continue.
9173
9442
  if !found
9174
9443
  wire_type = tag & 0x7
9444
+
9445
+ unknown_bytes = +"".b
9446
+ val = tag
9447
+ while val != 0
9448
+ byte = val & 0x7F
9449
+
9450
+ val >>= 7
9451
+ # This drops the top bits,
9452
+ # Otherwise, with a signed right shift,
9453
+ # we get infinity one bits at the top
9454
+ val &= (1 << 57) - 1
9455
+
9456
+ byte |= 0x80 if val != 0
9457
+ unknown_bytes << byte
9458
+ end
9459
+
9175
9460
  case wire_type
9176
9461
  when 0
9177
9462
  i = 0
9178
9463
  while true
9179
9464
  newbyte = buff.getbyte(index)
9180
9465
  index += 1
9181
- break if newbyte.nil? || newbyte < 0x80
9466
+ break if newbyte.nil?
9467
+ unknown_bytes << newbyte
9468
+ break if newbyte < 0x80
9182
9469
  i += 1
9183
9470
  break if i > 9
9184
9471
  end
9185
9472
  when 1
9473
+ unknown_bytes << buff.byteslice(index, 8)
9186
9474
  index += 8
9187
9475
  when 2
9188
- ## PULL_BYTES
9189
9476
  value =
9190
9477
  if (byte0 = buff.getbyte(index)) < 0x80
9191
9478
  index += 1
@@ -9241,15 +9528,29 @@ module Api
9241
9528
  raise "integer decoding error"
9242
9529
  end
9243
9530
 
9244
- buff.byteslice(index, value)
9245
- index += value
9531
+ val = value
9532
+ while val != 0
9533
+ byte = val & 0x7F
9534
+
9535
+ val >>= 7
9536
+ # This drops the top bits,
9537
+ # Otherwise, with a signed right shift,
9538
+ # we get infinity one bits at the top
9539
+ val &= (1 << 57) - 1
9540
+
9541
+ byte |= 0x80 if val != 0
9542
+ unknown_bytes << byte
9543
+ end
9246
9544
 
9247
- ## END PULL_BYTES
9545
+ unknown_bytes << buff.byteslice(index, value)
9546
+ index += value
9248
9547
  when 5
9548
+ unknown_bytes << buff.byteslice(index, 4)
9249
9549
  index += 4
9250
9550
  else
9251
9551
  raise "unknown wire type #{wire_type}"
9252
9552
  end
9553
+ (@_unknown_fields ||= +"".b) << unknown_bytes
9253
9554
  return self if index >= len
9254
9555
  ## PULL_UINT64
9255
9556
  tag =
@@ -9374,7 +9675,7 @@ module Api
9374
9675
 
9375
9676
  [val].pack("e", buffer: buff)
9376
9677
  end
9377
-
9678
+ buff << @_unknown_fields if @_unknown_fields
9378
9679
  buff
9379
9680
  end
9380
9681
 
@@ -9504,20 +9805,38 @@ module Api
9504
9805
  # unexpected, so discard it and continue.
9505
9806
  if !found
9506
9807
  wire_type = tag & 0x7
9808
+
9809
+ unknown_bytes = +"".b
9810
+ val = tag
9811
+ while val != 0
9812
+ byte = val & 0x7F
9813
+
9814
+ val >>= 7
9815
+ # This drops the top bits,
9816
+ # Otherwise, with a signed right shift,
9817
+ # we get infinity one bits at the top
9818
+ val &= (1 << 57) - 1
9819
+
9820
+ byte |= 0x80 if val != 0
9821
+ unknown_bytes << byte
9822
+ end
9823
+
9507
9824
  case wire_type
9508
9825
  when 0
9509
9826
  i = 0
9510
9827
  while true
9511
9828
  newbyte = buff.getbyte(index)
9512
9829
  index += 1
9513
- break if newbyte.nil? || newbyte < 0x80
9830
+ break if newbyte.nil?
9831
+ unknown_bytes << newbyte
9832
+ break if newbyte < 0x80
9514
9833
  i += 1
9515
9834
  break if i > 9
9516
9835
  end
9517
9836
  when 1
9837
+ unknown_bytes << buff.byteslice(index, 8)
9518
9838
  index += 8
9519
9839
  when 2
9520
- ## PULL_BYTES
9521
9840
  value =
9522
9841
  if (byte0 = buff.getbyte(index)) < 0x80
9523
9842
  index += 1
@@ -9573,15 +9892,29 @@ module Api
9573
9892
  raise "integer decoding error"
9574
9893
  end
9575
9894
 
9576
- buff.byteslice(index, value)
9577
- index += value
9895
+ val = value
9896
+ while val != 0
9897
+ byte = val & 0x7F
9898
+
9899
+ val >>= 7
9900
+ # This drops the top bits,
9901
+ # Otherwise, with a signed right shift,
9902
+ # we get infinity one bits at the top
9903
+ val &= (1 << 57) - 1
9578
9904
 
9579
- ## END PULL_BYTES
9905
+ byte |= 0x80 if val != 0
9906
+ unknown_bytes << byte
9907
+ end
9908
+
9909
+ unknown_bytes << buff.byteslice(index, value)
9910
+ index += value
9580
9911
  when 5
9912
+ unknown_bytes << buff.byteslice(index, 4)
9581
9913
  index += 4
9582
9914
  else
9583
9915
  raise "unknown wire type #{wire_type}"
9584
9916
  end
9917
+ (@_unknown_fields ||= +"".b) << unknown_bytes
9585
9918
  return self if index >= len
9586
9919
  ## PULL_UINT64
9587
9920
  tag =
@@ -9779,7 +10112,7 @@ module Api
9779
10112
  buff << byte
9780
10113
  end
9781
10114
  end
9782
-
10115
+ buff << @_unknown_fields if @_unknown_fields
9783
10116
  buff
9784
10117
  end
9785
10118
 
@@ -9970,20 +10303,38 @@ module Api
9970
10303
  # unexpected, so discard it and continue.
9971
10304
  if !found
9972
10305
  wire_type = tag & 0x7
10306
+
10307
+ unknown_bytes = +"".b
10308
+ val = tag
10309
+ while val != 0
10310
+ byte = val & 0x7F
10311
+
10312
+ val >>= 7
10313
+ # This drops the top bits,
10314
+ # Otherwise, with a signed right shift,
10315
+ # we get infinity one bits at the top
10316
+ val &= (1 << 57) - 1
10317
+
10318
+ byte |= 0x80 if val != 0
10319
+ unknown_bytes << byte
10320
+ end
10321
+
9973
10322
  case wire_type
9974
10323
  when 0
9975
10324
  i = 0
9976
10325
  while true
9977
10326
  newbyte = buff.getbyte(index)
9978
10327
  index += 1
9979
- break if newbyte.nil? || newbyte < 0x80
10328
+ break if newbyte.nil?
10329
+ unknown_bytes << newbyte
10330
+ break if newbyte < 0x80
9980
10331
  i += 1
9981
10332
  break if i > 9
9982
10333
  end
9983
10334
  when 1
10335
+ unknown_bytes << buff.byteslice(index, 8)
9984
10336
  index += 8
9985
10337
  when 2
9986
- ## PULL_BYTES
9987
10338
  value =
9988
10339
  if (byte0 = buff.getbyte(index)) < 0x80
9989
10340
  index += 1
@@ -10039,15 +10390,29 @@ module Api
10039
10390
  raise "integer decoding error"
10040
10391
  end
10041
10392
 
10042
- buff.byteslice(index, value)
10043
- index += value
10393
+ val = value
10394
+ while val != 0
10395
+ byte = val & 0x7F
10044
10396
 
10045
- ## END PULL_BYTES
10397
+ val >>= 7
10398
+ # This drops the top bits,
10399
+ # Otherwise, with a signed right shift,
10400
+ # we get infinity one bits at the top
10401
+ val &= (1 << 57) - 1
10402
+
10403
+ byte |= 0x80 if val != 0
10404
+ unknown_bytes << byte
10405
+ end
10406
+
10407
+ unknown_bytes << buff.byteslice(index, value)
10408
+ index += value
10046
10409
  when 5
10410
+ unknown_bytes << buff.byteslice(index, 4)
10047
10411
  index += 4
10048
10412
  else
10049
10413
  raise "unknown wire type #{wire_type}"
10050
10414
  end
10415
+ (@_unknown_fields ||= +"".b) << unknown_bytes
10051
10416
  return self if index >= len
10052
10417
  ## PULL_UINT64
10053
10418
  tag =
@@ -10430,7 +10795,7 @@ module Api
10430
10795
  buff << byte
10431
10796
  end
10432
10797
  end
10433
-
10798
+ buff << @_unknown_fields if @_unknown_fields
10434
10799
  buff
10435
10800
  end
10436
10801