Compare commits

..

9 Commits

18 changed files with 143 additions and 88 deletions

View File

@@ -85,6 +85,7 @@ if (WINDOWS)
/TP /TP
/W3 /W3
/c /c
/Zc:__cplusplus
/Zc:forScope /Zc:forScope
/Zc:rvalueCast /Zc:rvalueCast
/Zc:wchar_t /Zc:wchar_t

View File

@@ -50,12 +50,10 @@ if (LINUX)
set(DL_LIBRARY dl) set(DL_LIBRARY dl)
set(RT_LIBRARY rt) set(RT_LIBRARY rt)
set(PTHREAD_LIBRARY pthread) set(PTHREAD_LIBRARY pthread)
set(FMT_LIBRARY "")
else (LINUX) else (LINUX)
set(DL_LIBRARY "") set(DL_LIBRARY "")
set(RT_LIBRARY "") set(RT_LIBRARY "")
set(PTHREAD_LIBRARY "") set(PTHREAD_LIBRARY "")
set(FMT_LIBRARY fmt::fmt)
endif (LINUX) endif (LINUX)
if (WINDOWS) if (WINDOWS)
@@ -77,6 +75,6 @@ else (WINDOWS)
set(WINDOWS_LIBRARIES "") set(WINDOWS_LIBRARIES "")
endif (WINDOWS) endif (WINDOWS)
mark_as_advanced(DL_LIBRARY RT_LIBRARY PTHREAD_LIBRARY FMT_LIBRARY WINDOWS_LIBRARIES) mark_as_advanced(DL_LIBRARY RT_LIBRARY PTHREAD_LIBRARY WINDOWS_LIBRARIES)
endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED) endif(NOT DEFINED ${CMAKE_CURRENT_LIST_FILE}_INCLUDED)

View File

@@ -9,16 +9,18 @@ FetchContent_Declare(
Catch2 Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.11.0 GIT_TAG v2.11.0
GIT_SHALLOW TRUE
) )
FetchContent_Declare( FetchContent_Declare(
fmt fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 6.1.2 GIT_TAG 0463665ef136d685fe07a564d93c782456456d3d
) )
FetchContent_Declare( FetchContent_Declare(
nlohmann_json nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json.git GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.7.3 GIT_TAG v3.7.3
GIT_SHALLOW TRUE
) )
FetchContent_Declare( FetchContent_Declare(
absl absl
@@ -45,9 +47,7 @@ if (BUILD_TESTING)
endif() endif()
#Download the rest of the libraries #Download the rest of the libraries
if(WINDOWS)
FetchContent_MakeAvailable(fmt) FetchContent_MakeAvailable(fmt)
endif()
# Typically you don't care so much for a third party library's tests to be # Typically you don't care so much for a third party library's tests to be
# run from your own project's code. # run from your own project's code.

View File

@@ -300,6 +300,7 @@ target_link_libraries(
${CORESERVICES_LIBRARY} ${CORESERVICES_LIBRARY}
${URIPARSER_LIBRARY} ${URIPARSER_LIBRARY}
nlohmann_json::nlohmann_json nlohmann_json::nlohmann_json
absl::strings
${RT_LIBRARY} ${RT_LIBRARY}
) )

View File

@@ -1072,8 +1072,8 @@ S32 LLSDBinaryParser::doParse(std::istream& istr, LLSD& data) const
// the size, and read it. // the size, and read it.
U32 size_nbo = 0; U32 size_nbo = 0;
read(istr, (char*)&size_nbo, sizeof(U32)); /*Flawfinder: ignore*/ read(istr, (char*)&size_nbo, sizeof(U32)); /*Flawfinder: ignore*/
S32 size = (S32)ntohl(size_nbo); S32 size = (S32)ntohl(size_nbo); // Can return negative size if > 2^31.
if(mCheckLimits && (size > mMaxBytesLeft)) if(size < 0 || mCheckLimits && (size > mMaxBytesLeft))
{ {
parse_count = PARSE_FAILURE; parse_count = PARSE_FAILURE;
} }
@@ -1113,7 +1113,11 @@ S32 LLSDBinaryParser::parseMap(std::istream& istr, LLSD& map) const
map = LLSD::emptyMap(); map = LLSD::emptyMap();
U32 value_nbo = 0; U32 value_nbo = 0;
read(istr, (char*)&value_nbo, sizeof(U32)); /*Flawfinder: ignore*/ read(istr, (char*)&value_nbo, sizeof(U32)); /*Flawfinder: ignore*/
S32 size = (S32)ntohl(value_nbo); S32 size = (S32)ntohl(value_nbo); // Can return negative size if > 2^31.
if (size < 0)
{
return PARSE_FAILURE;
}
S32 parse_count = 0; S32 parse_count = 0;
S32 count = 0; S32 count = 0;
char c = get(istr); char c = get(istr);
@@ -1167,7 +1171,11 @@ S32 LLSDBinaryParser::parseArray(std::istream& istr, LLSD& array) const
array = LLSD::emptyArray(); array = LLSD::emptyArray();
U32 value_nbo = 0; U32 value_nbo = 0;
read(istr, (char*)&value_nbo, sizeof(U32)); /*Flawfinder: ignore*/ read(istr, (char*)&value_nbo, sizeof(U32)); /*Flawfinder: ignore*/
S32 size = (S32)ntohl(value_nbo); S32 size = (S32)ntohl(value_nbo); // Can return negative size if > 2^31.
if (size < 0)
{
return PARSE_FAILURE;
}
// *FIX: This would be a good place to reserve some space in the // *FIX: This would be a good place to reserve some space in the
// array... // array...
@@ -1208,8 +1216,8 @@ bool LLSDBinaryParser::parseString(
// *FIX: This is memory inefficient. // *FIX: This is memory inefficient.
U32 value_nbo = 0; U32 value_nbo = 0;
read(istr, (char*)&value_nbo, sizeof(U32)); /*Flawfinder: ignore*/ read(istr, (char*)&value_nbo, sizeof(U32)); /*Flawfinder: ignore*/
S32 size = (S32)ntohl(value_nbo); S32 size = (S32)ntohl(value_nbo); // Can return negative size if > 2^31.
if(mCheckLimits && (size > mMaxBytesLeft)) return false; if(size < 0 || mCheckLimits && (size > mMaxBytesLeft)) return false;
std::vector<char> buf; std::vector<char> buf;
if(size) if(size)
{ {

View File

@@ -29,6 +29,16 @@
#include <boost/optional/optional.hpp> #include <boost/optional/optional.hpp>
#include <string> #include <string>
#if __cplusplus < 201606
#include <absl/strings/string_view.h>
namespace std {
typedef absl::string_view string_view;
}
#else
#include <string_view>
#endif
#include <cstdio> #include <cstdio>
//#include <locale> //#include <locale>
#include <iomanip> #include <iomanip>

View File

@@ -2146,7 +2146,7 @@ void LLRender::setLineWidth(F32 line_width)
} }
if (mNewContext.lineWidth != line_width || mDirty) if (mNewContext.lineWidth != line_width || mDirty)
{ {
if (mMode == LLRender::LINES || LLRender::LINE_STRIP) if (mMode == LLRender::LINES || mMode == LLRender::LINE_STRIP)
{ {
flush(); flush();
} }
@@ -2492,7 +2492,8 @@ void LLRender::vertexBatchPreTransformed(LLVector4a* verts, S32 vert_count)
mColorsp[mCount] = mColorsp[mCount-1]; mColorsp[mCount] = mColorsp[mCount-1];
} }
mVerticesp[mCount] = mVerticesp[mCount-1]; if (mCount > 0) // ND: Guard against crashes if mCount is zero, yes it can happen
mVerticesp[mCount] = mVerticesp[mCount-1];
mPrimitiveReset = false; mPrimitiveReset = false;
} }
@@ -2528,9 +2529,12 @@ void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, S32
mCount++; mCount++;
mColorsp[mCount] = mColorsp[mCount-1]; mColorsp[mCount] = mColorsp[mCount-1];
} }
mVerticesp[mCount] = mVerticesp[mCount-1]; if (mCount > 0)
mTexcoordsp[mCount] = mTexcoordsp[mCount-1]; {
mVerticesp[mCount] = mVerticesp[mCount - 1];
mTexcoordsp[mCount] = mTexcoordsp[mCount - 1];
}
mPrimitiveReset = false; mPrimitiveReset = false;
} }
@@ -2564,9 +2568,12 @@ void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLCo
mColorsp.copyArray(mCount, colors, vert_count); mColorsp.copyArray(mCount, colors, vert_count);
mCount += vert_count; mCount += vert_count;
mVerticesp[mCount] = mVerticesp[mCount-1]; if (mCount > 0)
mTexcoordsp[mCount] = mTexcoordsp[mCount-1]; {
mColorsp[mCount] = mColorsp[mCount-1]; mVerticesp[mCount] = mVerticesp[mCount - 1];
mTexcoordsp[mCount] = mTexcoordsp[mCount - 1];
mColorsp[mCount] = mColorsp[mCount - 1];
}
mPrimitiveReset = false; mPrimitiveReset = false;
} }

View File

@@ -1197,6 +1197,10 @@ void LLVertexBuffer::genBuffer(U32 size)
{ {
mMappedData = sDynamicVBOPool.allocate(mGLBuffer, mSize); mMappedData = sDynamicVBOPool.allocate(mGLBuffer, mSize);
} }
if ((sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW_ARB) && !mMappedData)
{
LL_ERRS() << "mMappedData allocation failedd" << LL_ENDL;
}
sGLCount++; sGLCount++;
} }
@@ -1213,6 +1217,10 @@ void LLVertexBuffer::genIndices(U32 size)
{ {
mMappedIndexData = sDynamicIBOPool.allocate(mGLIndices, mIndicesSize); mMappedIndexData = sDynamicIBOPool.allocate(mGLIndices, mIndicesSize);
} }
if ((sDisableVBOMapping || mUsage != GL_DYNAMIC_DRAW_ARB) && !mMappedIndexData)
{
LL_ERRS() << "mMappedIndexData allocation failedd" << LL_ENDL;
}
sGLCount++; sGLCount++;
} }
@@ -1848,6 +1856,7 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
LL_ERRS() << "Attempted to map a specific range of a buffer that was already mapped." << LL_ENDL; LL_ERRS() << "Attempted to map a specific range of a buffer that was already mapped." << LL_ENDL;
} }
bool was_locked = mIndexLocked;
if (!mIndexLocked) if (!mIndexLocked)
{ {
mIndexLocked = true; mIndexLocked = true;
@@ -1942,6 +1951,10 @@ volatile U8* LLVertexBuffer::mapIndexBuffer(S32 index, S32 count, bool map_range
LL_ERRS() << "glMapBuffer returned NULL (no index data)" << LL_ENDL; LL_ERRS() << "glMapBuffer returned NULL (no index data)" << LL_ENDL;
} }
else if (was_locked)
{
LL_ERRS() << "mIndexLocked was true but no Index data allocated" << LL_ENDL;
}
else else
{ {
LL_ERRS() << "memory allocation for Index data failed. " << LL_ENDL; LL_ERRS() << "memory allocation for Index data failed. " << LL_ENDL;

View File

@@ -1709,7 +1709,7 @@ target_link_libraries(${VIEWER_BINARY_NAME}
absl::flat_hash_map absl::flat_hash_map
absl::node_hash_map absl::node_hash_map
nlohmann_json::nlohmann_json nlohmann_json::nlohmann_json
${FMT_LIBRARY} fmt::fmt
) )
if (LINUX) if (LINUX)

View File

@@ -531,17 +531,24 @@ void LLChatBar::sendChat( EChatType type )
// static // static
void LLChatBar::startChat(const char* line) void LLChatBar::startChat(const char* line)
{ {
if (!gChatBar || !gChatBar->getParent())
{
return;
}
gChatBar->getParent()->setVisible(TRUE); gChatBar->getParent()->setVisible(TRUE);
gChatBar->setKeyboardFocus(TRUE); gChatBar->setKeyboardFocus(TRUE);
gSavedSettings.setBOOL("ChatVisible", TRUE); gSavedSettings.setBOOL("ChatVisible", TRUE);
if (line && gChatBar->mInputEditor) if (gChatBar->mInputEditor)
{ {
std::string line_string(line); if (line)
gChatBar->mInputEditor->setText(line_string); {
std::string line_string(line);
gChatBar->mInputEditor->setText(line_string);
}
// always move cursor to end so users don't obliterate chat when accidentally hitting WASD
gChatBar->mInputEditor->setCursorToEnd();
} }
// always move cursor to end so users don't obliterate chat when accidentally hitting WASD
gChatBar->mInputEditor->setCursorToEnd();
} }
@@ -550,7 +557,8 @@ void LLChatBar::startChat(const char* line)
void LLChatBar::stopChat() void LLChatBar::stopChat()
{ {
// In simple UI mode, we never release focus from the chat bar // In simple UI mode, we never release focus from the chat bar
gChatBar->setKeyboardFocus(FALSE); if (gChatBar)
gChatBar->setKeyboardFocus(FALSE);
// If we typed a movement key and pressed return during the // If we typed a movement key and pressed return during the
// same frame, the keyboard handlers will see the key as having // same frame, the keyboard handlers will see the key as having
@@ -562,7 +570,8 @@ void LLChatBar::stopChat()
gAgent.stopTyping(); gAgent.stopTyping();
// hide chat bar so it doesn't grab focus back // hide chat bar so it doesn't grab focus back
gChatBar->getParent()->setVisible(FALSE); if (gChatBar && gChatBar->getParent())
gChatBar->getParent()->setVisible(FALSE);
gSavedSettings.setBOOL("ChatVisible", FALSE); gSavedSettings.setBOOL("ChatVisible", FALSE);
} }

View File

@@ -515,6 +515,10 @@ void LLCloudLayer::connectNeighbor(LLCloudLayer *cloudp, U32 direction)
return; return;
} }
if (mNeighbors[direction])
{
mNeighbors[direction]->mNeighbors[gDirOpposite[direction]] = NULL;
}
mNeighbors[direction] = cloudp; mNeighbors[direction] = cloudp;
if (cloudp) if (cloudp)
mNeighbors[direction]->mNeighbors[gDirOpposite[direction]] = this; mNeighbors[direction]->mNeighbors[gDirOpposite[direction]] = this;

View File

@@ -94,7 +94,7 @@ void LLHUDIcon::renderIcon(BOOL for_select)
if (mHidden) if (mHidden)
return; return;
if (mSourceObject.isNull() || mImagep.isNull()) if (mSourceObject.isNull() || mImagep.isNull() || mSourceObject->mDrawable.isNull())
{ {
markDead(); markDead();
return; return;

View File

@@ -560,7 +560,7 @@ void LLIMProcessing::processNewMessage(const LLUUID& from_id,
chat.mFromID = from_id; chat.mFromID = from_id;
chat.mFromName = name; chat.mFromName = name;
chat.mSourceType = (from_id.isNull() || (name == SYSTEM_FROM)) ? CHAT_SOURCE_SYSTEM : chat.mSourceType = (from_id.isNull() || (name == SYSTEM_FROM)) ? CHAT_SOURCE_SYSTEM :
(dialog == IM_FROM_TASK && dialog == IM_FROM_TASK_AS_ALERT) ? CHAT_SOURCE_OBJECT : CHAT_SOURCE_AGENT; (dialog == IM_FROM_TASK || dialog == IM_FROM_TASK_AS_ALERT) ? CHAT_SOURCE_OBJECT : CHAT_SOURCE_AGENT;
bool is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat) bool is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat)
// object IMs contain sender object id in session_id (STORM-1209) // object IMs contain sender object id in session_id (STORM-1209)
@@ -1895,6 +1895,11 @@ void LLIMProcessing::requestOfflineMessages()
void LLIMProcessing::requestOfflineMessagesCoro(const LLCoroResponder& responder) void LLIMProcessing::requestOfflineMessagesCoro(const LLCoroResponder& responder)
{ {
if (LLApp::isQuitting() || !gAgent.getRegion())
{
return;
}
auto status = responder.getStatus(); auto status = responder.getStatus();
if (!responder.isGoodStatus(status)) // success = httpResults["success"].asBoolean(); if (!responder.isGoodStatus(status)) // success = httpResults["success"].asBoolean();

View File

@@ -1609,22 +1609,8 @@ std::string LLPreviewGesture::getLabel(const std::vector<std::string>& v_labels)
for(const auto& pair : LLPreview::sInstances) for(const auto& pair : LLPreview::sInstances)
{ {
const auto& pPreview(pair.second); const auto& pPreview(pair.second);
#ifndef LL_WINDOWS
#if __cplusplus >= 201606
constexpr std::string_view gesture("Gesture"); constexpr std::string_view gesture("Gesture");
if (pPreview && pPreview->getTitleName().compare(gesture) == 0) if (pPreview && std::string_view(pPreview->getTitleName()) == gesture)
LL_COMPILE_TIME_MESSAGE("String view support detected, remove this macro check, this line and the old check below");
#endif
#endif
if (pPreview && pPreview->getTitleName() ==
#ifndef LL_WINDOWS
static_cast<const std::string>(
#endif
"Gesture"
#ifndef LL_WINDOWS
)
#endif
)
{ {
wait_anim = pPreview->getChild<LLCheckBoxCtrl>("wait_anim_check")->getLabel(); wait_anim = pPreview->getChild<LLCheckBoxCtrl>("wait_anim_check")->getLabel();
break; break;

View File

@@ -548,24 +548,29 @@ void start_chat( EKeystate s )
} }
// start chat // start chat
gChatBar->startChat(NULL); LLChatBar::startChat(NULL);
} }
void start_gesture( EKeystate s ) void start_gesture( EKeystate s )
{ {
if (LLAppViewer::instance()->quitRequested())
{
return; // can't talk, gotta go, kthxbye!
}
LLUICtrl* focus_ctrlp = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus()); LLUICtrl* focus_ctrlp = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
if (KEYSTATE_UP == s && if (KEYSTATE_UP == s &&
! (focus_ctrlp && focus_ctrlp->acceptsTextInput())) ! (focus_ctrlp && focus_ctrlp->acceptsTextInput()))
{ {
if (gChatBar->getCurrentChat().empty()) if (gChatBar && gChatBar->getCurrentChat().empty())
{ {
// No existing chat in chat editor, insert '/' // No existing chat in chat editor, insert '/'
gChatBar->startChat("/"); LLChatBar::startChat("/");
} }
else else
{ {
// Don't overwrite existing text in chat editor // Don't overwrite existing text in chat editor
gChatBar->startChat(NULL); LLChatBar::startChat(NULL);
} }
} }
} }

View File

@@ -152,10 +152,6 @@ bool can_block(const LLUUID& id);
static const boost::regex NEWLINES("\\n{1}"); static const boost::regex NEWLINES("\\n{1}");
// NaCl End // NaCl End
extern AIHTTPTimeoutPolicy authHandler_timeout;
// //
// Constants // Constants
// //
@@ -3877,17 +3873,18 @@ void process_sound_trigger(LLMessageSystem* msg, void**)
msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_ObjectID, object_id); msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_ObjectID, object_id);
// NaCl - Antispam Registry // NaCl - Antispam Registry
if (auto antispam = NACLAntiSpamRegistry::getIfExists()) if (NACLAntiSpamRegistry::instanceExists())
{ {
auto& antispam = NACLAntiSpamRegistry::instance();
static const LLCachedControl<U32> _NACL_AntiSpamSoundMulti("_NACL_AntiSpamSoundMulti"); static const LLCachedControl<U32> _NACL_AntiSpamSoundMulti("_NACL_AntiSpamSoundMulti");
if (owner_id.isNull()) if (owner_id.isNull())
{ {
bool is_collision_sound(const std::string & sound); bool is_collision_sound(const std::string & sound);
if (!is_collision_sound(sound_id.asString()) if (!is_collision_sound(sound_id.asString())
&& antispam->checkQueue(NACLAntiSpamRegistry::QUEUE_SOUND, object_id, LFIDBearer::OBJECT, _NACL_AntiSpamSoundMulti)) && antispam.checkQueue(NACLAntiSpamRegistry::QUEUE_SOUND, object_id, LFIDBearer::OBJECT, _NACL_AntiSpamSoundMulti))
return; return;
} }
else if (antispam->checkQueue(NACLAntiSpamRegistry::QUEUE_SOUND, owner_id, LFIDBearer::AVATAR, _NACL_AntiSpamSoundMulti)) return; else if (antispam.checkQueue(NACLAntiSpamRegistry::QUEUE_SOUND, owner_id, LFIDBearer::AVATAR, _NACL_AntiSpamSoundMulti)) return;
} }
// NaCl End // NaCl End
@@ -3967,12 +3964,13 @@ void process_preload_sound(LLMessageSystem* msg, void** user_data)
msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id); msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id);
// NaCl - Antispam Registry // NaCl - Antispam Registry
if (auto antispam = NACLAntiSpamRegistry::getIfExists()) if (NACLAntiSpamRegistry::instanceExists())
{ {
auto& antispam = NACLAntiSpamRegistry::instance();
static const LLCachedControl<U32> _NACL_AntiSpamSoundPreloadMulti("_NACL_AntiSpamSoundPreloadMulti"); static const LLCachedControl<U32> _NACL_AntiSpamSoundPreloadMulti("_NACL_AntiSpamSoundPreloadMulti");
if ((owner_id.isNull() if ((owner_id.isNull()
&& antispam->checkQueue(NACLAntiSpamRegistry::QUEUE_SOUND_PRELOAD, object_id, LFIDBearer::OBJECT, _NACL_AntiSpamSoundPreloadMulti)) && antispam.checkQueue(NACLAntiSpamRegistry::QUEUE_SOUND_PRELOAD, object_id, LFIDBearer::OBJECT, _NACL_AntiSpamSoundPreloadMulti))
|| antispam->checkQueue(NACLAntiSpamRegistry::QUEUE_SOUND_PRELOAD, owner_id, LFIDBearer::AVATAR, _NACL_AntiSpamSoundPreloadMulti)) || antispam.checkQueue(NACLAntiSpamRegistry::QUEUE_SOUND_PRELOAD, owner_id, LFIDBearer::AVATAR, _NACL_AntiSpamSoundPreloadMulti))
return; return;
} }
// NaCl End // NaCl End
@@ -4012,11 +4010,12 @@ void process_attached_sound(LLMessageSystem* msg, void** user_data)
msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id); msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id);
// NaCl - Antispam Registry // NaCl - Antispam Registry
if (auto antispam = NACLAntiSpamRegistry::getIfExists()) if (NACLAntiSpamRegistry::instanceExists())
{ {
auto& antispam = NACLAntiSpamRegistry::instance();
if ((owner_id.isNull() if ((owner_id.isNull()
&& antispam->checkQueue(NACLAntiSpamRegistry::QUEUE_SOUND, object_id, LFIDBearer::OBJECT)) && antispam.checkQueue(NACLAntiSpamRegistry::QUEUE_SOUND, object_id, LFIDBearer::OBJECT))
|| antispam->checkQueue(NACLAntiSpamRegistry::QUEUE_SOUND, owner_id)) || antispam.checkQueue(NACLAntiSpamRegistry::QUEUE_SOUND, owner_id))
return; return;
} }
// NaCl End // NaCl End
@@ -5775,9 +5774,11 @@ void process_economy_data(LLMessageSystem* msg, void** /*user_data*/)
void notify_cautioned_script_question(const LLSD& notification, const LLSD& response, S32 orig_questions, BOOL granted) void notify_cautioned_script_question(const LLSD& notification, const LLSD& response, S32 orig_questions, BOOL granted)
{ {
// NaCl - Antispam Registry // NaCl - Antispam Registry
if (auto antispam = NACLAntiSpamRegistry::getIfExists()) if (NACLAntiSpamRegistry::instanceExists())
if (antispam->checkQueue(NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG, notification["payload"]["task_id"].asUUID(), LFIDBearer::OBJECT)) {
if (NACLAntiSpamRegistry::instance().checkQueue(NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG, notification["payload"]["task_id"].asUUID(), LFIDBearer::OBJECT))
return; return;
}
// NaCl End // NaCl End
// only continue if at least some permissions were requested // only continue if at least some permissions were requested
if (orig_questions) if (orig_questions)
@@ -6052,11 +6053,12 @@ void process_script_question(LLMessageSystem* msg, void** user_data)
msg->getUUIDFast(_PREHASH_Data, _PREHASH_ItemID, itemid); msg->getUUIDFast(_PREHASH_Data, _PREHASH_ItemID, itemid);
// NaCl - Antispam Registry // NaCl - Antispam Registry
if (auto antispam = NACLAntiSpamRegistry::getIfExists()) if (NACLAntiSpamRegistry::instanceExists())
{ {
auto& antispam = NACLAntiSpamRegistry::instance();
if ((taskid.isNull() if ((taskid.isNull()
&& antispam->checkQueue(NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG, itemid, LFIDBearer::NONE)) && antispam.checkQueue(NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG, itemid, LFIDBearer::NONE))
|| antispam->checkQueue(NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG, taskid, LFIDBearer::OBJECT)) || antispam.checkQueue(NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG, taskid, LFIDBearer::OBJECT))
return; return;
} }
// NaCl End // NaCl End
@@ -7104,6 +7106,12 @@ void callback_load_url_name(const LLUUID& id, const std::string& full_name, bool
} }
} }
// We've got the name of the person who owns the object hurling the url.
void callback_load_url_avatar_name(const LLUUID& id, const LLAvatarName& av_name)
{
callback_load_url_name(id, av_name.getUserName(), false);
}
void process_load_url(LLMessageSystem* msg, void**) void process_load_url(LLMessageSystem* msg, void**)
{ {
LLUUID object_id; LLUUID object_id;
@@ -7124,11 +7132,12 @@ void process_load_url(LLMessageSystem* msg, void**)
msg->getBOOL("Data", "OwnerIsGroup", owner_is_group); msg->getBOOL("Data", "OwnerIsGroup", owner_is_group);
// NaCl - Antispam Registry // NaCl - Antispam Registry
if (auto antispam = NACLAntiSpamRegistry::getIfExists()) if (NACLAntiSpamRegistry::instanceExists())
{ {
auto& antispam = NACLAntiSpamRegistry::instance();
if ((owner_id.isNull() if ((owner_id.isNull()
&& antispam->checkQueue(NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG, object_id, LFIDBearer::OBJECT)) && antispam.checkQueue(NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG, object_id, LFIDBearer::OBJECT))
|| antispam->checkQueue(NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG, owner_id, owner_is_group ? LFIDBearer::GROUP : LFIDBearer::AVATAR)) || antispam.checkQueue(NACLAntiSpamRegistry::QUEUE_SCRIPT_DIALOG, owner_id, owner_is_group ? LFIDBearer::GROUP : LFIDBearer::AVATAR))
return; return;
} }
// NaCl End // NaCl End
@@ -7157,8 +7166,14 @@ void process_load_url(LLMessageSystem* msg, void**)
// Add to list of pending name lookups // Add to list of pending name lookups
gLoadUrlList.push_back(payload); gLoadUrlList.push_back(payload);
gCacheName->get(owner_id, owner_is_group, if (owner_is_group)
boost::bind(&callback_load_url_name, _1, _2, _3)); {
gCacheName->getGroup(owner_id, boost::bind(&callback_load_url_name, _1, _2, _3));
}
else
{
LLAvatarNameCache::get(owner_id, boost::bind(&callback_load_url_avatar_name, _1, _2));
}
} }
@@ -7308,21 +7323,15 @@ void onCovenantLoadComplete(LLVFS* vfs,
S32 file_length = file.getSize(); S32 file_length = file.getSize();
char* buffer = new char[file_length+1]; std::vector<char> buffer(file_length + 1);
if (buffer == NULL) file.read((U8*)&buffer[0], file_length);
{
LL_ERRS("Messaging") << "Memory Allocation failed" << LL_ENDL;
return;
}
file.read((U8*)buffer, file_length); /* Flawfinder: ignore */
// put a EOS at the end // put a EOS at the end
buffer[file_length] = 0; buffer[file_length] = '\0';
if( (file_length > 19) && !strncmp( buffer, "Linden text version", 19 ) ) if ((file_length > 19) && !strncmp(&buffer[0], "Linden text version", 19))
{ {
LLViewerTextEditor * editor = new LLViewerTextEditor(std::string("temp"), LLRect(0,0,0,0), file_length+1); LLViewerTextEditor * editor = new LLViewerTextEditor(std::string("temp"), LLRect(0,0,0,0), file_length+1);
if( !editor->importBuffer( buffer, file_length+1 ) ) if( !editor->importBuffer( &buffer[0], file_length+1 ) )
{ {
LL_WARNS("Messaging") << "Problem importing estate covenant." << LL_ENDL; LL_WARNS("Messaging") << "Problem importing estate covenant." << LL_ENDL;
covenant_text = "Problem importing estate covenant."; covenant_text = "Problem importing estate covenant.";
@@ -7339,7 +7348,6 @@ void onCovenantLoadComplete(LLVFS* vfs,
LL_WARNS("Messaging") << "Problem importing estate covenant: Covenant file format error." << LL_ENDL; LL_WARNS("Messaging") << "Problem importing estate covenant: Covenant file format error." << LL_ENDL;
covenant_text = "Problem importing estate covenant: Covenant file format error."; covenant_text = "Problem importing estate covenant: Covenant file format error.";
} }
delete[] buffer;
} }
else else
{ {

View File

@@ -872,7 +872,7 @@ LLOcclusionCullingGroup::~LLOcclusionCullingGroup()
if (mSpatialPartition) if (mSpatialPartition)
{ {
auto it = std::find_if(mSpatialPartition->mGroups.begin(), mSpatialPartition->mGroups.end(), [this](LLOcclusionCullingGroup* rhs) {return rhs == this; }); auto it = std::find_if(mSpatialPartition->mGroups.begin(), mSpatialPartition->mGroups.end(), [this](LLOcclusionCullingGroup* rhs) {return rhs == this; });
llassert_always(it != mSpatialPartition->mGroups.end()); llassert(it != mSpatialPartition->mGroups.end());
if (it != mSpatialPartition->mGroups.end()) if (it != mSpatialPartition->mGroups.end())
{ {
mSpatialPartition->mGroups.erase(it); mSpatialPartition->mGroups.erase(it);

View File

@@ -2946,7 +2946,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
{ {
{ {
// passing NULL here, character will be added later when it is handled by character handler. // passing NULL here, character will be added later when it is handled by character handler.
gChatBar->startChat(NULL); LLChatBar::startChat(NULL);
return TRUE; return TRUE;
} }
} }
@@ -3548,7 +3548,7 @@ void LLViewerWindow::updateLayout()
&& gFocusMgr.getKeyboardFocus() == NULL && gFocusMgr.getKeyboardFocus() == NULL
&& gChatBar->isInVisibleChain()) && gChatBar->isInVisibleChain())
{ {
gChatBar->startChat(NULL); LLChatBar::startChat(NULL);
} }
} }