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.
@@ -140,20 +140,38 @@ module Api
140
140
  # unexpected, so discard it and continue.
141
141
  if !found
142
142
  wire_type = tag & 0x7
143
+
144
+ unknown_bytes = +"".b
145
+ val = tag
146
+ while val != 0
147
+ byte = val & 0x7F
148
+
149
+ val >>= 7
150
+ # This drops the top bits,
151
+ # Otherwise, with a signed right shift,
152
+ # we get infinity one bits at the top
153
+ val &= (1 << 57) - 1
154
+
155
+ byte |= 0x80 if val != 0
156
+ unknown_bytes << byte
157
+ end
158
+
143
159
  case wire_type
144
160
  when 0
145
161
  i = 0
146
162
  while true
147
163
  newbyte = buff.getbyte(index)
148
164
  index += 1
149
- break if newbyte.nil? || newbyte < 0x80
165
+ break if newbyte.nil?
166
+ unknown_bytes << newbyte
167
+ break if newbyte < 0x80
150
168
  i += 1
151
169
  break if i > 9
152
170
  end
153
171
  when 1
172
+ unknown_bytes << buff.byteslice(index, 8)
154
173
  index += 8
155
174
  when 2
156
- ## PULL_BYTES
157
175
  value =
158
176
  if (byte0 = buff.getbyte(index)) < 0x80
159
177
  index += 1
@@ -209,15 +227,29 @@ module Api
209
227
  raise "integer decoding error"
210
228
  end
211
229
 
212
- buff.byteslice(index, value)
213
- index += value
230
+ val = value
231
+ while val != 0
232
+ byte = val & 0x7F
214
233
 
215
- ## END PULL_BYTES
234
+ val >>= 7
235
+ # This drops the top bits,
236
+ # Otherwise, with a signed right shift,
237
+ # we get infinity one bits at the top
238
+ val &= (1 << 57) - 1
239
+
240
+ byte |= 0x80 if val != 0
241
+ unknown_bytes << byte
242
+ end
243
+
244
+ unknown_bytes << buff.byteslice(index, value)
245
+ index += value
216
246
  when 5
247
+ unknown_bytes << buff.byteslice(index, 4)
217
248
  index += 4
218
249
  else
219
250
  raise "unknown wire type #{wire_type}"
220
251
  end
252
+ (@_unknown_fields ||= +"".b) << unknown_bytes
221
253
  return self if index >= len
222
254
  ## PULL_UINT64
223
255
  tag =
@@ -916,7 +948,7 @@ module Api
916
948
  else
917
949
  raise "bool values should be true or false"
918
950
  end
919
-
951
+ buff << @_unknown_fields if @_unknown_fields
920
952
  buff
921
953
  end
922
954
 
@@ -1035,20 +1067,38 @@ module Api
1035
1067
  # unexpected, so discard it and continue.
1036
1068
  if !found
1037
1069
  wire_type = tag & 0x7
1070
+
1071
+ unknown_bytes = +"".b
1072
+ val = tag
1073
+ while val != 0
1074
+ byte = val & 0x7F
1075
+
1076
+ val >>= 7
1077
+ # This drops the top bits,
1078
+ # Otherwise, with a signed right shift,
1079
+ # we get infinity one bits at the top
1080
+ val &= (1 << 57) - 1
1081
+
1082
+ byte |= 0x80 if val != 0
1083
+ unknown_bytes << byte
1084
+ end
1085
+
1038
1086
  case wire_type
1039
1087
  when 0
1040
1088
  i = 0
1041
1089
  while true
1042
1090
  newbyte = buff.getbyte(index)
1043
1091
  index += 1
1044
- break if newbyte.nil? || newbyte < 0x80
1092
+ break if newbyte.nil?
1093
+ unknown_bytes << newbyte
1094
+ break if newbyte < 0x80
1045
1095
  i += 1
1046
1096
  break if i > 9
1047
1097
  end
1048
1098
  when 1
1099
+ unknown_bytes << buff.byteslice(index, 8)
1049
1100
  index += 8
1050
1101
  when 2
1051
- ## PULL_BYTES
1052
1102
  value =
1053
1103
  if (byte0 = buff.getbyte(index)) < 0x80
1054
1104
  index += 1
@@ -1104,15 +1154,29 @@ module Api
1104
1154
  raise "integer decoding error"
1105
1155
  end
1106
1156
 
1107
- buff.byteslice(index, value)
1108
- index += value
1157
+ val = value
1158
+ while val != 0
1159
+ byte = val & 0x7F
1109
1160
 
1110
- ## END PULL_BYTES
1161
+ val >>= 7
1162
+ # This drops the top bits,
1163
+ # Otherwise, with a signed right shift,
1164
+ # we get infinity one bits at the top
1165
+ val &= (1 << 57) - 1
1166
+
1167
+ byte |= 0x80 if val != 0
1168
+ unknown_bytes << byte
1169
+ end
1170
+
1171
+ unknown_bytes << buff.byteslice(index, value)
1172
+ index += value
1111
1173
  when 5
1174
+ unknown_bytes << buff.byteslice(index, 4)
1112
1175
  index += 4
1113
1176
  else
1114
1177
  raise "unknown wire type #{wire_type}"
1115
1178
  end
1179
+ (@_unknown_fields ||= +"".b) << unknown_bytes
1116
1180
  return self if index >= len
1117
1181
  ## PULL_UINT64
1118
1182
  tag =
@@ -1739,7 +1803,7 @@ module Api
1739
1803
  end
1740
1804
  end
1741
1805
  end
1742
-
1806
+ buff << @_unknown_fields if @_unknown_fields
1743
1807
  buff
1744
1808
  end
1745
1809
 
@@ -1904,20 +1968,38 @@ module Api
1904
1968
  # unexpected, so discard it and continue.
1905
1969
  if !found
1906
1970
  wire_type = tag & 0x7
1971
+
1972
+ unknown_bytes = +"".b
1973
+ val = tag
1974
+ while val != 0
1975
+ byte = val & 0x7F
1976
+
1977
+ val >>= 7
1978
+ # This drops the top bits,
1979
+ # Otherwise, with a signed right shift,
1980
+ # we get infinity one bits at the top
1981
+ val &= (1 << 57) - 1
1982
+
1983
+ byte |= 0x80 if val != 0
1984
+ unknown_bytes << byte
1985
+ end
1986
+
1907
1987
  case wire_type
1908
1988
  when 0
1909
1989
  i = 0
1910
1990
  while true
1911
1991
  newbyte = buff.getbyte(index)
1912
1992
  index += 1
1913
- break if newbyte.nil? || newbyte < 0x80
1993
+ break if newbyte.nil?
1994
+ unknown_bytes << newbyte
1995
+ break if newbyte < 0x80
1914
1996
  i += 1
1915
1997
  break if i > 9
1916
1998
  end
1917
1999
  when 1
2000
+ unknown_bytes << buff.byteslice(index, 8)
1918
2001
  index += 8
1919
2002
  when 2
1920
- ## PULL_BYTES
1921
2003
  value =
1922
2004
  if (byte0 = buff.getbyte(index)) < 0x80
1923
2005
  index += 1
@@ -1973,15 +2055,29 @@ module Api
1973
2055
  raise "integer decoding error"
1974
2056
  end
1975
2057
 
1976
- buff.byteslice(index, value)
1977
- index += value
2058
+ val = value
2059
+ while val != 0
2060
+ byte = val & 0x7F
1978
2061
 
1979
- ## END PULL_BYTES
2062
+ val >>= 7
2063
+ # This drops the top bits,
2064
+ # Otherwise, with a signed right shift,
2065
+ # we get infinity one bits at the top
2066
+ val &= (1 << 57) - 1
2067
+
2068
+ byte |= 0x80 if val != 0
2069
+ unknown_bytes << byte
2070
+ end
2071
+
2072
+ unknown_bytes << buff.byteslice(index, value)
2073
+ index += value
1980
2074
  when 5
2075
+ unknown_bytes << buff.byteslice(index, 4)
1981
2076
  index += 4
1982
2077
  else
1983
2078
  raise "unknown wire type #{wire_type}"
1984
2079
  end
2080
+ (@_unknown_fields ||= +"".b) << unknown_bytes
1985
2081
  return self if index >= len
1986
2082
  ## PULL_UINT64
1987
2083
  tag =
@@ -2483,7 +2579,7 @@ module Api
2483
2579
 
2484
2580
  buff
2485
2581
  end
2486
-
2582
+ buff << @_unknown_fields if @_unknown_fields
2487
2583
  buff
2488
2584
  end
2489
2585
 
@@ -2599,20 +2695,38 @@ module Api
2599
2695
  # unexpected, so discard it and continue.
2600
2696
  if !found
2601
2697
  wire_type = tag & 0x7
2698
+
2699
+ unknown_bytes = +"".b
2700
+ val = tag
2701
+ while val != 0
2702
+ byte = val & 0x7F
2703
+
2704
+ val >>= 7
2705
+ # This drops the top bits,
2706
+ # Otherwise, with a signed right shift,
2707
+ # we get infinity one bits at the top
2708
+ val &= (1 << 57) - 1
2709
+
2710
+ byte |= 0x80 if val != 0
2711
+ unknown_bytes << byte
2712
+ end
2713
+
2602
2714
  case wire_type
2603
2715
  when 0
2604
2716
  i = 0
2605
2717
  while true
2606
2718
  newbyte = buff.getbyte(index)
2607
2719
  index += 1
2608
- break if newbyte.nil? || newbyte < 0x80
2720
+ break if newbyte.nil?
2721
+ unknown_bytes << newbyte
2722
+ break if newbyte < 0x80
2609
2723
  i += 1
2610
2724
  break if i > 9
2611
2725
  end
2612
2726
  when 1
2727
+ unknown_bytes << buff.byteslice(index, 8)
2613
2728
  index += 8
2614
2729
  when 2
2615
- ## PULL_BYTES
2616
2730
  value =
2617
2731
  if (byte0 = buff.getbyte(index)) < 0x80
2618
2732
  index += 1
@@ -2668,15 +2782,29 @@ module Api
2668
2782
  raise "integer decoding error"
2669
2783
  end
2670
2784
 
2671
- buff.byteslice(index, value)
2672
- index += value
2785
+ val = value
2786
+ while val != 0
2787
+ byte = val & 0x7F
2673
2788
 
2674
- ## END PULL_BYTES
2789
+ val >>= 7
2790
+ # This drops the top bits,
2791
+ # Otherwise, with a signed right shift,
2792
+ # we get infinity one bits at the top
2793
+ val &= (1 << 57) - 1
2794
+
2795
+ byte |= 0x80 if val != 0
2796
+ unknown_bytes << byte
2797
+ end
2798
+
2799
+ unknown_bytes << buff.byteslice(index, value)
2800
+ index += value
2675
2801
  when 5
2802
+ unknown_bytes << buff.byteslice(index, 4)
2676
2803
  index += 4
2677
2804
  else
2678
2805
  raise "unknown wire type #{wire_type}"
2679
2806
  end
2807
+ (@_unknown_fields ||= +"".b) << unknown_bytes
2680
2808
  return self if index >= len
2681
2809
  ## PULL_UINT64
2682
2810
  tag =
@@ -2801,7 +2929,7 @@ module Api
2801
2929
 
2802
2930
  [val].pack("e", buffer: buff)
2803
2931
  end
2804
-
2932
+ buff << @_unknown_fields if @_unknown_fields
2805
2933
  buff
2806
2934
  end
2807
2935
 
@@ -2925,20 +3053,38 @@ module Api
2925
3053
  # unexpected, so discard it and continue.
2926
3054
  if !found
2927
3055
  wire_type = tag & 0x7
3056
+
3057
+ unknown_bytes = +"".b
3058
+ val = tag
3059
+ while val != 0
3060
+ byte = val & 0x7F
3061
+
3062
+ val >>= 7
3063
+ # This drops the top bits,
3064
+ # Otherwise, with a signed right shift,
3065
+ # we get infinity one bits at the top
3066
+ val &= (1 << 57) - 1
3067
+
3068
+ byte |= 0x80 if val != 0
3069
+ unknown_bytes << byte
3070
+ end
3071
+
2928
3072
  case wire_type
2929
3073
  when 0
2930
3074
  i = 0
2931
3075
  while true
2932
3076
  newbyte = buff.getbyte(index)
2933
3077
  index += 1
2934
- break if newbyte.nil? || newbyte < 0x80
3078
+ break if newbyte.nil?
3079
+ unknown_bytes << newbyte
3080
+ break if newbyte < 0x80
2935
3081
  i += 1
2936
3082
  break if i > 9
2937
3083
  end
2938
3084
  when 1
3085
+ unknown_bytes << buff.byteslice(index, 8)
2939
3086
  index += 8
2940
3087
  when 2
2941
- ## PULL_BYTES
2942
3088
  value =
2943
3089
  if (byte0 = buff.getbyte(index)) < 0x80
2944
3090
  index += 1
@@ -2994,15 +3140,29 @@ module Api
2994
3140
  raise "integer decoding error"
2995
3141
  end
2996
3142
 
2997
- buff.byteslice(index, value)
2998
- index += value
3143
+ val = value
3144
+ while val != 0
3145
+ byte = val & 0x7F
2999
3146
 
3000
- ## END PULL_BYTES
3147
+ val >>= 7
3148
+ # This drops the top bits,
3149
+ # Otherwise, with a signed right shift,
3150
+ # we get infinity one bits at the top
3151
+ val &= (1 << 57) - 1
3152
+
3153
+ byte |= 0x80 if val != 0
3154
+ unknown_bytes << byte
3155
+ end
3156
+
3157
+ unknown_bytes << buff.byteslice(index, value)
3158
+ index += value
3001
3159
  when 5
3160
+ unknown_bytes << buff.byteslice(index, 4)
3002
3161
  index += 4
3003
3162
  else
3004
3163
  raise "unknown wire type #{wire_type}"
3005
3164
  end
3165
+ (@_unknown_fields ||= +"".b) << unknown_bytes
3006
3166
  return self if index >= len
3007
3167
  ## PULL_UINT64
3008
3168
  tag =
@@ -3182,7 +3342,7 @@ module Api
3182
3342
  buff << byte
3183
3343
  end
3184
3344
  end
3185
-
3345
+ buff << @_unknown_fields if @_unknown_fields
3186
3346
  buff
3187
3347
  end
3188
3348
 
@@ -3343,20 +3503,38 @@ module Api
3343
3503
  # unexpected, so discard it and continue.
3344
3504
  if !found
3345
3505
  wire_type = tag & 0x7
3506
+
3507
+ unknown_bytes = +"".b
3508
+ val = tag
3509
+ while val != 0
3510
+ byte = val & 0x7F
3511
+
3512
+ val >>= 7
3513
+ # This drops the top bits,
3514
+ # Otherwise, with a signed right shift,
3515
+ # we get infinity one bits at the top
3516
+ val &= (1 << 57) - 1
3517
+
3518
+ byte |= 0x80 if val != 0
3519
+ unknown_bytes << byte
3520
+ end
3521
+
3346
3522
  case wire_type
3347
3523
  when 0
3348
3524
  i = 0
3349
3525
  while true
3350
3526
  newbyte = buff.getbyte(index)
3351
3527
  index += 1
3352
- break if newbyte.nil? || newbyte < 0x80
3528
+ break if newbyte.nil?
3529
+ unknown_bytes << newbyte
3530
+ break if newbyte < 0x80
3353
3531
  i += 1
3354
3532
  break if i > 9
3355
3533
  end
3356
3534
  when 1
3535
+ unknown_bytes << buff.byteslice(index, 8)
3357
3536
  index += 8
3358
3537
  when 2
3359
- ## PULL_BYTES
3360
3538
  value =
3361
3539
  if (byte0 = buff.getbyte(index)) < 0x80
3362
3540
  index += 1
@@ -3412,15 +3590,29 @@ module Api
3412
3590
  raise "integer decoding error"
3413
3591
  end
3414
3592
 
3415
- buff.byteslice(index, value)
3416
- index += value
3593
+ val = value
3594
+ while val != 0
3595
+ byte = val & 0x7F
3417
3596
 
3418
- ## END PULL_BYTES
3597
+ val >>= 7
3598
+ # This drops the top bits,
3599
+ # Otherwise, with a signed right shift,
3600
+ # we get infinity one bits at the top
3601
+ val &= (1 << 57) - 1
3602
+
3603
+ byte |= 0x80 if val != 0
3604
+ unknown_bytes << byte
3605
+ end
3606
+
3607
+ unknown_bytes << buff.byteslice(index, value)
3608
+ index += value
3419
3609
  when 5
3610
+ unknown_bytes << buff.byteslice(index, 4)
3420
3611
  index += 4
3421
3612
  else
3422
3613
  raise "unknown wire type #{wire_type}"
3423
3614
  end
3615
+ (@_unknown_fields ||= +"".b) << unknown_bytes
3424
3616
  return self if index >= len
3425
3617
  ## PULL_UINT64
3426
3618
  tag =
@@ -3909,7 +4101,7 @@ module Api
3909
4101
  buff << byte
3910
4102
  end
3911
4103
  end
3912
-
4104
+ buff << @_unknown_fields if @_unknown_fields
3913
4105
  buff
3914
4106
  end
3915
4107
 
@@ -4083,20 +4275,38 @@ module Api
4083
4275
  # unexpected, so discard it and continue.
4084
4276
  if !found
4085
4277
  wire_type = tag & 0x7
4278
+
4279
+ unknown_bytes = +"".b
4280
+ val = tag
4281
+ while val != 0
4282
+ byte = val & 0x7F
4283
+
4284
+ val >>= 7
4285
+ # This drops the top bits,
4286
+ # Otherwise, with a signed right shift,
4287
+ # we get infinity one bits at the top
4288
+ val &= (1 << 57) - 1
4289
+
4290
+ byte |= 0x80 if val != 0
4291
+ unknown_bytes << byte
4292
+ end
4293
+
4086
4294
  case wire_type
4087
4295
  when 0
4088
4296
  i = 0
4089
4297
  while true
4090
4298
  newbyte = buff.getbyte(index)
4091
4299
  index += 1
4092
- break if newbyte.nil? || newbyte < 0x80
4300
+ break if newbyte.nil?
4301
+ unknown_bytes << newbyte
4302
+ break if newbyte < 0x80
4093
4303
  i += 1
4094
4304
  break if i > 9
4095
4305
  end
4096
4306
  when 1
4307
+ unknown_bytes << buff.byteslice(index, 8)
4097
4308
  index += 8
4098
4309
  when 2
4099
- ## PULL_BYTES
4100
4310
  value =
4101
4311
  if (byte0 = buff.getbyte(index)) < 0x80
4102
4312
  index += 1
@@ -4152,15 +4362,29 @@ module Api
4152
4362
  raise "integer decoding error"
4153
4363
  end
4154
4364
 
4155
- buff.byteslice(index, value)
4156
- index += value
4365
+ val = value
4366
+ while val != 0
4367
+ byte = val & 0x7F
4157
4368
 
4158
- ## END PULL_BYTES
4369
+ val >>= 7
4370
+ # This drops the top bits,
4371
+ # Otherwise, with a signed right shift,
4372
+ # we get infinity one bits at the top
4373
+ val &= (1 << 57) - 1
4374
+
4375
+ byte |= 0x80 if val != 0
4376
+ unknown_bytes << byte
4377
+ end
4378
+
4379
+ unknown_bytes << buff.byteslice(index, value)
4380
+ index += value
4159
4381
  when 5
4382
+ unknown_bytes << buff.byteslice(index, 4)
4160
4383
  index += 4
4161
4384
  else
4162
4385
  raise "unknown wire type #{wire_type}"
4163
4386
  end
4387
+ (@_unknown_fields ||= +"".b) << unknown_bytes
4164
4388
  return self if index >= len
4165
4389
  ## PULL_UINT64
4166
4390
  tag =
@@ -4639,7 +4863,7 @@ module Api
4639
4863
  buff << byte
4640
4864
  end
4641
4865
  end
4642
-
4866
+ buff << @_unknown_fields if @_unknown_fields
4643
4867
  buff
4644
4868
  end
4645
4869
 
@@ -4745,20 +4969,38 @@ module Api
4745
4969
  # unexpected, so discard it and continue.
4746
4970
  if !found
4747
4971
  wire_type = tag & 0x7
4972
+
4973
+ unknown_bytes = +"".b
4974
+ val = tag
4975
+ while val != 0
4976
+ byte = val & 0x7F
4977
+
4978
+ val >>= 7
4979
+ # This drops the top bits,
4980
+ # Otherwise, with a signed right shift,
4981
+ # we get infinity one bits at the top
4982
+ val &= (1 << 57) - 1
4983
+
4984
+ byte |= 0x80 if val != 0
4985
+ unknown_bytes << byte
4986
+ end
4987
+
4748
4988
  case wire_type
4749
4989
  when 0
4750
4990
  i = 0
4751
4991
  while true
4752
4992
  newbyte = buff.getbyte(index)
4753
4993
  index += 1
4754
- break if newbyte.nil? || newbyte < 0x80
4994
+ break if newbyte.nil?
4995
+ unknown_bytes << newbyte
4996
+ break if newbyte < 0x80
4755
4997
  i += 1
4756
4998
  break if i > 9
4757
4999
  end
4758
5000
  when 1
5001
+ unknown_bytes << buff.byteslice(index, 8)
4759
5002
  index += 8
4760
5003
  when 2
4761
- ## PULL_BYTES
4762
5004
  value =
4763
5005
  if (byte0 = buff.getbyte(index)) < 0x80
4764
5006
  index += 1
@@ -4814,15 +5056,29 @@ module Api
4814
5056
  raise "integer decoding error"
4815
5057
  end
4816
5058
 
4817
- buff.byteslice(index, value)
4818
- index += value
5059
+ val = value
5060
+ while val != 0
5061
+ byte = val & 0x7F
4819
5062
 
4820
- ## END PULL_BYTES
5063
+ val >>= 7
5064
+ # This drops the top bits,
5065
+ # Otherwise, with a signed right shift,
5066
+ # we get infinity one bits at the top
5067
+ val &= (1 << 57) - 1
5068
+
5069
+ byte |= 0x80 if val != 0
5070
+ unknown_bytes << byte
5071
+ end
5072
+
5073
+ unknown_bytes << buff.byteslice(index, value)
5074
+ index += value
4821
5075
  when 5
5076
+ unknown_bytes << buff.byteslice(index, 4)
4822
5077
  index += 4
4823
5078
  else
4824
5079
  raise "unknown wire type #{wire_type}"
4825
5080
  end
5081
+ (@_unknown_fields ||= +"".b) << unknown_bytes
4826
5082
  return self if index >= len
4827
5083
  ## PULL_UINT64
4828
5084
  tag =
@@ -5020,7 +5276,7 @@ module Api
5020
5276
  buff << byte
5021
5277
  end
5022
5278
  end
5023
-
5279
+ buff << @_unknown_fields if @_unknown_fields
5024
5280
  buff
5025
5281
  end
5026
5282