Title: [184622] trunk/Source/WebCore
Revision
184622
Author
[email protected]
Date
2015-05-20 00:39:12 -0700 (Wed, 20 May 2015)

Log Message

nullptr cleanup in WebCore/xml.
https://bugs.webkit.org/show_bug.cgi?id=145165

Patch by Hunseop Jeong <[email protected]> on 2015-05-20
Reviewed by Csaba Osztrogonác.

No new tests, no behavior changes

* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::responseXML):
(WebCore::XMLHttpRequest::internalAbort):
(WebCore::XMLHttpRequest::clearResponseBuffers):
(WebCore::XMLHttpRequest::clearRequest):
(WebCore::XMLHttpRequest::didFinishLoading):
* xml/XMLHttpRequestProgressEventThrottle.cpp:
(WebCore::XMLHttpRequestProgressEventThrottle::flushProgressEvent):
* xml/XSLImportRule.cpp:
(WebCore::XSLImportRule::XSLImportRule):
(WebCore::XSLImportRule::~XSLImportRule):
(WebCore::XSLImportRule::setXSLStyleSheet):
(WebCore::XSLImportRule::loadSheet):
* xml/XSLStyleSheet.h:
* xml/XSLStyleSheetLibxslt.cpp:
(WebCore::XSLStyleSheet::XSLStyleSheet):
(WebCore::XSLStyleSheet::~XSLStyleSheet):
(WebCore::XSLStyleSheet::clearDocuments):
* xml/XSLTProcessorLibxslt.cpp:
(WebCore::saveResultToString):
(WebCore::xsltParamArrayFromParameterMap):
(WebCore::xmlDocPtrFromNode):
(WebCore::XSLTProcessor::transformToString):
* xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::clearCurrentNodeStack):
(WebCore::XMLDocumentParser::exitText):
(WebCore::XMLDocumentParser::notifyFinished):
* xml/parser/XMLDocumentParser.h:
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::openFunc):
(WebCore::XMLDocumentParser::XMLDocumentParser):
* xml/parser/XMLDocumentParserScope.cpp:
* xml/parser/XMLDocumentParserScope.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (184621 => 184622)


--- trunk/Source/WebCore/ChangeLog	2015-05-20 07:26:56 UTC (rev 184621)
+++ trunk/Source/WebCore/ChangeLog	2015-05-20 07:39:12 UTC (rev 184622)
@@ -1,3 +1,46 @@
+2015-05-20  Hunseop Jeong  <[email protected]>
+
+        nullptr cleanup in WebCore/xml.
+        https://bugs.webkit.org/show_bug.cgi?id=145165
+
+        Reviewed by Csaba Osztrogonác.
+
+        No new tests, no behavior changes
+
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::responseXML):
+        (WebCore::XMLHttpRequest::internalAbort):
+        (WebCore::XMLHttpRequest::clearResponseBuffers):
+        (WebCore::XMLHttpRequest::clearRequest):
+        (WebCore::XMLHttpRequest::didFinishLoading):
+        * xml/XMLHttpRequestProgressEventThrottle.cpp:
+        (WebCore::XMLHttpRequestProgressEventThrottle::flushProgressEvent):
+        * xml/XSLImportRule.cpp:
+        (WebCore::XSLImportRule::XSLImportRule):
+        (WebCore::XSLImportRule::~XSLImportRule):
+        (WebCore::XSLImportRule::setXSLStyleSheet):
+        (WebCore::XSLImportRule::loadSheet):
+        * xml/XSLStyleSheet.h:
+        * xml/XSLStyleSheetLibxslt.cpp:
+        (WebCore::XSLStyleSheet::XSLStyleSheet):
+        (WebCore::XSLStyleSheet::~XSLStyleSheet):
+        (WebCore::XSLStyleSheet::clearDocuments):
+        * xml/XSLTProcessorLibxslt.cpp:
+        (WebCore::saveResultToString):
+        (WebCore::xsltParamArrayFromParameterMap):
+        (WebCore::xmlDocPtrFromNode):
+        (WebCore::XSLTProcessor::transformToString):
+        * xml/parser/XMLDocumentParser.cpp:
+        (WebCore::XMLDocumentParser::clearCurrentNodeStack):
+        (WebCore::XMLDocumentParser::exitText):
+        (WebCore::XMLDocumentParser::notifyFinished):
+        * xml/parser/XMLDocumentParser.h:
+        * xml/parser/XMLDocumentParserLibxml2.cpp:
+        (WebCore::openFunc):
+        (WebCore::XMLDocumentParser::XMLDocumentParser):
+        * xml/parser/XMLDocumentParserScope.cpp:
+        * xml/parser/XMLDocumentParserScope.h:
+
 2015-05-19  Carlos Garcia Campos  <[email protected]>
 
         [SOUP] Network Cache: Implement ShareableResource for Soup and enable it for GTK platform

Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (184621 => 184622)


--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2015-05-20 07:26:56 UTC (rev 184621)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp	2015-05-20 07:39:12 UTC (rev 184622)
@@ -213,7 +213,7 @@
         if ((m_response.isHTTP() && !responseIsXML() && !isHTML)
             || (isHTML && m_responseTypeCode == ResponseTypeDefault)
             || scriptExecutionContext()->isWorkerGlobalScope()) {
-            m_responseDocument = 0;
+            m_responseDocument = nullptr;
         } else {
             if (isHTML)
                 m_responseDocument = HTMLDocument::create(0, m_url);
@@ -225,7 +225,7 @@
             m_responseDocument->overrideMIMEType(mimeType);
 
             if (!m_responseDocument->wellFormed())
-                m_responseDocument = 0;
+                m_responseDocument = nullptr;
         }
         m_createdDocument = true;
     }
@@ -833,7 +833,7 @@
     // FIXME: when we add the support for multi-part XHR, we will have to think be careful with this initialization.
     m_receivedLength = 0;
 
-    m_decoder = 0;
+    m_decoder = nullptr;
 
     if (!m_loader)
         return true;
@@ -866,8 +866,8 @@
     m_responseBuilder.clear();
     m_responseEncoding = String();
     m_createdDocument = false;
-    m_responseDocument = 0;
-    m_responseBlob = 0;
+    m_responseDocument = nullptr;
+    m_responseBlob = nullptr;
     m_binaryResponseBuilder.clear();
     m_responseArrayBuffer.clear();
     m_responseCacheIsValid = false;
@@ -876,7 +876,7 @@
 void XMLHttpRequest::clearRequest()
 {
     m_requestHeaders.clear();
-    m_requestEntityBody = 0;
+    m_requestEntityBody = nullptr;
 }
 
 void XMLHttpRequest::genericError()
@@ -1112,11 +1112,11 @@
     InspectorInstrumentation::didFinishXHRLoading(scriptExecutionContext(), this, identifier, m_responseBuilder.toStringPreserveCapacity(), m_url, m_lastSendURL, m_lastSendLineNumber, m_lastSendColumnNumber);
 
     bool hadLoader = m_loader;
-    m_loader = 0;
+    m_loader = nullptr;
 
     changeState(DONE);
     m_responseEncoding = String();
-    m_decoder = 0;
+    m_decoder = nullptr;
 
     if (hadLoader)
         dropProtection();

Modified: trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp (184621 => 184622)


--- trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp	2015-05-20 07:26:56 UTC (rev 184621)
+++ trunk/Source/WebCore/xml/XMLHttpRequestProgressEventThrottle.cpp	2015-05-20 07:39:12 UTC (rev 184622)
@@ -121,7 +121,7 @@
     if (m_deferEvents && m_deferredProgressEvent) {
         // Move the progress event to the queue, to get it in the right order on resume.
         m_deferredEvents.append(m_deferredProgressEvent);
-        m_deferredProgressEvent = 0;
+        m_deferredProgressEvent = nullptr;
         return;
     }
 

Modified: trunk/Source/WebCore/xml/XSLImportRule.cpp (184621 => 184622)


--- trunk/Source/WebCore/xml/XSLImportRule.cpp	2015-05-20 07:26:56 UTC (rev 184621)
+++ trunk/Source/WebCore/xml/XSLImportRule.cpp	2015-05-20 07:39:12 UTC (rev 184622)
@@ -34,7 +34,7 @@
 XSLImportRule::XSLImportRule(XSLStyleSheet* parent, const String& href)
     : m_parentStyleSheet(parent)
     , m_strHref(href)
-    , m_cachedSheet(0)
+    , m_cachedSheet(nullptr)
     , m_loading(false)
 {
 }
@@ -42,7 +42,7 @@
 XSLImportRule::~XSLImportRule()
 {
     if (m_styleSheet)
-        m_styleSheet->setParentStyleSheet(0);
+        m_styleSheet->setParentStyleSheet(nullptr);
     
     if (m_cachedSheet)
         m_cachedSheet->removeClient(this);
@@ -51,7 +51,7 @@
 void XSLImportRule::setXSLStyleSheet(const String& href, const URL& baseURL, const String& sheet)
 {
     if (m_styleSheet)
-        m_styleSheet->setParentStyleSheet(0);
+        m_styleSheet->setParentStyleSheet(nullptr);
 
     m_styleSheet = XSLStyleSheet::create(this, href, baseURL);
 
@@ -73,7 +73,7 @@
 
 void XSLImportRule::loadSheet()
 {
-    CachedResourceLoader* cachedResourceLoader = 0;
+    CachedResourceLoader* cachedResourceLoader = nullptr;
 
     XSLStyleSheet* rootSheet = parentStyleSheet();
 

Modified: trunk/Source/WebCore/xml/XSLStyleSheet.h (184621 => 184622)


--- trunk/Source/WebCore/xml/XSLStyleSheet.h	2015-05-20 07:26:56 UTC (rev 184621)
+++ trunk/Source/WebCore/xml/XSLStyleSheet.h	2015-05-20 07:39:12 UTC (rev 184622)
@@ -94,7 +94,7 @@
     virtual String href() const override { return m_originalURL; }
     virtual String title() const override { return emptyString(); }
 
-    virtual void clearOwnerNode() override { m_ownerNode = 0; }
+    virtual void clearOwnerNode() override { m_ownerNode = nullptr; }
     virtual URL baseURL() const override { return m_finalURL; }
     virtual bool isLoading() const override;
 

Modified: trunk/Source/WebCore/xml/XSLStyleSheetLibxslt.cpp (184621 => 184622)


--- trunk/Source/WebCore/xml/XSLStyleSheetLibxslt.cpp	2015-05-20 07:26:56 UTC (rev 184621)
+++ trunk/Source/WebCore/xml/XSLStyleSheetLibxslt.cpp	2015-05-20 07:39:12 UTC (rev 184622)
@@ -52,15 +52,15 @@
 namespace WebCore {
 
 XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& originalURL, const URL& finalURL)
-    : m_ownerNode(0)
+    : m_ownerNode(nullptr)
     , m_originalURL(originalURL)
     , m_finalURL(finalURL)
     , m_isDisabled(false)
     , m_embedded(false)
     , m_processed(false) // Child sheets get marked as processed when the libxslt engine has finally seen them.
-    , m_stylesheetDoc(0)
+    , m_stylesheetDoc(nullptr)
     , m_stylesheetDocTaken(false)
-    , m_parentStyleSheet(parentRule ? parentRule->parentStyleSheet() : 0)
+    , m_parentStyleSheet(parentRule ? parentRule->parentStyleSheet() : nullptr)
 {
 }
 
@@ -71,9 +71,9 @@
     , m_isDisabled(false)
     , m_embedded(embedded)
     , m_processed(true) // The root sheet starts off processed.
-    , m_stylesheetDoc(0)
+    , m_stylesheetDoc(nullptr)
     , m_stylesheetDocTaken(false)
-    , m_parentStyleSheet(0)
+    , m_parentStyleSheet(nullptr)
 {
 }
 
@@ -84,7 +84,7 @@
 
     for (auto& child : m_children) {
         ASSERT(child->parentStyleSheet() == this);
-        child->setParentStyleSheet(0);
+        child->setParentStyleSheet(nullptr);
     }
 }
 
@@ -116,7 +116,7 @@
 
 void XSLStyleSheet::clearDocuments()
 {
-    m_stylesheetDoc = 0;
+    m_stylesheetDoc = nullptr;
     for (auto& import : m_children) {
         if (import->styleSheet())
             import->styleSheet()->clearDocuments();

Modified: trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp (184621 => 184622)


--- trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp	2015-05-20 07:26:56 UTC (rev 184621)
+++ trunk/Source/WebCore/xml/XSLTProcessorLibxslt.cpp	2015-05-20 07:39:12 UTC (rev 184622)
@@ -104,8 +104,8 @@
 }
 
 // FIXME: There seems to be no way to control the ctxt pointer for loading here, thus we have globals.
-static XSLTProcessor* globalProcessor = 0;
-static CachedResourceLoader* globalCachedResourceLoader = 0;
+static XSLTProcessor* globalProcessor = nullptr;
+static CachedResourceLoader* globalCachedResourceLoader = nullptr;
 static xmlDocPtr docLoaderFunc(const xmlChar* uri,
                                xmlDictPtr,
                                int options,
@@ -197,7 +197,7 @@
 
 static bool saveResultToString(xmlDocPtr resultDoc, xsltStylesheetPtr sheet, String& resultString)
 {
-    xmlOutputBufferPtr outputBuf = xmlAllocOutputBuffer(0);
+    xmlOutputBufferPtr outputBuf = xmlAllocOutputBuffer(nullptr);
     if (!outputBuf)
         return false;
 
@@ -231,7 +231,7 @@
         parameterArray[index++] = fastStrDup(parameter.key.utf8().data());
         parameterArray[index++] = fastStrDup(parameter.value.utf8().data());
     }
-    parameterArray[index] = 0;
+    parameterArray[index] = nullptr;
 
     return parameterArray;
 }
@@ -272,7 +272,7 @@
     Ref<Document> ownerDocument(sourceNode.document());
     bool sourceIsDocument = (&sourceNode == &ownerDocument.get());
 
-    xmlDocPtr sourceDoc = 0;
+    xmlDocPtr sourceDoc = nullptr;
     if (sourceIsDocument && ownerDocument->transformSource())
         sourceDoc = (xmlDocPtr)ownerDocument->transformSource()->platformSource();
     if (!sourceDoc) {
@@ -369,7 +369,7 @@
     sheet->method = origMethod;
     setXSLTLoadCallBack(0, 0, 0);
     xsltFreeStylesheet(sheet);
-    m_stylesheet = 0;
+    m_stylesheet = nullptr;
 
     return success;
 }

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp (184621 => 184622)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp	2015-05-20 07:26:56 UTC (rev 184621)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParser.cpp	2015-05-20 07:39:12 UTC (rev 184622)
@@ -88,8 +88,8 @@
 {
     if (m_currentNode && m_currentNode != document())
         m_currentNode->deref();
-    m_currentNode = 0;
-    m_leafTextNode = 0;
+    m_currentNode = nullptr;
+    m_leafTextNode = nullptr;
 
     if (m_currentNodeStack.size()) { // Aborted parsing.
         for (size_t i = m_currentNodeStack.size() - 1; i != 0; --i)
@@ -162,7 +162,7 @@
     Vector<xmlChar> empty;
     m_bufferedText.swap(empty);
 
-    m_leafTextNode = 0;
+    m_leafTextNode = nullptr;
 }
 
 void XMLDocumentParser::detach()
@@ -230,10 +230,10 @@
     bool wasCanceled = m_pendingScript->wasCanceled();
 
     m_pendingScript->removeClient(this);
-    m_pendingScript = 0;
+    m_pendingScript = nullptr;
 
     RefPtr<Element> e = m_scriptElement;
-    m_scriptElement = 0;
+    m_scriptElement = nullptr;
 
     ScriptElement* scriptElement = toScriptElementIfPossible(e.get());
     ASSERT(scriptElement);
@@ -248,7 +248,7 @@
         scriptElement->dispatchLoadEvent();
     }
 
-    m_scriptElement = 0;
+    m_scriptElement = nullptr;
 
     if (!isDetached() && !m_requestingScript)
         resumeParsing();

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParser.h (184621 => 184622)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParser.h	2015-05-20 07:26:56 UTC (rev 184621)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParser.h	2015-05-20 07:39:12 UTC (rev 184622)
@@ -85,7 +85,7 @@
         void setIsXHTMLDocument(bool isXHTML) { m_isXHTMLDocument = isXHTML; }
         bool isXHTMLDocument() const { return m_isXHTMLDocument; }
 
-        static bool parseDocumentFragment(const String&, DocumentFragment&, Element* parent = 0, ParserContentPolicy = AllowScriptingContent);
+        static bool parseDocumentFragment(const String&, DocumentFragment&, Element* parent = nullptr, ParserContentPolicy = AllowScriptingContent);
 
         // Used by the XMLHttpRequest to check if the responseXML was well formed.
         virtual bool wellFormed() const override { return !m_sawError; }
@@ -93,7 +93,7 @@
         static bool supportsXMLVersion(const String&);
 
     private:
-        XMLDocumentParser(Document&, FrameView* = 0);
+        XMLDocumentParser(Document&, FrameView* = nullptr);
         XMLDocumentParser(DocumentFragment&, Element*, ParserContentPolicy);
 
         // From DocumentParser
@@ -156,7 +156,7 @@
 
         SegmentedString m_originalSourceForTransform;
 
-        xmlParserCtxtPtr context() const { return m_context ? m_context->context() : 0; };
+        xmlParserCtxtPtr context() const { return m_context ? m_context->context() : nullptr; };
         RefPtr<XMLParserContext> m_context;
         std::unique_ptr<PendingCallbacks> m_pendingCallbacks;
         Vector<xmlChar> m_bufferedText;

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp (184621 => 184622)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp	2015-05-20 07:26:56 UTC (rev 184621)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp	2015-05-20 07:39:12 UTC (rev 184622)
@@ -459,7 +459,7 @@
 
     {
         CachedResourceLoader* cachedResourceLoader = XMLDocumentParserScope::currentCachedResourceLoader;
-        XMLDocumentParserScope scope(0);
+        XMLDocumentParserScope scope(nullptr);
         // FIXME: We should restore the original global error handler as well.
 
         if (cachedResourceLoader->frame())
@@ -577,7 +577,7 @@
 XMLDocumentParser::XMLDocumentParser(Document& document, FrameView* frameView)
     : ScriptableDocumentParser(document)
     , m_view(frameView)
-    , m_context(0)
+    , m_context(nullptr)
     , m_pendingCallbacks(std::make_unique<PendingCallbacks>())
     , m_depthTriggeringEntityExpansion(-1)
     , m_isParsingEntityDeclaration(false)
@@ -590,7 +590,7 @@
     , m_parserPaused(false)
     , m_requestingScript(false)
     , m_finishCalled(false)
-    , m_pendingScript(0)
+    , m_pendingScript(nullptr)
     , m_scriptStartPosition(TextPosition::belowRangePosition())
     , m_parsingFragment(false)
 {
@@ -598,8 +598,8 @@
 
 XMLDocumentParser::XMLDocumentParser(DocumentFragment& fragment, Element* parentElement, ParserContentPolicy parserContentPolicy)
     : ScriptableDocumentParser(fragment.document(), parserContentPolicy)
-    , m_view(0)
-    , m_context(0)
+    , m_view(nullptr)
+    , m_context(nullptr)
     , m_pendingCallbacks(std::make_unique<PendingCallbacks>())
     , m_depthTriggeringEntityExpansion(-1)
     , m_isParsingEntityDeclaration(false)

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParserScope.cpp (184621 => 184622)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParserScope.cpp	2015-05-20 07:26:56 UTC (rev 184621)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParserScope.cpp	2015-05-20 07:39:12 UTC (rev 184622)
@@ -28,7 +28,7 @@
 
 namespace WebCore {
 
-CachedResourceLoader* XMLDocumentParserScope::currentCachedResourceLoader = 0;
+CachedResourceLoader* XMLDocumentParserScope::currentCachedResourceLoader = nullptr;
 
 XMLDocumentParserScope::XMLDocumentParserScope(CachedResourceLoader* cachedResourceLoader)
     : m_oldCachedResourceLoader(currentCachedResourceLoader)

Modified: trunk/Source/WebCore/xml/parser/XMLDocumentParserScope.h (184621 => 184622)


--- trunk/Source/WebCore/xml/parser/XMLDocumentParserScope.h	2015-05-20 07:26:56 UTC (rev 184621)
+++ trunk/Source/WebCore/xml/parser/XMLDocumentParserScope.h	2015-05-20 07:39:12 UTC (rev 184622)
@@ -45,7 +45,7 @@
         static CachedResourceLoader* currentCachedResourceLoader;
 
 #if ENABLE(XSLT)
-        XMLDocumentParserScope(CachedResourceLoader* cachedResourceLoader, xmlGenericErrorFunc genericErrorFunc, xmlStructuredErrorFunc structuredErrorFunc = 0, void* errorContext = 0);
+        XMLDocumentParserScope(CachedResourceLoader*, xmlGenericErrorFunc, xmlStructuredErrorFunc structuredErrorFunc = 0, void* errorContext = nullptr);
 #endif
 
     private:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to