Updated Boost libraries

This commit is contained in:
Sergii Pylypenko
2013-06-26 17:31:21 +03:00
parent cb4611925f
commit d62c91a533
2623 changed files with 177210 additions and 61224 deletions
@@ -79,7 +79,7 @@ public:
: rd_index_(5)
, random_(std::fopen( "/dev/urandom", "rb" ))
{}
~seed_rng()
{
if (random_) {
@@ -109,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;
}
@@ -139,7 +140,7 @@ private:
}
{
unsigned int rn[] =
unsigned int rn[] =
{ static_cast<unsigned int>(std::rand())
, static_cast<unsigned int>(std::rand())
, static_cast<unsigned int>(std::rand())
@@ -153,9 +154,7 @@ private:
if(random_)
{
// the not_used variable is to suppress warnings
size_t not_used = 0;
not_used = std::fread( buffer, 1, 20, random_ );
ignore_size(std::fread( buffer, 1, 20, random_ ));
}
// using an uninitialized buffer[] if fopen fails
@@ -190,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&);
@@ -213,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()
+12 -4
View File
@@ -19,6 +19,7 @@
#include <stdexcept>
#include <boost/throw_exception.hpp>
#include <cstddef>
#include <string>
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std {
@@ -89,10 +90,17 @@ inline void sha1::process_byte(unsigned char byte)
{
process_byte_impl(byte);
bit_count_low += 8;
if (bit_count_low == 0) {
++bit_count_high;
if (bit_count_high == 0) {
// 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"));
}
}