SQLite

Check-in [5d189df39a]
Login

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

Overview
Comment:make os2Randomness() act the same as other platforms with SQLITE_TEST (all zeroed buffer) (CVS 5961)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5d189df39a3a5e99372826f87f9f20bbd92f1565
User & Date: pweilbacher 2008-11-26 19:56:48.000
Context
2008-11-26
20:03
remove warning in os2Sync() with SQLITE_NO_SYNC set (CVS 5962) (check-in: 68a51f67af user: pweilbacher tags: trunk)
19:56
make os2Randomness() act the same as other platforms with SQLITE_TEST (all zeroed buffer) (CVS 5961) (check-in: 5d189df39a user: pweilbacher tags: trunk)
13:44
Fix the test condition for the test cases added to prevent regressions of ticket #3508. (CVS 5957) (check-in: 4e94aa3bed user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/os_os2.c.
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code that is specific to OS/2.
**
** $Id: os_os2.c,v 1.60 2008/11/22 19:50:54 pweilbacher Exp $
*/

#include "sqliteInt.h"

#if SQLITE_OS_OS2

/*







|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code that is specific to OS/2.
**
** $Id: os_os2.c,v 1.61 2008/11/26 19:56:48 pweilbacher Exp $
*/

#include "sqliteInt.h"

#if SQLITE_OS_OS2

/*
962
963
964
965
966
967
968
969
970





971
972
973
974
975
976
977
#endif


/*
** Write up to nBuf bytes of randomness into zBuf.
*/
static int os2Randomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf ){
  int sizeofULong = sizeof(ULONG);
  int n = 0;





  if( (int)sizeof(DATETIME) <= nBuf - n ){
    DATETIME x;
    DosGetDateTime(&x);
    memcpy(&zBuf[n], &x, sizeof(x));
    n += sizeof(x);
  }








<

>
>
>
>
>







962
963
964
965
966
967
968

969
970
971
972
973
974
975
976
977
978
979
980
981
#endif


/*
** Write up to nBuf bytes of randomness into zBuf.
*/
static int os2Randomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf ){

  int n = 0;
#if defined(SQLITE_TEST)
  n = nBuf;
  memset(zBuf, 0, nBuf);
#else
  int sizeofULong = sizeof(ULONG);
  if( (int)sizeof(DATETIME) <= nBuf - n ){
    DATETIME x;
    DosGetDateTime(&x);
    memcpy(&zBuf[n], &x, sizeof(x));
    n += sizeof(x);
  }

1011
1012
1013
1014
1015
1016
1017

1018
1019
1020
1021
1022
1023
1024
      n += sizeofULong;
    }
    if( sizeofULong <= nBuf - n ){
      memcpy(&zBuf[n], &ulSysInfo[QSV_TOTAVAILMEM - 1], sizeofULong);
      n += sizeofULong;
    }
  }


  return n;
}

/*
** Sleep for a little while.  Return the amount of time slept.
** The argument is the number of microseconds we want to sleep.







>







1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
      n += sizeofULong;
    }
    if( sizeofULong <= nBuf - n ){
      memcpy(&zBuf[n], &ulSysInfo[QSV_TOTAVAILMEM - 1], sizeofULong);
      n += sizeofULong;
    }
  }
#endif

  return n;
}

/*
** Sleep for a little while.  Return the amount of time slept.
** The argument is the number of microseconds we want to sleep.