OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "net/base/net_util.h" | 5 #include "net/base/net_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <unicode/regex.h> | 9 #include <unicode/regex.h> |
10 #include <unicode/ucnv.h> | 10 #include <unicode/ucnv.h> |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1048 } else { | 1048 } else { |
1049 base::JsonDoubleQuote(EscapePath(raw_bytes), true, &result); | 1049 base::JsonDoubleQuote(EscapePath(raw_bytes), true, &result); |
1050 } | 1050 } |
1051 if (is_dir) { | 1051 if (is_dir) { |
1052 result.append(",1,"); | 1052 result.append(",1,"); |
1053 } else { | 1053 } else { |
1054 result.append(",0,"); | 1054 result.append(",0,"); |
1055 } | 1055 } |
1056 | 1056 |
1057 base::JsonDoubleQuote( | 1057 base::JsonDoubleQuote( |
1058 WideToUTF16Hack(FormatBytes(size, GetByteDisplayUnits(size), true)), true, | 1058 FormatBytes(size, GetByteDisplayUnits(size), true), |
| 1059 true, |
1059 &result); | 1060 &result); |
1060 | 1061 |
1061 result.append(","); | 1062 result.append(","); |
1062 | 1063 |
1063 string16 modified_str; | 1064 string16 modified_str; |
1064 // |modified| can be NULL in FTP listings. | 1065 // |modified| can be NULL in FTP listings. |
1065 if (!modified.is_null()) { | 1066 if (!modified.is_null()) { |
1066 modified_str = WideToUTF16Hack(base::TimeFormatShortDateAndTime(modified)); | 1067 modified_str = WideToUTF16Hack(base::TimeFormatShortDateAndTime(modified)); |
1067 } | 1068 } |
1068 base::JsonDoubleQuote(modified_str, true, &result); | 1069 base::JsonDoubleQuote(modified_str, true, &result); |
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 } | 1961 } |
1961 | 1962 |
1962 int GetPortFromAddrinfo(const struct addrinfo* info) { | 1963 int GetPortFromAddrinfo(const struct addrinfo* info) { |
1963 uint16* port_field = GetPortFieldFromAddrinfo(info); | 1964 uint16* port_field = GetPortFieldFromAddrinfo(info); |
1964 if (!port_field) | 1965 if (!port_field) |
1965 return -1; | 1966 return -1; |
1966 return ntohs(*port_field); | 1967 return ntohs(*port_field); |
1967 } | 1968 } |
1968 | 1969 |
1969 } // namespace net | 1970 } // namespace net |
OLD | NEW |