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

View File

@ -47,11 +47,11 @@ EdgeBasedGraphFactory::EdgeBasedGraphFactory(
std::vector<NodeID> & barrier_node_list,
std::vector<NodeID> & traffic_light_node_list,
std::vector<TurnRestriction> & input_restrictions_list,
std::vector<NodeInfo> & m_node_info_list,
std::vector<NodeInfo> & node_info_list,
SpeedProfileProperties speed_profile
) : speed_profile(speed_profile),
m_turn_restrictions_count(0),
m_node_info_list(m_node_info_list)
m_node_info_list(node_info_list)
{
BOOST_FOREACH(const TurnRestriction & restriction, input_restrictions_list) {
std::pair<NodeID, NodeID> restriction_source =

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 )
{

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);

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) {

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 );

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));

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),

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()) {

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);
}

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

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),

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),

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;

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;

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 );
}

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);

View File

@ -25,10 +25,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "ExtractorCallbacks.h"
#include "ExtractionContainers.h"
#include "ExtractionHelperFunctions.h"
#include "ExtractionWay.h"
#include "ExtractorCallbacks.h"
#include "../DataStructures/Restriction.h"
#include "../Util/SimpleLogger.h"

View File

@ -35,7 +35,7 @@ struct lua_State;
class ScriptingEnvironment {
public:
ScriptingEnvironment();
ScriptingEnvironment(const char * fileName);
explicit ScriptingEnvironment(const char * fileName);
virtual ~ScriptingEnvironment();
lua_State * getLuaStateForThreadID(const int);

View File

@ -28,10 +28,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef BASEPLUGIN_H_
#define BASEPLUGIN_H_
#include "../Util/StringUtil.h"
#include <osrm/Coordinate.h>
#include <osrm/Reply.h>
#include <osrm/RouteParameters.h>
#include <boost/foreach.hpp>
#include <string>
#include <vector>

View File

@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
template<class DataFacadeT>
class NearestPlugin : public BasePlugin {
public:
NearestPlugin(DataFacadeT * facade )
explicit NearestPlugin(DataFacadeT * facade )
:
facade(facade),
descriptor_string("nearest")

View File

@ -33,7 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
template<class DataFacadeT>
class TimestampPlugin : public BasePlugin {
public:
TimestampPlugin(const DataFacadeT * facade)
explicit TimestampPlugin(const DataFacadeT * facade)
: facade(facade), descriptor_string("timestamp")
{ }
const std::string & GetDescriptor() const { return descriptor_string; }

View File

@ -53,7 +53,7 @@ private:
SearchEngine<DataFacadeT> * search_engine_ptr;
public:
ViaRoutePlugin(DataFacadeT * facade)
explicit ViaRoutePlugin(DataFacadeT * facade)
:
descriptor_string("viaroute"),
facade(facade)

View File

@ -207,7 +207,7 @@ public:
delete m_static_rtree;
}
InternalDataFacade( const ServerPaths & server_paths ) {
explicit InternalDataFacade( const ServerPaths & server_paths ) {
//generate paths of data files
if( server_paths.find("hsgrdata") == server_paths.end() ) {
throw OSRMException("no hsgr file given in ini file");

View File

@ -33,6 +33,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <boost/asio.hpp>
#include <boost/bind.hpp>
#include <boost/make_shared.hpp>
#include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
@ -72,7 +73,7 @@ public:
void Run() {
std::vector<boost::shared_ptr<boost::thread> > threads;
for (unsigned i = 0; i < threadPoolSize; ++i) {
boost::shared_ptr<boost::thread> thread(new boost::thread(boost::bind(&boost::asio::io_service::run, &ioService)));
boost::shared_ptr<boost::thread> thread = boost::make_shared<boost::thread>(boost::bind(&boost::asio::io_service::run, &ioService));
threads.push_back(thread);
}
for (unsigned i = 0; i < threads.size(); ++i)