ox 2.1.3 → 2.1.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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9a5698b62e72673ff1938107b1a54c34b290529
4
- data.tar.gz: 33eddef77be0a84be7e41f205d2d03b61e17f43e
3
+ metadata.gz: e4d1bc0caa1f30250ac41bb09bf0e74146823e9a
4
+ data.tar.gz: 7b82a1d2ff0c9d3e3cbd386d6111dcc5df70fdd3
5
5
  SHA512:
6
- metadata.gz: 013bcd5da423407fd1d4553594da0cda3d6f8f852bded2d4df28a4df8408488e19108accf1cc51ae41af3e69d834a4bc0b4ee89386594fd07ad75179f0a2b57e
7
- data.tar.gz: 52bde8d7c5e22794718fe978af3c6eec2b02c013209cc1523df4265980a9afd546876556542d60f0ccc1f963e94a52116dfa7572c42c27686edebf69651bb5a4
6
+ metadata.gz: e483cedd63acafe9b3e4f2aa9cc197dc24f7120374c3be8c5966a4cb74d8e7bf0030101f0377130707caf08dc668d88f94e768a751e1efc216d5d8a137076c00
7
+ data.tar.gz: 9ee127f630abaae2f03377ce87cc54ca27e87e030165f5dd196c6566601e60ef7b07921c647857ea89bd8c8f694d77d6f625b0d908086deb82a23657708a8cc2
data/README.md CHANGED
@@ -34,24 +34,14 @@ A fast XML parser and Object marshaller as a Ruby gem.
34
34
 
35
35
  ## Release Notes
36
36
 
37
- ### Release 2.1.3
38
-
39
- - Added check for @attributes being nil. Reported by and proposed fix by Elana.
40
-
41
- ### Release 2.1.2
42
-
43
- - Added skip option to parsing. This allows white space to be collapsed in two
44
- different ways.
37
+ ### Current Release 2.1.4
45
38
 
46
- - Added respond_to? method for easy access method checking.
39
+ - Fixed bug where the parser always started at the first position in a stringio
40
+ instead of the current position.
47
41
 
48
- ### Release 2.1.1
49
-
50
- - Worked around a module reset and clear that occurs on some Rubies.
51
-
52
- ### Release 2.1.0
42
+ ### Release 2.1.3
53
43
 
54
- - Thanks to jfontan Ox now includes support for XMLRPC.
44
+ - Added check for @attributes being nil. Reported by and proposed fix by Elana.
55
45
 
56
46
  ## Description
57
47
 
@@ -93,7 +83,7 @@ callbacks. Unlike Nokogiri and LibXML, Ox can be tuned to use only the SAX
93
83
  callbacks that are of interest to the caller. (See the perf_sax.rb file for an
94
84
  example.)
95
85
 
96
- Ox is compatible with Ruby 1.8.7, 1.9.2, 2.0.0, JRuby, and RBX.
86
+ Ox is compatible with Ruby 1.8.7, 1.9.3, 2.1.2, and RBX.
97
87
 
98
88
  ### Object Dump Sample:
99
89
 
@@ -79,10 +79,11 @@ ID ox_keys_id;
79
79
  ID ox_local_id;
80
80
  ID ox_mesg_id;
81
81
  ID ox_message_id;
82
- ID ox_nodes_id;
83
82
  ID ox_new_id;
83
+ ID ox_nodes_id;
84
84
  ID ox_num_id;
85
85
  ID ox_parse_id;
86
+ ID ox_pos_id;
86
87
  ID ox_read_id;
87
88
  ID ox_readpartial_id;
88
89
  ID ox_start_element_id;
@@ -954,6 +955,7 @@ void Init_ox() {
954
955
  ox_new_id = rb_intern("new");
955
956
  ox_num_id = rb_intern("@num");
956
957
  ox_parse_id = rb_intern("parse");
958
+ ox_pos_id = rb_intern("pos");
957
959
  ox_read_id = rb_intern("read");
958
960
  ox_readpartial_id = rb_intern("readpartial");
959
961
  ox_start_element_id = rb_intern("start_element");
@@ -220,10 +220,11 @@ extern ID ox_keys_id;
220
220
  extern ID ox_local_id;
221
221
  extern ID ox_mesg_id;
222
222
  extern ID ox_message_id;
223
- extern ID ox_nodes_id;
224
223
  extern ID ox_new_id;
224
+ extern ID ox_nodes_id;
225
225
  extern ID ox_num_id;
226
226
  extern ID ox_parse_id;
227
+ extern ID ox_pos_id;
227
228
  extern ID ox_read_id;
228
229
  extern ID ox_readpartial_id;
229
230
  extern ID ox_start_element_id;
@@ -49,24 +49,18 @@ static VALUE rescue_cb(VALUE rdr, VALUE err);
49
49
  static VALUE io_cb(VALUE rdr);
50
50
  static VALUE partial_io_cb(VALUE rdr);
51
51
  static int read_from_io(Buf buf);
52
- #ifndef JRUBY_RUBY
53
52
  static int read_from_fd(Buf buf);
54
- #endif
55
53
  static int read_from_io_partial(Buf buf);
56
54
  static int read_from_str(Buf buf);
57
55
 
58
56
  void
59
57
  ox_sax_buf_init(Buf buf, VALUE io) {
60
- if (ox_stringio_class == rb_obj_class(io)) {
58
+ if (ox_stringio_class == rb_obj_class(io) && 0 == FIX2INT(rb_funcall2(io, ox_pos_id, 0, 0))) {
61
59
  VALUE s = rb_funcall2(io, ox_string_id, 0, 0);
62
60
 
63
61
  buf->read_func = read_from_str;
64
62
  buf->in_str = StringValuePtr(s);
65
63
  } else if (rb_respond_to(io, ox_readpartial_id)) {
66
- #ifdef JRUBY_RUBY
67
- buf->read_func = read_from_io_partial;
68
- buf->io = io;
69
- #else
70
64
  VALUE rfd;
71
65
 
72
66
  if (rb_respond_to(io, ox_fileno_id) && Qnil != (rfd = rb_funcall(io, ox_fileno_id, 0))) {
@@ -76,12 +70,7 @@ ox_sax_buf_init(Buf buf, VALUE io) {
76
70
  buf->read_func = read_from_io_partial;
77
71
  buf->io = io;
78
72
  }
79
- #endif
80
73
  } else if (rb_respond_to(io, ox_read_id)) {
81
- #ifdef JRUBY_RUBY
82
- buf->read_func = read_from_io;
83
- buf->io = io;
84
- #else
85
74
  VALUE rfd;
86
75
 
87
76
  if (rb_respond_to(io, ox_fileno_id) && Qnil != (rfd = rb_funcall(io, ox_fileno_id, 0))) {
@@ -91,7 +80,6 @@ ox_sax_buf_init(Buf buf, VALUE io) {
91
80
  buf->read_func = read_from_io;
92
81
  buf->io = io;
93
82
  }
94
- #endif
95
83
  } else {
96
84
  rb_raise(ox_arg_error_class, "sax_parser io argument must respond to readpartial() or read().\n");
97
85
  }
@@ -160,10 +148,6 @@ ox_sax_buf_read(Buf buf) {
160
148
 
161
149
  static VALUE
162
150
  rescue_cb(VALUE rbuf, VALUE err) {
163
- #ifndef JRUBY_RUBY
164
- /* JRuby seems to play by a different set if rules. It passes in an Fixnum
165
- * instead of an error like other Rubies. For now assume all errors are
166
- * EOF and deal with the results further down the line. */
167
151
  #if (defined(RUBINIUS_RUBY) || (1 == RUBY_VERSION_MAJOR && 8 == RUBY_VERSION_MINOR))
168
152
  if (rb_obj_class(err) != rb_eTypeError) {
169
153
  #else
@@ -174,7 +158,6 @@ rescue_cb(VALUE rbuf, VALUE err) {
174
158
  //ox_sax_drive_cleanup(buf->dr); called after exiting protect
175
159
  rb_raise(err, "at line %d, column %d\n", buf->line, buf->col);
176
160
  }
177
- #endif
178
161
  return Qfalse;
179
162
  }
180
163
 
@@ -226,7 +209,6 @@ read_from_io(Buf buf) {
226
209
  return (Qfalse == rb_rescue(io_cb, (VALUE)buf, rescue_cb, (VALUE)buf));
227
210
  }
228
211
 
229
- #ifndef JRUBY_RUBY
230
212
  static int
231
213
  read_from_fd(Buf buf) {
232
214
  ssize_t cnt;
@@ -241,7 +223,6 @@ read_from_fd(Buf buf) {
241
223
  }
242
224
  return 0;
243
225
  }
244
- #endif
245
226
 
246
227
  static char*
247
228
  ox_stpncpy(char *dest, const char *src, size_t n) {
@@ -51,18 +51,7 @@ typedef struct _Has {
51
51
 
52
52
  inline static int
53
53
  respond_to(VALUE obj, ID method) {
54
- #ifdef JRUBY_RUBY
55
- /* There is a bug in JRuby where rb_respond_to() returns true (1) even if
56
- * a method is private. */
57
- {
58
- VALUE args[1];
59
-
60
- *args = ID2SYM(method);
61
- return (Qtrue == rb_funcall2(obj, rb_intern("respond_to?"), 1, args));
62
- }
63
- #else
64
54
  return rb_respond_to(obj, method);
65
- #endif
66
55
  }
67
56
 
68
57
  inline static void
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Ox
3
3
  # Current version of the module.
4
- VERSION = '2.1.3'
4
+ VERSION = '2.1.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ox
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-25 00:00:00.000000000 Z
11
+ date: 2014-12-05 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: "A fast XML parser and object serializer that uses only standard C lib.\n
14
14
  \ \nOptimized XML (Ox), as the name implies was written to provide speed