mirror of https://gitee.com/bigwinds/arangodb
Fix compilation on Windows for S2 and VS 2017. (#5267)
* Fix compilation on Windows VS 2017 (s2). * Improve compilation fix for windows.
This commit is contained in:
parent
acab8b45f6
commit
b1aac15764
|
@ -23,6 +23,7 @@
|
|||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/crypto.h> // for OPENSSL_free
|
||||
|
@ -134,7 +135,16 @@ static int BN_ext_count_low_zero_bits(const BIGNUM* bn) {
|
|||
// converts the absolute value of `a into little-endian form and
|
||||
// stores it at `to`. `tolen` indicates the length of the output buffer `to`
|
||||
int size = BN_num_bytes(bn);
|
||||
unsigned char bin[size];
|
||||
unsigned char buf[80];
|
||||
std::unique_ptr<unsigned char> bin_up;
|
||||
unsigned char* bin;
|
||||
if (size <= 80) {
|
||||
bin = buf;
|
||||
} else {
|
||||
bin_up.reset(new unsigned char[size]);
|
||||
bin = bin_up.get();
|
||||
}
|
||||
|
||||
size = BN_bn2lebinpad(bn, bin, size);
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
|
|
Loading…
Reference in New Issue