yajl-ruby 0.6.4 → 0.6.5

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.

Potentially problematic release.


This version of yajl-ruby might be problematic. Click here for more details.

data/CHANGELOG.md CHANGED
@@ -1,7 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.5 (November 13th, 2009)
4
+ * optimize symbol creation while symbolize_keys is turned on
5
+ * fix for 32bit integer conversion into ruby
6
+
3
7
  ## 0.6.4 (November 4th, 2009)
4
8
  * All specs pass on Rubinius :)
9
+ * Added Yajl.load and Yajl.dump for compatibility with other various data format API's in ruby
5
10
  * Fixed a bug in Yajl::Encoder which allowed direct, unescaped encoding of NaN, Infinity and -Infinity.
6
11
  It will now properly throw a Yajl::EncodeError exception if either of these values are found unescaped.
7
12
  * Update bundled Yajl library to 1.0.7
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 4
3
- :major: 0
4
2
  :minor: 6
3
+ :patch: 5
4
+ :major: 0
data/ext/yajl_ext.c CHANGED
@@ -198,9 +198,9 @@ static int yajl_found_number(void * ctx, const char * numberVal, unsigned int nu
198
198
  cSubString[numberLen] = '\0';
199
199
 
200
200
  if (strchr(cSubString, '.') != NULL || strchr(cSubString, 'e') != NULL || strchr(cSubString, 'E') != NULL) {
201
- yajl_set_static_value(ctx, rb_float_new(atof(cSubString)));
201
+ yajl_set_static_value(ctx, rb_float_new(rb_cstr_to_dbl(cSubString, 10)));
202
202
  } else {
203
- yajl_set_static_value(ctx, INT2FIX(atoi(cSubString)));
203
+ yajl_set_static_value(ctx, rb_cstr2inum(cSubString, 10));
204
204
  }
205
205
  yajl_check_and_fire_callback(ctx);
206
206
  free(cSubString);
@@ -216,11 +216,18 @@ static int yajl_found_string(void * ctx, const unsigned char * stringVal, unsign
216
216
  static int yajl_found_hash_key(void * ctx, const unsigned char * stringVal, unsigned int stringLen) {
217
217
  struct yajl_parser_wrapper * wrapper;
218
218
  GetParser((VALUE)ctx, wrapper);
219
- VALUE keyStr = rb_str_new((const char *)stringVal, stringLen);
219
+ VALUE keyStr;
220
220
 
221
221
  if (wrapper->symbolizeKeys) {
222
- yajl_set_static_value(ctx, rb_funcall(keyStr, intern_to_sym, 0));
222
+ char * cSubString = ALLOC_N(char, stringLen+1);
223
+ if (cSubString) {
224
+ memcpy(cSubString, stringVal, stringLen);
225
+ }
226
+ cSubString[stringLen] = '\0';
227
+ yajl_set_static_value(ctx, ID2SYM(rb_intern(cSubString)));
228
+ free(cSubString);
223
229
  } else {
230
+ keyStr = rb_str_new((const char *)stringVal, stringLen);
224
231
  yajl_set_static_value(ctx, keyStr);
225
232
  }
226
233
  yajl_check_and_fire_callback(ctx);
@@ -32,7 +32,7 @@ describe "One-off JSON examples" do
32
32
 
33
33
  it "should parse invalid UTF8 with :check_utf8 set to false" do
34
34
  parser = Yajl::Parser.new(:check_utf8 => false)
35
- puts parser.parse("[\"#{"\201\203"}\"]").inspect
35
+ parser.parse("[\"#{"\201\203"}\"]").inspect
36
36
  end
37
37
 
38
38
  it "should parse using it's class method, from an IO" do
@@ -55,4 +55,10 @@ describe "One-off JSON examples" do
55
55
  end
56
56
  output.should == {"key" => 1234}
57
57
  end
58
+
59
+ it "should parse numbers greater than 2,147,483,648" do
60
+ Yajl::Parser.parse("{\"id\": 2147483649}").should eql({"id" => 2147483649})
61
+ Yajl::Parser.parse("{\"id\": 5687389800}").should eql({"id" => 5687389800})
62
+ Yajl::Parser.parse("{\"id\": 1046289770033519442869495707521600000000}").should eql({"id" => 1046289770033519442869495707521600000000})
63
+ end
58
64
  end
data/yajl-ruby.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{yajl-ruby}
8
- s.version = "0.6.4"
8
+ s.version = "0.6.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Lopez", "Lloyd Hilaiel"]
12
- s.date = %q{2009-11-04}
12
+ s.date = %q{2009-11-13}
13
13
  s.email = %q{seniorlopez@gmail.com}
14
14
  s.extensions = ["ext/extconf.rb"]
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yajl-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Lopez
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-11-04 00:00:00 -08:00
13
+ date: 2009-11-13 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies: []
16
16