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

Unified Diff: net/quic/core/quic_spdy_stream.cc

Issue 2558643002: Remove some uses of isdigit in net/, as it can be locale depedent. (Closed)
Patch Set: Response Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/ftp/ftp_network_transaction.cc ('k') | net/quic/core/quic_spdy_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_spdy_stream.cc
diff --git a/net/quic/core/quic_spdy_stream.cc b/net/quic/core/quic_spdy_stream.cc
index 61b6deb7b731b196303b34b914b8120c5e0e3c35..6c9335b76e87d82693766893cee84f3e312401ce 100644
--- a/net/quic/core/quic_spdy_stream.cc
+++ b/net/quic/core/quic_spdy_stream.cc
@@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
+#include "net/base/parse_number.h"
#include "net/quic/core/quic_bug_tracker.h"
#include "net/quic/core/quic_spdy_session.h"
#include "net/quic/core/quic_utils.h"
@@ -290,15 +291,19 @@ bool QuicSpdyStream::ParseHeaderStatusCode(const SpdyHeaderBlock& header,
if (status.size() != 3) {
return false;
}
- // First character must be an integer in range [1,5].
- if (status[0] < '1' || status[0] > '5') {
+
+ unsigned int result;
+ if (!ParseUint32(status, &result, nullptr)) {
return false;
}
- // The remaining two characters must be integers.
- if (!isdigit(status[1]) || !isdigit(status[2])) {
+
+ // Valid status codes are only in the range [100, 599].
+ if (result < 100 || result >= 600) {
return false;
}
- return StringToInt(status, status_code);
+
+ *status_code = static_cast<int>(result);
+ return true;
}
bool QuicSpdyStream::FinishedReadingTrailers() const {
« no previous file with comments | « net/ftp/ftp_network_transaction.cc ('k') | net/quic/core/quic_spdy_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698