From 881d91f86b25c501e5cf5140da5b5602ddb8227f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 25 Jan 2020 20:03:18 +0100 Subject: lib/xiph/OggFind: add parameter "synced" --- src/lib/xiph/OggFind.cxx | 5 +++-- src/lib/xiph/OggFind.hxx | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/xiph/OggFind.cxx b/src/lib/xiph/OggFind.cxx index e31bd9514..583d5fad0 100644 --- a/src/lib/xiph/OggFind.cxx +++ b/src/lib/xiph/OggFind.cxx @@ -57,13 +57,14 @@ OggSeekPageAtOffset(OggSyncState &oy, ogg_stream_state &os, InputStream &is, bool OggSeekFindEOS(OggSyncState &oy, ogg_stream_state &os, ogg_packet &packet, - InputStream &is) + InputStream &is, bool synced) { if (!is.KnownSize()) return false; if (is.GetRest() < 65536) - return OggFindEOS(oy, os, packet); + return (synced || oy.ExpectPageSeekIn(os)) && + OggFindEOS(oy, os, packet); if (!is.CheapSeeking()) return false; diff --git a/src/lib/xiph/OggFind.hxx b/src/lib/xiph/OggFind.hxx index 051237900..a8ddf60f3 100644 --- a/src/lib/xiph/OggFind.hxx +++ b/src/lib/xiph/OggFind.hxx @@ -47,10 +47,13 @@ OggSeekPageAtOffset(OggSyncState &oy, ogg_stream_state &os, InputStream &is, * Try to find the end-of-stream (EOS) packet. Seek to the end of the * file if necessary. * + * @param synced is the #OggSyncState currently synced? If not, then + * we need to use ogg_sync_pageseek() instead of ogg_sync_pageout(), + * which is more expensive * @return true if the EOS packet was found */ bool OggSeekFindEOS(OggSyncState &oy, ogg_stream_state &os, ogg_packet &packet, - InputStream &is); + InputStream &is, bool synced=true); #endif -- cgit v1.2.3 From 7e41c4de58412e0a1b915f0598da66fe1e29988e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 2 Feb 2020 14:10:15 -0800 Subject: [clang-tidy] use == instead of compare for strings Found with readability-string-compare Signed-off-by: Rosen Penev --- src/lib/upnp/ContentDirectoryService.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/upnp/ContentDirectoryService.cxx b/src/lib/upnp/ContentDirectoryService.cxx index f43a304a9..539da0fa5 100644 --- a/src/lib/upnp/ContentDirectoryService.cxx +++ b/src/lib/upnp/ContentDirectoryService.cxx @@ -37,7 +37,7 @@ ContentDirectoryService::ContentDirectoryService(const UPnPDevice &device, m_modelName(device.modelName), m_rdreqcnt(200) { - if (!m_modelName.compare("MediaTomb")) { + if (m_modelName == "MediaTomb") { // Readdir by 200 entries is good for most, but MediaTomb likes // them really big. Actually 1000 is better but I don't dare m_rdreqcnt = 500; -- cgit v1.2.3 From 8e4cb3217e32b517c8255ce93299a7a48ee7f03f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 4 Feb 2020 21:38:06 +0100 Subject: lib/xiph/OggSyncState: fix offset counter by using the actual page size --- src/lib/xiph/OggSyncState.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/xiph/OggSyncState.cxx b/src/lib/xiph/OggSyncState.cxx index f8d7aa67c..adbeb4461 100644 --- a/src/lib/xiph/OggSyncState.cxx +++ b/src/lib/xiph/OggSyncState.cxx @@ -43,7 +43,7 @@ OggSyncState::ExpectPage(ogg_page &page) if (r != 0) { if (r > 0) { start_offset = offset; - offset += r; + offset += page.header_len + page.body_len; } return r > 0; } -- cgit v1.2.3 From a3963de668447cf296db5d43421079ea9a3d7400 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 2 Feb 2020 14:31:45 -0800 Subject: [clang-tidy] change integer prefixes to uppercase Found with readability-uppercase-literal-suffix Signed-off-by: Rosen Penev --- src/lib/curl/Request.cxx | 2 +- src/lib/icu/CaseFold.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/curl/Request.cxx b/src/lib/curl/Request.cxx index 9126ee5c7..864a92d3f 100644 --- a/src/lib/curl/Request.cxx +++ b/src/lib/curl/Request.cxx @@ -56,7 +56,7 @@ CurlRequest::CurlRequest(CurlGlobal &_global, easy.SetUserAgent("Music Player Daemon " VERSION); easy.SetHeaderFunction(_HeaderFunction, this); easy.SetWriteFunction(WriteFunction, this); - easy.SetOption(CURLOPT_NETRC, 1l); + easy.SetOption(CURLOPT_NETRC, 1L); easy.SetErrorBuffer(error_buffer); easy.SetNoProgress(); easy.SetNoSignal(); diff --git a/src/lib/icu/CaseFold.cxx b/src/lib/icu/CaseFold.cxx index 120f87893..74e378e92 100644 --- a/src/lib/icu/CaseFold.cxx +++ b/src/lib/icu/CaseFold.cxx @@ -58,7 +58,7 @@ try { if (u.IsNull()) return AllocatedString<>::Duplicate(src); - AllocatedArray folded(u.size() * 2u); + AllocatedArray folded(u.size() * 2U); UErrorCode error_code = U_ZERO_ERROR; size_t folded_length = u_strFoldCase(folded.begin(), folded.size(), -- cgit v1.2.3 From a4eed3e3302bde1fcb20a740455d400e7436ad80 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 2 Feb 2020 16:06:22 -0800 Subject: [clang-tidy] use forward instead of move Found with bugprone-move-forwarding-reference Signed-off-by: Rosen Penev --- src/lib/dbus/UDisks2.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib') diff --git a/src/lib/dbus/UDisks2.cxx b/src/lib/dbus/UDisks2.cxx index d07e5aabe..0b1fefd94 100644 --- a/src/lib/dbus/UDisks2.cxx +++ b/src/lib/dbus/UDisks2.cxx @@ -167,7 +167,7 @@ ParseObjects(ODBus::ReadMessageIter &&i, ForEachInterface(std::move(i), [&callback](const char *path, auto &&j){ Object o(path); - ParseObject(o, std::move(j)); + ParseObject(o, std::forward(j)); if (o.IsValid()) callback(std::move(o)); }); -- cgit v1.2.3