nokogiri 1.6.8.rc1-x64-mingw32 → 1.6.8.rc2-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of nokogiri might be problematic. Click here for more details.

Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.cross_rubies +2 -0
  3. data/CHANGELOG.rdoc +16 -2
  4. data/Gemfile +2 -2
  5. data/LICENSE.txt +1 -1
  6. data/Manifest.txt +0 -1
  7. data/Rakefile +5 -3
  8. data/ext/nokogiri/extconf.rb +1 -2
  9. data/ext/nokogiri/html_document.c +6 -6
  10. data/ext/nokogiri/html_element_description.c +1 -1
  11. data/ext/nokogiri/html_entity_lookup.c +1 -1
  12. data/ext/nokogiri/html_sax_parser_context.c +4 -4
  13. data/ext/nokogiri/html_sax_push_parser.c +2 -2
  14. data/ext/nokogiri/xml_attr.c +2 -2
  15. data/ext/nokogiri/xml_comment.c +1 -1
  16. data/ext/nokogiri/xml_document.c +18 -18
  17. data/ext/nokogiri/xml_encoding_handler.c +3 -3
  18. data/ext/nokogiri/xml_entity_reference.c +1 -1
  19. data/ext/nokogiri/xml_node.c +27 -27
  20. data/ext/nokogiri/xml_node_set.c +3 -11
  21. data/ext/nokogiri/xml_processing_instruction.c +2 -2
  22. data/ext/nokogiri/xml_reader.c +6 -6
  23. data/ext/nokogiri/xml_sax_parser_context.c +1 -1
  24. data/ext/nokogiri/xml_sax_push_parser.c +1 -1
  25. data/ext/nokogiri/xml_schema.c +1 -1
  26. data/ext/nokogiri/xml_text.c +1 -1
  27. data/ext/nokogiri/xml_xpath_context.c +6 -6
  28. data/ext/nokogiri/xslt_stylesheet.c +6 -6
  29. data/lib/nokogiri/2.0/nokogiri.so +0 -0
  30. data/lib/nokogiri/2.1/nokogiri.so +0 -0
  31. data/lib/nokogiri/2.2/nokogiri.so +0 -0
  32. data/lib/nokogiri/2.3/nokogiri.so +0 -0
  33. data/lib/nokogiri/version.rb +1 -1
  34. data/lib/nokogiri/xml/node.rb +5 -9
  35. data/lib/nokogiri/xml/node_set.rb +3 -3
  36. data/test/html/test_document.rb +3 -3
  37. data/test/html/test_document_encoding.rb +4 -4
  38. data/test/html/test_node_encoding.rb +60 -0
  39. data/test/test_css_cache.rb +1 -1
  40. data/test/test_reader.rb +19 -19
  41. data/test/xml/sax/test_parser.rb +3 -7
  42. data/test/xml/test_document_encoding.rb +3 -3
  43. data/test/xml/test_namespace.rb +2 -2
  44. data/test/xml/test_node.rb +4 -4
  45. data/test/xml/test_node_encoding.rb +33 -69
  46. data/test/xml/test_node_set.rb +1 -1
  47. data/test/xml/test_unparented_node.rb +1 -1
  48. data/test_all +15 -9
  49. metadata +13 -12
  50. data/CHANGELOG.ja.rdoc +0 -1075
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd3ece857056eba5ef053b1b3f1ba36b8b1dad0b
4
- data.tar.gz: 0d1c2c6507a631a30516ff8daa9914302ff9fc81
3
+ metadata.gz: ebb56ce1f6ceb9f335e50dd3588f3aa9e3877264
4
+ data.tar.gz: dc646f895d24c63944a492ea17a91da1190d7875
5
5
  SHA512:
6
- metadata.gz: 34774095d0629e469e8b6169f4e0e0e3d8531410d19c1cb96675fb81feec2e079f81ef1bd2a5d8c9170347c3ed4b4855458c08e81821cf455ac77a9f5e8950b1
7
- data.tar.gz: b2c79c44dc8a5e950a7cdb5c93f3a0b26ea8d8193f77a2d7f3b81eb8ba337f4ef7f68ebf4774086b6c6e301b3a3376379cf59d82af2431b0ce7402120feb2916
6
+ metadata.gz: 5576039da2c18311964472523327827f100a8d7b602b86bc1cf6a73a5ecd0bb8dc6d8086cff2da6db49a0d2b4186528fd34ad1c5c915c52af7b7a256f618c255
7
+ data.tar.gz: 2faaea271be2dcf8a9ac28903b33916db307a23b77543a44237d73192fdbeba05009c9b0af6a71cdcd6086771176edc8b2df2299ff58aa66e7dce26ca0b096d8
@@ -5,3 +5,5 @@
5
5
  2.1.6:x86_64-w64-mingw32
6
6
  2.2.2:i686-w64-mingw32
7
7
  2.2.2:x86_64-w64-mingw32
8
+ 2.3.0:i686-w64-mingw32
9
+ 2.3.0:x86_64-w64-mingw32
@@ -5,15 +5,29 @@
5
5
  * (MRI) Bundled Libxml2 is upgraded to 2.9.3, which fixes a series of security issues. See https://mail.gnome.org/archives/xml/2015-November/msg00012.html
6
6
 
7
7
 
8
+ ==== Features
9
+
10
+ Several changes were made to improve performance:
11
+
12
+ * [MRI] Simplify NodeSet#to_a with a minor speed-up. (#1397)
13
+ * XML::Node#ancestors optimization (#1297) (Thanks, Bruno Sutic!)
14
+ * Use Symbol#to_proc where we weren't previously, because Ruby 1.8.7 reasons. (#1296) (Thanks, Bruno Sutic!)
15
+
16
+
8
17
  ==== Bug Fixes
9
18
 
10
19
  * [JRuby] fix load errors when deploying to JRuby/Torquebox (#1114) (Thanks, @atambo!)
11
20
  * [JRuby] fix NPE when inspecting nodes returned by NodeSet#drop (#1042) (Thanks, @mkristian!)
12
21
  * [JRuby] fix nil attriubte node's namespace in reader (#1327) (Thanks, @codekitchen!)
22
+ * [JRuby] fix Nokogiri munging unicode characters that require more than 2 bytes (#1113) (Thanks, @mkristian!)
13
23
  * [MRI] fix assertion failure while accessing attribute node's namespace in reader (#843) (Thanks, @2potatocakes!)
14
24
  * [MRI] fix issue with GCing namespace nodes returned in an xpath query. (#1155)
25
+ * [MRI] Ensure C strings are null-terminated. (#1381)
15
26
  * unescape special characters in CSS queries (#1303) (Thanks, @twalpole!)
16
27
  * consistently handle empty documents (#1349)
28
+ * Update to mini_portile2 2.1.0 to address whitespace-handling during patching. (#1402)
29
+ * Fix encoding of xml node namespaces.
30
+ * Work around issue installing Nokogiri on overlayfs (commonly used in Docker containers). (#1370, #1405)
17
31
 
18
32
 
19
33
  === 1.6.7.1 / 2015-12-16
@@ -59,7 +73,7 @@ See #1374 and #1376 for details.
59
73
  * [JRuby] reset the namespace cache when replacing the document's innerHtml (#1265) (Thanks, @mkristian!)
60
74
  * [JRuby] Document#parse should support IO objects that respond to #read. (#1124) (Thanks, Jake Byman!)
61
75
  * [MRI] Duplicate-id errors when setting the `id` attribute on HTML documents are now silenced. (#1262)
62
- * [JRuby] SAX parser cuts texts in peices when quare brackets exist. (#1261)
76
+ * [JRuby] SAX parser cuts texts in pieces when square brackets exist. (#1261)
63
77
  * [JRuby] Namespaced attributes aren't removed by remove_attribute. (#1299)
64
78
 
65
79
 
@@ -69,7 +83,7 @@ This version pulls in an upstream patch to the vendored libxml2 to address:
69
83
 
70
84
  * unclosed comment uninitialized access issue (#1376)
71
85
 
72
- This issue does not have a CVE assigned to it as this time.
86
+ This issue was assigned CVE-2015-8710 after the fact. See http://seclists.org/oss-sec/2015/q4/616 for details.
73
87
 
74
88
 
75
89
  === 1.6.6.3 / 2015-11-16
data/Gemfile CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  source "https://rubygems.org/"
6
6
 
7
- gem "mini_portile2", "~>2.0.0"
7
+ gem "mini_portile2", "~>2.1.0"
8
8
 
9
9
  gem "rdoc", "~>4.0", :group => [:development, :test]
10
10
  gem "hoe-bundler", ">=1.1", :group => [:development, :test]
@@ -14,7 +14,7 @@ gem "hoe-git", ">=1.4", :group => [:development, :test]
14
14
  gem "minitest", "~>2.2.2", :group => [:development, :test]
15
15
  gem "rake", ">=0.9", :group => [:development, :test]
16
16
  gem "rake-compiler", "~>0.9.2", :group => [:development, :test]
17
- gem "rake-compiler-dock", "~>0.4.2", :group => [:development, :test]
17
+ gem "rake-compiler-dock", "~>0.5.0", :group => [:development, :test]
18
18
  gem "racc", ">=1.4.6", :group => [:development, :test], :platform => :ruby
19
19
  gem "rexical", ">=1.0.5", :group => [:development, :test], :platform => :ruby
20
20
  gem "hoe", "~>3.14", :group => [:development, :test]
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2008 - 2015:
3
+ Copyright (c) 2008 - 2016:
4
4
 
5
5
  * [Aaron Patterson](http://tenderlovemaking.com)
6
6
  * [Mike Dalessio](http://mike.daless.io)
@@ -3,7 +3,6 @@
3
3
  .editorconfig
4
4
  .gemtest
5
5
  .travis.yml
6
- CHANGELOG.ja.rdoc
7
6
  CHANGELOG.rdoc
8
7
  CONTRIBUTING.md
9
8
  C_CODING_STYLE.rdoc
data/Rakefile CHANGED
@@ -129,7 +129,7 @@ HOE = Hoe.spec 'nokogiri' do
129
129
  unless java?
130
130
  self.extra_deps += [
131
131
  # Keep this version in sync with the one in extconf.rb !
132
- ["mini_portile2", "~> 2.0.0"],
132
+ ["mini_portile2", "~> 2.1.0"],
133
133
  ]
134
134
  end
135
135
 
@@ -141,7 +141,7 @@ HOE = Hoe.spec 'nokogiri' do
141
141
  ["minitest", "~> 2.2.2"],
142
142
  ["rake", ">= 0.9"],
143
143
  ["rake-compiler", "~> 0.9.2"],
144
- ["rake-compiler-dock", "~> 0.4.2"],
144
+ ["rake-compiler-dock", "~> 0.5.0"],
145
145
  ["racc", ">= 1.4.6"],
146
146
  ["rexical", ">= 1.0.5"]
147
147
  ]
@@ -184,6 +184,7 @@ if java?
184
184
  ext.target_version = '1.6'
185
185
  jars = ["#{jruby_home}/lib/jruby.jar"] + FileList['lib/*.jar']
186
186
  ext.classpath = jars.map { |x| File.expand_path x }.join ':'
187
+ ext.debug = true if ENV['JAVA_DEBUG']
187
188
  end
188
189
 
189
190
  task gem_build_path => [:compile] do
@@ -295,7 +296,8 @@ end
295
296
  require 'tasks/test'
296
297
 
297
298
  task :java_debug do
298
- ENV['JAVA_OPTS'] = '-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y' if java? && ENV['JAVA_DEBUG']
299
+ ENV['JRUBY_OPTS'] = "#{ENV['JRUBY_OPTS']} --debug --dev"
300
+ ENV['JAVA_OPTS'] = '-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y' if ENV['JAVA_DEBUG']
299
301
  end
300
302
 
301
303
  if java?
@@ -57,7 +57,6 @@ def do_clean
57
57
  # clean the ports build directory
58
58
  Pathname.glob(pwd.join('tmp', '*', 'ports')) { |dir|
59
59
  FileUtils.rm_rf(dir, verbose: true)
60
- FileUtils.rmdir(dir.parent, parents: true, verbose: true)
61
60
  }
62
61
 
63
62
  if enable_config('static')
@@ -393,7 +392,7 @@ else
393
392
 
394
393
  # The gem version constraint in the Rakefile is not respected at install time.
395
394
  # Keep this version in sync with the one in the Rakefile !
396
- gem "mini_portile2", "~> 2.0.0"
395
+ gem "mini_portile2", "~> 2.1.0"
397
396
  require 'mini_portile2'
398
397
  message "Using mini_portile version #{MiniPortile::VERSION}\n"
399
398
 
@@ -18,8 +18,8 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
18
18
  external_id = rb_ary_entry(rest, (long)1);
19
19
 
20
20
  doc = htmlNewDoc(
21
- RTEST(uri) ? (const xmlChar *)StringValuePtr(uri) : NULL,
22
- RTEST(external_id) ? (const xmlChar *)StringValuePtr(external_id) : NULL
21
+ RTEST(uri) ? (const xmlChar *)StringValueCStr(uri) : NULL,
22
+ RTEST(external_id) ? (const xmlChar *)StringValueCStr(external_id) : NULL
23
23
  );
24
24
  rb_doc = Nokogiri_wrap_xml_document(klass, doc);
25
25
  rb_obj_call_init(rb_doc, argc, argv);
@@ -39,8 +39,8 @@ static VALUE read_io( VALUE klass,
39
39
  VALUE encoding,
40
40
  VALUE options )
41
41
  {
42
- const char * c_url = NIL_P(url) ? NULL : StringValuePtr(url);
43
- const char * c_enc = NIL_P(encoding) ? NULL : StringValuePtr(encoding);
42
+ const char * c_url = NIL_P(url) ? NULL : StringValueCStr(url);
43
+ const char * c_enc = NIL_P(encoding) ? NULL : StringValueCStr(encoding);
44
44
  VALUE error_list = rb_ary_new();
45
45
  VALUE document;
46
46
  htmlDocPtr doc;
@@ -103,8 +103,8 @@ static VALUE read_memory( VALUE klass,
103
103
  VALUE options )
104
104
  {
105
105
  const char * c_buffer = StringValuePtr(string);
106
- const char * c_url = NIL_P(url) ? NULL : StringValuePtr(url);
107
- const char * c_enc = NIL_P(encoding) ? NULL : StringValuePtr(encoding);
106
+ const char * c_url = NIL_P(url) ? NULL : StringValueCStr(url);
107
+ const char * c_enc = NIL_P(encoding) ? NULL : StringValueCStr(encoding);
108
108
  int len = (int)RSTRING_LEN(string);
109
109
  VALUE error_list = rb_ary_new();
110
110
  VALUE document;
@@ -245,7 +245,7 @@ static VALUE name(VALUE self)
245
245
  static VALUE get_description(VALUE klass, VALUE tag_name)
246
246
  {
247
247
  const htmlElemDesc * description = htmlTagLookup(
248
- (const xmlChar *)StringValuePtr(tag_name)
248
+ (const xmlChar *)StringValueCStr(tag_name)
249
249
  );
250
250
 
251
251
  if(NULL == description) return Qnil;
@@ -9,7 +9,7 @@
9
9
  static VALUE get(VALUE self, VALUE key)
10
10
  {
11
11
  const htmlEntityDesc * desc =
12
- htmlEntityLookup((const xmlChar *)StringValuePtr(key));
12
+ htmlEntityLookup((const xmlChar *)StringValueCStr(key));
13
13
  VALUE klass, args[3];
14
14
 
15
15
  if(NULL == desc) return Qnil;
@@ -31,12 +31,12 @@ parse_memory(VALUE klass, VALUE data, VALUE encoding)
31
31
  }
32
32
 
33
33
  if (RTEST(encoding)) {
34
- xmlCharEncodingHandlerPtr enc = xmlFindCharEncodingHandler(StringValuePtr(encoding));
34
+ xmlCharEncodingHandlerPtr enc = xmlFindCharEncodingHandler(StringValueCStr(encoding));
35
35
  if (enc != NULL) {
36
36
  xmlSwitchToEncoding(ctxt, enc);
37
37
  if (ctxt->errNo == XML_ERR_UNSUPPORTED_ENCODING) {
38
38
  rb_raise(rb_eRuntimeError, "Unsupported encoding %s",
39
- StringValuePtr(encoding));
39
+ StringValueCStr(encoding));
40
40
  }
41
41
  }
42
42
  }
@@ -47,8 +47,8 @@ parse_memory(VALUE klass, VALUE data, VALUE encoding)
47
47
  static VALUE parse_file(VALUE klass, VALUE filename, VALUE encoding)
48
48
  {
49
49
  htmlParserCtxtPtr ctxt = htmlCreateFileParserCtxt(
50
- StringValuePtr(filename),
51
- StringValuePtr(encoding)
50
+ StringValueCStr(filename),
51
+ StringValueCStr(encoding)
52
52
  );
53
53
  return Data_Wrap_Struct(klass, NULL, deallocate, ctxt);
54
54
  }
@@ -46,10 +46,10 @@ static VALUE initialize_native(VALUE self, VALUE _xml_sax, VALUE _filename,
46
46
 
47
47
  Data_Get_Struct(_xml_sax, xmlSAXHandler, sax);
48
48
 
49
- if(_filename != Qnil) filename = StringValuePtr(_filename);
49
+ if(_filename != Qnil) filename = StringValueCStr(_filename);
50
50
 
51
51
  if (!NIL_P(encoding)) {
52
- enc = xmlParseCharEncoding(StringValuePtr(encoding));
52
+ enc = xmlParseCharEncoding(StringValueCStr(encoding));
53
53
  if (enc == XML_CHAR_ENCODING_ERROR)
54
54
  rb_raise(rb_eArgError, "Unsupported Encoding");
55
55
  }
@@ -20,7 +20,7 @@ static VALUE set_value(VALUE self, VALUE content)
20
20
  xmlNode *tmp;
21
21
 
22
22
  /* Encode our content */
23
- buffer = xmlEncodeEntitiesReentrant(attr->doc, (unsigned char *)StringValuePtr(content));
23
+ buffer = xmlEncodeEntitiesReentrant(attr->doc, (unsigned char *)StringValueCStr(content));
24
24
 
25
25
  attr->children = xmlStringGetNodeList(attr->doc, buffer);
26
26
  attr->last = NULL;
@@ -61,7 +61,7 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
61
61
 
62
62
  node = xmlNewDocProp(
63
63
  xml_doc,
64
- (const xmlChar *)StringValuePtr(name),
64
+ (const xmlChar *)StringValueCStr(name),
65
65
  NULL
66
66
  );
67
67
 
@@ -34,7 +34,7 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
34
34
 
35
35
  node = xmlNewDocComment(
36
36
  xml_doc,
37
- (const xmlChar *)StringValuePtr(content)
37
+ (const xmlChar *)StringValueCStr(content)
38
38
  );
39
39
 
40
40
  rb_node = Nokogiri_wrap_xml_node(klass, node);
@@ -181,7 +181,7 @@ static VALUE set_encoding(VALUE self, VALUE encoding)
181
181
  if (doc->encoding)
182
182
  free((char *) doc->encoding); /* this may produce a gcc cast warning */
183
183
 
184
- doc->encoding = xmlStrdup((xmlChar *)StringValuePtr(encoding));
184
+ doc->encoding = xmlStrdup((xmlChar *)StringValueCStr(encoding));
185
185
 
186
186
  return encoding;
187
187
  }
@@ -228,8 +228,8 @@ static VALUE read_io( VALUE klass,
228
228
  VALUE encoding,
229
229
  VALUE options )
230
230
  {
231
- const char * c_url = NIL_P(url) ? NULL : StringValuePtr(url);
232
- const char * c_enc = NIL_P(encoding) ? NULL : StringValuePtr(encoding);
231
+ const char * c_url = NIL_P(url) ? NULL : StringValueCStr(url);
232
+ const char * c_enc = NIL_P(encoding) ? NULL : StringValueCStr(encoding);
233
233
  VALUE error_list = rb_ary_new();
234
234
  VALUE document;
235
235
  xmlDocPtr doc;
@@ -279,8 +279,8 @@ static VALUE read_memory( VALUE klass,
279
279
  VALUE options )
280
280
  {
281
281
  const char * c_buffer = StringValuePtr(string);
282
- const char * c_url = NIL_P(url) ? NULL : StringValuePtr(url);
283
- const char * c_enc = NIL_P(encoding) ? NULL : StringValuePtr(encoding);
282
+ const char * c_url = NIL_P(url) ? NULL : StringValueCStr(url);
283
+ const char * c_enc = NIL_P(encoding) ? NULL : StringValueCStr(encoding);
284
284
  int len = (int)RSTRING_LEN(string);
285
285
  VALUE error_list = rb_ary_new();
286
286
  VALUE document;
@@ -355,7 +355,7 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
355
355
  version = rb_ary_entry(rest, (long)0);
356
356
  if (NIL_P(version)) version = rb_str_new2("1.0");
357
357
 
358
- doc = xmlNewDoc((xmlChar *)StringValuePtr(version));
358
+ doc = xmlNewDoc((xmlChar *)StringValueCStr(version));
359
359
  rb_doc = Nokogiri_wrap_xml_document(klass, doc);
360
360
  rb_obj_call_init(rb_doc, argc, argv);
361
361
  return rb_doc ;
@@ -383,13 +383,13 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
383
383
  * </bicycle>
384
384
  * </root>
385
385
  * EOXML
386
- *
386
+ *
387
387
  * doc.xpath("//tire").to_s # => ""
388
388
  * doc.xpath("//part:tire", "part" => "http://general-motors.com/").to_s # => "<part:tire>Michelin Model XGV</part:tire>"
389
389
  * doc.xpath("//part:tire", "part" => "http://schwinn.com/").to_s # => "<part:tire>I'm a bicycle tire!</part:tire>"
390
- *
390
+ *
391
391
  * doc.remove_namespaces!
392
- *
392
+ *
393
393
  * doc.xpath("//tire").to_s # => "<tire>Michelin Model XGV</tire><tire>I'm a bicycle tire!</tire>"
394
394
  * doc.xpath("//part:tire", "part" => "http://general-motors.com/").to_s # => ""
395
395
  * doc.xpath("//part:tire", "part" => "http://schwinn.com/").to_s # => ""
@@ -436,11 +436,11 @@ static VALUE create_entity(int argc, VALUE *argv, VALUE self)
436
436
  xmlResetLastError();
437
437
  ptr = xmlAddDocEntity(
438
438
  doc,
439
- (xmlChar *)(NIL_P(name) ? NULL : StringValuePtr(name)),
439
+ (xmlChar *)(NIL_P(name) ? NULL : StringValueCStr(name)),
440
440
  (int) (NIL_P(type) ? XML_INTERNAL_GENERAL_ENTITY : NUM2INT(type)),
441
- (xmlChar *)(NIL_P(external_id) ? NULL : StringValuePtr(external_id)),
442
- (xmlChar *)(NIL_P(system_id) ? NULL : StringValuePtr(system_id)),
443
- (xmlChar *)(NIL_P(content) ? NULL : StringValuePtr(content))
441
+ (xmlChar *)(NIL_P(external_id) ? NULL : StringValueCStr(external_id)),
442
+ (xmlChar *)(NIL_P(system_id) ? NULL : StringValueCStr(system_id)),
443
+ (xmlChar *)(NIL_P(content) ? NULL : StringValueCStr(content))
444
444
  );
445
445
 
446
446
  if(NULL == ptr) {
@@ -484,9 +484,9 @@ static int block_caller(void * ctx, xmlNodePtr _node, xmlNodePtr _parent)
484
484
  * doc.canonicalize { |obj, parent| ... }
485
485
  *
486
486
  * Canonicalize a document and return the results. Takes an optional block
487
- * that takes two parameters: the +obj+ and that node's +parent+.
487
+ * that takes two parameters: the +obj+ and that node's +parent+.
488
488
  * The +obj+ will be either a Nokogiri::XML::Node, or a Nokogiri::XML::Namespace
489
- * The block must return a non-nil, non-false value if the +obj+ passed in
489
+ * The block must return a non-nil, non-false value if the +obj+ passed in
490
490
  * should be included in the canonicalized document.
491
491
  */
492
492
  static VALUE canonicalize(int argc, VALUE* argv, VALUE self)
@@ -531,14 +531,14 @@ static VALUE canonicalize(int argc, VALUE* argv, VALUE self)
531
531
  ns = calloc((size_t)ns_len+1, sizeof(xmlChar *));
532
532
  for (i = 0 ; i < ns_len ; i++) {
533
533
  VALUE entry = rb_ary_entry(incl_ns, i);
534
- const char * ptr = StringValuePtr(entry);
534
+ const char * ptr = StringValueCStr(entry);
535
535
  ns[i] = (xmlChar*) ptr;
536
536
  }
537
537
  }
538
538
 
539
539
 
540
- xmlC14NExecute(doc, cb, ctx,
541
- (int) (NIL_P(mode) ? 0 : NUM2INT(mode)),
540
+ xmlC14NExecute(doc, cb, ctx,
541
+ (int) (NIL_P(mode) ? 0 : NUM2INT(mode)),
542
542
  ns,
543
543
  (int) RTEST(with_comments),
544
544
  buf);
@@ -9,7 +9,7 @@ static VALUE get(VALUE klass, VALUE key)
9
9
  {
10
10
  xmlCharEncodingHandlerPtr handler;
11
11
 
12
- handler = xmlFindCharEncodingHandler(StringValuePtr(key));
12
+ handler = xmlFindCharEncodingHandler(StringValueCStr(key));
13
13
  if(handler)
14
14
  return Data_Wrap_Struct(klass, NULL, NULL, handler);
15
15
 
@@ -23,7 +23,7 @@ static VALUE get(VALUE klass, VALUE key)
23
23
  */
24
24
  static VALUE delete(VALUE klass, VALUE name)
25
25
  {
26
- if(xmlDelEncodingAlias(StringValuePtr(name))) return Qnil;
26
+ if(xmlDelEncodingAlias(StringValueCStr(name))) return Qnil;
27
27
 
28
28
  return Qtrue;
29
29
  }
@@ -35,7 +35,7 @@ static VALUE delete(VALUE klass, VALUE name)
35
35
  */
36
36
  static VALUE alias(VALUE klass, VALUE from, VALUE to)
37
37
  {
38
- xmlAddEncodingAlias(StringValuePtr(from), StringValuePtr(to));
38
+ xmlAddEncodingAlias(StringValueCStr(from), StringValueCStr(to));
39
39
 
40
40
  return to;
41
41
  }
@@ -21,7 +21,7 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
21
21
 
22
22
  node = xmlNewReference(
23
23
  xml_doc,
24
- (const xmlChar *)StringValuePtr(name)
24
+ (const xmlChar *)StringValueCStr(name)
25
25
  );
26
26
 
27
27
  nokogiri_root_node(node);
@@ -331,7 +331,7 @@ static VALUE encode_special_chars(VALUE self, VALUE string)
331
331
  Data_Get_Struct(self, xmlNode, node);
332
332
  encoded = xmlEncodeSpecialChars(
333
333
  node->doc,
334
- (const xmlChar *)StringValuePtr(string)
334
+ (const xmlChar *)StringValueCStr(string)
335
335
  );
336
336
 
337
337
  encoded_str = NOKOGIRI_STR_NEW2(encoded);
@@ -367,9 +367,9 @@ static VALUE create_internal_subset(VALUE self, VALUE name, VALUE external_id, V
367
367
 
368
368
  dtd = xmlCreateIntSubset(
369
369
  doc,
370
- NIL_P(name) ? NULL : (const xmlChar *)StringValuePtr(name),
371
- NIL_P(external_id) ? NULL : (const xmlChar *)StringValuePtr(external_id),
372
- NIL_P(system_id) ? NULL : (const xmlChar *)StringValuePtr(system_id)
370
+ NIL_P(name) ? NULL : (const xmlChar *)StringValueCStr(name),
371
+ NIL_P(external_id) ? NULL : (const xmlChar *)StringValueCStr(external_id),
372
+ NIL_P(system_id) ? NULL : (const xmlChar *)StringValueCStr(system_id)
373
373
  );
374
374
 
375
375
  if(!dtd) return Qnil;
@@ -398,9 +398,9 @@ static VALUE create_external_subset(VALUE self, VALUE name, VALUE external_id, V
398
398
 
399
399
  dtd = xmlNewDtd(
400
400
  doc,
401
- NIL_P(name) ? NULL : (const xmlChar *)StringValuePtr(name),
402
- NIL_P(external_id) ? NULL : (const xmlChar *)StringValuePtr(external_id),
403
- NIL_P(system_id) ? NULL : (const xmlChar *)StringValuePtr(system_id)
401
+ NIL_P(name) ? NULL : (const xmlChar *)StringValueCStr(name),
402
+ NIL_P(external_id) ? NULL : (const xmlChar *)StringValueCStr(external_id),
403
+ NIL_P(system_id) ? NULL : (const xmlChar *)StringValueCStr(system_id)
404
404
  );
405
405
 
406
406
  if(!dtd) return Qnil;
@@ -737,7 +737,7 @@ static VALUE key_eh(VALUE self, VALUE attribute)
737
737
  {
738
738
  xmlNodePtr node;
739
739
  Data_Get_Struct(self, xmlNode, node);
740
- if(xmlHasProp(node, (xmlChar *)StringValuePtr(attribute)))
740
+ if(xmlHasProp(node, (xmlChar *)StringValueCStr(attribute)))
741
741
  return Qtrue;
742
742
  return Qfalse;
743
743
  }
@@ -752,8 +752,8 @@ static VALUE namespaced_key_eh(VALUE self, VALUE attribute, VALUE namespace)
752
752
  {
753
753
  xmlNodePtr node;
754
754
  Data_Get_Struct(self, xmlNode, node);
755
- if(xmlHasNsProp(node, (xmlChar *)StringValuePtr(attribute),
756
- NIL_P(namespace) ? NULL : (xmlChar *)StringValuePtr(namespace)))
755
+ if(xmlHasNsProp(node, (xmlChar *)StringValueCStr(attribute),
756
+ NIL_P(namespace) ? NULL : (xmlChar *)StringValueCStr(namespace)))
757
757
  return Qtrue;
758
758
  return Qfalse;
759
759
  }
@@ -778,7 +778,7 @@ static VALUE set(VALUE self, VALUE property, VALUE value)
778
778
  */
779
779
  if (node->type != XML_ELEMENT_NODE)
780
780
  return(Qnil);
781
- prop = xmlHasProp(node, (xmlChar *)StringValuePtr(property));
781
+ prop = xmlHasProp(node, (xmlChar *)StringValueCStr(property));
782
782
  if (prop && prop->children) {
783
783
  for (cur = prop->children; cur; cur = cur->next) {
784
784
  if (cur->_private) {
@@ -788,8 +788,8 @@ static VALUE set(VALUE self, VALUE property, VALUE value)
788
788
  }
789
789
  }
790
790
 
791
- xmlSetProp(node, (xmlChar *)StringValuePtr(property),
792
- (xmlChar *)StringValuePtr(value));
791
+ xmlSetProp(node, (xmlChar *)StringValueCStr(property),
792
+ (xmlChar *)StringValueCStr(value));
793
793
 
794
794
  return value;
795
795
  }
@@ -812,7 +812,7 @@ static VALUE get(VALUE self, VALUE rattribute)
812
812
  if (NIL_P(rattribute)) return Qnil;
813
813
 
814
814
  Data_Get_Struct(self, xmlNode, node);
815
- attribute = strdup(StringValuePtr(rattribute));
815
+ attribute = strdup(StringValueCStr(rattribute));
816
816
 
817
817
  colon = strchr(attribute, ':');
818
818
  if (colon) {
@@ -823,7 +823,7 @@ static VALUE get(VALUE self, VALUE rattribute)
823
823
  if (ns) {
824
824
  value = xmlGetNsProp(node, (xmlChar*)(attr_name), ns->href);
825
825
  } else {
826
- value = xmlGetProp(node, (xmlChar*)StringValuePtr(rattribute));
826
+ value = xmlGetProp(node, (xmlChar*)StringValueCStr(rattribute));
827
827
  }
828
828
  } else {
829
829
  value = xmlGetNoNsProp(node, (xmlChar*)attribute);
@@ -870,7 +870,7 @@ static VALUE attr(VALUE self, VALUE name)
870
870
  xmlNodePtr node;
871
871
  xmlAttrPtr prop;
872
872
  Data_Get_Struct(self, xmlNode, node);
873
- prop = xmlHasProp(node, (xmlChar *)StringValuePtr(name));
873
+ prop = xmlHasProp(node, (xmlChar *)StringValueCStr(name));
874
874
 
875
875
  if(! prop) return Qnil;
876
876
  return Nokogiri_wrap_xml_node(Qnil, (xmlNodePtr)prop);
@@ -887,8 +887,8 @@ static VALUE attribute_with_ns(VALUE self, VALUE name, VALUE namespace)
887
887
  xmlNodePtr node;
888
888
  xmlAttrPtr prop;
889
889
  Data_Get_Struct(self, xmlNode, node);
890
- prop = xmlHasNsProp(node, (xmlChar *)StringValuePtr(name),
891
- NIL_P(namespace) ? NULL : (xmlChar *)StringValuePtr(namespace));
890
+ prop = xmlHasNsProp(node, (xmlChar *)StringValueCStr(name),
891
+ NIL_P(namespace) ? NULL : (xmlChar *)StringValueCStr(namespace));
892
892
 
893
893
  if(! prop) return Qnil;
894
894
  return Nokogiri_wrap_xml_node(Qnil, (xmlNodePtr)prop);
@@ -1025,7 +1025,7 @@ static VALUE set_native_content(VALUE self, VALUE content)
1025
1025
  child = next ;
1026
1026
  }
1027
1027
 
1028
- xmlNodeSetContent(node, (xmlChar *)StringValuePtr(content));
1028
+ xmlNodeSetContent(node, (xmlChar *)StringValueCStr(content));
1029
1029
  return content;
1030
1030
  }
1031
1031
 
@@ -1063,7 +1063,7 @@ static VALUE set_lang(VALUE self_rb, VALUE lang_rb)
1063
1063
  xmlChar* lang ;
1064
1064
 
1065
1065
  Data_Get_Struct(self_rb, xmlNode, self);
1066
- lang = (xmlChar*)StringValuePtr(lang_rb);
1066
+ lang = (xmlChar*)StringValueCStr(lang_rb);
1067
1067
 
1068
1068
  xmlNodeSetLang(self, lang);
1069
1069
 
@@ -1128,7 +1128,7 @@ static VALUE set_name(VALUE self, VALUE new_name)
1128
1128
  {
1129
1129
  xmlNodePtr node;
1130
1130
  Data_Get_Struct(self, xmlNode, node);
1131
- xmlNodeSetName(node, (xmlChar*)StringValuePtr(new_name));
1131
+ xmlNodeSetName(node, (xmlChar*)StringValueCStr(new_name));
1132
1132
  return new_name;
1133
1133
  }
1134
1134
 
@@ -1202,13 +1202,13 @@ static VALUE native_write_to(
1202
1202
 
1203
1203
  before_indent = xmlTreeIndentString;
1204
1204
 
1205
- xmlTreeIndentString = StringValuePtr(indent_string);
1205
+ xmlTreeIndentString = StringValueCStr(indent_string);
1206
1206
 
1207
1207
  savectx = xmlSaveToIO(
1208
1208
  (xmlOutputWriteCallback)io_write_callback,
1209
1209
  (xmlOutputCloseCallback)io_close_callback,
1210
1210
  (void *)io,
1211
- RTEST(encoding) ? StringValuePtr(encoding) : NULL,
1211
+ RTEST(encoding) ? StringValueCStr(encoding) : NULL,
1212
1212
  (int)NUM2INT(options)
1213
1213
  );
1214
1214
 
@@ -1255,7 +1255,7 @@ static VALUE add_namespace_definition(VALUE self, VALUE prefix, VALUE href)
1255
1255
  ns = xmlSearchNs(
1256
1256
  node->doc,
1257
1257
  node,
1258
- (const xmlChar *)(NIL_P(prefix) ? NULL : StringValuePtr(prefix))
1258
+ (const xmlChar *)(NIL_P(prefix) ? NULL : StringValueCStr(prefix))
1259
1259
  );
1260
1260
 
1261
1261
  if(!ns) {
@@ -1264,8 +1264,8 @@ static VALUE add_namespace_definition(VALUE self, VALUE prefix, VALUE href)
1264
1264
  }
1265
1265
  ns = xmlNewNs(
1266
1266
  namespacee,
1267
- (const xmlChar *)StringValuePtr(href),
1268
- (const xmlChar *)(NIL_P(prefix) ? NULL : StringValuePtr(prefix))
1267
+ (const xmlChar *)StringValueCStr(href),
1268
+ (const xmlChar *)(NIL_P(prefix) ? NULL : StringValueCStr(prefix))
1269
1269
  );
1270
1270
  }
1271
1271
 
@@ -1295,7 +1295,7 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
1295
1295
 
1296
1296
  Data_Get_Struct(document, xmlDoc, doc);
1297
1297
 
1298
- node = xmlNewNode(NULL, (xmlChar *)StringValuePtr(name));
1298
+ node = xmlNewNode(NULL, (xmlChar *)StringValueCStr(name));
1299
1299
  node->doc = doc->doc;
1300
1300
  nokogiri_root_node(node);
1301
1301