aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/mhd_compat.c
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-08-23 20:13:07 +0000
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-08-23 20:13:07 +0000
commita3fc78c87acc9a411959115c071f60adf54a2e11 (patch)
treefe7b9954ef4c3d2aba9be1eb1430f5adee8a8e2c /src/microhttpd/mhd_compat.c
parent47bfec25d8fabfa4cc118e094a08101655d63d65 (diff)
downloadlibmicrohttpd-a3fc78c87acc9a411959115c071f60adf54a2e11.tar.gz
libmicrohttpd-a3fc78c87acc9a411959115c071f60adf54a2e11.zip
Emulate random() on platforms without random(), but with rand() function.
Diffstat (limited to 'src/microhttpd/mhd_compat.c')
-rw-r--r--src/microhttpd/mhd_compat.c20
1 files changed, 0 insertions, 20 deletions
diff --git a/src/microhttpd/mhd_compat.c b/src/microhttpd/mhd_compat.c
index 4911a1c6..c0a6e362 100644
--- a/src/microhttpd/mhd_compat.c
+++ b/src/microhttpd/mhd_compat.c
@@ -46,26 +46,6 @@ static_dummy_func(void)
46} 46}
47 47
48#if defined(_WIN32) && !defined(__CYGWIN__) 48#if defined(_WIN32) && !defined(__CYGWIN__)
49/**
50 * Static variable used by pseudo random number generator
51 */
52static int32_t rnd_val = 0;
53
54/**
55 * Generate 31-bit pseudo random number.
56 * Function initialize itself at first call to current time.
57 * @return 31-bit pseudo random number.
58 */
59int MHD_W32_random_(void)
60{
61 if (0 == rnd_val)
62 rnd_val = (int32_t)time(NULL);
63 /* stolen from winsup\cygwin\random.cc */
64 rnd_val = (16807 * (rnd_val % 127773) - 2836 * (rnd_val / 127773))
65 & 0x7fffffff;
66 return (int)rnd_val;
67}
68
69 49
70#ifndef HAVE_SNPRINTF 50#ifndef HAVE_SNPRINTF
71/* Emulate snprintf function on W32 */ 51/* Emulate snprintf function on W32 */