/ Check-in [93ce2bca]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix signed/unsigned comparison compiler warnings. Add the SQLITE_OMIT_RANDOMNESS compile-time option to cause the PRNG to be seeded identically on every run, for testing purposes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 93ce2bca701efc67aeb517c4d641bde71332e8a0
User & Date: drh 2015-04-30 12:31:49
Context
2015-04-30
13:06
Modify the mkfuzzdata1.tcl script so that it retains the culled test vectors in the tmp2 subdirectory. check-in: 431a958f user: drh tags: trunk
12:31
Fix signed/unsigned comparison compiler warnings. Add the SQLITE_OMIT_RANDOMNESS compile-time option to cause the PRNG to be seeded identically on every run, for testing purposes. check-in: 93ce2bca user: drh tags: trunk
2015-04-29
16:50
Use sqlite3_malloc64() in place of sqlite3_malloc() internally. check-in: 48f553b0 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/loadext.c.

   649    649   #ifndef SQLITE_OMIT_AUTOINIT
   650    650     rc = sqlite3_initialize();
   651    651     if( rc ){
   652    652       return rc;
   653    653     }else
   654    654   #endif
   655    655     {
   656         -    int i;
          656  +    u32 i;
   657    657   #if SQLITE_THREADSAFE
   658    658       sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
   659    659   #endif
   660    660       wsdAutoextInit;
   661    661       sqlite3_mutex_enter(mutex);
   662    662       for(i=0; i<wsdAutoext.nExt; i++){
   663    663         if( wsdAutoext.aExt[i]==xInit ) break;
................................................................................
   693    693   #if SQLITE_THREADSAFE
   694    694     sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
   695    695   #endif
   696    696     int i;
   697    697     int n = 0;
   698    698     wsdAutoextInit;
   699    699     sqlite3_mutex_enter(mutex);
   700         -  for(i=wsdAutoext.nExt-1; i>=0; i--){
          700  +  for(i=(int)wsdAutoext.nExt-1; i>=0; i--){
   701    701       if( wsdAutoext.aExt[i]==xInit ){
   702    702         wsdAutoext.nExt--;
   703    703         wsdAutoext.aExt[i] = wsdAutoext.aExt[wsdAutoext.nExt];
   704    704         n++;
   705    705         break;
   706    706       }
   707    707     }
................................................................................
   731    731   
   732    732   /*
   733    733   ** Load all automatic extensions.
   734    734   **
   735    735   ** If anything goes wrong, set an error in the database connection.
   736    736   */
   737    737   void sqlite3AutoLoadExtensions(sqlite3 *db){
   738         -  int i;
          738  +  u32 i;
   739    739     int go = 1;
   740    740     int rc;
   741    741     int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*);
   742    742   
   743    743     wsdAutoextInit;
   744    744     if( wsdAutoext.nExt==0 ){
   745    745       /* Common case: early out without every having to acquire a mutex */

Changes to src/os_unix.c.

  6131   6131     **
  6132   6132     ** When testing, initializing zBuf[] to zero is all we do.  That means
  6133   6133     ** that we always use the same random number sequence.  This makes the
  6134   6134     ** tests repeatable.
  6135   6135     */
  6136   6136     memset(zBuf, 0, nBuf);
  6137   6137     randomnessPid = osGetpid(0);  
  6138         -#if !defined(SQLITE_TEST)
         6138  +#if !defined(SQLITE_TEST) && !defined(SQLITE_OMIT_RANDOMNESS)
  6139   6139     {
  6140   6140       int fd, got;
  6141   6141       fd = robust_open("/dev/urandom", O_RDONLY, 0);
  6142   6142       if( fd<0 ){
  6143   6143         time_t t;
  6144   6144         time(&t);
  6145   6145         memcpy(zBuf, &t, sizeof(t));

Changes to src/os_win.c.

  5368   5368   
  5369   5369   /*
  5370   5370   ** Write up to nBuf bytes of randomness into zBuf.
  5371   5371   */
  5372   5372   static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
  5373   5373     int n = 0;
  5374   5374     UNUSED_PARAMETER(pVfs);
  5375         -#if defined(SQLITE_TEST)
         5375  +#if defined(SQLITE_TEST) || defined(SQLITE_OMIT_RANDOMNESS)
  5376   5376     n = nBuf;
  5377   5377     memset(zBuf, 0, nBuf);
  5378   5378   #else
  5379   5379     if( sizeof(SYSTEMTIME)<=nBuf-n ){
  5380   5380       SYSTEMTIME x;
  5381   5381       osGetSystemTime(&x);
  5382   5382       memcpy(&zBuf[n], &x, sizeof(x));
................................................................................
  5402   5402   #endif
  5403   5403     if( sizeof(LARGE_INTEGER)<=nBuf-n ){
  5404   5404       LARGE_INTEGER i;
  5405   5405       osQueryPerformanceCounter(&i);
  5406   5406       memcpy(&zBuf[n], &i, sizeof(i));
  5407   5407       n += sizeof(i);
  5408   5408     }
  5409         -#endif
  5410   5409   #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && SQLITE_WIN32_USE_UUID
  5411   5410     if( sizeof(UUID)<=nBuf-n ){
  5412   5411       UUID id;
  5413   5412       memset(&id, 0, sizeof(UUID));
  5414   5413       osUuidCreate(&id);
  5415   5414       memcpy(zBuf, &id, sizeof(UUID));
  5416   5415       n += sizeof(UUID);
................................................................................
  5419   5418       UUID id;
  5420   5419       memset(&id, 0, sizeof(UUID));
  5421   5420       osUuidCreateSequential(&id);
  5422   5421       memcpy(zBuf, &id, sizeof(UUID));
  5423   5422       n += sizeof(UUID);
  5424   5423     }
  5425   5424   #endif
         5425  +#endif /* defined(SQLITE_TEST) || defined(SQLITE_ZERO_PRNG_SEED) */
  5426   5426     return n;
  5427   5427   }
  5428   5428   
  5429   5429   
  5430   5430   /*
  5431   5431   ** Sleep for a little while.  Return the amount of time slept.
  5432   5432   */