diff options
Diffstat (limited to 'src/platform')
-rw-r--r-- | src/platform/Makefile.am | 20 | ||||
-rw-r--r-- | src/platform/w32functions.c | 74 |
2 files changed, 0 insertions, 94 deletions
diff --git a/src/platform/Makefile.am b/src/platform/Makefile.am deleted file mode 100644 index 448efae3..00000000 --- a/src/platform/Makefile.am +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | # This Makefile.am is in the public domain | ||
2 | AM_CPPFLAGS = \ | ||
3 | -I$(top_srcdir)/src/include | ||
4 | |||
5 | AM_CFLAGS = $(HIDDEN_VISIBILITY_CFLAGS) | ||
6 | |||
7 | if USE_COVERAGE | ||
8 | AM_CFLAGS += --coverage | ||
9 | endif | ||
10 | |||
11 | if HAVE_W32 | ||
12 | noinst_LTLIBRARIES = \ | ||
13 | libplatform_interface.la | ||
14 | libplatform_interface_la_CPPFLAGS = \ | ||
15 | $(AM_CPPFLAGS) \ | ||
16 | -DBUILDING_MHD_LIB=1 | ||
17 | libplatform_interface_la_SOURCES = \ | ||
18 | w32functions.c | ||
19 | endif | ||
20 | |||
diff --git a/src/platform/w32functions.c b/src/platform/w32functions.c deleted file mode 100644 index 6fec7a3c..00000000 --- a/src/platform/w32functions.c +++ /dev/null | |||
@@ -1,74 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of libmicrohttpd | ||
3 | Copyright (C) 2014 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. | ||
17 | If not, see <http://www.gnu.org/licenses/>. | ||
18 | */ | ||
19 | |||
20 | /** | ||
21 | * @file platform/w32functions.h | ||
22 | * @brief internal functions for W32 systems | ||
23 | * @author Karlson2k (Evgeny Grin) | ||
24 | */ | ||
25 | |||
26 | #include "w32functions.h" | ||
27 | #include <string.h> | ||
28 | #include <stdint.h> | ||
29 | #include <time.h> | ||
30 | #include <stdio.h> | ||
31 | #include <stdarg.h> | ||
32 | |||
33 | /** | ||
34 | * Static variable used by pseudo random number generator | ||
35 | */ | ||
36 | static int32_t rnd_val = 0; | ||
37 | /** | ||
38 | * Generate 31-bit pseudo random number. | ||
39 | * Function initialize itself at first call to current time. | ||
40 | * @return 31-bit pseudo random number. | ||
41 | */ | ||
42 | int MHD_W32_random_(void) | ||
43 | { | ||
44 | if (0 == rnd_val) | ||
45 | rnd_val = (int32_t)time(NULL); | ||
46 | /* stolen from winsup\cygwin\random.cc */ | ||
47 | rnd_val = (16807 * (rnd_val % 127773) - 2836 * (rnd_val / 127773)) | ||
48 | & 0x7fffffff; | ||
49 | return (int)rnd_val; | ||
50 | } | ||
51 | |||
52 | /* Emulate snprintf function on W32 */ | ||
53 | int W32_snprintf(char *__restrict s, size_t n, const char *__restrict format, ...) | ||
54 | { | ||
55 | int ret; | ||
56 | va_list args; | ||
57 | if (0 != n && NULL != s ) | ||
58 | { | ||
59 | va_start(args, format); | ||
60 | ret = _vsnprintf(s, n, format, args); | ||
61 | va_end(args); | ||
62 | if ((int)n == ret) | ||
63 | s[n - 1] = 0; | ||
64 | if (ret >= 0) | ||
65 | return ret; | ||
66 | } | ||
67 | va_start(args, format); | ||
68 | ret = _vscprintf(format, args); | ||
69 | va_end(args); | ||
70 | if (0 <= ret && 0 != n && NULL == s) | ||
71 | return -1; | ||
72 | |||
73 | return ret; | ||
74 | } | ||