sc2ai 0.4.1 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -527,20 +527,38 @@ module Api
527
527
  # unexpected, so discard it and continue.
528
528
  if !found
529
529
  wire_type = tag & 0x7
530
+
531
+ unknown_bytes = +"".b
532
+ val = tag
533
+ while val != 0
534
+ byte = val & 0x7F
535
+
536
+ val >>= 7
537
+ # This drops the top bits,
538
+ # Otherwise, with a signed right shift,
539
+ # we get infinity one bits at the top
540
+ val &= (1 << 57) - 1
541
+
542
+ byte |= 0x80 if val != 0
543
+ unknown_bytes << byte
544
+ end
545
+
530
546
  case wire_type
531
547
  when 0
532
548
  i = 0
533
549
  while true
534
550
  newbyte = buff.getbyte(index)
535
551
  index += 1
536
- break if newbyte.nil? || newbyte < 0x80
552
+ break if newbyte.nil?
553
+ unknown_bytes << newbyte
554
+ break if newbyte < 0x80
537
555
  i += 1
538
556
  break if i > 9
539
557
  end
540
558
  when 1
559
+ unknown_bytes << buff.byteslice(index, 8)
541
560
  index += 8
542
561
  when 2
543
- ## PULL_BYTES
544
562
  value =
545
563
  if (byte0 = buff.getbyte(index)) < 0x80
546
564
  index += 1
@@ -596,15 +614,29 @@ module Api
596
614
  raise "integer decoding error"
597
615
  end
598
616
 
599
- buff.byteslice(index, value)
600
- index += value
617
+ val = value
618
+ while val != 0
619
+ byte = val & 0x7F
620
+
621
+ val >>= 7
622
+ # This drops the top bits,
623
+ # Otherwise, with a signed right shift,
624
+ # we get infinity one bits at the top
625
+ val &= (1 << 57) - 1
626
+
627
+ byte |= 0x80 if val != 0
628
+ unknown_bytes << byte
629
+ end
601
630
 
602
- ## END PULL_BYTES
631
+ unknown_bytes << buff.byteslice(index, value)
632
+ index += value
603
633
  when 5
634
+ unknown_bytes << buff.byteslice(index, 4)
604
635
  index += 4
605
636
  else
606
637
  raise "unknown wire type #{wire_type}"
607
638
  end
639
+ (@_unknown_fields ||= +"".b) << unknown_bytes
608
640
  return self if index >= len
609
641
  ## PULL_UINT64
610
642
  tag =
@@ -2151,7 +2183,7 @@ module Api
2151
2183
 
2152
2184
  [val].pack("e", buffer: buff)
2153
2185
  end
2154
-
2186
+ buff << @_unknown_fields if @_unknown_fields
2155
2187
  buff
2156
2188
  end
2157
2189
 
@@ -2297,20 +2329,38 @@ module Api
2297
2329
  # unexpected, so discard it and continue.
2298
2330
  if !found
2299
2331
  wire_type = tag & 0x7
2332
+
2333
+ unknown_bytes = +"".b
2334
+ val = tag
2335
+ while val != 0
2336
+ byte = val & 0x7F
2337
+
2338
+ val >>= 7
2339
+ # This drops the top bits,
2340
+ # Otherwise, with a signed right shift,
2341
+ # we get infinity one bits at the top
2342
+ val &= (1 << 57) - 1
2343
+
2344
+ byte |= 0x80 if val != 0
2345
+ unknown_bytes << byte
2346
+ end
2347
+
2300
2348
  case wire_type
2301
2349
  when 0
2302
2350
  i = 0
2303
2351
  while true
2304
2352
  newbyte = buff.getbyte(index)
2305
2353
  index += 1
2306
- break if newbyte.nil? || newbyte < 0x80
2354
+ break if newbyte.nil?
2355
+ unknown_bytes << newbyte
2356
+ break if newbyte < 0x80
2307
2357
  i += 1
2308
2358
  break if i > 9
2309
2359
  end
2310
2360
  when 1
2361
+ unknown_bytes << buff.byteslice(index, 8)
2311
2362
  index += 8
2312
2363
  when 2
2313
- ## PULL_BYTES
2314
2364
  value =
2315
2365
  if (byte0 = buff.getbyte(index)) < 0x80
2316
2366
  index += 1
@@ -2366,15 +2416,29 @@ module Api
2366
2416
  raise "integer decoding error"
2367
2417
  end
2368
2418
 
2369
- buff.byteslice(index, value)
2370
- index += value
2419
+ val = value
2420
+ while val != 0
2421
+ byte = val & 0x7F
2422
+
2423
+ val >>= 7
2424
+ # This drops the top bits,
2425
+ # Otherwise, with a signed right shift,
2426
+ # we get infinity one bits at the top
2427
+ val &= (1 << 57) - 1
2428
+
2429
+ byte |= 0x80 if val != 0
2430
+ unknown_bytes << byte
2431
+ end
2371
2432
 
2372
- ## END PULL_BYTES
2433
+ unknown_bytes << buff.byteslice(index, value)
2434
+ index += value
2373
2435
  when 5
2436
+ unknown_bytes << buff.byteslice(index, 4)
2374
2437
  index += 4
2375
2438
  else
2376
2439
  raise "unknown wire type #{wire_type}"
2377
2440
  end
2441
+ (@_unknown_fields ||= +"".b) << unknown_bytes
2378
2442
  return self if index >= len
2379
2443
  ## PULL_UINT64
2380
2444
  tag =
@@ -2637,7 +2701,7 @@ module Api
2637
2701
 
2638
2702
  [val].pack("e", buffer: buff)
2639
2703
  end
2640
-
2704
+ buff << @_unknown_fields if @_unknown_fields
2641
2705
  buff
2642
2706
  end
2643
2707
 
@@ -2882,20 +2946,38 @@ module Api
2882
2946
  # unexpected, so discard it and continue.
2883
2947
  if !found
2884
2948
  wire_type = tag & 0x7
2949
+
2950
+ unknown_bytes = +"".b
2951
+ val = tag
2952
+ while val != 0
2953
+ byte = val & 0x7F
2954
+
2955
+ val >>= 7
2956
+ # This drops the top bits,
2957
+ # Otherwise, with a signed right shift,
2958
+ # we get infinity one bits at the top
2959
+ val &= (1 << 57) - 1
2960
+
2961
+ byte |= 0x80 if val != 0
2962
+ unknown_bytes << byte
2963
+ end
2964
+
2885
2965
  case wire_type
2886
2966
  when 0
2887
2967
  i = 0
2888
2968
  while true
2889
2969
  newbyte = buff.getbyte(index)
2890
2970
  index += 1
2891
- break if newbyte.nil? || newbyte < 0x80
2971
+ break if newbyte.nil?
2972
+ unknown_bytes << newbyte
2973
+ break if newbyte < 0x80
2892
2974
  i += 1
2893
2975
  break if i > 9
2894
2976
  end
2895
2977
  when 1
2978
+ unknown_bytes << buff.byteslice(index, 8)
2896
2979
  index += 8
2897
2980
  when 2
2898
- ## PULL_BYTES
2899
2981
  value =
2900
2982
  if (byte0 = buff.getbyte(index)) < 0x80
2901
2983
  index += 1
@@ -2951,15 +3033,29 @@ module Api
2951
3033
  raise "integer decoding error"
2952
3034
  end
2953
3035
 
2954
- buff.byteslice(index, value)
2955
- index += value
3036
+ val = value
3037
+ while val != 0
3038
+ byte = val & 0x7F
3039
+
3040
+ val >>= 7
3041
+ # This drops the top bits,
3042
+ # Otherwise, with a signed right shift,
3043
+ # we get infinity one bits at the top
3044
+ val &= (1 << 57) - 1
3045
+
3046
+ byte |= 0x80 if val != 0
3047
+ unknown_bytes << byte
3048
+ end
2956
3049
 
2957
- ## END PULL_BYTES
3050
+ unknown_bytes << buff.byteslice(index, value)
3051
+ index += value
2958
3052
  when 5
3053
+ unknown_bytes << buff.byteslice(index, 4)
2959
3054
  index += 4
2960
3055
  else
2961
3056
  raise "unknown wire type #{wire_type}"
2962
3057
  end
3058
+ (@_unknown_fields ||= +"".b) << unknown_bytes
2963
3059
  return self if index >= len
2964
3060
  ## PULL_UINT64
2965
3061
  tag =
@@ -3661,7 +3757,7 @@ module Api
3661
3757
 
3662
3758
  [val].pack("e", buffer: buff)
3663
3759
  end
3664
-
3760
+ buff << @_unknown_fields if @_unknown_fields
3665
3761
  buff
3666
3762
  end
3667
3763
 
@@ -4246,20 +4342,38 @@ module Api
4246
4342
  # unexpected, so discard it and continue.
4247
4343
  if !found
4248
4344
  wire_type = tag & 0x7
4345
+
4346
+ unknown_bytes = +"".b
4347
+ val = tag
4348
+ while val != 0
4349
+ byte = val & 0x7F
4350
+
4351
+ val >>= 7
4352
+ # This drops the top bits,
4353
+ # Otherwise, with a signed right shift,
4354
+ # we get infinity one bits at the top
4355
+ val &= (1 << 57) - 1
4356
+
4357
+ byte |= 0x80 if val != 0
4358
+ unknown_bytes << byte
4359
+ end
4360
+
4249
4361
  case wire_type
4250
4362
  when 0
4251
4363
  i = 0
4252
4364
  while true
4253
4365
  newbyte = buff.getbyte(index)
4254
4366
  index += 1
4255
- break if newbyte.nil? || newbyte < 0x80
4367
+ break if newbyte.nil?
4368
+ unknown_bytes << newbyte
4369
+ break if newbyte < 0x80
4256
4370
  i += 1
4257
4371
  break if i > 9
4258
4372
  end
4259
4373
  when 1
4374
+ unknown_bytes << buff.byteslice(index, 8)
4260
4375
  index += 8
4261
4376
  when 2
4262
- ## PULL_BYTES
4263
4377
  value =
4264
4378
  if (byte0 = buff.getbyte(index)) < 0x80
4265
4379
  index += 1
@@ -4315,15 +4429,29 @@ module Api
4315
4429
  raise "integer decoding error"
4316
4430
  end
4317
4431
 
4318
- buff.byteslice(index, value)
4319
- index += value
4432
+ val = value
4433
+ while val != 0
4434
+ byte = val & 0x7F
4320
4435
 
4321
- ## END PULL_BYTES
4436
+ val >>= 7
4437
+ # This drops the top bits,
4438
+ # Otherwise, with a signed right shift,
4439
+ # we get infinity one bits at the top
4440
+ val &= (1 << 57) - 1
4441
+
4442
+ byte |= 0x80 if val != 0
4443
+ unknown_bytes << byte
4444
+ end
4445
+
4446
+ unknown_bytes << buff.byteslice(index, value)
4447
+ index += value
4322
4448
  when 5
4449
+ unknown_bytes << buff.byteslice(index, 4)
4323
4450
  index += 4
4324
4451
  else
4325
4452
  raise "unknown wire type #{wire_type}"
4326
4453
  end
4454
+ (@_unknown_fields ||= +"".b) << unknown_bytes
4327
4455
  return self if index >= len
4328
4456
  ## PULL_UINT64
4329
4457
  tag =
@@ -5565,64 +5693,11 @@ module Api
5565
5693
 
5566
5694
  ## END PULL_UINT64
5567
5695
  end
5568
- if tag == 0xaa
5696
+ if tag == 0xa8
5569
5697
  found = true
5570
- ## PULL_UINT64
5571
- value =
5572
- if (byte0 = buff.getbyte(index)) < 0x80
5573
- index += 1
5574
- byte0
5575
- elsif (byte1 = buff.getbyte(index + 1)) < 0x80
5576
- index += 2
5577
- (byte1 << 7) | (byte0 & 0x7F)
5578
- elsif (byte2 = buff.getbyte(index + 2)) < 0x80
5579
- index += 3
5580
- (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5581
- elsif (byte3 = buff.getbyte(index + 3)) < 0x80
5582
- index += 4
5583
- (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
5584
- (byte0 & 0x7F)
5585
- elsif (byte4 = buff.getbyte(index + 4)) < 0x80
5586
- index += 5
5587
- (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
5588
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5589
- elsif (byte5 = buff.getbyte(index + 5)) < 0x80
5590
- index += 6
5591
- (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
5592
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5593
- elsif (byte6 = buff.getbyte(index + 6)) < 0x80
5594
- index += 7
5595
- (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
5596
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
5597
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5598
- elsif (byte7 = buff.getbyte(index + 7)) < 0x80
5599
- index += 8
5600
- (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
5601
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
5602
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5603
- elsif (byte8 = buff.getbyte(index + 8)) < 0x80
5604
- index += 9
5605
- (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
5606
- ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
5607
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
5608
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5609
- elsif (byte9 = buff.getbyte(index + 9)) < 0x80
5610
- index += 10
5611
-
5612
- (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) |
5613
- ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
5614
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
5615
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5616
- else
5617
- raise "integer decoding error"
5618
- end
5619
-
5620
- ## END PULL_UINT64
5621
-
5622
- goal = index + value
5698
+ ## DECODE REPEATED
5623
5699
  list = @tech_alias
5624
5700
  while true
5625
- break if index >= goal
5626
5701
  ## PULL_UINT64
5627
5702
  list << if (byte0 = buff.getbyte(index)) < 0x80
5628
5703
  index += 1
@@ -5673,60 +5748,71 @@ module Api
5673
5748
  end
5674
5749
 
5675
5750
  ## END PULL_UINT64
5676
- end
5677
5751
 
5678
- return self if index >= len
5679
- ## PULL_UINT64
5680
- tag =
5681
- if (byte0 = buff.getbyte(index)) < 0x80
5682
- index += 1
5683
- byte0
5684
- elsif (byte1 = buff.getbyte(index + 1)) < 0x80
5685
- index += 2
5686
- (byte1 << 7) | (byte0 & 0x7F)
5687
- elsif (byte2 = buff.getbyte(index + 2)) < 0x80
5688
- index += 3
5689
- (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5690
- elsif (byte3 = buff.getbyte(index + 3)) < 0x80
5691
- index += 4
5692
- (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
5693
- (byte0 & 0x7F)
5694
- elsif (byte4 = buff.getbyte(index + 4)) < 0x80
5695
- index += 5
5696
- (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
5697
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5698
- elsif (byte5 = buff.getbyte(index + 5)) < 0x80
5699
- index += 6
5700
- (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
5701
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5702
- elsif (byte6 = buff.getbyte(index + 6)) < 0x80
5703
- index += 7
5704
- (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
5705
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
5706
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5707
- elsif (byte7 = buff.getbyte(index + 7)) < 0x80
5708
- index += 8
5709
- (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
5710
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
5711
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5712
- elsif (byte8 = buff.getbyte(index + 8)) < 0x80
5713
- index += 9
5714
- (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
5715
- ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
5716
- ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
5717
- ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5718
- elsif (byte9 = buff.getbyte(index + 9)) < 0x80
5719
- index += 10
5752
+ return self if index >= len
5753
+ ## PULL_UINT64
5754
+ tag =
5755
+ if (byte0 = buff.getbyte(index)) < 0x80
5756
+ index += 1
5757
+ byte0
5758
+ elsif (byte1 = buff.getbyte(index + 1)) < 0x80
5759
+ index += 2
5760
+ (byte1 << 7) | (byte0 & 0x7F)
5761
+ elsif (byte2 = buff.getbyte(index + 2)) < 0x80
5762
+ index += 3
5763
+ (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5764
+ elsif (byte3 = buff.getbyte(index + 3)) < 0x80
5765
+ index += 4
5766
+ (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
5767
+ (byte0 & 0x7F)
5768
+ elsif (byte4 = buff.getbyte(index + 4)) < 0x80
5769
+ index += 5
5770
+ (byte4 << 28) | ((byte3 & 0x7F) << 21) |
5771
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
5772
+ (byte0 & 0x7F)
5773
+ elsif (byte5 = buff.getbyte(index + 5)) < 0x80
5774
+ index += 6
5775
+ (byte5 << 35) | ((byte4 & 0x7F) << 28) |
5776
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
5777
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5778
+ elsif (byte6 = buff.getbyte(index + 6)) < 0x80
5779
+ index += 7
5780
+ (byte6 << 42) | ((byte5 & 0x7F) << 35) |
5781
+ ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
5782
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
5783
+ (byte0 & 0x7F)
5784
+ elsif (byte7 = buff.getbyte(index + 7)) < 0x80
5785
+ index += 8
5786
+ (byte7 << 49) | ((byte6 & 0x7F) << 42) |
5787
+ ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
5788
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
5789
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5790
+ elsif (byte8 = buff.getbyte(index + 8)) < 0x80
5791
+ index += 9
5792
+ (byte8 << 56) | ((byte7 & 0x7F) << 49) |
5793
+ ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
5794
+ ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
5795
+ ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) |
5796
+ (byte0 & 0x7F)
5797
+ elsif (byte9 = buff.getbyte(index + 9)) < 0x80
5798
+ index += 10
5720
5799
 
5721
- (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) |
5722
- ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) |
5723
- ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) |
5724
- ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5725
- else
5726
- raise "integer decoding error"
5727
- end
5800
+ (byte9 << 63) | ((byte8 & 0x7F) << 56) |
5801
+ ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) |
5802
+ ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) |
5803
+ ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) |
5804
+ ((byte1 & 0x7F) << 7) | (byte0 & 0x7F)
5805
+ else
5806
+ raise "integer decoding error"
5807
+ end
5728
5808
 
5729
- ## END PULL_UINT64
5809
+ ## END PULL_UINT64
5810
+
5811
+ break unless tag == 0xa8
5812
+ end
5813
+ ## END DECODE REPEATED
5814
+
5815
+ return self if index >= len
5730
5816
  end
5731
5817
  if tag == 0xb0
5732
5818
  found = true
@@ -6555,19 +6641,12 @@ module Api
6555
6641
 
6556
6642
  list = @tech_alias
6557
6643
  if list.size > 0
6558
- buff << 0xaa
6559
- buff << 0x01
6560
-
6561
- # Save the buffer size before appending the repeated bytes
6562
- current_len = buff.bytesize
6563
-
6564
- # Write a single dummy byte to later store encoded length
6565
- buff << 42 # "*"
6566
-
6567
- # write each item
6568
6644
  list.each do |item|
6569
6645
  val = item
6570
6646
  if val != 0
6647
+ buff << 0xa8
6648
+ buff << 0x01
6649
+
6571
6650
  while val != 0
6572
6651
  byte = val & 0x7F
6573
6652
  val >>= 7
@@ -6576,40 +6655,6 @@ module Api
6576
6655
  end
6577
6656
  end
6578
6657
  end
6579
-
6580
- # Calculate the submessage's size
6581
- submessage_size = buff.bytesize - current_len - 1
6582
-
6583
- # Hope the size fits in one byte
6584
- byte = submessage_size & 0x7F
6585
- submessage_size >>= 7
6586
- byte |= 0x80 if submessage_size > 0
6587
- buff.setbyte(current_len, byte)
6588
-
6589
- # If the sub message was bigger
6590
- if submessage_size > 0
6591
- current_len += 1
6592
-
6593
- # compute how much we need to shift
6594
- encoded_int_len = 0
6595
- remaining_size = submessage_size
6596
- while remaining_size != 0
6597
- remaining_size >>= 7
6598
- encoded_int_len += 1
6599
- end
6600
-
6601
- # Make space in the string with dummy bytes
6602
- buff.bytesplice(current_len, 0, "*********", 0, encoded_int_len)
6603
-
6604
- # Overwrite the dummy bytes with the encoded length
6605
- while submessage_size != 0
6606
- byte = submessage_size & 0x7F
6607
- submessage_size >>= 7
6608
- byte |= 0x80 if submessage_size > 0
6609
- buff.setbyte(current_len, byte)
6610
- current_len += 1
6611
- end
6612
- end
6613
6658
  end
6614
6659
 
6615
6660
  val = @unit_alias
@@ -6739,7 +6784,7 @@ module Api
6739
6784
  end
6740
6785
  end
6741
6786
  end
6742
-
6787
+ buff << @_unknown_fields if @_unknown_fields
6743
6788
  buff
6744
6789
  end
6745
6790
 
@@ -7013,20 +7058,38 @@ module Api
7013
7058
  # unexpected, so discard it and continue.
7014
7059
  if !found
7015
7060
  wire_type = tag & 0x7
7061
+
7062
+ unknown_bytes = +"".b
7063
+ val = tag
7064
+ while val != 0
7065
+ byte = val & 0x7F
7066
+
7067
+ val >>= 7
7068
+ # This drops the top bits,
7069
+ # Otherwise, with a signed right shift,
7070
+ # we get infinity one bits at the top
7071
+ val &= (1 << 57) - 1
7072
+
7073
+ byte |= 0x80 if val != 0
7074
+ unknown_bytes << byte
7075
+ end
7076
+
7016
7077
  case wire_type
7017
7078
  when 0
7018
7079
  i = 0
7019
7080
  while true
7020
7081
  newbyte = buff.getbyte(index)
7021
7082
  index += 1
7022
- break if newbyte.nil? || newbyte < 0x80
7083
+ break if newbyte.nil?
7084
+ unknown_bytes << newbyte
7085
+ break if newbyte < 0x80
7023
7086
  i += 1
7024
7087
  break if i > 9
7025
7088
  end
7026
7089
  when 1
7090
+ unknown_bytes << buff.byteslice(index, 8)
7027
7091
  index += 8
7028
7092
  when 2
7029
- ## PULL_BYTES
7030
7093
  value =
7031
7094
  if (byte0 = buff.getbyte(index)) < 0x80
7032
7095
  index += 1
@@ -7082,15 +7145,29 @@ module Api
7082
7145
  raise "integer decoding error"
7083
7146
  end
7084
7147
 
7085
- buff.byteslice(index, value)
7086
- index += value
7148
+ val = value
7149
+ while val != 0
7150
+ byte = val & 0x7F
7087
7151
 
7088
- ## END PULL_BYTES
7152
+ val >>= 7
7153
+ # This drops the top bits,
7154
+ # Otherwise, with a signed right shift,
7155
+ # we get infinity one bits at the top
7156
+ val &= (1 << 57) - 1
7157
+
7158
+ byte |= 0x80 if val != 0
7159
+ unknown_bytes << byte
7160
+ end
7161
+
7162
+ unknown_bytes << buff.byteslice(index, value)
7163
+ index += value
7089
7164
  when 5
7165
+ unknown_bytes << buff.byteslice(index, 4)
7090
7166
  index += 4
7091
7167
  else
7092
7168
  raise "unknown wire type #{wire_type}"
7093
7169
  end
7170
+ (@_unknown_fields ||= +"".b) << unknown_bytes
7094
7171
  return self if index >= len
7095
7172
  ## PULL_UINT64
7096
7173
  tag =
@@ -7819,7 +7896,7 @@ module Api
7819
7896
  buff << byte
7820
7897
  end
7821
7898
  end
7822
-
7899
+ buff << @_unknown_fields if @_unknown_fields
7823
7900
  buff
7824
7901
  end
7825
7902
 
@@ -7967,20 +8044,38 @@ module Api
7967
8044
  # unexpected, so discard it and continue.
7968
8045
  if !found
7969
8046
  wire_type = tag & 0x7
8047
+
8048
+ unknown_bytes = +"".b
8049
+ val = tag
8050
+ while val != 0
8051
+ byte = val & 0x7F
8052
+
8053
+ val >>= 7
8054
+ # This drops the top bits,
8055
+ # Otherwise, with a signed right shift,
8056
+ # we get infinity one bits at the top
8057
+ val &= (1 << 57) - 1
8058
+
8059
+ byte |= 0x80 if val != 0
8060
+ unknown_bytes << byte
8061
+ end
8062
+
7970
8063
  case wire_type
7971
8064
  when 0
7972
8065
  i = 0
7973
8066
  while true
7974
8067
  newbyte = buff.getbyte(index)
7975
8068
  index += 1
7976
- break if newbyte.nil? || newbyte < 0x80
8069
+ break if newbyte.nil?
8070
+ unknown_bytes << newbyte
8071
+ break if newbyte < 0x80
7977
8072
  i += 1
7978
8073
  break if i > 9
7979
8074
  end
7980
8075
  when 1
8076
+ unknown_bytes << buff.byteslice(index, 8)
7981
8077
  index += 8
7982
8078
  when 2
7983
- ## PULL_BYTES
7984
8079
  value =
7985
8080
  if (byte0 = buff.getbyte(index)) < 0x80
7986
8081
  index += 1
@@ -8036,15 +8131,29 @@ module Api
8036
8131
  raise "integer decoding error"
8037
8132
  end
8038
8133
 
8039
- buff.byteslice(index, value)
8040
- index += value
8134
+ val = value
8135
+ while val != 0
8136
+ byte = val & 0x7F
8137
+
8138
+ val >>= 7
8139
+ # This drops the top bits,
8140
+ # Otherwise, with a signed right shift,
8141
+ # we get infinity one bits at the top
8142
+ val &= (1 << 57) - 1
8041
8143
 
8042
- ## END PULL_BYTES
8144
+ byte |= 0x80 if val != 0
8145
+ unknown_bytes << byte
8146
+ end
8147
+
8148
+ unknown_bytes << buff.byteslice(index, value)
8149
+ index += value
8043
8150
  when 5
8151
+ unknown_bytes << buff.byteslice(index, 4)
8044
8152
  index += 4
8045
8153
  else
8046
8154
  raise "unknown wire type #{wire_type}"
8047
8155
  end
8156
+ (@_unknown_fields ||= +"".b) << unknown_bytes
8048
8157
  return self if index >= len
8049
8158
  ## PULL_UINT64
8050
8159
  tag =
@@ -8348,7 +8457,7 @@ module Api
8348
8457
 
8349
8458
  buff << (val.ascii_only? ? val : val.b)
8350
8459
  end
8351
-
8460
+ buff << @_unknown_fields if @_unknown_fields
8352
8461
  buff
8353
8462
  end
8354
8463
 
@@ -8530,20 +8639,38 @@ module Api
8530
8639
  # unexpected, so discard it and continue.
8531
8640
  if !found
8532
8641
  wire_type = tag & 0x7
8642
+
8643
+ unknown_bytes = +"".b
8644
+ val = tag
8645
+ while val != 0
8646
+ byte = val & 0x7F
8647
+
8648
+ val >>= 7
8649
+ # This drops the top bits,
8650
+ # Otherwise, with a signed right shift,
8651
+ # we get infinity one bits at the top
8652
+ val &= (1 << 57) - 1
8653
+
8654
+ byte |= 0x80 if val != 0
8655
+ unknown_bytes << byte
8656
+ end
8657
+
8533
8658
  case wire_type
8534
8659
  when 0
8535
8660
  i = 0
8536
8661
  while true
8537
8662
  newbyte = buff.getbyte(index)
8538
8663
  index += 1
8539
- break if newbyte.nil? || newbyte < 0x80
8664
+ break if newbyte.nil?
8665
+ unknown_bytes << newbyte
8666
+ break if newbyte < 0x80
8540
8667
  i += 1
8541
8668
  break if i > 9
8542
8669
  end
8543
8670
  when 1
8671
+ unknown_bytes << buff.byteslice(index, 8)
8544
8672
  index += 8
8545
8673
  when 2
8546
- ## PULL_BYTES
8547
8674
  value =
8548
8675
  if (byte0 = buff.getbyte(index)) < 0x80
8549
8676
  index += 1
@@ -8599,15 +8726,29 @@ module Api
8599
8726
  raise "integer decoding error"
8600
8727
  end
8601
8728
 
8602
- buff.byteslice(index, value)
8603
- index += value
8729
+ val = value
8730
+ while val != 0
8731
+ byte = val & 0x7F
8604
8732
 
8605
- ## END PULL_BYTES
8733
+ val >>= 7
8734
+ # This drops the top bits,
8735
+ # Otherwise, with a signed right shift,
8736
+ # we get infinity one bits at the top
8737
+ val &= (1 << 57) - 1
8738
+
8739
+ byte |= 0x80 if val != 0
8740
+ unknown_bytes << byte
8741
+ end
8742
+
8743
+ unknown_bytes << buff.byteslice(index, value)
8744
+ index += value
8606
8745
  when 5
8746
+ unknown_bytes << buff.byteslice(index, 4)
8607
8747
  index += 4
8608
8748
  else
8609
8749
  raise "unknown wire type #{wire_type}"
8610
8750
  end
8751
+ (@_unknown_fields ||= +"".b) << unknown_bytes
8611
8752
  return self if index >= len
8612
8753
  ## PULL_UINT64
8613
8754
  tag =
@@ -9101,7 +9242,7 @@ module Api
9101
9242
 
9102
9243
  [val].pack("e", buffer: buff)
9103
9244
  end
9104
-
9245
+ buff << @_unknown_fields if @_unknown_fields
9105
9246
  buff
9106
9247
  end
9107
9248