ox 2.9.2 → 2.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb02e4bfe5c3553796c87488d1a973e5d0c7774391352c85558776b462a722ed
4
- data.tar.gz: 860e2ce73ed2f755140241bf211ce26425e8bb49ce1d3d1263b72a2f3e48dc44
3
+ metadata.gz: 2ed84d3d4fbc1ce7e736c41db72f0be81b54e647916ec7904d3ed8bde7a9f3c0
4
+ data.tar.gz: d8b315fcbadfa83b886cf99ef1273da41511ce2633a2fae01ed9fb5f1a8ac872
5
5
  SHA512:
6
- metadata.gz: 7bbbd7e22da84b169665e1633f8ad0f533ea500e01d5712282dbe1921d346bdcfd3dc51b918d6cbe241fa54d2b45b35a42553f44a0308f0d54e186e58d363fc2
7
- data.tar.gz: f45f9c90c1875965a4c0900334861d9416c888fe420b8343139abf09c2daaf51a4e56f2fd2abcb1229f33864c5ee3f2f37bc5a7caa42bd3d22685c942976de49
6
+ metadata.gz: b86eb6d808f3a3f0dd373082060c838cf829ca15f2d41d64df7a15f6014d4401019e45d39b564f1dade27f328c165792776692f361f4d95f955da1160c1db016
7
+ data.tar.gz: a8262ff6dc805641118dd60691d80da5ac8bd23efd69274c1807feb94f3ddde1da1bfecbc538a2a62e06f02a242384629393fb42216875e57f5aebabd3e902b9
@@ -1,4 +1,10 @@
1
1
 
2
+ ## 2.9.3 - June 12, 2018
3
+
4
+ - Handle `\0` in dumped strings better.
5
+
6
+ - No `\n` added on dumped if indent is less than zero.
7
+
2
8
  ## 2.9.2 - April 16, 2018
3
9
 
4
10
  - `locate` fixed to cover a missing condition with named child thanks to mberlanda.
data/README.md CHANGED
@@ -246,7 +246,7 @@ necessary.
246
246
  The type indicator map is:
247
247
 
248
248
  - **a** => `Array`
249
- - **b** => `Base64`
249
+ - **b** => `Base64` - only for legacy loads
250
250
  - **c** => `Class`
251
251
  - **f** => `Float`
252
252
  - **g** => `Regexp`
@@ -300,8 +300,6 @@ Hash. An example is of { 1 => 'one', 2 => 'two' } encoding is:
300
300
  <s>two</s>
301
301
  </h>
302
302
  ```
303
- Strings with characters not allowed in XML are base64 encoded amd will be
304
- converted back into a String when loaded.
305
303
 
306
304
  Ox supports circular references where attributes of one Object can refer to
307
305
  an Object that refers back to the first Object. When this option is used an
@@ -194,7 +194,7 @@ fill_value(Out out, const char *value, size_t len) {
194
194
  memcpy(out->cur, value, len);
195
195
  out->cur += len;
196
196
  } else {
197
- for (; '\0' != *value; value++) {
197
+ for (; 0 < len; len--, value++) {
198
198
  *out->cur++ = *value;
199
199
  }
200
200
  }
@@ -210,7 +210,7 @@ fill_attr(Out out, char name, const char *value, size_t len) {
210
210
  memcpy(out->cur, value, len);
211
211
  out->cur += len;
212
212
  } else {
213
- for (; '\0' != *value; value++) {
213
+ for (; 0 < len; len--, value++) {
214
214
  *out->cur++ = *value;
215
215
  }
216
216
  }
@@ -331,7 +331,7 @@ dump_value(Out out, const char *value, size_t size) {
331
331
  memcpy(out->cur, value, size);
332
332
  out->cur += size;
333
333
  } else {
334
- for (; '\0' != *value; value++) {
334
+ for (; 0 < size; size--, value++) {
335
335
  *out->cur++ = *value;
336
336
  }
337
337
  }
@@ -345,7 +345,7 @@ dump_str_value(Out out, const char *value, size_t size, const char *table) {
345
345
  if (out->end - out->cur <= (long)xsize) {
346
346
  grow(out, xsize);
347
347
  }
348
- for (; '\0' != *value; value++) {
348
+ for (; 0 < size; size--, value++) {
349
349
  if ('1' == table[(uchar)*value]) {
350
350
  *out->cur++ = *value;
351
351
  } else {
@@ -1284,7 +1284,9 @@ dump_obj_to_xml(VALUE obj, Options copts, Out out) {
1284
1284
  out->w_end = dump_end;
1285
1285
  dump_first_obj(obj, out);
1286
1286
  }
1287
- dump_value(out, "\n", 1);
1287
+ if (0 <= out->indent) {
1288
+ dump_value(out, "\n", 1);
1289
+ }
1288
1290
  if (Yes == copts->circular) {
1289
1291
  ox_cache8_delete(out->circ_cache);
1290
1292
  }
@@ -0,0 +1,26 @@
1
+ /* encode.h
2
+ * Copyright (c) 2011, Peter Ohler
3
+ * All rights reserved.
4
+ */
5
+
6
+ #ifndef __OX_ENCODE_H__
7
+ #define __OX_ENCODE_H__
8
+
9
+ #include "ruby.h"
10
+ #if HAS_ENCODING_SUPPORT
11
+ #include "ruby/encoding.h"
12
+ #endif
13
+
14
+ static inline VALUE
15
+ ox_encode(VALUE rstr) {
16
+ #if HAS_ENCODING_SUPPORT
17
+ rb_enc_associate(rstr, ox_utf8_encoding);
18
+ #else
19
+ if (Qnil != ox_utf8_encoding) {
20
+ rstr = rb_funcall(ox_utf8_encoding, ox_iconv_id, 1, rstr);
21
+ }
22
+ #endif
23
+ return rstr;
24
+ }
25
+
26
+ #endif /* __OX_ENCODE_H__ */
@@ -1,5 +1,5 @@
1
1
 
2
2
  module Ox
3
3
  # Current version of the module.
4
- VERSION = '2.9.2'
4
+ VERSION = '2.9.3'
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.9.2
4
+ version: 2.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-16 00:00:00.000000000 Z
11
+ date: 2018-06-12 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
@@ -35,6 +35,7 @@ files:
35
35
  - ext/ox/cache8.c
36
36
  - ext/ox/cache8.h
37
37
  - ext/ox/dump.c
38
+ - ext/ox/encode.h
38
39
  - ext/ox/err.c
39
40
  - ext/ox/err.h
40
41
  - ext/ox/extconf.rb