eliminated several warnings on startup

master
Richard Linden 2010-06-02 13:33:15 -07:00
parent e097f355aa
commit 9e7cf5c1bc
6 changed files with 30 additions and 45 deletions

View File

@ -1704,13 +1704,11 @@ void LLTextBase::appendAndHighlightText(const std::string &new_text, bool prepen
setCursorPos(old_length);
LLTextParser* highlight = LLTextParser::getInstance();
if (mParseHighlights && highlight)
if (mParseHighlights)
{
LLStyle::Params highlight_params(style_params);
LLSD pieces = highlight->parsePartialLineHighlights(new_text, highlight_params.color(), (LLTextParser::EHighlightPosition)highlight_part);
.
LLSD pieces = LLTextParser::instance().parsePartialLineHighlights(new_text, highlight_params.color(), (LLTextParser::EHighlightPosition)highlight_part);
for (S32 i = 0; i < pieces.size(); i++)
{
LLSD color_llsd = pieces[i]["color"];

View File

@ -43,29 +43,14 @@
#include "v4color.h"
#include "lldir.h"
// Routines used for parsing text for TextParsers and html
LLTextParser* LLTextParser::sInstance = NULL;
//
// Member Functions
//
LLTextParser::~LLTextParser()
{
sInstance=NULL;
}
LLTextParser::LLTextParser()
: mLoaded(false)
{}
// static
LLTextParser* LLTextParser::getInstance()
{
if (!sInstance)
{
sInstance = new LLTextParser();
sInstance->loadFromDisk();
}
return sInstance;
}
// Moved triggerAlerts() to llfloaterchat.cpp to break llui/llaudio library dependency.
@ -105,6 +90,8 @@ S32 LLTextParser::findPattern(const std::string &text, LLSD highlight)
LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLColor4 &color, EHighlightPosition part, S32 index)
{
loadKeywords();
//evil recursive string atomizer.
LLSD ret_llsd, start_llsd, middle_llsd, end_llsd;
@ -195,6 +182,8 @@ LLSD LLTextParser::parsePartialLineHighlights(const std::string &text, const LLC
bool LLTextParser::parseFullLineHighlights(const std::string &text, LLColor4 *color)
{
loadKeywords();
for (S32 i=0;i<mHighlights.size();i++)
{
if ((S32)mHighlights[i]["highlight"]==ALL || (S32)mHighlights[i]["condition"]==MATCHES)
@ -221,14 +210,14 @@ std::string LLTextParser::getFileName()
return path;
}
LLSD LLTextParser::loadFromDisk()
void LLTextParser::loadKeywords()
{
std::string filename=getFileName();
if (filename.empty())
{
llwarns << "LLTextParser::loadFromDisk() no valid user directory." << llendl;
if (mLoaded)
{// keywords already loaded
return;
}
else
std::string filename=getFileName();
if (!filename.empty())
{
llifstream file;
file.open(filename.c_str());
@ -237,9 +226,8 @@ LLSD LLTextParser::loadFromDisk()
LLSDSerialize::fromXML(mHighlights, file);
}
file.close();
mLoaded = true;
}
return mHighlights;
}
bool LLTextParser::saveToDisk(LLSD highlights)

View File

@ -35,12 +35,13 @@
#define LL_LLTEXTPARSER_H
#include "llsd.h"
#include "llsingleton.h"
class LLUUID;
class LLVector3d;
class LLColor4;
class LLTextParser
class LLTextParser : public LLSingleton<LLTextParser>
{
public:
typedef enum e_condition_type { CONTAINS, MATCHES, STARTS_WITH, ENDS_WITH } EConditionType;
@ -48,22 +49,20 @@ public:
typedef enum e_highlight_position { WHOLE, START, MIDDLE, END } EHighlightPosition;
typedef enum e_dialog_action { ACTION_NONE, ACTION_CLOSE, ACTION_ADD, ACTION_COPY, ACTION_UPDATE } EDialogAction;
static LLTextParser* getInstance();
LLTextParser(){};
~LLTextParser();
LLTextParser();
S32 findPattern(const std::string &text, LLSD highlight);
LLSD parsePartialLineHighlights(const std::string &text,const LLColor4 &color, EHighlightPosition part=WHOLE, S32 index=0);
bool parseFullLineHighlights(const std::string &text, LLColor4 *color);
private:
S32 findPattern(const std::string &text, LLSD highlight);
std::string getFileName();
LLSD loadFromDisk();
void loadKeywords();
bool saveToDisk(LLSD highlights);
public:
LLSD mHighlights;
private:
static LLTextParser* sInstance;
bool mLoaded;
};
#endif

View File

@ -1817,7 +1817,7 @@ bool LLAppViewer::loadSettingsFromDirectory(const std::string& location_key,
}
else
{
llwarns << "Cannot load " << full_settings_path << " - No settings found." << llendl;
llinfos << "Cannot load " << full_settings_path << " - No settings found." << llendl;
}
}
else

View File

@ -966,7 +966,7 @@ void LLFloaterPreference::cleanupBadSetting()
{
if (gSavedPerAccountSettings.getString("BusyModeResponse2") == "|TOKEN COPY BusyModeResponse|")
{
llwarns << "cleaning old BusyModeResponse" << llendl;
llinfos << "cleaning old BusyModeResponse" << llendl;
//LLTrans::getString("BusyModeResponseDefault") is used here for localization (EXT-5885)
gSavedPerAccountSettings.setString("BusyModeResponse2", LLTrans::getString("BusyModeResponseDefault"));
}

View File

@ -59,7 +59,7 @@ void initializeSecHandler()
gSecAPIHandler = gHandlerMap[BASIC_SECHANDLER];
// initialize all SecAPIHandlers
LLProtectedDataException ex = LLProtectedDataException("");
std::string exception_msg;
std::map<std::string, LLPointer<LLSecAPIHandler> >::const_iterator itr;
for(itr = gHandlerMap.begin(); itr != gHandlerMap.end(); ++itr)
{
@ -70,12 +70,12 @@ void initializeSecHandler()
}
catch (LLProtectedDataException e)
{
ex = e;
exception_msg = e.getMessage();
}
}
if (ex.getMessage().length() > 0 ) // an exception was thrown.
if (!exception_msg.empty()) // an exception was thrown.
{
throw ex;
throw LLProtectedDataException(exception_msg.c_str());
}
}