From: scantor Date: Sun, 29 Jan 2012 02:28:09 +0000 (+0000) Subject: Fix logo matching algorithm X-Git-Tag: 2.5.0~192 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=1f4f45eaa61787ff74150a2a49947bb40dd78eed;p=shibboleth%2Fsp.git Fix logo matching algorithm git-svn-id: https://svn.shibboleth.net/cpp-sp/branches/REL_2@3565 cb58f699-b61c-0410-a6fe-9272a202ed29 --- diff --git a/shibsp/attribute/resolver/impl/MetadataAttributeExtractor.cpp b/shibsp/attribute/resolver/impl/MetadataAttributeExtractor.cpp index ceccdb0..0244d17 100644 --- a/shibsp/attribute/resolver/impl/MetadataAttributeExtractor.cpp +++ b/shibsp/attribute/resolver/impl/MetadataAttributeExtractor.cpp @@ -321,18 +321,15 @@ void MetadataExtractor::doLogo( dim = (*i)->getWidth(); sizediff += abs(w - dim.second); } - if (sizediff > 0) { - if (sizediff < bestdiff) - match = *i; - } - else { + if (sizediff < bestdiff) { match = *i; + bestdiff = sizediff; } } - if (match && h == 0 && w == 0) + if (match && bestdiff == 0) break; } - if (match && h == 0 && w == 0) + if (match && bestdiff == 0) break; } while (request->continueLangMatching()); } @@ -347,18 +344,17 @@ void MetadataExtractor::doLogo( dim = (*i)->getWidth(); sizediff += abs(w - dim.second); } - if (sizediff > 0) { - if (sizediff < bestdiff) - match = *i; - } - else { + if (sizediff < bestdiff) { match = *i; + bestdiff = sizediff; } + if (match && bestdiff == 0) + break; } } - else { + + if (!match) match = logos.front(); - } if (!match->getDOM()) { match->marshall();