aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAli Tofigh <alito@webrtc.org>2022-06-30 11:58:26 +0200
committerWebRTC LUCI CQ <webrtc-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-06-30 13:19:18 +0000
commitde2ac5a6f368bb0fea6136505fda878e5be84211 (patch)
tree5597adbf213fa7e06196988389ae944f99b9b8eb /examples
parent4b97928b3068dce9b171013393a6c9b2383c7a9c (diff)
downloadwebrtc-de2ac5a6f368bb0fea6136505fda878e5be84211.tar.gz
Adopt absl::string_view in p2p/
Bug: webrtc:13579 Change-Id: Ia33afa2a9ad12d1a586087d49f581a93fddb565d Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/262766 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Ali Tofigh <alito@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37381}
Diffstat (limited to 'examples')
-rw-r--r--examples/BUILD.gn1
-rw-r--r--examples/turnserver/turnserver_main.cc7
2 files changed, 5 insertions, 3 deletions
diff --git a/examples/BUILD.gn b/examples/BUILD.gn
index 26a51b2b16..17cfc7b35a 100644
--- a/examples/BUILD.gn
+++ b/examples/BUILD.gn
@@ -800,6 +800,7 @@ if (is_linux || is_chromeos || is_win) {
"../rtc_base:socket_address",
"../rtc_base:socket_server",
"../rtc_base:threading",
+ "//third_party/abseil-cpp/absl/strings:strings",
]
}
rtc_executable("stunserver") {
diff --git a/examples/turnserver/turnserver_main.cc b/examples/turnserver/turnserver_main.cc
index 055d9baaee..8db6162306 100644
--- a/examples/turnserver/turnserver_main.cc
+++ b/examples/turnserver/turnserver_main.cc
@@ -14,6 +14,7 @@
#include <string>
#include <utility>
+#include "absl/strings/string_view.h"
#include "examples/turnserver/read_auth_file.h"
#include "p2p/base/basic_packet_socket_factory.h"
#include "p2p/base/port_interface.h"
@@ -32,12 +33,12 @@ class TurnFileAuth : public cricket::TurnAuthInterface {
explicit TurnFileAuth(std::map<std::string, std::string> name_to_key)
: name_to_key_(std::move(name_to_key)) {}
- virtual bool GetKey(const std::string& username,
- const std::string& realm,
+ virtual bool GetKey(absl::string_view username,
+ absl::string_view realm,
std::string* key) {
// File is stored as lines of <username>=<HA1>.
// Generate HA1 via "echo -n "<username>:<realm>:<password>" | md5sum"
- auto it = name_to_key_.find(username);
+ auto it = name_to_key_.find(std::string(username));
if (it == name_to_key_.end())
return false;
*key = it->second;