1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-06 15:49:35 +03:00

Begin migration to using sqlite3_vfs interface. (CVS 4240)

FossilOrigin-Name: af3e3c7acdc67013dd733effebe981620d922dd1
This commit is contained in:
danielk1977
2007-08-17 15:53:36 +00:00
parent e53831d644
commit b4b47411ab
21 changed files with 692 additions and 475 deletions

View File

@@ -15,7 +15,7 @@
** Random numbers are used by some of the database backends in order
** to generate random integer keys for tables or random filenames.
**
** $Id: random.c,v 1.16 2007/01/05 14:38:56 drh Exp $
** $Id: random.c,v 1.17 2007/08/17 15:53:37 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -63,7 +63,7 @@ static int randomByte(void){
char k[256];
prng.j = 0;
prng.i = 0;
sqlite3OsRandomSeed(k);
sqlite3OsRandomness(sqlite3_find_vfs(0), 256, k);
for(i=0; i<256; i++){
prng.s[i] = i;
}
@@ -92,9 +92,9 @@ static int randomByte(void){
*/
void sqlite3Randomness(int N, void *pBuf){
unsigned char *zBuf = pBuf;
sqlite3OsEnterMutex();
sqlite3_mutex_enter(sqlite3_mutex_alloc(SQLITE_MUTEX_PRNG));
while( N-- ){
*(zBuf++) = randomByte();
}
sqlite3OsLeaveMutex();
sqlite3_mutex_leave(sqlite3_mutex_alloc(SQLITE_MUTEX_PRNG));
}