Title: [113680] trunk/Source/WebCore
Revision
113680
Author
[email protected]
Date
2012-04-09 22:36:38 -0700 (Mon, 09 Apr 2012)

Log Message

combine two arrays in SVGException.cpp into one
https://bugs.webkit.org/show_bug.cgi?id=83444

Patch by Lu Guanqun <[email protected]> on 2012-04-09
Reviewed by Kentaro Hara.

No new tests required.

* svg/SVGException.cpp:
(SVGExceptionNameDescription):
(WebCore):
(WebCore::SVGException::initializeDescription):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113679 => 113680)


--- trunk/Source/WebCore/ChangeLog	2012-04-10 05:30:05 UTC (rev 113679)
+++ trunk/Source/WebCore/ChangeLog	2012-04-10 05:36:38 UTC (rev 113680)
@@ -1,5 +1,19 @@
 2012-04-09  Lu Guanqun  <[email protected]>
 
+        combine two arrays in SVGException.cpp into one
+        https://bugs.webkit.org/show_bug.cgi?id=83444
+
+        Reviewed by Kentaro Hara.
+
+        No new tests required.
+
+        * svg/SVGException.cpp:
+        (SVGExceptionNameDescription):
+        (WebCore):
+        (WebCore::SVGException::initializeDescription):
+
+2012-04-09  Lu Guanqun  <[email protected]>
+
         combine two arrays in XMLHttpRequestException.cpp into one
         https://bugs.webkit.org/show_bug.cgi?id=83443
 

Modified: trunk/Source/WebCore/svg/SVGException.cpp (113679 => 113680)


--- trunk/Source/WebCore/svg/SVGException.cpp	2012-04-10 05:30:05 UTC (rev 113679)
+++ trunk/Source/WebCore/svg/SVGException.cpp	2012-04-10 05:36:38 UTC (rev 113680)
@@ -34,21 +34,15 @@
 
 namespace WebCore {
 
-// FIXME: This should be an array of structs to pair the names and descriptions.
-static const char* const exceptionNames[] = {
-    "SVG_WRONG_TYPE_ERR",
-    "SVG_INVALID_VALUE_ERR",
-    "SVG_MATRIX_NOT_INVERTABLE"
+static struct SVGExceptionNameDescription {
+    const char* const name;
+    const char* const description;
+} exceptions[] = {
+    { "SVG_WRONG_TYPE_ERR", "An object of the wrong type was passed to an operation." },
+    { "SVG_INVALID_VALUE_ERR", "An invalid value was passed to an operation or assigned to an attribute." },
+    { "SVG_MATRIX_NOT_INVERTABLE", "An attempt was made to invert a matrix that is not invertible." }
 };
 
-static const char* const exceptionDescriptions[] = {
-    "An object of the wrong type was passed to an operation.",
-    "An invalid value was passed to an operation or assigned to an attribute.",
-    "An attempt was made to invert a matrix that is not invertible."
-};
-
-COMPILE_ASSERT(WTF_ARRAY_LENGTH(exceptionNames) == WTF_ARRAY_LENGTH(exceptionDescriptions), SVGExceptionTablesMustMatch);
-
 bool SVGException::initializeDescription(ExceptionCode ec, ExceptionCodeDescription* description)
 {
     if (ec < SVGExceptionOffset || ec > SVGExceptionMax)
@@ -58,11 +52,11 @@
     description->code = ec - SVGExceptionOffset;
     description->type = SVGExceptionType;
 
-    size_t tableSize = WTF_ARRAY_LENGTH(exceptionNames);
+    size_t tableSize = WTF_ARRAY_LENGTH(exceptions);
     size_t tableIndex = ec - SVG_WRONG_TYPE_ERR;
 
-    description->name = tableIndex < tableSize ? exceptionNames[tableIndex] : 0;
-    description->description = tableIndex < tableSize ? exceptionDescriptions[tableIndex] : 0;
+    description->name = tableIndex < tableSize ? exceptions[tableIndex].name : 0;
+    description->description = tableIndex < tableSize ? exceptions[tableIndex].description : 0;
 
     return true;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to