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

Log Message

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

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

No new tests requied.

* xml/XMLHttpRequestException.cpp:
(XMLHttpRequestExceptionNameDescription):
(WebCore):
(WebCore::XMLHttpRequestException::initializeDescription):

Modified Paths

Diff

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


--- trunk/Source/WebCore/ChangeLog	2012-04-10 04:57:32 UTC (rev 113678)
+++ trunk/Source/WebCore/ChangeLog	2012-04-10 05:30:05 UTC (rev 113679)
@@ -1,3 +1,17 @@
+2012-04-09  Lu Guanqun  <[email protected]>
+
+        combine two arrays in XMLHttpRequestException.cpp into one
+        https://bugs.webkit.org/show_bug.cgi?id=83443
+
+        Reviewed by Kentaro Hara.
+
+        No new tests requied.
+
+        * xml/XMLHttpRequestException.cpp:
+        (XMLHttpRequestExceptionNameDescription):
+        (WebCore):
+        (WebCore::XMLHttpRequestException::initializeDescription):
+
 2012-04-09  No'am Rosenthal  <[email protected]>
 
         [WK2] Enable using a single ShareableBitmap for multiple updates

Modified: trunk/Source/WebCore/xml/XMLHttpRequestException.cpp (113678 => 113679)


--- trunk/Source/WebCore/xml/XMLHttpRequestException.cpp	2012-04-10 04:57:32 UTC (rev 113678)
+++ trunk/Source/WebCore/xml/XMLHttpRequestException.cpp	2012-04-10 05:30:05 UTC (rev 113679)
@@ -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[] = {
-    "NETWORK_ERR",
-    "ABORT_ERR"
+static struct XMLHttpRequestExceptionNameDescription {
+    const char* const name;
+    const char* const description;
+} exceptions[] = {
+    { "NETWORK_ERR", "A network error occurred in synchronous requests." },
+    { "ABORT_ERR", "The user aborted a request in synchronous requests." }
 };
 
-static const char* const exceptionDescriptions[] = {
-    "A network error occurred in synchronous requests.",
-    "The user aborted a request in synchronous requests."
-};
-
-COMPILE_ASSERT(WTF_ARRAY_LENGTH(exceptionNames) == WTF_ARRAY_LENGTH(exceptionDescriptions), XMLHttpRequestExceptionTablesMustMatch);
-
 bool XMLHttpRequestException::initializeDescription(ExceptionCode ec, ExceptionCodeDescription* description)
 {
     if (ec < XMLHttpRequestExceptionOffset || ec > XMLHttpRequestExceptionMax)
@@ -53,11 +48,11 @@
     description->code = ec - XMLHttpRequestExceptionOffset;
     description->type = XMLHttpRequestExceptionType;
 
-    size_t tableSize = WTF_ARRAY_LENGTH(exceptionNames);
+    size_t tableSize = WTF_ARRAY_LENGTH(exceptions);
     size_t tableIndex = ec - NETWORK_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