manual range loop conversions (#1126)

* manual range loop conversions

Signed-off-by: Rosen Penev <rosenp@gmail.com>

* Restore const containers where non const temporaries are iterated

* Use std::as_const() instead of const container copies where possible

---------

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Co-authored-by: Urs Fleisch <ufleisch@users.sourceforge.net>
This commit is contained in:
Rosen Penev
2023-09-06 11:58:13 -07:00
committed by GitHub
parent 303b55fb97
commit 524b588a1e
37 changed files with 464 additions and 481 deletions

View File

@@ -30,8 +30,9 @@
#include "modfileprivate.h"
#include "tpropertymap.h"
#include <cstring>
#include <algorithm>
#include <cstring>
#include <utility>
using namespace TagLib;
using namespace XM;
@@ -319,9 +320,8 @@ public:
unsigned int size() const override
{
unsigned int size = 0;
for(auto i = m_readers.begin();
i != m_readers.end(); ++ i) {
size += (*i)->size();
for(const auto &reader : m_readers) {
size += reader->size();
}
return size;
}
@@ -329,9 +329,10 @@ public:
unsigned int read(TagLib::File &file, unsigned int limit) override
{
unsigned int sumcount = 0;
for(auto i = m_readers.cbegin();
limit > 0 && i != m_readers.cend(); ++ i) {
unsigned int count = (*i)->read(file, limit);
for(const auto &reader : std::as_const(m_readers)) {
if(limit == 0)
break;
unsigned int count = reader->read(file, limit);
limit -= count;
sumcount += count;
}