ext/ox/dump.c in ox-1.9.4 vs ext/ox/dump.c in ox-2.0.0
- old
+ new
@@ -593,13 +593,13 @@
cnt = (int)RARRAY_LEN(obj);
e.type = ArrayCode;
e.closed = (0 >= cnt);
out->w_start(out, &e);
if (!e.closed) {
- VALUE *np = RARRAY_PTR(obj);
- int i;
- int d2 = depth + 1;
+ const VALUE *np = RARRAY_PTR(obj);
+ int i;
+ int d2 = depth + 1;
for (i = cnt; 0 < i; i--, np++) {
dump_obj(0, *np, d2, out);
}
out->w_end(out, &e);
@@ -833,14 +833,14 @@
e.type = (Qtrue == rb_obj_is_kind_of(obj, rb_eException)) ? ExceptionCode : ObjectCode;
cnt = (int)RARRAY_LEN(vars);
e.closed = (0 >= cnt);
out->w_start(out, &e);
if (0 < cnt) {
- VALUE *np = RARRAY_PTR(vars);
- ID vid;
- unsigned int od = out->depth;
- int i;
+ const VALUE *np = RARRAY_PTR(vars);
+ ID vid;
+ unsigned int od = out->depth;
+ int i;
out->depth = depth + 1;
for (i = cnt; 0 < i; i--, np++) {
vid = rb_to_id(*np);
dump_var(vid, rb_ivar_get(obj, vid), out);
@@ -1103,22 +1103,22 @@
dump_gen_nodes(VALUE obj, unsigned int depth, Out out) {
long cnt = RARRAY_LEN(obj);
int indent_needed = 1;
if (0 < cnt) {
- VALUE *np = RARRAY_PTR(obj);
- VALUE clas;
- int d2 = depth + 1;
+ const VALUE *np = RARRAY_PTR(obj);
+ VALUE clas;
+ int d2 = depth + 1;
for (; 0 < cnt; cnt--, np++) {
clas = rb_obj_class(*np);
if (ox_element_clas == clas) {
dump_gen_element(*np, d2, out);
} else if (ox_instruct_clas == clas) {
dump_gen_instruct(*np, d2, out);
indent_needed = (1 == cnt) ? 0 : 1;
} else if (rb_cString == clas) {
- dump_str_value(out, StringValuePtr(*np), RSTRING_LEN(*np));
+ dump_str_value(out, StringValuePtr(*(VALUE*)np), RSTRING_LEN(*np));
indent_needed = (1 == cnt) ? 0 : 1;
} else if (ox_comment_clas == clas) {
dump_gen_val_node(*np, d2, "<!-- ", 5, " -->", 4, out);
} else if (ox_cdata_clas == clas) {
dump_gen_val_node(*np, d2, "<![CDATA[", 9, "]]>", 3, out);