 Chromium Code Reviews
 Chromium Code Reviews Issue 6533009:
  Switch from wcsftime to GetDateFormat to avoid crash in setup....  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src/
    
  
    Issue 6533009:
  Switch from wcsftime to GetDateFormat to avoid crash in setup....  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src/| Index: chrome/installer/util/install_util.cc | 
| =================================================================== | 
| --- chrome/installer/util/install_util.cc (revision 74952) | 
| +++ chrome/installer/util/install_util.cc (working copy) | 
| @@ -263,3 +263,12 @@ | 
| *command_line = CommandLine::FromString(command); | 
| } | 
| } | 
| + | 
| +std::wstring InstallUtil::GetCurrentDate() { | 
| + wchar_t date_str[10] = {0}; | 
| 
grt (UTC plus 2)
2011/02/17 04:04:10
Why 10?
 
tommi (sloooow) - chröme
2011/02/17 19:40:09
nervousness around yyyyy
 | 
| + const wchar_t kDateFormat[] = L"yyyyMMdd"; | 
| 
grt (UTC plus 2)
2011/02/17 04:04:10
nit: static const?
 
tommi (sloooow) - chröme
2011/02/17 19:40:09
Done.
 | 
| + size_t ret = GetDateFormatW(LOCALE_USER_DEFAULT, 0, NULL, kDateFormat, | 
| 
grt (UTC plus 2)
2011/02/17 04:04:10
Use LOCALE_INVARIANT.  Otherwise, you could potent
 
grt (UTC plus 2)
2011/02/17 04:04:10
MSDN says GetDateFormat returns an int.  If you ch
 
tommi (sloooow) - chröme
2011/02/17 19:40:09
Done.
 | 
| + date_str, arraysize(date_str)); | 
| + DCHECK_EQ(arraysize(kDateFormat), ret); | 
| 
grt (UTC plus 2)
2011/02/17 04:04:10
MSDN says that 'yyyy' can yield a 5-digit year, wh
 
tommi (sloooow) - chröme
2011/02/17 19:40:09
Done.
 | 
| + return date_str; | 
| 
grt (UTC plus 2)
2011/02/17 04:04:10
I'm a huge fan of std::wstring(date_str, ret), whi
 
tommi (sloooow) - chröme
2011/02/17 19:40:09
Done.
 | 
| +} |