[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
paroga at webkit.org
paroga at webkit.org
Wed Dec 22 16:18:15 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit f27e2eb144ddd5c677710aeca97962143c54eb6e
Author: paroga at webkit.org <paroga at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Nov 22 00:10:38 2010 +0000
2010-11-21 Patrick Gansterer <paroga at webkit.org>
Reviewed by Csaba Osztrogonác.
Use WTF_ARRAY_LENGTH in WebCore directory
https://bugs.webkit.org/show_bug.cgi?id=49882
* accessibility/AccessibilityObject.cpp:
(WebCore::createARIARoleMap):
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::JSDOMWindowBase):
* bindings/scripts/CodeGeneratorV8.pm:
* bindings/scripts/test/V8/V8TestObj.cpp:
(WebCore::ConfigureV8TestObjTemplate):
* css/CSSComputedStyleDeclaration.cpp:
* css/CSSMutableStyleDeclaration.cpp:
(WebCore::CSSMutableStyleDeclaration::getPropertyValue):
* css/CSSParser.cpp:
(WebCore::CSSParser::parseAnimationShorthand):
(WebCore::CSSParser::parseTransitionShorthand):
* css/CSSPropertyLonghand.cpp:
(WebCore::initShorthandMap):
* dom/ExceptionCode.cpp:
(WebCore::getExceptionCodeDescription):
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::removeImplicitlyStyledElement):
* editing/EditingStyle.cpp:
* editing/Editor.cpp:
(WebCore::triStateOfStyle):
* editing/EditorCommand.cpp:
(WebCore::createCommandMap):
* editing/MarkupAccumulator.cpp:
(WebCore::appendCharactersReplacingEntities):
* html/canvas/WebGLBuffer.cpp:
(WebCore::WebGLBuffer::getCachedMaxIndex):
(WebCore::WebGLBuffer::setCachedMaxIndex):
* loader/FTPDirectoryParser.cpp:
(WebCore::parseOneFTPLine):
* mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::updateFromElement):
* page/animation/AnimationBase.cpp:
(WebCore::addShorthandProperties):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::hasValidAvgCharWidth):
* rendering/break_lines.cpp:
* svg/SVGTransformable.cpp:
(WebCore::parseAndSkipType):
* svg/SVGViewSpec.cpp:
(WebCore::SVGViewSpec::parseViewSpec):
* svg/SVGZoomAndPan.cpp:
(WebCore::SVGZoomAndPan::parseZoomAndPan):
* xml/XPathFunctions.cpp:
(WebCore::XPath::createFunctionMap):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72500 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 17486a7..8721443 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,57 @@
+2010-11-21 Patrick Gansterer <paroga at webkit.org>
+
+ Reviewed by Csaba Osztrogonác.
+
+ Use WTF_ARRAY_LENGTH in WebCore directory
+ https://bugs.webkit.org/show_bug.cgi?id=49882
+
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::createARIARoleMap):
+ * bindings/js/JSDOMWindowBase.cpp:
+ (WebCore::JSDOMWindowBase::JSDOMWindowBase):
+ * bindings/scripts/CodeGeneratorV8.pm:
+ * bindings/scripts/test/V8/V8TestObj.cpp:
+ (WebCore::ConfigureV8TestObjTemplate):
+ * css/CSSComputedStyleDeclaration.cpp:
+ * css/CSSMutableStyleDeclaration.cpp:
+ (WebCore::CSSMutableStyleDeclaration::getPropertyValue):
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseAnimationShorthand):
+ (WebCore::CSSParser::parseTransitionShorthand):
+ * css/CSSPropertyLonghand.cpp:
+ (WebCore::initShorthandMap):
+ * dom/ExceptionCode.cpp:
+ (WebCore::getExceptionCodeDescription):
+ * editing/ApplyStyleCommand.cpp:
+ (WebCore::ApplyStyleCommand::removeImplicitlyStyledElement):
+ * editing/EditingStyle.cpp:
+ * editing/Editor.cpp:
+ (WebCore::triStateOfStyle):
+ * editing/EditorCommand.cpp:
+ (WebCore::createCommandMap):
+ * editing/MarkupAccumulator.cpp:
+ (WebCore::appendCharactersReplacingEntities):
+ * html/canvas/WebGLBuffer.cpp:
+ (WebCore::WebGLBuffer::getCachedMaxIndex):
+ (WebCore::WebGLBuffer::setCachedMaxIndex):
+ * loader/FTPDirectoryParser.cpp:
+ (WebCore::parseOneFTPLine):
+ * mathml/RenderMathMLOperator.cpp:
+ (WebCore::RenderMathMLOperator::updateFromElement):
+ * page/animation/AnimationBase.cpp:
+ (WebCore::addShorthandProperties):
+ * rendering/RenderTextControl.cpp:
+ (WebCore::RenderTextControl::hasValidAvgCharWidth):
+ * rendering/break_lines.cpp:
+ * svg/SVGTransformable.cpp:
+ (WebCore::parseAndSkipType):
+ * svg/SVGViewSpec.cpp:
+ (WebCore::SVGViewSpec::parseViewSpec):
+ * svg/SVGZoomAndPan.cpp:
+ (WebCore::SVGZoomAndPan::parseZoomAndPan):
+ * xml/XPathFunctions.cpp:
+ (WebCore::XPath::createFunctionMap):
+
2010-11-21 Mario Sanchez Prada <msanchez at igalia.com>
Reviewed by Chris Fleizach.
diff --git a/WebCore/accessibility/AccessibilityObject.cpp b/WebCore/accessibility/AccessibilityObject.cpp
index caf12dc..327a736 100644
--- a/WebCore/accessibility/AccessibilityObject.cpp
+++ b/WebCore/accessibility/AccessibilityObject.cpp
@@ -937,9 +937,8 @@ static ARIARoleMap* createARIARoleMap()
{ "treeitem", TreeItemRole }
};
ARIARoleMap* roleMap = new ARIARoleMap;
-
- const unsigned numRoles = sizeof(roles) / sizeof(roles[0]);
- for (unsigned i = 0; i < numRoles; ++i)
+
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(roles); ++i)
roleMap->set(roles[i].ariaRole, roles[i].webcoreRole);
return roleMap;
}
diff --git a/WebCore/bindings/js/JSDOMWindowBase.cpp b/WebCore/bindings/js/JSDOMWindowBase.cpp
index a72ece6..ad4e2f7 100644
--- a/WebCore/bindings/js/JSDOMWindowBase.cpp
+++ b/WebCore/bindings/js/JSDOMWindowBase.cpp
@@ -60,7 +60,7 @@ JSDOMWindowBase::JSDOMWindowBase(NonNullPassRefPtr<Structure> structure, PassRef
GlobalPropertyInfo(Identifier(globalExec(), "window"), d()->shell, DontDelete | ReadOnly)
};
- addStaticGlobals(staticGlobals, sizeof(staticGlobals) / sizeof(GlobalPropertyInfo));
+ addStaticGlobals(staticGlobals, WTF_ARRAY_LENGTH(staticGlobals));
}
void JSDOMWindowBase::updateDocument()
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index 90341b8..6ea61bc 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -1916,7 +1916,7 @@ END
push(@implContent, <<END);
static v8::Persistent<v8::ObjectTemplate> ConfigureShadowObjectTemplate(v8::Persistent<v8::ObjectTemplate> templ)
{
- batchConfigureAttributes(templ, v8::Handle<v8::ObjectTemplate>(), shadowAttrs, sizeof(shadowAttrs) / sizeof(*shadowAttrs));
+ batchConfigureAttributes(templ, v8::Handle<v8::ObjectTemplate>(), shadowAttrs, WTF_ARRAY_LENGTH(shadowAttrs));
// Install a security handler with V8.
templ->SetAccessCheckCallbacks(V8DOMWindow::namedSecurityCheck, V8DOMWindow::indexedSecurityCheck, v8::External::Wrap(&V8DOMWindow::info));
@@ -1948,7 +1948,7 @@ END
# Set up our attributes if we have them
if ($has_attributes) {
push(@implContent, <<END);
- ${interfaceName}Attrs, sizeof(${interfaceName}Attrs) / sizeof(*${interfaceName}Attrs),
+ ${interfaceName}Attrs, WTF_ARRAY_LENGTH(${interfaceName}Attrs),
END
} else {
push(@implContent, <<END);
@@ -1958,7 +1958,7 @@ END
if ($has_callbacks) {
push(@implContent, <<END);
- ${interfaceName}Callbacks, sizeof(${interfaceName}Callbacks) / sizeof(*${interfaceName}Callbacks));
+ ${interfaceName}Callbacks, WTF_ARRAY_LENGTH(${interfaceName}Callbacks));
END
} else {
push(@implContent, <<END);
@@ -2096,7 +2096,7 @@ END
if ($has_constants) {
push(@implContent, <<END);
- batchConfigureConstants(desc, proto, ${interfaceName}Consts, sizeof(${interfaceName}Consts) / sizeof(*${interfaceName}Consts));
+ batchConfigureConstants(desc, proto, ${interfaceName}Consts, WTF_ARRAY_LENGTH(${interfaceName}Consts));
END
}
diff --git a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
index e3d924a..c4a76ac 100644
--- a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
+++ b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
@@ -1253,8 +1253,8 @@ COMPILE_ASSERT(0x1abc == TestObj::CONST_VALUE_14, TestObjEnumCONST_VALUE_14IsWro
static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persistent<v8::FunctionTemplate> desc)
{
v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "TestObj", v8::Persistent<v8::FunctionTemplate>(), V8TestObj::internalFieldCount,
- TestObjAttrs, sizeof(TestObjAttrs) / sizeof(*TestObjAttrs),
- TestObjCallbacks, sizeof(TestObjCallbacks) / sizeof(*TestObjCallbacks));
+ TestObjAttrs, WTF_ARRAY_LENGTH(TestObjAttrs),
+ TestObjCallbacks, WTF_ARRAY_LENGTH(TestObjCallbacks));
v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
@@ -1312,7 +1312,7 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persi
proto->Set(v8::String::New("enabledAtRuntimeMethod1"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod1Callback, v8::Handle<v8::Value>(), defaultSignature));
if (RuntimeEnabledFeatures::featureNameEnabled())
proto->Set(v8::String::New("enabledAtRuntimeMethod2"), v8::FunctionTemplate::New(TestObjInternal::enabledAtRuntimeMethod2Callback, v8::Handle<v8::Value>(), defaultSignature));
- batchConfigureConstants(desc, proto, TestObjConsts, sizeof(TestObjConsts) / sizeof(*TestObjConsts));
+ batchConfigureConstants(desc, proto, TestObjConsts, WTF_ARRAY_LENGTH(TestObjConsts));
// Custom toString template
desc->Set(getToStringName(), getToStringTemplate());
diff --git a/WebCore/css/CSSComputedStyleDeclaration.cpp b/WebCore/css/CSSComputedStyleDeclaration.cpp
index cdcd3d6..c804694 100644
--- a/WebCore/css/CSSComputedStyleDeclaration.cpp
+++ b/WebCore/css/CSSComputedStyleDeclaration.cpp
@@ -272,7 +272,7 @@ static const int computedProperties[] = {
#endif
};
-const unsigned numComputedProperties = sizeof(computedProperties) / sizeof(computedProperties[0]);
+const unsigned numComputedProperties = WTF_ARRAY_LENGTH(computedProperties);
static int valueForRepeatRule(int rule)
{
diff --git a/WebCore/css/CSSMutableStyleDeclaration.cpp b/WebCore/css/CSSMutableStyleDeclaration.cpp
index 47809c2..09655ae 100644
--- a/WebCore/css/CSSMutableStyleDeclaration.cpp
+++ b/WebCore/css/CSSMutableStyleDeclaration.cpp
@@ -142,8 +142,7 @@ String CSSMutableStyleDeclaration::getPropertyValue(int propertyID) const
CSSPropertyBorderBottomColor,
CSSPropertyBorderLeftColor }};
String res;
- const int nrprops = sizeof(properties) / sizeof(properties[0]);
- for (int i = 0; i < nrprops; ++i) {
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(properties); ++i) {
String value = getCommonValue(properties[i], 4);
if (!value.isNull()) {
if (!res.isNull())
@@ -758,7 +757,7 @@ static const int blockProperties[] = {
CSSPropertyWidows
};
-const unsigned numBlockProperties = sizeof(blockProperties) / sizeof(blockProperties[0]);
+const unsigned numBlockProperties = WTF_ARRAY_LENGTH(blockProperties);
PassRefPtr<CSSMutableStyleDeclaration> CSSMutableStyleDeclaration::copyBlockProperties() const
{
diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
index 836113e..7b34ef7 100644
--- a/WebCore/css/CSSParser.cpp
+++ b/WebCore/css/CSSParser.cpp
@@ -2002,7 +2002,7 @@ bool CSSParser::parseAnimationShorthand(bool important)
CSSPropertyWebkitAnimationIterationCount,
CSSPropertyWebkitAnimationDirection,
CSSPropertyWebkitAnimationFillMode };
- const int numProperties = sizeof(properties) / sizeof(properties[0]);
+ const int numProperties = WTF_ARRAY_LENGTH(properties);
ShorthandScope scope(this, CSSPropertyWebkitAnimation);
@@ -2060,7 +2060,7 @@ bool CSSParser::parseTransitionShorthand(bool important)
CSSPropertyWebkitTransitionDuration,
CSSPropertyWebkitTransitionTimingFunction,
CSSPropertyWebkitTransitionDelay };
- const int numProperties = sizeof(properties) / sizeof(properties[0]);
+ const int numProperties = WTF_ARRAY_LENGTH(properties);
ShorthandScope scope(this, CSSPropertyWebkitTransition);
diff --git a/WebCore/css/CSSPropertyLonghand.cpp b/WebCore/css/CSSPropertyLonghand.cpp
index acca036..4df5d62 100644
--- a/WebCore/css/CSSPropertyLonghand.cpp
+++ b/WebCore/css/CSSPropertyLonghand.cpp
@@ -32,7 +32,7 @@ typedef HashMap<int, CSSPropertyLonghand> ShorthandMap;
static void initShorthandMap(ShorthandMap& shorthandMap)
{
#define SET_SHORTHAND_MAP_ENTRY(map, propID, array) \
- map.set(propID, CSSPropertyLonghand(array, sizeof(array) / sizeof(array[0])))
+ map.set(propID, CSSPropertyLonghand(array, WTF_ARRAY_LENGTH(array)))
// FIXME: The 'font' property has "shorthand nature" but is not parsed as a shorthand.
diff --git a/WebCore/dom/ExceptionCode.cpp b/WebCore/dom/ExceptionCode.cpp
index f048fe5..ad4fb6f 100644
--- a/WebCore/dom/ExceptionCode.cpp
+++ b/WebCore/dom/ExceptionCode.cpp
@@ -227,7 +227,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
code -= RangeException::RangeExceptionOffset;
nameTable = rangeExceptionNames;
descriptionTable = rangeExceptionDescriptions;
- nameTableSize = sizeof(rangeExceptionNames) / sizeof(rangeExceptionNames[0]);
+ nameTableSize = WTF_ARRAY_LENGTH(rangeExceptionNames);
nameTableOffset = RangeException::BAD_BOUNDARYPOINTS_ERR;
} else if (code >= EventException::EventExceptionOffset && code <= EventException::EventExceptionMax) {
type = EventExceptionType;
@@ -235,7 +235,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
code -= EventException::EventExceptionOffset;
nameTable = eventExceptionNames;
descriptionTable = eventExceptionDescriptions;
- nameTableSize = sizeof(eventExceptionNames) / sizeof(eventExceptionNames[0]);
+ nameTableSize = WTF_ARRAY_LENGTH(eventExceptionNames);
nameTableOffset = EventException::UNSPECIFIED_EVENT_TYPE_ERR;
} else if (code >= XMLHttpRequestException::XMLHttpRequestExceptionOffset && code <= XMLHttpRequestException::XMLHttpRequestExceptionMax) {
type = XMLHttpRequestExceptionType;
@@ -243,7 +243,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
code -= XMLHttpRequestException::XMLHttpRequestExceptionOffset;
nameTable = xmlHttpRequestExceptionNames;
descriptionTable = xmlHttpRequestExceptionDescriptions;
- nameTableSize = sizeof(xmlHttpRequestExceptionNames) / sizeof(xmlHttpRequestExceptionNames[0]);
+ nameTableSize = WTF_ARRAY_LENGTH(xmlHttpRequestExceptionNames);
// XMLHttpRequest exception codes start with 101 and we don't want 100 empty elements in the name array
nameTableOffset = XMLHttpRequestException::NETWORK_ERR;
#if ENABLE(XPATH)
@@ -253,7 +253,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
code -= XPathException::XPathExceptionOffset;
nameTable = xpathExceptionNames;
descriptionTable = xpathExceptionDescriptions;
- nameTableSize = sizeof(xpathExceptionNames) / sizeof(xpathExceptionNames[0]);
+ nameTableSize = WTF_ARRAY_LENGTH(xpathExceptionNames);
// XPath exception codes start with 51 and we don't want 51 empty elements in the name array
nameTableOffset = XPathException::INVALID_EXPRESSION_ERR;
#endif
@@ -264,7 +264,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
code -= SVGException::SVGExceptionOffset;
nameTable = svgExceptionNames;
descriptionTable = svgExceptionDescriptions;
- nameTableSize = sizeof(svgExceptionNames) / sizeof(svgExceptionNames[0]);
+ nameTableSize = WTF_ARRAY_LENGTH(svgExceptionNames);
nameTableOffset = SVGException::SVG_WRONG_TYPE_ERR;
#endif
#if ENABLE(DATABASE)
@@ -274,7 +274,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
code -= SQLException::SQLExceptionOffset;
nameTable = sqlExceptionNames;
descriptionTable = sqlExceptionDescriptions;
- nameTableSize = sizeof(sqlExceptionNames) / sizeof(sqlExceptionNames[0]);
+ nameTableSize = WTF_ARRAY_LENGTH(sqlExceptionNames);
nameTableOffset = SQLException::UNKNOWN_ERR;
#endif
#if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)
@@ -284,7 +284,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
code -= FileException::FileExceptionOffset;
nameTable = fileExceptionNames;
descriptionTable = fileExceptionDescriptions;
- nameTableSize = sizeof(fileExceptionNames) / sizeof(fileExceptionNames[0]);
+ nameTableSize = WTF_ARRAY_LENGTH(fileExceptionNames);
nameTableOffset = FileException::NOT_FOUND_ERR;
#endif
} else {
@@ -292,7 +292,7 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
typeName = "DOM";
nameTable = exceptionNames;
descriptionTable = exceptionDescriptions;
- nameTableSize = sizeof(exceptionNames) / sizeof(exceptionNames[0]);
+ nameTableSize = WTF_ARRAY_LENGTH(exceptionNames);
nameTableOffset = INDEX_SIZE_ERR;
}
diff --git a/WebCore/editing/ApplyStyleCommand.cpp b/WebCore/editing/ApplyStyleCommand.cpp
index c4aaac8..c43a574 100644
--- a/WebCore/editing/ApplyStyleCommand.cpp
+++ b/WebCore/editing/ApplyStyleCommand.cpp
@@ -1242,7 +1242,7 @@ bool ApplyStyleCommand::removeImplicitlyStyledElement(CSSMutableStyleDeclaration
// Current implementation does not support stylePushedDown when mode == RemoveNone because of early exit.
ASSERT(!extractedStyle || mode != RemoveNone);
bool removed = false;
- for (size_t i = 0; i < sizeof(HTMLEquivalents) / sizeof(HTMLEquivalent); i++) {
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(HTMLEquivalents); ++i) {
const HTMLEquivalent& equivalent = HTMLEquivalents[i];
ASSERT(equivalent.element || equivalent.attribute);
if ((extractedStyle && equivalent.pushDownType == ShouldNotBePushedDown)
diff --git a/WebCore/editing/EditingStyle.cpp b/WebCore/editing/EditingStyle.cpp
index 9da337f..4a55dad 100644
--- a/WebCore/editing/EditingStyle.cpp
+++ b/WebCore/editing/EditingStyle.cpp
@@ -65,7 +65,7 @@ static const int editingStyleProperties[] = {
CSSPropertyWebkitTextStrokeColor,
CSSPropertyWebkitTextStrokeWidth,
};
-size_t numEditingStyleProperties = sizeof(editingStyleProperties) / sizeof(editingStyleProperties[0]);
+size_t numEditingStyleProperties = WTF_ARRAY_LENGTH(editingStyleProperties);
static PassRefPtr<CSSMutableStyleDeclaration> copyEditingProperties(CSSStyleDeclaration* style)
{
diff --git a/WebCore/editing/Editor.cpp b/WebCore/editing/Editor.cpp
index aad872c..15bad70 100644
--- a/WebCore/editing/Editor.cpp
+++ b/WebCore/editing/Editor.cpp
@@ -929,7 +929,7 @@ static TriState triStateOfStyle(CSSStyleDeclaration* desiredStyle, CSSStyleDecla
RefPtr<CSSMutableStyleDeclaration> diff = getPropertiesNotIn(desiredStyle, styleToCompare);
if (ignoreTextOnlyProperties)
- diff->removePropertiesInSet(textOnlyProperties, sizeof(textOnlyProperties) / sizeof(textOnlyProperties[0]));
+ diff->removePropertiesInSet(textOnlyProperties, WTF_ARRAY_LENGTH(textOnlyProperties));
if (!diff->length())
return TrueTriState;
diff --git a/WebCore/editing/EditorCommand.cpp b/WebCore/editing/EditorCommand.cpp
index e3ea37e..ab83817 100644
--- a/WebCore/editing/EditorCommand.cpp
+++ b/WebCore/editing/EditorCommand.cpp
@@ -1556,8 +1556,7 @@ static const CommandMap& createCommandMap()
CommandMap& commandMap = *new CommandMap;
- const unsigned numCommands = sizeof(commands) / sizeof(commands[0]);
- for (unsigned i = 0; i < numCommands; i++) {
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(commands); ++i) {
ASSERT(!commandMap.get(commands[i].name));
commandMap.set(commands[i].name, &commands[i].command);
}
diff --git a/WebCore/editing/MarkupAccumulator.cpp b/WebCore/editing/MarkupAccumulator.cpp
index a701189..f6dbd8b 100644
--- a/WebCore/editing/MarkupAccumulator.cpp
+++ b/WebCore/editing/MarkupAccumulator.cpp
@@ -60,8 +60,8 @@ void appendCharactersReplacingEntities(Vector<UChar>& out, const UChar* content,
};
size_t positionAfterLastEntity = 0;
- for (size_t i = 0; i < length; i++) {
- for (size_t m = 0; m < sizeof(entityMaps) / sizeof(EntityDescription); m++) {
+ for (size_t i = 0; i < length; ++i) {
+ for (size_t m = 0; m < WTF_ARRAY_LENGTH(entityMaps); ++m) {
if (content[i] == entityMaps[m].entity && entityMaps[m].mask & entityMask) {
out.append(content + positionAfterLastEntity, i - positionAfterLastEntity);
append(out, entityMaps[m].reference);
diff --git a/WebCore/html/canvas/WebGLBuffer.cpp b/WebCore/html/canvas/WebGLBuffer.cpp
index 99d9cad..36ef048 100644
--- a/WebCore/html/canvas/WebGLBuffer.cpp
+++ b/WebCore/html/canvas/WebGLBuffer.cpp
@@ -170,8 +170,7 @@ unsigned WebGLBuffer::byteLength() const
long WebGLBuffer::getCachedMaxIndex(unsigned long type)
{
- size_t numEntries = sizeof(m_maxIndexCache) / sizeof(MaxIndexCacheEntry);
- for (size_t i = 0; i < numEntries; i++)
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(m_maxIndexCache); ++i)
if (m_maxIndexCache[i].type == type)
return m_maxIndexCache[i].maxIndex;
return -1;
@@ -179,8 +178,8 @@ long WebGLBuffer::getCachedMaxIndex(unsigned long type)
void WebGLBuffer::setCachedMaxIndex(unsigned long type, long value)
{
- int numEntries = sizeof(m_maxIndexCache) / sizeof(MaxIndexCacheEntry);
- for (int i = 0; i < numEntries; i++)
+ size_t numEntries = WTF_ARRAY_LENGTH(m_maxIndexCache);
+ for (size_t i = 0; i < numEntries; ++i)
if (m_maxIndexCache[i].type == type) {
m_maxIndexCache[i].maxIndex = value;
return;
diff --git a/WebCore/loader/FTPDirectoryParser.cpp b/WebCore/loader/FTPDirectoryParser.cpp
index f6a74de..6a05c4c 100644
--- a/WebCore/loader/FTPDirectoryParser.cpp
+++ b/WebCore/loader/FTPDirectoryParser.cpp
@@ -117,7 +117,7 @@ FTPEntryType parseOneFTPLine(const char* line, ListState& state, ListResult& res
{
static const char *month_names = "JanFebMarAprMayJunJulAugSepOctNovDec";
const char *tokens[16]; /* 16 is more than enough */
- unsigned int toklen[(sizeof(tokens)/sizeof(tokens[0]))];
+ unsigned int toklen[WTF_ARRAY_LENGTH(tokens)];
unsigned int linelen_sans_wsp; // line length sans whitespace
unsigned int numtoks = 0;
unsigned int tokmarker = 0; /* extra info for lstyle handler */
@@ -133,7 +133,7 @@ FTPEntryType parseOneFTPLine(const char* line, ListState& state, ListResult& res
}
unsigned int pos = 0;
- while (pos < linelen && numtoks < (sizeof(tokens)/sizeof(tokens[0])) )
+ while (pos < linelen && numtoks < WTF_ARRAY_LENGTH(tokens))
{
while (pos < linelen &&
(line[pos] == ' ' || line[pos] == '\t' || line[pos] == '\r'))
@@ -156,7 +156,7 @@ FTPEntryType parseOneFTPLine(const char* line, ListState& state, ListResult& res
return ParsingFailed(state);
linelen_sans_wsp = &(tokens[numtoks-1][toklen[numtoks-1]]) - tokens[0];
- if (numtoks == (sizeof(tokens)/sizeof(tokens[0])) )
+ if (numtoks == WTF_ARRAY_LENGTH(tokens))
{
pos = linelen;
while (pos > 0 && (line[pos-1] == ' ' || line[pos-1] == '\t'))
diff --git a/WebCore/mathml/RenderMathMLOperator.cpp b/WebCore/mathml/RenderMathMLOperator.cpp
index 72c997b..7f039b9 100644
--- a/WebCore/mathml/RenderMathMLOperator.cpp
+++ b/WebCore/mathml/RenderMathMLOperator.cpp
@@ -162,7 +162,7 @@ void RenderMathMLOperator::updateFromElement()
// Check for a stretchable character.
if (!stretchDisabled && firstChar) {
- const int maxIndex = sizeof(stretchyCharacters) / sizeof(stretchyCharacters[0]);
+ const int maxIndex = WTF_ARRAY_LENGTH(stretchyCharacters);
for (index++; index < maxIndex; index++) {
if (stretchyCharacters[index].character == firstChar) {
isStretchy = true;
diff --git a/WebCore/page/animation/AnimationBase.cpp b/WebCore/page/animation/AnimationBase.cpp
index ad5257e..66172f7 100644
--- a/WebCore/page/animation/AnimationBase.cpp
+++ b/WebCore/page/animation/AnimationBase.cpp
@@ -744,7 +744,7 @@ static void addShorthandProperties()
CSSPropertyWebkitTransformOrigin
};
- for (unsigned i = 0; i < sizeof(animatableShorthandProperties) / sizeof(animatableShorthandProperties[0]); ++i) {
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(animatableShorthandProperties); ++i) {
int propertyID = animatableShorthandProperties[i];
CSSPropertyLonghand longhand = longhandForProperty(propertyID);
if (longhand.length() > 0)
@@ -757,7 +757,7 @@ static void addShorthandProperties()
CSSPropertyFontWeight
};
- CSSPropertyLonghand fontLonghand(animatableFontProperties, sizeof(animatableFontProperties) / sizeof(animatableFontProperties[0]));
+ CSSPropertyLonghand fontLonghand(animatableFontProperties, WTF_ARRAY_LENGTH(animatableFontProperties));
addPropertyWrapper(CSSPropertyFont, new ShorthandPropertyWrapper(CSSPropertyFont, fontLonghand));
}
diff --git a/WebCore/rendering/RenderTextControl.cpp b/WebCore/rendering/RenderTextControl.cpp
index 9b9e51a..2040f10 100644
--- a/WebCore/rendering/RenderTextControl.cpp
+++ b/WebCore/rendering/RenderTextControl.cpp
@@ -490,11 +490,11 @@ static const char* fontFamiliesWithInvalidCharWidth[] = {
bool RenderTextControl::hasValidAvgCharWidth(AtomicString family)
{
static HashSet<AtomicString>* fontFamiliesWithInvalidCharWidthMap = 0;
-
+
if (!fontFamiliesWithInvalidCharWidthMap) {
fontFamiliesWithInvalidCharWidthMap = new HashSet<AtomicString>;
-
- for (unsigned i = 0; i < sizeof(fontFamiliesWithInvalidCharWidth) / sizeof(fontFamiliesWithInvalidCharWidth[0]); i++)
+
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(fontFamiliesWithInvalidCharWidth); ++i)
fontFamiliesWithInvalidCharWidthMap->add(AtomicString(fontFamiliesWithInvalidCharWidth[i]));
}
diff --git a/WebCore/rendering/break_lines.cpp b/WebCore/rendering/break_lines.cpp
index c6c1ddd..6ac3b6b 100644
--- a/WebCore/rendering/break_lines.cpp
+++ b/WebCore/rendering/break_lines.cpp
@@ -28,6 +28,7 @@
#include "CharacterNames.h"
#include "TextBreakIterator.h"
+#include <wtf/StdLibExtras.h>
#if PLATFORM(MAC)
#include <CoreServices/CoreServices.h>
@@ -114,8 +115,7 @@ static const unsigned char asciiLineBreakTable[][(asciiLineBreakTableLastChar -
#undef DI
#undef AL
-COMPILE_ASSERT(sizeof(asciiLineBreakTable) / sizeof(asciiLineBreakTable[0]) == asciiLineBreakTableLastChar - asciiLineBreakTableFirstChar + 1,
- TestLineBreakTableConsistency);
+COMPILE_ASSERT(WTF_ARRAY_LENGTH(asciiLineBreakTable) == asciiLineBreakTableLastChar - asciiLineBreakTableFirstChar + 1, TestLineBreakTableConsistency);
static inline bool shouldBreakAfter(UChar ch, UChar nextCh)
{
diff --git a/WebCore/svg/SVGTransformable.cpp b/WebCore/svg/SVGTransformable.cpp
index 006bb94..e637e7c 100644
--- a/WebCore/svg/SVGTransformable.cpp
+++ b/WebCore/svg/SVGTransformable.cpp
@@ -143,25 +143,25 @@ static inline bool parseAndSkipType(const UChar*& currTransform, const UChar* en
{
if (currTransform >= end)
return false;
-
+
if (*currTransform == 's') {
- if (skipString(currTransform, end, skewXDesc, sizeof(skewXDesc) / sizeof(UChar)))
+ if (skipString(currTransform, end, skewXDesc, WTF_ARRAY_LENGTH(skewXDesc)))
type = SVGTransform::SVG_TRANSFORM_SKEWX;
- else if (skipString(currTransform, end, skewYDesc, sizeof(skewYDesc) / sizeof(UChar)))
+ else if (skipString(currTransform, end, skewYDesc, WTF_ARRAY_LENGTH(skewYDesc)))
type = SVGTransform::SVG_TRANSFORM_SKEWY;
- else if (skipString(currTransform, end, scaleDesc, sizeof(scaleDesc) / sizeof(UChar)))
+ else if (skipString(currTransform, end, scaleDesc, WTF_ARRAY_LENGTH(scaleDesc)))
type = SVGTransform::SVG_TRANSFORM_SCALE;
else
return false;
- } else if (skipString(currTransform, end, translateDesc, sizeof(translateDesc) / sizeof(UChar)))
+ } else if (skipString(currTransform, end, translateDesc, WTF_ARRAY_LENGTH(translateDesc)))
type = SVGTransform::SVG_TRANSFORM_TRANSLATE;
- else if (skipString(currTransform, end, rotateDesc, sizeof(rotateDesc) / sizeof(UChar)))
+ else if (skipString(currTransform, end, rotateDesc, WTF_ARRAY_LENGTH(rotateDesc)))
type = SVGTransform::SVG_TRANSFORM_ROTATE;
- else if (skipString(currTransform, end, matrixDesc, sizeof(matrixDesc) / sizeof(UChar)))
+ else if (skipString(currTransform, end, matrixDesc, WTF_ARRAY_LENGTH(matrixDesc)))
type = SVGTransform::SVG_TRANSFORM_MATRIX;
- else
+ else
return false;
-
+
return true;
}
diff --git a/WebCore/svg/SVGViewSpec.cpp b/WebCore/svg/SVGViewSpec.cpp
index d6bade3..a0a683b 100644
--- a/WebCore/svg/SVGViewSpec.cpp
+++ b/WebCore/svg/SVGViewSpec.cpp
@@ -81,7 +81,7 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec)
if (currViewSpec >= end)
return false;
- if (!skipString(currViewSpec, end, svgViewSpec, sizeof(svgViewSpec) / sizeof(UChar)))
+ if (!skipString(currViewSpec, end, svgViewSpec, WTF_ARRAY_LENGTH(svgViewSpec)))
return false;
if (currViewSpec >= end || *currViewSpec != '(' )
@@ -90,7 +90,7 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec)
while (currViewSpec < end && *currViewSpec != ')') {
if (*currViewSpec == 'v') {
- if (skipString(currViewSpec, end, viewBoxSpec, sizeof(viewBoxSpec) / sizeof(UChar))) {
+ if (skipString(currViewSpec, end, viewBoxSpec, WTF_ARRAY_LENGTH(viewBoxSpec))) {
if (currViewSpec >= end || *currViewSpec != '(')
return false;
currViewSpec++;
@@ -101,7 +101,7 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec)
if (currViewSpec >= end || *currViewSpec != ')')
return false;
currViewSpec++;
- } else if (skipString(currViewSpec, end, viewTargetSpec, sizeof(viewTargetSpec) / sizeof(UChar))) {
+ } else if (skipString(currViewSpec, end, viewTargetSpec, WTF_ARRAY_LENGTH(viewTargetSpec))) {
if (currViewSpec >= end || *currViewSpec != '(')
return false;
const UChar* viewTargetStart = ++currViewSpec;
@@ -114,7 +114,7 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec)
} else
return false;
} else if (*currViewSpec == 'z') {
- if (!skipString(currViewSpec, end, zoomAndPanSpec, sizeof(zoomAndPanSpec) / sizeof(UChar)))
+ if (!skipString(currViewSpec, end, zoomAndPanSpec, WTF_ARRAY_LENGTH(zoomAndPanSpec)))
return false;
if (currViewSpec >= end || *currViewSpec != '(')
return false;
@@ -125,7 +125,7 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec)
return false;
currViewSpec++;
} else if (*currViewSpec == 'p') {
- if (!skipString(currViewSpec, end, preserveAspectRatioSpec, sizeof(preserveAspectRatioSpec) / sizeof(UChar)))
+ if (!skipString(currViewSpec, end, preserveAspectRatioSpec, WTF_ARRAY_LENGTH(preserveAspectRatioSpec)))
return false;
if (currViewSpec >= end || *currViewSpec != '(')
return false;
@@ -138,7 +138,7 @@ bool SVGViewSpec::parseViewSpec(const String& viewSpec)
return false;
currViewSpec++;
} else if (*currViewSpec == 't') {
- if (!skipString(currViewSpec, end, transformSpec, sizeof(transformSpec) / sizeof(UChar)))
+ if (!skipString(currViewSpec, end, transformSpec, WTF_ARRAY_LENGTH(transformSpec)))
return false;
if (currViewSpec >= end || *currViewSpec != '(')
return false;
diff --git a/WebCore/svg/SVGZoomAndPan.cpp b/WebCore/svg/SVGZoomAndPan.cpp
index 93ab3ad..36d4a60 100644
--- a/WebCore/svg/SVGZoomAndPan.cpp
+++ b/WebCore/svg/SVGZoomAndPan.cpp
@@ -56,9 +56,9 @@ static const UChar magnify[] = {'m', 'a', 'g', 'n', 'i', 'f', 'y'};
bool SVGZoomAndPan::parseZoomAndPan(const UChar*& start, const UChar* end)
{
- if (skipString(start, end, disable, sizeof(disable) / sizeof(UChar)))
+ if (skipString(start, end, disable, WTF_ARRAY_LENGTH(disable)))
setZoomAndPan(SVG_ZOOMANDPAN_DISABLE);
- else if (skipString(start, end, magnify, sizeof(magnify) / sizeof(UChar)))
+ else if (skipString(start, end, magnify, WTF_ARRAY_LENGTH(magnify)))
setZoomAndPan(SVG_ZOOMANDPAN_MAGNIFY);
else
return false;
diff --git a/WebCore/xml/XPathFunctions.cpp b/WebCore/xml/XPathFunctions.cpp
index 8b4e720..2091aca 100644
--- a/WebCore/xml/XPathFunctions.cpp
+++ b/WebCore/xml/XPathFunctions.cpp
@@ -708,10 +708,9 @@ static void createFunctionMap()
{ "translate", { &createFunTranslate, 3 } },
{ "true", { &createFunTrue, 0 } },
};
- const unsigned int numFunctions = sizeof(functions) / sizeof(functions[0]);
functionMap = new HashMap<String, FunctionRec>;
- for (unsigned i = 0; i < numFunctions; ++i)
+ for (size_t i = 0; i < WTF_ARRAY_LENGTH(functions); ++i)
functionMap->set(functions[i].name, functions[i].function);
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list