Alchemy llcharacter and llcommon merge pass.
This commit is contained in:
@@ -8,6 +8,7 @@ include(LLCommon)
|
||||
include(APR)
|
||||
include(Linking)
|
||||
include(Boost)
|
||||
include(OpenSSL)
|
||||
include(LLSharedLibs)
|
||||
include(GoogleBreakpad)
|
||||
include(Copy3rdPartyLibs)
|
||||
@@ -16,6 +17,7 @@ include(ZLIB)
|
||||
include_directories(
|
||||
${EXPAT_INCLUDE_DIRS}
|
||||
${LLCOMMON_INCLUDE_DIRS}
|
||||
${OPENSSL_INCLUDE_DIRS}
|
||||
${ZLIB_INCLUDE_DIRS}
|
||||
${BREAKPAD_INCLUDE_DIRECTORIES}
|
||||
)
|
||||
@@ -284,6 +286,7 @@ target_link_libraries(
|
||||
${APRUTIL_LIBRARIES}
|
||||
${APR_LIBRARIES}
|
||||
${EXPAT_LIBRARIES}
|
||||
${OPENSSL_LIBRARIES}
|
||||
${ZLIB_LIBRARIES}
|
||||
${WINDOWS_LIBRARIES}
|
||||
${Boost_CONTEXT_LIBRARY}
|
||||
|
||||
@@ -49,9 +49,8 @@
|
||||
* signatures.
|
||||
*/
|
||||
template <typename FTYPE>
|
||||
inline BOOL is_approx_equal_fraction_impl(FTYPE x, FTYPE y, U32 frac_bits)
|
||||
inline bool is_approx_equal_fraction_impl(FTYPE x, FTYPE y, U32 frac_bits)
|
||||
{
|
||||
BOOL ret = TRUE;
|
||||
FTYPE diff = (FTYPE) fabs(x - y);
|
||||
|
||||
S32 diffInt = (S32) diff;
|
||||
@@ -64,20 +63,20 @@ inline BOOL is_approx_equal_fraction_impl(FTYPE x, FTYPE y, U32 frac_bits)
|
||||
// based on the number of bits used for packing decimal portion.
|
||||
if (diffInt != 0 || diffFracTolerance > 1)
|
||||
{
|
||||
ret = FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// F32 flavor
|
||||
inline BOOL is_approx_equal_fraction(F32 x, F32 y, U32 frac_bits)
|
||||
inline bool is_approx_equal_fraction(F32 x, F32 y, U32 frac_bits)
|
||||
{
|
||||
return is_approx_equal_fraction_impl<F32>(x, y, frac_bits);
|
||||
}
|
||||
|
||||
/// F64 flavor
|
||||
inline BOOL is_approx_equal_fraction(F64 x, F64 y, U32 frac_bits)
|
||||
inline bool is_approx_equal_fraction(F64 x, F64 y, U32 frac_bits)
|
||||
{
|
||||
return is_approx_equal_fraction_impl<F64>(x, y, frac_bits);
|
||||
}
|
||||
|
||||
@@ -43,11 +43,9 @@
|
||||
#endif
|
||||
|
||||
#if defined(LL_WINDOWS) && defined(_DEBUG)
|
||||
# if _MSC_VER >= 1400 // Visual C++ 2005 or later
|
||||
# define _CRTDBG_MAP_ALLOC
|
||||
# include <stdlib.h>
|
||||
# include <crtdbg.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "llpreprocessor.h"
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
static const std::string HEAP_PROFILE_MAGIC_STR = "heap profile:";
|
||||
static const std::string HEAP_PROFILE_MAGIC_STR("heap profile:");
|
||||
|
||||
static bool is_separator(char c)
|
||||
{
|
||||
@@ -70,7 +70,7 @@ void LLAllocatorHeapProfile::parse(std::string const & prof_text)
|
||||
range_t prof_range(prof_begin, prof_text.end());
|
||||
boost::algorithm::split(prof_lines,
|
||||
prof_range,
|
||||
boost::bind(std::equal_to<llwchar>(), '\n', _1));
|
||||
std::bind(std::equal_to<llwchar>(), '\n', std::placeholders::_1));
|
||||
|
||||
std::vector< range_t >::const_iterator i;
|
||||
for(i = prof_lines.begin(); i != prof_lines.end() && !i->empty(); ++i)
|
||||
|
||||
@@ -28,38 +28,31 @@
|
||||
#include "linden_common.h"
|
||||
|
||||
#include "llbase64.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "apr_base64.h"
|
||||
|
||||
#include <openssl/evp.h>
|
||||
|
||||
// static
|
||||
std::string LLBase64::encode(const U8* input, size_t input_size)
|
||||
{
|
||||
std::string output;
|
||||
if (input
|
||||
&& input_size > 0)
|
||||
{
|
||||
// Yes, it returns int.
|
||||
int b64_buffer_length = apr_base64_encode_len(input_size);
|
||||
char* b64_buffer = new char[b64_buffer_length];
|
||||
|
||||
// This is faster than apr_base64_encode() if you know
|
||||
// you're not on an EBCDIC machine. Also, the output is
|
||||
// null terminated, even though the documentation doesn't
|
||||
// specify. See apr_base64.c for details. JC
|
||||
b64_buffer_length = apr_base64_encode_binary(
|
||||
b64_buffer,
|
||||
input,
|
||||
input_size);
|
||||
output.assign(b64_buffer);
|
||||
delete[] b64_buffer;
|
||||
}
|
||||
return output;
|
||||
if (!(input && input_size > 0)) return LLStringUtil::null;
|
||||
|
||||
BIO *b64 = BIO_new(BIO_f_base64());
|
||||
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
|
||||
|
||||
BIO *bio = BIO_new(BIO_s_mem());
|
||||
BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL);
|
||||
bio = BIO_push(b64, bio);
|
||||
BIO_write(bio, input, input_size);
|
||||
|
||||
(void)BIO_flush(bio);
|
||||
|
||||
char *new_data;
|
||||
size_t bytes_written = BIO_get_mem_data(bio, &new_data);
|
||||
std::string result(new_data, bytes_written);
|
||||
BIO_free_all(bio);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
std::string LLBase64::encode(const std::string& in_str)
|
||||
{
|
||||
@@ -74,9 +67,16 @@ std::string LLBase64::encode(const std::string& in_str)
|
||||
size_t LLBase64::decode(const std::string& input, U8 * buffer, size_t buffer_size)
|
||||
{
|
||||
if (input.empty()) return 0;
|
||||
|
||||
size_t bytes_written = apr_base64_decode_binary(buffer, input.data());
|
||||
|
||||
|
||||
BIO *b64 = BIO_new(BIO_f_base64());
|
||||
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
|
||||
|
||||
// BIO_new_mem_buf is not const aware, but it doesn't modify the buffer
|
||||
BIO *bio = BIO_new_mem_buf(const_cast<char*>(input.c_str()), input.length());
|
||||
bio = BIO_push(b64, bio);
|
||||
size_t bytes_written = BIO_read(bio, buffer, buffer_size);
|
||||
BIO_free_all(bio);
|
||||
|
||||
return bytes_written;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ void LLCallbackList::addFunction( callback_t func, void *data)
|
||||
|
||||
bool LLCallbackList::containsFunction( callback_t func, void *data)
|
||||
{
|
||||
callback_pair_t t(func, data);
|
||||
callback_list_t::iterator iter = find(func,data);
|
||||
if (iter != mCallbackList.end())
|
||||
{
|
||||
|
||||
@@ -88,7 +88,7 @@ std::string LLDate::asRFC1123() const
|
||||
|
||||
LLTrace::BlockTimerStatHandle FT_DATE_FORMAT("Date Format");
|
||||
|
||||
std::string LLDate::toHTTPDateString(std::string fmt) const
|
||||
std::string LLDate::toHTTPDateString(const std::string& fmt) const
|
||||
{
|
||||
LL_RECORD_BLOCK_TIME(FT_DATE_FORMAT);
|
||||
|
||||
@@ -102,7 +102,7 @@ std::string LLDate::toHTTPDateString(std::string fmt) const
|
||||
return toHTTPDateString(gmt, fmt);
|
||||
}
|
||||
|
||||
std::string LLDate::toHTTPDateString(tm * gmt, std::string fmt)
|
||||
std::string LLDate::toHTTPDateString(tm * gmt, const std::string& fmt)
|
||||
{
|
||||
LL_RECORD_BLOCK_TIME(FT_DATE_FORMAT);
|
||||
|
||||
@@ -115,8 +115,8 @@ std::string LLDate::toHTTPDateString(tm * gmt, std::string fmt)
|
||||
}
|
||||
|
||||
// use strftime() as it appears to be faster than std::time_put
|
||||
char buffer[128];
|
||||
if (std::strftime(buffer, 128, fmt.c_str(), gmt) == 0)
|
||||
char buffer[128] = {};
|
||||
if (std::strftime(buffer, sizeof(buffer), fmt.c_str(), gmt) == 0)
|
||||
return LLStringExplicit(EPOCH_STR);
|
||||
std::string res(buffer);
|
||||
|
||||
|
||||
@@ -86,8 +86,8 @@ public:
|
||||
std::string asRFC1123() const;
|
||||
void toStream(std::ostream&) const;
|
||||
bool split(S32 *year, S32 *month = NULL, S32 *day = NULL, S32 *hour = NULL, S32 *min = NULL, S32 *sec = NULL) const;
|
||||
std::string toHTTPDateString (std::string fmt) const;
|
||||
static std::string toHTTPDateString (tm * gmt, std::string fmt);
|
||||
std::string toHTTPDateString (const std::string& fmt) const;
|
||||
static std::string toHTTPDateString (tm * gmt, const std::string& fmt);
|
||||
/**
|
||||
* @brief Set the date from an ISO-8601 string.
|
||||
*
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <boost/graph/exception.hpp>
|
||||
// other Linden headers
|
||||
|
||||
LLDependenciesBase::VertexList LLDependenciesBase::topo_sort(int vertices, const EdgeList& edges) const
|
||||
LLDependenciesBase::VertexList LLDependenciesBase::topo_sort(std::size_t vertices, const EdgeList& edges) const
|
||||
{
|
||||
// Construct a Boost Graph Library graph according to the constraints
|
||||
// we've collected. It seems as though we ought to be able to capture
|
||||
|
||||
@@ -127,9 +127,9 @@ public:
|
||||
virtual std::string describe(bool full=true) const;
|
||||
|
||||
protected:
|
||||
typedef std::vector< std::pair<int, int> > EdgeList;
|
||||
typedef std::vector<int> VertexList;
|
||||
VertexList topo_sort(int vertices, const EdgeList& edges) const;
|
||||
typedef std::vector< std::pair<std::size_t, std::size_t> > EdgeList;
|
||||
typedef std::vector<std::size_t> VertexList;
|
||||
VertexList topo_sort(std::size_t vertices, const EdgeList& edges) const;
|
||||
|
||||
/**
|
||||
* refpair is specifically intended to capture a pair of references. This
|
||||
@@ -511,7 +511,7 @@ public:
|
||||
// been explicitly added. Rely on std::map rejecting a second attempt
|
||||
// to insert the same key. Use the map's size() as the vertex number
|
||||
// to get a distinct value for each successful insertion.
|
||||
typedef std::map<KEY, int> VertexMap;
|
||||
typedef std::map<KEY, std::size_t> VertexMap;
|
||||
VertexMap vmap;
|
||||
// Nest each of these loops because !@#$%? MSVC warns us that its
|
||||
// former broken behavior has finally been fixed -- and our builds
|
||||
@@ -542,7 +542,7 @@ public:
|
||||
for (typename DepNodeMap::const_iterator nmi = mNodes.begin(), nmend = mNodes.end();
|
||||
nmi != nmend; ++nmi)
|
||||
{
|
||||
int thisnode = vmap[nmi->first];
|
||||
std::size_t thisnode = vmap[nmi->first];
|
||||
// after dependencies: build edges from the named node to this one
|
||||
for (typename DepNode::dep_set::const_iterator ai = nmi->second.after.begin(),
|
||||
aend = nmi->second.after.end();
|
||||
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
{
|
||||
for (const_iterator_t dictionary_iter = map_t::begin();
|
||||
dictionary_iter != map_t::end();
|
||||
dictionary_iter++)
|
||||
++dictionary_iter)
|
||||
{
|
||||
const Entry *entry = dictionary_iter->second;
|
||||
if (entry->mName == name)
|
||||
|
||||
@@ -226,7 +226,7 @@ bool LLSimpleDispatcher::fireEvent(LLPointer<LLEvent> event, LLSD filter)
|
||||
for (itor=mListeners.begin(); itor!=mListeners.end(); ++itor)
|
||||
{
|
||||
LLListenerEntry& entry = *itor;
|
||||
if (filter_string == "" || entry.filter.asString() == filter_string)
|
||||
if (filter_string.empty() || entry.filter.asString() == filter_string)
|
||||
{
|
||||
(entry.listener)->handleEvent(event, (*itor).userdata);
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ struct LLEventDispatcher::ParamsDispatchEntry: public LLEventDispatcher::Dispatc
|
||||
virtual void call(const std::string& desc, const LLSD& event) const
|
||||
{
|
||||
LLSDArgsSource src(desc, event);
|
||||
mInvoker(boost::bind(&LLSDArgsSource::next, boost::ref(src)));
|
||||
mInvoker(std::bind(&LLSDArgsSource::next, std::ref(src)));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -57,19 +57,12 @@ static const int& nil(nil_);
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#ifndef BOOST_FUNCTION_HPP_INCLUDED
|
||||
#include <boost/function.hpp>
|
||||
#define BOOST_FUNCTION_HPP_INCLUDED
|
||||
#endif
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/function_types/is_nonmember_callable_builtin.hpp>
|
||||
#include <boost/function_types/parameter_types.hpp>
|
||||
#include <boost/function_types/function_arity.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/fusion/include/push_back.hpp>
|
||||
#include <boost/fusion/include/cons.hpp>
|
||||
#include <boost/fusion/include/invoke.hpp>
|
||||
@@ -303,7 +296,7 @@ private:
|
||||
// subclass object. However, I definitely want DispatchMap to destroy
|
||||
// DispatchEntry if no references are outstanding at the time an entry is
|
||||
// removed. This looks like a job for boost::shared_ptr.
|
||||
typedef std::map<std::string, boost::shared_ptr<DispatchEntry> > DispatchMap;
|
||||
typedef std::map<std::string, std::shared_ptr<DispatchEntry> > DispatchMap;
|
||||
|
||||
public:
|
||||
/// We want the flexibility to redefine what data we store per name,
|
||||
@@ -430,7 +423,7 @@ struct LLEventDispatcher::invoker
|
||||
// Instead of grabbing the first item from argsrc and making an
|
||||
// LLSDParam of it, call getter() and pass that as the instance param.
|
||||
invoker<Function, next_iter_type, To>::apply
|
||||
( func, argsrc, boost::fusion::push_back(boost::fusion::nil(), boost::ref(getter())));
|
||||
( func, argsrc, boost::fusion::push_back(boost::fusion::nil(), std::ref(getter())));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -33,15 +33,14 @@
|
||||
// STL headers
|
||||
// std headers
|
||||
// external library headers
|
||||
#include <boost/bind.hpp>
|
||||
// other Linden headers
|
||||
#include "llerror.h" // LL_ERRS
|
||||
#include "llsdutil.h" // llsd_matches()
|
||||
|
||||
LLEventFilter::LLEventFilter(LLEventPump& source, const std::string& name, bool tweak):
|
||||
LLEventStream(name, tweak)
|
||||
LLEventStream(name, tweak),
|
||||
mSource(source.listen(getName(), boost::bind(&LLEventFilter::post, this, _1)))
|
||||
{
|
||||
source.listen(getName(), boost::bind(&LLEventFilter::post, this, _1));
|
||||
}
|
||||
|
||||
LLEventMatching::LLEventMatching(const LLSD& pattern):
|
||||
|
||||
@@ -32,10 +32,6 @@
|
||||
#include "llevents.h"
|
||||
#include "stdtypes.h"
|
||||
#include "lltimer.h"
|
||||
#ifndef BOOST_FUNCTION_HPP_INCLUDED
|
||||
#include <boost/function.hpp>
|
||||
#define BOOST_FUNCTION_HPP_INCLUDED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Generic base class
|
||||
@@ -52,6 +48,9 @@ public:
|
||||
|
||||
/// Post an event to all listeners
|
||||
virtual bool post(const LLSD& event) = 0;
|
||||
|
||||
private:
|
||||
LLTempBoundListener mSource;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -89,7 +88,7 @@ public:
|
||||
LLEventTimeoutBase(LLEventPump& source);
|
||||
|
||||
/// Callable, can be constructed with boost::bind()
|
||||
typedef boost::function<void()> Action;
|
||||
typedef std::function<void()> Action;
|
||||
|
||||
/**
|
||||
* Start countdown timer for the specified number of @a seconds. Forward
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
#define LLHANDLE_H
|
||||
|
||||
#include "llpointer.h"
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
/**
|
||||
* Helper object for LLHandle. Don't instantiate these directly, used
|
||||
@@ -86,7 +85,7 @@ public:
|
||||
LLHandle() : mTombStone(getDefaultTombStone()) {}
|
||||
|
||||
template<typename U>
|
||||
LLHandle(const LLHandle<U>& other, typename boost::enable_if< typename boost::is_convertible<U*, T*> >::type* dummy = 0)
|
||||
LLHandle(const LLHandle<U>& other, typename std::enable_if<std::is_convertible<U*, T*>::value>::type* dummy = nullptr)
|
||||
: mTombStone(other.mTombStone)
|
||||
{}
|
||||
|
||||
@@ -195,7 +194,7 @@ public:
|
||||
}
|
||||
|
||||
template <typename U>
|
||||
LLHandle<U> getDerivedHandle(typename boost::enable_if< typename boost::is_convertible<U*, T*> >::type* dummy = 0) const
|
||||
LLHandle<U> getDerivedHandle(typename std::enable_if<std::is_convertible<U*, T*>::value>::type* dummy = nullptr) const
|
||||
{
|
||||
LLHandle<U> downcast_handle;
|
||||
downcast_handle.mTombStone = getHandle().mTombStone;
|
||||
|
||||
@@ -67,8 +67,8 @@ namespace LLInitParam
|
||||
mMergeFunc(merge_func),
|
||||
mDeserializeFunc(deserialize_func),
|
||||
mSerializeFunc(serialize_func),
|
||||
mInspectFunc(inspect_func),
|
||||
mValidationFunc(validation_func),
|
||||
mInspectFunc(inspect_func),
|
||||
mMinCount(min_count),
|
||||
mMaxCount(max_count),
|
||||
mUserData(NULL)
|
||||
@@ -79,8 +79,8 @@ namespace LLInitParam
|
||||
mMergeFunc(NULL),
|
||||
mDeserializeFunc(NULL),
|
||||
mSerializeFunc(NULL),
|
||||
mInspectFunc(NULL),
|
||||
mValidationFunc(NULL),
|
||||
mInspectFunc(NULL),
|
||||
mMinCount(0),
|
||||
mMaxCount(0),
|
||||
mUserData(NULL)
|
||||
@@ -193,7 +193,12 @@ namespace LLInitParam
|
||||
{
|
||||
if (!silent)
|
||||
{
|
||||
p.parserWarning(llformat("Failed to parse parameter \"%s\"", p.getCurrentElementName().c_str()));
|
||||
std::string file_name = p.getCurrentFileName();
|
||||
if(!file_name.empty())
|
||||
{
|
||||
file_name = "in file: " + file_name;
|
||||
}
|
||||
p.parserWarning(llformat("Failed to parse parameter \"%s\" %s", p.getCurrentElementName().c_str(), file_name.c_str()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -30,13 +30,7 @@
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#ifndef BOOST_FUNCTION_HPP_INCLUDED
|
||||
#include <boost/function.hpp>
|
||||
#define BOOST_FUNCTION_HPP_INCLUDED
|
||||
#endif
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_enum.hpp>
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
#include "llerror.h"
|
||||
@@ -118,7 +112,7 @@ namespace LLInitParam
|
||||
|
||||
// wraps comparison operator between any 2 values of the same type
|
||||
// specialize to handle cases where equality isn't defined well, or at all
|
||||
template <typename T, bool IS_BOOST_FUNCTION = boost::is_convertible<T, boost::function_base>::value >
|
||||
template <typename T, bool IS_BOOST_FUNCTION = std::is_convertible<T, boost::function_base>::value >
|
||||
struct ParamCompare
|
||||
{
|
||||
static bool equals(const T &a, const T &b)
|
||||
@@ -499,7 +493,7 @@ namespace LLInitParam
|
||||
|
||||
virtual ~Parser();
|
||||
|
||||
template <typename T> bool readValue(T& param, typename boost::disable_if<boost::is_enum<T> >::type* dummy = 0)
|
||||
template <typename T> bool readValue(T& param, typename std::enable_if<!std::is_enum<T>::value>::type* dummy = 0)
|
||||
{
|
||||
parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T));
|
||||
if (found_it != mParserReadFuncs->end())
|
||||
@@ -509,8 +503,8 @@ namespace LLInitParam
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T> bool readValue(T& param, typename boost::enable_if<boost::is_enum<T> >::type* dummy = 0)
|
||||
|
||||
template <typename T> bool readValue(T& param, typename std::enable_if<std::is_enum<T>::value>::type* dummy = nullptr)
|
||||
{
|
||||
parser_read_func_map_t::iterator found_it = mParserReadFuncs->find(&typeid(T));
|
||||
if (found_it != mParserReadFuncs->end())
|
||||
@@ -554,6 +548,7 @@ namespace LLInitParam
|
||||
}
|
||||
|
||||
virtual std::string getCurrentElementName() = 0;
|
||||
virtual std::string getCurrentFileName() = 0;
|
||||
virtual void parserWarning(const std::string& message);
|
||||
virtual void parserError(const std::string& message);
|
||||
void setParseSilently(bool silent) { mParseSilently = silent; }
|
||||
@@ -633,7 +628,7 @@ namespace LLInitParam
|
||||
UserData* mUserData;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<ParamDescriptor> ParamDescriptorPtr;
|
||||
typedef std::shared_ptr<ParamDescriptor> ParamDescriptorPtr;
|
||||
|
||||
// each derived Block class keeps a static data structure maintaining offsets to various params
|
||||
class LL_COMMON_API BlockDescriptor
|
||||
@@ -1449,7 +1444,7 @@ namespace LLInitParam
|
||||
++it)
|
||||
{
|
||||
std::string key = it->getValueName();
|
||||
name_stack.push_back(std::make_pair(std::string(), true));
|
||||
name_stack.emplace_back(std::string(), true);
|
||||
|
||||
if(key.empty())
|
||||
// not parsed via name values, write out value directly
|
||||
@@ -1501,7 +1496,7 @@ namespace LLInitParam
|
||||
|
||||
param_value_t& add()
|
||||
{
|
||||
mValues.push_back(value_t());
|
||||
mValues.emplace_back(value_t());
|
||||
Param::setProvided();
|
||||
return mValues.back();
|
||||
}
|
||||
|
||||
@@ -102,19 +102,19 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) {
|
||||
uint4 input_index, buffer_index;
|
||||
uint4 buffer_space; // how much space is left in buffer
|
||||
|
||||
if (finalized){ // so we can't update!
|
||||
if (mFinalized){ // so we can't update!
|
||||
std::cerr << "LLMD5::update: Can't update a finalized digest!" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// Compute number of bytes mod 64
|
||||
buffer_index = (unsigned int)((count[0] >> 3) & 0x3F);
|
||||
buffer_index = (unsigned int)((mCount[0] >> 3) & 0x3F);
|
||||
|
||||
// Update number of bits
|
||||
if ( (count[0] += ((uint4) input_length << 3))<((uint4) input_length << 3) )
|
||||
count[1]++;
|
||||
if ( (mCount[0] += ((uint4) input_length << 3))<((uint4) input_length << 3) )
|
||||
mCount[1]++;
|
||||
|
||||
count[1] += ((uint4)input_length >> 29);
|
||||
mCount[1] += ((uint4)input_length >> 29);
|
||||
|
||||
|
||||
buffer_space = 64 - buffer_index; // how much space is left in buffer
|
||||
@@ -129,10 +129,10 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) {
|
||||
if (input_length >= buffer_space) { // ie. we have enough to fill the buffer
|
||||
// fill the rest of the buffer and transform
|
||||
memcpy( /* Flawfinder: ignore */
|
||||
buffer + buffer_index,
|
||||
mBuffer + buffer_index,
|
||||
input,
|
||||
buffer_space);
|
||||
transform (buffer);
|
||||
transform (mBuffer);
|
||||
|
||||
for (input_index = buffer_space; input_index + 63 < input_length;
|
||||
input_index += 64)
|
||||
@@ -145,7 +145,7 @@ void LLMD5::update (const uint1 *input, const uint4 input_length) {
|
||||
|
||||
|
||||
// and here we do the buffering:
|
||||
memcpy(buffer+buffer_index, input+input_index, input_length-input_index); /* Flawfinder: ignore */
|
||||
memcpy(mBuffer+buffer_index, input+input_index, input_length-input_index); /* Flawfinder: ignore */
|
||||
}
|
||||
|
||||
|
||||
@@ -200,16 +200,16 @@ void LLMD5::finalize (){
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
if (finalized){
|
||||
if (mFinalized){
|
||||
std::cerr << "LLMD5::finalize: Already finalized this digest!" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// Save number of bits
|
||||
encode (bits, count, 8);
|
||||
encode (bits, mCount, 8);
|
||||
|
||||
// Pad out to 56 mod 64.
|
||||
index = (uint4) ((count[0] >> 3) & 0x3f);
|
||||
index = (uint4) ((mCount[0] >> 3) & 0x3f);
|
||||
padLen = (index < 56) ? (56 - index) : (120 - index);
|
||||
update (PADDING, padLen);
|
||||
|
||||
@@ -217,12 +217,12 @@ void LLMD5::finalize (){
|
||||
update (bits, 8);
|
||||
|
||||
// Store state in digest
|
||||
encode (digest, state, 16);
|
||||
encode (mDigest, mState, 16);
|
||||
|
||||
// Zeroize sensitive information
|
||||
memset (buffer, 0, sizeof(*buffer));
|
||||
memset (mBuffer, 0, sizeof(mBuffer));
|
||||
|
||||
finalized=1;
|
||||
mFinalized=true;
|
||||
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ LLMD5::LLMD5(const unsigned char *s)
|
||||
|
||||
void LLMD5::raw_digest(unsigned char *s) const
|
||||
{
|
||||
if (!finalized)
|
||||
if (!mFinalized)
|
||||
{
|
||||
std::cerr << "LLMD5::raw_digest: Can't get digest if you haven't "<<
|
||||
"finalized the digest!" << std::endl;
|
||||
@@ -277,22 +277,22 @@ void LLMD5::raw_digest(unsigned char *s) const
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(s, digest, 16); /* Flawfinder: ignore */
|
||||
memcpy(s, mDigest, 16); /* Flawfinder: ignore */
|
||||
return;
|
||||
}
|
||||
|
||||
//Singu extension: the inverse of LLMD5::raw_digest.
|
||||
void LLMD5::clone(unsigned char const* s)
|
||||
{
|
||||
memcpy(digest, s, 16);
|
||||
finalized = 1;
|
||||
memcpy(mDigest, s, 16);
|
||||
mFinalized = true;
|
||||
}
|
||||
|
||||
void LLMD5::hex_digest(char *s) const
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!finalized)
|
||||
if (!mFinalized)
|
||||
{
|
||||
std::cerr << "LLMD5::hex_digest: Can't get digest if you haven't "<<
|
||||
"finalized the digest!" <<std::endl;
|
||||
@@ -302,7 +302,7 @@ void LLMD5::hex_digest(char *s) const
|
||||
|
||||
for (i=0; i<16; i++)
|
||||
{
|
||||
sprintf(s+i*2, "%02x", digest[i]); /* Flawfinder: ignore */
|
||||
sprintf(s+i*2, "%02x", mDigest[i]); /* Flawfinder: ignore */
|
||||
}
|
||||
|
||||
s[32]='\0';
|
||||
@@ -322,9 +322,9 @@ void LLMD5::clone(std::string const& hash_str)
|
||||
unsigned char nibble = (c >= '0' && c <= '9') ? c - '0' : c - 'a' + 10;
|
||||
byte += nibble << ((1 - j) << 2);
|
||||
}
|
||||
digest[i] = byte;
|
||||
mDigest[i] = byte;
|
||||
}
|
||||
finalized = 1;
|
||||
mFinalized = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -340,17 +340,17 @@ std::ostream& operator<<(std::ostream &stream, LLMD5 const& context)
|
||||
// PRIVATE METHODS:
|
||||
|
||||
void LLMD5::init(){
|
||||
finalized=0; // we just started!
|
||||
mFinalized=false; // we just started!
|
||||
|
||||
// Nothing counted, so count=0
|
||||
count[0] = 0;
|
||||
count[1] = 0;
|
||||
mCount[0] = 0;
|
||||
mCount[1] = 0;
|
||||
|
||||
// Load magic initialization constants.
|
||||
state[0] = 0x67452301;
|
||||
state[1] = 0xefcdab89;
|
||||
state[2] = 0x98badcfe;
|
||||
state[3] = 0x10325476;
|
||||
mState[0] = 0x67452301;
|
||||
mState[1] = 0xefcdab89;
|
||||
mState[2] = 0x98badcfe;
|
||||
mState[3] = 0x10325476;
|
||||
}
|
||||
|
||||
|
||||
@@ -419,11 +419,11 @@ Rotation is separate from addition to prevent recomputation.
|
||||
// LLMD5 basic transformation. Transforms state based on block.
|
||||
void LLMD5::transform (const U8 block[64]){
|
||||
|
||||
uint4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
|
||||
uint4 a = mState[0], b = mState[1], c = mState[2], d = mState[3], x[16];
|
||||
|
||||
decode (x, block, 64);
|
||||
|
||||
assert(!finalized); // not just a user error, since the method is private
|
||||
assert(!mFinalized); // not just a user error, since the method is private
|
||||
|
||||
/* Round 1 */
|
||||
FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
|
||||
@@ -497,10 +497,10 @@ void LLMD5::transform (const U8 block[64]){
|
||||
II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
|
||||
II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
|
||||
|
||||
state[0] += a;
|
||||
state[1] += b;
|
||||
state[2] += c;
|
||||
state[3] += d;
|
||||
mState[0] += a;
|
||||
mState[1] += b;
|
||||
mState[2] += c;
|
||||
mState[3] += d;
|
||||
|
||||
// Zeroize sensitive information.
|
||||
memset ( (uint1 *) x, 0, sizeof(x));
|
||||
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
void update (const std::string& str);
|
||||
void finalize ();
|
||||
|
||||
bool isFinalized() const { return finalized; }
|
||||
bool isFinalized() const { return mFinalized; }
|
||||
|
||||
// constructors for special circumstances. All these constructors finalize
|
||||
// the MD5 context.
|
||||
@@ -120,19 +120,19 @@ public:
|
||||
void hex_digest(char *string) const; // provide 33-byte array for ascii-hex string
|
||||
|
||||
friend LL_COMMON_API std::ostream& operator<< (std::ostream&, LLMD5 const& context);
|
||||
friend LL_COMMON_API bool operator==(const LLMD5& a, const LLMD5& b) { return std::memcmp(a.digest ,b.digest, 16) == 0; }
|
||||
friend LL_COMMON_API bool operator!=(const LLMD5& a, const LLMD5& b) { return std::memcmp(a.digest ,b.digest, 16) != 0; }
|
||||
friend LL_COMMON_API bool operator<(const LLMD5& a, const LLMD5& b) { return std::memcmp(a.digest ,b.digest, 16) < 0; }
|
||||
friend LL_COMMON_API bool operator==(const LLMD5& a, const LLMD5& b) { return std::memcmp(a.mDigest ,b.mDigest, 16) == 0; }
|
||||
friend LL_COMMON_API bool operator!=(const LLMD5& a, const LLMD5& b) { return std::memcmp(a.mDigest,b.mDigest, 16) != 0; }
|
||||
friend LL_COMMON_API bool operator<(const LLMD5& a, const LLMD5& b) { return std::memcmp(a.mDigest,b.mDigest, 16) < 0; }
|
||||
|
||||
private:
|
||||
|
||||
|
||||
// next, the private data:
|
||||
uint4 state[4];
|
||||
uint4 count[2]; // number of *bits*, mod 2^64
|
||||
uint1 buffer[64]; // input buffer
|
||||
uint1 digest[16];
|
||||
uint1 finalized;
|
||||
uint4 mState[4];
|
||||
uint4 mCount[2]; // number of *bits*, mod 2^64
|
||||
uint1 mBuffer[64]; // input buffer
|
||||
uint1 mDigest[16];
|
||||
bool mFinalized;
|
||||
|
||||
// last, the private methods, mostly static:
|
||||
void init (); // called by all constructors
|
||||
|
||||
@@ -489,8 +489,7 @@ private:
|
||||
unsigned int ids = (unsigned int)cpu_info[0];
|
||||
setConfig(eMaxID, (S32)ids);
|
||||
|
||||
char cpu_vendor[0x20];
|
||||
memset(cpu_vendor, 0, sizeof(cpu_vendor));
|
||||
char cpu_vendor[0x20] = {0};
|
||||
*((int*)cpu_vendor) = cpu_info[1];
|
||||
*((int*)(cpu_vendor+4)) = cpu_info[3];
|
||||
*((int*)(cpu_vendor+8)) = cpu_info[2];
|
||||
@@ -556,8 +555,7 @@ private:
|
||||
unsigned int ext_ids = cpu_info[0];
|
||||
setConfig(eMaxExtID, 0);
|
||||
|
||||
char cpu_brand_string[0x40];
|
||||
memset(cpu_brand_string, 0, sizeof(cpu_brand_string));
|
||||
char cpu_brand_string[0x40] = {0};
|
||||
|
||||
// Get the information associated with each extended ID.
|
||||
for(unsigned int i=0x80000000; i<=ext_ids; ++i)
|
||||
@@ -638,16 +636,14 @@ private:
|
||||
{
|
||||
size_t len = 0;
|
||||
|
||||
char cpu_brand_string[0x40];
|
||||
char cpu_brand_string[0x40] = {0};
|
||||
len = sizeof(cpu_brand_string);
|
||||
memset(cpu_brand_string, 0, len);
|
||||
sysctlbyname("machdep.cpu.brand_string", (void*)cpu_brand_string, &len, NULL, 0);
|
||||
cpu_brand_string[0x3f] = 0;
|
||||
setInfo(eBrandName, cpu_brand_string);
|
||||
|
||||
char cpu_vendor[0x20];
|
||||
char cpu_vendor[0x20] = {0};
|
||||
len = sizeof(cpu_vendor);
|
||||
memset(cpu_vendor, 0, len);
|
||||
sysctlbyname("machdep.cpu.vendor", (void*)cpu_vendor, &len, NULL, 0);
|
||||
cpu_vendor[0x1f] = 0;
|
||||
setInfo(eVendor, cpu_vendor);
|
||||
@@ -735,8 +731,7 @@ private:
|
||||
LLFILE* cpuinfo_fp = LLFile::fopen(CPUINFO_FILE, "rb");
|
||||
if(cpuinfo_fp)
|
||||
{
|
||||
char line[MAX_STRING];
|
||||
memset(line, 0, MAX_STRING);
|
||||
char line[MAX_STRING] = {0};
|
||||
while(fgets(line, MAX_STRING, cpuinfo_fp))
|
||||
{
|
||||
// /proc/cpuinfo on Linux looks like:
|
||||
@@ -834,8 +829,7 @@ private:
|
||||
LLFILE* cpuinfo = LLFile::fopen(CPUINFO_FILE, "rb");
|
||||
if(cpuinfo)
|
||||
{
|
||||
char line[MAX_STRING];
|
||||
memset(line, 0, MAX_STRING);
|
||||
char line[MAX_STRING] = {0};
|
||||
while(fgets(line, MAX_STRING, cpuinfo))
|
||||
{
|
||||
line[strlen(line)-1] = ' ';
|
||||
|
||||
@@ -31,12 +31,10 @@
|
||||
#if ! defined(LL_LLPTRTO_H)
|
||||
#define LL_LLPTRTO_H
|
||||
|
||||
#include <type_traits>
|
||||
#include "llpointer.h"
|
||||
#include "llrefcount.h" // LLRefCount
|
||||
#include "llthread.h" // LLThreadSafeRefCount
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
#include <boost/type_traits/remove_pointer.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
/**
|
||||
* LLPtrTo<TARGET>::type is either of two things:
|
||||
@@ -56,14 +54,14 @@ struct LLPtrTo
|
||||
|
||||
/// specialize for subclasses of LLRefCount
|
||||
template <class T>
|
||||
struct LLPtrTo<T, typename boost::enable_if< boost::is_base_of<LLRefCount, T> >::type>
|
||||
struct LLPtrTo<T, typename std::enable_if< std::is_base_of<LLRefCount, T>::value>::type>
|
||||
{
|
||||
typedef LLPointer<T> type;
|
||||
};
|
||||
|
||||
/// specialize for subclasses of LLThreadSafeRefCount
|
||||
template <class T>
|
||||
struct LLPtrTo<T, typename boost::enable_if< boost::is_base_of<LLThreadSafeRefCount, T> >::type>
|
||||
struct LLPtrTo<T, typename std::enable_if< std::is_base_of<LLThreadSafeRefCount, T>::value>::type>
|
||||
{
|
||||
typedef LLPointer<T> type;
|
||||
};
|
||||
@@ -74,7 +72,7 @@ struct LLPtrTo<T, typename boost::enable_if< boost::is_base_of<LLThreadSafeRefCo
|
||||
template <typename PTRTYPE>
|
||||
struct LLRemovePointer
|
||||
{
|
||||
typedef typename boost::remove_pointer<PTRTYPE>::type type;
|
||||
typedef typename std::remove_pointer<PTRTYPE>::type type;
|
||||
};
|
||||
|
||||
/// specialize for LLPointer<SOMECLASS>
|
||||
|
||||
@@ -53,7 +53,7 @@ LLRunner::~LLRunner()
|
||||
mRunEvery.clear();
|
||||
}
|
||||
|
||||
S32 LLRunner::run()
|
||||
size_t LLRunner::run()
|
||||
{
|
||||
// We collect all of the runnables which should be run. Since the
|
||||
// runnables are allowed to adjust the run list, we need to copy
|
||||
|
||||
@@ -56,7 +56,7 @@ public:
|
||||
/**
|
||||
* @brief The pointer to a runnable.
|
||||
*/
|
||||
typedef boost::shared_ptr<LLRunnable> run_ptr_t;
|
||||
typedef std::shared_ptr<LLRunnable> run_ptr_t;
|
||||
|
||||
/**
|
||||
* @brief The handle for use in the API.
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
*
|
||||
* @return Returns the number of runnables run.
|
||||
*/
|
||||
S32 run();
|
||||
size_t run();
|
||||
|
||||
/**
|
||||
* @brief Add a runnable to the run list.
|
||||
|
||||
@@ -740,11 +740,9 @@ const LLSD& LLSD::Impl::undef()
|
||||
|
||||
void LLSD::Impl::dumpStats() const
|
||||
{
|
||||
S32 type_counts[LLSD::TypeLLSDNumTypes + 1];
|
||||
memset(&type_counts, 0, sizeof(type_counts));
|
||||
S32 type_counts[LLSD::TypeLLSDNumTypes + 1] = {0};
|
||||
|
||||
S32 share_counts[LLSD::TypeLLSDNumTypes + 1];
|
||||
memset(&share_counts, 0, sizeof(share_counts));
|
||||
S32 share_counts[LLSD::TypeLLSDNumTypes + 1] = {0};
|
||||
|
||||
// Add info from all the values this object has
|
||||
calcStats(type_counts, share_counts);
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
// Project includes
|
||||
#include "llsdparam.h"
|
||||
#include "llsdutil.h"
|
||||
#include "boost/bind.hpp"
|
||||
|
||||
static LLInitParam::Parser::parser_read_func_map_t sReadFuncs;
|
||||
static LLInitParam::Parser::parser_write_func_map_t sWriteFuncs;
|
||||
@@ -44,10 +43,8 @@ LLTrace::BlockTimerStatHandle FTM_SD_PARAM_ADAPTOR("LLSD to LLInitParam conversi
|
||||
//
|
||||
LLParamSDParser::LLParamSDParser()
|
||||
: Parser(sReadFuncs, sWriteFuncs, sInspectFuncs),
|
||||
mCurReadSD(NULL), mCurWriteSD(NULL), mWriteRootSD(NULL)
|
||||
mCurReadSD(NULL), mWriteRootSD(NULL)
|
||||
{
|
||||
using boost::bind;
|
||||
|
||||
if (sReadFuncs.empty())
|
||||
{
|
||||
registerParserFuncs<LLInitParam::Flag>(readFlag, &LLParamSDParser::writeFlag);
|
||||
@@ -100,7 +97,7 @@ void LLParamSDParser::readSD(const LLSD& sd, LLInitParam::BaseBlock& block, bool
|
||||
mNameStack.clear();
|
||||
setParseSilently(silent);
|
||||
|
||||
LLParamSDParserUtilities::readSDValues(boost::bind(&LLParamSDParser::submit, this, boost::ref(block), _1, _2), sd, mNameStack);
|
||||
LLParamSDParserUtilities::readSDValues(std::bind(&LLParamSDParser::submit, this, std::ref(block), std::placeholders::_1, std::placeholders::_2), sd, mNameStack);
|
||||
//readSDValues(sd, block);
|
||||
}
|
||||
|
||||
@@ -281,14 +278,14 @@ void LLParamSDParserUtilities::readSDValues(read_sd_cb_t cb, const LLSD& sd, LLI
|
||||
}
|
||||
else if (sd.isUndefined())
|
||||
{
|
||||
if (!cb.empty())
|
||||
if (cb)
|
||||
{
|
||||
cb(NO_VALUE_MARKER, stack);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!cb.empty())
|
||||
if (cb)
|
||||
{
|
||||
cb(sd, stack);
|
||||
}
|
||||
@@ -337,7 +334,7 @@ namespace LLInitParam
|
||||
if (!p.writeValue<LLSD>(mValue, name_stack_range))
|
||||
{
|
||||
// otherwise read from LLSD value and serialize out to parser (which could be LLSD, XUI, etc)
|
||||
LLParamSDParserUtilities::readSDValues(boost::bind(&serializeElement, boost::ref(p), _1, _2), mValue, name_stack_range);
|
||||
LLParamSDParserUtilities::readSDValues(std::bind(&serializeElement, std::ref(p), std::placeholders::_1, std::placeholders::_2), mValue, name_stack_range);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -29,14 +29,13 @@
|
||||
#define LL_LLSDPARAM_H
|
||||
|
||||
#include "llinitparam.h"
|
||||
#include "boost/function.hpp"
|
||||
#include "llfasttimer.h"
|
||||
|
||||
struct LL_COMMON_API LLParamSDParserUtilities
|
||||
{
|
||||
static LLSD& getSDWriteNode(LLSD& input, LLInitParam::Parser::name_stack_range_t& name_stack_range);
|
||||
|
||||
typedef boost::function<void (const LLSD&, LLInitParam::Parser::name_stack_t&)> read_sd_cb_t;
|
||||
typedef std::function<void (const LLSD&, LLInitParam::Parser::name_stack_t&)> read_sd_cb_t;
|
||||
static void readSDValues(read_sd_cb_t cb, const LLSD& sd, LLInitParam::Parser::name_stack_t& stack);
|
||||
static void readSDValues(read_sd_cb_t cb, const LLSD& sd);
|
||||
};
|
||||
@@ -66,6 +65,7 @@ public:
|
||||
}
|
||||
|
||||
/*virtual*/ std::string getCurrentElementName();
|
||||
/*virtual*/ std::string getCurrentFileName(){ return LLStringUtil::null; }
|
||||
|
||||
private:
|
||||
void writeSDImpl(LLSD& sd,
|
||||
@@ -106,7 +106,6 @@ private:
|
||||
Parser::name_stack_t mNameStack;
|
||||
const LLSD* mCurReadSD;
|
||||
LLSD* mWriteRootSD;
|
||||
LLSD* mCurWriteSD;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <boost/range.hpp>
|
||||
|
||||
// U32
|
||||
LLSD ll_sd_from_U32(const U32 val)
|
||||
@@ -347,7 +346,7 @@ class TypeLookup
|
||||
public:
|
||||
TypeLookup()
|
||||
{
|
||||
for (const Data *di(boost::begin(typedata)), *dend(boost::end(typedata)); di != dend; ++di)
|
||||
for (const Data *di(std::begin(typedata)), *dend(std::end(typedata)); di != dend; ++di)
|
||||
{
|
||||
mMap[di->type] = di->name;
|
||||
}
|
||||
@@ -527,7 +526,7 @@ std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::str
|
||||
LLSD::TypeURI
|
||||
};
|
||||
return match_types(prototype.type(),
|
||||
TypeVector(boost::begin(accept), boost::end(accept)),
|
||||
TypeVector(std::begin(accept), std::end(accept)),
|
||||
data.type(),
|
||||
pfx);
|
||||
}
|
||||
@@ -544,7 +543,7 @@ std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::str
|
||||
};
|
||||
// Funny business: shuffle the set of acceptable types to include all
|
||||
// but the prototype's type. Get the acceptable types in a set.
|
||||
std::set<LLSD::Type> rest(boost::begin(all), boost::end(all));
|
||||
std::set<LLSD::Type> rest(std::begin(all), std::end(all));
|
||||
// Remove the prototype's type because we pass that separately.
|
||||
rest.erase(prototype.type());
|
||||
return match_types(prototype.type(),
|
||||
@@ -560,7 +559,7 @@ std::string llsd_matches(const LLSD& prototype, const LLSD& data, const std::str
|
||||
LLSD::TypeString
|
||||
};
|
||||
return match_types(prototype.type(),
|
||||
TypeVector(boost::begin(accept), boost::end(accept)),
|
||||
TypeVector(std::begin(accept), std::end(accept)),
|
||||
data.type(),
|
||||
pfx);
|
||||
}
|
||||
|
||||
@@ -73,8 +73,7 @@ bool ll_get_stack_trace(std::vector<std::string>& lines)
|
||||
if(symbolsLoaded)
|
||||
{
|
||||
// create the frames to hold the addresses
|
||||
void* frames[MAX_STACK_DEPTH];
|
||||
memset(frames, 0, sizeof(void*)*MAX_STACK_DEPTH);
|
||||
void* frames[MAX_STACK_DEPTH] = {0};
|
||||
S32 depth = 0;
|
||||
|
||||
// get the addresses
|
||||
@@ -110,7 +109,7 @@ bool ll_get_stack_trace(std::vector<std::string>& lines)
|
||||
if(ret)
|
||||
{
|
||||
std::string file_name = line.FileName;
|
||||
std::string::size_type index = file_name.rfind("\\");
|
||||
std::string::size_type index = file_name.rfind('\\');
|
||||
stack_line << file_name.substr(index + 1, file_name.size()) << ":" << line.LineNumber;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
const std::string& String() const { return string; }
|
||||
size_t Hash() const { return string_hash; }
|
||||
|
||||
bool operator==(const LLStaticHashedString& b) const { return String() == b.String(); }
|
||||
bool operator==(const LLStaticHashedString& b) const { return Hash() == b.Hash(); }
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
@@ -318,9 +318,9 @@ inline bool vector_replace_with_last(T& invec, typename T::value_type const& val
|
||||
|
||||
// Append N elements to the vector and return a pointer to the first new element.
|
||||
template <typename T>
|
||||
inline T* vector_append(std::vector<T>& invec, S32 N)
|
||||
inline T* vector_append(std::vector<T>& invec, size_t N)
|
||||
{
|
||||
U32 sz = invec.size();
|
||||
size_t sz = invec.size();
|
||||
invec.resize(sz+N);
|
||||
return &(invec[sz]);
|
||||
}
|
||||
@@ -512,6 +512,17 @@ llbind2nd(const _Operation& __oper, const _Tp& __x)
|
||||
return llbinder2nd<_Operation>(__oper, _Arg2_type(__x));
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare std::type_info* pointers a la std::less. We break this out as a
|
||||
* separate function for use in two different std::less specializations.
|
||||
*/
|
||||
inline
|
||||
bool before(const std::type_info* lhs, const std::type_info* rhs)
|
||||
{
|
||||
// Just use before(), as we normally would
|
||||
return lhs->before(*rhs) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialize std::less<std::type_info*> to use std::type_info::before().
|
||||
* See MAINT-1175. It is NEVER a good idea to directly compare std::type_info*
|
||||
@@ -526,7 +537,7 @@ namespace std
|
||||
{
|
||||
bool operator()(const std::type_info* lhs, const std::type_info* rhs) const
|
||||
{
|
||||
return lhs->before(*rhs);
|
||||
return before(lhs, rhs);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -536,7 +547,7 @@ namespace std
|
||||
{
|
||||
bool operator()(std::type_info* lhs, std::type_info* rhs) const
|
||||
{
|
||||
return lhs->before(*rhs);
|
||||
return before(lhs, rhs);
|
||||
}
|
||||
};
|
||||
} // std
|
||||
|
||||
@@ -124,7 +124,7 @@ bool skip_to_next_word(std::istream& input_stream)
|
||||
|
||||
bool skip_to_end_of_next_keyword(const char* keyword, std::istream& input_stream)
|
||||
{
|
||||
int key_length = strlen(keyword); /*Flawfinder: ignore*/
|
||||
size_t key_length = strlen(keyword); /*Flawfinder: ignore*/
|
||||
if (0 == key_length)
|
||||
{
|
||||
return false;
|
||||
@@ -321,7 +321,7 @@ bool unget_line(const std::string& line, std::istream& input_stream)
|
||||
// returns true if removed last char
|
||||
bool remove_last_char(char c, std::string& line)
|
||||
{
|
||||
int line_size = line.size();
|
||||
size_t line_size = line.size();
|
||||
if (line_size > 1
|
||||
&& c == line[line_size - 1])
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
Object* operator ++(int) { Object* old = mObjectp; mBytep += mSkip; return old; }
|
||||
Object* operator +=(int i) { mBytep += mSkip*i; return mObjectp; }
|
||||
|
||||
Object& operator[](U32 index) { return *(Object*)(mBytep + (mSkip * index)); }
|
||||
Object& operator[](size_t index) { return *(Object*)(mBytep + (mSkip * index)); }
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -372,12 +372,12 @@ S32 wstring_utf8_length(const LLWString& wstr)
|
||||
|
||||
LLWString utf8str_to_wstring(const std::string& utf8str, S32 len)
|
||||
{
|
||||
llwchar unichar;
|
||||
LLWString wout;
|
||||
wout.reserve(len);
|
||||
|
||||
S32 i = 0;
|
||||
while (i < len)
|
||||
for (S32 i = 0; i < len; i++)
|
||||
{
|
||||
llwchar unichar;
|
||||
U8 cur_char = utf8str[i];
|
||||
|
||||
if (cur_char < 0x80)
|
||||
@@ -453,7 +453,6 @@ LLWString utf8str_to_wstring(const std::string& utf8str, S32 len)
|
||||
}
|
||||
|
||||
wout += unichar;
|
||||
++i;
|
||||
}
|
||||
return wout;
|
||||
}
|
||||
@@ -466,16 +465,15 @@ LLWString utf8str_to_wstring(const std::string& utf8str)
|
||||
|
||||
std::string wstring_to_utf8str(const LLWString& utf32str, S32 len)
|
||||
{
|
||||
char tchars[8]; /* Flawfinder: ignore */
|
||||
std::string out;
|
||||
out.reserve(len);
|
||||
|
||||
S32 i = 0;
|
||||
while (i < len)
|
||||
for (S32 i = 0; i < len; i++)
|
||||
{
|
||||
char tchars[8]; /* Flawfinder: ignore */
|
||||
S32 n = wchar_to_utf8chars(utf32str[i], tchars);
|
||||
tchars[n] = 0;
|
||||
out += tchars;
|
||||
i++;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@@ -812,7 +810,7 @@ std::string LLStringOps::getDatetimeCode (std::string key)
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::string("");
|
||||
return std::string();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1083,7 +1081,7 @@ bool LLStringUtil::formatDatetime(std::string& replacement, std::string token,
|
||||
}
|
||||
else if (param == "local")
|
||||
{
|
||||
replacement = ""; // user knows their own timezone
|
||||
replacement.clear(); // user knows their own timezone
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1384,8 +1384,12 @@ void LLStringUtilBase<T>::stripNonprintable(string_type& string)
|
||||
return;
|
||||
}
|
||||
size_t src_size = string.size();
|
||||
char* c_string = new char[src_size + 1];
|
||||
if(c_string == NULL)
|
||||
char* c_string = nullptr;
|
||||
try
|
||||
{
|
||||
c_string = new char[src_size + 1];
|
||||
}
|
||||
catch (const std::bad_alloc&)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ LLStringTableEntry* LLStringTable::addStringEntry(const char *str)
|
||||
if (strlist)
|
||||
{
|
||||
string_list_t::iterator iter;
|
||||
for (iter = strlist->begin(); iter != strlist->end(); iter++)
|
||||
for (iter = strlist->begin(); iter != strlist->end(); ++iter)
|
||||
{
|
||||
entry = *iter;
|
||||
ret_val = entry->mString;
|
||||
@@ -338,7 +338,7 @@ void LLStringTable::removeString(const char *str)
|
||||
if (strlist)
|
||||
{
|
||||
string_list_t::iterator iter;
|
||||
for (iter = strlist->begin(); iter != strlist->end(); iter++)
|
||||
for (iter = strlist->begin(); iter != strlist->end(); ++iter)
|
||||
{
|
||||
entry = *iter;
|
||||
ret_val = entry->mString;
|
||||
|
||||
@@ -150,7 +150,7 @@ public:
|
||||
for (S32 i = 0; i<mTableSize; i++)
|
||||
{
|
||||
string_set_t& stringset = mStringList[i];
|
||||
for (string_set_t::iterator iter = stringset.begin(); iter != stringset.end(); iter++)
|
||||
for (string_set_t::iterator iter = stringset.begin(); iter != stringset.end(); ++iter)
|
||||
{
|
||||
delete *iter;
|
||||
}
|
||||
|
||||
@@ -1311,7 +1311,11 @@ BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile)
|
||||
LLFILE *dst = NULL;
|
||||
S32 bytes = 0;
|
||||
tmpfile = dstfile + ".t";
|
||||
#if LL_WINDOWS
|
||||
src = gzopen_w(utf8str_to_utf16str(srcfile).c_str(), "rb");
|
||||
#else
|
||||
src = gzopen(srcfile.c_str(), "rb");
|
||||
#endif
|
||||
if (! src) goto err;
|
||||
dst = LLFile::fopen(tmpfile, "wb"); /* Flawfinder: ignore */
|
||||
if (! dst) goto err;
|
||||
@@ -1345,7 +1349,11 @@ BOOL gzip_file(const std::string& srcfile, const std::string& dstfile)
|
||||
LLFILE *src = NULL;
|
||||
S32 bytes = 0;
|
||||
tmpfile = dstfile + ".t";
|
||||
#if LL_WINDOWS
|
||||
dst = gzopen_w(utf8str_to_utf16str(tmpfile).c_str(), "wb");
|
||||
#else
|
||||
dst = gzopen(tmpfile.c_str(), "wb"); /* Flawfinder: ignore */
|
||||
#endif
|
||||
if (! dst) goto err;
|
||||
src = LLFile::fopen(srcfile, "rb"); /* Flawfinder: ignore */
|
||||
if (! src) goto err;
|
||||
|
||||
@@ -63,10 +63,6 @@
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
#ifndef BOOST_FUNCTION_HPP_INCLUDED
|
||||
#include <boost/function.hpp>
|
||||
#define BOOST_FUNCTION_HPP_INCLUDED
|
||||
#endif
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace LLTreeIter
|
||||
@@ -96,7 +92,7 @@ protected:
|
||||
typedef typename LLPtrTo<NODE>::type ptr_type;
|
||||
/// function that advances from this node to next accepts a node pointer
|
||||
/// and returns another
|
||||
typedef boost::function<ptr_type(const ptr_type&)> func_type;
|
||||
typedef std::function<ptr_type(const ptr_type&)> func_type;
|
||||
typedef SELFTYPE self_type;
|
||||
};
|
||||
|
||||
@@ -333,7 +329,7 @@ protected:
|
||||
typedef typename super::ptr_type ptr_type;
|
||||
// The func_type is different for this: from a NODE pointer, we must
|
||||
// obtain a CHILDITER.
|
||||
typedef boost::function<CHILDITER(const ptr_type&)> func_type;
|
||||
typedef std::function<CHILDITER(const ptr_type&)> func_type;
|
||||
private:
|
||||
typedef std::vector<ptr_type> list_type;
|
||||
public:
|
||||
@@ -438,7 +434,7 @@ protected:
|
||||
typedef typename super::ptr_type ptr_type;
|
||||
// The func_type is different for this: from a NODE pointer, we must
|
||||
// obtain a CHILDITER.
|
||||
typedef boost::function<CHILDITER(const ptr_type&)> func_type;
|
||||
typedef std::function<CHILDITER(const ptr_type&)> func_type;
|
||||
private:
|
||||
// Upon reaching a given node in our pending list, we need to know whether
|
||||
// we've already pushed that node's children, so we must associate a bool
|
||||
@@ -503,14 +499,17 @@ private:
|
||||
// Once we've popped the last node, this becomes a no-op.
|
||||
if (mPending.empty())
|
||||
return;
|
||||
|
||||
auto& pending = mPending.back();
|
||||
|
||||
// Here mPending.back() holds the node pointer we're proposing to
|
||||
// dereference next. Have we pushed that node's children yet?
|
||||
if (mPending.back().second)
|
||||
if (pending.second)
|
||||
return; // if so, it's okay to visit this node now
|
||||
// We haven't yet pushed this node's children. Do so now. Remember
|
||||
// that we did -- while the node in question is still back().
|
||||
mPending.back().second = true;
|
||||
addChildren(mPending.back().first);
|
||||
pending.second = true;
|
||||
addChildren(pending.first);
|
||||
// Now, because we've just changed mPending.back(), make that new node
|
||||
// current.
|
||||
makeCurrent();
|
||||
@@ -577,7 +576,7 @@ protected:
|
||||
typedef typename super::ptr_type ptr_type;
|
||||
// The func_type is different for this: from a NODE pointer, we must
|
||||
// obtain a CHILDITER.
|
||||
typedef boost::function<CHILDITER(const ptr_type&)> func_type;
|
||||
typedef std::function<CHILDITER(const ptr_type&)> func_type;
|
||||
private:
|
||||
// We need a FIFO queue rather than a LIFO stack. Use a deque rather than
|
||||
// a vector, since vector can't implement pop_front() efficiently.
|
||||
|
||||
@@ -191,10 +191,9 @@ LLURI::LLURI(const std::string& escaped_str)
|
||||
{
|
||||
std::string::size_type delim_pos;
|
||||
delim_pos = escaped_str.find(':');
|
||||
std::string temp;
|
||||
if (delim_pos == std::string::npos)
|
||||
{
|
||||
mScheme = "";
|
||||
mScheme.clear();
|
||||
mEscapedOpaque = escaped_str;
|
||||
}
|
||||
else
|
||||
@@ -244,7 +243,7 @@ void LLURI::parseAuthorityAndPathUsingOpaque()
|
||||
delim_pos2 == std::string::npos)
|
||||
{
|
||||
mEscapedAuthority = mEscapedOpaque.substr(2);
|
||||
mEscapedPath = "";
|
||||
mEscapedPath.clear();
|
||||
}
|
||||
// path exist, no query
|
||||
else if (delim_pos2 == std::string::npos)
|
||||
@@ -456,7 +455,7 @@ namespace {
|
||||
std::string::size_type start_pos = authority.find('@');
|
||||
if (start_pos == std::string::npos)
|
||||
{
|
||||
user = "";
|
||||
user.clear();
|
||||
start_pos = 0;
|
||||
}
|
||||
else
|
||||
@@ -469,7 +468,7 @@ namespace {
|
||||
if (end_pos == std::string::npos)
|
||||
{
|
||||
host = authority.substr(start_pos);
|
||||
port = "";
|
||||
port.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -529,7 +528,7 @@ U16 LLURI::hostPort() const
|
||||
return 21;
|
||||
return 0;
|
||||
}
|
||||
return atoi(port.c_str());
|
||||
return static_cast<U16>(std::stoi(port));
|
||||
}
|
||||
|
||||
std::string LLURI::path() const
|
||||
@@ -582,7 +581,7 @@ LLSD LLURI::queryMap(std::string escaped_query_string)
|
||||
else
|
||||
{
|
||||
tuple = escaped_query_string;
|
||||
escaped_query_string = "";
|
||||
escaped_query_string .clear();
|
||||
}
|
||||
if (tuple.empty()) continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user