aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/llmessagethrottle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llmessage/llmessagethrottle.cpp')
-rw-r--r--linden/indra/llmessage/llmessagethrottle.cpp35
1 files changed, 28 insertions, 7 deletions
diff --git a/linden/indra/llmessage/llmessagethrottle.cpp b/linden/indra/llmessage/llmessagethrottle.cpp
index d0ae872..84733ba 100644
--- a/linden/indra/llmessage/llmessagethrottle.cpp
+++ b/linden/indra/llmessage/llmessagethrottle.cpp
@@ -12,12 +12,12 @@
12 * ("GPL"), unless you have obtained a separate licensing agreement 12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of 13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or 14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlife.com/developers/opensource/gplv2 15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 * 16 *
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlife.com/developers/opensource/flossexception 20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 21 *
22 * By copying, modifying or distributing this software, you acknowledge 22 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 23 * that you have read and understood your obligations described above,
@@ -37,8 +37,18 @@
37#include "llframetimer.h" 37#include "llframetimer.h"
38 38
39// This is used for the stl search_n function. 39// This is used for the stl search_n function.
40#if _MSC_VER >= 1500 // VC9 has a bug in search_n
41struct eq_message_throttle_entry : public std::binary_function< LLMessageThrottleEntry, LLMessageThrottleEntry, bool >
42{
43 bool operator()(const LLMessageThrottleEntry& a, const LLMessageThrottleEntry& b) const
44 {
45 return a.getHash() == b.getHash();
46 }
47};
48#else
40bool eq_message_throttle_entry(LLMessageThrottleEntry a, LLMessageThrottleEntry b) 49bool eq_message_throttle_entry(LLMessageThrottleEntry a, LLMessageThrottleEntry b)
41 { return a.getHash() == b.getHash(); } 50 { return a.getHash() == b.getHash(); }
51#endif
42 52
43const U64 SEC_TO_USEC = 1000000; 53const U64 SEC_TO_USEC = 1000000;
44 54
@@ -113,9 +123,14 @@ BOOL LLMessageThrottle::addViewerAlert(const LLUUID& to, const char* mesg)
113 LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime()); 123 LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime());
114 124
115 // Check if this message is already in the list. 125 // Check if this message is already in the list.
116 message_list_iterator_t found = std::search_n(message_list->begin(), message_list->end(), 126#if _MSC_VER >= 1500 // VC9 has a bug in search_n
117 1, entry, eq_message_throttle_entry); 127 // SJB: This *should* work but has not been tested yet *TODO: Test!
118 128 message_list_iterator_t found = std::find_if(message_list->begin(), message_list->end(),
129 std::bind2nd(eq_message_throttle_entry(), entry));
130#else
131 message_list_iterator_t found = std::search_n(message_list->begin(), message_list->end(),
132 1, entry, eq_message_throttle_entry);
133#endif
119 if (found == message_list->end()) 134 if (found == message_list->end())
120 { 135 {
121 // This message was not found. Add it to the list. 136 // This message was not found. Add it to the list.
@@ -142,9 +157,15 @@ BOOL LLMessageThrottle::addAgentAlert(const LLUUID& agent, const LLUUID& task, c
142 LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime()); 157 LLMessageThrottleEntry entry(hash, LLFrameTimer::getTotalTime());
143 158
144 // Check if this message is already in the list. 159 // Check if this message is already in the list.
160#if _MSC_VER >= 1500 // VC9 has a bug in search_n
161 // SJB: This *should* work but has not been tested yet *TODO: Test!
162 message_list_iterator_t found = std::find_if(message_list->begin(), message_list->end(),
163 std::bind2nd(eq_message_throttle_entry(), entry));
164#else
145 message_list_iterator_t found = std::search_n(message_list->begin(), message_list->end(), 165 message_list_iterator_t found = std::search_n(message_list->begin(), message_list->end(),
146 1, entry, eq_message_throttle_entry); 166 1, entry, eq_message_throttle_entry);
147 167#endif
168
148 if (found == message_list->end()) 169 if (found == message_list->end())
149 { 170 {
150 // This message was not found. Add it to the list. 171 // This message was not found. Add it to the list.