diff options
| author | pepper <3782201+rohvani@users.noreply.github.com> | 2026-09-24 10:20:04 -0400 |
|---|---|---|
| committer | pepper <3782201+rohvani@users.noreply.github.com> | 2026-09-24 10:20:04 -0400 |
| commit | 4c681666468f25fa263be05ae73ebd27205ebaa4 (patch) | |
| tree | abfc38badacaed6cfef307fb243431942bab2c4c | |
| parent | d989bfe5d6f29c7c5b45bcb12cf833d176b560a7 (diff) | |
Use portable file ownership for transcript reads
Replace the Windows-only LLUniqueFile with std::unique_ptr and the
existing LLFile::close deleter. This fixes the macOS compile failure
while retaining automatic file closure on every exit.
Windows Release build, 41 history tests, and repository hooks passed.
macOS CI still needs to be rerun.
| -rw-r--r-- | indra/newview/lllogchat.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 9e23cd34be..a163a6a23e 100644 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -48,6 +48,7 @@ #include <boost/date_time/gregorian/gregorian.hpp> #include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/local_time_adjustor.hpp> +#include <memory> #include <mutex> #if !LL_WINDOWS @@ -488,7 +489,8 @@ void LLLogChat::loadChatHistoryExact(const std::string& path, std::list<LLSD>& m } // Binary mode keeps transcript contents independent of platform EOF handling. - LLUniqueFile input(LLFile::fopen(path, LLFILE_MODE("rb"))); + std::unique_ptr<LLFILE, int (*)(LLFILE*)> input( + LLFile::fopen(path, LLFILE_MODE("rb")), LLFile::close); if (!input) { LL_WARNS("ChatHistory") << "Unable to read file " << path << LL_ENDL; @@ -499,16 +501,16 @@ void LLLogChat::loadChatHistoryExact(const std::string& path, std::list<LLSD>& m // stitched reads parse from the beginning of each exact transcript path. char buffer[LOG_RECALL_SIZE]; bool skip_partial_line = true; - if (load_params["load_all_history"].asBoolean() || fseek(input, (LOG_RECALL_SIZE - 1) * -1, SEEK_END)) + if (load_params["load_all_history"].asBoolean() || fseek(input.get(), (LOG_RECALL_SIZE - 1) * -1, SEEK_END)) { skip_partial_line = false; - if (fseek(input, 0, SEEK_SET)) + if (fseek(input.get(), 0, SEEK_SET)) { return; } } - while (fgets(buffer, LOG_RECALL_SIZE, input)) + while (fgets(buffer, LOG_RECALL_SIZE, input.get())) { // Normalize either newline style before applying legacy multiline rules. size_t length = strlen(buffer); |
