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

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

Issue 8970023: FTP: work around server bugs resulting in negative file size being sent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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/ftp/ftp_directory_listing_parser_ls.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <iterator> 8 #include <iterator>
9 #include <map> 9 #include <map>
10 10
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 true, &result); 1404 true, &result);
1405 } else { 1405 } else {
1406 base::JsonDoubleQuote(EscapePath(raw_bytes), true, &result); 1406 base::JsonDoubleQuote(EscapePath(raw_bytes), true, &result);
1407 } 1407 }
1408 if (is_dir) { 1408 if (is_dir) {
1409 result.append(",1,"); 1409 result.append(",1,");
1410 } else { 1410 } else {
1411 result.append(",0,"); 1411 result.append(",0,");
1412 } 1412 }
1413 1413
1414 base::JsonDoubleQuote(FormatBytesUnlocalized(size), true, &result); 1414 // Negative size means unknown or not applicable (e.g. directory).
1415 string16 size_string;
1416 if (size >= 0)
1417 size_string = FormatBytesUnlocalized(size);
1418 base::JsonDoubleQuote(size_string, true, &result);
1415 1419
1416 result.append(","); 1420 result.append(",");
1417 1421
1418 string16 modified_str; 1422 string16 modified_str;
1419 // |modified| can be NULL in FTP listings. 1423 // |modified| can be NULL in FTP listings.
1420 if (!modified.is_null()) { 1424 if (!modified.is_null()) {
1421 modified_str = base::TimeFormatShortDateAndTime(modified); 1425 modified_str = base::TimeFormatShortDateAndTime(modified);
1422 } 1426 }
1423 base::JsonDoubleQuote(modified_str, true, &result); 1427 base::JsonDoubleQuote(modified_str, true, &result);
1424 1428
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 2458
2455 NetworkInterface::NetworkInterface(const std::string& name, 2459 NetworkInterface::NetworkInterface(const std::string& name,
2456 const IPAddressNumber& address) 2460 const IPAddressNumber& address)
2457 : name(name), address(address) { 2461 : name(name), address(address) {
2458 } 2462 }
2459 2463
2460 NetworkInterface::~NetworkInterface() { 2464 NetworkInterface::~NetworkInterface() {
2461 } 2465 }
2462 2466
2463 } // namespace net 2467 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/ftp/ftp_directory_listing_parser_ls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698