From 22a962c9fe4e347a1a55c9c7ae445aa382887ad3 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Tue, 7 May 2013 20:35:47 +0000 Subject: [PATCH] Constify libusb_get_pollfds return The correct return type, per our libusb(3) man page and the libusb.org and libusbx projects (whose interface we intend to follow for our libusb), is const struct libusb_pollfd **. Unfortunately the doxygen-generated libusbx API documentation[1] omits[2] the const for some reason. [1] http://libusbx.sourceforge.net/api-1.0/group__poll.html#gab1a72869a926552b27a6c667695df3a2 [2] http://sourceforge.net/mailarchive/forum.php?thread_name=497D10BE.8090007%40n-dimensional.de&forum_name=libusb-devel Reviewed by: hselasky@ --- lib/libusb/libusb.h | 2 +- lib/libusb/libusb10_io.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libusb/libusb.h b/lib/libusb/libusb.h index 225b539e907a..52ad914377bc 100644 --- a/lib/libusb/libusb.h +++ b/lib/libusb/libusb.h @@ -441,7 +441,7 @@ int libusb_handle_events(libusb_context * ctx); int libusb_handle_events_locked(libusb_context * ctx, struct timeval *tv); int libusb_get_next_timeout(libusb_context * ctx, struct timeval *tv); void libusb_set_pollfd_notifiers(libusb_context * ctx, libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb, void *user_data); -struct libusb_pollfd **libusb_get_pollfds(libusb_context * ctx); +const struct libusb_pollfd **libusb_get_pollfds(libusb_context * ctx); /* Synchronous device I/O */ diff --git a/lib/libusb/libusb10_io.c b/lib/libusb/libusb10_io.c index 489ceb76caed..9aa31c484224 100644 --- a/lib/libusb/libusb10_io.c +++ b/lib/libusb/libusb10_io.c @@ -397,7 +397,7 @@ libusb_set_pollfd_notifiers(libusb_context *ctx, ctx->fd_cb_user_data = user_data; } -struct libusb_pollfd ** +const struct libusb_pollfd ** libusb_get_pollfds(libusb_context *ctx) { struct libusb_super_pollfd *pollfd; @@ -423,7 +423,7 @@ libusb_get_pollfds(libusb_context *ctx) done: CTX_UNLOCK(ctx); - return (ret); + return ((const struct libusb_pollfd **)ret); }