ox 1.5.3 → 1.5.4

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 CHANGED
@@ -30,9 +30,11 @@ A fast XML parser and Object marshaller as a Ruby gem.
30
30
 
31
31
  ## <a name="release">Release Notes</a>
32
32
 
33
- ### Release 1.5.3
33
+ ### Release 1.5.4
34
34
 
35
- - Backed off on using the stack for allocation as very large XML files are too large for many stacks.
35
+ - Worked around bug in rb_protect in ruby 1.9.x and OS X 10.6.8 that caused ignored exceptions to be raised on program exit.
36
+
37
+ - Fixed a parse bug that did not accept &nn; sequences.
36
38
 
37
39
  ## <a name="description">Description</a>
38
40
 
data/ext/ox/ox.c CHANGED
@@ -272,7 +272,7 @@ set_def_opts(VALUE self, VALUE opts) {
272
272
  } else if (Qfalse == v) {
273
273
  *o->attr = No;
274
274
  } else {
275
- rb_raise(rb_eArgError, "%s must be true, false, or nil.\n", StringValuePtr(o->sym));
275
+ rb_raise(rb_eArgError, "%s must be true or false.\n", rb_id2name(SYM2ID(o->sym)));
276
276
  }
277
277
  }
278
278
  return Qnil;
@@ -569,7 +569,7 @@ parse_dump_options(VALUE ropts, Options copts) {
569
569
  } else if (rb_cFalseClass == c) {
570
570
  *o->attr = No;
571
571
  } else {
572
- rb_raise(rb_eArgError, "%s must be true or false.\n", StringValuePtr(o->sym));
572
+ rb_raise(rb_eArgError, "%s must be true or false.\n", rb_id2name(SYM2ID(o->sym)));
573
573
  }
574
574
  }
575
575
  }
data/ext/ox/parse.c CHANGED
@@ -717,7 +717,13 @@ collapse_special(char *str) {
717
717
 
718
718
  s++;
719
719
  if ('#' == *s) {
720
- c = (int)strtol(s, &end, 10);
720
+ s++;
721
+ if ('x' == *s || 'X' == *s) {
722
+ s++;
723
+ c = (int)strtol(s, &end, 16);
724
+ } else {
725
+ c = (int)strtol(s, &end, 10);
726
+ }
721
727
  if (';' != *end) {
722
728
  return EDOM;
723
729
  }
data/ext/ox/sax.c CHANGED
@@ -87,6 +87,7 @@ static char read_name_token(SaxDrive dr);
87
87
  static int read_quoted_value(SaxDrive dr);
88
88
  static int collapse_special(char *str);
89
89
 
90
+ static VALUE rescue_cb(VALUE rdr, VALUE err);
90
91
  static VALUE io_cb(VALUE rdr);
91
92
  static VALUE partial_io_cb(VALUE rdr);
92
93
  static int read_from_io(SaxDrive dr);
@@ -778,14 +779,15 @@ read_quoted_value(SaxDrive dr) {
778
779
  return 0;
779
780
  }
780
781
 
781
- static int
782
- read_from_io_partial(SaxDrive dr) {
783
- int ex = 0;
782
+ static VALUE
783
+ rescue_cb(VALUE rdr, VALUE err) {
784
+ if (rb_obj_class(err) != rb_eEOFError) {
785
+ SaxDrive dr = (SaxDrive)rdr;
784
786
 
785
- rb_protect(partial_io_cb, (VALUE)dr, &ex);
786
- // printf("*** io_cb exception = %d\n", ex);
787
- // An error code of 6 is always returned not matter what kind of Exception is raised.
788
- return ex;
787
+ sax_drive_cleanup(dr);
788
+ rb_raise(err, "at line %d, column %d\n", dr->line, dr->col);
789
+ }
790
+ return Qfalse;
789
791
  }
790
792
 
791
793
  static VALUE
@@ -804,17 +806,7 @@ partial_io_cb(VALUE rdr) {
804
806
  strcpy(dr->cur, str);
805
807
  dr->read_end = dr->cur + cnt;
806
808
 
807
- return Qnil;
808
- }
809
-
810
- static int
811
- read_from_io(SaxDrive dr) {
812
- int ex = 0;
813
-
814
- rb_protect(io_cb, (VALUE)dr, &ex);
815
- // printf("*** io_cb exception = %d\n", ex);
816
- // An error code of 6 is always returned not matter what kind of Exception is raised.
817
- return ex;
809
+ return Qtrue;
818
810
  }
819
811
 
820
812
  static VALUE
@@ -834,7 +826,17 @@ io_cb(VALUE rdr) {
834
826
  strcpy(dr->cur, str);
835
827
  dr->read_end = dr->cur + cnt;
836
828
 
837
- return Qnil;
829
+ return Qtrue;
830
+ }
831
+
832
+ static int
833
+ read_from_io_partial(SaxDrive dr) {
834
+ return (Qfalse == rb_rescue(partial_io_cb, (VALUE)dr, rescue_cb, (VALUE)dr));
835
+ }
836
+
837
+ static int
838
+ read_from_io(SaxDrive dr) {
839
+ return (Qfalse == rb_rescue(io_cb, (VALUE)dr, rescue_cb, (VALUE)dr));
838
840
  }
839
841
 
840
842
  static int
@@ -866,7 +868,12 @@ collapse_special(char *str) {
866
868
  s++;
867
869
  if ('#' == *s) {
868
870
  s++;
869
- c = (int)strtol(s, &end, 10);
871
+ if ('x' == *s || 'X' == *s) {
872
+ s++;
873
+ c = (int)strtol(s, &end, 16);
874
+ } else {
875
+ c = (int)strtol(s, &end, 10);
876
+ }
870
877
  if (';' != *end) {
871
878
  return EDOM;
872
879
  }
data/lib/ox/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Ox
3
3
  # Current version of the module.
4
- VERSION = '1.5.3'
4
+ VERSION = '1.5.4'
5
5
  end
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.5.3
4
+ version: 1.5.4
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-03-21 00:00:00.000000000 Z
12
+ date: 2012-03-29 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