[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdepim/kleopatra/models
From:       Dirk Mueller <mueller () kde ! org>
Date:       2009-03-02 15:41:35
Message-ID: 1236008495.922114.3977.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 934240 by mueller:

fix build with boost 1.38. namespaces are a tricky
business


 M  +24 -28    keylistmodel.cpp  


--- trunk/KDE/kdepim/kleopatra/models/keylistmodel.cpp #934239:934240
@@ -142,7 +142,7 @@
 static inline uint qHash( const char * data ) {
     if ( !data )
         return 1; // something != 0
-    return hash( reinterpret_cast<const uchar*>( data ) );
+    return ::hash( reinterpret_cast<const uchar*>( data ) );
 }
 
 class AbstractKeyListModel::Private {
@@ -682,38 +682,34 @@
 
 }
 
-namespace {
+// sorts 'keys' such that parent always come before their children:
+static std::vector<Key> topological_sort( const std::vector<Key> & keys ) {
 
-    // sorts 'keys' such that parent always come before their children:
-    std::vector<Key> topological_sort( const std::vector<Key> & keys ) {
+    adjacency_list<> graph( keys.size() );
 
-        adjacency_list<> graph( keys.size() );
+    // add edges from children to parents:
+    for ( unsigned int i = 0, end = keys.size() ; i != end ; ++i ) {
+        const char * const issuer_fpr = cleanChainID( keys[i] );
+        if ( !issuer_fpr || !*issuer_fpr )
+            continue;
+        const std::vector<Key>::const_iterator it
+            = qBinaryFind( keys.begin(), keys.end(), issuer_fpr, \
_detail::ByFingerprint<std::less>() ); +        if ( it == keys.end() )
+            continue;
+        add_edge( i, std::distance( keys.begin(), it ), graph );
+    }
 
-        // add edges from children to parents:
-        for ( unsigned int i = 0, end = keys.size() ; i != end ; ++i ) {
-            const char * const issuer_fpr = cleanChainID( keys[i] );
-            if ( !issuer_fpr || !*issuer_fpr )
-                continue;
-            const std::vector<Key>::const_iterator it
-                = qBinaryFind( keys.begin(), keys.end(), issuer_fpr, \
                _detail::ByFingerprint<std::less>() );
-            if ( it == keys.end() )
-                continue;
-            add_edge( i, std::distance( keys.begin(), it ), graph );
-        }
+    std::vector<int> order;
+    order.reserve( keys.size() );
+    topological_sort( graph, std::back_inserter( order ) );
 
-        std::vector<int> order;
-        order.reserve( keys.size() );
-        topological_sort( graph, std::back_inserter( order ) );
+    assert( order.size() == keys.size() );
 
-        assert( order.size() == keys.size() );
-
-        std::vector<Key> result;
-        result.reserve( keys.size() );
-        Q_FOREACH( int i, order )
-	    result.push_back( keys[i] );
-        return result;
-    }
-
+    std::vector<Key> result;
+    result.reserve( keys.size() );
+    Q_FOREACH( int i, order )
+        result.push_back( keys[i] );
+    return result;
 }
 
 QList<QModelIndex> HierarchicalKeyListModel::doAddKeys( const std::vector<Key> & \
keys ) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic