Adopt absl::string_view in rtc_base/ (straightforward cases)

Bug: webrtc:13579
Change-Id: I240db6285abb22652242bc0b2ebe9844ec4a45f0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258723
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Ali Tofigh <alito@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36561}
diff --git a/modules/audio_processing/aec_dump/aec_dump_impl.cc b/modules/audio_processing/aec_dump/aec_dump_impl.cc
index 160583e..1b87465 100644
--- a/modules/audio_processing/aec_dump/aec_dump_impl.cc
+++ b/modules/audio_processing/aec_dump/aec_dump_impl.cc
@@ -255,8 +255,8 @@
 std::unique_ptr<AecDump> AecDumpFactory::Create(std::string file_name,
                                                 int64_t max_log_size_bytes,
                                                 rtc::TaskQueue* worker_queue) {
-  return Create(FileWrapper::OpenWriteOnly(file_name.c_str()),
-                max_log_size_bytes, worker_queue);
+  return Create(FileWrapper::OpenWriteOnly(file_name), max_log_size_bytes,
+                worker_queue);
 }
 
 std::unique_ptr<AecDump> AecDumpFactory::Create(FILE* handle,
diff --git a/modules/audio_processing/audio_processing_unittest.cc b/modules/audio_processing/audio_processing_unittest.cc
index b21a022..e26548a 100644
--- a/modules/audio_processing/audio_processing_unittest.cc
+++ b/modules/audio_processing/audio_processing_unittest.cc
@@ -1600,7 +1600,7 @@
 
   const std::string filename =
       test::TempFilename(test::OutputPath(), "debug_aec");
-  FileWrapper f = FileWrapper::OpenWriteOnly(filename.c_str());
+  FileWrapper f = FileWrapper::OpenWriteOnly(filename);
   ASSERT_TRUE(f.is_open());
 
 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
diff --git a/modules/audio_processing/test/wav_based_simulator.cc b/modules/audio_processing/test/wav_based_simulator.cc
index 52a05a3..d8f6b59 100644
--- a/modules/audio_processing/test/wav_based_simulator.cc
+++ b/modules/audio_processing/test/wav_based_simulator.cc
@@ -25,7 +25,7 @@
 std::vector<WavBasedSimulator::SimulationEventType>
 WavBasedSimulator::GetCustomEventChain(const std::string& filename) {
   std::vector<WavBasedSimulator::SimulationEventType> call_chain;
-  FileWrapper file_wrapper = FileWrapper::OpenReadOnly(filename.c_str());
+  FileWrapper file_wrapper = FileWrapper::OpenReadOnly(filename);
 
   RTC_CHECK(file_wrapper.is_open())
       << "Could not open the custom call order file, reverting "
diff --git a/modules/audio_processing/transient/file_utils_unittest.cc b/modules/audio_processing/transient/file_utils_unittest.cc
index 1bcf6f9..c32df6c 100644
--- a/modules/audio_processing/transient/file_utils_unittest.cc
+++ b/modules/audio_processing/transient/file_utils_unittest.cc
@@ -159,7 +159,7 @@
 TEST_F(TransientFileUtilsTest, MAYBE_ReadInt16BufferFromFile) {
   std::string test_filename = kTestFileName;
 
-  FileWrapper file = FileWrapper::OpenReadOnly(test_filename.c_str());
+  FileWrapper file = FileWrapper::OpenReadOnly(test_filename);
   ASSERT_TRUE(file.is_open()) << "File could not be opened:\n"
                               << kTestFileName.c_str();
 
@@ -197,7 +197,7 @@
 TEST_F(TransientFileUtilsTest, MAYBE_ReadInt16FromFileToFloatBuffer) {
   std::string test_filename = kTestFileName;
 
-  FileWrapper file = FileWrapper::OpenReadOnly(test_filename.c_str());
+  FileWrapper file = FileWrapper::OpenReadOnly(test_filename);
   ASSERT_TRUE(file.is_open()) << "File could not be opened:\n"
                               << kTestFileName.c_str();
 
@@ -237,7 +237,7 @@
 TEST_F(TransientFileUtilsTest, MAYBE_ReadInt16FromFileToDoubleBuffer) {
   std::string test_filename = kTestFileName;
 
-  FileWrapper file = FileWrapper::OpenReadOnly(test_filename.c_str());
+  FileWrapper file = FileWrapper::OpenReadOnly(test_filename);
   ASSERT_TRUE(file.is_open()) << "File could not be opened:\n"
                               << kTestFileName.c_str();
 
@@ -275,7 +275,7 @@
 TEST_F(TransientFileUtilsTest, MAYBE_ReadFloatBufferFromFile) {
   std::string test_filename = kTestFileNamef;
 
-  FileWrapper file = FileWrapper::OpenReadOnly(test_filename.c_str());
+  FileWrapper file = FileWrapper::OpenReadOnly(test_filename);
   ASSERT_TRUE(file.is_open()) << "File could not be opened:\n"
                               << kTestFileNamef.c_str();
 
@@ -311,7 +311,7 @@
 TEST_F(TransientFileUtilsTest, MAYBE_ReadDoubleBufferFromFile) {
   std::string test_filename = kTestFileName;
 
-  FileWrapper file = FileWrapper::OpenReadOnly(test_filename.c_str());
+  FileWrapper file = FileWrapper::OpenReadOnly(test_filename);
   ASSERT_TRUE(file.is_open()) << "File could not be opened:\n"
                               << kTestFileName.c_str();
 
@@ -348,7 +348,7 @@
   std::string kOutFileName =
       CreateTempFilename(test::OutputPath(), "utils_test");
 
-  FileWrapper file = FileWrapper::OpenWriteOnly(kOutFileName.c_str());
+  FileWrapper file = FileWrapper::OpenWriteOnly(kOutFileName);
   ASSERT_TRUE(file.is_open()) << "File could not be opened:\n"
                               << kOutFileName.c_str();
 
@@ -365,7 +365,7 @@
 
   file.Close();
 
-  file = FileWrapper::OpenReadOnly(kOutFileName.c_str());
+  file = FileWrapper::OpenReadOnly(kOutFileName);
   ASSERT_TRUE(file.is_open()) << "File could not be opened:\n"
                               << kOutFileName.c_str();
 
@@ -384,7 +384,7 @@
   std::string kOutFileName =
       CreateTempFilename(test::OutputPath(), "utils_test");
 
-  FileWrapper file = FileWrapper::OpenWriteOnly(kOutFileName.c_str());
+  FileWrapper file = FileWrapper::OpenWriteOnly(kOutFileName);
   ASSERT_TRUE(file.is_open()) << "File could not be opened:\n"
                               << kOutFileName.c_str();
 
@@ -401,7 +401,7 @@
 
   file.Close();
 
-  file = FileWrapper::OpenReadOnly(kOutFileName.c_str());
+  file = FileWrapper::OpenReadOnly(kOutFileName);
   ASSERT_TRUE(file.is_open()) << "File could not be opened:\n"
                               << kOutFileName.c_str();
 
@@ -420,7 +420,7 @@
   std::string kOutFileName =
       CreateTempFilename(test::OutputPath(), "utils_test");
 
-  FileWrapper file = FileWrapper::OpenWriteOnly(kOutFileName.c_str());
+  FileWrapper file = FileWrapper::OpenWriteOnly(kOutFileName);
   ASSERT_TRUE(file.is_open()) << "File could not be opened:\n"
                               << kOutFileName.c_str();
 
@@ -437,7 +437,7 @@
 
   file.Close();
 
-  file = FileWrapper::OpenReadOnly(kOutFileName.c_str());
+  file = FileWrapper::OpenReadOnly(kOutFileName);
   ASSERT_TRUE(file.is_open()) << "File could not be opened:\n"
                               << kOutFileName.c_str();
 
@@ -472,7 +472,7 @@
   EXPECT_EQ(0u, WriteInt16BufferToFile(&file, 1, int16_buffer.get()));
   EXPECT_EQ(0u, WriteDoubleBufferToFile(&file, 1, double_buffer.get()));
 
-  file = FileWrapper::OpenReadOnly(test_filename.c_str());
+  file = FileWrapper::OpenReadOnly(test_filename);
   ASSERT_TRUE(file.is_open()) << "File could not be opened:\n"
                               << kTestFileName.c_str();
 
diff --git a/modules/audio_processing/transient/transient_detector_unittest.cc b/modules/audio_processing/transient/transient_detector_unittest.cc
index 0425133..a736462 100644
--- a/modules/audio_processing/transient/transient_detector_unittest.cc
+++ b/modules/audio_processing/transient/transient_detector_unittest.cc
@@ -48,7 +48,7 @@
                      << (sample_rate_hz / 1000) << "kHz";
 
     FileWrapper detect_file = FileWrapper::OpenReadOnly(
-        test::ResourcePath(detect_file_name.str(), "dat").c_str());
+        test::ResourcePath(detect_file_name.str(), "dat"));
 
     bool file_opened = detect_file.is_open();
     ASSERT_TRUE(file_opened) << "File could not be opened.\n"
@@ -60,7 +60,7 @@
                     << (sample_rate_hz / 1000) << "kHz";
 
     FileWrapper audio_file = FileWrapper::OpenReadOnly(
-        test::ResourcePath(audio_file_name.str(), "pcm").c_str());
+        test::ResourcePath(audio_file_name.str(), "pcm"));
 
     // Create detector.
     TransientDetector detector(sample_rate_hz);
diff --git a/modules/audio_processing/transient/wpd_tree_unittest.cc b/modules/audio_processing/transient/wpd_tree_unittest.cc
index 97d69ae..bf3ff98 100644
--- a/modules/audio_processing/transient/wpd_tree_unittest.cc
+++ b/modules/audio_processing/transient/wpd_tree_unittest.cc
@@ -88,7 +88,7 @@
     rtc::StringBuilder matlab_stream;
     matlab_stream << "audio_processing/transient/wpd" << i;
     std::string matlab_string = test::ResourcePath(matlab_stream.str(), "dat");
-    matlab_files_data[i] = FileWrapper::OpenReadOnly(matlab_string.c_str());
+    matlab_files_data[i] = FileWrapper::OpenReadOnly(matlab_string);
 
     bool file_opened = matlab_files_data[i].is_open();
     ASSERT_TRUE(file_opened) << "File could not be opened.\n" << matlab_string;
@@ -98,7 +98,7 @@
     out_stream << test::OutputPath() << "wpd_" << i << ".out";
     std::string out_string = out_stream.str();
 
-    out_files_data[i] = FileWrapper::OpenWriteOnly(out_string.c_str());
+    out_files_data[i] = FileWrapper::OpenWriteOnly(out_string);
 
     file_opened = out_files_data[i].is_open();
     ASSERT_TRUE(file_opened) << "File could not be opened.\n" << out_string;
@@ -108,7 +108,7 @@
   std::string test_file_name = test::ResourcePath(
       "audio_processing/transient/ajm-macbook-1-spke16m", "pcm");
 
-  FileWrapper test_file = FileWrapper::OpenReadOnly(test_file_name.c_str());
+  FileWrapper test_file = FileWrapper::OpenReadOnly(test_file_name);
 
   bool file_opened = test_file.is_open();
   ASSERT_TRUE(file_opened) << "File could not be opened.\n" << test_file_name;