summaryrefslogtreecommitdiff
path: root/indra/llmessage/llmessagethrottle.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2021-09-28 19:07:48 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2021-09-28 19:22:18 +0300
commitadcd08fbf4d96f8f52cef81895bda202c9e45896 (patch)
tree3e8643d7d2b19c86d723c79042e8b528a9508dd1 /indra/llmessage/llmessagethrottle.cpp
parente3b869e6f12a9d285ca3db4a2e7f4f0fa1ff8b26 (diff)
Revert "Merge branch 'c++17' into DRTVWR-522-maint"
This reverts commit 203ea3a70a775a09cbbffb1740ab7c58f1780baa, reversing changes made to 8e3f0778863a5aa337d1148a243ea91d238a8ac5. # Conflicts: # indra/newview/llmachineid.cpp
Diffstat (limited to 'indra/llmessage/llmessagethrottle.cpp')
-rw-r--r--indra/llmessage/llmessagethrottle.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/indra/llmessage/llmessagethrottle.cpp b/indra/llmessage/llmessagethrottle.cpp
index c5ae8b4547..579d6d7187 100644
--- a/indra/llmessage/llmessagethrottle.cpp
+++ b/indra/llmessage/llmessagethrottle.cpp
@@ -32,8 +32,18 @@
#include "llframetimer.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
bool eq_message_throttle_entry(LLMessageThrottleEntry a, LLMessageThrottleEntry b)
{ return a.getHash() == b.getHash(); }
+#endif
const U64 SEC_TO_USEC = 1000000;
@@ -108,8 +118,14 @@ BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const std::string& mesg
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.
@@ -136,8 +152,14 @@ BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, c
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())
{