Skip to content
Snippets Groups Projects
Commit cf877f18 authored by Andreas Traczyk's avatar Andreas Traczyk Committed by Sébastien Blin
Browse files

newcodecmodel: fix priority change when compiled with clang


- clang++ std::swap works with pre-inc/dec and g++ with post so
  we use std::iter_swap and std::advance wrappers which produce
  the same results on both compilers

Change-Id: I12a2c1f3854126096d3f4ba780c4b619c5497493
Reviewed-by: default avatarSebastien Blin <sebastien.blin@savoirfairelinux.com>
parent 8fe06620
No related branches found
No related tags found
No related merge requests found
......@@ -92,7 +92,7 @@ NewCodecModel::increasePriority(const unsigned int& codecId, bool isVideo)
}
while (it != codecs.end()) {
if (it->id == codecId) {
std::swap(*it, *it--);
std::iter_swap(it, std::prev(it));
break;
}
it++;
......@@ -115,7 +115,7 @@ NewCodecModel::decreasePriority(const unsigned int& codecId, bool isVideo)
}
while (it != codecs.end()) {
if (it->id == codecId) {
std::swap(*it, *it++);
std::iter_swap(it, std::next(it));
break;
}
it++;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment