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

Unified Diff: net/ftp/ftp_directory_listing_parsers.cc

Issue 343022: Also parse file size in new FTP LIST parsing code. (Closed)
Patch Set: Created 11 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: net/ftp/ftp_directory_listing_parsers.cc
diff --git a/net/ftp/ftp_directory_listing_parsers.cc b/net/ftp/ftp_directory_listing_parsers.cc
index c1a7f76028d7a383e10b34e4f536d793608ae12a..60cef806bf043789046fb3d730e49161ea257bde 100644
--- a/net/ftp/ftp_directory_listing_parsers.cc
+++ b/net/ftp/ftp_directory_listing_parsers.cc
@@ -128,8 +128,12 @@ bool FtpLsDirectoryListingParser::ConsumeLine(const string16& line) {
if (!IsStringNonNegativeNumber(columns[1]))
return false;
- if (!IsStringNonNegativeNumber(columns[4]))
+ if (!StringToInt64(columns[4], &entry.size))
return false;
+ if (entry.size < 0)
+ return false;
+ if (entry.type != FtpDirectoryListingEntry::FILE)
wtc 2009/10/28 19:12:08 Why don't we test entry.type earlier, like this?
wtc 2009/10/28 23:51:58 I see. Your code will return false if the format
+ entry.size = -1;
if (!UnixDateListingToTime(columns, &entry.last_modified))
return false;

Powered by Google App Engine
This is Rietveld 408576698