From: bruceperens Date: Tue, 18 Mar 2014 18:34:47 +0000 (+0000) Subject: Add PollType, so that we can support WSApoll on Windows. X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=89a3785a5f73be9bf10907a2475e76e2c1c6f4d2;p=freetel-svn-tracking.git Add PollType, so that we can support WSApoll on Windows. git-svn-id: https://svn.code.sf.net/p/freetel/code@1449 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/freedv-server/source/audio_sink.cpp b/freedv-server/source/audio_sink.cpp index 6d644dba..42d0953c 100644 --- a/freedv-server/source/audio_sink.cpp +++ b/freedv-server/source/audio_sink.cpp @@ -17,7 +17,7 @@ namespace FreeDV { /// \return The address of an array of integers containing the /// file descriptors. virtual int - poll_fds(struct pollfd * array, int space); + poll_fds(PollType * array, int space); /// Return the number of audio samples the device can handle in /// a write without blocking. This version always returns SIZE_MAX. @@ -46,7 +46,7 @@ namespace FreeDV { } int - AudioSink::poll_fds(struct pollfd *, int) + AudioSink::poll_fds(PollType *, int) { return 0; } diff --git a/freedv-server/source/blank_panel.cpp b/freedv-server/source/blank_panel.cpp index 96175684..5db66f4e 100644 --- a/freedv-server/source/blank_panel.cpp +++ b/freedv-server/source/blank_panel.cpp @@ -16,7 +16,7 @@ namespace FreeDV { /// with the number of file descriptors in the array. /// \return The address of an array of integers containing the /// file descriptors. - virtual int poll_fds(struct pollfd * array, int space); + virtual int poll_fds(PollType * array, int space); /// Return the amount of bytes ready for read. In this case, it always /// returns 0. @@ -33,7 +33,7 @@ namespace FreeDV { } int - BlankPanel::poll_fds(struct pollfd *, int) + BlankPanel::poll_fds(PollType *, int) { return 0; } diff --git a/freedv-server/source/drivers.h b/freedv-server/source/drivers.h index 83e1028a..091e8c9e 100644 --- a/freedv-server/source/drivers.h +++ b/freedv-server/source/drivers.h @@ -223,8 +223,11 @@ public: /// written. virtual std::size_t ready() = 0; - /// - virtual int poll_fds(struct pollfd * array, int space) = 0; + /// Type used by poll_fds(). For portability to Windows. + typedef struct pollfd PollType; + + /// Poll file descriptors for available I/O. + virtual int poll_fds(PollType * array, int space) = 0; virtual ~IODevice() = 0; }; diff --git a/freedv-server/source/platform/linux/audio_in_alsa.cpp b/freedv-server/source/platform/linux/audio_in_alsa.cpp index e93b47c7..f128289c 100644 --- a/freedv-server/source/platform/linux/audio_in_alsa.cpp +++ b/freedv-server/source/platform/linux/audio_in_alsa.cpp @@ -44,7 +44,7 @@ namespace FreeDV { /// \return The address of an array of integers containing the /// file descriptors. virtual int - poll_fds(struct pollfd * array, int space); + poll_fds(PollType * array, int space); /// Return the number of audio samples the device can provide in /// a read without blocking. @@ -114,7 +114,7 @@ namespace FreeDV { } int - AudioInALSA::poll_fds(struct pollfd * array, int space) + AudioInALSA::poll_fds(PollType * array, int space) { const int size = snd_pcm_poll_descriptors_count(handle); diff --git a/freedv-server/source/platform/linux/audio_out_alsa.cpp b/freedv-server/source/platform/linux/audio_out_alsa.cpp index cf371a41..ec5f353e 100644 --- a/freedv-server/source/platform/linux/audio_out_alsa.cpp +++ b/freedv-server/source/platform/linux/audio_out_alsa.cpp @@ -42,7 +42,7 @@ namespace FreeDV { /// \return The address of an array of integers containing the /// file descriptors. virtual int - poll_fds(struct pollfd * array, int space); + poll_fds(PollType * array, int space); /// Return the number of audio samples the device can handle in /// a write without blocking. @@ -111,7 +111,7 @@ namespace FreeDV { } int - AudioOutALSA::poll_fds(struct pollfd * array, int space) + AudioOutALSA::poll_fds(PollType * array, int space) { const int size = snd_pcm_poll_descriptors_count(handle); diff --git a/freedv-server/source/ptt_constant.cpp b/freedv-server/source/ptt_constant.cpp index b673f03c..5755e71e 100644 --- a/freedv-server/source/ptt_constant.cpp +++ b/freedv-server/source/ptt_constant.cpp @@ -21,7 +21,7 @@ namespace FreeDV { /// with the number of file descriptors in the array. /// \return The address of an array of integers containing the /// file descriptors. - virtual int poll_fds(struct pollfd * array, int space); + virtual int poll_fds(PollType * array, int space); /// Return the amount of bytes ready for read. std::size_t ready(); @@ -49,7 +49,7 @@ namespace FreeDV { } int - PTTConstant::poll_fds(struct pollfd *, int) + PTTConstant::poll_fds(PollType *, int) { return 0; } diff --git a/freedv-server/source/text_constant.cpp b/freedv-server/source/text_constant.cpp index 57c9d888..badbc3b2 100644 --- a/freedv-server/source/text_constant.cpp +++ b/freedv-server/source/text_constant.cpp @@ -21,7 +21,7 @@ namespace FreeDV { /// with the number of file descriptors in the array. /// \return The address of an array of integers containing the /// file descriptors. - virtual int poll_fds(struct pollfd * array, int space); + virtual int poll_fds(PollType * array, int space); /// Read the text data. std::size_t read(char * buffer, std::size_t size); @@ -40,7 +40,7 @@ namespace FreeDV { } int - TextConstant::poll_fds(struct pollfd *, int) + TextConstant::poll_fds(PollType *, int) { return 0; } diff --git a/freedv-server/source/tone.cpp b/freedv-server/source/tone.cpp index 97c61fac..7598358d 100644 --- a/freedv-server/source/tone.cpp +++ b/freedv-server/source/tone.cpp @@ -24,7 +24,7 @@ namespace FreeDV { /// with the number of file descriptors in the array. /// \return The address of an array of integers containing the /// file descriptors. - virtual int poll_fds(struct pollfd * array, int space); + virtual int poll_fds(PollType * array, int space); /// Return the amount of audio samples for read. In this case, it always /// returns SIZE_MAX. @@ -132,7 +132,7 @@ namespace FreeDV { } int - Tone::poll_fds(struct pollfd *, int) + Tone::poll_fds(PollType *, int) { return 0; }