From 3a57b18896eacb6fea6680d0eccaaeddb0b700b0 Mon Sep 17 00:00:00 2001
From: Oz Linden <oz@lindenlab.com>
Date: Tue, 7 Apr 2015 17:28:05 -0400
Subject: [PATCH] convert llifstream and llofstream to std::ifstream and
 std::ofstream respectively

---
 indra/llappearance/llwearable.cpp             |  4 +-
 indra/llcommon/llerror.cpp                    |  4 +-
 indra/llcommon/llfile.cpp                     | 85 +++++-----------
 indra/llcommon/llfile.h                       | 99 ++-----------------
 indra/llcommon/llliveappconfig.cpp            |  2 +-
 indra/llcommon/llstring.cpp                   |  2 +-
 indra/llcrashlogger/llcrashlock.cpp           |  4 +-
 indra/llimage/llimage.cpp                     |  4 +-
 indra/llimage/llimagefilter.cpp               |  2 +-
 indra/llmessage/llhttpclient.cpp              |  2 +-
 indra/llmessage/llmessageconfig.cpp           |  2 +-
 indra/llmessage/llservicebuilder.cpp          |  2 +-
 indra/llui/llspellcheck.cpp                   | 19 ++--
 indra/llui/llviewereventrecorder.cpp          |  2 +-
 indra/llvfs/llpidlock.cpp                     |  6 +-
 indra/llxml/llcontrol.cpp                     |  4 +-
 indra/llxml/tests/llcontrol_test.cpp          |  2 +-
 indra/newview/llagentpilot.cpp                |  8 +-
 indra/newview/llappviewer.cpp                 | 12 +--
 indra/newview/llavatariconctrl.cpp            |  4 +-
 indra/newview/llcommandlineparser.cpp         |  2 +-
 indra/newview/llfavoritesbar.cpp              | 14 +--
 indra/newview/llfeaturemanager.cpp            |  2 +-
 indra/newview/llfloaterabout.cpp              |  4 +-
 indra/newview/llfloatermodelpreview.cpp       |  4 +-
 indra/newview/llfloaterspellchecksettings.cpp |  5 +-
 indra/newview/lllocationhistory.cpp           |  4 +-
 indra/newview/lllogchat.cpp                   |  2 +-
 indra/newview/llpanellogin.cpp                |  4 +-
 indra/newview/llpanelmaininventory.cpp        | 18 ++--
 indra/newview/llsearchhistory.cpp             |  4 +-
 indra/newview/llsechandler_basic.cpp          |  6 +-
 indra/newview/llsyntaxid.cpp                  |  4 +-
 indra/newview/llteleporthistorystorage.cpp    |  4 +-
 indra/newview/llurlhistory.cpp                | 51 +++++-----
 indra/newview/llurlwhitelist.cpp              |  4 +-
 indra/newview/llviewermedia.cpp               |  4 +-
 indra/newview/llviewerobject.cpp              |  2 +-
 indra/newview/llviewertexturelist.cpp         |  4 +-
 indra/newview/llvoiceclient.cpp               | 11 ++-
 indra/newview/llwaterparammanager.cpp         |  2 +-
 indra/newview/llwldaycycle.cpp                |  4 +-
 indra/newview/llwlparammanager.cpp            |  2 +-
 indra/test/llmessageconfig_tut.cpp            |  2 +-
 indra/test/message_tut.cpp                    |  5 +-
 .../updater/llupdatedownloader.cpp            | 12 +--
 .../updater/llupdaterservice.cpp              |  8 +-
 47 files changed, 175 insertions(+), 282 deletions(-)

diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp
index 41c06f43683..5ca9f55ac8c 100755
--- a/indra/llappearance/llwearable.cpp
+++ b/indra/llappearance/llwearable.cpp
@@ -88,7 +88,7 @@ LLAssetType::EType LLWearable::getAssetType() const
 
 BOOL LLWearable::exportFile(const std::string& filename) const
 {
-	llofstream ofs(filename, std::ios_base::out | std::ios_base::trunc | std::ios_base::binary);
+	llofstream ofs(filename.c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary);
 	return ofs.is_open() && exportStream(ofs);
 }
 
@@ -204,7 +204,7 @@ void LLWearable::createLayers(S32 te, LLAvatarAppearance *avatarp)
 LLWearable::EImportResult LLWearable::importFile(const std::string& filename,
 												 LLAvatarAppearance* avatarp )
 {
-	llifstream ifs(filename, std::ios_base::in | std::ios_base::binary);
+	llifstream ifs(filename.c_str(), std::ios_base::in | std::ios_base::binary);
 	return (! ifs.is_open())? FAILURE : importStream(ifs, avatarp);
 }
 
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index 8119b14887e..21009893164 100755
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -113,7 +113,7 @@ namespace {
 	public:
 		RecordToFile(const std::string& filename)
 		{
-			mFile.open(filename, llofstream::out | llofstream::app);
+			mFile.open(filename.c_str(), std::ios_base::out | std::ios_base::app);
 			if (!mFile)
 			{
 				LL_INFOS() << "Error setting log file to " << filename << LL_ENDL;
@@ -335,7 +335,7 @@ namespace
 		LLSD configuration;
 
 		{
-			llifstream file(filename());
+			llifstream file(filename().c_str());
 			if (file.is_open())
 			{
 				LLSDSerialize::fromXML(configuration, file);
diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp
index 304d702979c..77a96573067 100755
--- a/indra/llcommon/llfile.cpp
+++ b/indra/llcommon/llfile.cpp
@@ -865,6 +865,7 @@ int llstdio_filebuf::sync()
 }
 #endif
 
+#if 0   // @TBDeleted
 /************** input file stream ********************************/
 
 
@@ -919,32 +920,6 @@ llifstream::llifstream(const char* _Filename,
 #endif
 
 
-#if llstream_LLFILE
-// explicit
-llifstream::llifstream(_Filet *_File,
-		ios_base::openmode _Mode, size_t _Size) :
-	_M_filebuf(_File, _Mode, _Size),
-#if LL_WINDOWS
-	std::istream(&_M_filebuf) {}
-#else
-	std::istream()
-{
-	this->init(&_M_filebuf);
-}
-#endif
-
-#if !LL_WINDOWS
-// explicit
-llifstream::llifstream(int __fd,
-		ios_base::openmode _Mode, size_t _Size) :
-	_M_filebuf(__fd, _Mode, _Size),
-	std::istream()
-{
-	this->init(&_M_filebuf);
-}
-#endif
-#endif // llstream_LLFILE
-
 bool llifstream::is_open() const
 {	// test if C stream has been opened
 	return _M_filebuf.is_open();
@@ -993,9 +968,9 @@ void llifstream::close()
 
 llofstream::llofstream() : _M_filebuf(),
 #if LL_WINDOWS
-	std::ostream(&_M_filebuf) {}
+	std::ofstream(&_M_filebuf) {}
 #else
-	std::ostream()
+	std::ofstream()
 {
 	this->init(&_M_filebuf);
 }
@@ -1005,7 +980,7 @@ llofstream::llofstream() : _M_filebuf(),
 llofstream::llofstream(const std::string& _Filename,
 		ios_base::openmode _Mode) : _M_filebuf(),
 #if LL_WINDOWS
-	std::ostream(&_M_filebuf)
+	std::ofstream(&_M_filebuf)
 {
 	llutf16string wideName = utf8str_to_utf16str( _Filename );
 	if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0)
@@ -1014,7 +989,7 @@ llofstream::llofstream(const std::string& _Filename,
 	}
 }
 #else
-	std::ostream()
+	std::ofstream()
 {
 	this->init(&_M_filebuf);
 	this->open(_Filename.c_str(), _Mode | ios_base::out);
@@ -1025,7 +1000,7 @@ llofstream::llofstream(const std::string& _Filename,
 llofstream::llofstream(const char* _Filename,
 		ios_base::openmode _Mode) : _M_filebuf(),
 #if LL_WINDOWS
-	std::ostream(&_M_filebuf)
+	std::ofstream(&_M_filebuf)
 {
 	llutf16string wideName = utf8str_to_utf16str( _Filename );
 	if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0)
@@ -1034,39 +1009,13 @@ llofstream::llofstream(const char* _Filename,
 	}
 }
 #else
-	std::ostream()
+	std::ofstream()
 {
 	this->init(&_M_filebuf);
 	this->open(_Filename, _Mode | ios_base::out);
 }
 #endif
 
-#if llstream_LLFILE
-// explicit
-llofstream::llofstream(_Filet *_File,
-			ios_base::openmode _Mode, size_t _Size) :
-	_M_filebuf(_File, _Mode, _Size),
-#if LL_WINDOWS
-	std::ostream(&_M_filebuf) {}
-#else
-	std::ostream()
-{
-	this->init(&_M_filebuf);
-}
-#endif
-
-#if !LL_WINDOWS
-// explicit
-llofstream::llofstream(int __fd,
-			ios_base::openmode _Mode, size_t _Size) :
-	_M_filebuf(__fd, _Mode, _Size),
-	std::ostream()
-{
-	this->init(&_M_filebuf);
-}
-#endif
-#endif // llstream_LLFILE
-
 bool llofstream::is_open() const
 {	// test if C stream has been opened
 	return _M_filebuf.is_open();
@@ -1108,6 +1057,25 @@ void llofstream::close()
 	}
 }
 
+void llofstream::~llofstream()
+{
+    try:
+    {
+        if ( is_open() )
+        {
+            flush();
+        }
+    }
+    catch (std::exception& e)
+    {
+        LL_WARNS() << "llofstream std::exception: " << e.what() << LL_ENDL;
+    }
+    catch (...)
+    {
+        LL_WARNS() << "llofstream non-std exception" << LL_ENDL;
+    }
+}
+
 /************** helper functions ********************************/
 
 std::streamsize llifstream_size(llifstream& ifstr)
@@ -1135,3 +1103,4 @@ std::streamsize llofstream_size(llofstream& ofstr)
 }
 
 
+#endif  // @TBDeleted
diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h
index 44a1e42fa5a..bd750b8c3c8 100755
--- a/indra/llcommon/llfile.h
+++ b/indra/llcommon/llfile.h
@@ -86,12 +86,6 @@ class LL_COMMON_API LLFile
 	static  const char * tmpdir();
 };
 
-// Remove ll[io]fstream support for [LL]FILE*, preparing to remove dependency
-// on GNU's standard library.
-#if ! defined(llstream_LLFILE)
-#define llstream_LLFILE 0
-#endif
-
 /**
  *  @brief Provides a layer of compatibility for C/POSIX.
  *
@@ -198,7 +192,9 @@ class LL_COMMON_API llstdio_filebuf : public _Myfb
 #endif
 };
 
-
+typedef std::ifstream llifstream;
+typedef std::ofstream llofstream;
+#if 0                           /* @TBDeleted  */
 /**
  *  @brief  Controlling input for files.
  *
@@ -234,34 +230,6 @@ class LL_COMMON_API llifstream	:	public	std::istream
 	explicit llifstream(const char* _Filename,
 			ios_base::openmode _Mode = ios_base::in);
 
-#if llstream_LLFILE
-	/**
-	 *  @brief  Create a stream using an open c file stream.
-	 *  @param  File  An open @c FILE*.
-        @param  Mode  Same meaning as in a standard filebuf.
-        @param  Size  Optimal or preferred size of internal buffer, in chars.
-                      Defaults to system's @c BUFSIZ.
-	*/
-	explicit llifstream(_Filet *_File,
-			ios_base::openmode _Mode = ios_base::in,
-			//size_t _Size = static_cast<size_t>(BUFSIZ));
-			size_t _Size = static_cast<size_t>(1));
-	
-	/**
-	 *  @brief  Create a stream using an open file descriptor.
-	 *  @param  fd    An open file descriptor.
-        @param  Mode  Same meaning as in a standard filebuf.
-        @param  Size  Optimal or preferred size of internal buffer, in chars.
-                      Defaults to system's @c BUFSIZ.
-	*/
-#if !LL_WINDOWS
-	explicit llifstream(int __fd,
-			ios_base::openmode _Mode = ios_base::in,
-			//size_t _Size = static_cast<size_t>(BUFSIZ));
-			size_t _Size = static_cast<size_t>(1));
-#endif
-#endif // llstream_LLFILE
-
 	/**
 	 *  @brief  The destructor does nothing.
 	 *
@@ -271,17 +239,6 @@ class LL_COMMON_API llifstream	:	public	std::istream
 	virtual ~llifstream() {}
 
 	// Members:
-#if llstream_LLFILE
-	/**
-	 *  @brief  Accessing the underlying buffer.
-	 *  @return  The current basic_filebuf buffer.
-	 *
-	 *  This hides both signatures of std::basic_ios::rdbuf().
-	*/
-	llstdio_filebuf* rdbuf() const
-	{ return const_cast<llstdio_filebuf*>(&_M_filebuf); }
-#endif // llstream_LLFILE
-
 	/**
 	 *  @brief  Wrapper to test for an open file.
 	 *  @return  @c rdbuf()->is_open()
@@ -324,7 +281,7 @@ class LL_COMMON_API llifstream	:	public	std::istream
  *  which allows construction using a pre-exisintg file stream buffer. 
  *  We refer to this std::basic_filebuf (or derivative) as @c sb.
 */
-class LL_COMMON_API llofstream	:	public	std::ostream
+class LL_COMMON_API llofstream	:	public	std::ofstream
 {
 public:
 	// Constructors:
@@ -350,60 +307,15 @@ class LL_COMMON_API llofstream	:	public	std::ostream
 	explicit llofstream(const char* _Filename,
 			ios_base::openmode _Mode = ios_base::out|ios_base::trunc);
 
-#if llstream_LLFILE
-	/**
-	 *  @brief  Create a stream using an open c file stream.
-	 *  @param  File  An open @c FILE*.
-        @param  Mode  Same meaning as in a standard filebuf.
-        @param  Size  Optimal or preferred size of internal buffer, in chars.
-                      Defaults to system's @c BUFSIZ.
-	*/
-	explicit llofstream(_Filet *_File,
-			ios_base::openmode _Mode = ios_base::out,
-			//size_t _Size = static_cast<size_t>(BUFSIZ));
-			size_t _Size = static_cast<size_t>(1));
-
-	/**
-	 *  @brief  Create a stream using an open file descriptor.
-	 *  @param  fd    An open file descriptor.
-        @param  Mode  Same meaning as in a standard filebuf.
-        @param  Size  Optimal or preferred size of internal buffer, in chars.
-                      Defaults to system's @c BUFSIZ.
-	*/
-#if !LL_WINDOWS
-	explicit llofstream(int __fd,
-			ios_base::openmode _Mode = ios_base::out,
-			//size_t _Size = static_cast<size_t>(BUFSIZ));
-			size_t _Size = static_cast<size_t>(1));
-#endif
-#endif // llstream_LLFILE
-
 	/**
 	 *  @brief  The destructor does nothing.
 	 *
 	 *  The file is closed by the filebuf object, not the formatting
 	 *  stream.
 	*/
-	virtual ~llofstream() {}
+	virtual ~llofstream();
 
 	// Members:
-#if llstream_LLFILE
-	/**
-	 *  @brief  Accessing the underlying buffer.
-	 *  @return  The current basic_filebuf buffer.
-	 *
-	 *  This hides both signatures of std::basic_ios::rdbuf().
-	*/
-	llstdio_filebuf* rdbuf() const
-	{ return const_cast<llstdio_filebuf*>(&_M_filebuf); }
-#endif // llstream_LLFILE
-
-	/**
-	 *  @brief  Wrapper to test for an open file.
-	 *  @return  @c rdbuf()->is_open()
-	*/
-	bool is_open() const;
-
 	/**
 	 *  @brief  Opens an external file.
 	 *  @param  Filename  The name of the file.
@@ -440,5 +352,6 @@ class LL_COMMON_API llofstream	:	public	std::ostream
  */
 std::streamsize LL_COMMON_API llifstream_size(llifstream& fstr);
 std::streamsize LL_COMMON_API llofstream_size(llofstream& fstr);
+#endif  /* @TBDeleted */
 
 #endif // not LL_LLFILE_H
diff --git a/indra/llcommon/llliveappconfig.cpp b/indra/llcommon/llliveappconfig.cpp
index 7c87c5a1a03..a9b1cdf4f64 100755
--- a/indra/llcommon/llliveappconfig.cpp
+++ b/indra/llcommon/llliveappconfig.cpp
@@ -49,7 +49,7 @@ bool LLLiveAppConfig::loadFile()
 {
 	LL_INFOS() << "LLLiveAppConfig::loadFile(): reading from "
 		<< filename() << LL_ENDL;
-    llifstream file(filename());
+    llifstream file(filename().c_str());
 	LLSD config;
     if (file.is_open())
     {
diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp
index 617969ab2a2..f3b8999883a 100755
--- a/indra/llcommon/llstring.cpp
+++ b/indra/llcommon/llstring.cpp
@@ -107,7 +107,7 @@ bool iswindividual(llwchar elem)
 
 bool _read_file_into_string(std::string& str, const std::string& filename)
 {
-	llifstream ifs(filename, llifstream::binary);
+	llifstream ifs(filename.c_str(), llifstream::binary);
 	if (!ifs.is_open())
 	{
 		LL_INFOS() << "Unable to open file " << filename << LL_ENDL;
diff --git a/indra/llcrashlogger/llcrashlock.cpp b/indra/llcrashlogger/llcrashlock.cpp
index 7fd78607074..7dde1fcd69f 100644
--- a/indra/llcrashlogger/llcrashlock.cpp
+++ b/indra/llcrashlogger/llcrashlock.cpp
@@ -106,7 +106,7 @@ LLSD LLCrashLock::getLockFile(std::string filename)
 {
 	LLSD lock_sd = LLSD::emptyMap();
     
-	llifstream ifile(filename);
+	llifstream ifile(filename.c_str());
     
 	if (ifile.is_open())
 	{									            
@@ -120,7 +120,7 @@ LLSD LLCrashLock::getLockFile(std::string filename)
 bool LLCrashLock::putLockFile(std::string filename, const LLSD& data)
 {    
     bool result = true;
-    llofstream ofile(filename);
+    llofstream ofile(filename.c_str());
     
 	if (!LLSDSerialize::toXML(data,ofile))
 	{
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index ecdcd95d290..16df27bb8e1 100755
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -1172,7 +1172,7 @@ static std::string find_file(std::string &name, S8 *codec)
 	for (int i=0; i<(int)(NUM_FILE_EXTENSIONS); i++)
 	{
 		tname = name + "." + std::string(file_extensions[i].exten);
-		llifstream ifs(tname, llifstream::binary);
+		llifstream ifs(tname.c_str(), llifstream::binary);
 		if (ifs.is_open())
 		{
 			ifs.close();
@@ -1219,7 +1219,7 @@ bool LLImageRaw::createFromFile(const std::string &filename, bool j2c_lowest_mip
 		return false; // format not recognized
 	}
 
-	llifstream ifs(name, llifstream::binary);
+	llifstream ifs(name.c_str(), llifstream::binary);
 	if (!ifs.is_open())
 	{
 		// SJB: changed from LL_INFOS() to LL_DEBUGS() to reduce spam
diff --git a/indra/llimage/llimagefilter.cpp b/indra/llimage/llimagefilter.cpp
index 0b9d1369107..41adc7be9a1 100755
--- a/indra/llimage/llimagefilter.cpp
+++ b/indra/llimage/llimagefilter.cpp
@@ -54,7 +54,7 @@ LLImageFilter::LLImageFilter(const std::string& file_path) :
     mStencilMax(1.0)
 {
     // Load filter description from file
-	llifstream filter_xml(file_path);
+	llifstream filter_xml(file_path.c_str());
 	if (filter_xml.is_open())
 	{
 		// Load and parse the file
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 200116337d9..f8db3dded2b 100755
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -157,7 +157,7 @@ namespace
 		{
 			LLBufferStream ostream(channels, buffer.get());
 
-			llifstream fstream(mFilename, std::iostream::binary | std::iostream::out);
+			llifstream fstream(mFilename.c_str(), std::iostream::binary | std::iostream::out);
 			if(fstream.is_open())
 			{
 				fstream.seekg(0, std::ios::end);
diff --git a/indra/llmessage/llmessageconfig.cpp b/indra/llmessage/llmessageconfig.cpp
index f8b2c8f5a64..64e79d67675 100755
--- a/indra/llmessage/llmessageconfig.cpp
+++ b/indra/llmessage/llmessageconfig.cpp
@@ -96,7 +96,7 @@ bool LLMessageConfigFile::loadFile()
 {
 	LLSD data;
     {
-        llifstream file(filename());
+        llifstream file(filename().c_str());
         
         if (file.is_open())
         {
diff --git a/indra/llmessage/llservicebuilder.cpp b/indra/llmessage/llservicebuilder.cpp
index 392e7f1091e..cf2e42f95cd 100755
--- a/indra/llmessage/llservicebuilder.cpp
+++ b/indra/llmessage/llservicebuilder.cpp
@@ -34,7 +34,7 @@
 void LLServiceBuilder::loadServiceDefinitionsFromFile(
 	const std::string& service_filename)
 {
-	llifstream service_file(service_filename, std::ios::binary);
+	llifstream service_file(service_filename.c_str(), std::ios::binary);
 	if(service_file.is_open())
 	{
 		LLSD service_data;
diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp
index 250372da5ba..0db42810590 100755
--- a/indra/llui/llspellcheck.cpp
+++ b/indra/llui/llspellcheck.cpp
@@ -144,12 +144,14 @@ void LLSpellChecker::refreshDictionaryMap()
 	const std::string user_path = getDictionaryUserPath();
 
 	// Load dictionary information (file name, friendly name, ...)
-	llifstream user_file(user_path + DICT_FILE_MAIN, std::ios::binary);
+    std::string user_filename(user_path + DICT_FILE_MAIN);
+	llifstream user_file(user_filename.c_str(), std::ios::binary);
 	if ( (!user_file.is_open()) 
 		|| (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(sDictMap, user_file)) 
 		|| (0 == sDictMap.size()) )
 	{
-		llifstream app_file(app_path + DICT_FILE_MAIN, std::ios::binary);
+        std::string app_filename(app_path + DICT_FILE_MAIN);
+		llifstream app_file(app_filename.c_str(), std::ios::binary);
 		if ( (!app_file.is_open()) 
 			|| (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(sDictMap, app_file)) 
 			|| (0 == sDictMap.size()) )
@@ -159,7 +161,7 @@ void LLSpellChecker::refreshDictionaryMap()
 	}
 
 	// Load user installed dictionary information
-	llifstream custom_file(user_path + DICT_FILE_USER, std::ios::binary);
+	llifstream custom_file(user_filename.c_str(), std::ios::binary);
 	if (custom_file.is_open())
 	{
 		LLSD custom_dict_map;
@@ -215,7 +217,7 @@ void LLSpellChecker::addToDictFile(const std::string& dict_path, const std::stri
 
 	if (gDirUtilp->fileExists(dict_path))
 	{
-		llifstream file_in(dict_path, std::ios::in);
+		llifstream file_in(dict_path.c_str(), std::ios::in);
 		if (file_in.is_open())
 		{
 			std::string word; int line_num = 0;
@@ -238,7 +240,7 @@ void LLSpellChecker::addToDictFile(const std::string& dict_path, const std::stri
 
 	word_list.push_back(word);
 
-	llofstream file_out(dict_path, std::ios::out | std::ios::trunc);	
+	llofstream file_out(dict_path.c_str(), std::ios::out | std::ios::trunc);	
 	if (file_out.is_open())
 	{
 		file_out << word_list.size() << std::endl;
@@ -352,7 +354,7 @@ void LLSpellChecker::initHunspell(const std::string& dict_language)
 
 		if (gDirUtilp->fileExists(user_path + DICT_FILE_IGNORE))
 		{
-			llifstream file_in(user_path + DICT_FILE_IGNORE, std::ios::in);
+			llifstream file_in((user_path + DICT_FILE_IGNORE).c_str(), std::ios::in);
 			if (file_in.is_open())
 			{
 				std::string word; int idxLine = 0;
@@ -463,7 +465,8 @@ void LLSpellChecker::removeDictionary(const std::string& dict_language)
 LLSD LLSpellChecker::loadUserDictionaryMap()
 {
 	LLSD dict_map;
-	llifstream dict_file(getDictionaryUserPath() + DICT_FILE_USER, std::ios::binary);
+    std::string dict_filename(getDictionaryUserPath() + DICT_FILE_USER);
+	llifstream dict_file(dict_filename.c_str(), std::ios::binary);
 	if (dict_file.is_open())
 	{
 		LLSDSerialize::fromXMLDocument(dict_map, dict_file);
@@ -475,7 +478,7 @@ LLSD LLSpellChecker::loadUserDictionaryMap()
 // static
 void LLSpellChecker::saveUserDictionaryMap(const LLSD& dict_map)
 {
-	llofstream dict_file(getDictionaryUserPath() + DICT_FILE_USER, std::ios::trunc);
+	llofstream dict_file((getDictionaryUserPath() + DICT_FILE_USER).c_str(), std::ios::trunc);
 	if (dict_file.is_open())
 	{
 		LLSDSerialize::toPrettyXML(dict_map, dict_file);
diff --git a/indra/llui/llviewereventrecorder.cpp b/indra/llui/llviewereventrecorder.cpp
index c5a4354f324..9fe6a542b4c 100644
--- a/indra/llui/llviewereventrecorder.cpp
+++ b/indra/llui/llviewereventrecorder.cpp
@@ -50,7 +50,7 @@ bool LLViewerEventRecorder::displayViewerEventRecorderMenuItems() {
 
 void LLViewerEventRecorder::setEventLoggingOn() {
   if (! mLog.is_open()) {
-    mLog.open(mLogFilename, llofstream::out);
+      mLog.open(mLogFilename.c_str(), std::ios_base::out);
   }
   logEvents=true; 
   LL_DEBUGS() << "LLViewerEventRecorder::setEventLoggingOn event logging turned on" << LL_ENDL;
diff --git a/indra/llvfs/llpidlock.cpp b/indra/llvfs/llpidlock.cpp
index e64368e8d77..6572edead39 100644
--- a/indra/llvfs/llpidlock.cpp
+++ b/indra/llvfs/llpidlock.cpp
@@ -95,7 +95,7 @@ LLPidLockFile& LLPidLockFile::instance()
 
 void LLPidLockFile::writeLockFile(LLSD pids)
 {
-	llofstream ofile(mLockName);
+	llofstream ofile(mLockName.c_str());
 
 	if (!LLSDSerialize::toXML(pids,ofile))
 	{
@@ -119,7 +119,7 @@ bool LLPidLockFile::requestLock(LLNameTable<void *> *name_table, bool autosave,
 	LLSD out_pids;
 	out_pids.append( (LLSD::Integer)mPID );
 
-	llifstream ifile(mLockName);
+	llifstream ifile(mLockName.c_str());
 
 	if (ifile.is_open()) 
 	{									//If file exists, we need to decide whether or not to continue.
@@ -175,7 +175,7 @@ bool LLPidLockFile::checkLock()
 
 void LLPidLockFile::releaseLock()
 {
-	llifstream ifile(mLockName);
+	llifstream ifile(mLockName.c_str());
 	LLSD in_pids;
 	LLSD out_pids;
 	bool write_file=FALSE;
diff --git a/indra/llxml/llcontrol.cpp b/indra/llxml/llcontrol.cpp
index 598a802d67a..4e3d0ab3927 100755
--- a/indra/llxml/llcontrol.cpp
+++ b/indra/llxml/llcontrol.cpp
@@ -833,7 +833,7 @@ U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only
 		}
 	}
 	llofstream file;
-	file.open(filename);
+	file.open(filename.c_str());
 	if (file.is_open())
 	{
 		LLSDSerialize::toPrettyXML(settings, file);
@@ -853,7 +853,7 @@ U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_v
 {
 	LLSD settings;
 	llifstream infile;
-	infile.open(filename);
+	infile.open(filename.c_str());
 	if(!infile.is_open())
 	{
 		LL_WARNS("Settings") << "Cannot find file " << filename << " to load." << LL_ENDL;
diff --git a/indra/llxml/tests/llcontrol_test.cpp b/indra/llxml/tests/llcontrol_test.cpp
index c273773c9b4..2b691ffbb1a 100755
--- a/indra/llxml/tests/llcontrol_test.cpp
+++ b/indra/llxml/tests/llcontrol_test.cpp
@@ -80,7 +80,7 @@ namespace tut
 		}
 		void writeSettingsFile(const LLSD& config)
 		{
-			llofstream file(mTestConfigFile);
+			llofstream file(mTestConfigFile.c_str());
 			if (file.is_open())
 			{
 				LLSDSerialize::toPrettyXML(config, file);
diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp
index 44589f0d57d..cfc445f9986 100755
--- a/indra/newview/llagentpilot.cpp
+++ b/indra/newview/llagentpilot.cpp
@@ -84,7 +84,7 @@ void LLAgentPilot::loadTxt(const std::string& filename)
 		return;
 	}
 	
-	llifstream file(filename);
+	llifstream file(filename.c_str());
 
 	if (!file)
 	{
@@ -125,7 +125,7 @@ void LLAgentPilot::loadXML(const std::string& filename)
 		return;
 	}
 	
-	llifstream file(filename);
+	llifstream file(filename.c_str());
 
 	if (!file)
 	{
@@ -168,7 +168,7 @@ void LLAgentPilot::save()
 void LLAgentPilot::saveTxt(const std::string& filename)
 {
 	llofstream file;
-	file.open(filename);
+	file.open(filename.c_str());
 
 	if (!file)
 	{
@@ -191,7 +191,7 @@ void LLAgentPilot::saveTxt(const std::string& filename)
 void LLAgentPilot::saveXML(const std::string& filename)
 {
 	llofstream file;
-	file.open(filename);
+	file.open(filename.c_str());
 
 	if (!file)
 	{
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index dd6b2802cd3..9668da25228 100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -3273,7 +3273,7 @@ void LLAppViewer::writeDebugInfo(bool isStatic)
         : getDynamicDebugFile() );
     
 	LL_INFOS() << "Opening debug file " << *debug_filename << LL_ENDL;
-	llofstream out_file(*debug_filename);
+	llofstream out_file(debug_filename->c_str());
     
     isStatic ?  LLSDSerialize::toPrettyXML(gDebugInfo, out_file)
              :  LLSDSerialize::toPrettyXML(gDebugInfo["Dynamic"], out_file);
@@ -3762,7 +3762,7 @@ void LLAppViewer::handleViewerCrash()
 	{
 		std::string filename;
 		filename = gDirUtilp->getExpandedFilename(LL_PATH_DUMP, "stats.log");
-		llofstream file(filename, llofstream::binary);
+		llofstream file(filename.c_str(), std::ios_base::binary);
 		if(file.good())
 		{
 			LL_INFOS() << "Handle viewer crash generating stats log." << LL_ENDL;
@@ -4650,7 +4650,7 @@ void LLAppViewer::loadNameCache()
 	std::string filename =
 		gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml");
 	LL_INFOS("AvNameCache") << filename << LL_ENDL;
-	llifstream name_cache_stream(filename);
+	llifstream name_cache_stream(filename.c_str());
 	if(name_cache_stream.is_open())
 	{
 		if ( ! LLAvatarNameCache::importFile(name_cache_stream))
@@ -4665,7 +4665,7 @@ void LLAppViewer::loadNameCache()
 
 	std::string name_cache;
 	name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache");
-	llifstream cache_file(name_cache);
+	llifstream cache_file(name_cache.c_str());
 	if(cache_file.is_open())
 	{
 		if(gCacheName->importFile(cache_file)) return;
@@ -4677,7 +4677,7 @@ void LLAppViewer::saveNameCache()
 	// display names cache
 	std::string filename =
 		gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml");
-	llofstream name_cache_stream(filename);
+	llofstream name_cache_stream(filename.c_str());
 	if(name_cache_stream.is_open())
 	{
 		LLAvatarNameCache::exportFile(name_cache_stream);
@@ -4688,7 +4688,7 @@ void LLAppViewer::saveNameCache()
     {
         std::string name_cache;
         name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache");
-        llofstream cache_file(name_cache);
+        llofstream cache_file(name_cache.c_str());
         if(cache_file.is_open())
         {
             gCacheName->exportFile(cache_file);
diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp
index 746b541f9d2..281e591b488 100755
--- a/indra/newview/llavatariconctrl.cpp
+++ b/indra/newview/llavatariconctrl.cpp
@@ -76,7 +76,7 @@ void LLAvatarIconIDCache::load	()
 	
 	// build filename for each user
 	std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, mFilename);
-	llifstream file(resolved_filename);
+	llifstream file(resolved_filename.c_str());
 
 	if (!file.is_open())
 		return;
@@ -114,7 +114,7 @@ void LLAvatarIconIDCache::save	()
 	std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, mFilename);
 
 	// open a file for writing
-	llofstream file (resolved_filename);
+	llofstream file (resolved_filename.c_str());
 	if (!file.is_open())
 	{
 		LL_WARNS() << "can't open avatar icons cache file\"" << mFilename << "\" for writing" << LL_ENDL;
diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp
index 06164e9597d..1819fc74ee1 100755
--- a/indra/newview/llcommandlineparser.cpp
+++ b/indra/newview/llcommandlineparser.cpp
@@ -622,7 +622,7 @@ void LLControlGroupCLP::configure(const std::string& config_filename, LLControlG
     LLSD clpConfigLLSD;
     
     llifstream input_stream;
-    input_stream.open(config_filename, std::ios::in | std::ios::binary);
+    input_stream.open(config_filename.c_str(), std::ios::in | std::ios::binary);
 
     if(input_stream.is_open())
     {
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 3da162c5ef4..fc9e85caf81 100755
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -1470,7 +1470,7 @@ void LLFavoritesOrderStorage::destroyClass()
 
 	std::string old_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml");
 	llifstream file;
-	file.open(old_filename);
+	file.open(old_filename.c_str());
 	if (file.is_open())
 	{
         file.close();
@@ -1508,7 +1508,7 @@ void LLFavoritesOrderStorage::load()
 
 	LLSD settings_llsd;
 	llifstream file;
-	file.open(filename);
+	file.open(filename.c_str());
 	if (file.is_open())
 	{
 		LLSDSerialize::fromXML(settings_llsd, file);
@@ -1542,7 +1542,7 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs()
     if (!filename.empty())
     {
         llifstream in_file;
-        in_file.open(filename);
+        in_file.open(filename.c_str());
         LLSD fav_llsd;
         if (in_file.is_open())
         {
@@ -1589,7 +1589,7 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs()
         fav_llsd[av_name.getUserName()] = user_llsd;
 
         llofstream file;
-        file.open(filename);
+        file.open(filename.c_str());
         if ( file.is_open() )
         {
             LLSDSerialize::toPrettyXML(fav_llsd, file);
@@ -1614,7 +1614,7 @@ void LLFavoritesOrderStorage::removeFavoritesRecordOfUser()
     {
         LLSD fav_llsd;
         llifstream file;
-        file.open(filename);
+        file.open(filename.c_str());
         if (file.is_open())
         {
             LLSDSerialize::fromXML(fav_llsd, file);
@@ -1631,7 +1631,7 @@ void LLFavoritesOrderStorage::removeFavoritesRecordOfUser()
             }
         
             llofstream out_file;
-            out_file.open(filename);
+            out_file.open(filename.c_str());
             if ( out_file.is_open() )
             {
                 LLSDSerialize::toPrettyXML(fav_llsd, out_file);
@@ -1687,7 +1687,7 @@ void LLFavoritesOrderStorage::save()
             }
 
             llofstream file;
-            file.open(filename);
+            file.open(filename.c_str());
             if ( file.is_open() )
             {
                 LLSDSerialize::toPrettyXML(settings_llsd, file);
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index af84aea6a61..ea39f812fd1 100755
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -331,7 +331,7 @@ bool LLFeatureManager::parseFeatureTable(std::string filename)
 	U32		version;
 	
 	cleanupFeatureTables(); // in case an earlier attempt left partial results
-	file.open(filename); 	 /*Flawfinder: ignore*/
+	file.open(filename.c_str()); 	 /*Flawfinder: ignore*/
 
 	if (!file)
 	{
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index 7ac3ac2f615..b342d8fdf36 100755
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -156,7 +156,7 @@ BOOL LLFloaterAbout::postBuild()
 	std::string contributors_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"contributors.txt");
 	llifstream contrib_file;
 	std::string contributors;
-	contrib_file.open(contributors_path);		/* Flawfinder: ignore */
+	contrib_file.open(contributors_path.c_str());		/* Flawfinder: ignore */
 	if (contrib_file.is_open())
 	{
 		std::getline(contrib_file, contributors); // all names are on a single line
@@ -173,7 +173,7 @@ BOOL LLFloaterAbout::postBuild()
     // Get the Versions and Copyrights, created at build time
 	std::string licenses_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"packages-info.txt");
 	llifstream licenses_file;
-	licenses_file.open(licenses_path);		/* Flawfinder: ignore */
+	licenses_file.open(licenses_path.c_str());		/* Flawfinder: ignore */
 	if (licenses_file.is_open())
 	{
 		std::string license_line;
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index ec905558aae..b9113d265ae 100755
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -2155,7 +2155,7 @@ bool LLModelLoader::loadFromSLM(const std::string& filename)
 
 	S32 file_size = (S32) stat.st_size;
 	
-	llifstream ifstream(filename, std::ifstream::in | std::ifstream::binary);
+	llifstream ifstream(filename.c_str(), std::ifstream::in | std::ifstream::binary);
 	LLSD data;
 	LLSDSerialize::fromBinary(data, ifstream, file_size);
 	ifstream.close();
@@ -3513,7 +3513,7 @@ void LLModelPreview::saveUploadData(const std::string& filename, bool save_skinw
 		data["instance"][i] = instance.asLLSD();
 	}
 
-	llofstream out(filename, std::ios_base::out | std::ios_base::binary);
+	llofstream out(filename.c_str(), std::ios_base::out | std::ios_base::binary);
 	LLSDSerialize::toBinary(data, out);
 	out.flush();
 	out.close();
diff --git a/indra/newview/llfloaterspellchecksettings.cpp b/indra/newview/llfloaterspellchecksettings.cpp
index 54c7b4c37dc..5124dae1479 100755
--- a/indra/newview/llfloaterspellchecksettings.cpp
+++ b/indra/newview/llfloaterspellchecksettings.cpp
@@ -350,7 +350,8 @@ void LLFloaterSpellCheckerImport::onBtnOK()
 		custom_dict_info["language"] = dict_language;
 
 		LLSD custom_dict_map;
-		llifstream custom_file_in(LLSpellChecker::getDictionaryUserPath() + "user_dictionaries.xml");
+        std::string custom_filename(LLSpellChecker::getDictionaryUserPath() + "user_dictionaries.xml");
+		llifstream custom_file_in(custom_filename.c_str());
 		if (custom_file_in.is_open())
 		{
 			LLSDSerialize::fromXMLDocument(custom_dict_map, custom_file_in);
@@ -372,7 +373,7 @@ void LLFloaterSpellCheckerImport::onBtnOK()
 			custom_dict_map.append(custom_dict_info);
 		}
 
-		llofstream custom_file_out(LLSpellChecker::getDictionaryUserPath() + "user_dictionaries.xml", std::ios::trunc);
+		llofstream custom_file_out(custom_filename.c_str(), std::ios::trunc);
 		if (custom_file_out.is_open())
 		{
 			LLSDSerialize::toPrettyXML(custom_dict_map, custom_file_out);
diff --git a/indra/newview/lllocationhistory.cpp b/indra/newview/lllocationhistory.cpp
index 680b35b5508..162d6e003e9 100755
--- a/indra/newview/lllocationhistory.cpp
+++ b/indra/newview/lllocationhistory.cpp
@@ -127,7 +127,7 @@ void LLLocationHistory::save() const
 	}
 
 	// open a file for writing
-	llofstream file (resolved_filename);
+	llofstream file(resolved_filename.c_str());
 	if (!file.is_open())
 	{
 		LL_WARNS() << "can't open location history file \"" << mFilename << "\" for writing" << LL_ENDL;
@@ -148,7 +148,7 @@ void LLLocationHistory::load()
 	
 	// build filename for each user
 	std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
-	llifstream file(resolved_filename);
+	llifstream file(resolved_filename.c_str());
 
 	if (!file.is_open())
 	{
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index cadbc16f1e9..7ddacf30337 100755
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -302,7 +302,7 @@ void LLLogChat::saveHistory(const std::string& filename,
 		return;
 	}
 	
-	llofstream file (LLLogChat::makeLogFileName(filename), std::ios_base::app);
+	llofstream file(LLLogChat::makeLogFileName(filename).c_str(), std::ios_base::app);
 	if (!file.is_open())
 	{
 		LL_WARNS() << "Couldn't open chat history log! - " + filename << LL_ENDL;
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 89c898001f4..cc8c3edd51a 100755
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -308,10 +308,10 @@ void LLPanelLogin::addFavoritesToStartLocation()
 
 	LLSD fav_llsd;
 	llifstream file;
-	file.open(filename);
+	file.open(filename.c_str());
 	if (!file.is_open())
 	{
-		file.open(old_filename);
+		file.open(old_filename.c_str());
 		if (!file.is_open()) return;
 	}
 	LLSDSerialize::fromXML(fav_llsd, file);
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 37273a77938..17c0b226d0c 100755
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -160,10 +160,9 @@ BOOL LLPanelMainInventory::postBuild()
 	}
 
 	// Now load the stored settings from disk, if available.
-	std::ostringstream filterSaveName;
-	filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME);
-	LL_INFOS() << "LLPanelMainInventory::init: reading from " << filterSaveName.str() << LL_ENDL;
-	llifstream file(filterSaveName.str());
+	std::string filterSaveName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME));
+	LL_INFOS() << "LLPanelMainInventory::init: reading from " << filterSaveName << LL_ENDL;
+	llifstream file(filterSaveName.c_str());
 	LLSD savedFilterState;
 	if (file.is_open())
 	{
@@ -243,16 +242,17 @@ LLPanelMainInventory::~LLPanelMainInventory( void )
 		}
 	}
 
-	std::ostringstream filterSaveName;
-	filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME);
-	llofstream filtersFile(filterSaveName.str());
+	std::string filterSaveName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME));
+	llofstream filtersFile(filterSaveName.c_str());
 	if(!LLSDSerialize::toPrettyXML(filterRoot, filtersFile))
 	{
-		LL_WARNS() << "Could not write to filters save file " << filterSaveName.str() << LL_ENDL;
+		LL_WARNS() << "Could not write to filters save file " << filterSaveName << LL_ENDL;
 	}
 	else
+    {
 		filtersFile.close();
-
+    }
+    
 	gInventory.removeObserver(this);
 	delete mSavedFolderState;
 }
diff --git a/indra/newview/llsearchhistory.cpp b/indra/newview/llsearchhistory.cpp
index 7b4bf637406..0ea05a03d67 100755
--- a/indra/newview/llsearchhistory.cpp
+++ b/indra/newview/llsearchhistory.cpp
@@ -43,7 +43,7 @@ bool LLSearchHistory::load()
 {
 	// build filename for each user
 	std::string resolved_filename = getHistoryFilePath();
-	llifstream file(resolved_filename);
+	llifstream file(resolved_filename.c_str());
 	if (!file.is_open())
 	{
 		return false;
@@ -76,7 +76,7 @@ bool LLSearchHistory::save()
 	// build filename for each user
 	std::string resolved_filename = getHistoryFilePath();
 	// open a file for writing
-	llofstream file (resolved_filename);
+	llofstream file(resolved_filename.c_str());
 	if (!file.is_open())
 	{
 		return false;
diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
index 588c585f524..40516f9bbb6 100755
--- a/indra/newview/llsechandler_basic.cpp
+++ b/indra/newview/llsechandler_basic.cpp
@@ -640,7 +640,7 @@ LLBasicCertificateStore::~LLBasicCertificateStore()
 // persist the store
 void LLBasicCertificateStore::save()
 {
-	llofstream file_store(mFilename, llofstream::binary);
+	llofstream file_store(mFilename.c_str(), std::ios_base::binary);
 	if(!file_store.fail())
 	{
 		for(iterator cert = begin();
@@ -1331,7 +1331,7 @@ void LLSecAPIBasicHandler::_writeProtectedData()
 	std::string tmp_filename = mProtectedDataFilename + ".tmp";
 	
 	llofstream protected_data_stream(tmp_filename.c_str(), 
-										llofstream::binary);
+                                     std::ios_base::binary);
 	try
 	{
 		
@@ -1568,7 +1568,7 @@ std::string LLSecAPIBasicHandler::_legacyLoadPassword()
 {
 	const S32 HASHED_LENGTH = 32;	
 	std::vector<U8> buffer(HASHED_LENGTH);
-	llifstream password_file(mLegacyPasswordPath, llifstream::binary);
+	llifstream password_file(mLegacyPasswordPath.c_str(), llifstream::binary);
 	
 	if(password_file.fail())
 	{
diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp
index a763d42a8df..802dff1ead9 100644
--- a/indra/newview/llsyntaxid.cpp
+++ b/indra/newview/llsyntaxid.cpp
@@ -83,7 +83,7 @@ class fetchKeywordsFileResponder : public LLHTTPClient::Responder
 		const std::string xml = str.str();
 
 		// save the str to disk, usually to the cache.
-		llofstream file(mFileSpec, std::ios_base::out);
+		llofstream file(mFileSpec.c_str(), std::ios_base::out);
 		file.write(xml.c_str(), str.str().size());
 		file.close();
 
@@ -269,7 +269,7 @@ void LLSyntaxIdLSL::loadKeywordsIntoLLSD()
 {
 	LLSD content;
 	llifstream file;
-	file.open(mFullFileSpec);
+	file.open(mFullFileSpec.c_str());
 	if (file.is_open())
 	{
 		if (LLSDSerialize::fromXML(content, file) != LLSDParser::PARSE_FAILURE)
diff --git a/indra/newview/llteleporthistorystorage.cpp b/indra/newview/llteleporthistorystorage.cpp
index f88f88a4fa9..8a5704939a1 100755
--- a/indra/newview/llteleporthistorystorage.cpp
+++ b/indra/newview/llteleporthistorystorage.cpp
@@ -164,7 +164,7 @@ void LLTeleportHistoryStorage::save()
 	std::string resolvedFilename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
 
 	// open the history file for writing
-	llofstream file (resolvedFilename);
+	llofstream file(resolvedFilename.c_str());
 	if (!file.is_open())
 	{
 		LL_WARNS() << "can't open teleport history file \"" << mFilename << "\" for writing" << LL_ENDL;
@@ -186,7 +186,7 @@ void LLTeleportHistoryStorage::load()
 	std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
 
 	// open the history file for reading
-	llifstream file(resolved_filename);
+	llifstream file(resolved_filename.c_str());
 	if (!file.is_open())
 	{
 		LL_WARNS() << "can't load teleport history from file \"" << mFilename << "\"" << LL_ENDL;
diff --git a/indra/newview/llurlhistory.cpp b/indra/newview/llurlhistory.cpp
index 8eea2b242ae..f7064e152ab 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;
 	}
 
diff --git a/indra/newview/llurlwhitelist.cpp b/indra/newview/llurlwhitelist.cpp
index 8211ce12f64..3a7285974e4 100755
--- a/indra/newview/llurlwhitelist.cpp
+++ b/indra/newview/llurlwhitelist.cpp
@@ -87,7 +87,7 @@ bool LLUrlWhiteList::load ()
 	std::string resolvedFilename = gDirUtilp->getExpandedFilename ( LL_PATH_PER_SL_ACCOUNT, mFilename );
 
 	// open a file for reading
-	llifstream file ( resolvedFilename );
+	llifstream file(resolvedFilename.c_str());
 	if ( file.is_open () )
 	{
 		// add each line in the file to the list
@@ -122,7 +122,7 @@ bool LLUrlWhiteList::save ()
 	}
 
 	// open a file for writing
-	llofstream file ( resolvedFilename );
+	llofstream file(resolvedFilename.c_str());
 	if ( file.is_open () )
 	{
 		// for each entry we have
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index c758bbcc9e9..509227c6835 100755
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -1278,7 +1278,7 @@ void LLViewerMedia::loadCookieFile()
 	}
 	
 	// open the file for reading
-	llifstream file(resolved_filename);
+	llifstream file(resolved_filename.c_str());
 	if (!file.is_open())
 	{
 		LL_WARNS() << "can't load plugin cookies from file \"" << PLUGIN_COOKIE_FILE_NAME << "\"" << LL_ENDL;
@@ -1320,7 +1320,7 @@ void LLViewerMedia::saveCookieFile()
 	}
 
 	// open a file for writing
-	llofstream file (resolved_filename);
+	llofstream file(resolved_filename.c_str());
 	if (!file.is_open())
 	{
 		LL_WARNS() << "can't open plugin cookie file \"" << PLUGIN_COOKIE_FILE_NAME << "\" for writing" << LL_ENDL;
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 74b8e693c48..db49fcb0d81 100755
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -3001,7 +3001,7 @@ void LLViewerObject::processTaskInvFile(void** user_data, S32 error_code, LLExtS
 BOOL LLViewerObject::loadTaskInvFile(const std::string& filename)
 {
 	std::string filename_and_local_path = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, filename);
-	llifstream ifs(filename_and_local_path);
+	llifstream ifs(filename_and_local_path.c_str());
 	if(ifs.good())
 	{
 		char buffer[MAX_STRING];	/* Flawfinder: ignore */
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 0865d900055..378bb18ecdc 100755
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -180,7 +180,7 @@ void LLViewerTextureList::doPrefetchImages()
 	LLSD imagelist;
 	std::string filename = get_texture_list_name();
 	llifstream file;
-	file.open(filename);
+	file.open(filename.c_str());
 	if (file.is_open())
 	{
 		if ( ! LLSDSerialize::fromXML(imagelist, file) )
@@ -274,7 +274,7 @@ void LLViewerTextureList::shutdown()
 	{
 		std::string filename = get_texture_list_name();
 		llofstream file;
-		file.open(filename);
+		file.open(filename.c_str());
         LL_DEBUGS() << "saving " << imagelist.size() << " image list entries" << LL_ENDL;
 		LLSDSerialize::toPrettyXML(imagelist, file);
 	}
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index 962cdf02684..e24884fe81d 100755
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -1024,10 +1024,15 @@ void LLSpeakerVolumeStorage::load()
 
 	LLSD settings_llsd;
 	llifstream file;
-	file.open(filename);
+	file.open(filename.c_str());
 	if (file.is_open())
 	{
-		LLSDSerialize::fromXML(settings_llsd, file);
+		if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(settings_llsd, file))
+        {
+            LL_WARNS("Voice") << "failed to parse " << filename << LL_ENDL;
+            
+        }
+            
 	}
 
 	for (LLSD::map_const_iterator iter = settings_llsd.beginMap();
@@ -1062,7 +1067,7 @@ void LLSpeakerVolumeStorage::save()
 		}
 
 		llofstream file;
-		file.open(filename);
+		file.open(filename.c_str());
 		LLSDSerialize::toPrettyXML(settings_llsd, file);
 	}
 }
diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp
index c854e1fc666..374792193ca 100755
--- a/indra/newview/llwaterparammanager.cpp
+++ b/indra/newview/llwaterparammanager.cpp
@@ -150,7 +150,7 @@ void LLWaterParamManager::savePreset(const std::string & name)
 	paramsData = mParamList[name].getAll();
 
 	// write to file
-	llofstream presetsXML(pathName);
+	llofstream presetsXML(pathName.c_str());
 	LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
 	formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY);
 	presetsXML.close();
diff --git a/indra/newview/llwldaycycle.cpp b/indra/newview/llwldaycycle.cpp
index e9b0baf612d..88079c5d263 100755
--- a/indra/newview/llwldaycycle.cpp
+++ b/indra/newview/llwldaycycle.cpp
@@ -109,7 +109,7 @@ LLSD LLWLDayCycle::loadDayCycleFromPath(const std::string& file_path)
 {
 	LL_INFOS("Windlight") << "Loading DayCycle settings from " << file_path << LL_ENDL;
 	
-	llifstream day_cycle_xml(file_path);
+	llifstream day_cycle_xml(file_path.c_str());
 	if (day_cycle_xml.is_open())
 	{
 		// load and parse it
@@ -137,7 +137,7 @@ void LLWLDayCycle::save(const std::string& file_path)
 {
 	LLSD day_data = asLLSD();
 
-	llofstream day_cycle_xml(file_path);
+	llofstream day_cycle_xml(file_path.c_str());
 	LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
 	formatter->format(day_data, day_cycle_xml, LLSDFormatter::OPTIONS_PRETTY);
 	day_cycle_xml.close();
diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp
index 91ea10d43d1..2b6d88efef7 100755
--- a/indra/newview/llwlparammanager.cpp
+++ b/indra/newview/llwlparammanager.cpp
@@ -334,7 +334,7 @@ void LLWLParamManager::savePreset(LLWLParamKey key)
 	paramsData = mParamList[key].getAll();
 
 	// write to file
-	llofstream presetsXML(pathName);
+	llofstream presetsXML(pathName.c_str());
 	LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();
 	formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY);
 	presetsXML.close();
diff --git a/indra/test/llmessageconfig_tut.cpp b/indra/test/llmessageconfig_tut.cpp
index 8088ce85589..df2151b1b1a 100755
--- a/indra/test/llmessageconfig_tut.cpp
+++ b/indra/test/llmessageconfig_tut.cpp
@@ -68,7 +68,7 @@ namespace tut
 
 		void writeConfigFile(const LLSD& config)
 		{
-			llofstream file((mTestConfigDir + "/message.xml"));
+			llofstream file((mTestConfigDir + "/message.xml").c_str());
 			if (file.is_open())
 			{
 				LLSDSerialize::toPrettyXML(config, file);
diff --git a/indra/test/message_tut.cpp b/indra/test/message_tut.cpp
index 57e423e5500..aa23699de07 100755
--- a/indra/test/message_tut.cpp
+++ b/indra/test/message_tut.cpp
@@ -119,9 +119,8 @@ namespace tut
 
 		void writeConfigFile(const LLSD& config)
 		{
-			std::ostringstream ostr;
-			ostr << mTestConfigDir << mSep << "message.xml";
-			llofstream file(ostr.str());
+			std::string ostr(mTestConfigDir + mSep + "message.xml");
+			llofstream file(ostr.c_str());
 			if (file.is_open())
 			{
 				LLSDSerialize::toPrettyXML(config, file);
diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp
index c42112af807..f868e5cc2c5 100755
--- a/indra/viewer_components/updater/llupdatedownloader.cpp
+++ b/indra/viewer_components/updater/llupdatedownloader.cpp
@@ -270,7 +270,7 @@ void LLUpdateDownloader::Implementation::resume(void)
 	}
 
 	mDownloadRecordPath = downloadMarkerPath();
-	llifstream dataStream(mDownloadRecordPath);
+	llifstream dataStream(mDownloadRecordPath.c_str());
 	if(!dataStream)
 	{
 		mClient.downloadError("no download marker");
@@ -362,7 +362,7 @@ size_t LLUpdateDownloader::Implementation::onHeader(void * buffer, size_t size)
 			LL_INFOS("UpdaterService") << "download size is " << size << LL_ENDL;
 
 			mDownloadData["size"] = LLSD(LLSD::Integer(size));
-			llofstream odataStream(mDownloadRecordPath);
+			llofstream odataStream(mDownloadRecordPath.c_str());
 			LLSDSerialize::toPrettyXML(mDownloadData, odataStream);
 		} catch (std::exception const & e) {
 			LL_WARNS("UpdaterService") << "unable to read content length ("
@@ -513,7 +513,7 @@ void LLUpdateDownloader::Implementation::resumeDownloading(size_t startByte)
 	}
 	throwOnCurlError(curl_easy_setopt(mCurl, CURLOPT_HTTPHEADER, mHeaderList));
 
-	mDownloadStream.open(mDownloadData["path"].asString(),
+	mDownloadStream.open(mDownloadData["path"].asString().c_str(),
 						 std::ios_base::out | std::ios_base::binary | std::ios_base::app);
 	start();
 }
@@ -534,10 +534,10 @@ void LLUpdateDownloader::Implementation::startDownloading(LLURI const & uri, std
 		<< " from " << uri.asString() << LL_ENDL;
 	LL_INFOS("UpdaterService") << "hash of file is " << hash << LL_ENDL;
 
-	llofstream dataStream(mDownloadRecordPath);
+	llofstream dataStream(mDownloadRecordPath.c_str());
 	LLSDSerialize::toPrettyXML(mDownloadData, dataStream);
 
-	mDownloadStream.open(filePath, std::ios_base::out | std::ios_base::binary);
+	mDownloadStream.open(filePath.c_str(), std::ios_base::out | std::ios_base::binary);
 	initializeCurlGet(uri.asString(), true);
 	start();
 }
@@ -570,7 +570,7 @@ bool LLUpdateDownloader::Implementation::validateOrRemove(const std::string& fil
 
 bool LLUpdateDownloader::Implementation::validateDownload(const std::string& filePath)
 {
-	llifstream fileStream(filePath, std::ios_base::in | std::ios_base::binary);
+	llifstream fileStream(filePath.c_str(), std::ios_base::in | std::ios_base::binary);
 	if(!fileStream)
 	{
 		LL_INFOS("UpdaterService") << "can't open " << filePath << ", invalid" << LL_ENDL;
diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp
index cb3be5bbdcd..c152493a514 100755
--- a/indra/viewer_components/updater/llupdaterservice.cpp
+++ b/indra/viewer_components/updater/llupdaterservice.cpp
@@ -285,7 +285,7 @@ bool LLUpdaterServiceImpl::checkForInstall(bool launchInstaller)
 {
 	bool foundInstall = false; // return true if install is found.
 
-	llifstream update_marker(update_marker_path(), 
+	llifstream update_marker(update_marker_path().c_str(), 
 							 std::ios::in | std::ios::binary);
 
 	if(update_marker.is_open())
@@ -365,7 +365,7 @@ bool LLUpdaterServiceImpl::checkForResume()
 	std::string download_marker_path = mUpdateDownloader.downloadMarkerPath();
 	if(LLFile::isfile(download_marker_path))
 	{
-		llifstream download_marker_stream(download_marker_path, 
+		llifstream download_marker_stream(download_marker_path.c_str(), 
 								 std::ios::in | std::ios::binary);
 		if(download_marker_stream.is_open())
 		{
@@ -460,7 +460,7 @@ void LLUpdaterServiceImpl::downloadComplete(LLSD const & data)
 
 	// Save out the download data to the SecondLifeUpdateReady
 	// marker file. 
-	llofstream update_marker(update_marker_path());
+	llofstream update_marker(update_marker_path().c_str());
 	LLSDSerialize::toPrettyXML(data, update_marker);
 	
 	LLSD event;
@@ -558,7 +558,7 @@ bool LLUpdaterServiceImpl::onMainLoop(LLSD const & event)
 			LL_DEBUGS("UpdaterService") << "found marker " << ll_install_failed_marker_path() << LL_ENDL;
 			int requiredValue = 0; 
 			{
-				llifstream stream(ll_install_failed_marker_path());
+				llifstream stream(ll_install_failed_marker_path().c_str());
 				stream >> requiredValue;
 				if(stream.fail())
 				{
-- 
GitLab