Changeset 113686 in webkit


Ignore:
Timestamp:
Apr 9, 2012 10:51:40 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Lu Guanqun <guanqun.lu@intel.com> on 2012-04-09
Reviewed by Kentaro Hara.

No new tests required.

  • dom/EventException.cpp:

(EventExceptionNameDescription):
(WebCore):
(WebCore::EventException::initializeDescription):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r113685 r113686  
     12012-04-09  Lu Guanqun  <guanqun.lu@intel.com>
     2
     3        combine two arrays in EventException.cpp into one
     4        https://bugs.webkit.org/show_bug.cgi?id=83451
     5
     6        Reviewed by Kentaro Hara.
     7
     8        No new tests required.
     9
     10        * dom/EventException.cpp:
     11        (EventExceptionNameDescription):
     12        (WebCore):
     13        (WebCore::EventException::initializeDescription):
     14
    1152012-04-09  Lu Guanqun  <guanqun.lu@intel.com>
    216
  • trunk/Source/WebCore/dom/EventException.cpp

    r98686 r113686  
    3232namespace WebCore {
    3333
    34 // FIXME: This should be an array of structs to pair the names and descriptions.
    35 static const char* const eventExceptionNames[] = {
    36     "UNSPECIFIED_EVENT_TYPE_ERR",
    37     "DISPATCH_REQUEST_ERR"
     34static struct EventExceptionNameDescription {
     35    const char* const name;
     36    const char* const description;
     37} exceptions[] = {
     38    { "UNSPECIFIED_EVENT_TYPE_ERR", "The Event's type was not specified by initializing the event before the method was called." },
     39    { "DISPATCH_REQUEST_ERR", "The Event object is already being dispatched." }
    3840};
    39 
    40 static const char* const eventExceptionDescriptions[] = {
    41     "The Event's type was not specified by initializing the event before the method was called.",
    42     "The Event object is already being dispatched."
    43 };
    44 
    45 COMPILE_ASSERT(WTF_ARRAY_LENGTH(eventExceptionNames) == WTF_ARRAY_LENGTH(eventExceptionDescriptions), EventExceptionTablesMustMatch);
    4641
    4742bool EventException::initializeDescription(ExceptionCode ec, ExceptionCodeDescription* description)
     
    5449    description->type = EventExceptionType;
    5550
    56     size_t tableSize = WTF_ARRAY_LENGTH(eventExceptionNames);
     51    size_t tableSize = WTF_ARRAY_LENGTH(exceptions);
    5752    size_t tableIndex = ec - UNSPECIFIED_EVENT_TYPE_ERR;
    5853
    59     description->name = tableIndex < tableSize ? eventExceptionNames[tableIndex] : 0;
    60     description->description = tableIndex < tableSize ? eventExceptionDescriptions[tableIndex] : 0;
     54    description->name = tableIndex < tableSize ? exceptions[tableIndex].name : 0;
     55    description->description = tableIndex < tableSize ? exceptions[tableIndex].description : 0;
    6156
    6257    return true;
Note: See TracChangeset for help on using the changeset viewer.