Commit f9f32ae0 authored by ggaren's avatar ggaren

Reviewed by Kevin McCulough.

        Global replace of "assert(" with "ASSERT(" to assist debugging. Removed
        one instance of commented-out code containing "assert(" instead of replacing it.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20495 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2d6559c9
2007-03-26 Geoffrey Garen <ggaren@apple.com>
Reviewed by Kevin McCulough.
Global replace of "assert(" with "ASSERT(" to assist debugging. Removed
one instance of commented-out code containing "assert(" instead of replacing it.
2007-03-25 Antti Koivisto <antti@apple.com>
Reviewed by Adam.
......
......@@ -201,7 +201,7 @@ JSValue* DOMCSSStyleDeclaration::getValueProperty(ExecState* exec, int token)
case ParentRule:
return toJS(exec, m_impl->parentRule());
default:
assert(0);
ASSERT(0);
return jsUndefined();
}
}
......@@ -384,7 +384,7 @@ JSValue* DOMStyleSheetList::getValueProperty(ExecState* exec, int token) const
case Length:
return jsNumber(m_impl->length());
default:
assert(0);
ASSERT(0);
return jsUndefined();
}
}
......@@ -505,7 +505,7 @@ JSValue* DOMMediaList::getValueProperty(ExecState* exec, int token)
case Length:
return jsNumber(m_impl->length());
default:
assert(0);
ASSERT(0);
return jsUndefined();
}
}
......@@ -612,7 +612,7 @@ JSValue* DOMCSSStyleSheet::getValueProperty(ExecState* exec, int token) const
case Rules:
return toJS(exec, static_cast<CSSStyleSheet*>(impl())->cssRules(true));
default:
assert(0);
ASSERT(0);
return jsUndefined();
}
}
......@@ -791,7 +791,7 @@ JSValue* DOMCSSRule::getValueProperty(ExecState* exec, int token) const
return jsStringOrNull(static_cast<CSSCharsetRule*>(m_impl.get())->encoding());
default:
assert(0);
ASSERT(0);
}
return jsUndefined();
}
......@@ -901,7 +901,7 @@ JSValue* DOMCSSValue::getValueProperty(ExecState* exec, int token) const
case CssValueType:
return jsNumber(cssValue.cssValueType());
default:
assert(0);
ASSERT(0);
return jsUndefined();
}
}
......
......@@ -124,7 +124,7 @@ DOMNode::~DOMNode()
void DOMNode::mark()
{
assert(!marked());
ASSERT(!marked());
Node* node = m_impl.get();
......@@ -169,7 +169,7 @@ void DOMNode::mark()
root->m_inSubtreeMark = false;
// Double check that we actually ended up marked. This assert caught problems in the past.
assert(marked());
ASSERT(marked());
}
bool DOMNode::toBoolean(ExecState* ) const
......@@ -717,7 +717,7 @@ JSValue* DOMNodeList::toPrimitive(ExecState* exec, JSType) const
JSValue* DOMNodeList::getValueProperty(ExecState* exec, int token) const
{
assert(token == Length);
ASSERT(token == Length);
return jsNumber(m_impl->length());
}
......
......@@ -572,10 +572,10 @@ JSValue *Clipboard::getValueProperty(ExecState *exec, int token) const
{
switch (token) {
case DropEffect:
assert(clipboard->isForDragging() || clipboard->dropEffect().isNull());
ASSERT(clipboard->isForDragging() || clipboard->dropEffect().isNull());
return jsStringOrUndefined(clipboard->dropEffect());
case EffectAllowed:
assert(clipboard->isForDragging() || clipboard->effectAllowed().isNull());
ASSERT(clipboard->isForDragging() || clipboard->effectAllowed().isNull());
return jsStringOrUndefined(clipboard->effectAllowed());
case Types:
{
......
......@@ -293,7 +293,7 @@ JSValue *JSHTMLDocument::getValueProperty(ExecState* exec, int token) const
case DesignMode:
return jsString(doc.inDesignMode() ? "on" : "off");
default:
assert(0);
ASSERT(0);
return jsUndefined();
}
}
......
......@@ -300,7 +300,7 @@ KJS_IMPLEMENT_PROTOTYPE_FUNCTION(PluginsFunc)
JSValue *Plugins::getValueProperty(ExecState *exec, int token) const
{
assert(token == Length);
ASSERT(token == Length);
return jsNumber(plugins->size());
}
......@@ -363,7 +363,7 @@ bool Plugins::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName
JSValue *MimeTypes::getValueProperty(ExecState *exec, int token) const
{
assert(token == Length);
ASSERT(token == Length);
return jsNumber(mimes->size());
}
......@@ -437,7 +437,7 @@ JSValue *Plugin::getValueProperty(ExecState *exec, int token) const
case Length:
return jsNumber(m_info->mimes.size());
default:
assert(0);
ASSERT(0);
return jsUndefined();
}
}
......
......@@ -131,7 +131,7 @@ void KJSProxy::finishedWithEvent(Event* event)
ScriptInterpreter* KJSProxy::interpreter()
{
initScriptIfNeeded();
assert(m_script);
ASSERT(m_script);
return m_script.get();
}
......
......@@ -1519,7 +1519,7 @@ static void parseWindowFeatures(const String& features, WindowFeatures& windowFe
i++;
valueEnd = i;
assert(i <= length);
ASSERT(i <= length);
String keyString(buffer.substring(keyBegin, keyEnd - keyBegin));
String valueString(buffer.substring(valueBegin, valueEnd - valueBegin));
......
......@@ -606,7 +606,7 @@ static List listFromNSArray(ExecState *exec, NSArray *array)
- (void)dealloc
{
assert(false);
ASSERT(false);
return;
[super dealloc]; // make -Wdealloc-check happy
}
......
......@@ -2774,7 +2774,7 @@ struct BorderImageParseContext
else if (!m_bottom)
m_bottom = val;
else {
assert(!m_left);
ASSERT(!m_left);
m_left = val;
}
......@@ -2790,7 +2790,7 @@ struct BorderImageParseContext
else if (!m_borderBottom)
m_borderBottom = val;
else {
assert(!m_borderLeft);
ASSERT(!m_borderLeft);
m_borderLeft = val;
}
......
......@@ -1610,7 +1610,7 @@ bool CSSStyleSelector::checkOneSelector(CSSSelector* sel, Element* e, bool isSub
dynamicPseudo = RenderStyle::SEARCH_RESULTS_BUTTON;
return true;
case CSSSelector::PseudoNotParsed:
assert(false);
ASSERT(false);
break;
}
return false;
......
......@@ -38,14 +38,14 @@ Attr::Attr(Element* element, Document* docPtr, Attribute* a)
m_attribute(a),
m_ignoreChildrenChanged(0)
{
assert(!m_attribute->attr());
ASSERT(!m_attribute->attr());
m_attribute->m_impl = this;
m_specified = true;
}
Attr::~Attr()
{
assert(m_attribute->attr() == this);
ASSERT(m_attribute->attr() == this);
m_attribute->m_impl = 0;
}
......
......@@ -184,20 +184,20 @@ bool ContainerNode::insertBefore(PassRefPtr<Node> newChild, Node* refChild, Exce
if (child->parentNode())
break;
assert(!child->nextSibling());
assert(!child->previousSibling());
ASSERT(!child->nextSibling());
ASSERT(!child->previousSibling());
// Add child before "next".
forbidEventDispatch();
Node* prev = next->previousSibling();
assert(m_lastChild != prev);
ASSERT(m_lastChild != prev);
next->setPreviousSibling(child.get());
if (prev) {
assert(m_firstChild != next);
assert(prev->nextSibling() == next);
ASSERT(m_firstChild != next);
ASSERT(prev->nextSibling() == next);
prev->setNextSibling(child.get());
} else {
assert(m_firstChild == next);
ASSERT(m_firstChild == next);
m_firstChild = child.get();
}
child->setParent(this);
......@@ -282,26 +282,26 @@ bool ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, Exce
if (child->parentNode())
break;
assert(!child->nextSibling());
assert(!child->previousSibling());
ASSERT(!child->nextSibling());
ASSERT(!child->previousSibling());
// Add child after "prev".
forbidEventDispatch();
Node* next;
if (prev) {
next = prev->nextSibling();
assert(m_firstChild != next);
ASSERT(m_firstChild != next);
prev->setNextSibling(child.get());
} else {
next = m_firstChild;
m_firstChild = child.get();
}
if (next) {
assert(m_lastChild != prev);
assert(next->previousSibling() == prev);
ASSERT(m_lastChild != prev);
ASSERT(next->previousSibling() == prev);
next->setPreviousSibling(child.get());
} else {
assert(m_lastChild == prev);
ASSERT(m_lastChild == prev);
m_lastChild = child.get();
}
child->setParent(this);
......@@ -878,7 +878,7 @@ Node *ContainerNode::childNode(unsigned index) const
static void dispatchChildInsertionEvents(Node* child, ExceptionCode& ec)
{
assert(!eventDispatchForbidden());
ASSERT(!eventDispatchForbidden());
RefPtr<Node> c = child;
RefPtr<Document> doc = child->document();
......
......@@ -231,8 +231,8 @@ static Widget* widgetForNode(Node* focusedNode)
static bool relinquishesEditingFocus(Node *node)
{
assert(node);
assert(node->isContentEditable());
ASSERT(node);
ASSERT(node->isContentEditable());
Node *root = node->rootEditableElement();
Frame* frame = node->document()->frame();
......@@ -244,8 +244,8 @@ static bool relinquishesEditingFocus(Node *node)
static bool acceptsEditingFocus(Node *node)
{
assert(node);
assert(node->isContentEditable());
ASSERT(node);
ASSERT(node->isContentEditable());
Node *root = node->rootEditableElement();
Frame* frame = node->document()->frame();
......@@ -1098,8 +1098,8 @@ void Document::updateLayoutIgnorePendingStylesheets()
void Document::attach()
{
assert(!attached());
assert(!m_inPageCache);
ASSERT(!attached());
ASSERT(!m_inPageCache);
if (!m_renderArena)
m_renderArena = new RenderArena();
......@@ -1493,7 +1493,7 @@ void Document::write(const String& text)
if (!m_tokenizer) {
open();
assert(m_tokenizer);
ASSERT(m_tokenizer);
if (!m_tokenizer)
return;
write(DeprecatedString("<html>"));
......@@ -1705,7 +1705,7 @@ Node* Document::previousFocusableNode(Node* start, KeyboardEvent* event)
int Document::nodeAbsIndex(Node *node)
{
assert(node->document() == this);
ASSERT(node->document() == this);
int absIndex = 0;
for (Node *n = node; n && n != this; n = n->traversePreviousNode())
......@@ -1724,7 +1724,7 @@ Node *Document::nodeWithAbsIndex(int absIndex)
void Document::processHttpEquiv(const String &equiv, const String &content)
{
assert(!equiv.isNull() && !content.isNull());
ASSERT(!equiv.isNull() && !content.isNull());
Frame *frame = this->frame();
......@@ -1920,7 +1920,7 @@ void Document::setSelectedStylesheetSet(const String& aString)
void Document::stylesheetLoaded()
{
// Make sure we knew this sheet was pending, and that our count isn't out of sync.
assert(m_pendingStylesheets > 0);
ASSERT(m_pendingStylesheets > 0);
m_pendingStylesheets--;
......@@ -2688,7 +2688,7 @@ void Document::passwordFieldAdded()
void Document::passwordFieldRemoved()
{
assert(m_passwordFields > 0);
ASSERT(m_passwordFields > 0);
m_passwordFields--;
}
......@@ -2704,7 +2704,7 @@ void Document::secureFormAdded()
void Document::secureFormRemoved()
{
assert(m_secureForms > 0);
ASSERT(m_secureForms > 0);
m_secureForms--;
}
......@@ -2806,7 +2806,7 @@ void Document::removeMarkers(Range *range, DocumentMarker::MarkerType markerType
void Document::addMarker(Node *node, DocumentMarker newMarker)
{
assert(newMarker.endOffset >= newMarker.startOffset);
ASSERT(newMarker.endOffset >= newMarker.startOffset);
if (newMarker.endOffset == newMarker.startOffset)
return;
......@@ -3177,7 +3177,7 @@ void Document::shiftMarkers(Node *node, unsigned startOffset, int delta, Documen
for (size_t i = 0; i != markers.size(); ++i) {
DocumentMarker &marker = markers[i];
if (marker.startOffset >= startOffset && (markerType == DocumentMarker::AllMarkers || marker.type == markerType)) {
assert((int)marker.startOffset + delta >= 0);
ASSERT((int)marker.startOffset + delta >= 0);
marker.startOffset += delta;
marker.endOffset += delta;
docDirty = true;
......
......@@ -66,7 +66,7 @@ PassRefPtr<Node> Element::cloneNode(bool deep)
{
ExceptionCode ec = 0;
RefPtr<Element> clone = document()->createElementNS(namespaceURI(), nodeName(), ec);
assert(!ec);
ASSERT(!ec);
// clone attributes
if (namedAttrMap)
......@@ -670,7 +670,7 @@ bool Element::childTypeAllowed(NodeType type)
void Element::dispatchAttrRemovalEvent(Attribute*)
{
assert(!eventDispatchForbidden());
ASSERT(!eventDispatchForbidden());
#if 0
if (!document()->hasListenerType(Document::DOMATTRMODIFIED_LISTENER))
return;
......@@ -682,7 +682,7 @@ void Element::dispatchAttrRemovalEvent(Attribute*)
void Element::dispatchAttrAdditionEvent(Attribute *attr)
{
assert(!eventDispatchForbidden());
ASSERT(!eventDispatchForbidden());
#if 0
if (!document()->hasListenerType(Document::DOMATTRMODIFIED_LISTENER))
return;
......
......@@ -69,7 +69,7 @@ public:
// used during parsing: only inserts if not already there
// no error checking!
void insertAttribute(Attribute* newAttribute) {
assert(!element);
ASSERT(!element);
if (!getAttributeItem(newAttribute->name()))
addAttribute(newAttribute);
else
......
......@@ -486,20 +486,20 @@ Node *Node::childNode(unsigned /*index*/) const
Node *Node::traverseNextNode(const Node *stayWithin) const
{
if (firstChild()) {
assert(!stayWithin || firstChild()->isDescendantOf(stayWithin));
ASSERT(!stayWithin || firstChild()->isDescendantOf(stayWithin));
return firstChild();
}
if (this == stayWithin)
return 0;
if (nextSibling()) {
assert(!stayWithin || nextSibling()->isDescendantOf(stayWithin));
ASSERT(!stayWithin || nextSibling()->isDescendantOf(stayWithin));
return nextSibling();
}
const Node *n = this;
while (n && !n->nextSibling() && (!stayWithin || n->parentNode() != stayWithin))
n = n->parentNode();
if (n) {
assert(!stayWithin || !n->nextSibling() || n->nextSibling()->isDescendantOf(stayWithin));
ASSERT(!stayWithin || !n->nextSibling() || n->nextSibling()->isDescendantOf(stayWithin));
return n->nextSibling();
}
return 0;
......@@ -510,14 +510,14 @@ Node *Node::traverseNextSibling(const Node *stayWithin) const
if (this == stayWithin)
return 0;
if (nextSibling()) {
assert(!stayWithin || nextSibling()->isDescendantOf(stayWithin));
ASSERT(!stayWithin || nextSibling()->isDescendantOf(stayWithin));
return nextSibling();
}
const Node *n = this;
while (n && !n->nextSibling() && (!stayWithin || n->parentNode() != stayWithin))
n = n->parentNode();
if (n) {
assert(!stayWithin || !n->nextSibling() || n->nextSibling()->isDescendantOf(stayWithin));
ASSERT(!stayWithin || !n->nextSibling() || n->nextSibling()->isDescendantOf(stayWithin));
return n->nextSibling();
}
return 0;
......@@ -539,20 +539,20 @@ Node *Node::traversePreviousNode(const Node *stayWithin) const
Node *Node::traversePreviousNodePostOrder(const Node *stayWithin) const
{
if (lastChild()) {
assert(!stayWithin || lastChild()->isDescendantOf(stayWithin));
ASSERT(!stayWithin || lastChild()->isDescendantOf(stayWithin));
return lastChild();
}
if (this == stayWithin)
return 0;
if (previousSibling()) {
assert(!stayWithin || previousSibling()->isDescendantOf(stayWithin));
ASSERT(!stayWithin || previousSibling()->isDescendantOf(stayWithin));
return previousSibling();
}
const Node *n = this;
while (n && !n->previousSibling() && (!stayWithin || n->parentNode() != stayWithin))
n = n->parentNode();
if (n) {
assert(!stayWithin || !n->previousSibling() || n->previousSibling()->isDescendantOf(stayWithin));
ASSERT(!stayWithin || !n->previousSibling() || n->previousSibling()->isDescendantOf(stayWithin));
return n->previousSibling();
}
return 0;
......@@ -810,8 +810,8 @@ void Node::dump(TextStream* stream, DeprecatedString ind) const
void Node::attach()
{
assert(!attached());
assert(!renderer() || (renderer()->style() && renderer()->parent()));
ASSERT(!attached());
ASSERT(!renderer() || (renderer()->style() && renderer()->parent()));
document()->incDOMTreeVersion();
m_attached = true;
}
......@@ -888,7 +888,7 @@ Node *Node::previousEditable() const
// the last child, it specifies to start at next sibling.
Node *Node::nextEditable(int offset) const
{
assert(offset>=0);
ASSERT(offset>=0);
Node *node;
if (hasChildNodes())
node = (offset >= (int)childNodeCount()) ? nextSibling() : childNode(offset)->nextLeafNode();
......@@ -994,11 +994,11 @@ void Node::createRendererIfNeeded()
if (!document()->shouldCreateRenderers())
return;
assert(!attached());
assert(!renderer());
ASSERT(!attached());
ASSERT(!renderer());
Node *parent = parentNode();
assert(parent);
ASSERT(parent);
RenderObject *parentRenderer = parent->renderer();
if (parentRenderer && parentRenderer->canHaveChildren()
......@@ -1034,7 +1034,7 @@ bool Node::rendererIsNeeded(RenderStyle *style)
RenderObject *Node::createRenderer(RenderArena *arena, RenderStyle *style)
{
assert(false);
ASSERT(false);
return 0;
}
......
......@@ -556,7 +556,7 @@ short Range::compareBoundaryPoints( Node *containerA, int offsetA, Node *contain
}
// Should never reach this point.
assert(0);
ASSERT(0);
return 0;
}
......
......@@ -382,7 +382,7 @@ void StyledElement::addCSSColor(MappedAttribute* attr, int id, const String &c)
colors[0] >>= 4*maxDigit;
colors[1] >>= 4*maxDigit;
colors[2] >>= 4*maxDigit;
// assert(colors[0] < 0x100 && colors[1] < 0x100 && colors[2] < 0x100);
// ASSERT(colors[0] < 0x100 && colors[1] < 0x100 && colors[2] < 0x100);
color = String::format("#%02x%02x%02x", colors[0], colors[1], colors[2]);
if (attr->decl()->setProperty(id, color, false))
......@@ -419,7 +419,7 @@ unsigned MappedAttributeHash::hash(const MappedAttributeKey& key)
tmp = (p[1] << 11) ^ hash;
hash = (hash << 16) ^ tmp;
hash += hash >> 11;
assert(sizeof(key.name) == 4 || sizeof(key.name) == 8);
ASSERT(sizeof(key.name) == 4 || sizeof(key.name) == 8);
if (sizeof(key.name) == 8) {
p += 2;
hash += p[0];
......@@ -433,7 +433,7 @@ unsigned MappedAttributeHash::hash(const MappedAttributeKey& key)
tmp = (p[1] << 11) ^ hash;
hash = (hash << 16) ^ tmp;
hash += hash >> 11;
assert(sizeof(key.value) == 4 || sizeof(key.value) == 8);
ASSERT(sizeof(key.value) == 4 || sizeof(key.value) == 8);
if (sizeof(key.value) == 8) {
p += 2;
hash += p[0];
......
......@@ -1066,7 +1066,7 @@ static xmlEntityPtr getXHTMLEntity(const xmlChar* name)
return 0;
CString value = String(&c, 1).utf8();
assert(value.length() < 5);
ASSERT(value.length() < 5);
sharedXHTMLEntity.length = value.length();
sharedXHTMLEntity.name = name;
memcpy(sharedXHTMLEntityResult, value.data(), sharedXHTMLEntity.length + 1);
......
......@@ -665,7 +665,7 @@ bool Editor::selectionStartHasStyle(CSSStyleDeclaration* style) const
if (nodeToRemove) {
ExceptionCode ec = 0;
nodeToRemove->remove(ec);
assert(ec == 0);
ASSERT(ec == 0);
}
return match;
......
......@@ -94,7 +94,7 @@ Position InsertTextCommand::prepareForTextInsertion(const Position& p)
void InsertTextCommand::input(const String &text, bool selectInsertedText)
{
assert(text.find('\n') == -1);
ASSERT(text.find('\n') == -1);
if (endingSelection().isNone())
return;
......
......@@ -749,7 +749,7 @@ void ReplaceSelectionCommand::completeHTMLReplacement(const Position &lastPositi
rebalanceWhitespaceAt(end);
if (m_matchStyle) {
assert(m_insertionStyle);
ASSERT(m_insertionStyle);
applyStyle(m_insertionStyle.get(), start, end);
}
......
......@@ -569,7 +569,7 @@ void TextIterator::exitNode()
emitCharacter('\n', baseNode->parentNode(), baseNode, 1, 1);
// remember whether to later add a newline for the current node
assert(!m_needAnotherNewline);
ASSERT(!m_needAnotherNewline);
m_needAnotherNewline = addNewline;
} else if (addNewline) {
// insert a newline with a position following this block's contents.
......@@ -696,7 +696,7 @@ SimplifiedBackwardsTextIterator::SimplifiedBackwardsTextIterator(const Range *r)
void SimplifiedBackwardsTextIterator::advance()
{
assert(m_positionNode);
ASSERT(m_positionNode);
m_positionNode = 0;
m_textLength = 0;
......@@ -876,11 +876,11 @@ PassRefPtr<Range> CharacterIterator::range() const