Title: [113690] trunk/Source/WebCore
Revision
113690
Author
[email protected]
Date
2012-04-09 23:24:57 -0700 (Mon, 09 Apr 2012)

Log Message

combine two arrays in XPathException into one
https://bugs.webkit.org/show_bug.cgi?id=83442

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

No new tests required.

* xml/XPathException.cpp:
(XPathExceptionNameDescription):
(WebCore):
(WebCore::XPathException::initializeDescription):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113689 => 113690)


--- trunk/Source/WebCore/ChangeLog	2012-04-10 06:18:57 UTC (rev 113689)
+++ trunk/Source/WebCore/ChangeLog	2012-04-10 06:24:57 UTC (rev 113690)
@@ -1,5 +1,19 @@
 2012-04-09  Lu Guanqun  <[email protected]>
 
+        combine two arrays in XPathException into one
+        https://bugs.webkit.org/show_bug.cgi?id=83442
+
+        Reviewed by Kentaro Hara.
+
+        No new tests required.
+
+        * xml/XPathException.cpp:
+        (XPathExceptionNameDescription):
+        (WebCore):
+        (WebCore::XPathException::initializeDescription):
+
+2012-04-09  Lu Guanqun  <[email protected]>
+
         combine exceptionNames and exceptionDescriptions in IDBDatabaseException.cpp into one array
         https://bugs.webkit.org/show_bug.cgi?id=83433
 

Modified: trunk/Source/WebCore/xml/XPathException.cpp (113689 => 113690)


--- trunk/Source/WebCore/xml/XPathException.cpp	2012-04-10 06:18:57 UTC (rev 113689)
+++ trunk/Source/WebCore/xml/XPathException.cpp	2012-04-10 06:24:57 UTC (rev 113690)
@@ -31,19 +31,14 @@
 
 namespace WebCore {
 
-// FIXME: This should be an array of structs to pair the names and descriptions.
-static const char* const exceptionNames[] = {
-    "INVALID_EXPRESSION_ERR",
-    "TYPE_ERR"
+static struct XPathExceptionNameDescription {
+    const char* const name;
+    const char* const description;
+} exceptions[] = {
+    { "INVALID_EXPRESSION_ERR", "The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator." },
+    { "TYPE_ERR", "The _expression_ could not be converted to return the specified type." }
 };
 
-static const char* const exceptionDescriptions[] = {
-    "The _expression_ had a syntax error or otherwise is not a legal _expression_ according to the rules of the specific XPathEvaluator.",
-    "The _expression_ could not be converted to return the specified type."
-};
-
-COMPILE_ASSERT(WTF_ARRAY_LENGTH(exceptionNames) == WTF_ARRAY_LENGTH(exceptionDescriptions), XPathExceptionTablesMustMatch);
-
 bool XPathException::initializeDescription(ExceptionCode ec, ExceptionCodeDescription* description)
 {
     if (ec < XPathExceptionOffset || ec > XPathExceptionMax)
@@ -53,11 +48,11 @@
     description->code = ec - XPathExceptionOffset;
     description->type = XPathExceptionType;
 
-    size_t tableSize = WTF_ARRAY_LENGTH(exceptionNames);
+    size_t tableSize = WTF_ARRAY_LENGTH(exceptions);
     size_t tableIndex = ec - INVALID_EXPRESSION_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