mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-30 01:16:16 +02:00
Fix warnings
This commit is contained in:
parent
97bfd95f28
commit
aab3c343d0
15 changed files with 31 additions and 10 deletions
|
@ -10,7 +10,9 @@ option(BUILD_TESTS "Build tests (run tests with make test)" ON)
|
|||
|
||||
if (MSVC)
|
||||
# warning level 4 and all warnings as errors
|
||||
add_compile_options(/W4 /WX)
|
||||
# warning C4505: 'getArch': unreferenced local function has been removed
|
||||
# warning C4458: declaration of 'size' hides class member
|
||||
add_compile_options(/W4 /WX /wd4458 /wd4505)
|
||||
else()
|
||||
# lots of warnings and all warnings as errors
|
||||
add_compile_options(-Wall -Wextra -pedantic -Werror -Wno-unused-function)
|
||||
|
|
|
@ -206,7 +206,8 @@ void metadata_callback(const FLAC__StreamDecoder* /*decoder*/, const FLAC__Strea
|
|||
if (metadata->type == FLAC__METADATA_TYPE_STREAMINFO)
|
||||
{
|
||||
static_cast<FlacDecoder*>(client_data)->cacheInfo_.sampleRate_ = metadata->data.stream_info.sample_rate;
|
||||
sampleFormat.setFormat(metadata->data.stream_info.sample_rate, metadata->data.stream_info.bits_per_sample, metadata->data.stream_info.channels);
|
||||
sampleFormat.setFormat(metadata->data.stream_info.sample_rate, static_cast<uint16_t>(metadata->data.stream_info.bits_per_sample),
|
||||
static_cast<uint16_t>(metadata->data.stream_info.channels));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ SampleFormat OggDecoder::setHeader(msg::CodecHeader* chunk)
|
|||
/// local state for most of the decode so multiple block decodes can proceed
|
||||
/// in parallel. We could init multiple vorbis_block structures for vd here
|
||||
|
||||
sampleFormat_.setFormat(vi.rate, 16, vi.channels);
|
||||
sampleFormat_.setFormat(vi.rate, 16, static_cast<uint16_t>(vi.channels));
|
||||
|
||||
/* Throw the comments plus a few lines about the bitstream we're decoding */
|
||||
char** ptr = vc.user_comments;
|
||||
|
|
|
@ -149,7 +149,6 @@ bool Player::getHardwareVolume(double& volume, bool& muted)
|
|||
std::ignore = volume;
|
||||
std::ignore = muted;
|
||||
throw SnapException("Failed to get hardware mixer volume: not supported");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -156,6 +156,8 @@ vector<PcmDevice> WASAPIPlayer::pcm_list()
|
|||
return deviceList;
|
||||
}
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4127)
|
||||
void WASAPIPlayer::worker()
|
||||
{
|
||||
assert(sizeof(char) == sizeof(BYTE));
|
||||
|
@ -396,6 +398,7 @@ void WASAPIPlayer::worker()
|
|||
}
|
||||
}
|
||||
}
|
||||
#pragma warning(pop)
|
||||
|
||||
HRESULT STDMETHODCALLTYPE AudioSessionEventListener::QueryInterface(REFIID riid, VOID** ppvInterface)
|
||||
{
|
||||
|
@ -419,6 +422,7 @@ HRESULT STDMETHODCALLTYPE AudioSessionEventListener::QueryInterface(REFIID riid,
|
|||
|
||||
HRESULT STDMETHODCALLTYPE AudioSessionEventListener::OnSimpleVolumeChanged(float NewVolume, BOOL NewMute, LPCGUID EventContext)
|
||||
{
|
||||
std::ignore = EventContext;
|
||||
volume_ = NewVolume;
|
||||
muted_ = NewMute;
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
#ifndef WASAPI_PLAYER_HPP
|
||||
#define WASAPI_PLAYER_HPP
|
||||
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4100)
|
||||
|
||||
#include "player.hpp"
|
||||
#include <audiopolicy.h>
|
||||
#include <endpointvolume.h>
|
||||
|
@ -187,4 +190,6 @@ private:
|
|||
ClientSettings::SharingMode mode_;
|
||||
};
|
||||
|
||||
#pragma warning(pop)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -115,7 +115,7 @@ void Stream::addChunk(unique_ptr<msg::PcmChunk> chunk)
|
|||
std::shared_ptr<msg::PcmChunk> front_;
|
||||
while (chunks_.front_copy(front_))
|
||||
{
|
||||
auto age = std::chrono::duration_cast<cs::msec>(TimeProvider::serverNow() - front_->start());
|
||||
age = std::chrono::duration_cast<cs::msec>(TimeProvider::serverNow() - front_->start());
|
||||
if ((age > 5s + bufferMs_) && chunks_.try_pop(front_))
|
||||
LOG(TRACE, LOG_TAG) << "Oldest chunk too old: " << age.count() << " ms, removing. Chunks in queue left: " << chunks_.size() << "\n";
|
||||
else
|
||||
|
|
|
@ -178,7 +178,7 @@ enum class Severity : std::int8_t
|
|||
|
||||
static Severity to_severity(std::string severity, Severity def = Severity::info)
|
||||
{
|
||||
std::transform(severity.begin(), severity.end(), severity.begin(), [](unsigned char c) { return std::tolower(c); });
|
||||
std::transform(severity.begin(), severity.end(), severity.begin(), [](unsigned char c) { return static_cast<char>(std::tolower(c)); });
|
||||
if (severity == "trace")
|
||||
return Severity::trace;
|
||||
else if (severity == "debug")
|
||||
|
@ -841,7 +841,7 @@ struct SinkOutputDebugString : public Sink
|
|||
{
|
||||
}
|
||||
|
||||
void log(const Metadata& metadata, const std::string& message) override
|
||||
void log(const Metadata& /*metadata*/, const std::string& message) override
|
||||
{
|
||||
std::wstring wide = std::wstring(message.begin(), message.end());
|
||||
OutputDebugString(wide.c_str());
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
|
||||
uint16_t getVolume()
|
||||
{
|
||||
return get("volume", 100);
|
||||
return get("volume", static_cast<uint16_t>(100));
|
||||
}
|
||||
|
||||
bool isMuted()
|
||||
|
|
|
@ -124,7 +124,7 @@ struct BaseMessage
|
|||
{
|
||||
}
|
||||
|
||||
BaseMessage(message_type type_) : type(type_), id(0), refersTo(0)
|
||||
BaseMessage(message_type type_) : type(static_cast<uint16_t>(type_)), id(0), refersTo(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
|
||||
uint16_t getVolume()
|
||||
{
|
||||
return get("volume", 100);
|
||||
return get("volume", static_cast<uint16_t>(100));
|
||||
}
|
||||
|
||||
bool isMuted()
|
||||
|
|
|
@ -61,6 +61,7 @@ inline static void timeofday(struct timeval* tv)
|
|||
// Implementation from http://stackoverflow.com/a/26085827/2510022
|
||||
inline static int gettimeofday(struct timeval* tp, struct timezone* tzp)
|
||||
{
|
||||
std::ignore = tzp;
|
||||
// Note: some broken versions only have 8 trailing zero's, the correct epoch has 9 trailing zero's
|
||||
static const uint64_t EPOCH = ((uint64_t)116444736000000000ULL);
|
||||
|
||||
|
|
|
@ -21,7 +21,10 @@
|
|||
|
||||
#include "control_session.hpp"
|
||||
#include <boost/beast/core.hpp>
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wuninitialized"
|
||||
#include <boost/beast/websocket.hpp>
|
||||
#pragma GCC diagnostic pop
|
||||
#include <deque>
|
||||
|
||||
namespace beast = boost::beast; // from <boost/beast.hpp>
|
||||
|
|
|
@ -21,7 +21,10 @@
|
|||
|
||||
#include "control_session.hpp"
|
||||
#include <boost/beast/core.hpp>
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wuninitialized"
|
||||
#include <boost/beast/websocket.hpp>
|
||||
#pragma GCC diagnostic pop
|
||||
#include <deque>
|
||||
|
||||
namespace beast = boost::beast; // from <boost/beast.hpp>
|
||||
|
|
|
@ -21,7 +21,10 @@
|
|||
|
||||
#include "stream_session.hpp"
|
||||
#include <boost/beast/core.hpp>
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wuninitialized"
|
||||
#include <boost/beast/websocket.hpp>
|
||||
#pragma GCC diagnostic pop
|
||||
#include <deque>
|
||||
|
||||
namespace beast = boost::beast; // from <boost/beast.hpp>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue