Changeset 122564 in webkit


Ignore:
Timestamp:
Jul 13, 2012 4:43:43 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[EFL] Add const to the parameter of getters in ewk_security_origin
https://bugs.webkit.org/show_bug.cgi?id=90954

Patch by Kihong Kwon <kihong.kwon@samsung.com> on 2012-07-13
Reviewed by Kentaro Hara.

Move initialization of strings for protocol and host to the ewk_security_origin_new method,
which allows to add const qualifier for ewk_security_origin_protocol_get and ewk_security_origin_host_get.
In addition, add null checks to the getters.

  • ewk/ewk_security_origin.cpp:

(ewk_security_origin_protocol_get):
(ewk_security_origin_host_get):
(ewk_security_origin_new):

  • ewk/ewk_security_origin.h:
Location:
trunk/Source/WebKit/efl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/efl/ChangeLog

    r122563 r122564  
     12012-07-13  Kihong Kwon  <kihong.kwon@samsung.com>
     2
     3        [EFL] Add const to the parameter of getters in ewk_security_origin
     4        https://bugs.webkit.org/show_bug.cgi?id=90954
     5
     6        Reviewed by Kentaro Hara.
     7
     8        Move initialization of strings for protocol and host to the ewk_security_origin_new method,
     9        which allows to add const qualifier for ewk_security_origin_protocol_get and ewk_security_origin_host_get.
     10        In addition, add null checks to the getters.
     11
     12        * ewk/ewk_security_origin.cpp:
     13        (ewk_security_origin_protocol_get):
     14        (ewk_security_origin_host_get):
     15        (ewk_security_origin_new):
     16        * ewk/ewk_security_origin.h:
     17
    1182012-07-13  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    219
  • trunk/Source/WebKit/efl/ewk/ewk_security_origin.cpp

    r119115 r122564  
    4040};
    4141
    42 const char* ewk_security_origin_protocol_get(Ewk_Security_Origin* origin)
     42const char* ewk_security_origin_protocol_get(const Ewk_Security_Origin* origin)
    4343{
    44     if (!origin->protocol)
    45         origin->protocol = eina_stringshare_add(origin->securityOrigin->protocol().utf8().data());
    46 
     44    EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0);
    4745    return origin->protocol;
    4846}
    4947
    50 const char* ewk_security_origin_host_get(Ewk_Security_Origin* origin)
     48const char* ewk_security_origin_host_get(const Ewk_Security_Origin* origin)
    5149{
    52     if (!origin->host)
    53         origin->host = eina_stringshare_add(origin->securityOrigin->host().utf8().data());
    54 
     50    EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0);
    5551    return origin->host;
    5652}
     
    143139
    144140    origin->securityOrigin = coreOrigin;
    145     origin->host = 0;
    146     origin->protocol = 0;
     141    origin->protocol = eina_stringshare_add(coreOrigin->protocol().utf8().data());
     142    origin->host = eina_stringshare_add(coreOrigin->host().utf8().data());
    147143
    148144    return origin;
  • trunk/Source/WebKit/efl/ewk/ewk_security_origin.h

    r119115 r122564  
    5050 * be modified. The string is guaranteed to be stringshared.
    5151 *
    52  * @return the protocol scheme
     52 * @return the protocol scheme or @c 0 if there is not a protocol scheme
    5353 */
    54 EAPI const char          *ewk_security_origin_protocol_get(Ewk_Security_Origin *o);
     54EAPI const char          *ewk_security_origin_protocol_get(const Ewk_Security_Origin *o);
    5555
    5656/**
     
    6262 * @param o security origin object
    6363 *
    64  * @return the host domain
     64 * @return the host domain or @c 0 if there is not a host scheme
    6565 */
    66 EAPI const char          *ewk_security_origin_host_get(Ewk_Security_Origin *o);
     66EAPI const char          *ewk_security_origin_host_get(const Ewk_Security_Origin *o);
    6767
    6868/**
Note: See TracChangeset for help on using the changeset viewer.