ox 2.1.7 → 2.1.8

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.

Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -11
  3. data/ext/ox/sax_buf.c +16 -26
  4. data/lib/ox/version.rb +1 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 065c6a76ec5d44344dd607e266b9208f32aead7d
4
- data.tar.gz: 242089d4a9ebe913eb825721085d1c6c8c7187f8
3
+ metadata.gz: 51863f95cc7782f0645385202e4d127994448832
4
+ data.tar.gz: 651e6890f72ebb7093eb96fdc116faf9885cfc75
5
5
  SHA512:
6
- metadata.gz: 37a3c5ff01e5e238ae83bde8cb3f722624e17b927a8005586ff5b6bba425c1980ba41a120ea8b0889c3da37fff802f42ed5980beb83290ed3c81ace4184b9050
7
- data.tar.gz: 5b830c8b6c8e8cd8f41349c2962a7fd510c6540111e41dcb46619983e1829b47e9ae4e8323c6836e03b04530551c6dd0f5374a4d08e9bc89a6d7c7238b1f8469
6
+ metadata.gz: 5ba36a153b758ad852bee9fb0cb1c245bcf64934e2a8f3ec84d5e21109d3bf6f90221ec632431d674f522e9eedde106d72f6403ad646f91fa59f58c9f6b225e5
7
+ data.tar.gz: e6703f7d082b29dc8f786e13abd5bc105d3683187fb654910510d470813775bfce23bef4aa49f9a98253005ccd13a3170f59e0dfb9558e0047fad74d3ff7349e
data/README.md CHANGED
@@ -34,23 +34,18 @@ A fast XML parser and Object marshaller as a Ruby gem.
34
34
 
35
35
  ## Release Notes
36
36
 
37
- ### Current Release 2.1.7
37
+ ### Current Release 2.1.8
38
+
39
+ - Fixed a bug that caused all input to be read before parsing with the sax
40
+ parser and an IO.pipe.
41
+
42
+ ### Release 2.1.7
38
43
 
39
44
  - Empty elements such as <foo></foo> are now called back with empty text.
40
45
 
41
46
  - Fixed GC problem that occurs with the new GC in Ruby 2.2 that garbage
42
47
  collects Symbols.
43
48
 
44
- ### Release 2.1.6
45
-
46
- - Update licenses. No other changes.
47
-
48
- ### Release 2.1.5
49
-
50
- - Fixed symbol intern problem with Ruby 2.2.0. Symbols are not dynamic unless
51
- rb_intern(). There does not seem to be a way to force symbols created with
52
- encoding to be pinned.
53
-
54
49
  ## Description
55
50
 
56
51
  Optimized XML (Ox), as the name implies was written to provide speed optimized
data/ext/ox/sax_buf.c CHANGED
@@ -30,31 +30,23 @@ static int read_from_str(Buf buf);
30
30
 
31
31
  void
32
32
  ox_sax_buf_init(Buf buf, VALUE io) {
33
- if (ox_stringio_class == rb_obj_class(io) && 0 == FIX2INT(rb_funcall2(io, ox_pos_id, 0, 0))) {
33
+ VALUE io_class = rb_obj_class(io);
34
+ VALUE rfd;
35
+
36
+ if (ox_stringio_class == io_class && 0 == FIX2INT(rb_funcall2(io, ox_pos_id, 0, 0))) {
34
37
  VALUE s = rb_funcall2(io, ox_string_id, 0, 0);
35
38
 
36
39
  buf->read_func = read_from_str;
37
40
  buf->in_str = StringValuePtr(s);
41
+ } else if (rb_cFile == io_class && Qnil != (rfd = rb_funcall(io, ox_fileno_id, 0))) {
42
+ buf->read_func = read_from_fd;
43
+ buf->fd = FIX2INT(rfd);
38
44
  } else if (rb_respond_to(io, ox_readpartial_id)) {
39
- VALUE rfd;
40
-
41
- if (rb_respond_to(io, ox_fileno_id) && Qnil != (rfd = rb_funcall(io, ox_fileno_id, 0))) {
42
- buf->read_func = read_from_fd;
43
- buf->fd = FIX2INT(rfd);
44
- } else {
45
- buf->read_func = read_from_io_partial;
46
- buf->io = io;
47
- }
45
+ buf->read_func = read_from_io_partial;
46
+ buf->io = io;
48
47
  } else if (rb_respond_to(io, ox_read_id)) {
49
- VALUE rfd;
50
-
51
- if (rb_respond_to(io, ox_fileno_id) && Qnil != (rfd = rb_funcall(io, ox_fileno_id, 0))) {
52
- buf->read_func = read_from_fd;
53
- buf->fd = FIX2INT(rfd);
54
- } else {
55
- buf->read_func = read_from_io;
56
- buf->io = io;
57
- }
48
+ buf->read_func = read_from_io;
49
+ buf->io = io;
58
50
  } else {
59
51
  rb_raise(ox_arg_error_class, "sax_parser io argument must respond to readpartial() or read().\n");
60
52
  }
@@ -123,11 +115,9 @@ ox_sax_buf_read(Buf buf) {
123
115
 
124
116
  static VALUE
125
117
  rescue_cb(VALUE rbuf, VALUE err) {
126
- #if (defined(RUBINIUS_RUBY) || (1 == RUBY_VERSION_MAJOR && 8 == RUBY_VERSION_MINOR))
127
- if (rb_obj_class(err) != rb_eTypeError) {
128
- #else
129
- if (rb_obj_class(err) != rb_eEOFError) {
130
- #endif
118
+ VALUE err_class = rb_obj_class(err);
119
+
120
+ if (err_class != rb_eTypeError && err_class != rb_eEOFError) {
131
121
  Buf buf = (Buf)rbuf;
132
122
 
133
123
  //ox_sax_drive_cleanup(buf->dr); called after exiting protect
@@ -148,7 +138,7 @@ partial_io_cb(VALUE rbuf) {
148
138
  rstr = rb_funcall2(buf->io, ox_readpartial_id, 1, args);
149
139
  str = StringValuePtr(rstr);
150
140
  cnt = strlen(str);
151
- //printf("*** read %lu bytes, str: '%s'\n", cnt, str);
141
+ //printf("*** read partial %lu bytes, str: '%s'\n", cnt, str);
152
142
  strcpy(buf->tail, str);
153
143
  buf->read_end = buf->tail + cnt;
154
144
 
@@ -167,7 +157,7 @@ io_cb(VALUE rbuf) {
167
157
  rstr = rb_funcall2(buf->io, ox_read_id, 1, args);
168
158
  str = StringValuePtr(rstr);
169
159
  cnt = strlen(str);
170
- /*printf("*** read %lu bytes, str: '%s'\n", cnt, str); */
160
+ //printf("*** read %lu bytes, str: '%s'\n", cnt, str);
171
161
  strcpy(buf->tail, str);
172
162
  buf->read_end = buf->tail + cnt;
173
163
 
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 = '2.1.7'
4
+ VERSION = '2.1.8'
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.7
4
+ version: 2.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-31 00:00:00.000000000 Z
11
+ date: 2015-02-10 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