ox 2.4.3 → 2.4.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.

Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -21
  3. data/ext/ox/builder.c +11 -10
  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: d290437be6f76cdfe1bafdad90ec6a057e1e028a
4
- data.tar.gz: 082a458a1848f01a68455b687ee155ab7eb81ddf
3
+ metadata.gz: 4a1905c08bb18a23fdd9d6bad093f5f79739e40f
4
+ data.tar.gz: a7cc8928144cc81a3fbc94bb8b3602143c0a24ee
5
5
  SHA512:
6
- metadata.gz: 4c6b1a63c3df6dd7c06ee00366dd871aea2153794d70b815f3d1582b032866d57310f22225a8f35e03529a3decb89f282b9b50bf5185865d11b3d1b72924cb55
7
- data.tar.gz: 7e7a0ed99dfa2f85335a7e68d85346385852e89f55b3fcc0a47a059de8c2fb28345f5bbdc69889d13af9cfad1ef8d6058a512a035e9622ac94bb9f9b17862c39
6
+ metadata.gz: b43ea527105a1ba835bef03530d4b513a82740c29ff00da835ceab0fea564b3f47a324e35a3a02318ca5c69cec05f3dad2f97ed7599ee9205ff6ed53e564f58e
7
+ data.tar.gz: a4ca3469d113d213f24d4e5c3de06409637ab8be0410f4bd4da81a17cbf15a82ec354cd0754aad4e4ca54f4fc3f30c681722557970c490a69032c940611b6e8c
data/README.md CHANGED
@@ -34,32 +34,19 @@ A fast XML parser and Object marshaller as a Ruby gem.
34
34
 
35
35
  ## Release Notes
36
36
 
37
- ### Release 2.4.3
38
-
39
- - Fixed compiler warnings and errors.
40
-
41
- - Updated for Ruby 2.4.0.
42
-
43
- ### Release 2.4.2
37
+ ### Release 2.4.4
44
38
 
45
- - Added methods to Ox::Builder to provide output position information.
39
+ - Builder element attributes with special characters are now encoded correctly.
46
40
 
47
- ### Release 2.4.1
41
+ - A newline at end of an XML string is now controlled by the indent value. A
42
+ value of -1 indicates no terminating newline character and an indentation of
43
+ zero.
48
44
 
49
- - Made SAX smarter a little smarter or rather let it handle unquoted string
50
- with a / at the end.
51
-
52
- - Fixed bug with reporting errors of element names that are too long.
53
-
54
- - Added overlay feature to give control over which elements generate callbacks
55
- with the SAX parser.
56
-
57
- - Element.locate now includes self if the path is relative and starts with a wildcard.
45
+ ### Release 2.4.3
58
46
 
59
- ### Release 2.4.0
47
+ - Fixed compiler warnings and errors.
60
48
 
61
- - Added Ox::Builder that constructs an XML string or writes XML to a stream
62
- using builder methods.
49
+ - Updated for Ruby 2.4.0.
63
50
 
64
51
  ## Description
65
52
 
@@ -61,7 +61,7 @@ xml_str_len(const unsigned char *str, size_t len) {
61
61
 
62
62
  static void
63
63
  append_indent(Builder b) {
64
- if (0 == b->indent) {
64
+ if (0 >= b->indent) {
65
65
  return;
66
66
  }
67
67
  if (b->buf.head < b->buf.tail) {
@@ -190,19 +190,18 @@ i_am_a_child(Builder b, bool is_text) {
190
190
 
191
191
  static int
192
192
  append_attr(VALUE key, VALUE value, Builder b) {
193
- int len;
194
-
195
193
  buf_append(&b->buf, ' ');
196
194
  b->col++;
197
195
  b->pos++;
198
196
  append_sym_str(b, key);
199
197
  buf_append_string(&b->buf, "=\"", 2);
198
+ b->col += 2;
199
+ b->pos += 2;
200
200
  Check_Type(value, T_STRING);
201
- len = (int)RSTRING_LEN(value);
202
- buf_append_string(&b->buf, StringValuePtr(value), len);
201
+ append_string(b, StringValuePtr(value), (int)RSTRING_LEN(value));
203
202
  buf_append(&b->buf, '"');
204
- b->col += len + 3;
205
- b->pos += len + 3;
203
+ b->col++;
204
+ b->pos++;
206
205
 
207
206
  return ST_CONTINUE;
208
207
  }
@@ -271,7 +270,9 @@ bclose(Builder b) {
271
270
  while (0 <= b->depth) {
272
271
  pop(b);
273
272
  }
274
- buf_append(&b->buf, '\n');
273
+ if (0 <= b->indent) {
274
+ buf_append(&b->buf, '\n');
275
+ }
275
276
  b->line++;
276
277
  b->col = 1;
277
278
  b->pos++;
@@ -288,7 +289,7 @@ to_s(Builder b) {
288
289
  if (0 != b->buf.fd) {
289
290
  rb_raise(ox_arg_error_class, "can not create a String with a stream or file builder.");
290
291
  }
291
- if ('\n' != *(b->buf.tail - 1)) {
292
+ if (0 <= b->indent && '\n' != *(b->buf.tail - 1)) {
292
293
  buf_append(&b->buf, '\n');
293
294
  b->line++;
294
295
  b->col = 1;
@@ -312,7 +313,7 @@ to_s(Builder b) {
312
313
  * which is the builder instance. The return value is then the generated string.
313
314
  *
314
315
  * - +options+ - (Hash) formating options
315
- * - +:indent+ (Fixnum) indentaion level
316
+ * - +:indent+ (Fixnum) indentaion level, negative leaves of terminating newline
316
317
  * - +:size+ (Fixnum) the initial size of the string buffer
317
318
  */
318
319
  static VALUE
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Ox
3
3
  # Current version of the module.
4
- VERSION = '2.4.3'
4
+ VERSION = '2.4.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.4.3
4
+ version: 2.4.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: 2016-06-26 00:00:00.000000000 Z
11
+ date: 2016-08-09 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