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/newview/llnotificationstorage.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'indra/newview/llnotificationstorage.cpp') 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) -- cgit v1.2.3 From 8b42c7898ef756a4a81daa08b2a5acce2894f4b8 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Tue, 7 Apr 2015 17:59:28 -0400 Subject: replace llifstream and llofstream with std::ifstream and std::ofstream respectively --- indra/newview/llnotificationstorage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llnotificationstorage.cpp') 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) { -- cgit v1.2.3 From 5c6cf3e7fb9f592e3a293921175b64b515bac23f Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Fri, 10 Apr 2015 11:02:37 -0400 Subject: restore the ll[io]fstream because we need them as wrappers on Windows for wide char paths; on other platforms they are now just typedefs to the std classes --- indra/newview/llnotificationstorage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llnotificationstorage.cpp') 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) { -- cgit v1.2.3