From 3a57b18896eacb6fea6680d0eccaaeddb0b700b0 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 7 Apr 2015 17:28:05 -0400 Subject: convert llifstream and llofstream to std::ifstream and std::ofstream respectively --- indra/newview/llurlhistory.cpp | 51 ++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'indra/newview/llurlhistory.cpp') diff --git a/indra/newview/llurlhistory.cpp b/indra/newview/llurlhistory.cpp index 8eea2b242a..f7064e152a 100755 --- a/indra/newview/llurlhistory.cpp +++ b/indra/newview/llurlhistory.cpp @@ -40,29 +40,32 @@ const int MAX_URL_COUNT = 10; // static bool LLURLHistory::loadFile(const std::string& filename) { + bool dataloaded = false; + sHistorySD = LLSD(); LLSD data; - { - std::string temp_str = gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter(); - - llifstream file((temp_str + filename)); - - if (file.is_open()) - { - LL_INFOS() << "Loading history.xml file at " << filename << LL_ENDL; - LLSDSerialize::fromXML(data, file); - } - - if (data.isUndefined()) - { - LL_INFOS() << "file missing, ill-formed, " - "or simply undefined; not changing the" - " file" << LL_ENDL; - sHistorySD = LLSD(); - return false; - } - } - sHistorySD = data; - return true; + + std::string user_filename(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + filename); + + llifstream file(user_filename.c_str()); + if (file.is_open()) + { + LLSDSerialize::fromXML(data, file); + if (data.isUndefined()) + { + LL_WARNS() << "error loading " << user_filename << LL_ENDL; + } + else + { + LL_INFOS() << "Loaded history file at " << user_filename << LL_ENDL; + sHistorySD = data; + dataloaded = true; + } + } + else + { + LL_INFOS() << "Unable to open history file at " << user_filename << LL_ENDL; + } + return dataloaded; } // static @@ -76,10 +79,10 @@ bool LLURLHistory::saveFile(const std::string& filename) } temp_str += gDirUtilp->getDirDelimiter() + filename; - llofstream out(temp_str); + llofstream out(temp_str.c_str()); if (!out.good()) { - LL_WARNS() << "Unable to open " << filename << " for output." << LL_ENDL; + LL_WARNS() << "Unable to open " << temp_str << " for output." << LL_ENDL; return false; } -- cgit v1.2.3 From 8b42c7898ef756a4a81daa08b2a5acce2894f4b8 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 7 Apr 2015 17:59:28 -0400 Subject: replace llifstream and llofstream with std::ifstream and std::ofstream respectively --- indra/newview/llurlhistory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llurlhistory.cpp') diff --git a/indra/newview/llurlhistory.cpp b/indra/newview/llurlhistory.cpp index f7064e152a..d45891ec45 100755 --- a/indra/newview/llurlhistory.cpp +++ b/indra/newview/llurlhistory.cpp @@ -46,7 +46,7 @@ bool LLURLHistory::loadFile(const std::string& filename) std::string user_filename(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + filename); - llifstream file(user_filename.c_str()); + std::ifstream file(user_filename.c_str()); if (file.is_open()) { LLSDSerialize::fromXML(data, file); @@ -79,7 +79,7 @@ bool LLURLHistory::saveFile(const std::string& filename) } temp_str += gDirUtilp->getDirDelimiter() + filename; - llofstream out(temp_str.c_str()); + std::ofstream out(temp_str.c_str()); if (!out.good()) { LL_WARNS() << "Unable to open " << temp_str << " for output." << LL_ENDL; -- cgit v1.2.3 From 5c6cf3e7fb9f592e3a293921175b64b515bac23f Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 10 Apr 2015 11:02:37 -0400 Subject: restore the ll[io]fstream because we need them as wrappers on Windows for wide char paths; on other platforms they are now just typedefs to the std classes --- indra/newview/llurlhistory.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llurlhistory.cpp') diff --git a/indra/newview/llurlhistory.cpp b/indra/newview/llurlhistory.cpp index d45891ec45..f7064e152a 100755 --- a/indra/newview/llurlhistory.cpp +++ b/indra/newview/llurlhistory.cpp @@ -46,7 +46,7 @@ bool LLURLHistory::loadFile(const std::string& filename) std::string user_filename(gDirUtilp->getLindenUserDir() + gDirUtilp->getDirDelimiter() + filename); - std::ifstream file(user_filename.c_str()); + llifstream file(user_filename.c_str()); if (file.is_open()) { LLSDSerialize::fromXML(data, file); @@ -79,7 +79,7 @@ bool LLURLHistory::saveFile(const std::string& filename) } temp_str += gDirUtilp->getDirDelimiter() + filename; - std::ofstream out(temp_str.c_str()); + llofstream out(temp_str.c_str()); if (!out.good()) { LL_WARNS() << "Unable to open " << temp_str << " for output." << LL_ENDL; -- cgit v1.2.3