Zero out some more key data before freeing it
[tor/rransom.git] / Win32Build / mingw / libevent-1.1b-mingw-custom.diff
blob350586e35f9038da84b26424952aa49ea7c01c73
1 Only in libevent-1.1b: CHANGES
2 Only in libevent-1.1b: Makefile
3 diff -uwr libevent-1.1b-old/Makefile.am libevent-1.1b/Makefile.am
4 --- libevent-1.1b-old/Makefile.am Wed Aug 9 22:16:35 2006
5 +++ libevent-1.1b/Makefile.am Sat Sep 2 03:49:26 2006
6 @@ -1,6 +1,5 @@
7 AUTOMAKE_OPTIONS = foreign no-dependencies
9 -SUBDIRS = . sample test
11 EXTRA_DIST = acconfig.h event.h event-internal.h log.h evsignal.h event.3 \
12 kqueue.c epoll_sub.c epoll.c select.c rtsig.c poll.c signal.c \
13 @@ -20,8 +19,29 @@
15 lib_LTLIBRARIES = libevent.la
17 -libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c
18 -libevent_la_LIBADD = @LTLIBOBJS@
20 +if BUILD_WIN32
22 +SUBDIRS = . sample
23 +SYS_LIBS = -lws2_32
24 +SYS_SRC = WIN32-Code/misc.c WIN32-Code/win32.c
26 +else
28 +SUBDIRS = . sample test
29 +SYS_LIBS =
30 +SYS_SRC =
32 +endif
34 +if USE_CUSTOM_CODE
35 +CUST_SRC = custom/custom.c
36 +else
37 +CUST_SRC =
38 +endif
40 +libevent_la_SOURCES = event.c buffer.c evbuffer.c log.c $(CUST_SRC) $(SYS_SRC)
41 +libevent_la_LIBADD = @LTLIBOBJS@ $(SYS_LIBS)
42 libevent_la_LDFLAGS = -release @VERSION@ -version-info 1:2:0
44 include_HEADERS = event.h
45 Only in libevent-1.1b: Makefile.in
46 diff -uwr libevent-1.1b-old/WIN32-Code/misc.c libevent-1.1b/WIN32-Code/misc.c
47 --- libevent-1.1b-old/WIN32-Code/misc.c Wed Aug 9 21:01:14 2006
48 +++ libevent-1.1b/WIN32-Code/misc.c Fri Sep 1 22:21:31 2006
49 @@ -4,6 +4,12 @@
50 #include <sys/timeb.h>
51 #include <time.h>
53 +#ifdef __GNUC__
54 +/*our prototypes for timeval and timezone are in here, just in case the above
55 + headers don't have them*/
56 +#include "misc.h"
57 +#endif
59 /****************************************************************************
61 * Function: gettimeofday(struct timeval *, struct timezone *)
62 diff -uwr libevent-1.1b-old/WIN32-Code/misc.h libevent-1.1b/WIN32-Code/misc.h
63 --- libevent-1.1b-old/WIN32-Code/misc.h Wed Aug 9 21:01:14 2006
64 +++ libevent-1.1b/WIN32-Code/misc.h Fri Sep 1 18:47:09 2006
65 @@ -1,6 +1,9 @@
66 #ifndef MISC_H
67 #define MISC_H
69 +struct timezone;
70 +struct timeval;
72 int gettimeofday(struct timeval *,struct timezone *);
74 #endif
75 diff -uwr libevent-1.1b-old/WIN32-Code/win32.c libevent-1.1b/WIN32-Code/win32.c
76 --- libevent-1.1b-old/WIN32-Code/win32.c Wed Aug 9 21:25:48 2006
77 +++ libevent-1.1b/WIN32-Code/win32.c Sat Sep 2 00:45:55 2006
78 @@ -60,7 +60,8 @@
79 /* MSDN says this is required to handle SIGFPE */
80 volatile double SIGFPE_REQ = 0.0f;
82 -int signal_handler(int sig);
83 +static int signal_handler(int sig);
85 void signal_process(void);
86 int signal_recalc(void);
88 @@ -77,20 +78,21 @@
91 void *win32_init (void);
92 -int win32_insert (void *, struct event *);
93 -int win32_del (void *, struct event *);
94 +int win32_insert (struct win32op *, struct event *);
95 +int win32_del (struct win32op *, struct event *);
96 int win32_recalc (struct event_base *base, void *, int);
97 -int win32_dispatch (struct event_base *base, void *, struct timeval *);
98 +int win32_dispatch (struct event_base *base, struct win32op *, struct timeval *);
100 struct eventop win32ops = {
101 "win32",
102 win32_init,
103 - win32_insert,
104 - win32_del,
105 + (int (*) (void*, struct event*)) win32_insert,
106 + (int (*) (void*, struct event*)) win32_del,
107 win32_recalc,
108 - win32_dispatch
109 + (int (*) (struct event_base*, void*, struct timeval*)) win32_dispatch
113 #define FD_SET_ALLOC_SIZE(n) ((sizeof(struct win_fd_set) + ((n)-1)*sizeof(SOCKET)))
115 static int
116 @@ -213,7 +215,13 @@
117 if (ev->ev_events & (EV_READ|EV_WRITE))
118 event_errx(1, "%s: EV_SIGNAL incompatible use",
119 __func__);
121 +#ifndef __GNUC__
122 if((int)signal(EVENT_SIGNAL(ev), signal_handler) == -1)
123 +#else
124 + if((int)signal(EVENT_SIGNAL(ev), (void*) signal_handler) == -1)
125 +#endif
127 return (-1);
129 return (0);
130 @@ -382,8 +390,13 @@
132 /* Reinstall our signal handler. */
133 TAILQ_FOREACH(ev, &signalqueue, ev_signal_next) {
134 +#ifndef __GNUC__
135 if((int)signal(EVENT_SIGNAL(ev), signal_handler) == -1)
136 +#else
137 + if((int)signal(EVENT_SIGNAL(ev), (void*) signal_handler) == -1)
138 +#endif
139 return (-1);
142 return (0);
144 Only in libevent-1.1b-old/: aclocal.m4
145 Only in libevent-1.1b: autom4te.cache
146 diff -uwr libevent-1.1b-old/buffer.c libevent-1.1b/buffer.c
147 --- libevent-1.1b-old/buffer.c Wed Aug 9 22:01:40 2006
148 +++ libevent-1.1b/buffer.c Fri Sep 1 18:52:56 2006
149 @@ -197,7 +197,7 @@
150 u_char *data = EVBUFFER_DATA(buffer);
151 size_t len = EVBUFFER_LENGTH(buffer);
152 char *line;
153 - u_int i;
154 + unsigned int i;
156 for (i = 0; i < len; i++) {
157 if (data[i] == '\r' || data[i] == '\n')
158 Only in libevent-1.1b: config.guess
159 Only in libevent-1.1b: config.h
160 diff -uwr libevent-1.1b-old/config.h.in libevent-1.1b/config.h.in
161 --- libevent-1.1b-old/config.h.in Wed Aug 9 21:27:37 2006
162 +++ libevent-1.1b/config.h.in Sat Sep 2 02:23:17 2006
163 @@ -223,6 +223,9 @@
164 /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
165 #undef TIME_WITH_SYS_TIME
167 +/* Define to 1 if you want to use a custom eventops variable */
168 +#undef USE_CUSTOM_EVENTOPS
170 /* Version number of package */
171 #undef VERSION
173 @@ -232,11 +235,9 @@
174 /* Define to empty if `const' does not conform to ANSI C. */
175 #undef const
177 -/* Define to `__inline__' or `__inline' if that's what the C compiler
178 - calls it, or to nothing if 'inline' is not supported under any name. */
179 -#ifndef __cplusplus
180 +/* Define as `__inline' if that's what the C compiler calls it, or to nothing
181 + if it is not supported. */
182 #undef inline
183 -#endif
185 /* Define to `int' if <sys/types.h> does not define. */
186 #undef pid_t
187 Only in libevent-1.1b: config.h.in~
188 Only in libevent-1.1b: config.log
189 Only in libevent-1.1b: config.status
190 Only in libevent-1.1b: configure
191 diff -uwr libevent-1.1b-old/configure.in libevent-1.1b/configure.in
192 --- libevent-1.1b-old/configure.in Wed Aug 9 22:05:17 2006
193 +++ libevent-1.1b/configure.in Sat Sep 2 03:40:15 2006
194 @@ -21,6 +21,18 @@
195 CFLAGS="$CFLAGS -Wall"
198 +AC_ARG_ENABLE(custom-eventops,
199 + [ --enable-custom-eventops Use custom eventops variable],
200 + AC_DEFINE([USE_CUSTOM_EVENTOPS],[1],
201 + [Define to 1 to use a custom eventops variable])
202 + ,)
203 +AC_ARG_ENABLE(custom-code,
204 + [ --enable-custom-code Use custom code from custom/],
205 + customcodev=true,
206 + customcodev=false)
208 +AM_CONDITIONAL(USE_CUSTOM_CODE, test x$customcodev = xtrue)
210 AC_PROG_LIBTOOL
212 dnl Uncomment "AC_DISABLE_SHARED" to make shared librraries not get
213 @@ -110,6 +122,22 @@
214 AC_MSG_RESULT(yes)] ,AC_MSG_RESULT(no)
218 +dnl - check if the macro WIN32 is defined on this compiler.
219 +dnl - (this is how we check for a windows version of GCC)
220 +AC_MSG_CHECKING(for WIN32)
221 +AC_TRY_COMPILE(,
223 + #ifndef WIN32
224 + #error
225 + #endif
226 + ],
227 + bwin32=true; AC_MSG_RESULT(yes),
228 + bwin32=false; AC_MSG_RESULT(no),
231 +AM_CONDITIONAL(BUILD_WIN32, test x$bwin32 = xtrue)
234 dnl Checks for typedefs, structures, and compiler characteristics.
235 AC_C_CONST
236 diff -uwr libevent-1.1b-old/evbuffer.c libevent-1.1b/evbuffer.c
237 --- libevent-1.1b-old/evbuffer.c Wed Aug 9 21:01:14 2006
238 +++ libevent-1.1b/evbuffer.c Fri Sep 1 19:18:13 2006
239 @@ -154,12 +154,20 @@
240 if (EVBUFFER_LENGTH(bufev->output)) {
241 res = evbuffer_write(bufev->output, fd);
242 if (res == -1) {
243 +#ifndef WIN32
244 +/*todo. evbuffer uses WriteFile when WIN32 is set. WIN32 system calls do not
245 + *set errno. thus this error checking is not portable*/
246 if (errno == EAGAIN ||
247 errno == EINTR ||
248 errno == EINPROGRESS)
249 goto reschedule;
250 /* error case */
251 what |= EVBUFFER_ERROR;
253 +#else
254 + goto reschedule;
255 +#endif
257 } else if (res == 0) {
258 /* eof case */
259 what |= EVBUFFER_EOF;
260 @@ -181,6 +189,7 @@
261 return;
263 reschedule:
265 if (EVBUFFER_LENGTH(bufev->output) != 0)
266 bufferevent_add(&bufev->ev_write, bufev->timeout_write);
267 return;
268 diff -uwr libevent-1.1b-old/event.c libevent-1.1b/event.c
269 --- libevent-1.1b-old/event.c Wed Aug 9 21:25:48 2006
270 +++ libevent-1.1b/event.c Sat Sep 2 04:22:05 2006
271 @@ -30,8 +30,14 @@
272 #define WIN32_LEAN_AND_MEAN
273 #include <windows.h>
274 #undef WIN32_LEAN_AND_MEAN
276 +#ifdef __GNUC__
277 +#include "WIN32-Code/misc.h"
278 +#else
279 #include "misc.h"
280 #endif
282 +#endif
283 #include <sys/types.h>
284 #include <sys/tree.h>
285 #ifdef HAVE_SYS_TIME_H
286 @@ -53,6 +59,7 @@
287 #include "event-internal.h"
288 #include "log.h"
291 #ifdef HAVE_SELECT
292 extern const struct eventop selectops;
293 #endif
294 @@ -75,6 +82,8 @@
295 extern const struct eventop win32ops;
296 #endif
298 +#ifndef USE_CUSTOM_EVENTOPS
300 /* In order of preference */
301 const struct eventop *eventops[] = {
302 #ifdef HAVE_WORKING_KQUEUE
303 @@ -101,6 +110,11 @@
304 NULL
307 +#else
308 +#include "custom-eventops.h"
309 +#endif //USE_CUSTOM_EVENTOPS
312 /* Global state */
313 struct event_list signalqueue;
315 Only in libevent-1.1b: libtool
316 diff -uwr libevent-1.1b-old/log.c libevent-1.1b/log.c
317 --- libevent-1.1b-old/log.c Wed Aug 9 21:01:14 2006
318 +++ libevent-1.1b/log.c Fri Sep 1 19:09:45 2006
319 @@ -45,8 +45,14 @@
320 #define WIN32_LEAN_AND_MEAN
321 #include <windows.h>
322 #undef WIN32_LEAN_AND_MEAN
324 +#ifdef __GNUC__
325 +#include "WIN32-Code/misc.h"
326 +#else
327 #include "misc.h"
328 #endif
330 +#endif
331 #include <sys/types.h>
332 #include <sys/tree.h>
333 #ifdef HAVE_SYS_TIME_H
334 Only in libevent-1.1b/sample: Makefile
335 Only in libevent-1.1b/sample: Makefile.in
336 Only in libevent-1.1b: stamp-h1
337 Only in libevent-1.1b/test: Makefile
338 Only in libevent-1.1b/test: Makefile.in