ox 1.6.9 → 1.7.0

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. data/README.md +5 -1
  2. data/ext/ox/ox.c +0 -12
  3. data/ext/ox/sax.c +14 -1
  4. data/lib/ox/version.rb +1 -1
  5. metadata +2 -2
data/README.md CHANGED
@@ -34,9 +34,13 @@ A fast XML parser and Object marshaller as a Ruby gem.
34
34
 
35
35
  ## <a name="release">Release Notes</a>
36
36
 
37
+ ### Release 1.7.0
38
+
39
+ - Added support for BOM in the SAX parser.
40
+
37
41
  ### Release 1.6.9
38
42
 
39
- - Added support for BOM. They are honored for and handled correctly for UTF-8. Others cause encoding issues with Ruby or raise an error as others are not ASCII compatible..
43
+ - Added support for BOM. They are honored for and handled correctly for UTF-8. Others cause encoding issues with Ruby or raise an error as others are not ASCII compatible.
40
44
 
41
45
  ## <a name="description">Description</a>
42
46
 
data/ext/ox/ox.c CHANGED
@@ -131,16 +131,8 @@ static VALUE xsd_date_sym;
131
131
 
132
132
  #if HAS_ENCODING_SUPPORT
133
133
  rb_encoding *ox_utf8_encoding = 0;
134
- static rb_encoding *ox_utf16le_encoding = 0;
135
- static rb_encoding *ox_utf16be_encoding = 0;
136
- static rb_encoding *ox_utf32le_encoding = 0;
137
- static rb_encoding *ox_utf32be_encoding = 0;
138
134
  #else
139
135
  void *ox_utf8_encoding = 0;
140
- static void *ox_utf16le_encoding = 0;
141
- static void *ox_utf16be_encoding = 0;
142
- static void *ox_utf32le_encoding = 0;
143
- static void *ox_utf32be_encoding = 0;
144
136
  #endif
145
137
 
146
138
  struct _Options ox_default_options = {
@@ -866,10 +858,6 @@ void Init_ox() {
866
858
  rb_define_module_function(Ox, "cache8_test", cache8_test, 0);
867
859
  #if HAS_ENCODING_SUPPORT
868
860
  ox_utf8_encoding = rb_enc_find("UTF-8");
869
- ox_utf16le_encoding = rb_enc_find("UTF-16LE");
870
- ox_utf16be_encoding = rb_enc_find("UTF-16BE");
871
- ox_utf32le_encoding = rb_enc_find("UTF-32LE");
872
- ox_utf32be_encoding = rb_enc_find("UTF-32BE");
873
861
  #endif
874
862
  }
875
863
 
data/ext/ox/sax.c CHANGED
@@ -409,7 +409,20 @@ read_children(SaxDrive dr, int first) {
409
409
 
410
410
  while (!err) {
411
411
  dr->str = dr->cur; /* protect the start */
412
- if ('\0' == (c = next_non_white(dr))) {
412
+ c = sax_drive_get(dr);
413
+ if (first) {
414
+ if (0xEF == (uint8_t)c) { /* only UTF8 is supported */
415
+ if (0xBB == (uint8_t)sax_drive_get(dr) && 0xBF == (uint8_t)sax_drive_get(dr)) {
416
+ #if HAS_ENCODING_SUPPORT
417
+ dr->encoding = ox_utf8_encoding;
418
+ #endif
419
+ c = sax_drive_get(dr);
420
+ } else {
421
+ sax_drive_error(dr, "invalid format, invalid BOM or a binary file.", 1);
422
+ }
423
+ }
424
+ }
425
+ if ('\0' == c || (is_white(c) && '\0' == (c = next_non_white(dr)))) {
413
426
  if (!first) {
414
427
  sax_drive_error(dr, "invalid format, element not terminated", 1);
415
428
  err = 1;
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 = '1.6.9'
4
+ VERSION = '1.7.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.9
4
+ version: 1.7.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-25 00:00:00.000000000 Z
12
+ date: 2012-11-27 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! "A fast XML parser and object serializer that uses only standard C
15
15
  lib.\n \nOptimized XML (Ox), as the name implies was written to provide