clang-tidy: range for loop conversions

Found with modernize-loop-convert

Ran through git clang-format.

Also removed several questionable loops and replaced with simpler
algorithms.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev
2021-04-26 17:01:09 -07:00
committed by Luis Díaz Más
parent 5a4c3cd057
commit 4ceb325c8f
35 changed files with 406 additions and 438 deletions
+16 -8
View File
@@ -233,11 +233,15 @@ namespace Exiv2 {
, { "data://" ,pDataUri , true }
, { "-" ,pStdin , false }
};
for ( size_t i = 0 ; result == pFile && i < sizeof(prots)/sizeof(prots[0]) ; i ++ )
if ( path.rfind(prots[i].name, 0) == 0 )
for (auto&& prot : prots) {
if (result != pFile)
break;
if (path.rfind(prot.name, 0) == 0)
// URL's require data. Stdin == "-" and no further data
if ( prots[i].isUrl ? path.size() > prots[i].name.size() : path.size() == prots[i].name.size() )
result = prots[i].prot;
if (prot.isUrl ? path.size() > prot.name.size() : path.size() == prot.name.size())
result = prot.prot;
}
return result;
} // fileProtocol
@@ -257,11 +261,15 @@ namespace Exiv2 {
, { L"data://" ,pDataUri , true }
, { L"-" ,pStdin , false }
};
for ( size_t i = 0 ; result == pFile && i < sizeof(prots)/sizeof(prots[0]) ; i ++ )
if ( path.rfind(prots[i].name, 0) == 0 )
for (auto&& prot : prots) {
if (result != pFile)
break;
if (path.rfind(prot.name, 0) == 0)
// URL's require data. Stdin == "-" and no further data
if ( prots[i].isUrl ? path.size() > prots[i].name.size() : path.size() == prots[i].name.size() )
result = prots[i].prot;
if (prot.isUrl ? path.size() > prot.name.size() : path.size() == prot.name.size())
result = prot.prot;
}
return result;
} // fileProtocol