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

Restructure the OS interface yet again. This time make the OsFile object

a virtual base class which is subclassed for unix, windows, and the crash
test simulator.  Add the new file "os.c" for common os layer code.  Move
all OS-specific routines into the sqlite3Os structure. (CVS 2795)

FossilOrigin-Name: bd8740d1aecba69e1b5d64d43db07e8ad8841f07
This commit is contained in:
drh
2005-11-30 03:20:31 +00:00
parent 392b3ddf2e
commit 054889ec6d
20 changed files with 752 additions and 598 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.13 2005/06/12 21:35:52 drh Exp $
** $Id: random.c,v 1.14 2005/11/30 03:20:32 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -63,7 +63,7 @@ static int randomByte(){
char k[256];
prng.j = 0;
prng.i = 0;
sqlite3OsRandomSeed(k);
sqlite3Os.xRandomSeed(k);
for(i=0; i<256; i++){
prng.s[i] = i;
}
@@ -92,9 +92,9 @@ static int randomByte(){
*/
void sqlite3Randomness(int N, void *pBuf){
unsigned char *zBuf = pBuf;
sqlite3OsEnterMutex();
sqlite3Os.xEnterMutex();
while( N-- ){
*(zBuf++) = randomByte();
}
sqlite3OsLeaveMutex();
sqlite3Os.xLeaveMutex();
}