Fix build with ToT libc++
hardware/google/camera/common/profiler/profiler.cc:429:21: error: no matching constructor for initialization of 'std::ofstream' (aka 'basic_ofstream<char>')
429 | if (std::ofstream fout(filepath, std::ios::out); fout.is_open()) {
| ^ ~~~~~~~~~~~~~~~~~~~~~~~
Test: Build with ToT libc++
Change-Id: I31a94a467d552dfe252b571547ddebb543b7fa5b
diff --git a/common/profiler/profiler.cc b/common/profiler/profiler.cc
index c090ab2..40d7457 100644
--- a/common/profiler/profiler.cc
+++ b/common/profiler/profiler.cc
@@ -191,10 +191,10 @@
virtual void DumpResult(const std::string& filepath);
// Dump result in text format.
- void DumpTxt(std::string_view filepath);
+ void DumpTxt(const std::string& filepath);
// Dump result in proto binary format.
- void DumpPb(std::string_view filepath);
+ void DumpPb(const std::string& filepath);
// Dump result format extension: proto or text.
constexpr static char kStrPb[] = ".pb";
@@ -421,7 +421,7 @@
ALOGI("");
}
-void ProfilerImpl::DumpTxt(std::string_view filepath) {
+void ProfilerImpl::DumpTxt(const std::string& filepath) {
// The dump result data is organized as 3 sections:
// 1. detla time and fps of each frame.
// 2. start time of each frame.
@@ -473,7 +473,7 @@
}
}
-void ProfilerImpl::DumpPb(std::string_view filepath) {
+void ProfilerImpl::DumpPb(const std::string& filepath) {
if (std::ofstream fout(filepath, std::ios::out); fout.is_open()) {
profiler::ProfilingResult profiling_result;
profiling_result.set_usecase(use_case_);