randomInt should return signed int

svn path=/trunk/kdesupport/qca/; revision=648706
This commit is contained in:
Justin Karneges 2007-04-01 04:07:22 +00:00
parent 888844476e
commit 0f17fbc864
3 changed files with 4 additions and 4 deletions

2
TODO
View File

@ -13,7 +13,6 @@
make sure there aren't any cases where a Foo::supportsBar()-style function make sure there aren't any cases where a Foo::supportsBar()-style function
reports true, but then when the object is created, it doesn't actually reports true, but then when the object is created, it doesn't actually
support the feature (because the wrong provider was used). support the feature (because the wrong provider was used).
why is Random returning unsigned?
code: code:
strange backtrace on mac (ask textshell) strange backtrace on mac (ask textshell)
other: other:
@ -30,6 +29,7 @@
tls extensions: hostname and ocsp stapling tls extensions: hostname and ocsp stapling
QSecureArray/QBigInteger -> QCA::SecureArray/QCA::BigInteger ? QSecureArray/QBigInteger -> QCA::SecureArray/QCA::BigInteger ?
code: code:
global random thread-safety?
tls/sasl tls/sasl
fix asker implementation, it is a disaster fix asker implementation, it is a disaster
dirwatch: thread safety dirwatch: thread safety

View File

@ -104,7 +104,7 @@ namespace QCA
* myRandomInt = QCA::Random::randomInt(); * myRandomInt = QCA::Random::randomInt();
* \endcode * \endcode
*/ */
static uint randomInt(); static int randomInt();
/** /**
* Provide a specified number of random bytes * Provide a specified number of random bytes

View File

@ -48,10 +48,10 @@ uchar Random::randomChar()
return globalRNG().nextByte(); return globalRNG().nextByte();
} }
uint Random::randomInt() int Random::randomInt()
{ {
QSecureArray a = globalRNG().nextBytes(sizeof(int)); QSecureArray a = globalRNG().nextBytes(sizeof(int));
uint x; int x;
memcpy(&x, a.data(), a.size()); memcpy(&x, a.data(), a.size());
return x; return x;
} }