Updated following code review.

v0.27.3
clanmills 6 years ago
parent 742cd5885b
commit d8a513b7df

@ -259,7 +259,7 @@ namespace Exiv2 {
struct { struct {
std::string name ; std::string name ;
Protocol prot ; Protocol prot ;
bool url ; // path.size() > name.size() bool isUrl; // path.size() > name.size()
} prots[] = } prots[] =
{ { "http://" ,pHttp , true } { { "http://" ,pHttp , true }
, { "https://" ,pHttps , true } , { "https://" ,pHttps , true }
@ -273,7 +273,7 @@ namespace Exiv2 {
for ( size_t i = 0 ; result == pFile && i < sizeof(prots)/sizeof(prots[0]) ; i ++ ) for ( size_t i = 0 ; result == pFile && i < sizeof(prots)/sizeof(prots[0]) ; i ++ )
if ( path.find(prots[i].name) == 0 ) if ( path.find(prots[i].name) == 0 )
// URL's require data. Stdin == "-" and no further data // URL's require data. Stdin == "-" and no further data
if ( prots[i].url ? path.size() > prots[i].name.size() : path.size() == prots[i].name.size() ) if ( prots[i].isUrl ? path.size() > prots[i].name.size() : path.size() == prots[i].name.size() )
result = prots[i].prot; result = prots[i].prot;
return result; return result;
@ -284,7 +284,7 @@ namespace Exiv2 {
struct { struct {
std::wstring name ; std::wstring name ;
Protocol prot ; Protocol prot ;
bool url ; // path.size() > name.size() bool isUrl; // path.size() > name.size()
} prots[] = } prots[] =
{ { L"http://" ,pHttp , true } { { L"http://" ,pHttp , true }
, { L"https://" ,pHttps , true } , { L"https://" ,pHttps , true }
@ -298,7 +298,7 @@ namespace Exiv2 {
for ( size_t i = 0 ; result == pFile && i < sizeof(prots)/sizeof(prots[0]) ; i ++ ) for ( size_t i = 0 ; result == pFile && i < sizeof(prots)/sizeof(prots[0]) ; i ++ )
if ( path.find(prots[i].name) == 0 ) if ( path.find(prots[i].name) == 0 )
// URL's require data. Stdin == "-" and no further data // URL's require data. Stdin == "-" and no further data
if ( prots[i].url ? path.size() > prots[i].name.size() : path.size() == prots[i].name.size() ) if ( prots[i].isUrl ? path.size() > prots[i].name.size() : path.size() == prots[i].name.size() )
result = prots[i].prot; result = prots[i].prot;
return result; return result;

Loading…
Cancel
Save