Prevent use of outdated notecard import by removing it from LLTextEditor
LLViewerTextEditor properly overrides this anyway.
This commit is contained in:
@@ -4991,110 +4991,6 @@ void LLTextEditor::setOnScrollEndCallback(void (*callback)(void*), void* userdat
|
||||
mScrollbar->setOnScrollEndCallback(callback, userdata);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Hack for Notecards
|
||||
|
||||
BOOL LLTextEditor::importBuffer(const char* buffer, S32 length )
|
||||
{
|
||||
std::istringstream instream(buffer);
|
||||
|
||||
// Version 1 format:
|
||||
// Linden text version 1\n
|
||||
// {\n
|
||||
// <EmbeddedItemList chunk>
|
||||
// Text length <bytes without \0>\n
|
||||
// <text without \0> (text may contain ext_char_values)
|
||||
// }\n
|
||||
|
||||
char tbuf[MAX_STRING]; /* Flawfinder: ignore */
|
||||
|
||||
S32 version = 0;
|
||||
instream.getline(tbuf, MAX_STRING);
|
||||
if( 1 != sscanf(tbuf, "Linden text version %d", &version) )
|
||||
{
|
||||
LL_WARNS() << "Invalid Linden text file header " << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if( 1 != version )
|
||||
{
|
||||
LL_WARNS() << "Invalid Linden text file version: " << version << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
instream.getline(tbuf, MAX_STRING);
|
||||
if( 0 != sscanf(tbuf, "{") )
|
||||
{
|
||||
LL_WARNS() << "Invalid Linden text file format" << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
S32 text_len = 0;
|
||||
instream.getline(tbuf, MAX_STRING);
|
||||
if( 1 != sscanf(tbuf, "Text length %d", &text_len) )
|
||||
{
|
||||
LL_WARNS() << "Invalid Linden text length field" << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if( text_len > mMaxTextByteLength )
|
||||
{
|
||||
LL_WARNS() << "Invalid Linden text length: " << text_len << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL success = TRUE;
|
||||
|
||||
char* text = new char[ text_len + 1];
|
||||
if (text == NULL)
|
||||
{
|
||||
LL_ERRS() << "Memory allocation failure." << LL_ENDL;
|
||||
return FALSE;
|
||||
}
|
||||
instream.get(text, text_len + 1, '\0');
|
||||
text[text_len] = '\0';
|
||||
if( text_len != (S32)strlen(text) )/* Flawfinder: ignore */
|
||||
{
|
||||
LL_WARNS() << llformat("Invalid text length: %d != %d ",strlen(text),text_len) << LL_ENDL;/* Flawfinder: ignore */
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
instream.getline(tbuf, MAX_STRING);
|
||||
if( success && (0 != sscanf(tbuf, "}")) )
|
||||
{
|
||||
LL_WARNS() << "Invalid Linden text file format: missing terminal }" << LL_ENDL;
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
if( success )
|
||||
{
|
||||
// Actually set the text
|
||||
setText( LLStringExplicit(text) );
|
||||
}
|
||||
|
||||
delete[] text;
|
||||
|
||||
setCursorPos(0);
|
||||
deselect();
|
||||
|
||||
needsReflow();
|
||||
return success;
|
||||
}
|
||||
|
||||
BOOL LLTextEditor::exportBuffer(std::string &buffer )
|
||||
{
|
||||
std::ostringstream outstream(buffer);
|
||||
|
||||
outstream << "Linden text version 1\n";
|
||||
outstream << "{\n";
|
||||
|
||||
outstream << llformat("Text length %d\n", mWText.length() );
|
||||
outstream << getText();
|
||||
outstream << "}\n";
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// LLTextSegment
|
||||
|
||||
|
||||
@@ -236,8 +236,8 @@ public:
|
||||
void setCommitOnFocusLost(BOOL b) { mCommitOnFocusLost = b; }
|
||||
|
||||
// Hack to handle Notecards
|
||||
virtual BOOL importBuffer(const char* buffer, S32 length );
|
||||
virtual BOOL exportBuffer(std::string& buffer );
|
||||
virtual BOOL importBuffer(const char* buffer, S32 length) { return false; }
|
||||
virtual BOOL exportBuffer(std::string& buffer) { return false; }
|
||||
|
||||
// If takes focus, will take keyboard focus on click.
|
||||
void setTakesFocus(BOOL b) { mTakesFocus = b; }
|
||||
|
||||
Reference in New Issue
Block a user