wincng: Added cast for double to unsigned long conversion

This commit is contained in:
Marc Hoersken 2014-03-22 23:12:59 +01:00
parent 160776d218
commit 2c46c4bf95

View File

@ -1697,7 +1697,8 @@ _libssh2_wincng_bignum_set_word(_libssh2_bn *bn, unsigned long word)
while (number >>= 1)
bits++;
length = (unsigned long)(ceil((double)(bits+1)/8)*sizeof(unsigned char));
length = (unsigned long) (ceil(((double)(bits + 1)) / 8.0) *
sizeof(unsigned char));
if (_libssh2_wincng_bignum_resize(bn, length))
return -1;
@ -1740,12 +1741,17 @@ _libssh2_wincng_bignum_from_bin(_libssh2_bn *bn, unsigned long len,
unsigned char *bignum;
unsigned long offset, length, bits;
if (bn && bin && len > 0) {
if (!_libssh2_wincng_bignum_resize(bn, len)) {
if (!bn || !bin || !len)
return;
if (_libssh2_wincng_bignum_resize(bn, len))
return;
memcpy(bn->bignum, bin, len);
bits = _libssh2_wincng_bignum_bits(bn);
length = ceil((double)bits / 8) * sizeof(unsigned char);
length = (unsigned long) (ceil(((double)bits) / 8.0) *
sizeof(unsigned char));
offset = bn->length - length;
if (offset > 0) {
@ -1757,8 +1763,6 @@ _libssh2_wincng_bignum_from_bin(_libssh2_bn *bn, unsigned long len,
bn->length = length;
}
}
}
}
}
void