bson_ext 1.0 → 1.0.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.
- data/ext/cbson/cbson.c +11 -3
- data/ext/cbson/version.h +1 -1
- metadata +6 -12
data/ext/cbson/cbson.c
CHANGED
@@ -88,7 +88,15 @@ static VALUE DigestMD5;
|
|
88
88
|
|
89
89
|
#if HAVE_RUBY_ENCODING_H
|
90
90
|
#include "ruby/encoding.h"
|
91
|
-
#define STR_NEW(p,n)
|
91
|
+
#define STR_NEW(p,n) \
|
92
|
+
({ \
|
93
|
+
VALUE _str = rb_enc_str_new((p), (n), rb_utf8_encoding()); \
|
94
|
+
rb_encoding* internal_encoding = rb_default_internal_encoding(); \
|
95
|
+
if (internal_encoding) { \
|
96
|
+
_str = rb_str_export_to_enc(_str, internal_encoding); \
|
97
|
+
} \
|
98
|
+
_str; \
|
99
|
+
})
|
92
100
|
/* MUST call TO_UTF8 before calling write_utf8. */
|
93
101
|
#define TO_UTF8(string) rb_str_export_to_enc((string), rb_utf8_encoding())
|
94
102
|
static void write_utf8(buffer_t buffer, VALUE string, char check_null) {
|
@@ -532,7 +540,7 @@ static void write_doc(buffer_t buffer, VALUE hash, VALUE check_keys, VALUE move_
|
|
532
540
|
}
|
533
541
|
|
534
542
|
// we have to check for an OrderedHash and handle that specially
|
535
|
-
if (strcmp(rb_obj_classname(hash), "OrderedHash") == 0) {
|
543
|
+
if (strcmp(rb_obj_classname(hash), "BSON::OrderedHash") == 0) {
|
536
544
|
VALUE keys = rb_funcall(hash, rb_intern("keys"), 0);
|
537
545
|
int i;
|
538
546
|
for(i = 0; i < RARRAY_LEN(keys); i++) {
|
@@ -909,7 +917,7 @@ void Init_cbson() {
|
|
909
917
|
InvalidStringEncoding = rb_const_get(bson, rb_intern("InvalidStringEncoding"));
|
910
918
|
InvalidDocument = rb_const_get(bson, rb_intern("InvalidDocument"));
|
911
919
|
rb_require("bson/ordered_hash");
|
912
|
-
OrderedHash = rb_const_get(
|
920
|
+
OrderedHash = rb_const_get(bson, rb_intern("OrderedHash"));
|
913
921
|
|
914
922
|
CBson = rb_define_module("CBson");
|
915
923
|
ext_version = rb_str_new2(VERSION);
|
data/ext/cbson/version.h
CHANGED
metadata
CHANGED
@@ -1,11 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bson_ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 1
|
7
|
-
- 0
|
8
|
-
version: "1.0"
|
4
|
+
version: 1.0.1
|
9
5
|
platform: ruby
|
10
6
|
authors:
|
11
7
|
- Mike Dirolf
|
@@ -13,7 +9,7 @@ autorequire:
|
|
13
9
|
bindir: bin
|
14
10
|
cert_chain: []
|
15
11
|
|
16
|
-
date: 2010-
|
12
|
+
date: 2010-05-07 00:00:00 -04:00
|
17
13
|
default_executable:
|
18
14
|
dependencies: []
|
19
15
|
|
@@ -36,7 +32,7 @@ files:
|
|
36
32
|
- ext/cbson/buffer.h
|
37
33
|
- ext/cbson/encoding_helpers.h
|
38
34
|
- ext/cbson/version.h
|
39
|
-
has_rdoc:
|
35
|
+
has_rdoc: true
|
40
36
|
homepage: http://www.mongodb.org
|
41
37
|
licenses: []
|
42
38
|
|
@@ -49,20 +45,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
49
45
|
requirements:
|
50
46
|
- - ">="
|
51
47
|
- !ruby/object:Gem::Version
|
52
|
-
segments:
|
53
|
-
- 0
|
54
48
|
version: "0"
|
49
|
+
version:
|
55
50
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
51
|
requirements:
|
57
52
|
- - ">="
|
58
53
|
- !ruby/object:Gem::Version
|
59
|
-
segments:
|
60
|
-
- 0
|
61
54
|
version: "0"
|
55
|
+
version:
|
62
56
|
requirements: []
|
63
57
|
|
64
58
|
rubyforge_project:
|
65
|
-
rubygems_version: 1.3.
|
59
|
+
rubygems_version: 1.3.5
|
66
60
|
signing_key:
|
67
61
|
specification_version: 3
|
68
62
|
summary: C extensions for Ruby BSON.
|