ox 1.4.5 → 1.4.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ox might be problematic. Click here for more details.
- data/README.md +2 -2
- data/ext/ox/dump.c +12 -8
- data/ext/ox/ox.c +4 -0
- data/ext/ox/ox.h +2 -0
- data/lib/ox/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -26,9 +26,9 @@ A fast XML parser and Object marshaller as a Ruby gem.
|
|
26
26
|
|
27
27
|
## <a name="release">Release Notes</a>
|
28
28
|
|
29
|
-
### Release 1.4.
|
29
|
+
### Release 1.4.6
|
30
30
|
|
31
|
-
-
|
31
|
+
- Adopted the Exception message encoding hack to work for the latests ruby versions.
|
32
32
|
|
33
33
|
## <a name="description">Description</a>
|
34
34
|
|
data/ext/ox/dump.c
CHANGED
@@ -72,6 +72,7 @@ typedef struct _Out {
|
|
72
72
|
int indent;
|
73
73
|
int depth; // used by dumpHash
|
74
74
|
Options opts;
|
75
|
+
VALUE obj;
|
75
76
|
} *Out;
|
76
77
|
|
77
78
|
static void dump_obj_to_xml(VALUE obj, Options copts, Out out);
|
@@ -435,9 +436,11 @@ dump_first_obj(VALUE obj, Out out) {
|
|
435
436
|
static void
|
436
437
|
dump_obj(ID aid, VALUE obj, unsigned int depth, Out out) {
|
437
438
|
struct _Element e;
|
439
|
+
VALUE prev_obj = out->obj;
|
438
440
|
char value_buf[64];
|
439
441
|
int cnt;
|
440
442
|
|
443
|
+
out->obj = obj;
|
441
444
|
if (0 == aid) {
|
442
445
|
//e.attr.str = 0;
|
443
446
|
e.attr.len = 0;
|
@@ -823,20 +826,20 @@ dump_obj(ID aid, VALUE obj, unsigned int depth, Out out) {
|
|
823
826
|
}
|
824
827
|
break;
|
825
828
|
}
|
829
|
+
out->obj = prev_obj;
|
826
830
|
}
|
827
831
|
|
828
832
|
static int
|
829
833
|
dump_var(ID key, VALUE value, Out out) {
|
830
|
-
if (T_DATA == rb_type(value) &&
|
834
|
+
if (T_DATA == rb_type(value) && key == mesg_id) {
|
831
835
|
/* There is a secret recipe that keeps Exception mesg attributes as a
|
832
|
-
* T_DATA until it is needed.
|
833
|
-
*
|
834
|
-
*
|
835
|
-
*
|
836
|
-
*
|
837
|
-
* that can be represented as a String then this will fail.
|
836
|
+
* T_DATA until it is needed. The safe way around this hack is to call
|
837
|
+
* the message() method and use the returned string as the
|
838
|
+
* message. Not pretty but it solves the most common use of this
|
839
|
+
* hack. If there are others they will have to be handled one at a
|
840
|
+
* time.
|
838
841
|
*/
|
839
|
-
|
842
|
+
value = rb_funcall(out->obj, message_id, 0);
|
840
843
|
}
|
841
844
|
dump_obj(key, value, out->depth, out);
|
842
845
|
|
@@ -1026,6 +1029,7 @@ dump_obj_to_xml(VALUE obj, Options copts, Out out) {
|
|
1026
1029
|
out->circ_cache = 0;
|
1027
1030
|
out->circ_cnt = 0;
|
1028
1031
|
out->opts = copts;
|
1032
|
+
out->obj = obj;
|
1029
1033
|
if (Yes == copts->circular) {
|
1030
1034
|
ox_cache8_new(&out->circ_cache);
|
1031
1035
|
}
|
data/ext/ox/ox.c
CHANGED
@@ -62,6 +62,8 @@ ID inspect_id;
|
|
62
62
|
ID instruct_id;
|
63
63
|
ID keys_id;
|
64
64
|
ID local_id;
|
65
|
+
ID mesg_id;
|
66
|
+
ID message_id;
|
65
67
|
ID nodes_id;
|
66
68
|
ID num_id;
|
67
69
|
ID parse_id;
|
@@ -653,6 +655,8 @@ void Init_ox() {
|
|
653
655
|
instruct_id = rb_intern("instruct");
|
654
656
|
keys_id = rb_intern("keys");
|
655
657
|
local_id = rb_intern("local");
|
658
|
+
mesg_id = rb_intern("mesg");
|
659
|
+
message_id = rb_intern("message");
|
656
660
|
nodes_id = rb_intern("@nodes");
|
657
661
|
num_id = rb_intern("@num");
|
658
662
|
parse_id = rb_intern("parse");
|
data/ext/ox/ox.h
CHANGED
data/lib/ox/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-02-09 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! "A fast XML parser and object serializer that uses only standard C
|
15
15
|
lib.\n \nOptimized XML (Ox), as the name implies was written to provide
|