ox 2.14.19 → 2.14.21

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8f79925bdad366a8453ecda24602c7372371b5ac90363def31f7a21c5f46e85a
4
- data.tar.gz: 1d88152e72cd654b215592b9874f6cf4c018853fcbfe3a5e3a37aa4f15a7d0f1
3
+ metadata.gz: 90ae9618a50e6028cfaa556e88975ddc3a6f38572732326ea27145141b3b892d
4
+ data.tar.gz: 24dc5e56d8b1cffe5b2125cb530a68784b4d3d59ace2aa67c8511461b727313a
5
5
  SHA512:
6
- metadata.gz: ed6c242bf2a70049e9af314614fc9c47f51fb4740a1fdb4785fa693d1c93586bf10b4a1c73ba60e6e88c39c6b6b6d283b324ffbd27cac51e915a1fc48c69b5a0
7
- data.tar.gz: 8c0d35c215e6720fff4c82cb711f9f9991b6dfcd91c4ec1c74ac656c52ef1cb74fcc93a4171fbbe28b09aee0ceefe8c50173d20af4935321207db93f45009b18
6
+ metadata.gz: 3a8d4307b4864e47719d0beaa06639cbad02ef7acca448a78161ed44ca97309895a35f14d674effe72060a86e10df4937cc2dcf08241701064bbf23fecaf7b3e
7
+ data.tar.gz: 943e7ef226e58cefb34745e8dc58242e1338e5d671faad42427911ed11199243fe333457a5c21a3de8b23e906cf4bb9e1bff7070e81b42cf6ddd2d3cba01a6b3
data/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All changes to the Ox gem are documented here. Releases follow semantic versioning.
4
4
 
5
+ ## [2.14.21] - 2025-01-15
6
+
7
+ ### Fixed
8
+
9
+ - Removed internal dependency on BigDecimal. If BigDecimal is use it
10
+ must now be included in the calling code. This was forced by the
11
+ change in BigDecimal no longer being included in the Ruby core.
12
+
13
+ ## [2.14.20] - 2025-01-12
14
+
15
+ ### Fixed
16
+
17
+ - The instruction encoding attribute is now used to set the encoding in the `:limited` mode.
18
+
5
19
  ## [2.14.19] - 2024-12-25
6
20
 
7
21
  ### Fixed
data/ext/ox/ox.c CHANGED
@@ -87,7 +87,6 @@ VALUE ox_sym_bank; // Array
87
87
 
88
88
  VALUE ox_arg_error_class;
89
89
  VALUE ox_bag_clas;
90
- VALUE ox_bigdecimal_class;
91
90
  VALUE ox_cdata_clas;
92
91
  VALUE ox_comment_clas;
93
92
  VALUE ox_raw_clas;
@@ -1399,7 +1398,7 @@ void Init_ox(void) {
1399
1398
 
1400
1399
  rb_require("time");
1401
1400
  rb_require("date");
1402
- rb_require("bigdecimal");
1401
+ // rb_require("bigdecimal");
1403
1402
  rb_require("stringio");
1404
1403
 
1405
1404
  ox_abort_id = rb_intern("abort");
@@ -1471,7 +1470,6 @@ void Init_ox(void) {
1471
1470
  ox_arg_error_class = rb_const_get_at(Ox, rb_intern("ArgError"));
1472
1471
  ox_struct_class = rb_const_get(rb_cObject, rb_intern("Struct"));
1473
1472
  ox_stringio_class = rb_const_get(rb_cObject, rb_intern("StringIO"));
1474
- ox_bigdecimal_class = rb_const_get(rb_cObject, rb_intern("BigDecimal"));
1475
1473
 
1476
1474
  abort_sym = ID2SYM(rb_intern("abort"));
1477
1475
  rb_gc_register_address(&abort_sym);
@@ -1589,7 +1587,6 @@ void Init_ox(void) {
1589
1587
  rb_gc_register_address(&ox_arg_error_class);
1590
1588
  rb_gc_register_address(&ox_bag_clas);
1591
1589
  rb_gc_register_address(&ox_bag_clas);
1592
- rb_gc_register_address(&ox_bigdecimal_class);
1593
1590
  rb_gc_register_address(&ox_cdata_clas);
1594
1591
  rb_gc_register_address(&ox_cdata_clas);
1595
1592
  rb_gc_register_address(&ox_comment_clas);
data/ext/ox/ox.h CHANGED
@@ -218,7 +218,6 @@ extern VALUE ox_sym_bank; // Array
218
218
  extern VALUE ox_version_sym;
219
219
  extern VALUE ox_zero_fixnum;
220
220
 
221
- extern VALUE ox_bigdecimal_class;
222
221
  extern VALUE ox_date_class;
223
222
  extern VALUE ox_stringio_class;
224
223
  extern VALUE ox_struct_class;
data/ext/ox/parse.c CHANGED
@@ -342,6 +342,15 @@ DONE:
342
342
  } else {
343
343
  pi->pcb->instruct(pi, target, attrs.head, content_ptr);
344
344
  }
345
+ } else {
346
+ for (Attr a = attrs.head; a < attrs.tail; a++) {
347
+ if (0 == strcasecmp(a->name, "encoding")) {
348
+ strncpy(pi->options->encoding, a->value, sizeof(pi->options->encoding) - 1);
349
+ pi->options->encoding[sizeof(pi->options->encoding) - 1] = '\0';
350
+ pi->options->rb_enc = rb_enc_find(a->value);
351
+ break;
352
+ }
353
+ }
345
354
  }
346
355
  attr_stack_cleanup(&attrs);
347
356
  if (content_ptr != content) {
data/lib/ox/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Ox
2
2
  # Current version of the module.
3
- VERSION = '2.14.19'
3
+ VERSION = '2.14.21'
4
4
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ox
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.14.19
4
+ version: 2.14.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Ohler
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-12-25 00:00:00.000000000 Z
10
+ date: 2025-01-25 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bigdecimal
@@ -52,7 +51,6 @@ files:
52
51
  - ext/ox/err.c
53
52
  - ext/ox/err.h
54
53
  - ext/ox/extconf.rb
55
- - ext/ox/foo.h
56
54
  - ext/ox/gen_load.c
57
55
  - ext/ox/hash_load.c
58
56
  - ext/ox/helper.h
@@ -100,7 +98,6 @@ metadata:
100
98
  homepage_uri: http://www.ohler.com/ox/
101
99
  source_code_uri: https://github.com/ohler55/ox
102
100
  rubygems_mfa_required: 'true'
103
- post_install_message:
104
101
  rdoc_options:
105
102
  - "--main"
106
103
  - README.md
@@ -125,8 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
122
  - !ruby/object:Gem::Version
126
123
  version: '0'
127
124
  requirements: []
128
- rubygems_version: 3.5.11
129
- signing_key:
125
+ rubygems_version: 3.6.2
130
126
  specification_version: 4
131
127
  summary: A fast XML parser and object serializer.
132
128
  test_files: []
data/ext/ox/foo.h DELETED
@@ -1,204 +0,0 @@
1
- /* sax_buf.h
2
- * Copyright (c) 2011, Peter Ohler
3
- * All rights reserved.
4
- */
5
-
6
- #ifndef OX_SAX_BUF_H
7
- #define OX_SAX_BUF_H
8
-
9
- #include <stdio.h>
10
-
11
- typedef struct _buf {
12
- char base[0x00001000];
13
- char *head;
14
- char *end;
15
- char *tail;
16
- char *read_end; /* one past last character read */
17
- char *pro; /* protection start, buffer can not slide past this point */
18
- char *str; /* start of current string being read */
19
- off_t pos;
20
- off_t line;
21
- off_t col;
22
- off_t pro_pos;
23
- off_t pro_line;
24
- off_t pro_col;
25
- int (*read_func)(struct _buf *buf);
26
- union {
27
- int fd;
28
- VALUE io;
29
- const char *str;
30
- } in;
31
- struct _saxDrive *dr;
32
- } *Buf;
33
-
34
- typedef struct _checkPt {
35
- off_t pro_dif;
36
- off_t pos;
37
- off_t line;
38
- off_t col;
39
- char c;
40
- } *CheckPt;
41
-
42
- #define CHECK_PT_INIT {-1, 0, 0, 0, '\0'}
43
-
44
- extern void ox_sax_buf_init(Buf buf, VALUE io);
45
- extern int ox_sax_buf_read(Buf buf);
46
-
47
- static inline char buf_get(Buf buf) {
48
- // printf("*** drive get from '%s' from start: %ld buf: %p from read_end: %ld\n", buf->tail, buf->tail -
49
- // buf->head, buf->head, buf->read_end - buf->tail);
50
- if (buf->read_end <= buf->tail) {
51
- if (0 != ox_sax_buf_read(buf)) {
52
- return '\0';
53
- }
54
- }
55
- if ('\n' == *buf->tail) {
56
- buf->line++;
57
- buf->col = 0;
58
- } else {
59
- buf->col++;
60
- }
61
- buf->pos++;
62
-
63
- return *buf->tail++;
64
- }
65
-
66
- static inline void buf_backup(Buf buf) {
67
- buf->tail--;
68
- buf->col--;
69
- buf->pos--;
70
- if (0 >= buf->col) {
71
- buf->line--;
72
- // allow col to be negative since we never backup twice in a row
73
- }
74
- }
75
-
76
- static inline void buf_protect(Buf buf) {
77
- buf->pro = buf->tail;
78
- buf->str = buf->tail; // can't have str before pro
79
- buf->pro_pos = buf->pos;
80
- buf->pro_line = buf->line;
81
- buf->pro_col = buf->col;
82
- }
83
-
84
- static inline void buf_reset(Buf buf) {
85
- buf->tail = buf->pro;
86
- buf->pos = buf->pro_pos;
87
- buf->line = buf->pro_line;
88
- buf->col = buf->pro_col;
89
- }
90
-
91
- /* Starts by reading a character so it is safe to use with an empty or
92
- * compacted buffer.
93
- */
94
- static inline char buf_next_non_white(Buf buf) {
95
- char c;
96
-
97
- while ('\0' != (c = buf_get(buf))) {
98
- switch (c) {
99
- case ' ':
100
- case '\t':
101
- case '\f':
102
- case '\n':
103
- case '\r': break;
104
- default: return c;
105
- }
106
- }
107
- return '\0';
108
- }
109
-
110
- /* Starts by reading a character so it is safe to use with an empty or
111
- * compacted buffer.
112
- */
113
- static inline char buf_next_white(Buf buf) {
114
- char c;
115
-
116
- while ('\0' != (c = buf_get(buf))) {
117
- switch (c) {
118
- case ' ':
119
- case '\t':
120
- case '\f':
121
- case '\n':
122
- case '\r':
123
- case '\0': return c;
124
- default: break;
125
- }
126
- }
127
- return '\0';
128
- }
129
-
130
- static inline void buf_cleanup(Buf buf) {
131
- if (buf->base != buf->head && 0 != buf->head) {
132
- xfree(buf->head);
133
- buf->head = 0;
134
- }
135
- }
136
-
137
- static inline int is_white(char c) {
138
- switch (c) {
139
- case ' ':
140
- case '\t':
141
- case '\f':
142
- case '\n':
143
- case '\r': return 1;
144
- default: break;
145
- }
146
- return 0;
147
- }
148
-
149
- static inline void buf_checkpoint(Buf buf, CheckPt cp) {
150
- cp->pro_dif = (int)(buf->tail - buf->pro);
151
- cp->pos = buf->pos;
152
- cp->line = buf->line;
153
- cp->col = buf->col;
154
- cp->c = *(buf->tail - 1);
155
- }
156
-
157
- static inline int buf_checkset(CheckPt cp) {
158
- return (0 <= cp->pro_dif);
159
- }
160
-
161
- static inline char buf_checkback(Buf buf, CheckPt cp) {
162
- buf->tail = buf->pro + cp->pro_dif;
163
- buf->pos = cp->pos;
164
- buf->line = cp->line;
165
- buf->col = cp->col;
166
- return cp->c;
167
- }
168
-
169
- static inline void buf_collapse_return(char *str) {
170
- char *s = str;
171
- char *back = str;
172
-
173
- for (; '\0' != *s; s++) {
174
- if (back != str && '\n' == *s && '\r' == *(back - 1)) {
175
- *(back - 1) = '\n';
176
- } else {
177
- *back++ = *s;
178
- }
179
- }
180
- *back = '\0';
181
- }
182
-
183
- static inline void buf_collapse_white(char *str) {
184
- char *s = str;
185
- char *back = str;
186
-
187
- for (; '\0' != *s; s++) {
188
- switch (*s) {
189
- case ' ':
190
- case '\t':
191
- case '\f':
192
- case '\n':
193
- case '\r':
194
- if (back == str || ' ' != *(back - 1)) {
195
- *back++ = ' ';
196
- }
197
- break;
198
- default: *back++ = *s; break;
199
- }
200
- }
201
- *back = '\0';
202
- }
203
-
204
- #endif /* OX_SAX_BUF_H */