[cpp-sp COMMIT] /branches/REL_2/shibsp/attribute/resolver/impl/MetadataAttributeExtractor.cpp

noreply at shibboleth.net noreply at shibboleth.net
Sun Jan 29 02:28:10 GMT 2012


Author: scantor
Date: Sun Jan 29 02:28:09 2012
New Revision: 3565

URL: http://svn.shibboleth.net/view/cpp-sp?rev=3565&view=rev
Log:
Fix logo matching algorithm

Modified:
    branches/REL_2/shibsp/attribute/resolver/impl/MetadataAttributeExtractor.cpp

Modified: branches/REL_2/shibsp/attribute/resolver/impl/MetadataAttributeExtractor.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/attribute/resolver/impl/MetadataAttributeExtractor.cpp?rev=3565&r1=3564&r2=3565&view=diff
==============================================================================
--- branches/REL_2/shibsp/attribute/resolver/impl/MetadataAttributeExtractor.cpp (original)
+++ branches/REL_2/shibsp/attribute/resolver/impl/MetadataAttributeExtractor.cpp Sun Jan 29 02:28:09 2012
@@ -321,18 +321,15 @@
                         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 @@
                 dim = (*i)->getWidth();
                 sizediff += abs(w - dim.second);
             }
-            if (sizediff > 0) {
-                if (sizediff < bestdiff)
-                    match = *i;
-            }
-            else {
+            if (sizediff < bestdiff) {
                 match = *i;
-            }
-        }
-    }
-    else {
+                bestdiff = sizediff;
+            }
+            if (match && bestdiff == 0)
+                break;
+        }
+    }
+
+    if (!match)
         match = logos.front();
-    }
 
     if (!match->getDOM()) {
         match->marshall();



More information about the commits mailing list