Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: net/base/net_util.cc

Issue 419: Fix a crash caused by a NULL FILETIME when creating ftp... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/base/net_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 #include <unicode/ucnv.h> 6 #include <unicode/ucnv.h>
7 #include <unicode/uidna.h> 7 #include <unicode/uidna.h>
8 #include <unicode/ulocdata.h> 8 #include <unicode/ulocdata.h>
9 #include <unicode/uniset.h> 9 #include <unicode/uniset.h>
10 #include <unicode/uscript.h> 10 #include <unicode/uscript.h>
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 result.append(",1,"); 812 result.append(",1,");
813 } else { 813 } else {
814 result.append(",0,"); 814 result.append(",0,");
815 } 815 }
816 816
817 string_escape::JavascriptDoubleQuote( 817 string_escape::JavascriptDoubleQuote(
818 FormatBytes(size, GetByteDisplayUnits(size), true), true, &result); 818 FormatBytes(size, GetByteDisplayUnits(size), true), true, &result);
819 819
820 result.append(","); 820 result.append(",");
821 821
822 Time time(Time::FromFileTime(*modified)); 822 std::wstring modified_str;
823 string_escape::JavascriptDoubleQuote(base::TimeFormatShortDateAndTime(time), 823 // |modified| can be NULL in FTP listings.
824 true, &result); 824 if (modified) {
825 Time time(Time::FromFileTime(*modified));
826 modified_str = base::TimeFormatShortDateAndTime(time);
827 }
828 string_escape::JavascriptDoubleQuote(modified_str, true, &result);
brettw 2008/09/03 18:48:48 Can all the code be moved inside the if statement?
825 829
826 result.append(");</script>\n"); 830 result.append(");</script>\n");
827 831
828 return result; 832 return result;
829 } 833 }
830 #endif 834 #endif
831 835
832 std::wstring StripWWW(const std::wstring& text) { 836 std::wstring StripWWW(const std::wstring& text) {
833 const std::wstring www(L"www."); 837 const std::wstring www(L"www.");
834 return (text.compare(0, www.length(), www) == 0) ? 838 return (text.compare(0, www.length(), www) == 0) ?
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 if (kAllowedFtpPorts[i] == port) { 902 if (kAllowedFtpPorts[i] == port) {
899 return true; 903 return true;
900 } 904 }
901 } 905 }
902 // Port not explicitly allowed by FTP, so return the default restrictions. 906 // Port not explicitly allowed by FTP, so return the default restrictions.
903 return IsPortAllowedByDefault(port); 907 return IsPortAllowedByDefault(port);
904 } 908 }
905 909
906 } // namespace net 910 } // namespace net
907 911
OLDNEW
« no previous file with comments | « no previous file | net/base/net_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698