fix compiler errors which caused by support of freebsd
This commit is contained in:
parent
da70334459
commit
26ce77ded5
@ -12,8 +12,10 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
# ifndef NANA_LINUX
|
||||
static bool get_default_audio(std::string &, bool);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace nana{namespace audio
|
||||
{
|
||||
@ -47,14 +49,13 @@ namespace nana{namespace audio
|
||||
}wave_native_if;
|
||||
#endif
|
||||
//class audio_device
|
||||
audio_device::audio_device()
|
||||
#if defined(NANA_WINDOWS)
|
||||
: handle_(nullptr), buf_prep_(nullptr)
|
||||
audio_device::audio_device():
|
||||
#if defined(NANA_WINDOWS) || defined(NANA_LINUX)
|
||||
handle_(nullptr),
|
||||
#elif defined(NANA_POSIX)
|
||||
: handle_(-1), buf_prep_(nullptr)
|
||||
#elif defined(NANA_LINUX)
|
||||
: handle_(nullptr), buf_prep_(nullptr)
|
||||
handle_(-1),
|
||||
#endif
|
||||
buf_prep_(nullptr)
|
||||
{}
|
||||
|
||||
audio_device::~audio_device()
|
||||
@ -64,7 +65,7 @@ namespace nana{namespace audio
|
||||
|
||||
bool audio_device::empty() const
|
||||
{
|
||||
#ifdef NANA_POSIX
|
||||
#if defined(NANA_POSIX) && not defined(NANA_LINUX)
|
||||
return (-1 == handle_);
|
||||
#else
|
||||
return (nullptr == handle_);
|
||||
@ -249,11 +250,6 @@ namespace nana{namespace audio
|
||||
|
||||
wave_native_if.out_prepare(handle_, m, sizeof(WAVEHDR));
|
||||
wave_native_if.out_write(handle_, m, sizeof(WAVEHDR));
|
||||
#elif defined(NANA_POSIX)
|
||||
// consider moving this to a background thread.
|
||||
// currently this blocks calling thread.
|
||||
::write(handle_, m->buf, m->bufsize);
|
||||
buf_prep_->revert(m);
|
||||
#elif defined(NANA_LINUX)
|
||||
std::size_t frames = m->bufsize / bytes_per_frame_;
|
||||
std::size_t buffered = 0; //in bytes
|
||||
@ -269,6 +265,11 @@ namespace nana{namespace audio
|
||||
::snd_pcm_prepare(handle_);
|
||||
}
|
||||
buf_prep_->revert(m);
|
||||
#elif defined(NANA_POSIX)
|
||||
// consider moving this to a background thread.
|
||||
// currently this blocks calling thread.
|
||||
::write(handle_, m->buf, m->bufsize);
|
||||
buf_prep_->revert(m);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -304,7 +305,7 @@ namespace nana{namespace audio
|
||||
}//end namespace audio
|
||||
}//end namespace nana
|
||||
|
||||
#ifdef NANA_POSIX
|
||||
#if defined(NANA_POSIX) && not defined(NANA_LINUX)
|
||||
// parse input securely, no-overruns or overflows.
|
||||
static bool match(char *&cursor, const char *pattern, const char *tail)
|
||||
{
|
||||
|
||||
@ -34,7 +34,7 @@ static void posix_open_url(const char *url_utf8)
|
||||
const char *home = getenv("HOME");
|
||||
std::string cheat(home);
|
||||
cheat += "/.mozilla";
|
||||
struct stat exists{};
|
||||
struct stat exists;
|
||||
|
||||
// TODO: generalize this for chromium, opera, waterfox, etc.
|
||||
// Most desktop environments (KDE, Gnome, Lumina etc.) provide a way to set
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user