ox 2.14.8 → 2.14.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/ext/ox/buf.h +8 -0
- data/ext/ox/parse.c +1 -1
- data/ext/ox/sax.c +24 -10
- data/lib/ox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a654851f11a761fdb77beb9cb4ec9ae07b4697cec9a4c5578a973a344779ca97
|
|
4
|
+
data.tar.gz: b4b004cc4fd90e3c52e142bd4007c471515a520d52a42ca2d81f332c11e6b2ba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6b0595691afa3021e1abada2fd0fc4fb21992a10155f744846b01eb40bd74e33bf52041db37ec502b3f916295b64bde60816c20d99ed9954633342d035225d8a
|
|
7
|
+
data.tar.gz: e38010c8dcf091b983d17774464bd727a0f33538548d6b5d1820c6d043ba602d83552837a4ce4dd963c554ec19657475c21add9246323e5d5a9fbd7773c20e55
|
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All changes to the Ox gem are documented here. Releases follow semantic versioning.
|
|
4
4
|
|
|
5
|
+
## [2.14.11] - 2022-03-31
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Missing attribute value no longer crashes with the SAX parser.
|
|
10
|
+
|
|
11
|
+
## [2.14.10] - 2022-03-10
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Writing strings over 16K to a file with builder no longer causes a crash.
|
|
16
|
+
|
|
17
|
+
## [2.14.9] - 2022-02-11
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Fixed the `\r` replacement with `\n` with the SAX parser according to https://www.w3.org/TR/2008/REC-xml-20081126/#sec-line-ends.
|
|
22
|
+
|
|
5
23
|
## [2.14.8] - 2022-02-09
|
|
6
24
|
|
|
7
25
|
### Fixed
|
data/ext/ox/buf.h
CHANGED
|
@@ -86,8 +86,16 @@ buf_append_string(Buf buf, const char *s, size_t slen) {
|
|
|
86
86
|
|
|
87
87
|
if (len != (size_t)write(buf->fd, buf->head, len)) {
|
|
88
88
|
buf->err = true;
|
|
89
|
+
return;
|
|
89
90
|
}
|
|
90
91
|
buf->tail = buf->head;
|
|
92
|
+
if (sizeof(buf->base) <= slen) {
|
|
93
|
+
if (slen != (size_t)write(buf->fd, s, slen)) {
|
|
94
|
+
buf->err = true;
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
91
99
|
} else {
|
|
92
100
|
size_t len = buf->end - buf->head;
|
|
93
101
|
size_t toff = buf->tail - buf->head;
|
data/ext/ox/parse.c
CHANGED
data/ext/ox/sax.c
CHANGED
|
@@ -117,7 +117,7 @@ static void attr_text(SaxDrive dr, VALUE name, char *value, long pos, long line,
|
|
|
117
117
|
VALUE args[2];
|
|
118
118
|
|
|
119
119
|
args[0] = name;
|
|
120
|
-
if (dr->options.convert_special) {
|
|
120
|
+
if (dr->options.convert_special && '\0' != value[0]) {
|
|
121
121
|
ox_sax_collapse_special(dr, value, pos, line, col);
|
|
122
122
|
}
|
|
123
123
|
args[1] = rb_str_new2(value);
|
|
@@ -307,8 +307,8 @@ static void sax_drive_init(SaxDrive dr, VALUE handler, VALUE io, SaxOptions opti
|
|
|
307
307
|
dr->encoding = rb_enc_find(ox_default_options.encoding);
|
|
308
308
|
}
|
|
309
309
|
dr->utf8 = (NULL == dr->encoding || rb_utf8_encoding() == dr->encoding);
|
|
310
|
-
if (NULL == dr->encoding || rb_utf8_encoding() == dr->encoding) {
|
|
311
|
-
dr->get_name = dr->options.symbolize ? ox_utf8_sym : ox_utf8_name;
|
|
310
|
+
if (NULL == dr->encoding || rb_utf8_encoding() == dr->encoding) { // UTF-8
|
|
311
|
+
dr->get_name = dr->options.symbolize ? ox_utf8_sym : ox_utf8_name; // TBD UTF8 sym?
|
|
312
312
|
} else {
|
|
313
313
|
dr->get_name = dr->options.symbolize ? ox_enc_sym : ox_enc_name;
|
|
314
314
|
}
|
|
@@ -334,7 +334,7 @@ static char skipBOM(SaxDrive dr) {
|
|
|
334
334
|
if (0xEF == (uint8_t)c) { /* only UTF8 is supported */
|
|
335
335
|
if (0xBB == (uint8_t)buf_get(&dr->buf) && 0xBF == (uint8_t)buf_get(&dr->buf)) {
|
|
336
336
|
dr->encoding = ox_utf8_encoding;
|
|
337
|
-
c
|
|
337
|
+
c = buf_get(&dr->buf);
|
|
338
338
|
} else {
|
|
339
339
|
ox_sax_drive_error(dr, BAD_BOM "invalid BOM or a binary file.");
|
|
340
340
|
c = '\0';
|
|
@@ -1215,9 +1215,10 @@ static char read_attrs(SaxDrive dr, char c, char termc, char term2, int is_xml,
|
|
|
1215
1215
|
col = dr->buf.col + 1;
|
|
1216
1216
|
c = read_quoted_value(dr);
|
|
1217
1217
|
attr_value = dr->buf.str;
|
|
1218
|
+
|
|
1218
1219
|
if (is_encoding) {
|
|
1219
1220
|
dr->encoding = rb_enc_find(dr->buf.str);
|
|
1220
|
-
is_encoding
|
|
1221
|
+
is_encoding = 0;
|
|
1221
1222
|
}
|
|
1222
1223
|
}
|
|
1223
1224
|
if (0 >= dr->blocked && (NULL == h || ActiveOverlay == h->overlay || NestOverlay == h->overlay)) {
|
|
@@ -1368,7 +1369,8 @@ int ox_sax_collapse_special(SaxDrive dr, char *str, long pos, long line, long co
|
|
|
1368
1369
|
char *b = str;
|
|
1369
1370
|
|
|
1370
1371
|
while ('\0' != *s) {
|
|
1371
|
-
|
|
1372
|
+
switch (*s) {
|
|
1373
|
+
case '&': {
|
|
1372
1374
|
int c = 0;
|
|
1373
1375
|
char *end;
|
|
1374
1376
|
|
|
@@ -1458,13 +1460,25 @@ int ox_sax_collapse_special(SaxDrive dr, char *str, long pos, long line, long co
|
|
|
1458
1460
|
}
|
|
1459
1461
|
*b++ = (char)c;
|
|
1460
1462
|
col++;
|
|
1461
|
-
|
|
1463
|
+
break;
|
|
1464
|
+
}
|
|
1465
|
+
case '\r':
|
|
1466
|
+
s++;
|
|
1462
1467
|
if ('\n' == *s) {
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1468
|
+
continue;
|
|
1469
|
+
}
|
|
1470
|
+
line++;
|
|
1471
|
+
col = 1;
|
|
1472
|
+
*b++ = '\n';
|
|
1473
|
+
break;
|
|
1474
|
+
case '\n':
|
|
1475
|
+
line++;
|
|
1476
|
+
col = 0;
|
|
1477
|
+
// fall through
|
|
1478
|
+
default:
|
|
1466
1479
|
col++;
|
|
1467
1480
|
*b++ = *s++;
|
|
1481
|
+
break;
|
|
1468
1482
|
}
|
|
1469
1483
|
}
|
|
1470
1484
|
*b = '\0';
|
data/lib/ox/version.rb
CHANGED
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.14.
|
|
4
|
+
version: 2.14.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter Ohler
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-
|
|
11
|
+
date: 2022-03-31 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\nOptimized
|
|
14
14
|
XML (Ox), as the name implies was written to provide speed optimized\nXML handling.
|