Sync llcommon with Alchemy a bit.
llmath::llround->ll_round LL_ICC->LL_INTELC Add llpredicate Add LL_CPP11 macro Remove llhash Update llinitparam, llsd and all relatives of it.
This commit is contained in:
@@ -26,25 +26,13 @@
|
||||
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llhash.h"
|
||||
|
||||
#include "llmessagethrottle.h"
|
||||
#include "llframetimer.h"
|
||||
#include "fix_macros.h"
|
||||
|
||||
// This is used for the stl search_n function.
|
||||
#if _MSC_VER >= 1500 // VC9 has a bug in search_n
|
||||
struct eq_message_throttle_entry : public std::binary_function< LLMessageThrottleEntry, LLMessageThrottleEntry, bool >
|
||||
{
|
||||
bool operator()(const LLMessageThrottleEntry& a, const LLMessageThrottleEntry& b) const
|
||||
{
|
||||
return a.getHash() == b.getHash();
|
||||
}
|
||||
};
|
||||
#else
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
bool eq_message_throttle_entry(LLMessageThrottleEntry a, LLMessageThrottleEntry b)
|
||||
{ return a.getHash() == b.getHash(); }
|
||||
#endif
|
||||
|
||||
const U64 SEC_TO_USEC = 1000000;
|
||||
|
||||
@@ -114,19 +102,14 @@ BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg
|
||||
std::ostringstream full_mesg;
|
||||
full_mesg << to << mesg;
|
||||
|
||||
// Create an entry for this message.
|
||||
size_t hash = llhash(full_mesg.str().c_str());
|
||||
// Create an entry for this message.o.o
|
||||
size_t hash = boost::hash<std::string>()(full_mesg.str());
|
||||
LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime());
|
||||
|
||||
// Check if this message is already in the list.
|
||||
#if _MSC_VER >= 1500 // VC9 has a bug in search_n
|
||||
// SJB: This *should* work but has not been tested yet *TODO: Test!
|
||||
message_list_iterator_t found = std::find_if(message_list->begin(), message_list->end(),
|
||||
std::bind2nd(eq_message_throttle_entry(), entry));
|
||||
#else
|
||||
message_list_iterator_t found = std::search_n(message_list->begin(), message_list->end(),
|
||||
1, entry, eq_message_throttle_entry);
|
||||
#endif
|
||||
|
||||
if (found == message_list->end())
|
||||
{
|
||||
// This message was not found. Add it to the list.
|
||||
@@ -149,18 +132,12 @@ BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, c
|
||||
full_mesg << agent << task << mesg;
|
||||
|
||||
// Create an entry for this message.
|
||||
size_t hash = llhash(full_mesg.str().c_str());
|
||||
size_t hash = boost::hash<std::string>()(full_mesg.str());
|
||||
LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime());
|
||||
|
||||
// Check if this message is already in the list.
|
||||
#if _MSC_VER >= 1500 // VC9 has a bug in search_n
|
||||
// SJB: This *should* work but has not been tested yet *TODO: Test!
|
||||
message_list_iterator_t found = std::find_if(message_list->begin(), message_list->end(),
|
||||
std::bind2nd(eq_message_throttle_entry(), entry));
|
||||
#else
|
||||
message_list_iterator_t found = std::search_n(message_list->begin(), message_list->end(),
|
||||
1, entry, eq_message_throttle_entry);
|
||||
#endif
|
||||
|
||||
if (found == message_list->end())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user