sc2ai 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -172,20 +172,38 @@ module Api
172
172
  # unexpected, so discard it and continue.
173
173
  if !found
174
174
  wire_type = tag & 0x7
175
+
176
+ unknown_bytes = +"".b
177
+ val = tag
178
+ while val != 0
179
+ byte = val & 0x7F
180
+
181
+ val >>= 7
182
+ # This drops the top bits,
183
+ # Otherwise, with a signed right shift,
184
+ # we get infinity one bits at the top
185
+ val &= (1 << 57) - 1
186
+
187
+ byte |= 0x80 if val != 0
188
+ unknown_bytes << byte
189
+ end
190
+
175
191
  case wire_type
176
192
  when 0
177
193
  i = 0
178
194
  while true
179
195
  newbyte = buff.getbyte(index)
180
196
  index += 1
181
- break if newbyte.nil? || newbyte < 0x80
197
+ break if newbyte.nil?
198
+ unknown_bytes << newbyte
199
+ break if newbyte < 0x80
182
200
  i += 1
183
201
  break if i > 9
184
202
  end
185
203
  when 1
204
+ unknown_bytes << buff.byteslice(index, 8)
186
205
  index += 8
187
206
  when 2
188
- ## PULL_BYTES
189
207
  value =
190
208
  if (byte0 = buff.getbyte(index)) < 0x80
191
209
  index += 1
@@ -241,15 +259,29 @@ module Api
241
259
  raise "integer decoding error"
242
260
  end
243
261
 
244
- buff.byteslice(index, value)
245
- index += value
262
+ val = value
263
+ while val != 0
264
+ byte = val & 0x7F
265
+
266
+ val >>= 7
267
+ # This drops the top bits,
268
+ # Otherwise, with a signed right shift,
269
+ # we get infinity one bits at the top
270
+ val &= (1 << 57) - 1
246
271
 
247
- ## END PULL_BYTES
272
+ byte |= 0x80 if val != 0
273
+ unknown_bytes << byte
274
+ end
275
+
276
+ unknown_bytes << buff.byteslice(index, value)
277
+ index += value
248
278
  when 5
279
+ unknown_bytes << buff.byteslice(index, 4)
249
280
  index += 4
250
281
  else
251
282
  raise "unknown wire type #{wire_type}"
252
283
  end
284
+ (@_unknown_fields ||= +"".b) << unknown_bytes
253
285
  return self if index >= len
254
286
  ## PULL_UINT64
255
287
  tag =
@@ -519,7 +551,7 @@ module Api
519
551
  else
520
552
  raise "bool values should be true or false"
521
553
  end
522
-
554
+ buff << @_unknown_fields if @_unknown_fields
523
555
  buff
524
556
  end
525
557
 
@@ -683,20 +715,38 @@ module Api
683
715
  # unexpected, so discard it and continue.
684
716
  if !found
685
717
  wire_type = tag & 0x7
718
+
719
+ unknown_bytes = +"".b
720
+ val = tag
721
+ while val != 0
722
+ byte = val & 0x7F
723
+
724
+ val >>= 7
725
+ # This drops the top bits,
726
+ # Otherwise, with a signed right shift,
727
+ # we get infinity one bits at the top
728
+ val &= (1 << 57) - 1
729
+
730
+ byte |= 0x80 if val != 0
731
+ unknown_bytes << byte
732
+ end
733
+
686
734
  case wire_type
687
735
  when 0
688
736
  i = 0
689
737
  while true
690
738
  newbyte = buff.getbyte(index)
691
739
  index += 1
692
- break if newbyte.nil? || newbyte < 0x80
740
+ break if newbyte.nil?
741
+ unknown_bytes << newbyte
742
+ break if newbyte < 0x80
693
743
  i += 1
694
744
  break if i > 9
695
745
  end
696
746
  when 1
747
+ unknown_bytes << buff.byteslice(index, 8)
697
748
  index += 8
698
749
  when 2
699
- ## PULL_BYTES
700
750
  value =
701
751
  if (byte0 = buff.getbyte(index)) < 0x80
702
752
  index += 1
@@ -752,15 +802,29 @@ module Api
752
802
  raise "integer decoding error"
753
803
  end
754
804
 
755
- buff.byteslice(index, value)
756
- index += value
805
+ val = value
806
+ while val != 0
807
+ byte = val & 0x7F
808
+
809
+ val >>= 7
810
+ # This drops the top bits,
811
+ # Otherwise, with a signed right shift,
812
+ # we get infinity one bits at the top
813
+ val &= (1 << 57) - 1
814
+
815
+ byte |= 0x80 if val != 0
816
+ unknown_bytes << byte
817
+ end
757
818
 
758
- ## END PULL_BYTES
819
+ unknown_bytes << buff.byteslice(index, value)
820
+ index += value
759
821
  when 5
822
+ unknown_bytes << buff.byteslice(index, 4)
760
823
  index += 4
761
824
  else
762
825
  raise "unknown wire type #{wire_type}"
763
826
  end
827
+ (@_unknown_fields ||= +"".b) << unknown_bytes
764
828
  return self if index >= len
765
829
  ## PULL_UINT64
766
830
  tag =
@@ -1244,7 +1308,7 @@ module Api
1244
1308
 
1245
1309
  buff.concat(val.b)
1246
1310
  end
1247
-
1311
+ buff << @_unknown_fields if @_unknown_fields
1248
1312
  buff
1249
1313
  end
1250
1314
 
@@ -1398,20 +1462,38 @@ module Api
1398
1462
  # unexpected, so discard it and continue.
1399
1463
  if !found
1400
1464
  wire_type = tag & 0x7
1465
+
1466
+ unknown_bytes = +"".b
1467
+ val = tag
1468
+ while val != 0
1469
+ byte = val & 0x7F
1470
+
1471
+ val >>= 7
1472
+ # This drops the top bits,
1473
+ # Otherwise, with a signed right shift,
1474
+ # we get infinity one bits at the top
1475
+ val &= (1 << 57) - 1
1476
+
1477
+ byte |= 0x80 if val != 0
1478
+ unknown_bytes << byte
1479
+ end
1480
+
1401
1481
  case wire_type
1402
1482
  when 0
1403
1483
  i = 0
1404
1484
  while true
1405
1485
  newbyte = buff.getbyte(index)
1406
1486
  index += 1
1407
- break if newbyte.nil? || newbyte < 0x80
1487
+ break if newbyte.nil?
1488
+ unknown_bytes << newbyte
1489
+ break if newbyte < 0x80
1408
1490
  i += 1
1409
1491
  break if i > 9
1410
1492
  end
1411
1493
  when 1
1494
+ unknown_bytes << buff.byteslice(index, 8)
1412
1495
  index += 8
1413
1496
  when 2
1414
- ## PULL_BYTES
1415
1497
  value =
1416
1498
  if (byte0 = buff.getbyte(index)) < 0x80
1417
1499
  index += 1
@@ -1467,15 +1549,29 @@ module Api
1467
1549
  raise "integer decoding error"
1468
1550
  end
1469
1551
 
1470
- buff.byteslice(index, value)
1471
- index += value
1552
+ val = value
1553
+ while val != 0
1554
+ byte = val & 0x7F
1472
1555
 
1473
- ## END PULL_BYTES
1556
+ val >>= 7
1557
+ # This drops the top bits,
1558
+ # Otherwise, with a signed right shift,
1559
+ # we get infinity one bits at the top
1560
+ val &= (1 << 57) - 1
1561
+
1562
+ byte |= 0x80 if val != 0
1563
+ unknown_bytes << byte
1564
+ end
1565
+
1566
+ unknown_bytes << buff.byteslice(index, value)
1567
+ index += value
1474
1568
  when 5
1569
+ unknown_bytes << buff.byteslice(index, 4)
1475
1570
  index += 4
1476
1571
  else
1477
1572
  raise "unknown wire type #{wire_type}"
1478
1573
  end
1574
+ (@_unknown_fields ||= +"".b) << unknown_bytes
1479
1575
  return self if index >= len
1480
1576
  ## PULL_UINT64
1481
1577
  tag =
@@ -1811,7 +1907,7 @@ module Api
1811
1907
  buff << byte
1812
1908
  end
1813
1909
  end
1814
-
1910
+ buff << @_unknown_fields if @_unknown_fields
1815
1911
  buff
1816
1912
  end
1817
1913
 
@@ -1946,20 +2042,38 @@ module Api
1946
2042
  # unexpected, so discard it and continue.
1947
2043
  if !found
1948
2044
  wire_type = tag & 0x7
2045
+
2046
+ unknown_bytes = +"".b
2047
+ val = tag
2048
+ while val != 0
2049
+ byte = val & 0x7F
2050
+
2051
+ val >>= 7
2052
+ # This drops the top bits,
2053
+ # Otherwise, with a signed right shift,
2054
+ # we get infinity one bits at the top
2055
+ val &= (1 << 57) - 1
2056
+
2057
+ byte |= 0x80 if val != 0
2058
+ unknown_bytes << byte
2059
+ end
2060
+
1949
2061
  case wire_type
1950
2062
  when 0
1951
2063
  i = 0
1952
2064
  while true
1953
2065
  newbyte = buff.getbyte(index)
1954
2066
  index += 1
1955
- break if newbyte.nil? || newbyte < 0x80
2067
+ break if newbyte.nil?
2068
+ unknown_bytes << newbyte
2069
+ break if newbyte < 0x80
1956
2070
  i += 1
1957
2071
  break if i > 9
1958
2072
  end
1959
2073
  when 1
2074
+ unknown_bytes << buff.byteslice(index, 8)
1960
2075
  index += 8
1961
2076
  when 2
1962
- ## PULL_BYTES
1963
2077
  value =
1964
2078
  if (byte0 = buff.getbyte(index)) < 0x80
1965
2079
  index += 1
@@ -2015,15 +2129,29 @@ module Api
2015
2129
  raise "integer decoding error"
2016
2130
  end
2017
2131
 
2018
- buff.byteslice(index, value)
2019
- index += value
2132
+ val = value
2133
+ while val != 0
2134
+ byte = val & 0x7F
2020
2135
 
2021
- ## END PULL_BYTES
2136
+ val >>= 7
2137
+ # This drops the top bits,
2138
+ # Otherwise, with a signed right shift,
2139
+ # we get infinity one bits at the top
2140
+ val &= (1 << 57) - 1
2141
+
2142
+ byte |= 0x80 if val != 0
2143
+ unknown_bytes << byte
2144
+ end
2145
+
2146
+ unknown_bytes << buff.byteslice(index, value)
2147
+ index += value
2022
2148
  when 5
2149
+ unknown_bytes << buff.byteslice(index, 4)
2023
2150
  index += 4
2024
2151
  else
2025
2152
  raise "unknown wire type #{wire_type}"
2026
2153
  end
2154
+ (@_unknown_fields ||= +"".b) << unknown_bytes
2027
2155
  return self if index >= len
2028
2156
  ## PULL_UINT64
2029
2157
  tag =
@@ -2403,7 +2531,7 @@ module Api
2403
2531
 
2404
2532
  buff
2405
2533
  end
2406
-
2534
+ buff << @_unknown_fields if @_unknown_fields
2407
2535
  buff
2408
2536
  end
2409
2537
 
@@ -2538,20 +2666,38 @@ module Api
2538
2666
  # unexpected, so discard it and continue.
2539
2667
  if !found
2540
2668
  wire_type = tag & 0x7
2669
+
2670
+ unknown_bytes = +"".b
2671
+ val = tag
2672
+ while val != 0
2673
+ byte = val & 0x7F
2674
+
2675
+ val >>= 7
2676
+ # This drops the top bits,
2677
+ # Otherwise, with a signed right shift,
2678
+ # we get infinity one bits at the top
2679
+ val &= (1 << 57) - 1
2680
+
2681
+ byte |= 0x80 if val != 0
2682
+ unknown_bytes << byte
2683
+ end
2684
+
2541
2685
  case wire_type
2542
2686
  when 0
2543
2687
  i = 0
2544
2688
  while true
2545
2689
  newbyte = buff.getbyte(index)
2546
2690
  index += 1
2547
- break if newbyte.nil? || newbyte < 0x80
2691
+ break if newbyte.nil?
2692
+ unknown_bytes << newbyte
2693
+ break if newbyte < 0x80
2548
2694
  i += 1
2549
2695
  break if i > 9
2550
2696
  end
2551
2697
  when 1
2698
+ unknown_bytes << buff.byteslice(index, 8)
2552
2699
  index += 8
2553
2700
  when 2
2554
- ## PULL_BYTES
2555
2701
  value =
2556
2702
  if (byte0 = buff.getbyte(index)) < 0x80
2557
2703
  index += 1
@@ -2607,15 +2753,29 @@ module Api
2607
2753
  raise "integer decoding error"
2608
2754
  end
2609
2755
 
2610
- buff.byteslice(index, value)
2611
- index += value
2756
+ val = value
2757
+ while val != 0
2758
+ byte = val & 0x7F
2759
+
2760
+ val >>= 7
2761
+ # This drops the top bits,
2762
+ # Otherwise, with a signed right shift,
2763
+ # we get infinity one bits at the top
2764
+ val &= (1 << 57) - 1
2612
2765
 
2613
- ## END PULL_BYTES
2766
+ byte |= 0x80 if val != 0
2767
+ unknown_bytes << byte
2768
+ end
2769
+
2770
+ unknown_bytes << buff.byteslice(index, value)
2771
+ index += value
2614
2772
  when 5
2773
+ unknown_bytes << buff.byteslice(index, 4)
2615
2774
  index += 4
2616
2775
  else
2617
2776
  raise "unknown wire type #{wire_type}"
2618
2777
  end
2778
+ (@_unknown_fields ||= +"".b) << unknown_bytes
2619
2779
  return self if index >= len
2620
2780
  ## PULL_UINT64
2621
2781
  tag =
@@ -2805,7 +2965,7 @@ module Api
2805
2965
 
2806
2966
  [val].pack("e", buffer: buff)
2807
2967
  end
2808
-
2968
+ buff << @_unknown_fields if @_unknown_fields
2809
2969
  buff
2810
2970
  end
2811
2971
 
@@ -2959,20 +3119,38 @@ module Api
2959
3119
  # unexpected, so discard it and continue.
2960
3120
  if !found
2961
3121
  wire_type = tag & 0x7
3122
+
3123
+ unknown_bytes = +"".b
3124
+ val = tag
3125
+ while val != 0
3126
+ byte = val & 0x7F
3127
+
3128
+ val >>= 7
3129
+ # This drops the top bits,
3130
+ # Otherwise, with a signed right shift,
3131
+ # we get infinity one bits at the top
3132
+ val &= (1 << 57) - 1
3133
+
3134
+ byte |= 0x80 if val != 0
3135
+ unknown_bytes << byte
3136
+ end
3137
+
2962
3138
  case wire_type
2963
3139
  when 0
2964
3140
  i = 0
2965
3141
  while true
2966
3142
  newbyte = buff.getbyte(index)
2967
3143
  index += 1
2968
- break if newbyte.nil? || newbyte < 0x80
3144
+ break if newbyte.nil?
3145
+ unknown_bytes << newbyte
3146
+ break if newbyte < 0x80
2969
3147
  i += 1
2970
3148
  break if i > 9
2971
3149
  end
2972
3150
  when 1
3151
+ unknown_bytes << buff.byteslice(index, 8)
2973
3152
  index += 8
2974
3153
  when 2
2975
- ## PULL_BYTES
2976
3154
  value =
2977
3155
  if (byte0 = buff.getbyte(index)) < 0x80
2978
3156
  index += 1
@@ -3028,15 +3206,29 @@ module Api
3028
3206
  raise "integer decoding error"
3029
3207
  end
3030
3208
 
3031
- buff.byteslice(index, value)
3032
- index += value
3209
+ val = value
3210
+ while val != 0
3211
+ byte = val & 0x7F
3212
+
3213
+ val >>= 7
3214
+ # This drops the top bits,
3215
+ # Otherwise, with a signed right shift,
3216
+ # we get infinity one bits at the top
3217
+ val &= (1 << 57) - 1
3218
+
3219
+ byte |= 0x80 if val != 0
3220
+ unknown_bytes << byte
3221
+ end
3033
3222
 
3034
- ## END PULL_BYTES
3223
+ unknown_bytes << buff.byteslice(index, value)
3224
+ index += value
3035
3225
  when 5
3226
+ unknown_bytes << buff.byteslice(index, 4)
3036
3227
  index += 4
3037
3228
  else
3038
3229
  raise "unknown wire type #{wire_type}"
3039
3230
  end
3231
+ (@_unknown_fields ||= +"".b) << unknown_bytes
3040
3232
  return self if index >= len
3041
3233
  ## PULL_UINT64
3042
3234
  tag =
@@ -3291,7 +3483,7 @@ module Api
3291
3483
 
3292
3484
  [val].pack("e", buffer: buff)
3293
3485
  end
3294
-
3486
+ buff << @_unknown_fields if @_unknown_fields
3295
3487
  buff
3296
3488
  end
3297
3489
 
@@ -3445,20 +3637,38 @@ module Api
3445
3637
  # unexpected, so discard it and continue.
3446
3638
  if !found
3447
3639
  wire_type = tag & 0x7
3640
+
3641
+ unknown_bytes = +"".b
3642
+ val = tag
3643
+ while val != 0
3644
+ byte = val & 0x7F
3645
+
3646
+ val >>= 7
3647
+ # This drops the top bits,
3648
+ # Otherwise, with a signed right shift,
3649
+ # we get infinity one bits at the top
3650
+ val &= (1 << 57) - 1
3651
+
3652
+ byte |= 0x80 if val != 0
3653
+ unknown_bytes << byte
3654
+ end
3655
+
3448
3656
  case wire_type
3449
3657
  when 0
3450
3658
  i = 0
3451
3659
  while true
3452
3660
  newbyte = buff.getbyte(index)
3453
3661
  index += 1
3454
- break if newbyte.nil? || newbyte < 0x80
3662
+ break if newbyte.nil?
3663
+ unknown_bytes << newbyte
3664
+ break if newbyte < 0x80
3455
3665
  i += 1
3456
3666
  break if i > 9
3457
3667
  end
3458
3668
  when 1
3669
+ unknown_bytes << buff.byteslice(index, 8)
3459
3670
  index += 8
3460
3671
  when 2
3461
- ## PULL_BYTES
3462
3672
  value =
3463
3673
  if (byte0 = buff.getbyte(index)) < 0x80
3464
3674
  index += 1
@@ -3514,15 +3724,29 @@ module Api
3514
3724
  raise "integer decoding error"
3515
3725
  end
3516
3726
 
3517
- buff.byteslice(index, value)
3518
- index += value
3727
+ val = value
3728
+ while val != 0
3729
+ byte = val & 0x7F
3730
+
3731
+ val >>= 7
3732
+ # This drops the top bits,
3733
+ # Otherwise, with a signed right shift,
3734
+ # we get infinity one bits at the top
3735
+ val &= (1 << 57) - 1
3519
3736
 
3520
- ## END PULL_BYTES
3737
+ byte |= 0x80 if val != 0
3738
+ unknown_bytes << byte
3739
+ end
3740
+
3741
+ unknown_bytes << buff.byteslice(index, value)
3742
+ index += value
3521
3743
  when 5
3744
+ unknown_bytes << buff.byteslice(index, 4)
3522
3745
  index += 4
3523
3746
  else
3524
3747
  raise "unknown wire type #{wire_type}"
3525
3748
  end
3749
+ (@_unknown_fields ||= +"".b) << unknown_bytes
3526
3750
  return self if index >= len
3527
3751
  ## PULL_UINT64
3528
3752
  tag =
@@ -3858,7 +4082,7 @@ module Api
3858
4082
  buff << byte
3859
4083
  end
3860
4084
  end
3861
-
4085
+ buff << @_unknown_fields if @_unknown_fields
3862
4086
  buff
3863
4087
  end
3864
4088