Return const char* from ToString(RTCErrorType error).

Returning absl::string_view causes problems to the Chromium/WebRTC
component build because absl::operator<< needs to be exported.

This CL switches to `const char*` which should be enough to avoid
to generate temporaries.

Bug: webrtc:9419
Change-Id: If169a6f95c7efd21ac8ce108c7f2f80a76ff2313
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153842
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29250}
This commit is contained in:
Mirko Bonadei
2019-09-20 09:33:02 +02:00
committed by Commit Bot
parent e0b31677b6
commit fb59a6aa3f
3 changed files with 4 additions and 7 deletions

View File

@ -10,12 +10,11 @@
#include "api/rtc_error.h"
#include "absl/strings/string_view.h"
#include "rtc_base/arraysize.h"
namespace {
const absl::string_view kRTCErrorTypeNames[] = {
const char* kRTCErrorTypeNames[] = {
"NONE",
"UNSUPPORTED_OPERATION",
"UNSUPPORTED_PARAMETER",
@ -53,7 +52,7 @@ void RTCError::set_message(std::string message) {
message_ = std::move(message);
}
absl::string_view ToString(RTCErrorType error) {
const char* ToString(RTCErrorType error) {
int index = static_cast<int>(error);
return kRTCErrorTypeNames[index];
}