summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/uuid')
-rw-r--r--3rdParty/Boost/src/boost/uuid/name_generator.hpp8
-rw-r--r--3rdParty/Boost/src/boost/uuid/random_generator.hpp3
-rw-r--r--3rdParty/Boost/src/boost/uuid/seed_rng.hpp28
-rw-r--r--3rdParty/Boost/src/boost/uuid/sha1.hpp61
-rw-r--r--3rdParty/Boost/src/boost/uuid/string_generator.hpp5
5 files changed, 67 insertions, 38 deletions
diff --git a/3rdParty/Boost/src/boost/uuid/name_generator.hpp b/3rdParty/Boost/src/boost/uuid/name_generator.hpp
index 42473a6..fe582b4 100644
--- a/3rdParty/Boost/src/boost/uuid/name_generator.hpp
+++ b/3rdParty/Boost/src/boost/uuid/name_generator.hpp
@@ -71,10 +71,10 @@ private:
for (size_t i=0; i<count; i++) {
uint32_t c = characters[i];
- sha.process_byte( (c >> 0) && 0xFF );
- sha.process_byte( (c >> 8) && 0xFF );
- sha.process_byte( (c >> 16) && 0xFF );
- sha.process_byte( (c >> 24) && 0xFF );
+ sha.process_byte( (c >> 0) & 0xFF );
+ sha.process_byte( (c >> 8) & 0xFF );
+ sha.process_byte( (c >> 16) & 0xFF );
+ sha.process_byte( (c >> 24) & 0xFF );
}
}
diff --git a/3rdParty/Boost/src/boost/uuid/random_generator.hpp b/3rdParty/Boost/src/boost/uuid/random_generator.hpp
index 4d11f6b..0f4a0ab 100644
--- a/3rdParty/Boost/src/boost/uuid/random_generator.hpp
+++ b/3rdParty/Boost/src/boost/uuid/random_generator.hpp
@@ -90,7 +90,8 @@ public:
i = 0;
}
- *it = ((random_value >> (i*8)) & 0xFF);
+ // static_cast gets rid of warnings of converting unsigned long to boost::uint8_t
+ *it = static_cast<uuid::value_type>((random_value >> (i*8)) & 0xFF);
}
// set variant
diff --git a/3rdParty/Boost/src/boost/uuid/seed_rng.hpp b/3rdParty/Boost/src/boost/uuid/seed_rng.hpp
index 3090197..97b505f 100644
--- a/3rdParty/Boost/src/boost/uuid/seed_rng.hpp
+++ b/3rdParty/Boost/src/boost/uuid/seed_rng.hpp
@@ -24,12 +24,11 @@
#include <boost/config.hpp>
#include <cstring> // for memcpy
#include <limits>
-#include <memory.h>
#include <ctime> // for time_t, time, clock_t, clock
#include <cstdlib> // for rand
#include <cstdio> // for FILE, fopen, fread, fclose
#include <boost/uuid/sha1.hpp>
-//#include <boost/nondet_random.hpp> //forward declare boost::random_device
+//#include <boost/nondet_random.hpp> //forward declare boost::random::random_device
// can't use boost::generator_iterator since boost::random number seed(Iter&, Iter)
// functions need a last iterator
@@ -57,9 +56,9 @@ namespace std {
#endif
// forward declare random number generators
-namespace boost {
+namespace boost { namespace random {
class random_device;
-} //namespace boost
+}} //namespace boost::random
namespace boost {
namespace uuids {
@@ -80,7 +79,7 @@ public:
: rd_index_(5)
, random_(std::fopen( "/dev/urandom", "rb" ))
{}
-
+
~seed_rng()
{
if (random_) {
@@ -110,9 +109,10 @@ public:
}
private:
+ inline void ignore_size(size_t) {}
+
static unsigned int * sha1_random_digest_state_()
{
- // intentionally left uninitialized
static unsigned int state[ 5 ];
return state;
}
@@ -140,7 +140,11 @@ private:
}
{
- unsigned int rn[] = { std::rand(), std::rand(), std::rand() };
+ unsigned int rn[] =
+ { static_cast<unsigned int>(std::rand())
+ , static_cast<unsigned int>(std::rand())
+ , static_cast<unsigned int>(std::rand())
+ };
sha.process_bytes( (unsigned char const*)rn, sizeof( rn ) );
}
@@ -150,7 +154,7 @@ private:
if(random_)
{
- std::fread( buffer, 1, 20, random_ );
+ ignore_size(std::fread( buffer, 1, 20, random_ ));
}
// using an uninitialized buffer[] if fopen fails
@@ -185,7 +189,7 @@ private:
unsigned int rd_[5];
int rd_index_;
std::FILE * random_;
-
+
private: // make seed_rng noncopyable
seed_rng(seed_rng const&);
seed_rng& operator=(seed_rng const&);
@@ -208,9 +212,9 @@ class generator_iterator
, single_pass_traversal_tag
, typename Generator::result_type const&
> super_t;
-
+
public:
- generator_iterator() : m_g(NULL) {}
+ generator_iterator() : m_g(NULL), m_value(0) {}
generator_iterator(Generator* g) : m_g(g), m_value((*m_g)()) {}
void increment()
@@ -247,7 +251,7 @@ inline void seed(UniformRandomNumberGenerator& rng)
// random_device does not / can not be seeded
template <>
-inline void seed<boost::random_device>(boost::random_device&) {}
+inline void seed<boost::random::random_device>(boost::random::random_device&) {}
// random_device does not / can not be seeded
template <>
diff --git a/3rdParty/Boost/src/boost/uuid/sha1.hpp b/3rdParty/Boost/src/boost/uuid/sha1.hpp
index b4a1344..e695e13 100644
--- a/3rdParty/Boost/src/boost/uuid/sha1.hpp
+++ b/3rdParty/Boost/src/boost/uuid/sha1.hpp
@@ -8,16 +8,18 @@
// Revision History
// 29 May 2007 - Initial Revision
// 25 Feb 2008 - moved to namespace boost::uuids::detail
+// 10 Jan 2012 - can now handle the full size of messages (2^64 - 1 bits)
// This is a byte oriented implementation
-// Note: this implementation does not handle message longer than
-// 2^32 bytes.
#ifndef BOOST_UUID_SHA1_H
#define BOOST_UUID_SHA1_H
#include <boost/static_assert.hpp>
+#include <stdexcept>
+#include <boost/throw_exception.hpp>
#include <cstddef>
+#include <string>
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std {
@@ -54,6 +56,7 @@ public:
private:
void process_block();
+ void process_byte_impl(unsigned char byte);
private:
unsigned int h_[5];
@@ -61,7 +64,8 @@ private:
unsigned char block_[64];
std::size_t block_byte_index_;
- std::size_t byte_count_;
+ std::size_t bit_count_low;
+ std::size_t bit_count_high;
};
inline sha1::sha1()
@@ -78,13 +82,34 @@ inline void sha1::reset()
h_[4] = 0xC3D2E1F0;
block_byte_index_ = 0;
- byte_count_ = 0;
+ bit_count_low = 0;
+ bit_count_high = 0;
}
inline void sha1::process_byte(unsigned char byte)
{
+ process_byte_impl(byte);
+
+ // size_t max value = 0xFFFFFFFF
+ //if (bit_count_low + 8 >= 0x100000000) { // would overflow
+ //if (bit_count_low >= 0x100000000-8) {
+ if (bit_count_low < 0xFFFFFFF8) {
+ bit_count_low += 8;
+ } else {
+ bit_count_low = 0;
+
+ if (bit_count_high <= 0xFFFFFFFE) {
+ ++bit_count_high;
+ } else {
+ BOOST_THROW_EXCEPTION(std::runtime_error("sha1 too many bytes"));
+ }
+ }
+}
+
+inline void sha1::process_byte_impl(unsigned char byte)
+{
block_[block_byte_index_++] = byte;
- ++byte_count_;
+
if (block_byte_index_ == 64) {
block_byte_index_ = 0;
process_block();
@@ -160,10 +185,8 @@ inline void sha1::process_block()
inline void sha1::get_digest(digest_type digest)
{
- std::size_t bit_count = byte_count_*8;
-
// append the bit '1' to the message
- process_byte(0x80);
+ process_byte_impl(0x80);
// append k bits '0', where k is the minimum number >= 0
// such that the resulting message length is congruent to 56 (mod 64)
@@ -171,29 +194,29 @@ inline void sha1::get_digest(digest_type digest)
if (block_byte_index_ > 56) {
// finish this block
while (block_byte_index_ != 0) {
- process_byte(0);
+ process_byte_impl(0);
}
// one more block
while (block_byte_index_ < 56) {
- process_byte(0);
+ process_byte_impl(0);
}
} else {
while (block_byte_index_ < 56) {
- process_byte(0);
+ process_byte_impl(0);
}
}
// append length of message (before pre-processing)
// as a 64-bit big-endian integer
- process_byte(0);
- process_byte(0);
- process_byte(0);
- process_byte(0);
- process_byte( static_cast<unsigned char>((bit_count>>24) & 0xFF));
- process_byte( static_cast<unsigned char>((bit_count>>16) & 0xFF));
- process_byte( static_cast<unsigned char>((bit_count>>8 ) & 0xFF));
- process_byte( static_cast<unsigned char>((bit_count) & 0xFF));
+ process_byte_impl( static_cast<unsigned char>((bit_count_high>>24) & 0xFF) );
+ process_byte_impl( static_cast<unsigned char>((bit_count_high>>16) & 0xFF) );
+ process_byte_impl( static_cast<unsigned char>((bit_count_high>>8 ) & 0xFF) );
+ process_byte_impl( static_cast<unsigned char>((bit_count_high) & 0xFF) );
+ process_byte_impl( static_cast<unsigned char>((bit_count_low>>24) & 0xFF) );
+ process_byte_impl( static_cast<unsigned char>((bit_count_low>>16) & 0xFF) );
+ process_byte_impl( static_cast<unsigned char>((bit_count_low>>8 ) & 0xFF) );
+ process_byte_impl( static_cast<unsigned char>((bit_count_low) & 0xFF) );
// get final digest
digest[0] = h_[0];
diff --git a/3rdParty/Boost/src/boost/uuid/string_generator.hpp b/3rdParty/Boost/src/boost/uuid/string_generator.hpp
index 7d2733b..538ebe8 100644
--- a/3rdParty/Boost/src/boost/uuid/string_generator.hpp
+++ b/3rdParty/Boost/src/boost/uuid/string_generator.hpp
@@ -14,6 +14,7 @@
#include <iterator>
#include <algorithm> // for find
#include <stdexcept>
+#include <boost/throw_exception.hpp>
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std {
@@ -41,7 +42,7 @@ struct string_generator {
template <typename ch, typename char_traits, typename alloc>
uuid operator()(std::basic_string<ch, char_traits, alloc> const& s) const {
return operator()(s.begin(), s.end());
- };
+ }
uuid operator()(char const*const s) const {
return operator()(s, s+std::strlen(s));
@@ -174,7 +175,7 @@ private:
}
void throw_invalid() const {
- throw std::runtime_error("invalid uuid string");
+ BOOST_THROW_EXCEPTION(std::runtime_error("invalid uuid string"));
}
};