aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/mhd_compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/mhd_compat.h')
-rw-r--r--src/microhttpd/mhd_compat.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/microhttpd/mhd_compat.h b/src/microhttpd/mhd_compat.h
index 7fe3c735..3f88055f 100644
--- a/src/microhttpd/mhd_compat.h
+++ b/src/microhttpd/mhd_compat.h
@@ -35,6 +35,7 @@
35#define MHD_COMPAT_H 1 35#define MHD_COMPAT_H 1
36 36
37#include "mhd_options.h" 37#include "mhd_options.h"
38#include <stdlib.h>
38 39
39/* Platform-independent snprintf name */ 40/* Platform-independent snprintf name */
40#if defined(HAVE_SNPRINTF) 41#if defined(HAVE_SNPRINTF)
@@ -49,19 +50,20 @@ int W32_snprintf(char *__restrict s, size_t n, const char *__restrict format, ..
49#endif /* ! _WIN32*/ 50#endif /* ! _WIN32*/
50#endif /* ! HAVE_SNPRINTF */ 51#endif /* ! HAVE_SNPRINTF */
51 52
52#if !defined(_WIN32) || defined(__CYGWIN__) 53#ifdef HAVE_RANDOM
54/**
55 * Generate pseudo random number at least 30-bit wide.
56 * @return pseudo random number at least 30-bit wide.
57 */
53#define MHD_random_() random() 58#define MHD_random_() random()
54#else /* _WIN32 && !__CYGWIN__ */ 59#else /* HAVE_RANDOM */
55#define MHD_random_() MHD_W32_random_() 60#ifdef HAVE_RAND
56
57/** 61/**
58 * Generate 31-bit pseudo random number. 62 * Generate pseudo random number at least 30-bit wide.
59 * Function initialize itself at first call to current time. 63 * @return pseudo random number at least 30-bit wide.
60 * @return 31-bit pseudo random number.
61 */ 64 */
62int MHD_W32_random_(void); 65#define MHD_random_() ( (((long)rand()) << 15) + (long)rand() )
63#endif /* _WIN32 && !__CYGWIN__ */ 66#endif /* HAVE_RAND */
64 67#endif /* HAVE_RANDOM */
65
66 68
67#endif /* MHD_COMPAT_H */ 69#endif /* MHD_COMPAT_H */