Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Side by Side Diff: Source/core/xml/XPathResult.cpp

Issue 1161323007: Use nullptr instead of 0 in xml and xmlhttprequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated as per review comment & modified in other files which assigned "0" to ptr. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/xml/XPathParser.cpp ('k') | Source/core/xml/XSLImportRule.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> 2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org>
3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 exceptionState.throwTypeError("The result type is not a boolean."); 148 exceptionState.throwTypeError("The result type is not a boolean.");
149 return false; 149 return false;
150 } 150 }
151 return m_value.toBoolean(); 151 return m_value.toBoolean();
152 } 152 }
153 153
154 Node* XPathResult::singleNodeValue(ExceptionState& exceptionState) const 154 Node* XPathResult::singleNodeValue(ExceptionState& exceptionState) const
155 { 155 {
156 if (resultType() != ANY_UNORDERED_NODE_TYPE && resultType() != FIRST_ORDERED _NODE_TYPE) { 156 if (resultType() != ANY_UNORDERED_NODE_TYPE && resultType() != FIRST_ORDERED _NODE_TYPE) {
157 exceptionState.throwTypeError("The result type is not a single node."); 157 exceptionState.throwTypeError("The result type is not a single node.");
158 return 0; 158 return nullptr;
159 } 159 }
160 160
161 const NodeSet& nodes = m_value.toNodeSet(0); 161 const NodeSet& nodes = m_value.toNodeSet(0);
162 if (resultType() == FIRST_ORDERED_NODE_TYPE) 162 if (resultType() == FIRST_ORDERED_NODE_TYPE)
163 return nodes.firstNode(); 163 return nodes.firstNode();
164 return nodes.anyNode(); 164 return nodes.anyNode();
165 } 165 }
166 166
167 bool XPathResult::invalidIteratorState() const 167 bool XPathResult::invalidIteratorState() const
168 { 168 {
(...skipping 11 matching lines...) Expand all
180 return 0; 180 return 0;
181 } 181 }
182 182
183 return m_value.toNodeSet(0).size(); 183 return m_value.toNodeSet(0).size();
184 } 184 }
185 185
186 Node* XPathResult::iterateNext(ExceptionState& exceptionState) 186 Node* XPathResult::iterateNext(ExceptionState& exceptionState)
187 { 187 {
188 if (resultType() != UNORDERED_NODE_ITERATOR_TYPE && resultType() != ORDERED_ NODE_ITERATOR_TYPE) { 188 if (resultType() != UNORDERED_NODE_ITERATOR_TYPE && resultType() != ORDERED_ NODE_ITERATOR_TYPE) {
189 exceptionState.throwTypeError("The result type is not an iterator."); 189 exceptionState.throwTypeError("The result type is not an iterator.");
190 return 0; 190 return nullptr;
191 } 191 }
192 192
193 if (invalidIteratorState()) { 193 if (invalidIteratorState()) {
194 exceptionState.throwDOMException(InvalidStateError, "The document has mu tated since the result was returned."); 194 exceptionState.throwDOMException(InvalidStateError, "The document has mu tated since the result was returned.");
195 return 0; 195 return nullptr;
196 } 196 }
197 197
198 if (m_nodeSetPosition + 1 > nodeSet().size()) 198 if (m_nodeSetPosition + 1 > nodeSet().size())
199 return 0; 199 return nullptr;
200 200
201 Node* node = nodeSet()[m_nodeSetPosition]; 201 Node* node = nodeSet()[m_nodeSetPosition];
202 202
203 m_nodeSetPosition++; 203 m_nodeSetPosition++;
204 204
205 return node; 205 return node;
206 } 206 }
207 207
208 Node* XPathResult::snapshotItem(unsigned index, ExceptionState& exceptionState) 208 Node* XPathResult::snapshotItem(unsigned index, ExceptionState& exceptionState)
209 { 209 {
210 if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_ NODE_SNAPSHOT_TYPE) { 210 if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_ NODE_SNAPSHOT_TYPE) {
211 exceptionState.throwTypeError("The result type is not a snapshot."); 211 exceptionState.throwTypeError("The result type is not a snapshot.");
212 return 0; 212 return nullptr;
213 } 213 }
214 214
215 const NodeSet& nodes = m_value.toNodeSet(0); 215 const NodeSet& nodes = m_value.toNodeSet(0);
216 if (index >= nodes.size()) 216 if (index >= nodes.size())
217 return 0; 217 return nullptr;
218 218
219 return nodes[index]; 219 return nodes[index];
220 } 220 }
221 221
222 } 222 }
OLDNEW
« no previous file with comments | « Source/core/xml/XPathParser.cpp ('k') | Source/core/xml/XSLImportRule.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698