oj 2.10.1 → 2.10.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of oj might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f8482eb646d2eea0781d023d94e10ea29e10936
4
- data.tar.gz: 085d5a8ff9fe704c875021496a9a28cdd8c957f0
3
+ metadata.gz: 8a212c2204a5f29bb42b42ed9db56d51f44bda08
4
+ data.tar.gz: 6f151a8f68ff8720ebb3e1dac263b234d0cedb00
5
5
  SHA512:
6
- metadata.gz: 04f67e449e524a7ac7a883ab20e305fe2bd75fed02f85c8a3ca3b16ee7c9ce17df7b23a1133f375d6088621210fca5f55eec01e8764a7a2d8a7cd37977d53f19
7
- data.tar.gz: 88a657bdbe9063946d24e0de22447bee76bff728e660d86ccecf81853fe2044e333166e1013343fccb022ed977656d083234d916aed1ea9baa1254ff59c82142
6
+ metadata.gz: 94d89b9109d22a280a368caf064717a7f662e9056681c1ec8ac6aae6d9c775cf5ef3cad6619cd3610d5864f0ad3f3d785c2aebf862a5891a027ce2180e588fa5
7
+ data.tar.gz: bee25237960557655787c3082aaf56652bcf002d0da6b23445bd30549a895be177215a266e5133dad8946d5dea8b83662dede24570623c3cf193fb3d626fffd0
data/README.md CHANGED
@@ -26,22 +26,9 @@ Follow [@peterohler on Twitter](http://twitter.com/#!/peterohler) for announceme
26
26
 
27
27
  [![Build Status](https://secure.travis-ci.org/ohler55/oj.png?branch=master)](http://travis-ci.org/ohler55/oj)
28
28
 
29
- ### Current Release 2.10.1
29
+ ### Current Release 2.10.2
30
30
 
31
- - Changed parse argument error to be a Ruby ArgError instead of a general Exception.
32
-
33
- ### Release 2.10.0
34
-
35
- - Using an indent of less than zero will not place newline characters between
36
- JSON elements when using the string or stream writer.
37
-
38
- - new options callback method was added to the Simple Callback Parser. If
39
- defined the prepare_key() method will be called when an JSON object ket is
40
- first encountered. The return value is then used as the key in the key-value
41
- pair.
42
-
43
- - Increased significants digits to 16 from 15. On occasion there may be
44
- unexpected round off results. Tou avoid those use the bigdecimal options.
31
+ - Fixed string corruption bug due to an uncommented assignment used for debugging.
45
32
 
46
33
  [Older release notes](http://www.ohler.com/dev/oj_misc/release_notes.html).
47
34
 
@@ -47,7 +47,7 @@ hash_set_cstr(ParseInfo pi, Val kval, const char *str, size_t len, const char *o
47
47
  if (Qundef == rkey &&
48
48
  0 != pi->options.create_id &&
49
49
  *pi->options.create_id == *key &&
50
- pi->options.create_id_len == klen &&
50
+ (int)pi->options.create_id_len == klen &&
51
51
  0 == strncmp(pi->options.create_id, key, klen)) {
52
52
  parent->classname = oj_strndup(str, len);
53
53
  parent->clen = len;
@@ -285,7 +285,7 @@ set_obj_ivar(Val parent, Val kval, VALUE value) {
285
285
  if (0 == (var_id = oj_attr_hash_get(key, klen, &slot))) {
286
286
  char attr[256];
287
287
 
288
- if (sizeof(attr) <= klen + 2) {
288
+ if ((int)sizeof(attr) <= klen + 2) {
289
289
  char *buf = ALLOC_N(char, klen + 2);
290
290
 
291
291
  if ('~' == *key) {
@@ -354,7 +354,7 @@ hash_set_cstr(ParseInfo pi, Val kval, const char *str, size_t len, const char *o
354
354
  } else if (0 != oj_odd_set_arg(parent->odd_args, kval->key, kval->klen, str_to_value(pi, str, len, orig))) {
355
355
  char buf[256];
356
356
 
357
- if (sizeof(buf) - 1 <= klen) {
357
+ if ((int)sizeof(buf) - 1 <= klen) {
358
358
  klen = sizeof(buf) - 2;
359
359
  }
360
360
  memcpy(buf, key, klen);
@@ -401,7 +401,7 @@ hash_set_num(ParseInfo pi, Val kval, NumInfo ni) {
401
401
  } else if (0 != oj_odd_set_arg(parent->odd_args, key, klen, oj_num_as_value(ni))) {
402
402
  char buf[256];
403
403
 
404
- if (sizeof(buf) - 1 <= klen) {
404
+ if ((int)sizeof(buf) - 1 <= klen) {
405
405
  klen = sizeof(buf) - 2;
406
406
  }
407
407
  memcpy(buf, key, klen);
@@ -470,7 +470,7 @@ hash_set_value(ParseInfo pi, Val kval, VALUE value) {
470
470
  } else if (0 != oj_odd_set_arg(parent->odd_args, key, klen, value)) {
471
471
  char buf[256];
472
472
 
473
- if (sizeof(buf) - 1 <= klen) {
473
+ if ((int)sizeof(buf) - 1 <= klen) {
474
474
  klen = sizeof(buf) - 2;
475
475
  }
476
476
  memcpy(buf, key, klen);
@@ -51,7 +51,7 @@ static VALUE partial_io_cb(VALUE rdr);
51
51
  static int read_from_io(Reader reader);
52
52
  static int read_from_fd(Reader reader);
53
53
  static int read_from_io_partial(Reader reader);
54
- static int read_from_str(Reader reader);
54
+ //static int read_from_str(Reader reader);
55
55
 
56
56
  void
57
57
  oj_reader_init(Reader reader, VALUE io, int fd) {
@@ -74,7 +74,7 @@ oj_reader_init(Reader reader, VALUE io, int fd) {
74
74
  reader->read_func = read_from_fd;
75
75
  reader->fd = fd;
76
76
  } else if (rb_cString == io_class) {
77
- reader->read_func = read_from_str;
77
+ reader->read_func = 0;
78
78
  reader->in_str = StringValuePtr(io);
79
79
  reader->head = (char*)reader->in_str;
80
80
  reader->tail = reader->head;
@@ -82,7 +82,7 @@ oj_reader_init(Reader reader, VALUE io, int fd) {
82
82
  } else if (oj_stringio_class == io_class) {
83
83
  VALUE s = rb_funcall2(io, oj_string_id, 0, 0);
84
84
 
85
- reader->read_func = read_from_str;
85
+ reader->read_func = 0;
86
86
  reader->in_str = StringValuePtr(s);
87
87
  reader->head = (char*)reader->in_str;
88
88
  reader->tail = reader->head;
@@ -121,12 +121,12 @@ oj_reader_read(Reader reader) {
121
121
  shift = reader->pro - reader->head - 1; // leave one character so we can backup one
122
122
  }
123
123
  if (0 >= shift) { /* no space left so allocate more */
124
- char *old = reader->head;
124
+ const char *old = reader->head;
125
125
  size_t size = reader->end - reader->head + BUF_PAD;
126
126
 
127
127
  if (reader->head == reader->base) {
128
128
  reader->head = ALLOC_N(char, size * 2);
129
- memcpy(reader->head, old, size);
129
+ memcpy((char*)reader->head, old, size);
130
130
  } else {
131
131
  REALLOC_N(reader->head, char, size * 2);
132
132
  }
@@ -141,7 +141,7 @@ oj_reader_read(Reader reader) {
141
141
  reader->str = reader->head + (reader->str - old);
142
142
  }
143
143
  } else {
144
- memmove(reader->head, reader->head + shift, reader->read_end - (reader->head + shift));
144
+ memmove((char*)reader->head, reader->head + shift, reader->read_end - (reader->head + shift));
145
145
  reader->tail -= shift;
146
146
  reader->read_end -= shift;
147
147
  if (0 != reader->pro) {
@@ -153,7 +153,7 @@ oj_reader_read(Reader reader) {
153
153
  }
154
154
  }
155
155
  err = reader->read_func(reader);
156
- *reader->read_end = '\0';
156
+ *(char*)reader->read_end = '\0';
157
157
 
158
158
  return err;
159
159
  }
@@ -238,7 +238,9 @@ read_from_fd(Reader reader) {
238
238
  }
239
239
 
240
240
  // This is only called when the end of the string is reached so just return -1.
241
+ /*
241
242
  static int
242
243
  read_from_str(Reader reader) {
243
244
  return -1;
244
245
  }
246
+ */
@@ -149,7 +149,7 @@ reader_expect(Reader reader, const char *s) {
149
149
  static inline void
150
150
  reader_cleanup(Reader reader) {
151
151
  if (reader->free_head && 0 != reader->head) {
152
- xfree(reader->head);
152
+ xfree((char*)reader->head);
153
153
  reader->head = 0;
154
154
  reader->free_head = 0;
155
155
  }
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '2.10.1'
4
+ VERSION = '2.10.2'
5
5
  end
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+
4
+ %w(lib ext test).each do |dir|
5
+ $LOAD_PATH.unshift File.expand_path("../../#{dir}", __FILE__)
6
+ end
7
+
8
+ require 'oj'
9
+
10
+
11
+ Thread.new do
12
+ string_io = StringIO.new('{"foo":"bar"}')
13
+ Oj.load(string_io)
14
+ string_io.rewind
15
+ puts string_io.read
16
+ end.join
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.10.1
4
+ version: 2.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-17 00:00:00.000000000 Z
11
+ date: 2014-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -114,6 +114,7 @@ files:
114
114
  - test/isolated/test_mimic_define.rb
115
115
  - test/isolated/test_mimic_rails_after.rb
116
116
  - test/isolated/test_mimic_rails_before.rb
117
+ - test/mod.rb
117
118
  - test/perf.rb
118
119
  - test/perf_compat.rb
119
120
  - test/perf_fast.rb