D8983: Properly parse dates in cookies when running in non-English locale

David Faure noreply at phabricator.kde.org
Sun Nov 26 17:46:50 UTC 2017


dfaure added a comment.


  Thanks for the fix, looks good, just two minor improvement suggestions.

INLINE COMMENTS

> kcookiejar.cpp:78
>          const QString weekday = value.left(index);
> +        QLocale l = QLocale::c();
>          for (int i = 1; i < 8; ++i) {

"i" and "l" local variables are hard to read, please rename to locale or cLocale

> kcookiejar.cpp:119
> +            // Only English month names are allowed, thus use the C locale.
> +            dt = QLocale::c().toDateTime(value, QL1S(date_formats[i]));
>              if (dt.isValid()) {

You could (and probably should) do like the above loop and move QLocale::c() to a local variable defined before the `for` loop.
QLocale::c() creates a QLocale instance every time, so better do that only once.

REPOSITORY
  R241 KIO

REVISION DETAIL
  https://phabricator.kde.org/D8983

To: schwab, dfaure, #frameworks
Cc: anthonyfieroni, #frameworks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20171126/928f5df1/attachment.html>


More information about the Kde-frameworks-devel mailing list