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

Unified Diff: webrtc/base/ipaddress.cc

Issue 1480743002: Strip IP addresses in NDEBUG (release) builds. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month 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: webrtc/base/ipaddress.cc
diff --git a/webrtc/base/ipaddress.cc b/webrtc/base/ipaddress.cc
index f0698e52f128408f82ac72958696e82edc16728e..3b74d60036565463886e94258e0a93570a6fae5e 100644
--- a/webrtc/base/ipaddress.cc
+++ b/webrtc/base/ipaddress.cc
@@ -41,8 +41,6 @@ static const in6_addr kTeredoPrefix = {{{0x20, 0x01, 0x00, 0x00}}};
static const in6_addr kV4CompatibilityPrefix = {{{0}}};
static const in6_addr k6BonePrefix = {{{0x3f, 0xfe, 0}}};
-bool IPAddress::strip_sensitive_ = false;
-
static bool IsPrivateV4(uint32_t ip);
static in_addr ExtractMappedAddress(const in6_addr& addr);
@@ -144,9 +142,10 @@ std::string IPAddress::ToString() const {
}
std::string IPAddress::ToSensitiveString() const {
- if (!strip_sensitive_)
- return ToString();
-
+#if !defined(NDEBUG)
+ // Return non-stripped in debug.
+ return ToString();
+#else
switch (family_) {
case AF_INET: {
std::string address = ToString();
@@ -164,6 +163,7 @@ std::string IPAddress::ToSensitiveString() const {
}
}
return std::string();
+#endif
}
IPAddress IPAddress::Normalized() const {
@@ -186,10 +186,6 @@ IPAddress IPAddress::AsIPv6Address() const {
return IPAddress(v6addr);
}
-void IPAddress::set_strip_sensitive(bool enable) {
- strip_sensitive_ = enable;
-}
-
bool InterfaceAddress::operator==(const InterfaceAddress &other) const {
return ipv6_flags_ == other.ipv6_flags() &&
static_cast<const IPAddress&>(*this) == other;

Powered by Google App Engine
This is Rietveld 408576698