+2012-04-09 Lu Guanqun <guanqun.lu@intel.com>
+
+ 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 <noam.rosenthal@nokia.com>
[WK2] Enable using a single ShareableBitmap for multiple updates
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)
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;
}