Replace replace_substrs with Abseil

Bug: None
Change-Id: I155cc29db951ef1b812691c57aaafe037fbeb230
Reviewed-on: https://webrtc-review.googlesource.com/c/114241
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26699}
This commit is contained in:
Steve Anton
2019-02-14 15:13:09 -08:00
committed by Commit Bot
parent bf9e01ab4e
commit 1c9c9fc9b6
8 changed files with 30 additions and 63 deletions

View File

@ -13,6 +13,7 @@
#include <string>
#include <vector>
#include "absl/strings/str_replace.h"
#include "rtc_base/checks.h"
#include "rtc_base/fake_ssl_identity.h"
#include "rtc_base/helpers.h"
@ -20,7 +21,6 @@
#include "rtc_base/message_digest.h"
#include "rtc_base/ssl_fingerprint.h"
#include "rtc_base/ssl_identity.h"
#include "rtc_base/string_utils.h"
#include "test/gtest.h"
using rtc::SSLIdentity;
@ -173,10 +173,10 @@ IdentityAndInfo CreateFakeIdentityAndInfoFromDers(
info.identity.reset(new rtc::FakeSSLIdentity(info.pems));
// Strip header/footer and newline characters of PEM strings.
for (size_t i = 0; i < info.pems.size(); ++i) {
rtc::replace_substrs("-----BEGIN CERTIFICATE-----", 27, "", 0,
&info.pems[i]);
rtc::replace_substrs("-----END CERTIFICATE-----", 25, "", 0, &info.pems[i]);
rtc::replace_substrs("\n", 1, "", 0, &info.pems[i]);
absl::StrReplaceAll({{"-----BEGIN CERTIFICATE-----", ""},
{"-----END CERTIFICATE-----", ""},
{"\n", ""}},
&info.pems[i]);
}
// Fingerprints for the whole certificate chain, starting with leaf
// certificate.