bson 3.2.0 → 3.2.1
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/CHANGELOG.md +7 -0
- data/ext/bson/native.c +17 -11
- data/lib/bson/version.rb +1 -1
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97406446c031dcd1d113981137d7a5f3b7cf931b
|
4
|
+
data.tar.gz: 71e76d81578a58363dbb4eb254521e5b5154c9ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce10bfb4026b5830ba571f98f99b4a02075223a5039262c855f9ddd7e676e562895f89db5013826d52b42bd9622580c32815b50731b41b6f4f53f0018ea20708
|
7
|
+
data.tar.gz: 009a442c08996a177318e48d41fc637fde1e72354979389123cc7e829c96e9a0051ae202a0c7fae62a308c204f37c2eacf4aaa20da57d48d2fad313727f41018
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
data/ext/bson/native.c
CHANGED
@@ -49,12 +49,12 @@
|
|
49
49
|
#endif
|
50
50
|
|
51
51
|
/**
|
52
|
-
* Define the max hostname length constant if nonexistant.
|
52
|
+
* Define the max hostname hash length constant if nonexistant.
|
53
53
|
*
|
54
|
-
* @since 2.0
|
54
|
+
* @since 3.2.0
|
55
55
|
*/
|
56
|
-
#ifndef
|
57
|
-
#define
|
56
|
+
#ifndef HOST_NAME_HASH_MAX
|
57
|
+
#define HOST_NAME_HASH_MAX 256
|
58
58
|
#endif
|
59
59
|
|
60
60
|
/**
|
@@ -136,13 +136,12 @@ static const char rb_bson_null_byte = 0;
|
|
136
136
|
static const char rb_bson_true_byte = 1;
|
137
137
|
|
138
138
|
/**
|
139
|
-
* Holds the machine id for object id generation.
|
139
|
+
* Holds the machine id hash for object id generation.
|
140
140
|
*
|
141
|
-
* @since 2.0
|
141
|
+
* @since 3.2.0
|
142
142
|
*
|
143
|
-
* @todo: Need to set this value properly.
|
144
143
|
*/
|
145
|
-
static char
|
144
|
+
static char rb_bson_machine_id_hash[HOST_NAME_HASH_MAX];
|
146
145
|
|
147
146
|
/**
|
148
147
|
* The counter for incrementing object ids.
|
@@ -246,7 +245,7 @@ static VALUE rb_object_id_generator_next(int argc, VALUE* args, VALUE self)
|
|
246
245
|
c = htonl(rb_bson_object_id_counter << 8);
|
247
246
|
|
248
247
|
memcpy(&bytes, &t, 4);
|
249
|
-
memcpy(&bytes[4],
|
248
|
+
memcpy(&bytes[4], rb_bson_machine_id_hash, 3);
|
250
249
|
memcpy(&bytes[7], &pid, 2);
|
251
250
|
memcpy(&bytes[9], (unsigned char*) &c, 3);
|
252
251
|
rb_bson_object_id_counter++;
|
@@ -619,12 +618,19 @@ void Init_native()
|
|
619
618
|
VALUE string = rb_const_get(bson, rb_intern("String"));
|
620
619
|
VALUE true_class = rb_const_get(bson, rb_intern("TrueClass"));
|
621
620
|
VALUE false_class = rb_const_get(bson, rb_intern("FalseClass"));
|
621
|
+
// needed to hash the machine id
|
622
|
+
rb_require("digest/md5");
|
623
|
+
VALUE digest_class = rb_const_get(rb_cObject, rb_intern("Digest"));
|
624
|
+
VALUE md5_class = rb_const_get(digest_class, rb_intern("MD5"));
|
622
625
|
rb_bson_utf8_string = rb_const_get(bson, rb_intern("UTF8"));
|
623
626
|
rb_utc_method = rb_intern("utc");
|
624
627
|
|
625
|
-
// Get the object id machine id.
|
628
|
+
// Get the object id machine id and hash it.
|
629
|
+
char rb_bson_machine_id[256];
|
626
630
|
gethostname(rb_bson_machine_id, sizeof rb_bson_machine_id);
|
627
|
-
rb_bson_machine_id[
|
631
|
+
rb_bson_machine_id[255] = '\0';
|
632
|
+
VALUE digest = rb_funcall(md5_class, rb_intern("digest"), 1, rb_str_new2(rb_bson_machine_id));
|
633
|
+
memcpy(rb_bson_machine_id_hash, RSTRING_PTR(digest), RSTRING_LEN(digest));
|
628
634
|
|
629
635
|
// Integer optimizations.
|
630
636
|
rb_undef_method(integer, "to_bson_int32");
|
data/lib/bson/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Brock
|
@@ -34,7 +34,7 @@ cert_chain:
|
|
34
34
|
XZOS48LlWh15EG4yZo/gRzqNAW2LUIkYA5eMS2Kp6r+KV8IBUO/LaHdrXbdilpa8
|
35
35
|
BRsuCo7UZDbFVRns04HLyjVvkj+K/ywIcdKdS0csz5M=
|
36
36
|
-----END CERTIFICATE-----
|
37
|
-
date: 2015-07-
|
37
|
+
date: 2015-07-30 00:00:00.000000000 Z
|
38
38
|
dependencies: []
|
39
39
|
description: A full featured BSON specification implementation, in Ruby
|
40
40
|
email:
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: 1.3.6
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project: bson
|
139
|
-
rubygems_version: 2.4.
|
139
|
+
rubygems_version: 2.4.6
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Ruby Implementation of the BSON specification
|
metadata.gz.sig
CHANGED
Binary file
|