/* Find corresponding image file. */
int step = 1;
for (std::size_t j = i + 1; j < dir.size(); j += step) {
util::fs::File const & img_file = dir[j];
/* Since the files are sorted we can break - no more files with the same prefix exist. */
if (util::string::left(img_file.name, prefix.size()) != prefix) {
if (step == 1) {
j = i;
step = -1;
continue;
} else {
break;
}
}
If i == dir.size()-1 then control flow will not enter to the loop and image will be lost.
If
i == dir.size()-1
then control flow will not enter to the loop and image will be lost.