Fix build failure when InternalDHKeyExchange is used

pull/1213/head
Tatsuhiro Tsujikawa 2018-05-17 18:39:44 +09:00
parent 6ddd23cce0
commit e8e04d6f22
1 changed files with 6 additions and 4 deletions

View File

@ -19,6 +19,8 @@
#include <memory> #include <memory>
#include <stdint.h> #include <stdint.h>
#include "a2functional.h"
namespace bignum { namespace bignum {
template <size_t dim> class ulong { template <size_t dim> class ulong {
@ -31,17 +33,17 @@ private:
std::unique_ptr<char_t[]> buf_; std::unique_ptr<char_t[]> buf_;
public: public:
inline ulong() : buf_(make_unique<char_t[]>(dim)) {} inline ulong() : buf_(aria2::make_unique<char_t[]>(dim)) {}
inline ulong(size_t t) : buf_(make_unique<char_t[]>(dim)) inline ulong(size_t t) : buf_(aria2::make_unique<char_t[]>(dim))
{ {
memcpy(buf_.get(), (char_t*)&t, sizeof(t)); memcpy(buf_.get(), (char_t*)&t, sizeof(t));
} }
inline ulong(const ulong<dim>& rhs) : buf_(make_unique<char_t[]>(dim)) inline ulong(const ulong<dim>& rhs) : buf_(aria2::make_unique<char_t[]>(dim))
{ {
memcpy(buf_.get(), rhs.buf_.get(), dim); memcpy(buf_.get(), rhs.buf_.get(), dim);
} }
explicit inline ulong(const char_t* data, size_t size) explicit inline ulong(const char_t* data, size_t size)
: buf_(make_unique<char_t[]>(dim)) : buf_(aria2::make_unique<char_t[]>(dim))
{ {
if (size > dim) { if (size > dim) {
throw std::bad_alloc(); throw std::bad_alloc();