oj 2.14.2 → 2.14.3

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
  SHA1:
3
- metadata.gz: 5ba2532677f201c509765f805bcbcf1cbdddcac7
4
- data.tar.gz: 56fc6f4ccc428ac6f07a3453fba0fbd9f0ee6509
3
+ metadata.gz: 0e9413b81d3efaee1f673a90f9f6fbbfa3c8ebe2
4
+ data.tar.gz: cf61d3cf4f800dc535befff9ac0ca436356727e1
5
5
  SHA512:
6
- metadata.gz: 80690fabb4c159ef4bafebe48843da2f7e6de4e5236545163472575fe555458e2e57a78e4d823c64ae9a1f37d34f4b6af8bc33b106d73243600b2d8a92c143b4
7
- data.tar.gz: c17262ab7020f38281534b821f7541d9a5b1cc3b193ac0ed404f0f241819907a9631dc96b248720ffb944b1c2b6ac6e38893801b4e176b8fa67e4ff4f82030ab
6
+ metadata.gz: 321c45f5f2de1ad7aab6d8cbf595fc911f5172a6688a9816a4efe78a07ec84229e86bd3aa5fd170a8b98434db9aa4aa502ea8cda7f44f0ba1a4e4818446085fe
7
+ data.tar.gz: f610cf7d169c86dfc02fc6fb5cc3a018cc86a5f890c4a7f2ae251bbf97083ebb6d7307ec907b36c1bfb7fc10fe8bed76ca2c756716288228a60bea31e8d09d8a
data/README.md CHANGED
@@ -159,14 +159,9 @@ Oj.default_options = {:mode => :compat }
159
159
 
160
160
  ## Releases
161
161
 
162
- **Release 2.14.2**
162
+ **Release 2.14.3**
163
163
 
164
- - Non-UTF-8 string input is now converted to UTF-8.
165
-
166
- **Release 2.14.1**
167
-
168
- - Fixed bug that reverted to BigDecimal when a decimal had preceeding zeros
169
- after the decimal point.
164
+ - Updated to support Ruby 2.3.0.
170
165
 
171
166
  [Older release notes](http://www.ohler.com/dev/oj_misc/release_notes.html).
172
167
 
@@ -34,6 +34,7 @@ dflags = {
34
34
  'USE_RB_MUTEX' => (is_windows && !('1' == version[0] && '8' == version[1])) ? 1 : 0,
35
35
  'DATETIME_1_8' => ('ruby' == type && ('1' == version[0] && '8' == version[1])) ? 1 : 0,
36
36
  'NO_TIME_ROUND_PAD' => ('rubinius' == type) ? 1 : 0,
37
+ 'HAS_DATA_OBJECT_WRAP' => ('ruby' == type && '2' == version[0] && '3' <= version[1]) ? 1 : 0,
37
38
  }
38
39
  # This is a monster hack to get around issues with 1.9.3-p0 on CentOS 5.4. SO
39
40
  # some reason math.h and string.h contents are not processed. Might be a
@@ -813,7 +813,11 @@ parse_json(VALUE clas, char *json, int given, int allocated) {
813
813
  }
814
814
  #endif
815
815
  // last arg is free func void* func(void*)
816
+ #if HAS_DATA_OBJECT_WRAP
817
+ doc->self = rb_data_object_wrap(clas, doc, 0, free_doc_cb);
818
+ #else
816
819
  doc->self = rb_data_object_alloc(clas, doc, 0, free_doc_cb);
820
+ #endif
817
821
  rb_gc_register_address(&doc->self);
818
822
  doc->json = json;
819
823
  DATA_PTR(doc->self) = doc;
@@ -445,9 +445,8 @@ static struct _StrLen data[] = {
445
445
  static uint64_t
446
446
  micro_time() {
447
447
  struct timeval tv;
448
- struct timezone tz;
449
448
 
450
- gettimeofday(&tv, &tz);
449
+ gettimeofday(&tv, NULL);
451
450
 
452
451
  return (uint64_t)tv.tv_sec * 1000000ULL + (uint64_t)tv.tv_usec;
453
452
  }
@@ -109,7 +109,7 @@ int
109
109
  oj_reader_read(Reader reader) {
110
110
  int err;
111
111
  size_t shift = 0;
112
-
112
+
113
113
  if (0 == reader->read_func) {
114
114
  return -1;
115
115
  }
@@ -165,7 +165,7 @@ rescue_cb(VALUE rbuf, VALUE err) {
165
165
  if (rb_eTypeError != clas && rb_eEOFError != clas) {
166
166
  Reader reader = (Reader)rbuf;
167
167
 
168
- rb_raise(err, "at line %d, column %d\n", reader->line, reader->col);
168
+ rb_raise(clas, "at line %d, column %d\n", reader->line, reader->col);
169
169
  }
170
170
  return Qfalse;
171
171
  }
@@ -185,6 +185,7 @@ partial_io_cb(VALUE rbuf) {
185
185
  }
186
186
  str = StringValuePtr(rstr);
187
187
  cnt = RSTRING_LEN(rstr);
188
+ //printf("*** partial read %lu bytes, str: '%s'\n", cnt, str);
188
189
  strcpy(reader->tail, str);
189
190
  reader->read_end = reader->tail + cnt;
190
191
 
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '2.14.2'
4
+ VERSION = '2.14.3'
5
5
  end
@@ -73,6 +73,7 @@ class AllHandler < Oj::ScHandler
73
73
  end # AllHandler
74
74
 
75
75
  class Closer < AllHandler
76
+ attr_accessor :io
76
77
  def initialize(io)
77
78
  super()
78
79
  @io = io
@@ -340,7 +341,13 @@ class ScpTest < Minitest::Test
340
341
  [:hash_set, 'one', true]], handler.calls)
341
342
  else
342
343
  read_io.close
343
- write_io.write json
344
+ write_io.write json[0..11]
345
+ sleep(0.1)
346
+ begin
347
+ write_io.write json[12..-1]
348
+ rescue Exception => e
349
+ # ignore, should fail to write
350
+ end
344
351
  write_io.close
345
352
  Process.exit(0)
346
353
  end
@@ -357,8 +364,15 @@ class ScpTest < Minitest::Test
357
364
  end
358
365
  Thread.start(json) do |j|
359
366
  c = server.accept()
360
- c.puts json
361
- c.close
367
+ c.puts json[0..11]
368
+ 10.times {
369
+ break if c.closed?
370
+ sleep(0.1)
371
+ }
372
+ unless c.closed?
373
+ c.puts json[12..-1]
374
+ c.close
375
+ end
362
376
  end
363
377
  begin
364
378
  sock = TCPSocket.new('localhost', 8080)
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: 2.14.2
4
+ version: 2.14.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-19 00:00:00.000000000 Z
11
+ date: 2015-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler