From 77d25204ea5ea4378e0c10e1f57e56148980fce2 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 2 Apr 2015 15:41:45 -0400 Subject: clarity and logging cleanup --- indra/llcommon/lllivefile.cpp | 85 +++++++++++++++++++++++-------------------- 1 file changed, 46 insertions(+), 39 deletions(-) diff --git a/indra/llcommon/lllivefile.cpp b/indra/llcommon/lllivefile.cpp index c1987baf55..ea485c2d86 100755 --- a/indra/llcommon/lllivefile.cpp +++ b/indra/llcommon/lllivefile.cpp @@ -51,6 +51,8 @@ public: bool mLastExists; LLEventTimer* mEventTimer; +private: + LOG_CLASS(LLLiveFile); }; LLLiveFile::Impl::Impl(const std::string& filename, const F32 refresh_period) @@ -83,46 +85,51 @@ LLLiveFile::~LLLiveFile() bool LLLiveFile::Impl::check() { - if (!mForceCheck && mRefreshTimer.getElapsedTimeF32() < mRefreshPeriod) + bool detected_change = false; + // Skip the check if not enough time has elapsed and we're not + // forcing a check of the file + if (mForceCheck || mRefreshTimer.getElapsedTimeF32() >= mRefreshPeriod) { - // Skip the check if not enough time has elapsed and we're not - // forcing a check of the file - return false; - } - mForceCheck = false; - mRefreshTimer.reset(); - - // Stat the file to see if it exists and when it was last modified. - llstat stat_data; - int res = LLFile::stat(mFilename, &stat_data); - - if (res) - { - // Couldn't stat the file, that means it doesn't exist or is - // broken somehow. Clear flags and return. - if (mLastExists) - { - mLastExists = false; - return true; // no longer existing is a change! - } - return false; - } - - // The file exists, decide if we want to load it. - if (mLastExists) - { - // The file existed last time, don't read it if it hasn't changed since - // last time. - if (stat_data.st_mtime <= mLastModTime) - { - return false; - } - } - - // We want to read the file. Update status info for the file. - mLastExists = true; - mLastStatTime = stat_data.st_mtime; - return true; + mForceCheck = false; // force only forces one check + mRefreshTimer.reset(); // don't check again until mRefreshPeriod has passed + + // Stat the file to see if it exists and when it was last modified. + llstat stat_data; + if (LLFile::stat(mFilename, &stat_data)) + { + // Couldn't stat the file, that means it doesn't exist or is + // broken somehow. + if (mLastExists) + { + mLastExists = false; + detected_change = true; // no longer existing is a change! + LL_DEBUGS() << "detected deleted file '" << mFilename << "'" << LL_ENDL; + } + } + else + { + // The file exists + if ( ! mLastExists ) + { + // last check, it did not exist - that counts as a change + LL_DEBUGS() << "detected created file '" << mFilename << "'" << LL_ENDL; + detected_change = true; + } + else if ( stat_data.st_mtime > mLastModTime ) + { + // file modification time is newer than last check + LL_DEBUGS() << "detected updated file '" << mFilename << "'" << LL_ENDL; + detected_change = true; + } + mLastExists = true; + mLastStatTime = stat_data.st_mtime; + } + } + if (detected_change) + { + LL_INFOS() << "detected file change '" << mFilename << "'" << LL_ENDL; + } + return detected_change; } void LLLiveFile::Impl::changed() -- cgit v1.2.3 From 59e58c9328f414ae95b6a09129de3a9942aab083 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 2 Apr 2015 15:53:07 -0400 Subject: improve notice clarity --- indra/newview/skins/default/xui/en/notifications.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index b4d8046d18..34897e61e4 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -10398,7 +10398,7 @@ Cannot create large prims that intersect other players. Please re-try when othe icon="alertmodal.tga" name="DefaultObjectPermissions" type="alert"> - There was a problem saving the default permissions due to the following reason: [REASON]. Please try setting the default permissions later. + There was a problem saving the default object permissions: [REASON]. Please try setting the default permissions later. fail Date: Thu, 2 Apr 2015 16:01:17 -0400 Subject: add script to check xml files written by the viewer --- scripts/check-viewer-xml | 102 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100755 scripts/check-viewer-xml diff --git a/scripts/check-viewer-xml b/scripts/check-viewer-xml new file mode 100755 index 0000000000..27c1112492 --- /dev/null +++ b/scripts/check-viewer-xml @@ -0,0 +1,102 @@ +#!/usr/bin/env python +from __future__ import print_function +import sys +import os +import argparse +import xml.etree.ElementTree as xml + +try: + from llbase import llsd +except ImportError: + try: + from indra.base import llsd + except ImportError: + sys.exit("""Failed to import python llsd module from llbase or indra.base. +Try + pip install llbase +or + sudo pip install llbase +""") + +def warning(*objs): + print(*objs, file=sys.stderr) + +def xml_is_ok(file): + # Check that the XML file is well formed. + try : + elements = xml.parse(file) + except IOError as read_error: + warning("XML not readable '%s':\n %s" % (file, read_error)) + return False + except xml.ParseError as parse_error : + warning("XML not well-formed '%s':\n %s" % (file, parse_error.msg)) + return False + + root = elements.getroot() + if root.tag == 'llsd': + # if it's LLSD, we should be able to also validate that + with open(file, "r") as llsd_file: + llsd_content=llsd_file.read() + try: + llsd.parse(llsd_content) + except Exception as validity_error: + warning("LLSD not valid '%s':\n %s" % (file, validity_error)) + return False + elif arg.verbosity == 'verbose': + warning(" %s is not a document type that can be validated" % root.tag) + + return True + +cmd_line = argparse.ArgumentParser(description='Checks all xml files found in viewer settings and cache directories ', + prog='check-viewer-xml', + ) +cmd_line.add_argument('directory', nargs='*', default=None, + help='additional directories to check') +verbosity_options=cmd_line.add_mutually_exclusive_group() +verbosity_options.add_argument('-v', '--verbose', + help='verbose output', action='store_const', const='verbose', dest='verbosity') +verbosity_options.add_argument('-q', '--quiet', + help='output errors only', action='store_const', const='quiet', dest='verbosity', default='normal') + +arg = cmd_line.parse_args() + +if sys.platform == 'darwin': + CheckDirs = [ os.path.expanduser('~/Library/Caches/SecondLife'), + os.path.expanduser('~/Library/Application Support/SecondLife'), + ] +elif sys.platform == 'linux2': + CheckDirs = [ os.path.expanduser('~/.secondlife'), + ] +elif sys.platform == 'win32' or sys.platform == 'cygwin': + CheckDirs = [ os.path.expanduser('~\\Local Settings\\Temp'), + os.path.expanduser('~\\Application\\Data\\Secondlife'), + os.path.expanduser('~\\AppData\\Roaming\\Secondlife'), + os.path.expanduser('~\\AppData\\Local\\Secondlife'), + ] +else: + sys.exit("unrecognized platform '%s'" % sys.platform) + +if arg.directory: + CheckDirs.extend(arg.directory) + +checked_files = 0 +invalid_files = 0 +for root in filter(os.path.isdir, CheckDirs): + if arg.verbosity == 'verbose': + print("Searching '%s'" % root) + for directory, dirs, files in os.walk(root): + for file in files: + if file.endswith('.xml'): + xml_file = os.path.join(directory,file) + if arg.verbosity == 'verbose': + print("Checking '%s'" % xml_file) + checked_files += 1 + if not xml_is_ok(xml_file): + invalid_files += 1 + +if arg.verbosity != 'quiet': + print("Checked %d files, %d errors found." % (checked_files, invalid_files)) + +sys.exit(invalid_files) + + -- cgit v1.2.3 From 6324e580001b3b3f2a6e851a483b235529be13c6 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 2 Apr 2015 21:11:22 -0400 Subject: improve logging of errors in default permissions cap --- indra/newview/llfloaterperms.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 849aa7cd14..042cf47070 100755 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -195,7 +195,7 @@ private: // even if it is the same as a previous one. sPreviousReason = ""; LLFloaterPermsDefault::setCapSent(true); - LL_INFOS("FloaterPermsResponder") << "Sent default permissions to simulator" << LL_ENDL; + LL_INFOS("ObjectPermissionsFloater") << "Default permissions successfully sent to simulator" << LL_ENDL; } }; @@ -223,8 +223,20 @@ void LLFloaterPermsDefault::updateCap() report["default_object_perm_masks"]["NextOwner"] = (LLSD::Integer)LLFloaterPerms::getNextOwnerPerms(sCategoryNames[CAT_OBJECTS]); + { + LL_DEBUGS("ObjectPermissionsFloater") << "Sending default permissions to '" + << object_url << "'\n"; + std::ostringstream sent_perms_log; + LLSDSerialize::toPrettyXML(report, sent_perms_log); + LL_CONT << sent_perms_log.str() << LL_ENDL; + } + LLHTTPClient::post(object_url, report, new LLFloaterPermsResponder()); } + else + { + LL_DEBUGS("ObjectPermissionsFloater") << "AgentPreferences cap not available." << LL_ENDL; + } } void LLFloaterPermsDefault::setCapSent(bool cap_sent) -- cgit v1.2.3 From e19809cb916df8b2ba965662607abe604d7a2bf5 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 2 Apr 2015 21:12:43 -0400 Subject: improve logging of machine id generation --- indra/newview/llmachineid.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/indra/newview/llmachineid.cpp b/indra/newview/llmachineid.cpp index cd6473921d..b5fd3df0f3 100755 --- a/indra/newview/llmachineid.cpp +++ b/indra/newview/llmachineid.cpp @@ -88,7 +88,7 @@ S32 LLMachineID::init() if (FAILED(hres)) { - LL_DEBUGS("AppInit") << "Failed to initialize security. Error code = 0x" << hex << hres << LL_ENDL; + LL_WARNS("AppInit") << "Failed to initialize security. Error code = 0x" << hex << hres << LL_ENDL; CoUninitialize(); return 1; // Program has failed. } @@ -106,7 +106,7 @@ S32 LLMachineID::init() if (FAILED(hres)) { - LL_DEBUGS("AppInit") << "Failed to create IWbemLocator object." << " Err code = 0x" << hex << hres << LL_ENDL; + LL_WARNS("AppInit") << "Failed to create IWbemLocator object." << " Err code = 0x" << hex << hres << LL_ENDL; CoUninitialize(); return 1; // Program has failed. } @@ -132,7 +132,7 @@ S32 LLMachineID::init() if (FAILED(hres)) { - LL_DEBUGS("AppInit") << "Could not connect. Error code = 0x" << hex << hres << LL_ENDL; + LL_WARNS("AppInit") << "Could not connect. Error code = 0x" << hex << hres << LL_ENDL; pLoc->Release(); CoUninitialize(); return 1; // Program has failed. @@ -157,7 +157,7 @@ S32 LLMachineID::init() if (FAILED(hres)) { - LL_DEBUGS("AppInit") << "Could not set proxy blanket. Error code = 0x" << hex << hres << LL_ENDL; + LL_WARNS("AppInit") << "Could not set proxy blanket. Error code = 0x" << hex << hres << LL_ENDL; pSvc->Release(); pLoc->Release(); CoUninitialize(); @@ -178,7 +178,7 @@ S32 LLMachineID::init() if (FAILED(hres)) { - LL_DEBUGS("AppInit") << "Query for operating system name failed." << " Error code = 0x" << hex << hres << LL_ENDL; + LL_WARNS("AppInit") << "Query for operating system name failed." << " Error code = 0x" << hex << hres << LL_ENDL; pSvc->Release(); pLoc->Release(); CoUninitialize(); @@ -205,7 +205,7 @@ S32 LLMachineID::init() // Get the value of the Name property hr = pclsObj->Get(L"SerialNumber", 0, &vtProp, 0, 0); - LL_DEBUGS("AppInit") << " Serial Number : " << vtProp.bstrVal << LL_ENDL; + LL_INFOS("AppInit") << " Serial Number : " << vtProp.bstrVal << LL_ENDL; // use characters in the returned Serial Number to create a byte array of size len BSTR serialNumber ( vtProp.bstrVal); unsigned int j = 0; @@ -252,7 +252,7 @@ S32 LLMachineID::getUniqueID(unsigned char *unique_id, size_t len) if (has_static_unique_id) { memcpy ( unique_id, &static_unique_id, len); - LL_DEBUGS("AppInit") << "UniqueID: 0x"; + LL_INFOS_ONCE("AppInit") << "UniqueID: 0x"; // Code between here and LL_ENDL is not executed unless the LL_DEBUGS // actually produces output for (size_t i = 0; i < len; ++i) -- cgit v1.2.3 From 4aafdfd1c6ee76484b83a4e91a73af357aba0de7 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 2 Apr 2015 21:21:21 -0400 Subject: add catch for possible exception in llsechandler_basic destructor (crash on exit) --- indra/newview/llsechandler_basic.cpp | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp index fc9d9f0842..588c585f52 100755 --- a/indra/newview/llsechandler_basic.cpp +++ b/indra/newview/llsechandler_basic.cpp @@ -1364,6 +1364,7 @@ void LLSecAPIBasicHandler::_writeProtectedData() } catch (...) { + LL_WARNS() << "LLProtectedDataException(Error writing Protected Data Store)" << LL_ENDL; // it's good practice to clean up any secure information on error // (even though this file isn't really secure. Perhaps in the future // it may be, however. @@ -1372,20 +1373,35 @@ void LLSecAPIBasicHandler::_writeProtectedData() // EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData() // Decided throwing an exception here was overkill until we figure out why this happens //throw LLProtectedDataException("Error writing Protected Data Store"); - LL_INFOS() << "LLProtectedDataException(Error writing Protected Data Store)" << LL_ENDL; } - // move the temporary file to the specified file location. - if((((LLFile::isfile(mProtectedDataFilename) != 0) && - (LLFile::remove(mProtectedDataFilename) != 0))) || - (LLFile::rename(tmp_filename, mProtectedDataFilename))) + try + { + // move the temporary file to the specified file location. + if((( (LLFile::isfile(mProtectedDataFilename) != 0) + && (LLFile::remove(mProtectedDataFilename) != 0))) + || (LLFile::rename(tmp_filename, mProtectedDataFilename))) + { + LL_WARNS() << "LLProtectedDataException(Could not overwrite protected data store)" << LL_ENDL; + LLFile::remove(tmp_filename); + + // EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData() + // Decided throwing an exception here was overkill until we figure out why this happens + //throw LLProtectedDataException("Could not overwrite protected data store"); + } + } + catch (...) { + LL_WARNS() << "LLProtectedDataException(Error renaming '" << tmp_filename + << "' to '" << mProtectedDataFilename << "')" << LL_ENDL; + // it's good practice to clean up any secure information on error + // (even though this file isn't really secure. Perhaps in the future + // it may be, however. LLFile::remove(tmp_filename); - // EXP-1825 crash in LLSecAPIBasicHandler::_writeProtectedData() + //crash in LLSecAPIBasicHandler::_writeProtectedData() // Decided throwing an exception here was overkill until we figure out why this happens - //throw LLProtectedDataException("Could not overwrite protected data store"); - LL_INFOS() << "LLProtectedDataException(Could not overwrite protected data store)" << LL_ENDL; + //throw LLProtectedDataException("Error writing Protected Data Store"); } } -- cgit v1.2.3 From 66bc5107863e8226e91818cd9d3c075d0514dbe5 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 2 Apr 2015 21:43:34 -0400 Subject: detect xml errors in parsing xml files and remove those files --- indra/llmessage/llavatarnamecache.cpp | 39 +++++++++++++++++---------------- indra/llmessage/llavatarnamecache.h | 2 +- indra/newview/llappviewer.cpp | 31 ++++++++++++++++---------- indra/newview/llnotificationstorage.cpp | 10 ++++++--- indra/newview/llviewertexturelist.cpp | 22 ++++++++++++++----- indra/newview/llviewertexturelist.h | 3 +-- 6 files changed, 65 insertions(+), 42 deletions(-) diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index d02a60b7b2..549708097a 100755 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -355,9 +355,7 @@ void LLAvatarNameCache::requestNamesViaCapability() if (!url.empty()) { - LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::requestNamesViaCapability requested " - << ids << " ids" - << LL_ENDL; + LL_INFOS("AvNameCache") << "LLAvatarNameCache::requestNamesViaCapability getting " << ids << " ids" << LL_ENDL; LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids)); } } @@ -381,8 +379,7 @@ void LLAvatarNameCache::legacyNameFetch(const LLUUID& agent_id, const std::string& full_name, bool is_group) { - LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::legacyNameFetch " - << "agent " << agent_id << " " + LL_DEBUGS("AvNameCache") << "LLAvatarNameCache agent " << agent_id << " " << "full name '" << full_name << "'" << ( is_group ? " [group]" : "" ) << LL_ENDL; @@ -411,7 +408,7 @@ void LLAvatarNameCache::requestNamesViaLegacy() // invoked below. This should never happen in practice. sPendingQueue[agent_id] = now; - LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::requestNamesViaLegacy agent " << agent_id << LL_ENDL; + LL_DEBUGS("AvNameCache") << "agent " << agent_id << LL_ENDL; gCacheName->get(agent_id, false, // legacy compatibility boost::bind(&LLAvatarNameCache::legacyNameCallback, _1, _2, _3)); @@ -429,12 +426,13 @@ void LLAvatarNameCache::cleanupClass() sCache.clear(); } -void LLAvatarNameCache::importFile(std::istream& istr) +bool LLAvatarNameCache::importFile(std::istream& istr) { LLSD data; if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(data, istr)) { - return; + LL_WARNS("AvNameCache") << "avatar name cache data xml parse failed" << LL_ENDL; + return false; } // by convention LLSD storage is a map @@ -450,17 +448,19 @@ void LLAvatarNameCache::importFile(std::istream& istr) av_name.fromLLSD( it->second ); sCache[agent_id] = av_name; } - LL_INFOS("AvNameCache") << "loaded " << sCache.size() << LL_ENDL; - + LL_INFOS("AvNameCache") << "LLAvatarNameCache loaded " << sCache.size() << LL_ENDL; // Some entries may have expired since the cache was stored, // but they will be flushed in the first call to eraseUnrefreshed // from LLAvatarNameResponder::idle + + return true; } void LLAvatarNameCache::exportFile(std::ostream& ostr) { LLSD agents; F64 max_unrefreshed = LLFrameTimer::getTotalSeconds() - MAX_UNREFRESHED_TIME; + LL_INFOS("AvNameCache") << "LLAvatarNameCache at exit cache has " << sCache.size() << LL_ENDL; cache_t::const_iterator it = sCache.begin(); for ( ; it != sCache.end(); ++it) { @@ -473,6 +473,7 @@ void LLAvatarNameCache::exportFile(std::ostream& ostr) agents[agent_id.asString()] = av_name.asLLSD(); } } + LL_INFOS("AvNameCache") << "LLAvatarNameCache returning " << agents.size() << LL_ENDL; LLSD data; data["agents"] = agents; LLSDSerialize::toPrettyXML(data, ostr); @@ -515,6 +516,7 @@ void LLAvatarNameCache::idle() } else { + LL_WARNS_ONCE("AvNameCache") << "LLAvatarNameCache still using legacy api" << LL_ENDL; requestNamesViaLegacy(); } } @@ -552,24 +554,26 @@ void LLAvatarNameCache::eraseUnrefreshed() if (!sLastExpireCheck || sLastExpireCheck < max_unrefreshed) { sLastExpireCheck = now; - + S32 expired = 0; for (cache_t::iterator it = sCache.begin(); it != sCache.end();) { const LLAvatarName& av_name = it->second; if (av_name.mExpires < max_unrefreshed) { - LL_DEBUGS("AvNameCache") << it->first + LL_DEBUGS("AvNameCacheExpired") << "LLAvatarNameCache " << it->first << " user '" << av_name.getAccountName() << "' " << "expired " << now - av_name.mExpires << " secs ago" << LL_ENDL; sCache.erase(it++); + expired++; } else { ++it; } } - LL_INFOS("AvNameCache") << sCache.size() << " cached avatar names" << LL_ENDL; + LL_INFOS("AvNameCache") << "LLAvatarNameCache expired " << expired << " cached avatar names, " + << sCache.size() << " remaining" << LL_ENDL; } } @@ -590,8 +594,7 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name) { if (!isRequestPending(agent_id)) { - LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::get " - << "refresh agent " << agent_id + LL_DEBUGS("AvNameCache") << "LLAvatarNameCache refresh agent " << agent_id << LL_ENDL; sAskQueue.insert(agent_id); } @@ -603,9 +606,7 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name) if (!isRequestPending(agent_id)) { - LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::get " - << "queue request for agent " << agent_id - << LL_ENDL; + LL_DEBUGS("AvNameCache") << "LLAvatarNameCache queue request for agent " << agent_id << LL_ENDL; sAskQueue.insert(agent_id); } @@ -734,7 +735,7 @@ bool LLAvatarNameCache::expirationFromCacheControl(const LLSD& headers, F64 *exp fromCacheControl = true; } } - LL_DEBUGS("AvNameCache") + LL_DEBUGS("AvNameCache") << "LLAvatarNameCache " << ( fromCacheControl ? "expires based on cache control " : "default expiration " ) << "in " << *expires - now << " seconds" << LL_ENDL; diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h index ea016b3125..5a10053a69 100755 --- a/indra/llmessage/llavatarnamecache.h +++ b/indra/llmessage/llavatarnamecache.h @@ -46,7 +46,7 @@ namespace LLAvatarNameCache void cleanupClass(); // Import/export the name cache to file. - void importFile(std::istream& istr); + bool importFile(std::istream& istr); void exportFile(std::ostream& ostr); // On the viewer, usually a simulator capabilitity. diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 4bf719ec31..dd6b2802cd 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4653,7 +4653,12 @@ void LLAppViewer::loadNameCache() llifstream name_cache_stream(filename); if(name_cache_stream.is_open()) { - LLAvatarNameCache::importFile(name_cache_stream); + if ( ! LLAvatarNameCache::importFile(name_cache_stream)) + { + LL_WARNS("AppInit") << "removing invalid '" << filename << "'" << LL_ENDL; + name_cache_stream.close(); + LLFile::remove(filename); + } } if (!gCacheName) return; @@ -4668,7 +4673,7 @@ void LLAppViewer::loadNameCache() } void LLAppViewer::saveNameCache() - { +{ // display names cache std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml"); @@ -4676,16 +4681,18 @@ void LLAppViewer::saveNameCache() if(name_cache_stream.is_open()) { LLAvatarNameCache::exportFile(name_cache_stream); -} - - if (!gCacheName) return; - - std::string name_cache; - name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache"); - llofstream cache_file(name_cache); - if(cache_file.is_open()) - { - gCacheName->exportFile(cache_file); + } + + // real names cache + if (gCacheName) + { + std::string name_cache; + name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache"); + llofstream cache_file(name_cache); + if(cache_file.is_open()) + { + gCacheName->exportFile(cache_file); + } } } diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp index e9970de58c..3418b33d37 100755 --- a/indra/newview/llnotificationstorage.cpp +++ b/indra/newview/llnotificationstorage.cpp @@ -123,14 +123,18 @@ bool LLNotificationStorage::readNotifications(LLSD& pNotificationData, bool is_n { LLPointer parser = new LLSDXMLParser(); didFileRead = (parser->parse(notifyFile, pNotificationData, LLSDSerialize::SIZE_UNLIMITED) >= 0); + notifyFile.close(); + if (!didFileRead) { LL_WARNS("LLNotificationStorage") << "Failed to parse open notifications from file '" << mFileName - << "'" << LL_ENDL; + << "'" << LL_ENDL; + LLFile::remove(filename); + LL_WARNS("LLNotificationStorage") << "Removed invalid open notifications file '" << mFileName + << "'" << LL_ENDL; } } - - LL_INFOS("LLNotificationStorage") << "ending read '" << filename << "'" << LL_ENDL; + if (!didFileRead) { if(is_new_filename) diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 8c27ddc63c..0865d90005 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -165,7 +165,7 @@ void LLViewerTextureList::doPreloadImages() static std::string get_texture_list_name() { - return std::string("texture_list_") + gSavedSettings.getString("LoginLocation") + ".xml"; + return gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "texture_list_" + gSavedSettings.getString("LoginLocation") + ".xml"); } void LLViewerTextureList::doPrefetchImages() @@ -178,13 +178,22 @@ void LLViewerTextureList::doPrefetchImages() // Pre-fetch textures from last logout LLSD imagelist; - std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name()); + std::string filename = get_texture_list_name(); llifstream file; file.open(filename); if (file.is_open()) { - LLSDSerialize::fromXML(imagelist, file); - } + if ( ! LLSDSerialize::fromXML(imagelist, file) ) + { + file.close(); + LL_WARNS() << "XML parse error reading texture list '" << filename << "'" << LL_ENDL; + LL_WARNS() << "Removing invalid texture list '" << filename << "'" << LL_ENDL; + LLFile::remove(filename); + return; + } + file.close(); + } + S32 texture_count = 0; for (LLSD::array_iterator iter = imagelist.beginArray(); iter != imagelist.endArray(); ++iter) { @@ -198,10 +207,12 @@ void LLViewerTextureList::doPrefetchImages() LLViewerFetchedTexture* image = LLViewerTextureManager::getFetchedTexture(uuid, FTT_DEFAULT, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, texture_type); if (image) { + texture_count += 1; image->addTextureStats((F32)pixel_area); } } } + LL_DEBUGS() << "fetched " << texture_count << " images from " << filename << LL_ENDL; } /////////////////////////////////////////////////////////////////////////////// @@ -261,9 +272,10 @@ void LLViewerTextureList::shutdown() if (count > 0 && !gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "").empty()) { - std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, get_texture_list_name()); + std::string filename = get_texture_list_name(); llofstream file; file.open(filename); + LL_DEBUGS() << "saving " << imagelist.size() << " image list entries" << LL_ENDL; LLSDSerialize::toPrettyXML(imagelist, file); } diff --git a/indra/newview/llviewertexturelist.h b/indra/newview/llviewertexturelist.h index 2f84d0947a..fbbfe9a7d4 100755 --- a/indra/newview/llviewertexturelist.h +++ b/indra/newview/llviewertexturelist.h @@ -61,8 +61,6 @@ typedef void (*LLImageCallback)(BOOL success, class LLViewerTextureList { - LOG_CLASS(LLViewerTextureList); - friend class LLTextureView; friend class LLViewerTextureManager; friend class LLLocalBitmap; @@ -206,6 +204,7 @@ private: private: static S32 sNumImages; static void (*sUUIDCallback)(void**, const LLUUID &); + LOG_CLASS(LLViewerTextureList); }; class LLUIImageList : public LLImageProviderInterface, public LLSingleton -- cgit v1.2.3 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/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 +-- .../viewer_components/updater/llupdaterservice.cpp | 8 +- 47 files changed, 175 insertions(+), 282 deletions(-) diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index 41c06f4368..5ca9f55ac8 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 8119b14887..2100989316 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 304d702979..77a9657306 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 44a1e42fa5..bd750b8c3c 100755 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -86,12 +86,6 @@ public: 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 @@ protected: #endif }; - +typedef std::ifstream llifstream; +typedef std::ofstream llofstream; +#if 0 /* @TBDeleted */ /** * @brief Controlling input for files. * @@ -234,34 +230,6 @@ public: 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(BUFSIZ)); - size_t _Size = static_cast(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(BUFSIZ)); - size_t _Size = static_cast(1)); -#endif -#endif // llstream_LLFILE - /** * @brief The destructor does nothing. * @@ -271,17 +239,6 @@ public: 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(&_M_filebuf); } -#endif // llstream_LLFILE - /** * @brief Wrapper to test for an open file. * @return @c rdbuf()->is_open() @@ -324,7 +281,7 @@ private: * 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 @@ public: 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(BUFSIZ)); - size_t _Size = static_cast(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(BUFSIZ)); - size_t _Size = static_cast(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(&_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 @@ private: */ 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 7c87c5a1a0..a9b1cdf4f6 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 617969ab2a..f3b8999883 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 7fd7860707..7dde1fcd69 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 ecdcd95d29..16df27bb8e 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 0b9d136910..41adc7be9a 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 200116337d..f8db3dded2 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 f8b2c8f5a6..64e79d6767 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 392e7f1091..cf2e42f95c 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 250372da5b..0db4281059 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 c5a4354f32..9fe6a542b4 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 e64368e8d7..6572edead3 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 *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 598a802d67..4e3d0ab392 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 c273773c9b..2b691ffbb1 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 44589f0d57..cfc445f998 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 dd6b2802cd..9668da2522 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 746b541f9d..281e591b48 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 06164e9597..1819fc74ee 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 3da162c5ef..fc9e85caf8 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 af84aea6a6..ea39f812fd 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 7ac3ac2f61..b342d8fdf3 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 ec905558aa..b9113d265a 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 54c7b4c37d..5124dae147 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 680b35b550..162d6e003e 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 cadbc16f1e..7ddacf3033 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 89c898001f..cc8c3edd51 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 37273a7793..17c0b226d0 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 7b4bf63740..0ea05a03d6 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 588c585f52..40516f9bbb 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 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 a763d42a8d..802dff1ead 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -83,7 +83,7 @@ public: 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 f88f88a4fa..8a5704939a 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 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; } diff --git a/indra/newview/llurlwhitelist.cpp b/indra/newview/llurlwhitelist.cpp index 8211ce12f6..3a7285974e 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 c758bbcc9e..509227c683 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 74b8e693c4..db49fcb0d8 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 0865d90005..378bb18ecd 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 962cdf0268..e24884fe81 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 c854e1fc66..374792193c 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 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 e9b0baf612..88079c5d26 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 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 91ea10d43d..2b6d88efef 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 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 8088ce8558..df2151b1b1 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 57e423e550..aa23699de0 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 c42112af80..f868e5cc2c 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 cb3be5bbdc..c152493a51 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()) { -- 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/llappearance/llwearable.cpp | 4 +- indra/llcommon/llerror.cpp | 4 +- indra/llcommon/llfile.cpp | 239 --------------------- indra/llcommon/llfile.h | 162 -------------- 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/llinventory/llinventory.cpp | 2 +- indra/llmessage/llhttpclient.cpp | 2 +- indra/llmessage/llmessageconfig.cpp | 2 +- indra/llmessage/llservicebuilder.cpp | 2 +- indra/llrender/llpostprocess.cpp | 4 +- indra/llui/llspellcheck.cpp | 16 +- indra/llui/lltextparser.cpp | 4 +- indra/llui/llviewereventrecorder.h | 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/llautoreplace.cpp | 6 +- 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/llfloaterautoreplacesettings.cpp | 4 +- indra/newview/llfloatermodelpreview.cpp | 4 +- indra/newview/llfloaterspellchecksettings.cpp | 4 +- indra/newview/lllocationhistory.cpp | 4 +- indra/newview/lllogchat.cpp | 2 +- indra/newview/llnotificationstorage.cpp | 4 +- indra/newview/llpanellogin.cpp | 2 +- indra/newview/llpanelmaininventory.cpp | 4 +- indra/newview/llsearchhistory.cpp | 4 +- indra/newview/llsechandler_basic.cpp | 10 +- indra/newview/llsyntaxid.cpp | 4 +- indra/newview/llteleporthistorystorage.cpp | 4 +- indra/newview/llurlhistory.cpp | 4 +- indra/newview/llurlwhitelist.cpp | 4 +- indra/newview/llviewermedia.cpp | 4 +- indra/newview/llviewernetwork.cpp | 2 +- indra/newview/llviewerobject.cpp | 2 +- indra/newview/llviewertexturelist.cpp | 4 +- indra/newview/llvoiceclient.cpp | 4 +- indra/newview/llwaterparammanager.cpp | 4 +- indra/newview/llwearablelist.cpp | 2 +- indra/newview/llwldaycycle.cpp | 4 +- indra/newview/llwlparammanager.cpp | 4 +- indra/newview/tests/llsechandler_basic_test.cpp | 4 +- indra/newview/tests/llslurl_test.cpp | 6 +- indra/newview/tests/llviewernetwork_test.cpp | 4 +- indra/test/llmessageconfig_tut.cpp | 2 +- indra/test/message_tut.cpp | 2 +- indra/viewer_components/updater/CMakeLists.txt | 4 +- .../updater/llupdatedownloader.cpp | 10 +- .../viewer_components/updater/llupdaterservice.cpp | 8 +- 59 files changed, 124 insertions(+), 525 deletions(-) diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index 5ca9f55ac8..1bbe878bba 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.c_str(), std::ios_base::out | std::ios_base::trunc | std::ios_base::binary); + std::ofstream 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.c_str(), std::ios_base::in | std::ios_base::binary); + std::ifstream 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 2100989316..3cb81b4e47 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -135,7 +135,7 @@ namespace { } private: - llofstream mFile; + std::ofstream mFile; }; @@ -335,7 +335,7 @@ namespace LLSD configuration; { - llifstream file(filename().c_str()); + std::ifstream 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 77a9657306..ab432a923d 100755 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -865,242 +865,3 @@ int llstdio_filebuf::sync() } #endif -#if 0 // @TBDeleted -/************** input file stream ********************************/ - - -llifstream::llifstream() : _M_filebuf(), -#if LL_WINDOWS - std::istream(&_M_filebuf) {} -#else - std::istream() -{ - this->init(&_M_filebuf); -} -#endif - -// explicit -llifstream::llifstream(const std::string& _Filename, - ios_base::openmode _Mode) : _M_filebuf(), -#if LL_WINDOWS - std::istream(&_M_filebuf) -{ - llutf16string wideName = utf8str_to_utf16str( _Filename ); - if (_M_filebuf.open(wideName.c_str(), _Mode | ios_base::in) == 0) - { - _Myios::setstate(ios_base::failbit); - } -} -#else - std::istream() -{ - this->init(&_M_filebuf); - this->open(_Filename.c_str(), _Mode | ios_base::in); -} -#endif - -// explicit -llifstream::llifstream(const char* _Filename, - ios_base::openmode _Mode) : _M_filebuf(), -#if LL_WINDOWS - std::istream(&_M_filebuf) -{ - llutf16string wideName = utf8str_to_utf16str( _Filename ); - if (_M_filebuf.open(wideName.c_str(), _Mode | ios_base::in) == 0) - { - _Myios::setstate(ios_base::failbit); - } -} -#else - std::istream() -{ - this->init(&_M_filebuf); - this->open(_Filename, _Mode | ios_base::in); -} -#endif - - -bool llifstream::is_open() const -{ // test if C stream has been opened - return _M_filebuf.is_open(); -} - -void llifstream::open(const char* _Filename, ios_base::openmode _Mode) -{ // open a C stream with specified mode - -#if LL_WINDOWS - llutf16string wideName = utf8str_to_utf16str( _Filename ); - if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::in) == 0) - { - _Myios::setstate(ios_base::failbit); - } - else - { - _Myios::clear(); - } -#else - if (_M_filebuf.open(_Filename, _Mode | ios_base::in) == 0) - { - this->setstate(ios_base::failbit); - } - else - { - this->clear(); - } -#endif -} - -void llifstream::close() -{ // close the C stream - if (_M_filebuf.close() == 0) - { -#if LL_WINDOWS - _Myios::setstate(ios_base::failbit); -#else - this->setstate(ios_base::failbit); -#endif - } -} - - -/************** output file stream ********************************/ - - -llofstream::llofstream() : _M_filebuf(), -#if LL_WINDOWS - std::ofstream(&_M_filebuf) {} -#else - std::ofstream() -{ - this->init(&_M_filebuf); -} -#endif - -// explicit -llofstream::llofstream(const std::string& _Filename, - ios_base::openmode _Mode) : _M_filebuf(), -#if LL_WINDOWS - std::ofstream(&_M_filebuf) -{ - llutf16string wideName = utf8str_to_utf16str( _Filename ); - if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) - { - _Myios::setstate(ios_base::failbit); - } -} -#else - std::ofstream() -{ - this->init(&_M_filebuf); - this->open(_Filename.c_str(), _Mode | ios_base::out); -} -#endif - -// explicit -llofstream::llofstream(const char* _Filename, - ios_base::openmode _Mode) : _M_filebuf(), -#if LL_WINDOWS - std::ofstream(&_M_filebuf) -{ - llutf16string wideName = utf8str_to_utf16str( _Filename ); - if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) - { - _Myios::setstate(ios_base::failbit); - } -} -#else - std::ofstream() -{ - this->init(&_M_filebuf); - this->open(_Filename, _Mode | ios_base::out); -} -#endif - -bool llofstream::is_open() const -{ // test if C stream has been opened - return _M_filebuf.is_open(); -} - -void llofstream::open(const char* _Filename, ios_base::openmode _Mode) -{ // open a C stream with specified mode -#if LL_WINDOWS - llutf16string wideName = utf8str_to_utf16str( _Filename ); - if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) - { - _Myios::setstate(ios_base::failbit); - } - else - { - _Myios::clear(); - } -#else - if (_M_filebuf.open(_Filename, _Mode | ios_base::out) == 0) - { - this->setstate(ios_base::failbit); - } - else - { - this->clear(); - } -#endif -} - -void llofstream::close() -{ // close the C stream - if (_M_filebuf.close() == 0) - { -#if LL_WINDOWS - _Myios::setstate(ios_base::failbit); -#else - this->setstate(ios_base::failbit); -#endif - } -} - -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) -{ - if(!ifstr.is_open()) return 0; - std::streampos pos_old = ifstr.tellg(); - ifstr.seekg(0, ios_base::beg); - std::streampos pos_beg = ifstr.tellg(); - ifstr.seekg(0, ios_base::end); - std::streampos pos_end = ifstr.tellg(); - ifstr.seekg(pos_old, ios_base::beg); - return pos_end - pos_beg; -} - -std::streamsize llofstream_size(llofstream& ofstr) -{ - if(!ofstr.is_open()) return 0; - std::streampos pos_old = ofstr.tellp(); - ofstr.seekp(0, ios_base::beg); - std::streampos pos_beg = ofstr.tellp(); - ofstr.seekp(0, ios_base::end); - std::streampos pos_end = ofstr.tellp(); - ofstr.seekp(pos_old, ios_base::beg); - return pos_end - pos_beg; -} - - -#endif // @TBDeleted diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index bd750b8c3c..e310d47325 100755 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -192,166 +192,4 @@ protected: #endif }; -typedef std::ifstream llifstream; -typedef std::ofstream llofstream; -#if 0 /* @TBDeleted */ -/** - * @brief Controlling input for files. - * - * This class supports reading from named files, using the inherited - * functions from std::basic_istream. To control the associated - * sequence, an instance of std::basic_filebuf (or a platform-specific derivative) - * 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 llifstream : public std::istream -{ - // input stream associated with a C stream -public: - // Constructors: - /** - * @brief Default constructor. - * - * Initializes @c sb using its default constructor, and passes - * @c &sb to the base class initializer. Does not open any files - * (you haven't given it a filename to open). - */ - llifstream(); - - /** - * @brief Create an input file stream. - * @param Filename String specifying the filename. - * @param Mode Open file in specified mode (see std::ios_base). - * - * @c ios_base::in is automatically included in @a mode. - */ - explicit llifstream(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::in); - explicit llifstream(const char* _Filename, - ios_base::openmode _Mode = ios_base::in); - - /** - * @brief The destructor does nothing. - * - * The file is closed by the filebuf object, not the formatting - * stream. - */ - virtual ~llifstream() {} - - // Members: - /** - * @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. - * @param Node The open mode flags. - * - * Calls @c llstdio_filebuf::open(s,mode|in). If that function - * fails, @c failbit is set in the stream's error state. - */ - void open(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::in) - { open(_Filename.c_str(), _Mode); } - void open(const char* _Filename, - ios_base::openmode _Mode = ios_base::in); - - /** - * @brief Close the file. - * - * Calls @c llstdio_filebuf::close(). If that function - * fails, @c failbit is set in the stream's error state. - */ - void close(); - -private: - llstdio_filebuf _M_filebuf; -}; - - -/** - * @brief Controlling output for files. - * - * This class supports writing to named files, using the inherited - * functions from std::basic_ostream. To control the associated - * sequence, an instance of std::basic_filebuf (or a platform-specific derivative) - * 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::ofstream -{ -public: - // Constructors: - /** - * @brief Default constructor. - * - * Initializes @c sb using its default constructor, and passes - * @c &sb to the base class initializer. Does not open any files - * (you haven't given it a filename to open). - */ - llofstream(); - - /** - * @brief Create an output file stream. - * @param Filename String specifying the filename. - * @param Mode Open file in specified mode (see std::ios_base). - * - * @c ios_base::out|ios_base::trunc is automatically included in - * @a mode. - */ - explicit llofstream(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::out|ios_base::trunc); - explicit llofstream(const char* _Filename, - ios_base::openmode _Mode = ios_base::out|ios_base::trunc); - - /** - * @brief The destructor does nothing. - * - * The file is closed by the filebuf object, not the formatting - * stream. - */ - virtual ~llofstream(); - - // Members: - /** - * @brief Opens an external file. - * @param Filename The name of the file. - * @param Node The open mode flags. - * - * Calls @c llstdio_filebuf::open(s,mode|out). If that function - * fails, @c failbit is set in the stream's error state. - */ - void open(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::out|ios_base::trunc) - { open(_Filename.c_str(), _Mode); } - void open(const char* _Filename, - ios_base::openmode _Mode = ios_base::out|ios_base::trunc); - - /** - * @brief Close the file. - * - * Calls @c llstdio_filebuf::close(). If that function - * fails, @c failbit is set in the stream's error state. - */ - void close(); - -private: - llstdio_filebuf _M_filebuf; -}; - - -/** - * @breif filesize helpers. - * - * The file size helpers are not considered particularly efficient, - * and should only be used for config files and the like -- not in a - * loop. - */ -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 a9b1cdf4f6..f955194009 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().c_str()); + std::ifstream file(filename().c_str()); LLSD config; if (file.is_open()) { diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index f3b8999883..227f81e88f 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.c_str(), llifstream::binary); + std::ifstream ifs(filename.c_str(), std::ifstream::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 7dde1fcd69..049aa4d135 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.c_str()); + std::ifstream 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.c_str()); + std::ofstream ofile(filename.c_str()); if (!LLSDSerialize::toXML(data,ofile)) { diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 16df27bb8e..ef92395d6d 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.c_str(), llifstream::binary); + std::ifstream ifs(tname.c_str(), std::ifstream::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.c_str(), llifstream::binary); + std::ifstream ifs(name.c_str(), std::ifstream::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 41adc7be9a..92fbc8ad73 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.c_str()); + std::ifstream filter_xml(file_path.c_str()); if (filter_xml.is_open()) { // Load and parse the file diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 11647c5518..9a1aeca3cb 100755 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -229,7 +229,7 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) } // exportFile should be replaced with exportLegacyStream -// not sure whether exportLegacyStream(llofstream(fp)) would work, fp may need to get icramented... +// not sure whether exportLegacyStream(std::ofstream(fp)) would work, fp may need to get icramented... BOOL LLInventoryObject::exportFile(LLFILE* fp, BOOL) const { std::string uuid_str; diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index f8db3dded2..a36b3ff3c8 100755 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -157,7 +157,7 @@ namespace { LLBufferStream ostream(channels, buffer.get()); - llifstream fstream(mFilename.c_str(), std::iostream::binary | std::iostream::out); + std::ifstream 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 64e79d6767..e91051b73e 100755 --- a/indra/llmessage/llmessageconfig.cpp +++ b/indra/llmessage/llmessageconfig.cpp @@ -96,7 +96,7 @@ bool LLMessageConfigFile::loadFile() { LLSD data; { - llifstream file(filename().c_str()); + std::ifstream file(filename().c_str()); if (file.is_open()) { diff --git a/indra/llmessage/llservicebuilder.cpp b/indra/llmessage/llservicebuilder.cpp index cf2e42f95c..34ab891830 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.c_str(), std::ios::binary); + std::ifstream service_file(service_filename.c_str(), std::ios::binary); if(service_file.is_open()) { LLSD service_data; diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index b6ea5aa7f1..7f0c9e9533 100755 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -66,7 +66,7 @@ LLPostProcess::LLPostProcess(void) : std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); LL_DEBUGS("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL; - llifstream effectsXML(pathName); + std::ifstream effectsXML(pathName); if (effectsXML) { @@ -153,7 +153,7 @@ void LLPostProcess::saveEffect(std::string const & effectName) std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); //LL_INFOS() << "Saving PostProcess Effects settings to " << pathName << LL_ENDL; - llofstream effectsXML(pathName); + std::ofstream effectsXML(pathName); LLPointer formatter = new LLSDXMLFormatter(); diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp index 0db4281059..e6551a84c3 100755 --- a/indra/llui/llspellcheck.cpp +++ b/indra/llui/llspellcheck.cpp @@ -145,13 +145,13 @@ void LLSpellChecker::refreshDictionaryMap() // Load dictionary information (file name, friendly name, ...) std::string user_filename(user_path + DICT_FILE_MAIN); - llifstream user_file(user_filename.c_str(), std::ios::binary); + std::ifstream 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()) ) { std::string app_filename(app_path + DICT_FILE_MAIN); - llifstream app_file(app_filename.c_str(), std::ios::binary); + std::ifstream 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()) ) @@ -161,7 +161,7 @@ void LLSpellChecker::refreshDictionaryMap() } // Load user installed dictionary information - llifstream custom_file(user_filename.c_str(), std::ios::binary); + std::ifstream custom_file(user_filename.c_str(), std::ios::binary); if (custom_file.is_open()) { LLSD custom_dict_map; @@ -217,7 +217,7 @@ void LLSpellChecker::addToDictFile(const std::string& dict_path, const std::stri if (gDirUtilp->fileExists(dict_path)) { - llifstream file_in(dict_path.c_str(), std::ios::in); + std::ifstream file_in(dict_path.c_str(), std::ios::in); if (file_in.is_open()) { std::string word; int line_num = 0; @@ -240,7 +240,7 @@ void LLSpellChecker::addToDictFile(const std::string& dict_path, const std::stri word_list.push_back(word); - llofstream file_out(dict_path.c_str(), std::ios::out | std::ios::trunc); + std::ofstream file_out(dict_path.c_str(), std::ios::out | std::ios::trunc); if (file_out.is_open()) { file_out << word_list.size() << std::endl; @@ -354,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).c_str(), std::ios::in); + std::ifstream file_in((user_path + DICT_FILE_IGNORE).c_str(), std::ios::in); if (file_in.is_open()) { std::string word; int idxLine = 0; @@ -466,7 +466,7 @@ LLSD LLSpellChecker::loadUserDictionaryMap() { LLSD dict_map; std::string dict_filename(getDictionaryUserPath() + DICT_FILE_USER); - llifstream dict_file(dict_filename.c_str(), std::ios::binary); + std::ifstream dict_file(dict_filename.c_str(), std::ios::binary); if (dict_file.is_open()) { LLSDSerialize::fromXMLDocument(dict_map, dict_file); @@ -478,7 +478,7 @@ LLSD LLSpellChecker::loadUserDictionaryMap() // static void LLSpellChecker::saveUserDictionaryMap(const LLSD& dict_map) { - llofstream dict_file((getDictionaryUserPath() + DICT_FILE_USER).c_str(), std::ios::trunc); + std::ofstream 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/lltextparser.cpp b/indra/llui/lltextparser.cpp index 0b36241da0..086d937753 100755 --- a/indra/llui/lltextparser.cpp +++ b/indra/llui/lltextparser.cpp @@ -211,7 +211,7 @@ void LLTextParser::loadKeywords() std::string filename=getFileName(); if (!filename.empty()) { - llifstream file; + std::ifstream file; file.open(filename.c_str()); if (file.is_open()) { @@ -231,7 +231,7 @@ bool LLTextParser::saveToDisk(LLSD highlights) LL_WARNS() << "LLTextParser::saveToDisk() no valid user directory." << LL_ENDL; return FALSE; } - llofstream file; + std::ofstream file; file.open(filename.c_str()); LLSDSerialize::toPrettyXML(mHighlights, file); file.close(); diff --git a/indra/llui/llviewereventrecorder.h b/indra/llui/llviewereventrecorder.h index 375efcc3de..fb00572817 100644 --- a/indra/llui/llviewereventrecorder.h +++ b/indra/llui/llviewereventrecorder.h @@ -79,7 +79,7 @@ class LLViewerEventRecorder : public LLSingleton bool logEvents; std::string mLogFilename; - llofstream mLog; + std::ofstream mLog; private: diff --git a/indra/llvfs/llpidlock.cpp b/indra/llvfs/llpidlock.cpp index 6572edead3..26cbce1028 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.c_str()); + std::ofstream ofile(mLockName.c_str()); if (!LLSDSerialize::toXML(pids,ofile)) { @@ -119,7 +119,7 @@ bool LLPidLockFile::requestLock(LLNameTable *name_table, bool autosave, LLSD out_pids; out_pids.append( (LLSD::Integer)mPID ); - llifstream ifile(mLockName.c_str()); + std::ifstream 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.c_str()); + std::ifstream 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 4e3d0ab392..079545d31f 100755 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -832,7 +832,7 @@ U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only ++num_saved; } } - llofstream file; + std::ofstream file; file.open(filename.c_str()); if (file.is_open()) { @@ -852,7 +852,7 @@ U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_values, bool save_values) { LLSD settings; - llifstream infile; + std::ifstream infile; infile.open(filename.c_str()); if(!infile.is_open()) { diff --git a/indra/llxml/tests/llcontrol_test.cpp b/indra/llxml/tests/llcontrol_test.cpp index 2b691ffbb1..bc17a88f7c 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.c_str()); + std::ofstream 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 cfc445f998..4b3b0e42e0 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.c_str()); + std::ifstream file(filename.c_str()); if (!file) { @@ -125,7 +125,7 @@ void LLAgentPilot::loadXML(const std::string& filename) return; } - llifstream file(filename.c_str()); + std::ifstream file(filename.c_str()); if (!file) { @@ -167,7 +167,7 @@ void LLAgentPilot::save() void LLAgentPilot::saveTxt(const std::string& filename) { - llofstream file; + std::ofstream file; file.open(filename.c_str()); if (!file) @@ -190,7 +190,7 @@ void LLAgentPilot::saveTxt(const std::string& filename) void LLAgentPilot::saveXML(const std::string& filename) { - llofstream file; + std::ofstream file; file.open(filename.c_str()); if (!file) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 9668da2522..b2c74854ff 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->c_str()); + std::ofstream 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.c_str(), std::ios_base::binary); + std::ofstream 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.c_str()); + std::ifstream 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.c_str()); + std::ifstream 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.c_str()); + std::ofstream 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.c_str()); + std::ofstream cache_file(name_cache.c_str()); if(cache_file.is_open()) { gCacheName->exportFile(cache_file); diff --git a/indra/newview/llautoreplace.cpp b/indra/newview/llautoreplace.cpp index dd9354fe3a..62e32eac00 100755 --- a/indra/newview/llautoreplace.cpp +++ b/indra/newview/llautoreplace.cpp @@ -148,7 +148,7 @@ void LLAutoReplace::loadFromSettings() if(gDirUtilp->fileExists(filename)) { LLSD userSettings; - llifstream file; + std::ifstream file; file.open(filename.c_str()); if (file.is_open()) { @@ -173,7 +173,7 @@ void LLAutoReplace::loadFromSettings() if(gDirUtilp->fileExists(defaultName)) { LLSD appDefault; - llifstream file; + std::ifstream file; file.open(defaultName.c_str()); if (file.is_open()) { @@ -209,7 +209,7 @@ void LLAutoReplace::loadFromSettings() void LLAutoReplace::saveToUserSettings() { std::string filename=getUserSettingsFileName(); - llofstream file; + std::ofstream file; file.open(filename.c_str()); LLSDSerialize::toPrettyXML(mSettings.asLLSD(), file); file.close(); diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp index 281e591b48..fd96e65edd 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.c_str()); + std::ifstream 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.c_str()); + std::ofstream 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 1819fc74ee..9d4f7f6dd8 100755 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -621,7 +621,7 @@ void LLControlGroupCLP::configure(const std::string& config_filename, LLControlG // members of a control group. LLSD clpConfigLLSD; - llifstream input_stream; + std::ifstream input_stream; 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 fc9e85caf8..4c8a4ece70 100755 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -1469,7 +1469,7 @@ void LLFavoritesOrderStorage::destroyClass() std::string old_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); - llifstream file; + std::ifstream file; file.open(old_filename.c_str()); if (file.is_open()) { @@ -1507,7 +1507,7 @@ void LLFavoritesOrderStorage::load() std::string filename = getSavedOrderFileName(); LLSD settings_llsd; - llifstream file; + std::ifstream file; file.open(filename.c_str()); if (file.is_open()) { @@ -1541,7 +1541,7 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs() std::string filename = getStoredFavoritesFilename(); if (!filename.empty()) { - llifstream in_file; + std::ifstream in_file; in_file.open(filename.c_str()); LLSD fav_llsd; if (in_file.is_open()) @@ -1588,7 +1588,7 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs() // as we'll compare it with the stored credentials in the login panel. fav_llsd[av_name.getUserName()] = user_llsd; - llofstream file; + std::ofstream file; file.open(filename.c_str()); if ( file.is_open() ) { @@ -1613,7 +1613,7 @@ void LLFavoritesOrderStorage::removeFavoritesRecordOfUser() if (!filename.empty()) { LLSD fav_llsd; - llifstream file; + std::ifstream file; file.open(filename.c_str()); if (file.is_open()) { @@ -1630,7 +1630,7 @@ void LLFavoritesOrderStorage::removeFavoritesRecordOfUser() fav_llsd.erase(av_name.getUserName()); } - llofstream out_file; + std::ofstream out_file; out_file.open(filename.c_str()); if ( out_file.is_open() ) { @@ -1686,7 +1686,7 @@ void LLFavoritesOrderStorage::save() settings_llsd[iter->first.asString()] = iter->second; } - llofstream file; + std::ofstream file; file.open(filename.c_str()); if ( file.is_open() ) { diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index ea39f812fd..12afb552eb 100755 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -326,7 +326,7 @@ bool LLFeatureManager::parseFeatureTable(std::string filename) { LL_INFOS("RenderInit") << "Attempting to parse feature table from " << filename << LL_ENDL; - llifstream file; + std::ifstream file; std::string name; U32 version; diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index b342d8fdf3..5529111b7f 100755 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -154,7 +154,7 @@ BOOL LLFloaterAbout::postBuild() // Get the names of contributors, extracted from .../doc/contributions.txt by viewer_manifest.py at build time std::string contributors_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"contributors.txt"); - llifstream contrib_file; + std::ifstream contrib_file; std::string contributors; contrib_file.open(contributors_path.c_str()); /* Flawfinder: ignore */ if (contrib_file.is_open()) @@ -172,7 +172,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; + std::ifstream licenses_file; licenses_file.open(licenses_path.c_str()); /* Flawfinder: ignore */ if (licenses_file.is_open()) { diff --git a/indra/newview/llfloaterautoreplacesettings.cpp b/indra/newview/llfloaterautoreplacesettings.cpp index 6e56e929df..a16ecf2a80 100755 --- a/indra/newview/llfloaterautoreplacesettings.cpp +++ b/indra/newview/llfloaterautoreplacesettings.cpp @@ -353,7 +353,7 @@ void LLFloaterAutoReplaceSettings::onImportList() LLFilePicker& picker = LLFilePicker::instance(); if( picker.getOpenFile( LLFilePicker::FFLOAD_XML) ) { - llifstream file; + std::ifstream file; file.open(picker.getFirstFile().c_str()); LLSD newList; if (file.is_open()) @@ -545,7 +545,7 @@ void LLFloaterAutoReplaceSettings::onExportList() LLFilePicker& picker = LLFilePicker::instance(); if( picker.getSaveFile( LLFilePicker::FFSAVE_XML, listFileName) ) { - llofstream file; + std::ofstream file; file.open(picker.getFirstFile().c_str()); LLSDSerialize::toPrettyXML(*list, file); file.close(); diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index b9113d265a..e3ca48e4ae 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.c_str(), std::ifstream::in | std::ifstream::binary); + std::ifstream 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.c_str(), std::ios_base::out | std::ios_base::binary); + std::ofstream 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 5124dae147..63346f42ef 100755 --- a/indra/newview/llfloaterspellchecksettings.cpp +++ b/indra/newview/llfloaterspellchecksettings.cpp @@ -351,7 +351,7 @@ void LLFloaterSpellCheckerImport::onBtnOK() LLSD custom_dict_map; std::string custom_filename(LLSpellChecker::getDictionaryUserPath() + "user_dictionaries.xml"); - llifstream custom_file_in(custom_filename.c_str()); + std::ifstream custom_file_in(custom_filename.c_str()); if (custom_file_in.is_open()) { LLSDSerialize::fromXMLDocument(custom_dict_map, custom_file_in); @@ -373,7 +373,7 @@ void LLFloaterSpellCheckerImport::onBtnOK() custom_dict_map.append(custom_dict_info); } - llofstream custom_file_out(custom_filename.c_str(), std::ios::trunc); + std::ofstream 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 162d6e003e..57f53bd0d9 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.c_str()); + std::ofstream 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.c_str()); + std::ifstream file(resolved_filename.c_str()); if (!file.is_open()) { diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 7ddacf3033..8585fa6078 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).c_str(), std::ios_base::app); + std::ofstream 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/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp index 3418b33d37..315084788e 100755 --- a/indra/newview/llnotificationstorage.cpp +++ b/indra/newview/llnotificationstorage.cpp @@ -87,7 +87,7 @@ LLNotificationStorage::~LLNotificationStorage() bool LLNotificationStorage::writeNotifications(const LLSD& pNotificationData) const { - llofstream notifyFile(mFileName.c_str()); + std::ofstream notifyFile(mFileName.c_str()); bool didFileOpen = notifyFile.is_open(); if (!didFileOpen) @@ -113,7 +113,7 @@ bool LLNotificationStorage::readNotifications(LLSD& pNotificationData, bool is_n pNotificationData.clear(); - llifstream notifyFile(filename.c_str()); + std::ifstream notifyFile(filename.c_str()); didFileRead = notifyFile.is_open(); if (!didFileRead) { diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index cc8c3edd51..8b9cd9c88a 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -307,7 +307,7 @@ void LLPanelLogin::addFavoritesToStartLocation() updateLoginButtons(); LLSD fav_llsd; - llifstream file; + std::ifstream file; file.open(filename.c_str()); if (!file.is_open()) { diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 17c0b226d0..87f27ea8ef 100755 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -162,7 +162,7 @@ BOOL LLPanelMainInventory::postBuild() // Now load the stored settings from disk, if available. 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()); + std::ifstream file(filterSaveName.c_str()); LLSD savedFilterState; if (file.is_open()) { @@ -243,7 +243,7 @@ LLPanelMainInventory::~LLPanelMainInventory( void ) } std::string filterSaveName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME)); - llofstream filtersFile(filterSaveName.c_str()); + std::ofstream filtersFile(filterSaveName.c_str()); if(!LLSDSerialize::toPrettyXML(filterRoot, filtersFile)) { LL_WARNS() << "Could not write to filters save file " << filterSaveName << LL_ENDL; diff --git a/indra/newview/llsearchhistory.cpp b/indra/newview/llsearchhistory.cpp index 0ea05a03d6..0bc88590da 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.c_str()); + std::ifstream 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.c_str()); + std::ofstream 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 40516f9bbb..c904b95666 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.c_str(), std::ios_base::binary); + std::ofstream file_store(mFilename.c_str(), std::ios_base::binary); if(!file_store.fail()) { for(iterator cert = begin(); @@ -1245,8 +1245,8 @@ void LLSecAPIBasicHandler::_readProtectedData() { // attempt to load the file into our map LLPointer parser = new LLSDXMLParser(); - llifstream protected_data_stream(mProtectedDataFilename.c_str(), - llifstream::binary); + std::ifstream protected_data_stream(mProtectedDataFilename.c_str(), + std::ifstream::binary); if (!protected_data_stream.fail()) { U8 salt[STORE_SALT_SIZE]; @@ -1330,7 +1330,7 @@ void LLSecAPIBasicHandler::_writeProtectedData() // an error. std::string tmp_filename = mProtectedDataFilename + ".tmp"; - llofstream protected_data_stream(tmp_filename.c_str(), + std::ofstream protected_data_stream(tmp_filename.c_str(), std::ios_base::binary); try { @@ -1568,7 +1568,7 @@ std::string LLSecAPIBasicHandler::_legacyLoadPassword() { const S32 HASHED_LENGTH = 32; std::vector buffer(HASHED_LENGTH); - llifstream password_file(mLegacyPasswordPath.c_str(), llifstream::binary); + std::ifstream password_file(mLegacyPasswordPath.c_str(), std::ifstream::binary); if(password_file.fail()) { diff --git a/indra/newview/llsyntaxid.cpp b/indra/newview/llsyntaxid.cpp index 802dff1ead..cbbc238b24 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -83,7 +83,7 @@ public: const std::string xml = str.str(); // save the str to disk, usually to the cache. - llofstream file(mFileSpec.c_str(), std::ios_base::out); + std::ofstream file(mFileSpec.c_str(), std::ios_base::out); file.write(xml.c_str(), str.str().size()); file.close(); @@ -268,7 +268,7 @@ void LLSyntaxIdLSL::loadDefaultKeywordsIntoLLSD() void LLSyntaxIdLSL::loadKeywordsIntoLLSD() { LLSD content; - llifstream file; + std::ifstream file; file.open(mFullFileSpec.c_str()); if (file.is_open()) { diff --git a/indra/newview/llteleporthistorystorage.cpp b/indra/newview/llteleporthistorystorage.cpp index 8a5704939a..36257c8bf2 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.c_str()); + std::ofstream 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.c_str()); + std::ifstream 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 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; diff --git a/indra/newview/llurlwhitelist.cpp b/indra/newview/llurlwhitelist.cpp index 3a7285974e..c401f86212 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.c_str()); + std::ifstream 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.c_str()); + std::ofstream 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 509227c683..69b1ee93dc 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.c_str()); + std::ifstream 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.c_str()); + std::ofstream 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/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp index faa58d423f..0a283efae2 100755 --- a/indra/newview/llviewernetwork.cpp +++ b/indra/newview/llviewernetwork.cpp @@ -135,7 +135,7 @@ void LLGridManager::initialize(const std::string& grid_file) "Aditi"); LLSD other_grids; - llifstream llsd_xml; + std::ifstream llsd_xml; if (!grid_file.empty()) { LL_INFOS("GridManager")<<"Grid configuration file '"<getExpandedFilename(LL_PATH_CACHE, filename); - llifstream ifs(filename_and_local_path.c_str()); + std::ifstream 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 378bb18ecd..384589607c 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -179,7 +179,7 @@ void LLViewerTextureList::doPrefetchImages() // Pre-fetch textures from last logout LLSD imagelist; std::string filename = get_texture_list_name(); - llifstream file; + std::ifstream file; file.open(filename.c_str()); if (file.is_open()) { @@ -273,7 +273,7 @@ void LLViewerTextureList::shutdown() if (count > 0 && !gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "").empty()) { std::string filename = get_texture_list_name(); - llofstream file; + std::ofstream file; 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 e24884fe81..351494aae7 100755 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -1023,7 +1023,7 @@ void LLSpeakerVolumeStorage::load() LL_INFOS("Voice") << "Loading stored speaker volumes from: " << filename << LL_ENDL; LLSD settings_llsd; - llifstream file; + std::ifstream file; file.open(filename.c_str()); if (file.is_open()) { @@ -1066,7 +1066,7 @@ void LLSpeakerVolumeStorage::save() settings_llsd[iter->first.asString()] = volume; } - llofstream file; + std::ofstream file; file.open(filename.c_str()); LLSDSerialize::toPrettyXML(settings_llsd, file); } diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index 374792193c..e0b89e3eb9 100755 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -110,7 +110,7 @@ void LLWaterParamManager::loadPresetsFromDir(const std::string& dir) bool LLWaterParamManager::loadPreset(const std::string& path) { - llifstream xml_file; + std::ifstream xml_file; std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true)); xml_file.open(path.c_str()); @@ -150,7 +150,7 @@ void LLWaterParamManager::savePreset(const std::string & name) paramsData = mParamList[name].getAll(); // write to file - llofstream presetsXML(pathName.c_str()); + std::ofstream presetsXML(pathName.c_str()); LLPointer formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index b61fbbd073..b5d22b42a8 100755 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -113,7 +113,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID else if (status >= 0) { // read the file - llifstream ifs(filename, llifstream::binary); + std::ifstream ifs(filename, std::ifstream::binary); if( !ifs.is_open() ) { LL_WARNS("Wearable") << "Bad Wearable Asset: unable to open file: '" << filename << "'" << LL_ENDL; diff --git a/indra/newview/llwldaycycle.cpp b/indra/newview/llwldaycycle.cpp index 88079c5d26..3f5579d0fb 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.c_str()); + std::ifstream 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.c_str()); + std::ofstream day_cycle_xml(file_path.c_str()); LLPointer 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 2b6d88efef..ed0b733ade 100755 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -293,7 +293,7 @@ void LLWLParamManager::loadPresetsFromDir(const std::string& dir) bool LLWLParamManager::loadPreset(const std::string& path) { - llifstream xml_file; + std::ifstream xml_file; std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true)); xml_file.open(path.c_str()); @@ -334,7 +334,7 @@ void LLWLParamManager::savePreset(LLWLParamKey key) paramsData = mParamList[key].getAll(); // write to file - llofstream presetsXML(pathName.c_str()); + std::ofstream presetsXML(pathName.c_str()); LLPointer formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp index 2a8dc15346..a2f91fa55d 100755 --- a/indra/newview/tests/llsechandler_basic_test.cpp +++ b/indra/newview/tests/llsechandler_basic_test.cpp @@ -585,7 +585,7 @@ namespace tut LLMachineID::getUniqueID(unique_id, sizeof(unique_id)); LLXORCipher cipher2(unique_id, sizeof(unique_id)); cipher2.encrypt((U8*)&decoded_password[0], length); - llofstream password_file("test_password.dat", std::ofstream::binary); + std::ofstream password_file("test_password.dat", std::ofstream::binary); password_file.write(&decoded_password[0], length); password_file.close(); @@ -719,7 +719,7 @@ namespace tut test_store=NULL; // instantiate a cert store from a file - llofstream certstorefile("mycertstore.pem", std::ios::out); + std::ofstream certstorefile("mycertstore.pem", std::ios::out); certstorefile << mPemChildCert << std::endl << mPemTestCert << std::endl; certstorefile.close(); // validate loaded certs diff --git a/indra/newview/tests/llslurl_test.cpp b/indra/newview/tests/llslurl_test.cpp index 2bc0d5a086..272c2d4eb7 100755 --- a/indra/newview/tests/llslurl_test.cpp +++ b/indra/newview/tests/llslurl_test.cpp @@ -152,7 +152,7 @@ namespace tut template<> template<> void slurlTestObject::test<1>() { - llofstream gridfile(TEST_FILENAME); + std::ofstream gridfile(TEST_FILENAME); gridfile << gSampleGridFile; gridfile.close(); @@ -269,7 +269,7 @@ namespace tut template<> template<> void slurlTestObject::test<2>() { - llofstream gridfile(TEST_FILENAME); + std::ofstream gridfile(TEST_FILENAME); gridfile << gSampleGridFile; gridfile.close(); @@ -302,7 +302,7 @@ namespace tut template<> template<> void slurlTestObject::test<3>() { - llofstream gridfile(TEST_FILENAME); + std::ofstream gridfile(TEST_FILENAME); gridfile << gSampleGridFile; gridfile.close(); diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp index 0eb0ab6500..2b0330a5b3 100755 --- a/indra/newview/tests/llviewernetwork_test.cpp +++ b/indra/newview/tests/llviewernetwork_test.cpp @@ -245,7 +245,7 @@ namespace tut template<> template<> void viewerNetworkTestObject::test<2>() { - llofstream gridfile(TEST_FILENAME); + std::ofstream gridfile(TEST_FILENAME); gridfile << gSampleGridFile; gridfile.close(); @@ -376,7 +376,7 @@ namespace tut void viewerNetworkTestObject::test<7>() { // adding a grid with simply a name will populate the values. - llofstream gridfile(TEST_FILENAME); + std::ofstream gridfile(TEST_FILENAME); gridfile << gSampleGridFile; gridfile.close(); diff --git a/indra/test/llmessageconfig_tut.cpp b/indra/test/llmessageconfig_tut.cpp index df2151b1b1..6de5cf894d 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").c_str()); + std::ofstream 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 aa23699de0..9a537919c9 100755 --- a/indra/test/message_tut.cpp +++ b/indra/test/message_tut.cpp @@ -120,7 +120,7 @@ namespace tut void writeConfigFile(const LLSD& config) { std::string ostr(mTestConfigDir + mSep + "message.xml"); - llofstream file(ostr.c_str()); + std::ofstream file(ostr.c_str()); if (file.is_open()) { LLSDSerialize::toPrettyXML(config, file); diff --git a/indra/viewer_components/updater/CMakeLists.txt b/indra/viewer_components/updater/CMakeLists.txt index 61fd4220e0..cbf8066dee 100755 --- a/indra/viewer_components/updater/CMakeLists.txt +++ b/indra/viewer_components/updater/CMakeLists.txt @@ -70,12 +70,12 @@ if(LL_TESTS) ) # *NOTE:Mani - I was trying to use the preprocessor seam to mock out -# llifstream (and other) llcommon classes. I didn't work +# std::ifstream (and other) llcommon classes. I didn't work # because of the windows declspec(dllimport)attribute. #set_source_files_properties( # llupdaterservice.cpp # PROPERTIES -# LL_TEST_ADDITIONAL_CFLAGS "-Dllifstream=llus_mock_llifstream" +# LL_TEST_ADDITIONAL_CFLAGS "-Dstd::ifstream=llus_mock_std::ifstream" # ) LL_ADD_PROJECT_UNIT_TESTS(llupdaterservice "${llupdater_service_TEST_SOURCE_FILES}") diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp index f868e5cc2c..fc25582100 100755 --- a/indra/viewer_components/updater/llupdatedownloader.cpp +++ b/indra/viewer_components/updater/llupdatedownloader.cpp @@ -67,7 +67,7 @@ private: LLUpdateDownloader::Client & mClient; CURL * mCurl; LLSD mDownloadData; - llofstream mDownloadStream; + std::ofstream mDownloadStream; unsigned char mDownloadPercent; std::string mDownloadRecordPath; curl_slist * mHeaderList; @@ -270,7 +270,7 @@ void LLUpdateDownloader::Implementation::resume(void) } mDownloadRecordPath = downloadMarkerPath(); - llifstream dataStream(mDownloadRecordPath.c_str()); + std::ifstream 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.c_str()); + std::ofstream odataStream(mDownloadRecordPath.c_str()); LLSDSerialize::toPrettyXML(mDownloadData, odataStream); } catch (std::exception const & e) { LL_WARNS("UpdaterService") << "unable to read content length (" @@ -534,7 +534,7 @@ 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.c_str()); + std::ofstream dataStream(mDownloadRecordPath.c_str()); LLSDSerialize::toPrettyXML(mDownloadData, dataStream); mDownloadStream.open(filePath.c_str(), std::ios_base::out | std::ios_base::binary); @@ -570,7 +570,7 @@ bool LLUpdateDownloader::Implementation::validateOrRemove(const std::string& fil bool LLUpdateDownloader::Implementation::validateDownload(const std::string& filePath) { - llifstream fileStream(filePath.c_str(), std::ios_base::in | std::ios_base::binary); + std::ifstream 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 c152493a51..8359317983 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().c_str(), + std::ifstream 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.c_str(), + std::ifstream 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().c_str()); + std::ofstream 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().c_str()); + std::ifstream stream(ll_install_failed_marker_path().c_str()); stream >> requiredValue; if(stream.fail()) { -- cgit v1.2.3 From 1abc87139b09d4d333c72eb5ffb576895f1c2a0f Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 8 Apr 2015 13:00:35 -0400 Subject: fix validity errors in settings files --- indra/newview/app_settings/settings.xml | 3 ++- indra/newview/app_settings/settings_per_account.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 138bdde9e9..408d82ff69 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -5019,6 +5019,7 @@ Type LLSD Value + LSLFindCaseInsensitivity @@ -11774,7 +11775,7 @@ Type F32 Value - 0.0 + 0.0 TextureFetchSource diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index d119504017..c62b45ed81 100755 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -97,7 +97,7 @@ Type Boolean Value - true + 1 InstantMessageLogPath -- cgit v1.2.3 From 6b9b4c91d122dccabf7541af70ed68a623ad8810 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Thu, 9 Apr 2015 11:12:47 -0400 Subject: Detect running under cygwin and fail gracefully --- scripts/check-viewer-xml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/check-viewer-xml b/scripts/check-viewer-xml index 27c1112492..85366c02ae 100755 --- a/scripts/check-viewer-xml +++ b/scripts/check-viewer-xml @@ -68,11 +68,13 @@ elif sys.platform == 'linux2': CheckDirs = [ os.path.expanduser('~/.secondlife'), ] elif sys.platform == 'win32' or sys.platform == 'cygwin': - CheckDirs = [ os.path.expanduser('~\\Local Settings\\Temp'), - os.path.expanduser('~\\Application\\Data\\Secondlife'), - os.path.expanduser('~\\AppData\\Roaming\\Secondlife'), - os.path.expanduser('~\\AppData\\Local\\Secondlife'), - ] + if os.path.isdir(os.path.expanduser('~\\AppData\\Roaming')): + CheckDirs = [ os.path.expanduser('~\\Application\\Data\\Secondlife'), + os.path.expanduser('~\\AppData\\Roaming\\Secondlife'), + os.path.expanduser('~\\AppData\\Local\\Secondlife'), + ] + else: + sys.exit("No AppData\\Roaming directory found;\nThis script must be run in a native Windows command shell.\nRunning under cygwin does not work.") else: sys.exit("unrecognized platform '%s'" % sys.platform) -- 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/llappearance/llwearable.cpp | 4 +- indra/llcommon/llerror.cpp | 4 +- indra/llcommon/llfile.cpp | 170 +++++++++++++++--- indra/llcommon/llfile.h | 191 +++++++++++++++++++++ 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/llinventory/llinventory.cpp | 2 +- indra/llmessage/llhttpclient.cpp | 2 +- indra/llmessage/llmessageconfig.cpp | 2 +- indra/llmessage/llservicebuilder.cpp | 2 +- indra/llrender/llpostprocess.cpp | 4 +- indra/llui/llspellcheck.cpp | 16 +- indra/llui/lltextparser.cpp | 4 +- indra/llui/llviewereventrecorder.h | 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/llautoreplace.cpp | 6 +- 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/llfloaterautoreplacesettings.cpp | 4 +- indra/newview/llfloatermodelpreview.cpp | 4 +- indra/newview/llfloaterspellchecksettings.cpp | 4 +- indra/newview/lllocationhistory.cpp | 4 +- indra/newview/lllogchat.cpp | 2 +- indra/newview/llnotificationstorage.cpp | 4 +- indra/newview/llpanellogin.cpp | 2 +- indra/newview/llpanelmaininventory.cpp | 4 +- indra/newview/llsearchhistory.cpp | 4 +- indra/newview/llsechandler_basic.cpp | 10 +- indra/newview/llsyntaxid.cpp | 4 +- indra/newview/llteleporthistorystorage.cpp | 4 +- indra/newview/llurlhistory.cpp | 4 +- indra/newview/llurlwhitelist.cpp | 4 +- indra/newview/llviewermedia.cpp | 4 +- indra/newview/llviewernetwork.cpp | 2 +- indra/newview/llviewerobject.cpp | 2 +- indra/newview/llviewertexturelist.cpp | 6 +- indra/newview/llvoiceclient.cpp | 4 +- indra/newview/llwaterparammanager.cpp | 4 +- indra/newview/llwearablelist.cpp | 2 +- indra/newview/llwldaycycle.cpp | 4 +- indra/newview/llwlparammanager.cpp | 4 +- indra/newview/tests/llsechandler_basic_test.cpp | 4 +- indra/newview/tests/llslurl_test.cpp | 6 +- indra/newview/tests/llviewernetwork_test.cpp | 4 +- indra/test/llmessageconfig_tut.cpp | 2 +- indra/test/message_tut.cpp | 2 +- indra/viewer_components/updater/CMakeLists.txt | 4 +- .../updater/llupdatedownloader.cpp | 10 +- .../viewer_components/updater/llupdaterservice.cpp | 8 +- 59 files changed, 466 insertions(+), 145 deletions(-) diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index 1bbe878bba..5ca9f55ac8 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 { - std::ofstream ofs(filename.c_str(), 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 ) { - std::ifstream ifs(filename.c_str(), 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 3cb81b4e47..2100989316 100755 --- a/indra/llcommon/llerror.cpp +++ b/indra/llcommon/llerror.cpp @@ -135,7 +135,7 @@ namespace { } private: - std::ofstream mFile; + llofstream mFile; }; @@ -335,7 +335,7 @@ namespace LLSD configuration; { - std::ifstream file(filename().c_str()); + 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 ab432a923d..295c97eac8 100755 --- a/indra/llcommon/llfile.cpp +++ b/indra/llcommon/llfile.cpp @@ -424,26 +424,6 @@ LLFILE * LLFile::_Fiopen(const std::string& filename, /************** llstdio file buffer ********************************/ -//llstdio_filebuf* llstdio_filebuf::open(const char *_Filename, -// ios_base::openmode _Mode) -//{ -//#if LL_WINDOWS -// _Filet *_File; -// if (is_open() || (_File = LLFILE::_Fiopen(_Filename, _Mode)) == 0) -// return (0); // open failed -// -// _Init(_File, _Openfl); -// _Initcvt(&_USE(_Mysb::getloc(), _Cvt)); -// return (this); // open succeeded -//#else -// std::filebuf* _file = std::filebuf::open(_Filename, _Mode); -// if (NULL == _file) return NULL; -// return this; -//#endif -//} - - -// *TODO: Seek the underlying c stream for better cross-platform compatibility? #if !LL_WINDOWS llstdio_filebuf::int_type llstdio_filebuf::overflow(llstdio_filebuf::int_type __c) { @@ -865,3 +845,153 @@ int llstdio_filebuf::sync() } #endif +#if LL_WINDOWS +/************** input file stream ********************************/ + +llifstream::llifstream() : + _M_filebuf(), + std::istream(&_M_filebuf) +{ +} + +// explicit +llifstream::llifstream(const std::string& _Filename, + ios_base::openmode _Mode) : + _M_filebuf(), + std::istream(&_M_filebuf) +{ + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open(wideName.c_str(), _Mode | ios_base::in) == 0) + { + _Myios::setstate(ios_base::failbit); + } +} + +// explicit +llifstream::llifstream(const char* _Filename, + ios_base::openmode _Mode) : + _M_filebuf(), + std::istream(&_M_filebuf) +{ + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open(wideName.c_str(), _Mode | ios_base::in) == 0) + { + _Myios::setstate(ios_base::failbit); + } +} + +bool llifstream::is_open() const +{ // test if C stream has been opened + return _M_filebuf.is_open(); +} + +void llifstream::open(const char* _Filename, ios_base::openmode _Mode) +{ // open a C stream with specified mode + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::in) == 0) + { + _Myios::setstate(ios_base::failbit); + } + else + { + _Myios::clear(); + } +} + +void llifstream::close() +{ // close the C stream + if (_M_filebuf.close() == 0) + { + _Myios::setstate(ios_base::failbit); + } +} + + +/************** output file stream ********************************/ + + +llofstream::llofstream() : + _M_filebuf(), + std::ostream(&_M_filebuf) +{ +} + +// explicit +llofstream::llofstream(const std::string& _Filename, + ios_base::openmode _Mode) : + _M_filebuf(), + std::ostream(&_M_filebuf) +{ + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) + { + _Myios::setstate(ios_base::failbit); + } +} + +// explicit +llofstream::llofstream(const char* _Filename, + ios_base::openmode _Mode) : + _M_filebuf(), + std::ostream(&_M_filebuf) +{ + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) + { + _Myios::setstate(ios_base::failbit); + } +} + +bool llofstream::is_open() const +{ // test if C stream has been opened + return _M_filebuf.is_open(); +} + +void llofstream::open(const char* _Filename, ios_base::openmode _Mode) +{ // open a C stream with specified mode + llutf16string wideName = utf8str_to_utf16str( _Filename ); + if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0) + { + _Myios::setstate(ios_base::failbit); + } + else + { + _Myios::clear(); + } +} + +void llofstream::close() +{ // close the C stream + if (_M_filebuf.close() == 0) + { + _Myios::setstate(ios_base::failbit); + } +} + +/************** helper functions ********************************/ + +std::streamsize llifstream_size(llifstream& ifstr) +{ + if(!ifstr.is_open()) return 0; + std::streampos pos_old = ifstr.tellg(); + ifstr.seekg(0, ios_base::beg); + std::streampos pos_beg = ifstr.tellg(); + ifstr.seekg(0, ios_base::end); + std::streampos pos_end = ifstr.tellg(); + ifstr.seekg(pos_old, ios_base::beg); + return pos_end - pos_beg; +} + +std::streamsize llofstream_size(llofstream& ofstr) +{ + if(!ofstr.is_open()) return 0; + std::streampos pos_old = ofstr.tellp(); + ofstr.seekp(0, ios_base::beg); + std::streampos pos_beg = ofstr.tellp(); + ofstr.seekp(0, ios_base::end); + std::streampos pos_end = ofstr.tellp(); + ofstr.seekp(pos_old, ios_base::beg); + return pos_end - pos_beg; +} + +#endif // LL_WINDOWS diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index e310d47325..347c9867aa 100755 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -192,4 +192,195 @@ protected: #endif }; +#if LL_WINDOWS +/** + * @brief Controlling input for files. + * + * This class supports reading from named files, using the inherited + * functions from std::basic_istream. To control the associated + * sequence, an instance of std::basic_filebuf (or a platform-specific derivative) + * 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 llifstream : public std::istream +{ + // input stream associated with a C stream + public: + // Constructors: + /** + * @brief Default constructor. + * + * Initializes @c sb using its default constructor, and passes + * @c &sb to the base class initializer. Does not open any files + * (you haven't given it a filename to open). + */ + llifstream(); + + /** + * @brief Create an input file stream. + * @param Filename String specifying the filename. + * @param Mode Open file in specified mode (see std::ios_base). + * + * @c ios_base::in is automatically included in @a mode. + */ + explicit llifstream(const std::string& _Filename, + ios_base::openmode _Mode = ios_base::in); + explicit llifstream(const char* _Filename, + ios_base::openmode _Mode = ios_base::in); + + /** + * @brief The destructor does nothing. + * + * The file is closed by the filebuf object, not the formatting + * stream. + */ + virtual ~llifstream() {} + + // Members: + /** + * @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(&_M_filebuf); } + + /** + * @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. + * @param Node The open mode flags. + * + * Calls @c llstdio_filebuf::open(s,mode|in). If that function + * fails, @c failbit is set in the stream's error state. + */ + void open(const std::string& _Filename, + ios_base::openmode _Mode = ios_base::in) + { open(_Filename.c_str(), _Mode); } + void open(const char* _Filename, + ios_base::openmode _Mode = ios_base::in); + + /** + * @brief Close the file. + * + * Calls @c llstdio_filebuf::close(). If that function + * fails, @c failbit is set in the stream's error state. + */ + void close(); + + private: + llstdio_filebuf _M_filebuf; +}; + + +/** + * @brief Controlling output for files. + * + * This class supports writing to named files, using the inherited + * functions from std::basic_ostream. To control the associated + * sequence, an instance of std::basic_filebuf (or a platform-specific derivative) + * 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 +{ + public: + // Constructors: + /** + * @brief Default constructor. + * + * Initializes @c sb using its default constructor, and passes + * @c &sb to the base class initializer. Does not open any files + * (you haven't given it a filename to open). + */ + llofstream(); + + /** + * @brief Create an output file stream. + * @param Filename String specifying the filename. + * @param Mode Open file in specified mode (see std::ios_base). + * + * @c ios_base::out|ios_base::trunc is automatically included in + * @a mode. + */ + explicit llofstream(const std::string& _Filename, + ios_base::openmode _Mode = ios_base::out|ios_base::trunc); + explicit llofstream(const char* _Filename, + ios_base::openmode _Mode = ios_base::out|ios_base::trunc); + + /** + * @brief The destructor does nothing. + * + * The file is closed by the filebuf object, not the formatting + * stream. + */ + virtual ~llofstream() {} + + // Members: + /** + * @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(&_M_filebuf); } + + /** + * @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. + * @param Node The open mode flags. + * + * Calls @c llstdio_filebuf::open(s,mode|out). If that function + * fails, @c failbit is set in the stream's error state. + */ + void open(const std::string& _Filename, + ios_base::openmode _Mode = ios_base::out|ios_base::trunc) + { open(_Filename.c_str(), _Mode); } + void open(const char* _Filename, + ios_base::openmode _Mode = ios_base::out|ios_base::trunc); + + /** + * @brief Close the file. + * + * Calls @c llstdio_filebuf::close(). If that function + * fails, @c failbit is set in the stream's error state. + */ + void close(); + + private: + llstdio_filebuf _M_filebuf; +}; + + +/** + * @breif filesize helpers. + * + * The file size helpers are not considered particularly efficient, + * and should only be used for config files and the like -- not in a + * loop. + */ +std::streamsize LL_COMMON_API llifstream_size(llifstream& fstr); +std::streamsize LL_COMMON_API llofstream_size(llofstream& fstr); + +#else // ! LL_WINDOWS + +// on non-windows, llifstream and llofstream are just mapped directly to the std:: equivalents +typedef std::ifstream llifstream; +typedef std::ofstream llofstream; + +#endif // LL_WINDOWS or ! LL_WINDOWS + #endif // not LL_LLFILE_H diff --git a/indra/llcommon/llliveappconfig.cpp b/indra/llcommon/llliveappconfig.cpp index f955194009..a9b1cdf4f6 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; - std::ifstream file(filename().c_str()); + llifstream file(filename().c_str()); LLSD config; if (file.is_open()) { diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index 227f81e88f..f3b8999883 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) { - std::ifstream ifs(filename.c_str(), std::ifstream::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 049aa4d135..7dde1fcd69 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(); - std::ifstream ifile(filename.c_str()); + 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; - std::ofstream ofile(filename.c_str()); + llofstream ofile(filename.c_str()); if (!LLSDSerialize::toXML(data,ofile)) { diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index ef92395d6d..16df27bb8e 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); - std::ifstream ifs(tname.c_str(), std::ifstream::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 } - std::ifstream ifs(name.c_str(), std::ifstream::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 92fbc8ad73..41adc7be9a 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 - std::ifstream filter_xml(file_path.c_str()); + llifstream filter_xml(file_path.c_str()); if (filter_xml.is_open()) { // Load and parse the file diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp index 9a1aeca3cb..11647c5518 100755 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -229,7 +229,7 @@ BOOL LLInventoryObject::importLegacyStream(std::istream& input_stream) } // exportFile should be replaced with exportLegacyStream -// not sure whether exportLegacyStream(std::ofstream(fp)) would work, fp may need to get icramented... +// not sure whether exportLegacyStream(llofstream(fp)) would work, fp may need to get icramented... BOOL LLInventoryObject::exportFile(LLFILE* fp, BOOL) const { std::string uuid_str; diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index a36b3ff3c8..f8db3dded2 100755 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -157,7 +157,7 @@ namespace { LLBufferStream ostream(channels, buffer.get()); - std::ifstream fstream(mFilename.c_str(), 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 e91051b73e..64e79d6767 100755 --- a/indra/llmessage/llmessageconfig.cpp +++ b/indra/llmessage/llmessageconfig.cpp @@ -96,7 +96,7 @@ bool LLMessageConfigFile::loadFile() { LLSD data; { - std::ifstream file(filename().c_str()); + llifstream file(filename().c_str()); if (file.is_open()) { diff --git a/indra/llmessage/llservicebuilder.cpp b/indra/llmessage/llservicebuilder.cpp index 34ab891830..cf2e42f95c 100755 --- a/indra/llmessage/llservicebuilder.cpp +++ b/indra/llmessage/llservicebuilder.cpp @@ -34,7 +34,7 @@ void LLServiceBuilder::loadServiceDefinitionsFromFile( const std::string& service_filename) { - std::ifstream service_file(service_filename.c_str(), 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/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp index 7f0c9e9533..b6ea5aa7f1 100755 --- a/indra/llrender/llpostprocess.cpp +++ b/indra/llrender/llpostprocess.cpp @@ -66,7 +66,7 @@ LLPostProcess::LLPostProcess(void) : std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); LL_DEBUGS("AppInit", "Shaders") << "Loading PostProcess Effects settings from " << pathName << LL_ENDL; - std::ifstream effectsXML(pathName); + llifstream effectsXML(pathName); if (effectsXML) { @@ -153,7 +153,7 @@ void LLPostProcess::saveEffect(std::string const & effectName) std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", XML_FILENAME)); //LL_INFOS() << "Saving PostProcess Effects settings to " << pathName << LL_ENDL; - std::ofstream effectsXML(pathName); + llofstream effectsXML(pathName); LLPointer formatter = new LLSDXMLFormatter(); diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp index e6551a84c3..0db4281059 100755 --- a/indra/llui/llspellcheck.cpp +++ b/indra/llui/llspellcheck.cpp @@ -145,13 +145,13 @@ void LLSpellChecker::refreshDictionaryMap() // Load dictionary information (file name, friendly name, ...) std::string user_filename(user_path + DICT_FILE_MAIN); - std::ifstream user_file(user_filename.c_str(), std::ios::binary); + 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()) ) { std::string app_filename(app_path + DICT_FILE_MAIN); - std::ifstream app_file(app_filename.c_str(), std::ios::binary); + 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()) ) @@ -161,7 +161,7 @@ void LLSpellChecker::refreshDictionaryMap() } // Load user installed dictionary information - std::ifstream custom_file(user_filename.c_str(), std::ios::binary); + llifstream custom_file(user_filename.c_str(), std::ios::binary); if (custom_file.is_open()) { LLSD custom_dict_map; @@ -217,7 +217,7 @@ void LLSpellChecker::addToDictFile(const std::string& dict_path, const std::stri if (gDirUtilp->fileExists(dict_path)) { - std::ifstream file_in(dict_path.c_str(), 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; @@ -240,7 +240,7 @@ void LLSpellChecker::addToDictFile(const std::string& dict_path, const std::stri word_list.push_back(word); - std::ofstream file_out(dict_path.c_str(), 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; @@ -354,7 +354,7 @@ void LLSpellChecker::initHunspell(const std::string& dict_language) if (gDirUtilp->fileExists(user_path + DICT_FILE_IGNORE)) { - std::ifstream file_in((user_path + DICT_FILE_IGNORE).c_str(), 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; @@ -466,7 +466,7 @@ LLSD LLSpellChecker::loadUserDictionaryMap() { LLSD dict_map; std::string dict_filename(getDictionaryUserPath() + DICT_FILE_USER); - std::ifstream dict_file(dict_filename.c_str(), std::ios::binary); + llifstream dict_file(dict_filename.c_str(), std::ios::binary); if (dict_file.is_open()) { LLSDSerialize::fromXMLDocument(dict_map, dict_file); @@ -478,7 +478,7 @@ LLSD LLSpellChecker::loadUserDictionaryMap() // static void LLSpellChecker::saveUserDictionaryMap(const LLSD& dict_map) { - std::ofstream dict_file((getDictionaryUserPath() + DICT_FILE_USER).c_str(), 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/lltextparser.cpp b/indra/llui/lltextparser.cpp index 086d937753..0b36241da0 100755 --- a/indra/llui/lltextparser.cpp +++ b/indra/llui/lltextparser.cpp @@ -211,7 +211,7 @@ void LLTextParser::loadKeywords() std::string filename=getFileName(); if (!filename.empty()) { - std::ifstream file; + llifstream file; file.open(filename.c_str()); if (file.is_open()) { @@ -231,7 +231,7 @@ bool LLTextParser::saveToDisk(LLSD highlights) LL_WARNS() << "LLTextParser::saveToDisk() no valid user directory." << LL_ENDL; return FALSE; } - std::ofstream file; + llofstream file; file.open(filename.c_str()); LLSDSerialize::toPrettyXML(mHighlights, file); file.close(); diff --git a/indra/llui/llviewereventrecorder.h b/indra/llui/llviewereventrecorder.h index fb00572817..375efcc3de 100644 --- a/indra/llui/llviewereventrecorder.h +++ b/indra/llui/llviewereventrecorder.h @@ -79,7 +79,7 @@ class LLViewerEventRecorder : public LLSingleton bool logEvents; std::string mLogFilename; - std::ofstream mLog; + llofstream mLog; private: diff --git a/indra/llvfs/llpidlock.cpp b/indra/llvfs/llpidlock.cpp index 26cbce1028..6572edead3 100644 --- a/indra/llvfs/llpidlock.cpp +++ b/indra/llvfs/llpidlock.cpp @@ -95,7 +95,7 @@ LLPidLockFile& LLPidLockFile::instance() void LLPidLockFile::writeLockFile(LLSD pids) { - std::ofstream ofile(mLockName.c_str()); + llofstream ofile(mLockName.c_str()); if (!LLSDSerialize::toXML(pids,ofile)) { @@ -119,7 +119,7 @@ bool LLPidLockFile::requestLock(LLNameTable *name_table, bool autosave, LLSD out_pids; out_pids.append( (LLSD::Integer)mPID ); - std::ifstream ifile(mLockName.c_str()); + 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() { - std::ifstream ifile(mLockName.c_str()); + 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 079545d31f..4e3d0ab392 100755 --- a/indra/llxml/llcontrol.cpp +++ b/indra/llxml/llcontrol.cpp @@ -832,7 +832,7 @@ U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only ++num_saved; } } - std::ofstream file; + llofstream file; file.open(filename.c_str()); if (file.is_open()) { @@ -852,7 +852,7 @@ U32 LLControlGroup::saveToFile(const std::string& filename, BOOL nondefault_only U32 LLControlGroup::loadFromFile(const std::string& filename, bool set_default_values, bool save_values) { LLSD settings; - std::ifstream infile; + llifstream infile; infile.open(filename.c_str()); if(!infile.is_open()) { diff --git a/indra/llxml/tests/llcontrol_test.cpp b/indra/llxml/tests/llcontrol_test.cpp index bc17a88f7c..2b691ffbb1 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) { - std::ofstream file(mTestConfigFile.c_str()); + 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 4b3b0e42e0..cfc445f998 100755 --- a/indra/newview/llagentpilot.cpp +++ b/indra/newview/llagentpilot.cpp @@ -84,7 +84,7 @@ void LLAgentPilot::loadTxt(const std::string& filename) return; } - std::ifstream file(filename.c_str()); + llifstream file(filename.c_str()); if (!file) { @@ -125,7 +125,7 @@ void LLAgentPilot::loadXML(const std::string& filename) return; } - std::ifstream file(filename.c_str()); + llifstream file(filename.c_str()); if (!file) { @@ -167,7 +167,7 @@ void LLAgentPilot::save() void LLAgentPilot::saveTxt(const std::string& filename) { - std::ofstream file; + llofstream file; file.open(filename.c_str()); if (!file) @@ -190,7 +190,7 @@ void LLAgentPilot::saveTxt(const std::string& filename) void LLAgentPilot::saveXML(const std::string& filename) { - std::ofstream file; + llofstream file; file.open(filename.c_str()); if (!file) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index b2c74854ff..9668da2522 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; - std::ofstream out_file(debug_filename->c_str()); + 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"); - std::ofstream file(filename.c_str(), std::ios_base::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; - std::ifstream name_cache_stream(filename.c_str()); + 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"); - std::ifstream cache_file(name_cache.c_str()); + 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"); - std::ofstream name_cache_stream(filename.c_str()); + 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"); - std::ofstream cache_file(name_cache.c_str()); + llofstream cache_file(name_cache.c_str()); if(cache_file.is_open()) { gCacheName->exportFile(cache_file); diff --git a/indra/newview/llautoreplace.cpp b/indra/newview/llautoreplace.cpp index 62e32eac00..dd9354fe3a 100755 --- a/indra/newview/llautoreplace.cpp +++ b/indra/newview/llautoreplace.cpp @@ -148,7 +148,7 @@ void LLAutoReplace::loadFromSettings() if(gDirUtilp->fileExists(filename)) { LLSD userSettings; - std::ifstream file; + llifstream file; file.open(filename.c_str()); if (file.is_open()) { @@ -173,7 +173,7 @@ void LLAutoReplace::loadFromSettings() if(gDirUtilp->fileExists(defaultName)) { LLSD appDefault; - std::ifstream file; + llifstream file; file.open(defaultName.c_str()); if (file.is_open()) { @@ -209,7 +209,7 @@ void LLAutoReplace::loadFromSettings() void LLAutoReplace::saveToUserSettings() { std::string filename=getUserSettingsFileName(); - std::ofstream file; + llofstream file; file.open(filename.c_str()); LLSDSerialize::toPrettyXML(mSettings.asLLSD(), file); file.close(); diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp index fd96e65edd..281e591b48 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); - std::ifstream file(resolved_filename.c_str()); + 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 - std::ofstream file (resolved_filename.c_str()); + 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 9d4f7f6dd8..1819fc74ee 100755 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -621,7 +621,7 @@ void LLControlGroupCLP::configure(const std::string& config_filename, LLControlG // members of a control group. LLSD clpConfigLLSD; - std::ifstream input_stream; + llifstream input_stream; 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 4c8a4ece70..fc9e85caf8 100755 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -1469,7 +1469,7 @@ void LLFavoritesOrderStorage::destroyClass() std::string old_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); - std::ifstream file; + llifstream file; file.open(old_filename.c_str()); if (file.is_open()) { @@ -1507,7 +1507,7 @@ void LLFavoritesOrderStorage::load() std::string filename = getSavedOrderFileName(); LLSD settings_llsd; - std::ifstream file; + llifstream file; file.open(filename.c_str()); if (file.is_open()) { @@ -1541,7 +1541,7 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs() std::string filename = getStoredFavoritesFilename(); if (!filename.empty()) { - std::ifstream in_file; + llifstream in_file; in_file.open(filename.c_str()); LLSD fav_llsd; if (in_file.is_open()) @@ -1588,7 +1588,7 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs() // as we'll compare it with the stored credentials in the login panel. fav_llsd[av_name.getUserName()] = user_llsd; - std::ofstream file; + llofstream file; file.open(filename.c_str()); if ( file.is_open() ) { @@ -1613,7 +1613,7 @@ void LLFavoritesOrderStorage::removeFavoritesRecordOfUser() if (!filename.empty()) { LLSD fav_llsd; - std::ifstream file; + llifstream file; file.open(filename.c_str()); if (file.is_open()) { @@ -1630,7 +1630,7 @@ void LLFavoritesOrderStorage::removeFavoritesRecordOfUser() fav_llsd.erase(av_name.getUserName()); } - std::ofstream out_file; + llofstream out_file; out_file.open(filename.c_str()); if ( out_file.is_open() ) { @@ -1686,7 +1686,7 @@ void LLFavoritesOrderStorage::save() settings_llsd[iter->first.asString()] = iter->second; } - std::ofstream file; + llofstream file; file.open(filename.c_str()); if ( file.is_open() ) { diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index 12afb552eb..ea39f812fd 100755 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -326,7 +326,7 @@ bool LLFeatureManager::parseFeatureTable(std::string filename) { LL_INFOS("RenderInit") << "Attempting to parse feature table from " << filename << LL_ENDL; - std::ifstream file; + llifstream file; std::string name; U32 version; diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index 5529111b7f..b342d8fdf3 100755 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -154,7 +154,7 @@ BOOL LLFloaterAbout::postBuild() // Get the names of contributors, extracted from .../doc/contributions.txt by viewer_manifest.py at build time std::string contributors_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS,"contributors.txt"); - std::ifstream contrib_file; + llifstream contrib_file; std::string contributors; contrib_file.open(contributors_path.c_str()); /* Flawfinder: ignore */ if (contrib_file.is_open()) @@ -172,7 +172,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"); - std::ifstream licenses_file; + llifstream licenses_file; licenses_file.open(licenses_path.c_str()); /* Flawfinder: ignore */ if (licenses_file.is_open()) { diff --git a/indra/newview/llfloaterautoreplacesettings.cpp b/indra/newview/llfloaterautoreplacesettings.cpp index a16ecf2a80..6e56e929df 100755 --- a/indra/newview/llfloaterautoreplacesettings.cpp +++ b/indra/newview/llfloaterautoreplacesettings.cpp @@ -353,7 +353,7 @@ void LLFloaterAutoReplaceSettings::onImportList() LLFilePicker& picker = LLFilePicker::instance(); if( picker.getOpenFile( LLFilePicker::FFLOAD_XML) ) { - std::ifstream file; + llifstream file; file.open(picker.getFirstFile().c_str()); LLSD newList; if (file.is_open()) @@ -545,7 +545,7 @@ void LLFloaterAutoReplaceSettings::onExportList() LLFilePicker& picker = LLFilePicker::instance(); if( picker.getSaveFile( LLFilePicker::FFSAVE_XML, listFileName) ) { - std::ofstream file; + llofstream file; file.open(picker.getFirstFile().c_str()); LLSDSerialize::toPrettyXML(*list, file); file.close(); diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index e3ca48e4ae..b9113d265a 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; - std::ifstream ifstream(filename.c_str(), 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(); } - std::ofstream out(filename.c_str(), 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 63346f42ef..5124dae147 100755 --- a/indra/newview/llfloaterspellchecksettings.cpp +++ b/indra/newview/llfloaterspellchecksettings.cpp @@ -351,7 +351,7 @@ void LLFloaterSpellCheckerImport::onBtnOK() LLSD custom_dict_map; std::string custom_filename(LLSpellChecker::getDictionaryUserPath() + "user_dictionaries.xml"); - std::ifstream custom_file_in(custom_filename.c_str()); + llifstream custom_file_in(custom_filename.c_str()); if (custom_file_in.is_open()) { LLSDSerialize::fromXMLDocument(custom_dict_map, custom_file_in); @@ -373,7 +373,7 @@ void LLFloaterSpellCheckerImport::onBtnOK() custom_dict_map.append(custom_dict_info); } - std::ofstream custom_file_out(custom_filename.c_str(), 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 57f53bd0d9..162d6e003e 100755 --- a/indra/newview/lllocationhistory.cpp +++ b/indra/newview/lllocationhistory.cpp @@ -127,7 +127,7 @@ void LLLocationHistory::save() const } // open a file for writing - std::ofstream file(resolved_filename.c_str()); + 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); - std::ifstream file(resolved_filename.c_str()); + llifstream file(resolved_filename.c_str()); if (!file.is_open()) { diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index 8585fa6078..7ddacf3033 100755 --- a/indra/newview/lllogchat.cpp +++ b/indra/newview/lllogchat.cpp @@ -302,7 +302,7 @@ void LLLogChat::saveHistory(const std::string& filename, return; } - std::ofstream file(LLLogChat::makeLogFileName(filename).c_str(), 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/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp index 315084788e..3418b33d37 100755 --- a/indra/newview/llnotificationstorage.cpp +++ b/indra/newview/llnotificationstorage.cpp @@ -87,7 +87,7 @@ LLNotificationStorage::~LLNotificationStorage() bool LLNotificationStorage::writeNotifications(const LLSD& pNotificationData) const { - std::ofstream notifyFile(mFileName.c_str()); + llofstream notifyFile(mFileName.c_str()); bool didFileOpen = notifyFile.is_open(); if (!didFileOpen) @@ -113,7 +113,7 @@ bool LLNotificationStorage::readNotifications(LLSD& pNotificationData, bool is_n pNotificationData.clear(); - std::ifstream notifyFile(filename.c_str()); + llifstream notifyFile(filename.c_str()); didFileRead = notifyFile.is_open(); if (!didFileRead) { diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 8b9cd9c88a..cc8c3edd51 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -307,7 +307,7 @@ void LLPanelLogin::addFavoritesToStartLocation() updateLoginButtons(); LLSD fav_llsd; - std::ifstream file; + llifstream file; file.open(filename.c_str()); if (!file.is_open()) { diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 87f27ea8ef..17c0b226d0 100755 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -162,7 +162,7 @@ BOOL LLPanelMainInventory::postBuild() // Now load the stored settings from disk, if available. std::string filterSaveName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME)); LL_INFOS() << "LLPanelMainInventory::init: reading from " << filterSaveName << LL_ENDL; - std::ifstream file(filterSaveName.c_str()); + llifstream file(filterSaveName.c_str()); LLSD savedFilterState; if (file.is_open()) { @@ -243,7 +243,7 @@ LLPanelMainInventory::~LLPanelMainInventory( void ) } std::string filterSaveName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME)); - std::ofstream filtersFile(filterSaveName.c_str()); + llofstream filtersFile(filterSaveName.c_str()); if(!LLSDSerialize::toPrettyXML(filterRoot, filtersFile)) { LL_WARNS() << "Could not write to filters save file " << filterSaveName << LL_ENDL; diff --git a/indra/newview/llsearchhistory.cpp b/indra/newview/llsearchhistory.cpp index 0bc88590da..0ea05a03d6 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(); - std::ifstream file(resolved_filename.c_str()); + 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 - std::ofstream file(resolved_filename.c_str()); + 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 c904b95666..40516f9bbb 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() { - std::ofstream file_store(mFilename.c_str(), std::ios_base::binary); + llofstream file_store(mFilename.c_str(), std::ios_base::binary); if(!file_store.fail()) { for(iterator cert = begin(); @@ -1245,8 +1245,8 @@ void LLSecAPIBasicHandler::_readProtectedData() { // attempt to load the file into our map LLPointer parser = new LLSDXMLParser(); - std::ifstream protected_data_stream(mProtectedDataFilename.c_str(), - std::ifstream::binary); + llifstream protected_data_stream(mProtectedDataFilename.c_str(), + llifstream::binary); if (!protected_data_stream.fail()) { U8 salt[STORE_SALT_SIZE]; @@ -1330,7 +1330,7 @@ void LLSecAPIBasicHandler::_writeProtectedData() // an error. std::string tmp_filename = mProtectedDataFilename + ".tmp"; - std::ofstream protected_data_stream(tmp_filename.c_str(), + llofstream protected_data_stream(tmp_filename.c_str(), std::ios_base::binary); try { @@ -1568,7 +1568,7 @@ std::string LLSecAPIBasicHandler::_legacyLoadPassword() { const S32 HASHED_LENGTH = 32; std::vector buffer(HASHED_LENGTH); - std::ifstream password_file(mLegacyPasswordPath.c_str(), std::ifstream::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 cbbc238b24..802dff1ead 100644 --- a/indra/newview/llsyntaxid.cpp +++ b/indra/newview/llsyntaxid.cpp @@ -83,7 +83,7 @@ public: const std::string xml = str.str(); // save the str to disk, usually to the cache. - std::ofstream file(mFileSpec.c_str(), std::ios_base::out); + llofstream file(mFileSpec.c_str(), std::ios_base::out); file.write(xml.c_str(), str.str().size()); file.close(); @@ -268,7 +268,7 @@ void LLSyntaxIdLSL::loadDefaultKeywordsIntoLLSD() void LLSyntaxIdLSL::loadKeywordsIntoLLSD() { LLSD content; - std::ifstream file; + llifstream file; file.open(mFullFileSpec.c_str()); if (file.is_open()) { diff --git a/indra/newview/llteleporthistorystorage.cpp b/indra/newview/llteleporthistorystorage.cpp index 36257c8bf2..8a5704939a 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 - std::ofstream file(resolvedFilename.c_str()); + 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 - std::ifstream file(resolved_filename.c_str()); + 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 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; diff --git a/indra/newview/llurlwhitelist.cpp b/indra/newview/llurlwhitelist.cpp index c401f86212..3a7285974e 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 - std::ifstream file(resolvedFilename.c_str()); + 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 - std::ofstream file(resolvedFilename.c_str()); + 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 69b1ee93dc..509227c683 100755 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1278,7 +1278,7 @@ void LLViewerMedia::loadCookieFile() } // open the file for reading - std::ifstream file(resolved_filename.c_str()); + 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 - std::ofstream file(resolved_filename.c_str()); + 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/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp index 0a283efae2..faa58d423f 100755 --- a/indra/newview/llviewernetwork.cpp +++ b/indra/newview/llviewernetwork.cpp @@ -135,7 +135,7 @@ void LLGridManager::initialize(const std::string& grid_file) "Aditi"); LLSD other_grids; - std::ifstream llsd_xml; + llifstream llsd_xml; if (!grid_file.empty()) { LL_INFOS("GridManager")<<"Grid configuration file '"<getExpandedFilename(LL_PATH_CACHE, filename); - std::ifstream ifs(filename_and_local_path.c_str()); + 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 384589607c..b145d9ea9d 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -179,7 +179,7 @@ void LLViewerTextureList::doPrefetchImages() // Pre-fetch textures from last logout LLSD imagelist; std::string filename = get_texture_list_name(); - std::ifstream file; + llifstream file; file.open(filename.c_str()); if (file.is_open()) { @@ -273,7 +273,7 @@ void LLViewerTextureList::shutdown() if (count > 0 && !gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "").empty()) { std::string filename = get_texture_list_name(); - std::ofstream file; + llofstream file; file.open(filename.c_str()); LL_DEBUGS() << "saving " << imagelist.size() << " image list entries" << LL_ENDL; LLSDSerialize::toPrettyXML(imagelist, file); @@ -459,7 +459,7 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, // If the image is not found, creates new image and // enqueues a request for transmission - if ((&image_id == NULL) || image_id.isNull()) + if (image_id.isNull()) { return (LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_UI)); } diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 351494aae7..e24884fe81 100755 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -1023,7 +1023,7 @@ void LLSpeakerVolumeStorage::load() LL_INFOS("Voice") << "Loading stored speaker volumes from: " << filename << LL_ENDL; LLSD settings_llsd; - std::ifstream file; + llifstream file; file.open(filename.c_str()); if (file.is_open()) { @@ -1066,7 +1066,7 @@ void LLSpeakerVolumeStorage::save() settings_llsd[iter->first.asString()] = volume; } - std::ofstream file; + llofstream file; file.open(filename.c_str()); LLSDSerialize::toPrettyXML(settings_llsd, file); } diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp index e0b89e3eb9..374792193c 100755 --- a/indra/newview/llwaterparammanager.cpp +++ b/indra/newview/llwaterparammanager.cpp @@ -110,7 +110,7 @@ void LLWaterParamManager::loadPresetsFromDir(const std::string& dir) bool LLWaterParamManager::loadPreset(const std::string& path) { - std::ifstream xml_file; + llifstream xml_file; std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true)); xml_file.open(path.c_str()); @@ -150,7 +150,7 @@ void LLWaterParamManager::savePreset(const std::string & name) paramsData = mParamList[name].getAll(); // write to file - std::ofstream presetsXML(pathName.c_str()); + llofstream presetsXML(pathName.c_str()); LLPointer formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); diff --git a/indra/newview/llwearablelist.cpp b/indra/newview/llwearablelist.cpp index b5d22b42a8..b61fbbd073 100755 --- a/indra/newview/llwearablelist.cpp +++ b/indra/newview/llwearablelist.cpp @@ -113,7 +113,7 @@ void LLWearableList::processGetAssetReply( const char* filename, const LLAssetID else if (status >= 0) { // read the file - std::ifstream ifs(filename, std::ifstream::binary); + llifstream ifs(filename, llifstream::binary); if( !ifs.is_open() ) { LL_WARNS("Wearable") << "Bad Wearable Asset: unable to open file: '" << filename << "'" << LL_ENDL; diff --git a/indra/newview/llwldaycycle.cpp b/indra/newview/llwldaycycle.cpp index 3f5579d0fb..88079c5d26 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; - std::ifstream day_cycle_xml(file_path.c_str()); + 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(); - std::ofstream day_cycle_xml(file_path.c_str()); + llofstream day_cycle_xml(file_path.c_str()); LLPointer 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 ed0b733ade..2b6d88efef 100755 --- a/indra/newview/llwlparammanager.cpp +++ b/indra/newview/llwlparammanager.cpp @@ -293,7 +293,7 @@ void LLWLParamManager::loadPresetsFromDir(const std::string& dir) bool LLWLParamManager::loadPreset(const std::string& path) { - std::ifstream xml_file; + llifstream xml_file; std::string name(gDirUtilp->getBaseFileName(LLURI::unescape(path), /*strip_exten = */ true)); xml_file.open(path.c_str()); @@ -334,7 +334,7 @@ void LLWLParamManager::savePreset(LLWLParamKey key) paramsData = mParamList[key].getAll(); // write to file - std::ofstream presetsXML(pathName.c_str()); + llofstream presetsXML(pathName.c_str()); LLPointer formatter = new LLSDXMLFormatter(); formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY); presetsXML.close(); diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp index a2f91fa55d..2a8dc15346 100755 --- a/indra/newview/tests/llsechandler_basic_test.cpp +++ b/indra/newview/tests/llsechandler_basic_test.cpp @@ -585,7 +585,7 @@ namespace tut LLMachineID::getUniqueID(unique_id, sizeof(unique_id)); LLXORCipher cipher2(unique_id, sizeof(unique_id)); cipher2.encrypt((U8*)&decoded_password[0], length); - std::ofstream password_file("test_password.dat", std::ofstream::binary); + llofstream password_file("test_password.dat", std::ofstream::binary); password_file.write(&decoded_password[0], length); password_file.close(); @@ -719,7 +719,7 @@ namespace tut test_store=NULL; // instantiate a cert store from a file - std::ofstream certstorefile("mycertstore.pem", std::ios::out); + llofstream certstorefile("mycertstore.pem", std::ios::out); certstorefile << mPemChildCert << std::endl << mPemTestCert << std::endl; certstorefile.close(); // validate loaded certs diff --git a/indra/newview/tests/llslurl_test.cpp b/indra/newview/tests/llslurl_test.cpp index 272c2d4eb7..2bc0d5a086 100755 --- a/indra/newview/tests/llslurl_test.cpp +++ b/indra/newview/tests/llslurl_test.cpp @@ -152,7 +152,7 @@ namespace tut template<> template<> void slurlTestObject::test<1>() { - std::ofstream gridfile(TEST_FILENAME); + llofstream gridfile(TEST_FILENAME); gridfile << gSampleGridFile; gridfile.close(); @@ -269,7 +269,7 @@ namespace tut template<> template<> void slurlTestObject::test<2>() { - std::ofstream gridfile(TEST_FILENAME); + llofstream gridfile(TEST_FILENAME); gridfile << gSampleGridFile; gridfile.close(); @@ -302,7 +302,7 @@ namespace tut template<> template<> void slurlTestObject::test<3>() { - std::ofstream gridfile(TEST_FILENAME); + llofstream gridfile(TEST_FILENAME); gridfile << gSampleGridFile; gridfile.close(); diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp index 2b0330a5b3..0eb0ab6500 100755 --- a/indra/newview/tests/llviewernetwork_test.cpp +++ b/indra/newview/tests/llviewernetwork_test.cpp @@ -245,7 +245,7 @@ namespace tut template<> template<> void viewerNetworkTestObject::test<2>() { - std::ofstream gridfile(TEST_FILENAME); + llofstream gridfile(TEST_FILENAME); gridfile << gSampleGridFile; gridfile.close(); @@ -376,7 +376,7 @@ namespace tut void viewerNetworkTestObject::test<7>() { // adding a grid with simply a name will populate the values. - std::ofstream gridfile(TEST_FILENAME); + llofstream gridfile(TEST_FILENAME); gridfile << gSampleGridFile; gridfile.close(); diff --git a/indra/test/llmessageconfig_tut.cpp b/indra/test/llmessageconfig_tut.cpp index 6de5cf894d..df2151b1b1 100755 --- a/indra/test/llmessageconfig_tut.cpp +++ b/indra/test/llmessageconfig_tut.cpp @@ -68,7 +68,7 @@ namespace tut void writeConfigFile(const LLSD& config) { - std::ofstream file((mTestConfigDir + "/message.xml").c_str()); + 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 9a537919c9..aa23699de0 100755 --- a/indra/test/message_tut.cpp +++ b/indra/test/message_tut.cpp @@ -120,7 +120,7 @@ namespace tut void writeConfigFile(const LLSD& config) { std::string ostr(mTestConfigDir + mSep + "message.xml"); - std::ofstream file(ostr.c_str()); + llofstream file(ostr.c_str()); if (file.is_open()) { LLSDSerialize::toPrettyXML(config, file); diff --git a/indra/viewer_components/updater/CMakeLists.txt b/indra/viewer_components/updater/CMakeLists.txt index cbf8066dee..61fd4220e0 100755 --- a/indra/viewer_components/updater/CMakeLists.txt +++ b/indra/viewer_components/updater/CMakeLists.txt @@ -70,12 +70,12 @@ if(LL_TESTS) ) # *NOTE:Mani - I was trying to use the preprocessor seam to mock out -# std::ifstream (and other) llcommon classes. I didn't work +# llifstream (and other) llcommon classes. I didn't work # because of the windows declspec(dllimport)attribute. #set_source_files_properties( # llupdaterservice.cpp # PROPERTIES -# LL_TEST_ADDITIONAL_CFLAGS "-Dstd::ifstream=llus_mock_std::ifstream" +# LL_TEST_ADDITIONAL_CFLAGS "-Dllifstream=llus_mock_llifstream" # ) LL_ADD_PROJECT_UNIT_TESTS(llupdaterservice "${llupdater_service_TEST_SOURCE_FILES}") diff --git a/indra/viewer_components/updater/llupdatedownloader.cpp b/indra/viewer_components/updater/llupdatedownloader.cpp index fc25582100..f868e5cc2c 100755 --- a/indra/viewer_components/updater/llupdatedownloader.cpp +++ b/indra/viewer_components/updater/llupdatedownloader.cpp @@ -67,7 +67,7 @@ private: LLUpdateDownloader::Client & mClient; CURL * mCurl; LLSD mDownloadData; - std::ofstream mDownloadStream; + llofstream mDownloadStream; unsigned char mDownloadPercent; std::string mDownloadRecordPath; curl_slist * mHeaderList; @@ -270,7 +270,7 @@ void LLUpdateDownloader::Implementation::resume(void) } mDownloadRecordPath = downloadMarkerPath(); - std::ifstream dataStream(mDownloadRecordPath.c_str()); + 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)); - std::ofstream odataStream(mDownloadRecordPath.c_str()); + llofstream odataStream(mDownloadRecordPath.c_str()); LLSDSerialize::toPrettyXML(mDownloadData, odataStream); } catch (std::exception const & e) { LL_WARNS("UpdaterService") << "unable to read content length (" @@ -534,7 +534,7 @@ void LLUpdateDownloader::Implementation::startDownloading(LLURI const & uri, std << " from " << uri.asString() << LL_ENDL; LL_INFOS("UpdaterService") << "hash of file is " << hash << LL_ENDL; - std::ofstream dataStream(mDownloadRecordPath.c_str()); + llofstream dataStream(mDownloadRecordPath.c_str()); LLSDSerialize::toPrettyXML(mDownloadData, dataStream); mDownloadStream.open(filePath.c_str(), std::ios_base::out | std::ios_base::binary); @@ -570,7 +570,7 @@ bool LLUpdateDownloader::Implementation::validateOrRemove(const std::string& fil bool LLUpdateDownloader::Implementation::validateDownload(const std::string& filePath) { - std::ifstream fileStream(filePath.c_str(), 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 8359317983..c152493a51 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. - std::ifstream update_marker(update_marker_path().c_str(), + 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)) { - std::ifstream download_marker_stream(download_marker_path.c_str(), + 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. - std::ofstream update_marker(update_marker_path().c_str()); + 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; { - std::ifstream stream(ll_install_failed_marker_path().c_str()); + llifstream stream(ll_install_failed_marker_path().c_str()); stream >> requiredValue; if(stream.fail()) { -- cgit v1.2.3