diff options
Diffstat (limited to 'src/microhttpd/mhd_compat.h')
-rw-r--r-- | src/microhttpd/mhd_compat.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/microhttpd/mhd_compat.h b/src/microhttpd/mhd_compat.h new file mode 100644 index 00000000..7fe3c735 --- /dev/null +++ b/src/microhttpd/mhd_compat.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | This file is part of libmicrohttpd | ||
3 | Copyright (C) 2014-2016 Karlson2k (Evgeny Grin) | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2.1 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public | ||
16 | License along with this library; if not, write to the Free Software | ||
17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | |||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file microhttpd/mhd_compat.h | ||
23 | * @brief Header for platform missing functions. | ||
24 | * @author Karlson2k (Evgeny Grin) | ||
25 | * | ||
26 | * Provides compatibility for platforms with some missing | ||
27 | * functionality. | ||
28 | * Any functions can be implemented as macro on some platforms | ||
29 | * unless explicitly marked otherwise. | ||
30 | * Any function argument can be skipped in macro, so avoid | ||
31 | * variable modification in function parameters. | ||
32 | */ | ||
33 | |||
34 | #ifndef MHD_COMPAT_H | ||
35 | #define MHD_COMPAT_H 1 | ||
36 | |||
37 | #include "mhd_options.h" | ||
38 | |||
39 | /* Platform-independent snprintf name */ | ||
40 | #if defined(HAVE_SNPRINTF) | ||
41 | #define MHD_snprintf_ snprintf | ||
42 | #else /* ! HAVE_SNPRINTF */ | ||
43 | #if defined(_WIN32) | ||
44 | /* Emulate snprintf function on W32 */ | ||
45 | int W32_snprintf(char *__restrict s, size_t n, const char *__restrict format, ...); | ||
46 | #define MHD_snprintf_ W32_snprintf | ||
47 | #else /* ! _WIN32*/ | ||
48 | #error Your platform does not support snprintf() and MHD does not know how to emulate it on your platform. | ||
49 | #endif /* ! _WIN32*/ | ||
50 | #endif /* ! HAVE_SNPRINTF */ | ||
51 | |||
52 | #if !defined(_WIN32) || defined(__CYGWIN__) | ||
53 | #define MHD_random_() random() | ||
54 | #else /* _WIN32 && !__CYGWIN__ */ | ||
55 | #define MHD_random_() MHD_W32_random_() | ||
56 | |||
57 | /** | ||
58 | * Generate 31-bit pseudo random number. | ||
59 | * Function initialize itself at first call to current time. | ||
60 | * @return 31-bit pseudo random number. | ||
61 | */ | ||
62 | int MHD_W32_random_(void); | ||
63 | #endif /* _WIN32 && !__CYGWIN__ */ | ||
64 | |||
65 | |||
66 | |||
67 | #endif /* MHD_COMPAT_H */ | ||