]> granicus.if.org Git - libevent/commitdiff
Fix some compilation warnings with msvc
authorNick Mathewson <nickm@torproject.org>
Tue, 3 Apr 2012 20:15:49 +0000 (16:15 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 3 Apr 2012 20:15:49 +0000 (16:15 -0400)
event.c
test/regress_buffer.c

diff --git a/event.c b/event.c
index 14950238e08163576f13afb29c005beeb81927f8..0f10b56976e3575ea451d7cce5e28f6dcf47d1e0 100644 (file)
--- a/event.c
+++ b/event.c
@@ -2129,6 +2129,7 @@ evthread_notify_base_default(struct event_base *base)
        return (r < 0 && errno != EAGAIN) ? -1 : 0;
 }
 
+#ifdef EVENT__HAVE_EVENTFD
 /* Helper callback: wake an event_base from another thread.  This version
  * assumes that you have a working eventfd() implementation. */
 static int
@@ -2142,6 +2143,8 @@ evthread_notify_base_eventfd(struct event_base *base)
 
        return (r < 0) ? -1 : 0;
 }
+#endif
+
 
 /** Tell the thread currently running the event_loop for base (if any) that it
  * needs to stop waiting in its dispatch function (if it is) and process all
@@ -2963,6 +2966,7 @@ event_set_mem_functions(void *(*malloc_fn)(size_t sz),
 }
 #endif
 
+#ifdef EVENT__HAVE_EVENTFD
 static void
 evthread_notify_drain_eventfd(evutil_socket_t fd, short what, void *arg)
 {
@@ -2978,6 +2982,7 @@ evthread_notify_drain_eventfd(evutil_socket_t fd, short what, void *arg)
        base->is_notify_pending = 0;
        EVBASE_RELEASE_LOCK(base, th_base_lock);
 }
+#endif
 
 static void
 evthread_notify_drain_default(evutil_socket_t fd, short what, void *arg)
@@ -3012,13 +3017,16 @@ evthread_make_base_notifiable(struct event_base *base)
                return 0;
        }
 
+#ifdef EVENT__HAVE_EVENTFD
        base->th_notify_fd[0] = evutil_eventfd_(0,
            EVUTIL_EFD_CLOEXEC|EVUTIL_EFD_NONBLOCK);
        if (base->th_notify_fd[0] >= 0) {
                base->th_notify_fd[1] = -1;
                notify = evthread_notify_base_eventfd;
                cb = evthread_notify_drain_eventfd;
-       } else if (evutil_make_internal_pipe_(base->th_notify_fd) == 0) {
+       } else
+#endif
+       if (evutil_make_internal_pipe_(base->th_notify_fd) == 0) {
                notify = evthread_notify_base_default;
                cb = evthread_notify_drain_default;
        } else {
index 05f179061afbdbd5420358f57b5e9bbaedf7bdab..dfb680b5dde702f55a62721a06794f1247738eb7 100644 (file)
@@ -757,7 +757,7 @@ test_evbuffer_add_file(void *ptr)
                data = malloc(1024*512);
                tt_assert(data);
                for (i = 0; i < datalen; ++i)
-                       data[i] = evutil_weakrand_();
+                       data[i] = (char)evutil_weakrand_();
        } else {
                data = strdup("here is a relatively small string.");
                tt_assert(data);