several lints fixed that were detected by facebook's flint

This commit is contained in:
Dennis Luxen
2014-04-16 16:59:40 +02:00
parent da81e4839a
commit 64720c2d2e
24 changed files with 39 additions and 34 deletions
+4 -4
View File
@@ -43,7 +43,7 @@ template< typename NodeID, typename Key >
class ArrayStorage {
public:
ArrayStorage( size_t size ) : positions( new Key[size] ) {
explicit ArrayStorage( size_t size ) : positions( new Key[size] ) {
memset(positions, 0, size*sizeof(Key));
}
@@ -65,7 +65,7 @@ template< typename NodeID, typename Key >
class MapStorage {
public:
MapStorage( size_t ) {}
explicit MapStorage( size_t ) {}
Key &operator[]( NodeID node ) {
return nodes[node];
@@ -87,7 +87,7 @@ class UnorderedMapStorage {
typedef typename UnorderedMapType::const_iterator UnorderedMapConstIterator;
public:
UnorderedMapStorage( size_t ) {
explicit UnorderedMapStorage( size_t ) {
//hash table gets 1000 Buckets
nodes.rehash(1000);
}
@@ -119,7 +119,7 @@ public:
typedef Weight WeightType;
typedef Data DataType;
BinaryHeap( size_t maxID )
explicit BinaryHeap( size_t maxID )
:
nodeIndex( maxID )
{
+1 -1
View File
@@ -40,7 +40,7 @@ template<typename Data>
class ConcurrentQueue {
public:
ConcurrentQueue(const size_t max_size) : m_internal_queue(max_size) { }
explicit ConcurrentQueue(const size_t max_size) : m_internal_queue(max_size) { }
inline void push(const Data & data) {
boost::mutex::scoped_lock lock(m_mutex);
+2 -2
View File
@@ -96,10 +96,10 @@ public:
DeallocatingVectorIterator() {}
template<typename T2>
DeallocatingVectorIterator(const DeallocatingVectorIterator<T2> & r) : mState(r.mState) {}
explicit DeallocatingVectorIterator(const DeallocatingVectorIterator<T2> & r) : mState(r.mState) {}
DeallocatingVectorIterator(std::size_t idx, std::vector<ElementT *> & input_list) : mState(idx, input_list) {}
DeallocatingVectorIterator(const DeallocatingVectorIteratorState & r) : mState(r) {}
explicit DeallocatingVectorIterator(const DeallocatingVectorIteratorState & r) : mState(r) {}
template<typename T2>
DeallocatingVectorIterator& operator=(const DeallocatingVectorIterator<T2> &r) {
+1 -1
View File
@@ -57,7 +57,7 @@ class DynamicGraph {
};
//Constructs an empty graph with a given number of nodes.
DynamicGraph( int32_t nodes ) : m_numNodes(nodes), m_numEdges(0) {
explicit DynamicGraph( int32_t nodes ) : m_numNodes(nodes), m_numEdges(0) {
m_nodes.reserve( m_numNodes );
m_nodes.resize( m_numNodes );
+1 -1
View File
@@ -40,7 +40,7 @@ public:
HashTable() : super() { }
HashTable(const unsigned size) : super(size) { }
explicit HashTable(const unsigned size) : super(size) { }
inline void Add( KeyT const & key, ValueT const & value) {
super::emplace(std::make_pair(key, value));
+1 -1
View File
@@ -129,7 +129,7 @@ public:
}
template<class EdgeT>
EdgeBasedEdge(const EdgeT & myEdge ) :
explicit EdgeBasedEdge(const EdgeT & myEdge ) :
m_source(myEdge.source),
m_target(myEdge.target),
m_edgeID(myEdge.data.via),
+1 -1
View File
@@ -43,7 +43,7 @@ private:
std::list<CacheEntry> itemsInCache;
boost::unordered_map<KeyT, typename std::list<CacheEntry>::iterator > positionMap;
public:
LRUCache(unsigned c) : capacity(c) {}
explicit LRUCache(unsigned c) : capacity(c) {}
bool Holds(KeyT key) {
if(positionMap.find(key) != positionMap.end()) {
+1 -1
View File
@@ -38,7 +38,7 @@ public:
* @param maxValue the value that corresponds to 100%
* @param step the progress is shown in steps of 'step' percent
*/
Percent(unsigned maxValue, unsigned step = 5) {
explicit Percent(unsigned maxValue, unsigned step = 5) {
reinit(maxValue, step);
}
+3 -3
View File
@@ -25,8 +25,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _NODE_COORDS_H
#define _NODE_COORDS_H
#ifndef QUERY_NODE_H
#define QUERY_NODE_H
#include "../typedefs.h"
@@ -83,4 +83,4 @@ struct NodeInfo {
}
};
#endif //_NODE_COORDS_H
#endif //QUERY_NODE_H
+3 -4
View File
@@ -58,14 +58,13 @@ struct TurnRestriction {
bool unused7:1;
} flags;
TurnRestriction(NodeID viaNode) :
explicit TurnRestriction(NodeID viaNode) :
viaNode(viaNode),
fromNode(UINT_MAX),
toNode(UINT_MAX) {
}
TurnRestriction(const bool isOnly = false) :
explicit TurnRestriction(const bool isOnly = false) :
viaNode(UINT_MAX),
fromNode(UINT_MAX),
toNode(UINT_MAX) {
@@ -91,7 +90,7 @@ struct InputRestrictionContainer {
{
restriction.viaNode = vn;
}
InputRestrictionContainer(
explicit InputRestrictionContainer(
bool isOnly = false
) :
fromWay(UINT_MAX),
+1 -1
View File
@@ -54,7 +54,7 @@ public:
ShortestPathRouting<DataFacadeT> shortest_path;
AlternativeRouting <DataFacadeT> alternative_path;
SearchEngine( DataFacadeT * facade )
explicit SearchEngine( DataFacadeT * facade )
:
facade (facade),
shortest_path (facade, engine_working_data),
+1 -1
View File
@@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
struct _HeapData {
NodeID parent;
_HeapData( NodeID p ) : parent(p) { }
/* explicit */ _HeapData( NodeID p ) : parent(p) { }
};
// typedef StaticGraph<QueryEdge::EdgeData> QueryGraph;
+1 -1
View File
@@ -41,7 +41,7 @@ template<typename DataT>
class ShMemIterator : public std::iterator<std::input_iterator_tag, DataT> {
DataT * p;
public:
ShMemIterator(DataT * x) : p(x) {}
explicit ShMemIterator(DataT * x) : p(x) {}
ShMemIterator(const ShMemIterator & mit) : p(mit.p) {}
ShMemIterator& operator++() {
++p;
+2 -2
View File
@@ -99,7 +99,7 @@ public:
}
};
StaticKDTree( std::vector< InputPoint > * points ){
explicit StaticKDTree( std::vector< InputPoint > * points ){
BOOST_ASSERT( k > 0 );
BOOST_ASSERT ( points->size() > 0 );
size = points->size();
@@ -207,7 +207,7 @@ private:
};
class Less {
public:
Less( unsigned d ) {
explicit Less( unsigned d ) {
dimension = d;
BOOST_ASSERT( dimension < k );
}
+1 -1
View File
@@ -54,7 +54,7 @@ public:
}
};
XORFastHashStorage( size_t ) : positions(2<<16), currentTimestamp(0) { }
explicit XORFastHashStorage( size_t ) : positions(2<<16), currentTimestamp(0) { }
inline HashCell& operator[]( const NodeID node ) {
unsigned short position = fastHash(node);