mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-11 01:42:22 +03:00
Fix compilation issue with MSVC due to a misplaced variable declaration.
FossilOrigin-Name: 9588b345d09daaa49d24d7fb6cab732e64e5474e
This commit is contained in:
16
src/random.c
16
src/random.c
@@ -34,10 +34,6 @@ void sqlite3_randomness(int N, void *pBuf){
|
||||
unsigned char t;
|
||||
unsigned char *zBuf = pBuf;
|
||||
|
||||
#ifndef SQLITE_OMIT_AUTOINIT
|
||||
if( sqlite3_initialize() ) return;
|
||||
#endif
|
||||
|
||||
/* The "wsdPrng" macro will resolve to the pseudo-random number generator
|
||||
** state vector. If writable static data is unsupported on the target,
|
||||
** we have to locate the state vector at run-time. In the more common
|
||||
@@ -52,13 +48,23 @@ void sqlite3_randomness(int N, void *pBuf){
|
||||
#endif
|
||||
|
||||
#if SQLITE_THREADSAFE
|
||||
sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG);
|
||||
sqlite3_mutex *mutex;
|
||||
#endif
|
||||
|
||||
#ifndef SQLITE_OMIT_AUTOINIT
|
||||
if( sqlite3_initialize() ) return;
|
||||
#endif
|
||||
|
||||
#if SQLITE_THREADSAFE
|
||||
mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG);
|
||||
sqlite3_mutex_enter(mutex);
|
||||
#endif
|
||||
|
||||
if( N<=0 || pBuf==0 ){
|
||||
wsdPrng.isInit = 0;
|
||||
#if SQLITE_THREADSAFE
|
||||
sqlite3_mutex_leave(mutex);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user