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:
Inusaito Sayori
2015-03-20 22:04:04 -04:00
parent 16a2b28c1b
commit 72080e79e9
135 changed files with 1940 additions and 1282 deletions

View File

@@ -200,7 +200,7 @@ std::string LLMail::buildSMTPTransaction(
if(!from_address || !to_address)
{
llinfos << "send_mail build_smtp_transaction reject: missing to and/or"
<< " from address." << llendl;
<< " from address." << LL_ENDL;
return std::string();
}
if(!valid_subject_chars(subject))
@@ -208,7 +208,7 @@ std::string LLMail::buildSMTPTransaction(
llinfos << "send_mail build_smtp_transaction reject: bad subject header: "
<< "to=<" << to_address
<< ">, from=<" << from_address << ">"
<< llendl;
<< LL_ENDL;
return std::string();
}
std::ostringstream from_fmt;
@@ -266,7 +266,7 @@ bool LLMail::send(
if(!from_address || !to_address)
{
llinfos << "send_mail reject: missing to and/or from address."
<< llendl;
<< LL_ENDL;
return false;
}
@@ -278,7 +278,7 @@ bool LLMail::send(
std::string good_string = "\n..\n";
while (1)
{
int index = message.find(bad_string);
size_t index = message.find(bad_string);
if (index == std::string::npos) break;
message.replace(index, bad_string.size(), good_string);
}
@@ -305,7 +305,7 @@ bool LLMail::send(
{
llinfos << "send_mail reject: mail system is disabled: to=<"
<< to_address << ">, from=<" << from_address
<< ">" << llendl;
<< ">" << LL_ENDL;
// Any future interface to SMTP should return this as an
// error. --mark
return true;
@@ -314,7 +314,7 @@ bool LLMail::send(
{
llwarns << "send_mail reject: mail system not initialized: to=<"
<< to_address << ">, from=<" << from_address
<< ">" << llendl;
<< ">" << LL_ENDL;
return false;
}
@@ -322,7 +322,7 @@ bool LLMail::send(
{
llwarns << "send_mail reject: SMTP connect failure: to=<"
<< to_address << ">, from=<" << from_address
<< ">" << llendl;
<< ">" << LL_ENDL;
return false;
}
@@ -342,20 +342,20 @@ bool LLMail::send(
<< "to=<" << to_address
<< ">, from=<" << from_address << ">"
<< ", bytes=" << original_size
<< ", sent=" << send_size << llendl;
<< ", sent=" << send_size << LL_ENDL;
return false;
}
if(send_size >= LL_MAX_KNOWN_GOOD_MAIL_SIZE)
{
llwarns << "send_mail message has been shown to fail in testing "
<< "when sending messages larger than " << LL_MAX_KNOWN_GOOD_MAIL_SIZE
<< " bytes. The next log about success is potentially a lie." << llendl;
<< " bytes. The next log about success is potentially a lie." << LL_ENDL;
}
lldebugs << "send_mail success: "
<< "to=<" << to_address
<< ">, from=<" << from_address << ">"
<< ", bytes=" << original_size
<< ", sent=" << send_size << llendl;
<< ", sent=" << send_size << LL_ENDL;
#if LL_LOG_ENTIRE_MAIL_MESSAGE_ON_SEND
llinfos << rfc2822_msg.str() << llendl;

View File

@@ -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())
{

View File

@@ -68,21 +68,21 @@ inline BOOL to_region_handle(const F32 x_pos, const F32 y_pos, U64 *region_handl
U32 x_int, y_int;
if (x_pos < 0.f)
{
// llwarns << "to_region_handle:Clamping negative x position " << x_pos << " to zero!" << llendl;
// LL_WARNS() << "to_region_handle:Clamping negative x position " << x_pos << " to zero!" << LL_ENDL;
return FALSE;
}
else
{
x_int = (U32)llmath::llround(x_pos);
x_int = (U32)ll_round(x_pos);
}
if (y_pos < 0.f)
{
// llwarns << "to_region_handle:Clamping negative y position " << y_pos << " to zero!" << llendl;
// LL_WARNS() << "to_region_handle:Clamping negative y position " << y_pos << " to zero!" << LL_ENDL;
return FALSE;
}
else
{
y_int = (U32)llmath::llround(y_pos);
y_int = (U32)ll_round(y_pos);
}
*region_handle = to_region_handle(x_int, y_int);
return TRUE;

View File

@@ -391,7 +391,7 @@ BOOL LLThrottleGroup::dynamicAdjust()
}
mBitsSentThisPeriod[i] = 0;
total += llmath::llround(mBitsSentHistory[i]);
total += ll_round(mBitsSentHistory[i]);
}
// Look for busy channels

View File

@@ -2765,7 +2765,7 @@ void LLMessageSystem::dumpReceiveCounts()
if (mt->mReceiveCount > 0)
{
LL_INFOS("Messaging") << "Num: " << std::setw(3) << mt->mReceiveCount << " Bytes: " << std::setw(6) << mt->mReceiveBytes
<< " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << llmath::llround(100 * mt->mDecodeTimeThisFrame / mReceiveTime) << "%" << llendl;
<< " Invalid: " << std::setw(3) << mt->mReceiveInvalid << " " << mt->mName << " " << ll_round(100 * mt->mDecodeTimeThisFrame / mReceiveTime) << "%" << llendl;
}
}
}

View File

@@ -26,7 +26,7 @@
#include "linden_common.h"
#include "net.h"
//#include "net.h"
// system library includes
#include <stdexcept>
@@ -36,7 +36,6 @@
#include <winsock2.h>
#include <windows.h>
#else
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -370,7 +369,7 @@ BOOL send_packet(int hSocket, const char *sendBuffer, int size, U32 recipient, i
return TRUE;
}
llinfos << "sendto() failed to " << u32_to_ip_string(recipient) << ":" << nPort
<< ", Error " << last_error << llendl;
<< ", Error " << last_error << LL_ENDL;
}
}
} while ( (nRet == SOCKET_ERROR)
@@ -414,7 +413,7 @@ S32 start_net(S32& socket_out, int& nPort)
if (nRet < 0)
{
llwarns << "Failed to bind on an OS assigned port error: "
<< nRet << llendl;
<< nRet << LL_ENDL;
}
else
{
@@ -596,7 +595,7 @@ int receive_packet(int hSocket, char * receiveBuffer)
}
// Uncomment for testing if/when implementing for Mac or Windows:
// llinfos << "Received datagram to in addr " << u32_to_ip_string(get_receiving_interface_ip()) << llendl;
// LL_INFOS() << "Received datagram to in addr " << u32_to_ip_string(get_receiving_interface_ip()) << LL_ENDL;
return nRet;
}

View File

@@ -67,5 +67,8 @@ const S32 ETHERNET_MTU_BYTES = 1500;
const S32 MTUBITS = MTUBYTES*8;
const S32 MTUU32S = MTUBITS/32;
// For automatic port discovery when running multiple viewers on one host
const U32 PORT_DISCOVERY_RANGE_MIN = 13000;
const U32 PORT_DISCOVERY_RANGE_MAX = PORT_DISCOVERY_RANGE_MIN + 50;
#endif