Commit 4c787a9d authored by Stephane Sezer's avatar Stephane Sezer Committed by Jordan DeLong

Make folly::Uri::port() return uint16_t instead of uint32_t.

Summary: We can safely assume that ports are always going to be 16bit (TCP or UDP), so no need to have a uint32_t here.

Test Plan: Ran tests in folly/tests.

Reviewed By: tudorb@fb.com

FB internal diff: D973291
parent ffd25cf7
...@@ -79,7 +79,7 @@ Uri::Uri(StringPiece str) : port_(0) { ...@@ -79,7 +79,7 @@ Uri::Uri(StringPiece str) : port_(0) {
StringPiece port(authorityMatch[4].first, authorityMatch[4].second); StringPiece port(authorityMatch[4].first, authorityMatch[4].second);
if (!port.empty()) { if (!port.empty()) {
port_ = to<uint32_t>(port); port_ = to<uint16_t>(port);
} }
username_ = submatch(authorityMatch, 1); username_ = submatch(authorityMatch, 1);
......
...@@ -48,7 +48,7 @@ class Uri { ...@@ -48,7 +48,7 @@ class Uri {
const fbstring& username() const { return username_; } const fbstring& username() const { return username_; }
const fbstring& password() const { return password_; } const fbstring& password() const { return password_; }
const fbstring& host() const { return host_; } const fbstring& host() const { return host_; }
uint32_t port() const { return port_; } uint16_t port() const { return port_; }
const fbstring& path() const { return path_; } const fbstring& path() const { return path_; }
const fbstring& query() const { return query_; } const fbstring& query() const { return query_; }
const fbstring& fragment() const { return fragment_; } const fbstring& fragment() const { return fragment_; }
...@@ -64,7 +64,7 @@ class Uri { ...@@ -64,7 +64,7 @@ class Uri {
fbstring username_; fbstring username_;
fbstring password_; fbstring password_;
fbstring host_; fbstring host_;
uint32_t port_; uint16_t port_;
fbstring path_; fbstring path_;
fbstring query_; fbstring query_;
fbstring fragment_; fbstring fragment_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment