Changeset 192459 in webkit


Ignore:
Timestamp:
Nov 14, 2015 11:56:55 PM (8 years ago)
Author:
Gyuyoung Kim
Message:

[EFL][GTK] Remove use of String::format() in versionForUAString()
https://bugs.webkit.org/show_bug.cgi?id=151250

Reviewed by Darin Adler.

As String::format() will be deprecated due to the security problem, reimplement
versionForUAString() using a macro.

  • platform/efl/UserAgentEfl.cpp:

(WebCore::versionForUAString):

  • platform/gtk/UserAgentGtk.cpp:

(WebCore::platformVersionForUAString):
(WebCore::versionForUAString):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r192458 r192459  
     12015-11-14  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
     2
     3        [EFL][GTK] Remove use of String::format() in versionForUAString()
     4        https://bugs.webkit.org/show_bug.cgi?id=151250
     5
     6        Reviewed by Darin Adler.
     7
     8        As String::format() will be deprecated due to the security problem, reimplement
     9        versionForUAString() using a macro.
     10
     11        * platform/efl/UserAgentEfl.cpp:
     12        (WebCore::versionForUAString):
     13        * platform/gtk/UserAgentGtk.cpp:
     14        (WebCore::platformVersionForUAString):
     15        (WebCore::versionForUAString):
     16
    1172015-11-14  Antti Koivisto  <antti@apple.com>
    218
  • trunk/Source/WebCore/platform/efl/UserAgentEfl.cpp

    r192288 r192459  
    5656}
    5757
    58 static const String& versionForUAString()
     58static const char* versionForUAString()
    5959{
    60     static NeverDestroyed<String> version(String::format("%i.%i", WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION));
    61     return version;
     60#define MAKE_VERSION(major, minor) #major "." #minor
     61    return MAKE_VERSION(WEBKIT_MAJOR_VERSION, WEBKIT_MINOR_VERSION);
     62#undef MAKE_VERSION
    6263}
    6364
    6465String standardUserAgent(const String& applicationName, const String& applicationVersion)
    6566{
    66     const String& version = versionForUAString();
     67    const String& version = ASCIILiteral(versionForUAString());
    6768    static NeverDestroyed<String> standardUserAgentString = makeString("Mozilla/5.0 (", platformForUAString(), "; ", platformVersionForUAString(),
    6869        ") AppleWebKit/", version, " (KHTML, like Gecko) Version/8.0 Safari/601.2.7");
     
    7374    String finalApplicationVersion = applicationVersion;
    7475    if (finalApplicationVersion.isEmpty())
    75         finalApplicationVersion = versionForUAString();
     76        finalApplicationVersion = ASCIILiteral(versionForUAString());
    7677
    7778    return standardUserAgentString + ' ' + applicationName + '/' + finalApplicationVersion;
  • trunk/Source/WebCore/platform/gtk/UserAgentGtk.cpp

    r169892 r192459  
    112112}
    113113
    114 static const String versionForUAString()
     114static const char* versionForUAString()
    115115{
    116     static NeverDestroyed<const String> uaVersion(String::format("%i.%i", USER_AGENT_GTK_MAJOR_VERSION, USER_AGENT_GTK_MINOR_VERSION));
    117     return uaVersion;
     116#define MAKE_VERSION(major, minor) #major "." #minor
     117    return MAKE_VERSION(USER_AGENT_GTK_MAJOR_VERSION, USER_AGENT_GTK_MINOR_VERSION);
     118#undef MAKE_VERSION
    118119}
    119120
Note: See TracChangeset for help on using the changeset viewer.