diff options
Diffstat (limited to 'indra/newview')
42 files changed, 400 insertions, 276 deletions
| diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d8565aec2f..f6fb57da99 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -5030,6 +5030,7 @@        <key>Type</key>        <string>LLSD</string>        <key>Value</key> +      <array/>      </map>      <key>LSLFindCaseInsensitivity</key>          <map> @@ -11796,7 +11797,7 @@      <key>Type</key>      <string>F32</string>      <key>Value</key> -    <integer>0.0</integer> +    <real>0.0</real>    </map>      <key>TextureFetchSource</key>      <map> 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 @@          <key>Type</key>              <string>Boolean</string>          <key>Value</key> -            <integer>true</integer> +            <integer>1</integer>      </map>         <key>InstantMessageLogPath</key>          <map> diff --git a/indra/newview/llagentpilot.cpp b/indra/newview/llagentpilot.cpp index 44589f0d57..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); +	std::ifstream file(filename.c_str());  	if (!file)  	{ @@ -125,7 +125,7 @@ void LLAgentPilot::loadXML(const std::string& filename)  		return;  	} -	llifstream file(filename); +	std::ifstream file(filename.c_str());  	if (!file)  	{ @@ -167,8 +167,8 @@ void LLAgentPilot::save()  void LLAgentPilot::saveTxt(const std::string& filename)  { -	llofstream file; -	file.open(filename); +	std::ofstream file; +	file.open(filename.c_str());  	if (!file)  	{ @@ -190,8 +190,8 @@ void LLAgentPilot::saveTxt(const std::string& filename)  void LLAgentPilot::saveXML(const std::string& filename)  { -	llofstream file; -	file.open(filename); +	std::ofstream file; +	file.open(filename.c_str());  	if (!file)  	{ diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 4bf719ec31..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); +	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, llofstream::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,17 +4650,22 @@ 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); +	std::ifstream name_cache_stream(filename.c_str());  	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;  	std::string name_cache;  	name_cache = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "name.cache"); -	llifstream cache_file(name_cache); +	std::ifstream cache_file(name_cache.c_str());  	if(cache_file.is_open())  	{  		if(gCacheName->importFile(cache_file)) return; @@ -4668,24 +4673,26 @@ void LLAppViewer::loadNameCache()  }  void LLAppViewer::saveNameCache() -	{ +{  	// display names cache  	std::string filename =  		gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "avatar_name_cache.xml"); -	llofstream name_cache_stream(filename); +	std::ofstream name_cache_stream(filename.c_str());  	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"); +        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 746b541f9d..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); +	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); +	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 06164e9597..9d4f7f6dd8 100755 --- a/indra/newview/llcommandlineparser.cpp +++ b/indra/newview/llcommandlineparser.cpp @@ -621,8 +621,8 @@ void LLControlGroupCLP::configure(const std::string& config_filename, LLControlG      // members of a control group.      LLSD clpConfigLLSD; -    llifstream input_stream; -    input_stream.open(config_filename, std::ios::in | std::ios::binary); +    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 6c5b5be720..4c8a4ece70 100755 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -480,7 +480,7 @@ BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,  				const LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);  				if (item->getParentUUID() == favorites_id)  				{ -					LL_WARNS() << "Attemt to copy a favorite item into the same folder." << LL_ENDL; +					LL_WARNS("FavoritesBar") << "Attemt to copy a favorite item into the same folder." << LL_ENDL;  					break;  				} @@ -632,7 +632,7 @@ void LLFavoritesBarCtrl::handleNewFavoriteDragAndDrop(LLInventoryItem *item, con  	//		landmarks to an empty favorites bar.  	updateButtons(); -	LL_INFOS() << "Copied inventory item #" << item->getUUID() << " to favorites." << LL_ENDL; +	LL_INFOS("FavoritesBar") << "Copied inventory item #" << item->getUUID() << " to favorites." << LL_ENDL;  }  //virtual @@ -871,7 +871,7 @@ LLButton* LLFavoritesBarCtrl::createButton(const LLPointer<LLViewerInventoryItem  	fav_btn = LLUICtrlFactory::create<LLFavoriteLandmarkButton>(fav_btn_params);  	if (NULL == fav_btn)  	{ -		LL_WARNS() << "Unable to create LLFavoriteLandmarkButton widget: " << item->getName() << LL_ENDL; +		LL_WARNS("FavoritesBar") << "Unable to create LLFavoriteLandmarkButton widget: " << item->getName() << LL_ENDL;  		return NULL;  	} @@ -1160,7 +1160,7 @@ bool LLFavoritesBarCtrl::enableSelected(const LLSD& userdata)  void LLFavoritesBarCtrl::doToSelected(const LLSD& userdata)  {  	std::string action = userdata.asString(); -	LL_INFOS() << "Action = " << action << " Item = " << mSelectedItemID.asString() << LL_ENDL; +	LL_INFOS("FavoritesBar") << "Action = " << action << " Item = " << mSelectedItemID.asString() << LL_ENDL;  	LLViewerInventoryItem* item = gInventory.getItem(mSelectedItemID);  	if (!item) @@ -1444,22 +1444,40 @@ void LLFavoritesOrderStorage::getSLURL(const LLUUID& asset_id)  		boost::bind(&LLFavoritesOrderStorage::onLandmarkLoaded, this, asset_id, _1));  	if (lm)  	{ +        LL_DEBUGS("FavoritesBar") << "landmark for " << asset_id << " already loaded" << LL_ENDL;  		onLandmarkLoaded(asset_id, lm);  	}  }  // static +std::string LLFavoritesOrderStorage::getStoredFavoritesFilename() +{ +	std::string user_dir = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, ""); + +    return (user_dir.empty() ? "" +            : gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, +                                             "stored_favorites_" +                                          + LLGridManager::getInstance()->getGrid() +                                          + ".xml") +            ); +} + +// static  void LLFavoritesOrderStorage::destroyClass()  {  	LLFavoritesOrderStorage::instance().cleanup();  	std::string old_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites.xml"); -	llifstream file; -	file.open(old_filename); +	std::ifstream file; +	file.open(old_filename.c_str());  	if (file.is_open())  	{ -		std::string new_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites_" + LLGridManager::getInstance()->getGrid() + ".xml"); +        file.close(); +		std::string new_filename = getStoredFavoritesFilename(); +        LL_INFOS("FavoritesBar") << "moving favorites from old name '" << old_filename +                                 << "' to new name '" << new_filename << "'" +                                 << LL_ENDL;  		LLFile::copy(old_filename,new_filename);  		LLFile::remove(old_filename);  	} @@ -1474,18 +1492,35 @@ void LLFavoritesOrderStorage::destroyClass()  	}  } +std::string LLFavoritesOrderStorage::getSavedOrderFileName() +{ +	// If we quit from the login screen we will not have an SL account +	// name.  Don't try to save, otherwise we'll dump a file in +	// C:\Program Files\SecondLife\ or similar. JC +	std::string user_dir = gDirUtilp->getLindenUserDir(); +    return (user_dir.empty() ? "" : gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SORTING_DATA_FILE_NAME)); +} +  void LLFavoritesOrderStorage::load()  {  	// load per-resident sorting information -	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SORTING_DATA_FILE_NAME); +	std::string filename = getSavedOrderFileName();  	LLSD settings_llsd; -	llifstream file; -	file.open(filename); +	std::ifstream file; +	file.open(filename.c_str());  	if (file.is_open())  	{  		LLSDSerialize::fromXML(settings_llsd, file); +        LL_INFOS("FavoritesBar") << "loaded favorites order from '" << filename << "' " +                                 << (settings_llsd.isMap() ? "" : "un") << "successfully" +                                 << LL_ENDL; +        file.close();  	} +    else +    { +        LL_WARNS("FavoritesBar") << "unable to open favorites order file at '" << filename << "'" << LL_ENDL; +    }  	for (LLSD::map_const_iterator iter = settings_llsd.beginMap();  		iter != settings_llsd.endMap(); ++iter) @@ -1499,92 +1534,120 @@ void LLFavoritesOrderStorage::saveFavoritesSLURLs()  	// Do not change the file if we are not logged in yet.  	if (!LLLoginInstance::getInstance()->authSuccess())  	{ -		LL_WARNS() << "Cannot save favorites: not logged in" << LL_ENDL; +		LL_WARNS("FavoritesBar") << "Cannot save favorites: not logged in" << LL_ENDL;  		return;  	} -	std::string user_dir = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, ""); -	if (user_dir.empty()) -	{ -		LL_WARNS() << "Cannot save favorites: empty user dir name" << LL_ENDL; -		return; -	} - -	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites_" + LLGridManager::getInstance()->getGrid() + ".xml"); -	llifstream in_file; -	in_file.open(filename); -	LLSD fav_llsd; -	if (in_file.is_open()) -	{ -		LLSDSerialize::fromXML(fav_llsd, in_file); -	} - -	const LLUUID fav_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); -	LLInventoryModel::cat_array_t cats; -	LLInventoryModel::item_array_t items; -	gInventory.collectDescendents(fav_id, cats, items, LLInventoryModel::EXCLUDE_TRASH); - -	LLSD user_llsd; -	for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); it++) -	{ -		LLSD value; -		value["name"] = (*it)->getName(); -		value["asset_id"] = (*it)->getAssetUUID(); - -		slurls_map_t::iterator slurl_iter = mSLURLs.find(value["asset_id"]); -		if (slurl_iter != mSLURLs.end()) -		{ -			LL_DEBUGS() << "Saving favorite: idx=" << LLFavoritesOrderStorage::instance().getSortIndex((*it)->getUUID()) << ", SLURL=" <<  slurl_iter->second << ", value=" << value << LL_ENDL; -			value["slurl"] = slurl_iter->second; -			user_llsd[LLFavoritesOrderStorage::instance().getSortIndex((*it)->getUUID())] = value; -		} -		else -		{ -			LL_WARNS() << "Not saving favorite " << value["name"] << ": no matching SLURL" << LL_ENDL; -		} -	} - -	LLAvatarName av_name; -	LLAvatarNameCache::get( gAgentID, &av_name ); -	// Note : use the "John Doe" and not the "john.doe" version of the name  -	// as we'll compare it with the stored credentials in the login panel. -	LL_DEBUGS() << "Saved favorites for " << av_name.getUserName() << LL_ENDL; -	fav_llsd[av_name.getUserName()] = user_llsd; - -	llofstream file; -	file.open(filename); -	LLSDSerialize::toPrettyXML(fav_llsd, file); +	std::string filename = getStoredFavoritesFilename(); +    if (!filename.empty()) +    { +        std::ifstream in_file; +        in_file.open(filename.c_str()); +        LLSD fav_llsd; +        if (in_file.is_open()) +        { +            LLSDSerialize::fromXML(fav_llsd, in_file); +            LL_INFOS("FavoritesBar") << "loaded favorites from '" << filename << "' " +                                     << (fav_llsd.isMap() ? "" : "un") << "successfully" +                                     << LL_ENDL; +            in_file.close(); +        } +        else +        { +            LL_WARNS("FavoritesBar") << "unable to open favorites from '" << filename << "'" << LL_ENDL; +        } + +        const LLUUID fav_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE); +        LLInventoryModel::cat_array_t cats; +        LLInventoryModel::item_array_t items; +        gInventory.collectDescendents(fav_id, cats, items, LLInventoryModel::EXCLUDE_TRASH); + +        LLSD user_llsd; +        for (LLInventoryModel::item_array_t::iterator it = items.begin(); it != items.end(); it++) +        { +            LLSD value; +            value["name"] = (*it)->getName(); +            value["asset_id"] = (*it)->getAssetUUID(); + +            slurls_map_t::iterator slurl_iter = mSLURLs.find(value["asset_id"]); +            if (slurl_iter != mSLURLs.end()) +            { +                LL_DEBUGS("FavoritesBar") << "Saving favorite: idx=" << LLFavoritesOrderStorage::instance().getSortIndex((*it)->getUUID()) << ", SLURL=" <<  slurl_iter->second << ", value=" << value << LL_ENDL; +                value["slurl"] = slurl_iter->second; +                user_llsd[LLFavoritesOrderStorage::instance().getSortIndex((*it)->getUUID())] = value; +            } +            else +            { +                LL_WARNS("FavoritesBar") << "Not saving favorite " << value["name"] << ": no matching SLURL" << LL_ENDL; +            } +        } + +        LLAvatarName av_name; +        LLAvatarNameCache::get( gAgentID, &av_name ); +        // Note : use the "John Doe" and not the "john.doe" version of the name  +        // as we'll compare it with the stored credentials in the login panel. +        fav_llsd[av_name.getUserName()] = user_llsd; + +        std::ofstream file; +        file.open(filename.c_str()); +        if ( file.is_open() ) +        { +            LLSDSerialize::toPrettyXML(fav_llsd, file); +            LL_INFOS("FavoritesBar") << "saved favorites for '" << av_name.getUserName() +                                     << "' to '" << filename << "' " +                                     << LL_ENDL; +            file.close(); +        } +        else +        { +            LL_WARNS("FavoritesBar") << "unable to open favorites storage for '" << av_name.getUserName() +                                     << "' at '" << filename << "' " +                                     << LL_ENDL; +        } +    }  }  void LLFavoritesOrderStorage::removeFavoritesRecordOfUser()  { -	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "stored_favorites_" + LLGridManager::getInstance()->getGrid() + ".xml"); -	LLSD fav_llsd; -	llifstream file; -	file.open(filename); -	if (!file.is_open()) return; -	LLSDSerialize::fromXML(fav_llsd, file); - -	LLAvatarName av_name; -	LLAvatarNameCache::get( gAgentID, &av_name ); -	// Note : use the "John Doe" and not the "john.doe" version of the name. -	// See saveFavoritesSLURLs() here above for the reason why. -	LL_DEBUGS() << "Removed favorites for " << av_name.getUserName() << LL_ENDL; -	if (fav_llsd.has(av_name.getUserName())) -	{ -		fav_llsd.erase(av_name.getUserName()); -	} - -	llofstream out_file; -	out_file.open(filename); -	LLSDSerialize::toPrettyXML(fav_llsd, out_file); - +	std::string filename = getStoredFavoritesFilename(); +    if (!filename.empty()) +    { +        LLSD fav_llsd; +        std::ifstream file; +        file.open(filename.c_str()); +        if (file.is_open()) +        { +            LLSDSerialize::fromXML(fav_llsd, file); +            file.close(); +         +            LLAvatarName av_name; +            LLAvatarNameCache::get( gAgentID, &av_name ); +            // Note : use the "John Doe" and not the "john.doe" version of the name. +            // See saveFavoritesSLURLs() here above for the reason why. +            if (fav_llsd.has(av_name.getUserName())) +            { +                LL_INFOS("FavoritesBar") << "Removed favorites for " << av_name.getUserName() << LL_ENDL; +                fav_llsd.erase(av_name.getUserName()); +            } +         +            std::ofstream out_file; +            out_file.open(filename.c_str()); +            if ( out_file.is_open() ) +            { +                LLSDSerialize::toPrettyXML(fav_llsd, out_file); +                LL_INFOS("FavoritesBar") << "saved favorites to '" << filename << "' " +                                         << LL_ENDL; +                out_file.close(); +            } +        } +    }  }  void LLFavoritesOrderStorage::onLandmarkLoaded(const LLUUID& asset_id, LLLandmark* landmark)  { -	if (!landmark) return; - +	if (landmark) +    { +        LL_DEBUGS("FavoritesBar") << "landmark for " << asset_id << " loaded" << LL_ENDL;  	LLVector3d pos_global;  	if (!landmark->getGlobalPos(pos_global))  	{ @@ -1595,42 +1658,54 @@ void LLFavoritesOrderStorage::onLandmarkLoaded(const LLUUID& asset_id, LLLandmar  	if (!pos_global.isExactlyZero())  	{ +        LL_DEBUGS("FavoritesBar") << "requesting slurl for landmark " << asset_id << LL_ENDL;  		LLLandmarkActions::getSLURLfromPosGlobal(pos_global,  			boost::bind(&LLFavoritesOrderStorage::storeFavoriteSLURL, this, asset_id, _1));  	} +    }  }  void LLFavoritesOrderStorage::storeFavoriteSLURL(const LLUUID& asset_id, std::string& slurl)  { -	LL_DEBUGS() << "Saving landmark SLURL: " << slurl << LL_ENDL; +	LL_DEBUGS("FavoritesBar") << "Saving landmark SLURL '" << slurl << "' for " << asset_id << LL_ENDL;  	mSLURLs[asset_id] = slurl;  }  void LLFavoritesOrderStorage::save()  { -	// nothing to save if clean -	if (!mIsDirty) return; - -	// If we quit from the login screen we will not have an SL account -	// name.  Don't try to save, otherwise we'll dump a file in -	// C:\Program Files\SecondLife\ or similar. JC -	std::string user_dir = gDirUtilp->getLindenUserDir(); -	if (!user_dir.empty()) -	{ -		std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SORTING_DATA_FILE_NAME); -		LLSD settings_llsd; - -		for(sort_index_map_t::const_iterator iter = mSortIndexes.begin(); iter != mSortIndexes.end(); ++iter) -		{ -			settings_llsd[iter->first.asString()] = iter->second; -		} - -		llofstream file; -		file.open(filename); -		LLSDSerialize::toPrettyXML(settings_llsd, file); -	} +	if (mIsDirty) +    { +        // something changed, so save it +        std::string filename = LLFavoritesOrderStorage::getInstance()->getSavedOrderFileName(); +        if (!filename.empty()) +        { +            LLSD settings_llsd; + +            for(sort_index_map_t::const_iterator iter = mSortIndexes.begin(); iter != mSortIndexes.end(); ++iter) +            { +                settings_llsd[iter->first.asString()] = iter->second; +            } + +            std::ofstream file; +            file.open(filename.c_str()); +            if ( file.is_open() ) +            { +                LLSDSerialize::toPrettyXML(settings_llsd, file); +                LL_INFOS("FavoritesBar") << "saved favorites order to '" << filename << "' " << LL_ENDL; +            } +            else +            { +                LL_WARNS("FavoritesBar") << "failed to open favorites order file '" << filename << "' " << LL_ENDL; +            } +        } +        else +        { +            LL_DEBUGS("FavoritesBar") << "no user directory available to store favorites order file" << LL_ENDL; +        } +    }  } +  void LLFavoritesOrderStorage::cleanup()  {  	// nothing to clean diff --git a/indra/newview/llfavoritesbar.h b/indra/newview/llfavoritesbar.h index 5ca1d3e8ed..a370724947 100755 --- a/indra/newview/llfavoritesbar.h +++ b/indra/newview/llfavoritesbar.h @@ -162,19 +162,7 @@ private:  	boost::signals2::connection mEndDragConnection;  }; -/* -class AddFavoriteLandmarkCallback : public LLInventoryCallback -{ -public: -	AddFavoriteLandmarkCallback() : mTargetLandmarkId(LLUUID::null) {} -	void setTargetLandmarkId(const LLUUID& target_uuid) { mTargetLandmarkId = target_uuid; } - -private: -	void fire(const LLUUID& inv_item); -	LLUUID mTargetLandmarkId; -}; -*/  /**   * Class to store sorting order of favorites landmarks in a local file. EXT-3985.   * It replaced previously implemented solution to store sort index in landmark's name as a "<N>@" prefix. @@ -222,14 +210,16 @@ private:  	friend class LLSingleton<LLFavoritesOrderStorage>;  	LLFavoritesOrderStorage() : mIsDirty(false) { load(); }  	~LLFavoritesOrderStorage() { save(); } - +      	/**  	 * Removes sort indexes for items which are not in Favorites bar for now.  	 */  	void cleanup();  	const static std::string SORTING_DATA_FILE_NAME; - +    std::string getSavedOrderFileName(); +    static std::string getStoredFavoritesFilename(); +      	void load();  	void save(); diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp index af84aea6a6..12afb552eb 100755 --- a/indra/newview/llfeaturemanager.cpp +++ b/indra/newview/llfeaturemanager.cpp @@ -326,12 +326,12 @@ 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;  	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..5529111b7f 100755 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -154,9 +154,9 @@ 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);		/* 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 @@ -172,8 +172,8 @@ 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 */ +	std::ifstream licenses_file; +	licenses_file.open(licenses_path.c_str());		/* Flawfinder: ignore */  	if (licenses_file.is_open())  	{  		std::string license_line; 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 ec905558aa..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, 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, 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/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) diff --git a/indra/newview/llfloaterspellchecksettings.cpp b/indra/newview/llfloaterspellchecksettings.cpp index 54c7b4c37d..63346f42ef 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"); +		std::ifstream 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); +		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 680b35b550..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); +	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); +	std::ifstream file(resolved_filename.c_str());  	if (!file.is_open())  	{ diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp index cadbc16f1e..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), 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/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) diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp index e9970de58c..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)  	{ @@ -123,14 +123,18 @@ bool LLNotificationStorage::readNotifications(LLSD& pNotificationData, bool is_n  	{  		LLPointer<LLSDParser> 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/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 89c898001f..8b9cd9c88a 100755 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -307,11 +307,11 @@ void LLPanelLogin::addFavoritesToStartLocation()  	updateLoginButtons();  	LLSD fav_llsd; -	llifstream file; -	file.open(filename); +	std::ifstream file; +	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..87f27ea8ef 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; +	std::ifstream 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)); +	std::ofstream 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..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); +	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); +	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 fc9d9f0842..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, llofstream::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<LLSDParser> 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,8 +1330,8 @@ void LLSecAPIBasicHandler::_writeProtectedData()  	// an error.  	std::string tmp_filename = mProtectedDataFilename + ".tmp"; -	llofstream protected_data_stream(tmp_filename.c_str(),  -										llofstream::binary); +	std::ofstream protected_data_stream(tmp_filename.c_str(),  +                                     std::ios_base::binary);  	try  	{ @@ -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");  	}  } @@ -1552,7 +1568,7 @@ std::string LLSecAPIBasicHandler::_legacyLoadPassword()  {  	const S32 HASHED_LENGTH = 32;	  	std::vector<U8> buffer(HASHED_LENGTH); -	llifstream password_file(mLegacyPasswordPath, 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 a763d42a8d..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, 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,8 +268,8 @@ void LLSyntaxIdLSL::loadDefaultKeywordsIntoLLSD()  void LLSyntaxIdLSL::loadKeywordsIntoLLSD()  {  	LLSD content; -	llifstream file; -	file.open(mFullFileSpec); +	std::ifstream file; +	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..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); +	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); +	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 8eea2b242a..d45891ec45 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); + +    std::ifstream 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); +	std::ofstream 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..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 ); +	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 ); +	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 c758bbcc9e..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); +	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); +	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 '"<<grid_file<<"'"<<LL_ENDL; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 74b8e693c4..a2d9e936d5 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); +	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 8c27ddc63c..384589607c 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()); -	llifstream file; -	file.open(filename); +	std::string filename = get_texture_list_name(); +	std::ifstream file; +	file.open(filename.c_str());  	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()); -		llofstream file; -		file.open(filename); +		std::string filename = get_texture_list_name(); +		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/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<LLUIImageList> diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 4bd24a4923..1e9945b514 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -178,7 +178,6 @@ LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id,  	mScreenp(NULL),  	mLastRegionHandle(0),  	mRegionCrossingCount(0), -	//mInitialBakesLoaded(false),  	// Value outside legal range, so will always be a mismatch the  	// first time through.  	mLastHoverOffsetSent(LLVector3(0.0f, 0.0f, -999.0f)) diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 962cdf0268..351494aae7 100755 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -1023,11 +1023,16 @@ void LLSpeakerVolumeStorage::load()  	LL_INFOS("Voice") << "Loading stored speaker volumes from: " << filename << LL_ENDL;  	LLSD settings_llsd; -	llifstream file; -	file.open(filename); +	std::ifstream file; +	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(); @@ -1061,8 +1066,8 @@ void LLSpeakerVolumeStorage::save()  			settings_llsd[iter->first.asString()] = volume;  		} -		llofstream file; -		file.open(filename); +		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 c854e1fc66..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); +	std::ofstream presetsXML(pathName.c_str());  	LLPointer<LLSDFormatter> 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 e9b0baf612..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); +	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); +	std::ofstream day_cycle_xml(file_path.c_str());  	LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();  	formatter->format(day_data, day_cycle_xml, LLSDFormatter::OPTIONS_PRETTY);  	day_cycle_xml.close(); diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp index 91ea10d43d..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); +	std::ofstream presetsXML(pathName.c_str());  	LLPointer<LLSDFormatter> formatter = new LLSDXMLFormatter();  	formatter->format(paramsData, presetsXML, LLSDFormatter::OPTIONS_PRETTY);  	presetsXML.close(); diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 97885a0ce6..023a2fb925 100755 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -10623,7 +10623,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.  	<tag>fail</tag>     <usetemplate       name="okbutton" 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(); | 
