oj 2.1.1 → 2.1.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: 362c05976208620196631aa5d6cd69759c2eec9f
4
- data.tar.gz: 95cd1d6833702d958b5b8eecfd5e3480e75e8736
3
+ metadata.gz: 59068b284af14e2585b85c69b1cc182f3dd0195d
4
+ data.tar.gz: 963f274f3d866a2230b674fbab5890a5d2b86dcd
5
5
  SHA512:
6
- metadata.gz: 672874c0393c2e718c8cef9ddf2a479f730df35c08a39fa36da00c3a4bc8b7fa3d45ff5db41379525212c04d70ec2e805666ee55c1c6d5a06c81e3fbe682db63
7
- data.tar.gz: 84c9d719920d5fe073a4980b43861d0315f84d8910d820598a3835e47fa6a1a7fc7074fb3d5049073c32bddefade970167990debdc7fd61f0faed3c97a9dc52f
6
+ metadata.gz: 32d43a8666dc8f16857a7ddee5ec4080a979c3cfc12d3834b3a832f40e323e742c4ecdac97f42400805983a2c448619a5f7a5e75f79221d8c0943551d0ec7591
7
+ data.tar.gz: 5113342958ca4a32bdd43af03ccba31c31c588967a40bd0e6cac1846e52db25a4a15231dcd16c82bb6c7507e2a9788fe4bff74b1ec56b957f55934e99e4e511a
data/README.md CHANGED
@@ -20,6 +20,10 @@ Follow [@peterohler on Twitter](http://twitter.com/#!/peterohler) for announceme
20
20
 
21
21
  [![Build Status](https://secure.travis-ci.org/ohler55/oj.png?branch=master)](http://travis-ci.org/ohler55/oj)
22
22
 
23
+ ### Current Release 2.1.2
24
+
25
+ - Fixed support for Windows.
26
+
23
27
  ### Current Release 2.1.1
24
28
 
25
29
  - Fixed off by 1 error in buffer for escaped strings.
@@ -94,7 +94,11 @@ slot_print(Cache8 c, sid_t key, unsigned int depth) {
94
94
  k = (k8 << BITS) | i;
95
95
  /*printf("*** key: 0x%016llx depth: %u i: %u\n", k, depth, i); */
96
96
  if (DEPTH - 1 == depth) {
97
+ #if IS_WINDOWS
98
+ printf("0x%016lx: %4lu\n", (long unsigned int)k, (long unsigned int)b->value);
99
+ #else
97
100
  printf("0x%016llx: %4llu\n", (long long unsigned int)k, (long long unsigned int)b->value);
101
+ #endif
98
102
  } else {
99
103
  slot_print(b->child, k, depth + 1);
100
104
  }
@@ -34,6 +34,7 @@
34
34
  #include "err.h"
35
35
  #include "parse.h"
36
36
  #include "resolve.h"
37
+ #include "hash.h"
37
38
 
38
39
  static void
39
40
  hash_set_cstr(ParseInfo pi, const char *key, size_t klen, const char *str, size_t len, const char *orig) {
@@ -44,7 +45,7 @@ hash_set_cstr(ParseInfo pi, const char *key, size_t klen, const char *str, size_
44
45
  pi->options.create_id_len == klen &&
45
46
  0 == strncmp(pi->options.create_id, key, klen)) {
46
47
  if (str < pi->json || pi->cur < str) {
47
- parent->classname = strndup(str, len);
48
+ parent->classname = oj_strndup(str, len);
48
49
  } else {
49
50
  parent->classname = str;
50
51
  }
@@ -116,7 +116,7 @@ hash_get(Hash hash, const char *key, size_t len, VALUE **slotp, VALUE def_value)
116
116
  bucket->next = b;
117
117
 
118
118
  }
119
- bucket->key = strndup(key, len);
119
+ bucket->key = oj_strndup(key, len);
120
120
  bucket->len = len;
121
121
  bucket->val = def_value;
122
122
  *slotp = &bucket->val;
@@ -147,3 +147,13 @@ ID
147
147
  oj_attr_hash_get(const char *key, size_t len, ID **slotp) {
148
148
  return (ID)hash_get(&intern_hash, key, len, (VALUE**)slotp, 0);
149
149
  }
150
+
151
+ char*
152
+ oj_strndup(const char *s, size_t len) {
153
+ char *d = ALLOC_N(char, len + 1);
154
+
155
+ memcpy(d, s, len);
156
+ d[len] = '\0';
157
+
158
+ return d;
159
+ }
@@ -41,5 +41,6 @@ extern VALUE oj_class_hash_get(const char *key, size_t len, VALUE **slotp);
41
41
  extern ID oj_attr_hash_get(const char *key, size_t len, ID **slotp);
42
42
 
43
43
  extern void oj_hash_print();
44
+ extern char* oj_strndup(const char *s, size_t len);
44
45
 
45
46
  #endif /* __OJ_HASH_H__ */
@@ -28,8 +28,10 @@
28
28
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
  */
30
30
 
31
+ #ifndef _WIN32
31
32
  #include <sys/time.h>
32
33
  #include <time.h>
34
+ #endif
33
35
  #include "hash.h"
34
36
 
35
37
  typedef struct _StrLen {
@@ -468,7 +470,11 @@ perf() {
468
470
  }
469
471
  }
470
472
  dt = micro_time() - start;
473
+ #if IS_WINDOWS
474
+ printf("%d iterations took %ld msecs\n", iter, (long)(dt / 1000));
475
+ #else
471
476
  printf("%d iterations took %lld msecs\n", iter, dt / 1000);
477
+ #endif
472
478
  }
473
479
 
474
480
  void
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Oj
3
3
  # Current version of the module.
4
- VERSION = '2.1.1'
4
+ VERSION = '2.1.2'
5
5
  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: 2.1.1
4
+ version: 2.1.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: 2013-06-17 00:00:00.000000000 Z
11
+ date: 2013-06-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'The fastest JSON parser and object serializer. '
14
14
  email: peter@ohler.com
@@ -92,7 +92,9 @@ files:
92
92
  - LICENSE
93
93
  - README.md
94
94
  homepage: http://www.ohler.com/oj
95
- licenses: []
95
+ licenses:
96
+ - MIT
97
+ - GPL-3.0
96
98
  metadata: {}
97
99
  post_install_message:
98
100
  rdoc_options: