QIconLoader: don't re-evaluate container.size() all the time

Experience shows that the compiler does not recognize the
size() call as a constant expression, so help it along.

Change-Id: I60cd1754f8be123c62e3b47f6f721f42a69fe3c5
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
bb10
Marc Mutz 2014-08-22 20:55:24 +02:00
parent 8f0f7acb67
commit 5335a71535
1 changed files with 3 additions and 1 deletions

View File

@ -564,9 +564,11 @@ void QIconLoaderEngine::virtual_hook(int id, void *data)
QIconEngine::AvailableSizesArgument &arg
= *reinterpret_cast<QIconEngine::AvailableSizesArgument*>(data);
arg.sizes.clear();
const int N = m_entries.size();
arg.sizes.reserve(N);
// Gets all sizes from the DirectoryInfo entries
for (int i = 0 ; i < m_entries.size() ; ++i) {
for (int i = 0; i < N; ++i) {
int size = m_entries.at(i)->dir.size;
arg.sizes.append(QSize(size, size));
}