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

Unified Diff: net/ftp/ftp_ctrl_response_buffer.cc

Issue 1875203002: Refactor FtpCtrlResponseBuffer::ParseLine to use net::ParseInt32() rather than base::StringToInt(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ftp/ftp_ctrl_response_buffer.cc
diff --git a/net/ftp/ftp_ctrl_response_buffer.cc b/net/ftp/ftp_ctrl_response_buffer.cc
index 8dd631b6c45bb871c11c01116c371ade2c75a8d5..c2d848367569ef312984a2f85ef81b28a4daf344 100644
--- a/net/ftp/ftp_ctrl_response_buffer.cc
+++ b/net/ftp/ftp_ctrl_response_buffer.cc
@@ -8,7 +8,7 @@
#include "base/bind.h"
#include "base/logging.h"
-#include "base/strings/string_number_conversions.h"
+#include "net/base/parse_number.h"
#include "base/strings/string_piece.h"
#include "base/values.h"
#include "net/base/net_errors.h"
@@ -123,10 +123,11 @@ FtpCtrlResponseBuffer::ParsedLine FtpCtrlResponseBuffer::ParseLine(
ParsedLine result;
if (line.length() >= 3) {
- if (base::StringToInt(base::StringPiece(line.begin(), line.begin() + 3),
- &result.status_code))
- result.has_status_code = (100 <= result.status_code &&
- result.status_code <= 599);
+ if (ParseInt32(base::StringPiece(line.begin(), line.begin() + 3),
+ ParseIntFormat::NON_NEGATIVE, &result.status_code)) {
+ result.has_status_code =
+ (100 <= result.status_code && result.status_code <= 599);
+ }
if (result.has_status_code && line.length() >= 4 && line[3] == ' ') {
result.is_complete = true;
} else if (result.has_status_code && line.length() >= 4 && line[3] == '-') {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698