Changeset 220444 in webkit


Ignore:
Timestamp:
Aug 9, 2017 12:00:34 AM (7 years ago)
Author:
zandobersek@gmail.com
Message:

[Soup] Incorrect conversion in msToSoupDate()
https://bugs.webkit.org/show_bug.cgi?id=175320

Reviewed by Carlos Garcia Campos.

Original patch by VaL Doroshchuk.

  • platform/network/soup/NetworkStorageSessionSoup.cpp:

(WebCore::msToSoupDate): monthFromDayInYear() returns a value in the [0,11] range,
while soup_date_new() expects a month value in the [1,12] range. The return value
must be thus incremented by one to match that expectation.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r220443 r220444  
     12017-08-09  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [Soup] Incorrect conversion in msToSoupDate()
     4        https://bugs.webkit.org/show_bug.cgi?id=175320
     5
     6        Reviewed by Carlos Garcia Campos.
     7
     8        Original patch by VaL Doroshchuk.
     9
     10        * platform/network/soup/NetworkStorageSessionSoup.cpp:
     11        (WebCore::msToSoupDate): monthFromDayInYear() returns a value in the [0,11] range,
     12        while soup_date_new() expects a month value in the [1,12] range. The return value
     13        must be thus incremented by one to match that expectation.
     14
    1152017-08-08  Wenson Hsieh  <wenson_hsieh@apple.com>
    216
  • trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp

    r219290 r220444  
    295295    int dayOfYear = dayInYear(ms, year);
    296296    bool leapYear = isLeapYear(year);
    297     return soup_date_new(year, monthFromDayInYear(dayOfYear, leapYear), dayInMonthFromDayInYear(dayOfYear, leapYear), msToHours(ms), msToMinutes(ms), static_cast<int>(ms / 1000) % 60);
     297
     298    // monthFromDayInYear() returns a value in the [0,11] range, while soup_date_new() expects
     299    // a value in the [1,12] range, meaning we have to manually adjust the month value.
     300    return soup_date_new(year, monthFromDayInYear(dayOfYear, leapYear) + 1, dayInMonthFromDayInYear(dayOfYear, leapYear), msToHours(ms), msToMinutes(ms), static_cast<int>(ms / 1000) % 60);
    298301}
    299302
Note: See TracChangeset for help on using the changeset viewer.