Merge branch 'v0.21.x'
This commit is contained in:
@@ -25,6 +25,8 @@
|
||||
#include "io/FileDescriptor.hxx"
|
||||
#include "util/RuntimeError.hxx"
|
||||
|
||||
#include <cinttypes> // for PRIu64 (PRIoffset)
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
@@ -97,6 +99,11 @@ FileInputStream::Read(std::unique_lock<Mutex> &,
|
||||
nbytes = reader.Read(ptr, read_size);
|
||||
}
|
||||
|
||||
if (nbytes == 0 && !IsEOF())
|
||||
throw FormatRuntimeError("Unexpected end of file %s"
|
||||
" at %" PRIoffset " of %" PRIoffset,
|
||||
GetURI(), GetOffset(), GetSize());
|
||||
|
||||
offset += nbytes;
|
||||
return nbytes;
|
||||
}
|
||||
|
@@ -430,6 +430,8 @@ playlist::SetSongIdRange(PlayerControl &pc, unsigned id,
|
||||
if (position < 0)
|
||||
throw PlaylistError::NoSuchSong();
|
||||
|
||||
bool was_queued = false;
|
||||
|
||||
if (playing) {
|
||||
if (position == current)
|
||||
throw PlaylistError(PlaylistResult::DENIED,
|
||||
@@ -441,6 +443,10 @@ playlist::SetSongIdRange(PlayerControl &pc, unsigned id,
|
||||
already; cancel that */
|
||||
pc.LockCancel();
|
||||
queued = -1;
|
||||
|
||||
/* schedule a call to UpdateQueuedSong() to
|
||||
re-queue the song with its new range */
|
||||
was_queued = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,7 +469,8 @@ playlist::SetSongIdRange(PlayerControl &pc, unsigned id,
|
||||
song.SetEndTime(end);
|
||||
|
||||
/* announce the change to all interested subsystems */
|
||||
UpdateQueuedSong(pc, nullptr);
|
||||
if (was_queued)
|
||||
UpdateQueuedSong(pc, nullptr);
|
||||
queue.ModifyAtPosition(position);
|
||||
OnModified();
|
||||
}
|
||||
|
@@ -70,7 +70,12 @@ gcc_pure
|
||||
static const char *
|
||||
SkipUriScheme(const char *uri) noexcept
|
||||
{
|
||||
const char *const schemes[] = { "http://", "https://", "ftp://" };
|
||||
static const char *const schemes[] = {
|
||||
"http://", "https://",
|
||||
"ftp://",
|
||||
"smb://",
|
||||
};
|
||||
|
||||
for (auto scheme : schemes) {
|
||||
auto result = StringAfterPrefixCaseASCII(uri, scheme);
|
||||
if (result != nullptr)
|
||||
|
Reference in New Issue
Block a user