oj 3.6.9 → 3.6.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74bbbdb4c9cecc3d5008e135e276f134b3ccaa53d56d37e01f9039c80962abd8
4
- data.tar.gz: 591d6d922cb44220f963d0432d246ab839001d8599bb9bc3ad562248df2c3b2a
3
+ metadata.gz: 8a87c62472d113e29856309232619790b751b188625b5f8500188f3d33225ceb
4
+ data.tar.gz: aaa3439fab55eb25f6ea54a4dc200dc0a97df79a5d0e1b8a1cd5b2a04550b8f7
5
5
  SHA512:
6
- metadata.gz: 5cc9a42e0e64f59b4120cb39986d9b90f1b2f55585cc5c5df79e3be12b6d177407d58b3380006349b3dd6d42aece669da62d8c147c833567465377501ce11eca
7
- data.tar.gz: 7b822b5752305070cd1fa9371c2bd5808ff3e127413482ef6a9a7af062c555cd79884a9a3ff0e3f5b3dc3675db84197b28a20259eb03969dbc930cb3f2d975c9
6
+ metadata.gz: f3dbefcb405bb2283b099206a5916970f4a06afc69354a1a3a3330ee45b1c0d4c6a9799626775131e85ca3a3b8ac93ff2663cddc81253f00a611d0e562626833
7
+ data.tar.gz: 2c4fb14af2b3840c69695998091ad25163ad3325e42d777c1a133ed427fac22ec096e2ed9d235f0814f0c8c2de5bfff823d0e12d1f2081ef66dfd74acb49d6b9
@@ -118,7 +118,7 @@ date_dump(VALUE obj, int depth, Out out) {
118
118
  case RubyTime:
119
119
  case XmlTime:
120
120
  v = rb_funcall(obj, rb_intern("iso8601"), 0);
121
- oj_dump_cstr(rb_string_value_ptr((VALUE*)&v), RSTRING_LEN(v), 0, 0, out);
121
+ oj_dump_cstr(rb_string_value_ptr((VALUE*)&v), (int)RSTRING_LEN(v), 0, 0, out);
122
122
  break;
123
123
  case UnixZTime:
124
124
  v = rb_funcall(obj, rb_intern("to_time"), 0);
@@ -544,7 +544,7 @@ dump_common(VALUE obj, int depth, Out out) {
544
544
  if (aj == obj) {
545
545
  volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
546
546
 
547
- oj_dump_cstr(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), false, false, out);
547
+ oj_dump_cstr(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), false, false, out);
548
548
  } else {
549
549
  oj_dump_custom_val(aj, depth, out, true);
550
550
  }
@@ -843,8 +843,10 @@ dump_struct(VALUE obj, int depth, Out out, bool as_ok) {
843
843
  v = rb_struct_aref(obj, INT2FIX(i));
844
844
  #endif
845
845
  if (ma != Qnil) {
846
- name = rb_id2name(SYM2ID(rb_ary_entry(ma, i)));
847
- len = strlen(name);
846
+ volatile VALUE s = rb_sym_to_s(rb_ary_entry(ma, i));
847
+
848
+ name = rb_string_value_ptr((VALUE*)&s);
849
+ len = (int)RSTRING_LEN(s);
848
850
  } else {
849
851
  len = snprintf(num_id, sizeof(num_id), "%d", i);
850
852
  name = num_id;
@@ -439,7 +439,7 @@ void
439
439
  oj_dump_ruby_time(VALUE obj, Out out) {
440
440
  volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
441
441
 
442
- oj_dump_cstr(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), 0, 0, out);
442
+ oj_dump_cstr(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), 0, 0, out);
443
443
  }
444
444
 
445
445
  void
@@ -686,7 +686,7 @@ oj_dump_str(VALUE obj, int depth, Out out, bool as_ok) {
686
686
  obj = rb_str_conv_enc(obj, enc, rb_utf8_encoding());
687
687
  }
688
688
  #endif
689
- oj_dump_cstr(rb_string_value_ptr((VALUE*)&obj), RSTRING_LEN(obj), 0, 0, out);
689
+ oj_dump_cstr(rb_string_value_ptr((VALUE*)&obj), (int)RSTRING_LEN(obj), 0, 0, out);
690
690
  }
691
691
 
692
692
  void
@@ -696,7 +696,7 @@ oj_dump_sym(VALUE obj, int depth, Out out, bool as_ok) {
696
696
 
697
697
  volatile VALUE s = rb_sym_to_s(obj);
698
698
 
699
- oj_dump_cstr(rb_string_value_ptr((VALUE*)&s), RSTRING_LEN(s), 0, 0, out);
699
+ oj_dump_cstr(rb_string_value_ptr((VALUE*)&s), (int)RSTRING_LEN(s), 0, 0, out);
700
700
  }
701
701
 
702
702
  static void
@@ -895,7 +895,7 @@ void
895
895
  oj_dump_obj_to_s(VALUE obj, Out out) {
896
896
  volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
897
897
 
898
- oj_dump_cstr(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), 0, 0, out);
898
+ oj_dump_cstr(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), 0, 0, out);
899
899
  }
900
900
 
901
901
  void
@@ -53,7 +53,7 @@ dump_leaf_str(Leaf leaf, Out out) {
53
53
  oj_dump_cstr(leaf->str, strlen(leaf->str), 0, 0, out);
54
54
  break;
55
55
  case RUBY_VAL:
56
- oj_dump_cstr(rb_string_value_cstr(&leaf->value), RSTRING_LEN(leaf->value), 0, 0, out);
56
+ oj_dump_cstr(rb_string_value_cstr(&leaf->value), (int)RSTRING_LEN(leaf->value), 0, 0, out);
57
57
  break;
58
58
  case COL_VAL:
59
59
  default:
@@ -204,7 +204,7 @@ dump_str_class(VALUE obj, VALUE clas, int depth, Out out) {
204
204
  dump_obj_attrs(obj, clas, 0, depth, out);
205
205
  } else {
206
206
  const char *s = rb_string_value_ptr((VALUE*)&obj);
207
- size_t len = RSTRING_LEN(obj);
207
+ size_t len = (int)RSTRING_LEN(obj);
208
208
  char s1 = s[1];
209
209
 
210
210
  oj_dump_cstr(s, len, 0, (':' == *s || ('^' == *s && ('r' == s1 || 'i' == s1))), out);
@@ -218,9 +218,9 @@ dump_str(VALUE obj, int depth, Out out, bool as_ok) {
218
218
 
219
219
  static void
220
220
  dump_sym(VALUE obj, int depth, Out out, bool as_ok) {
221
- const char *sym = rb_id2name(SYM2ID(obj));
222
-
223
- oj_dump_cstr(sym, strlen(sym), 1, 0, out);
221
+ volatile VALUE s = rb_sym_to_s(obj);
222
+
223
+ oj_dump_cstr(rb_string_value_ptr((VALUE*)&s), (int)RSTRING_LEN(s), 1, 0, out);
224
224
  }
225
225
 
226
226
  static int
@@ -544,7 +544,7 @@ dump_obj_attrs(VALUE obj, VALUE clas, slot_t id, int depth, Out out) {
544
544
  *out->cur++ = 'f';
545
545
  *out->cur++ = '"';
546
546
  *out->cur++ = ':';
547
- oj_dump_cstr(rb_string_value_ptr((VALUE*)&obj), RSTRING_LEN(obj), 0, 0, out);
547
+ oj_dump_cstr(rb_string_value_ptr((VALUE*)&obj), (int)RSTRING_LEN(obj), 0, 0, out);
548
548
  break;
549
549
  case T_ARRAY:
550
550
  assure_size(out, d2 * out->indent + 14);
@@ -709,8 +709,10 @@ dump_struct(VALUE obj, int depth, Out out, bool as_ok) {
709
709
 
710
710
  *out->cur++ = '[';
711
711
  for (i = 0; i < cnt; i++) {
712
- name = rb_id2name(SYM2ID(rb_ary_entry(ma, i)));
713
- len = strlen(name);
712
+ volatile VALUE s = rb_sym_to_s(rb_ary_entry(ma, i));
713
+
714
+ name = rb_string_value_ptr((VALUE*)&s);
715
+ len = (int)RSTRING_LEN(s);
714
716
  size = len + 3;
715
717
  assure_size(out, size);
716
718
  if (0 < i) {
@@ -316,7 +316,7 @@ dump_data_strict(VALUE obj, int depth, Out out, bool as_ok) {
316
316
  if (oj_bigdecimal_class == clas) {
317
317
  volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
318
318
 
319
- oj_dump_raw(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), out);
319
+ oj_dump_raw(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), out);
320
320
  } else {
321
321
  raise_strict(obj);
322
322
  }
@@ -329,7 +329,7 @@ dump_data_null(VALUE obj, int depth, Out out, bool as_ok) {
329
329
  if (oj_bigdecimal_class == clas) {
330
330
  volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
331
331
 
332
- oj_dump_raw(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), out);
332
+ oj_dump_raw(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), out);
333
333
  } else {
334
334
  oj_dump_nil(Qnil, depth, out, false);
335
335
  }
@@ -1158,7 +1158,7 @@ doc_open(VALUE clas, VALUE str) {
1158
1158
  int allocate;
1159
1159
 
1160
1160
  Check_Type(str, T_STRING);
1161
- len = RSTRING_LEN(str) + 1;
1161
+ len = (int)RSTRING_LEN(str) + 1;
1162
1162
  allocate = (SMALL_XML < len || !given);
1163
1163
  if (allocate) {
1164
1164
  json = ALLOC_N(char, len);
@@ -164,8 +164,10 @@ dump_struct(VALUE obj, int depth, Out out, bool as_ok) {
164
164
  assure_size(out, 2);
165
165
  *out->cur++ = '{';
166
166
  for (i = 0; i < cnt; i++) {
167
- name = rb_id2name(SYM2ID(rb_ary_entry(ma, i)));
168
- len = (int)strlen(name);
167
+ volatile VALUE s = rb_sym_to_s(rb_ary_entry(ma, i));
168
+
169
+ name = rb_string_value_ptr((VALUE*)&s);
170
+ len = (int)RSTRING_LEN(s);
169
171
  assure_size(out, size + sep_len + 6);
170
172
  if (0 < i) {
171
173
  *out->cur++ = ',';
@@ -214,9 +216,9 @@ dump_bigdecimal(VALUE obj, int depth, Out out, bool as_ok) {
214
216
  if ('I' == *str || 'N' == *str || ('-' == *str && 'I' == str[1])) {
215
217
  oj_dump_nil(Qnil, depth, out, false);
216
218
  } else if (Yes == out->opts->bigdec_as_num) {
217
- oj_dump_raw(str, RSTRING_LEN(rstr), out);
219
+ oj_dump_raw(str, (int)RSTRING_LEN(rstr), out);
218
220
  } else {
219
- oj_dump_cstr(str, RSTRING_LEN(rstr), 0, 0, out);
221
+ oj_dump_cstr(str, (int)RSTRING_LEN(rstr), 0, 0, out);
220
222
  }
221
223
  }
222
224
 
@@ -338,7 +340,7 @@ static void
338
340
  dump_to_s(VALUE obj, int depth, Out out, bool as_ok) {
339
341
  volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
340
342
 
341
- oj_dump_cstr(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), 0, 0, out);
343
+ oj_dump_cstr(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), 0, 0, out);
342
344
  }
343
345
 
344
346
  static ID parameters_id = 0;
@@ -233,7 +233,7 @@ dump_obj(VALUE obj, int depth, Out out, bool as_ok) {
233
233
  } else if (oj_bigdecimal_class == clas) {
234
234
  volatile VALUE rstr = rb_funcall(obj, oj_to_s_id, 0);
235
235
 
236
- oj_dump_raw(rb_string_value_ptr((VALUE*)&rstr), RSTRING_LEN(rstr), out);
236
+ oj_dump_raw(rb_string_value_ptr((VALUE*)&rstr), (int)RSTRING_LEN(rstr), out);
237
237
  } else if (resolve_wab_uuid_class() == clas) {
238
238
  oj_dump_str(rb_funcall(obj, oj_to_s_id, 0), depth, out, false);
239
239
  } else if (resolve_uri_http_class() == clas) {
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '3.6.9'
4
+ VERSION = '3.6.10'
5
5
  end
@@ -31,5 +31,5 @@ end
31
31
 
32
32
  record_allocation do
33
33
  data = 1_000_000.times.map { |i| "string_number_#{i}".to_sym } # array of symbols
34
- Oj.dump(data, mode: :strict)
34
+ Oj.dump(data, mode: :rails)
35
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oj
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.9
4
+ version: 3.6.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-12 00:00:00.000000000 Z
11
+ date: 2018-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler