nokogiri 1.8.2-java → 1.8.3-java
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.
Potentially problematic release.
This version of nokogiri might be problematic. Click here for more details.
- checksums.yaml +5 -5
- data/.travis.yml +14 -14
- data/CHANGELOG.md +43 -1
- data/LICENSE.md +2 -1
- data/Manifest.txt +3 -0
- data/README.md +20 -21
- data/Rakefile +3 -9
- data/SECURITY.md +19 -0
- data/build_all +1 -1
- data/dependencies.yml +11 -11
- data/ext/java/nokogiri/HtmlSaxParserContext.java +7 -13
- data/ext/java/nokogiri/HtmlSaxPushParser.java +72 -90
- data/ext/java/nokogiri/NokogiriService.java +0 -19
- data/ext/java/nokogiri/XmlNode.java +2 -23
- data/ext/java/nokogiri/XmlSaxParserContext.java +81 -101
- data/ext/java/nokogiri/XmlSaxPushParser.java +117 -89
- data/ext/java/nokogiri/XmlSyntaxError.java +9 -17
- data/ext/java/nokogiri/internals/NokogiriHandler.java +100 -108
- data/ext/java/nokogiri/internals/NokogiriHelpers.java +11 -14
- data/ext/java/nokogiri/internals/ParserContext.java +34 -19
- data/ext/java/nokogiri/internals/ReaderNode.java +6 -10
- data/ext/java/nokogiri/internals/SaveContextVisitor.java +4 -3
- data/ext/java/nokogiri/internals/XmlDomParserContext.java +6 -3
- data/ext/java/nokogiri/internals/c14n/InclusiveNamespaces.java +4 -3
- data/ext/nokogiri/extconf.rb +1 -1
- data/ext/nokogiri/html_element_description.c +14 -14
- data/ext/nokogiri/xml_cdata.c +6 -4
- data/ext/nokogiri/xml_document.c +2 -3
- data/ext/nokogiri/xml_dtd.c +2 -2
- data/ext/nokogiri/xml_io.c +1 -0
- data/ext/nokogiri/xml_namespace.c +3 -9
- data/ext/nokogiri/xml_namespace.h +2 -0
- data/ext/nokogiri/xml_node.c +23 -15
- data/ext/nokogiri/xml_node_set.c +5 -4
- data/ext/nokogiri/xml_node_set.h +0 -1
- data/ext/nokogiri/xslt_stylesheet.c +2 -2
- data/lib/nokogiri/css/parser.rb +108 -90
- data/lib/nokogiri/css/parser.y +13 -2
- data/lib/nokogiri/css/tokenizer.rb +1 -1
- data/lib/nokogiri/css/tokenizer.rex +4 -4
- data/lib/nokogiri/css/xpath_visitor.rb +10 -3
- data/lib/nokogiri/html/document_fragment.rb +11 -1
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/version.rb +1 -1
- data/lib/nokogiri/xml/node.rb +58 -0
- data/lib/nokogiri/xml/node_set.rb +32 -18
- data/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch +78 -0
- data/test/css/test_nthiness.rb +21 -21
- data/test/css/test_parser.rb +17 -0
- data/test/html/test_attributes.rb +85 -0
- data/test/html/test_document_fragment.rb +7 -1
- data/test/test_css_cache.rb +5 -3
- data/test/xml/sax/test_parser.rb +9 -1
- data/test/xml/sax/test_push_parser.rb +60 -0
- data/test/xml/test_cdata.rb +1 -1
- data/test/xml/test_document.rb +5 -5
- data/test/xml/test_dtd.rb +4 -4
- data/test/xml/test_node.rb +89 -6
- data/test/xml/test_node_attributes.rb +3 -3
- data/test/xml/test_node_reparenting.rb +18 -0
- data/test/xml/test_node_set.rb +31 -4
- data/test/xml/test_reader.rb +13 -1
- data/test/xml/test_syntax_error.rb +3 -3
- data/test/xml/test_xpath.rb +8 -0
- metadata +25 -4
| @@ -229,11 +229,8 @@ public class NokogiriHelpers { | |
| 229 229 | 
             
                public static String getPrefix(String qName) {
         | 
| 230 230 | 
             
                    if (qName == null) return null;
         | 
| 231 231 |  | 
| 232 | 
            -
                    int pos = qName.indexOf(':');
         | 
| 233 | 
            -
                     | 
| 234 | 
            -
                        return qName.substring(0, pos);
         | 
| 235 | 
            -
                    else
         | 
| 236 | 
            -
                        return null;
         | 
| 232 | 
            +
                    final int pos = qName.indexOf(':');
         | 
| 233 | 
            +
                    return pos > 0 ? qName.substring(0, pos) : null;
         | 
| 237 234 | 
             
                }
         | 
| 238 235 |  | 
| 239 236 | 
             
                /**
         | 
| @@ -243,11 +240,8 @@ public class NokogiriHelpers { | |
| 243 240 | 
             
                public static String getLocalPart(String qName) {
         | 
| 244 241 | 
             
                    if (qName == null) return null;
         | 
| 245 242 |  | 
| 246 | 
            -
                    int pos = qName.indexOf(':');
         | 
| 247 | 
            -
                     | 
| 248 | 
            -
                        return qName.substring(pos + 1);
         | 
| 249 | 
            -
                    else
         | 
| 250 | 
            -
                        return qName;
         | 
| 243 | 
            +
                    final int pos = qName.indexOf(':');
         | 
| 244 | 
            +
                    return pos > 0 ? qName.substring(pos + 1) : qName;
         | 
| 251 245 | 
             
                }
         | 
| 252 246 |  | 
| 253 247 | 
             
                public static String getLocalNameForNamespace(String name) {
         | 
| @@ -593,20 +587,23 @@ public class NokogiriHelpers { | |
| 593 587 | 
             
                    return "xml:base".equals(attrName) || "xlink:href".equals(attrName);
         | 
| 594 588 | 
             
                }
         | 
| 595 589 |  | 
| 596 | 
            -
                public static boolean  | 
| 597 | 
            -
                    //if (obj == null || obj.isNil()) return false;
         | 
| 590 | 
            +
                public static boolean isBlank(IRubyObject obj) {
         | 
| 598 591 | 
             
                    if ( !(obj instanceof XmlText) ) return false;
         | 
| 599 592 |  | 
| 600 593 | 
             
                    CharSequence content = ((XmlNode) obj).getContentImpl();
         | 
| 601 | 
            -
                    return content == null ||  | 
| 594 | 
            +
                    return content == null || isBlank(content);
         | 
| 602 595 | 
             
                }
         | 
| 603 596 |  | 
| 604 | 
            -
                public static boolean  | 
| 597 | 
            +
                public static boolean isBlank(CharSequence str) {
         | 
| 605 598 | 
             
                    int len = str.length(); int beg = 0;
         | 
| 606 599 | 
             
                    while ((beg < len) && (str.charAt(beg) <= ' ')) beg++;
         | 
| 607 600 | 
             
                    return beg == len;
         | 
| 608 601 | 
             
                }
         | 
| 609 602 |  | 
| 603 | 
            +
                public static boolean isBlank(String str) {
         | 
| 604 | 
            +
                    return str.isEmpty() || isBlank((CharSequence) str);
         | 
| 605 | 
            +
                }
         | 
| 606 | 
            +
             | 
| 610 607 | 
             
                public static CharSequence canonicalizeWhitespace(CharSequence str) {
         | 
| 611 608 | 
             
                    final int len = str.length();
         | 
| 612 609 | 
             
                    StringBuilder sb = new StringBuilder(len);
         | 
| @@ -43,6 +43,7 @@ import java.io.StringReader; | |
| 43 43 | 
             
            import java.net.URI;
         | 
| 44 44 | 
             
            import java.nio.charset.Charset;
         | 
| 45 45 | 
             
            import java.nio.charset.UnsupportedCharsetException;
         | 
| 46 | 
            +
            import java.util.concurrent.Callable;
         | 
| 46 47 |  | 
| 47 48 | 
             
            import org.jruby.Ruby;
         | 
| 48 49 | 
             
            import org.jruby.RubyClass;
         | 
| @@ -54,7 +55,6 @@ import org.jruby.runtime.builtin.IRubyObject; | |
| 54 55 | 
             
            import org.jruby.util.ByteList;
         | 
| 55 56 | 
             
            import org.jruby.util.TypeConverter;
         | 
| 56 57 | 
             
            import org.xml.sax.InputSource;
         | 
| 57 | 
            -
            import org.xml.sax.SAXException;
         | 
| 58 58 |  | 
| 59 59 | 
             
            /**
         | 
| 60 60 | 
             
             * Base class for the various parser contexts.  Handles converting
         | 
| @@ -63,7 +63,7 @@ import org.xml.sax.SAXException; | |
| 63 63 | 
             
             * @author Patrick Mahoney <pat@polycrystal.org>
         | 
| 64 64 | 
             
             * @author Yoko Harada <yokolet@gmail.com>
         | 
| 65 65 | 
             
             */
         | 
| 66 | 
            -
            public class ParserContext extends RubyObject {
         | 
| 66 | 
            +
            public abstract class ParserContext extends RubyObject {
         | 
| 67 67 | 
             
                protected InputSource source = null;
         | 
| 68 68 | 
             
                protected IRubyObject detected_encoding = null;
         | 
| 69 69 | 
             
                protected int stringDataSize = -1;
         | 
| @@ -229,23 +229,23 @@ public class ParserContext extends RubyObject { | |
| 229 229 | 
             
                    protected static final long NOCDATA = 16384;
         | 
| 230 230 | 
             
                    protected static final long NOXINCNODE = 32768;
         | 
| 231 231 |  | 
| 232 | 
            -
                    public boolean strict;
         | 
| 233 | 
            -
                    public boolean recover;
         | 
| 234 | 
            -
                    public boolean noEnt;
         | 
| 235 | 
            -
                    public boolean dtdLoad;
         | 
| 236 | 
            -
                    public boolean dtdAttr;
         | 
| 237 | 
            -
                    public boolean dtdValid;
         | 
| 238 | 
            -
                    public boolean noError;
         | 
| 239 | 
            -
                    public boolean noWarning;
         | 
| 240 | 
            -
                    public boolean pedantic;
         | 
| 241 | 
            -
                    public boolean noBlanks;
         | 
| 242 | 
            -
                    public boolean sax1;
         | 
| 243 | 
            -
                    public boolean xInclude;
         | 
| 244 | 
            -
                    public boolean noNet;
         | 
| 245 | 
            -
                    public boolean noDict;
         | 
| 246 | 
            -
                    public boolean nsClean;
         | 
| 247 | 
            -
                    public boolean noCdata;
         | 
| 248 | 
            -
                    public boolean noXIncNode;
         | 
| 232 | 
            +
                    public final boolean strict;
         | 
| 233 | 
            +
                    public final boolean recover;
         | 
| 234 | 
            +
                    public final boolean noEnt;
         | 
| 235 | 
            +
                    public final boolean dtdLoad;
         | 
| 236 | 
            +
                    public final boolean dtdAttr;
         | 
| 237 | 
            +
                    public final boolean dtdValid;
         | 
| 238 | 
            +
                    public final boolean noError;
         | 
| 239 | 
            +
                    public final boolean noWarning;
         | 
| 240 | 
            +
                    public final boolean pedantic;
         | 
| 241 | 
            +
                    public final boolean noBlanks;
         | 
| 242 | 
            +
                    public final boolean sax1;
         | 
| 243 | 
            +
                    public final boolean xInclude;
         | 
| 244 | 
            +
                    public final boolean noNet;
         | 
| 245 | 
            +
                    public final boolean noDict;
         | 
| 246 | 
            +
                    public final boolean nsClean;
         | 
| 247 | 
            +
                    public final boolean noCdata;
         | 
| 248 | 
            +
                    public final boolean noXIncNode;
         | 
| 249 249 |  | 
| 250 250 | 
             
                    protected static boolean test(long options, long mask) {
         | 
| 251 251 | 
             
                        return ((options & mask) == mask);
         | 
| @@ -272,6 +272,7 @@ public class ParserContext extends RubyObject { | |
| 272 272 | 
             
                    }
         | 
| 273 273 | 
             
                }
         | 
| 274 274 |  | 
| 275 | 
            +
                /*
         | 
| 275 276 | 
             
                public static class NokogiriXInlcudeEntityResolver implements org.xml.sax.EntityResolver {
         | 
| 276 277 | 
             
                    InputSource source;
         | 
| 277 278 | 
             
                    public NokogiriXInlcudeEntityResolver(InputSource source) {
         | 
| @@ -285,6 +286,20 @@ public class ParserContext extends RubyObject { | |
| 285 286 | 
             
                        if (publicId != null) source.setPublicId(publicId);
         | 
| 286 287 | 
             
                        return source;
         | 
| 287 288 | 
             
                    }
         | 
| 289 | 
            +
                } */
         | 
| 290 | 
            +
             | 
| 291 | 
            +
                public static abstract class ParserTask<T extends ParserContext> implements Callable<T> {
         | 
| 292 | 
            +
             | 
| 293 | 
            +
                    protected final ThreadContext context; // TODO does not seem like a good idea!?
         | 
| 294 | 
            +
                    protected final IRubyObject handler;
         | 
| 295 | 
            +
                    protected final T parser;
         | 
| 296 | 
            +
             | 
| 297 | 
            +
                    protected ParserTask(ThreadContext context, IRubyObject handler, T parser) {
         | 
| 298 | 
            +
                        this.context = context;
         | 
| 299 | 
            +
                        this.handler = handler;
         | 
| 300 | 
            +
                        this.parser = parser;
         | 
| 301 | 
            +
                    }
         | 
| 302 | 
            +
             | 
| 288 303 | 
             
                }
         | 
| 289 304 |  | 
| 290 305 | 
             
            }
         | 
| @@ -32,13 +32,6 @@ | |
| 32 32 |  | 
| 33 33 | 
             
            package nokogiri.internals;
         | 
| 34 34 |  | 
| 35 | 
            -
            import static nokogiri.internals.NokogiriHelpers.getNokogiriClass;
         | 
| 36 | 
            -
            import static nokogiri.internals.NokogiriHelpers.isNamespace;
         | 
| 37 | 
            -
            import static nokogiri.internals.NokogiriHelpers.isXmlBase;
         | 
| 38 | 
            -
            import static nokogiri.internals.NokogiriHelpers.rubyStringToString;
         | 
| 39 | 
            -
            import static nokogiri.internals.NokogiriHelpers.stringOrBlank;
         | 
| 40 | 
            -
            import static nokogiri.internals.NokogiriHelpers.stringOrNil;
         | 
| 41 | 
            -
             | 
| 42 35 | 
             
            import java.util.ArrayList;
         | 
| 43 36 | 
             
            import java.util.HashMap;
         | 
| 44 37 | 
             
            import java.util.List;
         | 
| @@ -61,6 +54,8 @@ import org.jruby.runtime.builtin.IRubyObject; | |
| 61 54 | 
             
            import org.w3c.dom.Attr;
         | 
| 62 55 | 
             
            import org.w3c.dom.Document;
         | 
| 63 56 |  | 
| 57 | 
            +
            import static nokogiri.internals.NokogiriHelpers.*;
         | 
| 58 | 
            +
             | 
| 64 59 | 
             
            /**
         | 
| 65 60 | 
             
             * Abstract class of Node for XmlReader.
         | 
| 66 61 | 
             
             *
         | 
| @@ -263,7 +258,7 @@ public abstract class ReaderNode { | |
| 263 258 | 
             
                        super(runtime);
         | 
| 264 259 | 
             
                        nodeType = ReaderNodeType.END_ELEMENT.getValue();
         | 
| 265 260 | 
             
                        this.uri = "".equals(uri) ? null : uri;
         | 
| 266 | 
            -
                        this.localName = localName | 
| 261 | 
            +
                        this.localName = ! isBlank(localName) ? localName : qName;
         | 
| 267 262 | 
             
                        this.name = qName;
         | 
| 268 263 | 
             
                        parsePrefix(qName);
         | 
| 269 264 | 
             
                        this.depth = depth;
         | 
| @@ -299,7 +294,7 @@ public abstract class ReaderNode { | |
| 299 294 | 
             
                        super(runtime);
         | 
| 300 295 | 
             
                        this.nodeType = ReaderNodeType.ELEMENT.getValue();
         | 
| 301 296 | 
             
                        this.uri = "".equals(uri) ? null : uri;
         | 
| 302 | 
            -
                        this.localName = localName | 
| 297 | 
            +
                        this.localName = ! isBlank(localName) ? localName : qName;
         | 
| 303 298 | 
             
                        this.name = qName;
         | 
| 304 299 | 
             
                        parsePrefix(qName);
         | 
| 305 300 | 
             
                        this.depth = depth;
         | 
| @@ -475,7 +470,7 @@ public abstract class ReaderNode { | |
| 475 470 | 
             
                        this.localName = "#text";
         | 
| 476 471 | 
             
                        this.name = "#text";
         | 
| 477 472 | 
             
                        this.depth = depth;
         | 
| 478 | 
            -
                        if (content | 
| 473 | 
            +
                        if (!isBlank(content)) nodeType = ReaderNodeType.TEXT.getValue();
         | 
| 479 474 | 
             
                        else nodeType = ReaderNodeType.SIGNIFICANT_WHITESPACE.getValue();
         | 
| 480 475 | 
             
                        if (!langStack.isEmpty()) this.lang = langStack.peek();
         | 
| 481 476 | 
             
                        if (!xmlBaseStack.isEmpty()) this.xmlBase = xmlBaseStack.peek();
         | 
| @@ -491,4 +486,5 @@ public abstract class ReaderNode { | |
| 491 486 | 
             
                        return value;
         | 
| 492 487 | 
             
                    }
         | 
| 493 488 | 
             
                }
         | 
| 489 | 
            +
             | 
| 494 490 | 
             
            }
         | 
| @@ -35,7 +35,8 @@ package nokogiri.internals; | |
| 35 35 | 
             
            import static nokogiri.internals.NokogiriHelpers.canonicalizeWhitespace;
         | 
| 36 36 | 
             
            import static nokogiri.internals.NokogiriHelpers.encodeJavaString;
         | 
| 37 37 | 
             
            import static nokogiri.internals.NokogiriHelpers.isNamespace;
         | 
| 38 | 
            -
            import static nokogiri.internals.NokogiriHelpers. | 
| 38 | 
            +
            import static nokogiri.internals.NokogiriHelpers.isBlank;
         | 
| 39 | 
            +
            import static nokogiri.internals.NokogiriHelpers.shouldEncode;
         | 
| 39 40 |  | 
| 40 41 | 
             
            import java.nio.charset.Charset;
         | 
| 41 42 | 
             
            import java.nio.charset.CharsetEncoder;
         | 
| @@ -737,13 +738,13 @@ public class SaveContextVisitor { | |
| 737 738 | 
             
                    CharSequence textContent = text.getNodeValue();
         | 
| 738 739 | 
             
                    if (canonical) {
         | 
| 739 740 | 
             
                        c14nNodeList.add(text);
         | 
| 740 | 
            -
                        if ( | 
| 741 | 
            +
                        if (isBlank(textContent)) {
         | 
| 741 742 | 
             
                            buffer.append(canonicalizeWhitespace(textContent));
         | 
| 742 743 | 
             
                            return true;
         | 
| 743 744 | 
             
                        }
         | 
| 744 745 | 
             
                    }
         | 
| 745 746 |  | 
| 746 | 
            -
                    if ( | 
| 747 | 
            +
                    if (shouldEncode(text) && !isHtmlScript(text) && !isHtmlStyle(text)) {
         | 
| 747 748 | 
             
                        textContent = encodeJavaString(textContent);
         | 
| 748 749 | 
             
                    }
         | 
| 749 750 |  | 
| @@ -33,6 +33,7 @@ | |
| 33 33 | 
             
            package nokogiri.internals;
         | 
| 34 34 |  | 
| 35 35 | 
             
            import static nokogiri.internals.NokogiriHelpers.getNokogiriClass;
         | 
| 36 | 
            +
            import static nokogiri.internals.NokogiriHelpers.isBlank;
         | 
| 36 37 |  | 
| 37 38 | 
             
            import java.io.IOException;
         | 
| 38 39 | 
             
            import java.util.ArrayList;
         | 
| @@ -47,6 +48,7 @@ import org.apache.xerces.parsers.DOMParser; | |
| 47 48 | 
             
            import org.jruby.Ruby;
         | 
| 48 49 | 
             
            import org.jruby.RubyArray;
         | 
| 49 50 | 
             
            import org.jruby.RubyClass;
         | 
| 51 | 
            +
            import org.jruby.RubyFixnum;
         | 
| 50 52 | 
             
            import org.jruby.exceptions.RaiseException;
         | 
| 51 53 | 
             
            import org.jruby.runtime.ThreadContext;
         | 
| 52 54 | 
             
            import org.jruby.runtime.builtin.IRubyObject;
         | 
| @@ -64,6 +66,7 @@ import org.xml.sax.SAXException; | |
| 64 66 | 
             
             * @author Yoko Harada <yokolet@gmail.com>
         | 
| 65 67 | 
             
             */
         | 
| 66 68 | 
             
            public class XmlDomParserContext extends ParserContext {
         | 
| 69 | 
            +
             | 
| 67 70 | 
             
                protected static final String FEATURE_LOAD_EXTERNAL_DTD =
         | 
| 68 71 | 
             
                    "http://apache.org/xml/features/nonvalidating/load-external-dtd";
         | 
| 69 72 | 
             
                protected static final String FEATURE_LOAD_DTD_GRAMMAR =
         | 
| @@ -90,13 +93,13 @@ public class XmlDomParserContext extends ParserContext { | |
| 90 93 |  | 
| 91 94 | 
             
                public XmlDomParserContext(Ruby runtime, IRubyObject encoding, IRubyObject options) {
         | 
| 92 95 | 
             
                    super(runtime);
         | 
| 93 | 
            -
                    this.options = new ParserContext.Options(( | 
| 96 | 
            +
                    this.options = new ParserContext.Options(RubyFixnum.fix2long(options));
         | 
| 94 97 | 
             
                    java_encoding = NokogiriHelpers.getValidEncoding(runtime, encoding);
         | 
| 95 98 | 
             
                    ruby_encoding = encoding;
         | 
| 96 99 | 
             
                    initErrorHandler();
         | 
| 97 100 | 
             
                    initParser(runtime);
         | 
| 98 101 | 
             
                }
         | 
| 99 | 
            -
             | 
| 102 | 
            +
             | 
| 100 103 | 
             
                protected void initErrorHandler() {
         | 
| 101 104 | 
             
                    if (options.recover) {
         | 
| 102 105 | 
             
                        errorHandler = new NokogiriNonStrictErrorHandler(options.noError, options.noWarning);
         | 
| @@ -274,7 +277,7 @@ public class XmlDomParserContext extends ParserContext { | |
| 274 277 | 
             
                }
         | 
| 275 278 |  | 
| 276 279 | 
             
                private static void findEmptyTexts(Node node, List<Node> emptyNodes) {
         | 
| 277 | 
            -
                    if (node.getNodeType() == Node.TEXT_NODE &&  | 
| 280 | 
            +
                    if (node.getNodeType() == Node.TEXT_NODE && isBlank(node.getTextContent())) {
         | 
| 278 281 | 
             
                        emptyNodes.add(node);
         | 
| 279 282 | 
             
                    } else {
         | 
| 280 283 | 
             
                        NodeList children = node.getChildNodes();
         | 
| @@ -75,7 +75,7 @@ public class InclusiveNamespaces extends ElementProxy { | |
| 75 75 | 
             
                        prefixList = new TreeSet<String>(prefixes);
         | 
| 76 76 | 
             
                    }
         | 
| 77 77 |  | 
| 78 | 
            -
                    StringBuilder sb = new StringBuilder();
         | 
| 78 | 
            +
                    StringBuilder sb = new StringBuilder(prefixList.size() * 8);
         | 
| 79 79 | 
             
                    for (String prefix : prefixList) {
         | 
| 80 80 | 
             
                        if (prefix.equals("xmlns")) {
         | 
| 81 81 | 
             
                            sb.append("#default ");
         | 
| @@ -83,9 +83,10 @@ public class InclusiveNamespaces extends ElementProxy { | |
| 83 83 | 
             
                            sb.append(prefix).append(' ');
         | 
| 84 84 | 
             
                        }
         | 
| 85 85 | 
             
                    }
         | 
| 86 | 
            +
                    int last = sb.length() - 1;
         | 
| 87 | 
            +
                    while (last >= 0 && sb.charAt(last) == ' ') sb.setLength(last--); // trim
         | 
| 86 88 |  | 
| 87 | 
            -
                    this.constructionElement.setAttributeNS(
         | 
| 88 | 
            -
                        null, InclusiveNamespaces._ATT_EC_PREFIXLIST, sb.toString().trim());
         | 
| 89 | 
            +
                    this.constructionElement.setAttributeNS(null, InclusiveNamespaces._ATT_EC_PREFIXLIST, sb.toString());
         | 
| 89 90 | 
             
                }
         | 
| 90 91 |  | 
| 91 92 | 
             
                /**
         | 
    
        data/ext/nokogiri/extconf.rb
    CHANGED
    
    | @@ -434,7 +434,7 @@ end | |
| 434 434 |  | 
| 435 435 | 
             
            if RbConfig::MAKEFILE_CONFIG['CC'] =~ /gcc/
         | 
| 436 436 | 
             
              $CFLAGS << " -O3" unless $CFLAGS[/-O\d/]
         | 
| 437 | 
            -
              $CFLAGS << " -Wall -Wcast-qual -Wwrite-strings - | 
| 437 | 
            +
              $CFLAGS << " -Wall -Wcast-qual -Wwrite-strings -Wextra -Wmissing-noreturn -Winline"
         | 
| 438 438 | 
             
            end
         | 
| 439 439 |  | 
| 440 440 | 
             
            case
         | 
| @@ -8,7 +8,7 @@ | |
| 8 8 | 
             
             */
         | 
| 9 9 | 
             
            static VALUE required_attributes(VALUE self)
         | 
| 10 10 | 
             
            {
         | 
| 11 | 
            -
              htmlElemDesc * description;
         | 
| 11 | 
            +
              const htmlElemDesc * description;
         | 
| 12 12 | 
             
              VALUE list;
         | 
| 13 13 | 
             
              int i;
         | 
| 14 14 |  | 
| @@ -33,7 +33,7 @@ static VALUE required_attributes(VALUE self) | |
| 33 33 | 
             
             */
         | 
| 34 34 | 
             
            static VALUE deprecated_attributes(VALUE self)
         | 
| 35 35 | 
             
            {
         | 
| 36 | 
            -
              htmlElemDesc * description;
         | 
| 36 | 
            +
              const htmlElemDesc * description;
         | 
| 37 37 | 
             
              VALUE list;
         | 
| 38 38 | 
             
              int i;
         | 
| 39 39 |  | 
| @@ -58,7 +58,7 @@ static VALUE deprecated_attributes(VALUE self) | |
| 58 58 | 
             
             */
         | 
| 59 59 | 
             
            static VALUE optional_attributes(VALUE self)
         | 
| 60 60 | 
             
            {
         | 
| 61 | 
            -
              htmlElemDesc * description;
         | 
| 61 | 
            +
              const htmlElemDesc * description;
         | 
| 62 62 | 
             
              VALUE list;
         | 
| 63 63 | 
             
              int i;
         | 
| 64 64 |  | 
| @@ -83,7 +83,7 @@ static VALUE optional_attributes(VALUE self) | |
| 83 83 | 
             
             */
         | 
| 84 84 | 
             
            static VALUE default_sub_element(VALUE self)
         | 
| 85 85 | 
             
            {
         | 
| 86 | 
            -
              htmlElemDesc * description;
         | 
| 86 | 
            +
              const htmlElemDesc * description;
         | 
| 87 87 | 
             
              Data_Get_Struct(self, htmlElemDesc, description);
         | 
| 88 88 |  | 
| 89 89 | 
             
              if (description->defaultsubelt)
         | 
| @@ -100,7 +100,7 @@ static VALUE default_sub_element(VALUE self) | |
| 100 100 | 
             
             */
         | 
| 101 101 | 
             
            static VALUE sub_elements(VALUE self)
         | 
| 102 102 | 
             
            {
         | 
| 103 | 
            -
              htmlElemDesc * description;
         | 
| 103 | 
            +
              const htmlElemDesc * description;
         | 
| 104 104 | 
             
              VALUE list;
         | 
| 105 105 | 
             
              int i;
         | 
| 106 106 |  | 
| @@ -125,7 +125,7 @@ static VALUE sub_elements(VALUE self) | |
| 125 125 | 
             
             */
         | 
| 126 126 | 
             
            static VALUE description(VALUE self)
         | 
| 127 127 | 
             
            {
         | 
| 128 | 
            -
              htmlElemDesc * description;
         | 
| 128 | 
            +
              const htmlElemDesc * description;
         | 
| 129 129 | 
             
              Data_Get_Struct(self, htmlElemDesc, description);
         | 
| 130 130 |  | 
| 131 131 | 
             
              return NOKOGIRI_STR_NEW2(description->desc);
         | 
| @@ -139,7 +139,7 @@ static VALUE description(VALUE self) | |
| 139 139 | 
             
             */
         | 
| 140 140 | 
             
            static VALUE inline_eh(VALUE self)
         | 
| 141 141 | 
             
            {
         | 
| 142 | 
            -
              htmlElemDesc * description;
         | 
| 142 | 
            +
              const htmlElemDesc * description;
         | 
| 143 143 | 
             
              Data_Get_Struct(self, htmlElemDesc, description);
         | 
| 144 144 |  | 
| 145 145 | 
             
              if(description->isinline) return Qtrue;
         | 
| @@ -154,7 +154,7 @@ static VALUE inline_eh(VALUE self) | |
| 154 154 | 
             
             */
         | 
| 155 155 | 
             
            static VALUE deprecated_eh(VALUE self)
         | 
| 156 156 | 
             
            {
         | 
| 157 | 
            -
              htmlElemDesc * description;
         | 
| 157 | 
            +
              const htmlElemDesc * description;
         | 
| 158 158 | 
             
              Data_Get_Struct(self, htmlElemDesc, description);
         | 
| 159 159 |  | 
| 160 160 | 
             
              if(description->depr) return Qtrue;
         | 
| @@ -169,7 +169,7 @@ static VALUE deprecated_eh(VALUE self) | |
| 169 169 | 
             
             */
         | 
| 170 170 | 
             
            static VALUE empty_eh(VALUE self)
         | 
| 171 171 | 
             
            {
         | 
| 172 | 
            -
              htmlElemDesc * description;
         | 
| 172 | 
            +
              const htmlElemDesc * description;
         | 
| 173 173 | 
             
              Data_Get_Struct(self, htmlElemDesc, description);
         | 
| 174 174 |  | 
| 175 175 | 
             
              if(description->empty) return Qtrue;
         | 
| @@ -184,7 +184,7 @@ static VALUE empty_eh(VALUE self) | |
| 184 184 | 
             
             */
         | 
| 185 185 | 
             
            static VALUE save_end_tag_eh(VALUE self)
         | 
| 186 186 | 
             
            {
         | 
| 187 | 
            -
              htmlElemDesc * description;
         | 
| 187 | 
            +
              const htmlElemDesc * description;
         | 
| 188 188 | 
             
              Data_Get_Struct(self, htmlElemDesc, description);
         | 
| 189 189 |  | 
| 190 190 | 
             
              if(description->saveEndTag) return Qtrue;
         | 
| @@ -199,7 +199,7 @@ static VALUE save_end_tag_eh(VALUE self) | |
| 199 199 | 
             
             */
         | 
| 200 200 | 
             
            static VALUE implied_end_tag_eh(VALUE self)
         | 
| 201 201 | 
             
            {
         | 
| 202 | 
            -
              htmlElemDesc * description;
         | 
| 202 | 
            +
              const htmlElemDesc * description;
         | 
| 203 203 | 
             
              Data_Get_Struct(self, htmlElemDesc, description);
         | 
| 204 204 |  | 
| 205 205 | 
             
              if(description->endTag) return Qtrue;
         | 
| @@ -214,7 +214,7 @@ static VALUE implied_end_tag_eh(VALUE self) | |
| 214 214 | 
             
             */
         | 
| 215 215 | 
             
            static VALUE implied_start_tag_eh(VALUE self)
         | 
| 216 216 | 
             
            {
         | 
| 217 | 
            -
              htmlElemDesc * description;
         | 
| 217 | 
            +
              const htmlElemDesc * description;
         | 
| 218 218 | 
             
              Data_Get_Struct(self, htmlElemDesc, description);
         | 
| 219 219 |  | 
| 220 220 | 
             
              if(description->startTag) return Qtrue;
         | 
| @@ -229,7 +229,7 @@ static VALUE implied_start_tag_eh(VALUE self) | |
| 229 229 | 
             
             */
         | 
| 230 230 | 
             
            static VALUE name(VALUE self)
         | 
| 231 231 | 
             
            {
         | 
| 232 | 
            -
              htmlElemDesc * description;
         | 
| 232 | 
            +
              const htmlElemDesc * description;
         | 
| 233 233 | 
             
              Data_Get_Struct(self, htmlElemDesc, description);
         | 
| 234 234 |  | 
| 235 235 | 
             
              if(NULL == description->name) return Qnil;
         | 
| @@ -249,7 +249,7 @@ static VALUE get_description(VALUE klass, VALUE tag_name) | |
| 249 249 | 
             
              );
         | 
| 250 250 |  | 
| 251 251 | 
             
              if(NULL == description) return Qnil;
         | 
| 252 | 
            -
              return Data_Wrap_Struct(klass, 0, 0, (void *)description);
         | 
| 252 | 
            +
              return Data_Wrap_Struct(klass, 0, 0, (void *)(uintptr_t)description);
         | 
| 253 253 | 
             
            }
         | 
| 254 254 |  | 
| 255 255 | 
             
            VALUE cNokogiriHtmlElementDescription ;
         | 
    
        data/ext/nokogiri/xml_cdata.c
    CHANGED
    
    | @@ -17,15 +17,17 @@ static VALUE new(int argc, VALUE *argv, VALUE klass) | |
| 17 17 | 
             
              VALUE content;
         | 
| 18 18 | 
             
              VALUE rest;
         | 
| 19 19 | 
             
              VALUE rb_node;
         | 
| 20 | 
            -
               | 
| 21 | 
            -
              int content_str_len;
         | 
| 20 | 
            +
              xmlChar *content_str = NULL;
         | 
| 21 | 
            +
              int content_str_len = 0;
         | 
| 22 22 |  | 
| 23 23 | 
             
              rb_scan_args(argc, argv, "2*", &doc, &content, &rest);
         | 
| 24 24 |  | 
| 25 25 | 
             
              Data_Get_Struct(doc, xmlDoc, xml_doc);
         | 
| 26 26 |  | 
| 27 | 
            -
               | 
| 28 | 
            -
             | 
| 27 | 
            +
              if (!NIL_P(content)) {
         | 
| 28 | 
            +
                content_str = (xmlChar *)StringValuePtr(content);
         | 
| 29 | 
            +
                content_str_len = RSTRING_LEN(content);
         | 
| 30 | 
            +
              }
         | 
| 29 31 |  | 
| 30 32 | 
             
              node = xmlNewCDataBlock(xml_doc->doc, content_str, content_str_len);
         | 
| 31 33 |  |