Revise compiler checks for the rand_s() function.

FossilOrigin-Name: 287f508dd6abc1b9ffdbec6a685ebe79eeac992b
This commit is contained in:
mistachkin 2016-02-15 22:01:24 +00:00
parent 51d5ed97f5
commit bfc9b3f45c
5 changed files with 104 additions and 97 deletions

View File

@ -1,5 +1,5 @@
C On\swindows\ssystems\swhen\srand_s()\sis\savailable,\suse\sit\sto\sobtain\sadditional\nseed\smaterial\sin\swinRandomness().
D 2016-02-15T21:31:51.875
C Revise\scompiler\schecks\sfor\sthe\srand_s()\sfunction.
D 2016-02-15T22:01:24.377
F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 30f075dc4f27a07abb76088946b2944178d85347
@ -321,7 +321,7 @@ F src/mem2.c f1940d9e91948dd6a908fbb9ce3835c36b5d83c3
F src/mem3.c 8768ac94694f31ffaf8b4d0ea5dc08af7010a35a
F src/mem5.c 9bf955937b07f8c32541c8a9991f33ce3173d944
F src/memjournal.c 349a04fb803db40532cde0993e39758f1acaecce
F src/msvc.h 32960d4f059c281182accbb3a5e5215d969fc73a
F src/msvc.h d9ba56c6851227ab44b3f228a35f3f5772296495
F src/mutex.c 8e45800ee78e0cd1f1f3fe8e398853307f4a085c
F src/mutex.h 779d588e3b7756ec3ecf7d78cde1d84aba414f85
F src/mutex_noop.c 9d4309c075ba9cc7249e19412d3d62f7f94839c4
@ -333,7 +333,7 @@ F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf
F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
F src/os_unix.c 3a6f20736dfb8a0949cdd66553fdf59f6604be35
F src/os_win.c 382fd1b58ddfe649993110ebdfb7f31d3cdcf7f6
F src/os_win.c d085a0b043abe0c9349c7e8663730cc290041b56
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
F src/pager.c 6812f3803951774b56abded396171e1c12b0b003
F src/pager.h f3eb324a3ff2408b28bab7e81c1c55c13720f865
@ -353,7 +353,7 @@ F src/shell.c 0367440658104bf2ce8d8a9a5a713a4b11c9acbe
F src/sqlite.h.in f80c6ebd85588fc514bfedf3ecb00cec269cb410
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d
F src/sqliteInt.h e2ed86c6f5c3e503bbd07328737342afedfe48fc
F src/sqliteInt.h 47f61c35d587d38cbcfc8ba852ff441054d697d3
F src/sqliteLimit.h 216557999cb45f2e3578ed53ebefe228d779cb46
F src/status.c 70912d7be68e9e2dbc4010c93d344af61d4c59ba
F src/table.c 5226df15ab9179b9ed558d89575ea0ce37b03fc9
@ -1427,7 +1427,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh a98af506df552f3b3c0d904f94e4cdc4e1a6d598
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P fea3705e7750d276a8c8300b7a82dfae2d5979c0
R 3ea964cea3f85da9036cd633975ae669
U drh
Z 9da59384e387e9220326258d227dc94d
P 139081bef9f63c3ebbe9e992408597b1349bdf37
R 882b4878d4fb3d5db66502eaecb957f2
U mistachkin
Z 2021541af14002b61ba4d5fc0e59c306

View File

@ -1 +1 @@
139081bef9f63c3ebbe9e992408597b1349bdf37
287f508dd6abc1b9ffdbec6a685ebe79eeac992b

View File

@ -16,7 +16,6 @@
#define _MSVC_H_
#if defined(_MSC_VER)
#define _CRT_RAND_S /* Make rand_s() available on windows systems */
#pragma warning(disable : 4054)
#pragma warning(disable : 4055)
#pragma warning(disable : 4100)

View File

@ -5424,7 +5424,7 @@ static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
EntropyGatherer e;
UNUSED_PARAMETER(pVfs);
memset(zBuf, 0, nBuf);
#ifdef _MSC_VER
#if defined(_MSC_VER) && _MSC_VER>=1400
rand_s((int*)zBuf); /* rand_s() is not available with MinGW */
#endif
e.a = (unsigned char*)zBuf;

View File

@ -15,6 +15,14 @@
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_
/*
** Make sure that rand_s() is available on Windows systems with MSVC 2005
** or higher.
*/
#if defined(_MSC_VER) && _MSC_VER>=1400
# define _CRT_RAND_S
#endif
/*
** Include the header file used to customize the compiler options for MSVC.
** This should be done first so that it can successfully prevent spurious