Merge remote-tracking branches 'neheb/uniq', 'neheb/bool', 'neheb/loop', 'neheb/bool2', 'neheb/perf', 'neheb/void' and 'neheb/value'
This commit is contained in:
commit
4b0444e760
|
@ -107,7 +107,7 @@ static constexpr OptionDef option_defs[] = {
|
|||
static constexpr Domain cmdline_domain("cmdline");
|
||||
|
||||
gcc_noreturn
|
||||
static void version(void)
|
||||
static void version()
|
||||
{
|
||||
printf("Music Player Daemon " VERSION " (%s)"
|
||||
"\n"
|
||||
|
@ -273,7 +273,7 @@ static void PrintOption(const OptionDef &opt)
|
|||
}
|
||||
|
||||
gcc_noreturn
|
||||
static void help(void)
|
||||
static void help()
|
||||
{
|
||||
printf("Usage:\n"
|
||||
" mpd [OPTION...] [path/to/mpd.conf]\n"
|
||||
|
@ -283,7 +283,7 @@ static void help(void)
|
|||
"Options:\n");
|
||||
|
||||
for (const auto &i : option_defs)
|
||||
if(i.HasDescription() == true) // hide hidden options from help print
|
||||
if(i.HasDescription()) // hide hidden options from help print
|
||||
PrintOption(i);
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
|
|
|
@ -63,7 +63,7 @@ static void redirect_logs(int fd)
|
|||
}
|
||||
|
||||
static int
|
||||
open_log_file(void)
|
||||
open_log_file()
|
||||
{
|
||||
assert(!out_path.IsNull());
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ archive_plugin_from_name(const char *name) noexcept
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void archive_plugin_init_all(void)
|
||||
void archive_plugin_init_all()
|
||||
{
|
||||
for (unsigned i = 0; archive_plugins[i] != nullptr; ++i) {
|
||||
const ArchivePlugin *plugin = archive_plugins[i];
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <bzlib.h>
|
||||
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
class Bzip2ArchiveFile final : public ArchiveFile {
|
||||
std::string name;
|
||||
|
@ -65,7 +66,7 @@ class Bzip2InputStream final : public InputStream {
|
|||
char buffer[5000];
|
||||
|
||||
public:
|
||||
Bzip2InputStream(const std::shared_ptr<InputStream> &_input,
|
||||
Bzip2InputStream(std::shared_ptr<InputStream> _input,
|
||||
const char *uri,
|
||||
Mutex &mutex);
|
||||
~Bzip2InputStream() override;
|
||||
|
@ -111,11 +112,11 @@ bz2_open(Path pathname)
|
|||
|
||||
/* single archive handling */
|
||||
|
||||
Bzip2InputStream::Bzip2InputStream(const std::shared_ptr<InputStream> &_input,
|
||||
Bzip2InputStream::Bzip2InputStream(std::shared_ptr<InputStream> _input,
|
||||
const char *_uri,
|
||||
Mutex &_mutex)
|
||||
:InputStream(_uri, _mutex),
|
||||
input(_input)
|
||||
input(std::move(_input))
|
||||
{
|
||||
Open();
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <utility>
|
||||
|
||||
#define CEILING(x, y) ((x+(y-1))/y)
|
||||
|
||||
struct Iso9660 {
|
||||
|
@ -141,12 +143,12 @@ class Iso9660InputStream final : public InputStream {
|
|||
iso9660_stat_t *statbuf;
|
||||
|
||||
public:
|
||||
Iso9660InputStream(const std::shared_ptr<Iso9660> &_iso,
|
||||
Iso9660InputStream(std::shared_ptr<Iso9660> _iso,
|
||||
const char *_uri,
|
||||
Mutex &_mutex,
|
||||
iso9660_stat_t *_statbuf)
|
||||
:InputStream(_uri, _mutex),
|
||||
iso(_iso), statbuf(_statbuf) {
|
||||
iso(std::move(_iso)), statbuf(_statbuf) {
|
||||
size = statbuf->size;
|
||||
seekable = true;
|
||||
SetReady();
|
||||
|
|
|
@ -246,8 +246,8 @@ static CommandResult
|
|||
PrintAvailableCommands(Response &r, const Partition &partition,
|
||||
unsigned permission) noexcept
|
||||
{
|
||||
for (unsigned i = 0; i < num_commands; ++i) {
|
||||
const struct command *cmd = &commands[i];
|
||||
for (const auto & i : commands) {
|
||||
const struct command *cmd = &i;
|
||||
|
||||
if (cmd->permission == (permission & cmd->permission) &&
|
||||
command_available(partition, cmd))
|
||||
|
@ -260,8 +260,8 @@ PrintAvailableCommands(Response &r, const Partition &partition,
|
|||
static CommandResult
|
||||
PrintUnavailableCommands(Response &r, unsigned permission) noexcept
|
||||
{
|
||||
for (unsigned i = 0; i < num_commands; ++i) {
|
||||
const struct command *cmd = &commands[i];
|
||||
for (const auto & i : commands) {
|
||||
const struct command *cmd = &i;
|
||||
|
||||
if (cmd->permission != (permission & cmd->permission))
|
||||
r.Format("command: %s\n", cmd->cmd);
|
||||
|
|
|
@ -23,14 +23,15 @@
|
|||
#include "song/Filter.hxx"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
DatabaseVisitorHelper::DatabaseVisitorHelper(const DatabaseSelection &_selection,
|
||||
DatabaseVisitorHelper::DatabaseVisitorHelper(DatabaseSelection _selection,
|
||||
VisitSong &visit_song) noexcept
|
||||
:selection(_selection)
|
||||
:selection(std::move(_selection))
|
||||
{
|
||||
// TODO: apply URI and SongFilter
|
||||
assert(selection.uri.empty());
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
* @param visit_song the callback function passed to
|
||||
* Database::Visit(); may be replaced by this class
|
||||
*/
|
||||
DatabaseVisitorHelper(const DatabaseSelection &selection,
|
||||
DatabaseVisitorHelper(DatabaseSelection selection,
|
||||
VisitSong &visit_song) noexcept;
|
||||
~DatabaseVisitorHelper() noexcept;
|
||||
|
||||
|
|
|
@ -863,10 +863,7 @@ IsFilterSupported(const ISongFilter &f) noexcept
|
|||
return true;
|
||||
|
||||
const auto tag = Convert(t->GetTagType());
|
||||
if (tag == MPD_TAG_COUNT)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return tag != MPD_TAG_COUNT;
|
||||
} else if (auto u = dynamic_cast<const UriSongFilter *>(&f)) {
|
||||
if (u->IsNegated())
|
||||
// TODO implement
|
||||
|
|
|
@ -330,7 +330,7 @@ mpd_inotify_init(EventLoop &loop, Storage &storage, UpdateService &update,
|
|||
}
|
||||
|
||||
void
|
||||
mpd_inotify_finish(void) noexcept
|
||||
mpd_inotify_finish() noexcept
|
||||
{
|
||||
if (inotify_source == nullptr)
|
||||
return;
|
||||
|
|
|
@ -102,7 +102,7 @@ flac_scan_stream(InputStream &is, TagHandler &handler) noexcept
|
|||
* Some glue code around FLAC__stream_decoder_new().
|
||||
*/
|
||||
static FlacStreamDecoder
|
||||
flac_decoder_new(void)
|
||||
flac_decoder_new()
|
||||
{
|
||||
FlacStreamDecoder sd;
|
||||
if(!FLAC__stream_decoder_set_metadata_respond(sd.get(), FLAC__METADATA_TYPE_VORBIS_COMMENT))
|
||||
|
|
|
@ -516,8 +516,8 @@ parse_xing(struct xing *xing, struct mad_bitptr *ptr, int *oldbitlen) noexcept
|
|||
if (xing->flags & XING_TOC) {
|
||||
if (bitlen < 800)
|
||||
return false;
|
||||
for (unsigned i = 0; i < 100; ++i)
|
||||
xing->toc[i] = mad_bit_read(ptr, 8);
|
||||
for (unsigned char & i : xing->toc)
|
||||
i = mad_bit_read(ptr, 8);
|
||||
bitlen -= 800;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,24 +38,24 @@ static constexpr Domain mikmod_domain("mikmod");
|
|||
static constexpr size_t MIKMOD_FRAME_SIZE = 4096;
|
||||
|
||||
static BOOL
|
||||
mikmod_mpd_init(void)
|
||||
mikmod_mpd_init()
|
||||
{
|
||||
return VC_Init();
|
||||
}
|
||||
|
||||
static void
|
||||
mikmod_mpd_exit(void)
|
||||
mikmod_mpd_exit()
|
||||
{
|
||||
VC_Exit();
|
||||
}
|
||||
|
||||
static void
|
||||
mikmod_mpd_update(void)
|
||||
mikmod_mpd_update()
|
||||
{
|
||||
}
|
||||
|
||||
static BOOL
|
||||
mikmod_mpd_is_present(void)
|
||||
mikmod_mpd_is_present()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -102,10 +102,7 @@ FullyBufferedSocket::OnSocketReady(unsigned flags) noexcept
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!BufferedSocket::OnSocketReady(flags))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return BufferedSocket::OnSocketReady(flags);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -33,7 +33,7 @@ InputPlugin::SupportsUri(const char *uri) const noexcept
|
|||
if (StringStartsWithIgnoreCase(uri, *i))
|
||||
return true;
|
||||
} else {
|
||||
for (auto schema : protocols()) {
|
||||
for (const auto& schema : protocols()) {
|
||||
if (StringStartsWithIgnoreCase(uri, schema.c_str())){
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ parse_cdio_uri(const char *src)
|
|||
}
|
||||
|
||||
static AllocatedPath
|
||||
cdio_detect_device(void)
|
||||
cdio_detect_device()
|
||||
{
|
||||
char **devices = cdio_get_devices_with_cap(nullptr, CDIO_FS_AUDIO,
|
||||
false);
|
||||
|
|
|
@ -39,7 +39,7 @@ void print_supported_uri_schemes_to_fp(FILE *fp)
|
|||
protocols.emplace(uri);
|
||||
});
|
||||
|
||||
for (auto protocol : protocols) {
|
||||
for (const auto& protocol : protocols) {
|
||||
fprintf(fp, " %s", protocol.c_str());
|
||||
}
|
||||
fprintf(fp,"\n");
|
||||
|
@ -54,7 +54,7 @@ print_supported_uri_schemes(Response &r)
|
|||
protocols.emplace(uri);
|
||||
});
|
||||
|
||||
for (auto protocol : protocols) {
|
||||
for (const auto& protocol : protocols) {
|
||||
r.Format("handler: %s\n", protocol.c_str());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,8 +84,8 @@ NeighborGlue::Open()
|
|||
void
|
||||
NeighborGlue::Close() noexcept
|
||||
{
|
||||
for (auto i = explorers.begin(), end = explorers.end(); i != end; ++i)
|
||||
i->explorer->Close();
|
||||
for (auto & explorer : explorers)
|
||||
explorer.explorer->Close();
|
||||
}
|
||||
|
||||
NeighborGlue::List
|
||||
|
|
|
@ -80,7 +80,7 @@ audio_output_state_read(const char *line, MultipleOutputs &outputs)
|
|||
}
|
||||
|
||||
unsigned
|
||||
audio_output_state_get_version(void)
|
||||
audio_output_state_get_version()
|
||||
{
|
||||
return audio_output_state_version;
|
||||
}
|
||||
|
|
|
@ -419,7 +419,7 @@ JackOutput::Connect()
|
|||
}
|
||||
|
||||
static bool
|
||||
mpd_jack_test_default_device(void)
|
||||
mpd_jack_test_default_device()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -872,7 +872,7 @@ try {
|
|||
}
|
||||
|
||||
static bool
|
||||
pulse_output_test_default_device(void)
|
||||
pulse_output_test_default_device()
|
||||
{
|
||||
return PulseOutput::TestDefaultDevice();
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ mixramp_interpolate(const char *ramp_list, float required_db) noexcept
|
|||
* between the dB and seconds of a pair.
|
||||
* The dB values must be monotonically increasing for this to work. */
|
||||
|
||||
while (1) {
|
||||
while (true) {
|
||||
/* Parse the dB value. */
|
||||
char *endptr;
|
||||
const float db = ParseFloat(ramp_list, &endptr);
|
||||
|
|
|
@ -1155,7 +1155,7 @@ try {
|
|||
|
||||
std::unique_lock<Mutex> lock(mutex);
|
||||
|
||||
while (1) {
|
||||
while (true) {
|
||||
switch (command) {
|
||||
case PlayerCommand::SEEK:
|
||||
case PlayerCommand::QUEUE:
|
||||
|
|
|
@ -177,11 +177,11 @@ SoundCloudJsonData::EndMap() noexcept
|
|||
{
|
||||
if (got_url > 1) {
|
||||
got_url--;
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (got_url == 0)
|
||||
return 1;
|
||||
return true;
|
||||
|
||||
/* got_url == 1, track finished, make it into a song */
|
||||
got_url = 0;
|
||||
|
|
|
@ -139,7 +139,7 @@ storage_state_get_hash(const Instance &instance)
|
|||
|
||||
boost::crc_32_type result;
|
||||
|
||||
for (auto mount: mounts) {
|
||||
for (const auto& mount : mounts) {
|
||||
result.process_bytes(mount.c_str(), mount.length());
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ static bool had_group = false;
|
|||
static int detach_fd = -1;
|
||||
|
||||
void
|
||||
daemonize_kill(void)
|
||||
daemonize_kill()
|
||||
{
|
||||
if (pidfile.IsNull())
|
||||
throw std::runtime_error("no pid_file specified in the config file");
|
||||
|
@ -85,14 +85,14 @@ daemonize_kill(void)
|
|||
}
|
||||
|
||||
void
|
||||
daemonize_close_stdin(void)
|
||||
daemonize_close_stdin()
|
||||
{
|
||||
close(STDIN_FILENO);
|
||||
open("/dev/null", O_RDONLY);
|
||||
}
|
||||
|
||||
void
|
||||
daemonize_set_user(void)
|
||||
daemonize_set_user()
|
||||
{
|
||||
if (user_name == nullptr)
|
||||
return;
|
||||
|
@ -245,7 +245,7 @@ daemonize_init(const char *user, const char *group, AllocatedPath &&_pidfile)
|
|||
}
|
||||
|
||||
void
|
||||
daemonize_finish(void)
|
||||
daemonize_finish()
|
||||
{
|
||||
if (!pidfile.IsNull()) {
|
||||
unlink(pidfile.c_str());
|
||||
|
|
Loading…
Reference in New Issue