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 c6902528b3
commit 5a0d693c93
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> & barrier_node_list,
std::vector<NodeID> & traffic_light_node_list, std::vector<NodeID> & traffic_light_node_list,
std::vector<TurnRestriction> & input_restrictions_list, std::vector<TurnRestriction> & input_restrictions_list,
std::vector<NodeInfo> & m_node_info_list, std::vector<NodeInfo> & node_info_list,
SpeedProfileProperties speed_profile SpeedProfileProperties speed_profile
) : speed_profile(speed_profile), ) : speed_profile(speed_profile),
m_turn_restrictions_count(0), 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) { BOOST_FOREACH(const TurnRestriction & restriction, input_restrictions_list) {
std::pair<NodeID, NodeID> restriction_source = std::pair<NodeID, NodeID> restriction_source =

View File

@ -43,7 +43,7 @@ template< typename NodeID, typename Key >
class ArrayStorage { class ArrayStorage {
public: public:
ArrayStorage( size_t size ) : positions( new Key[size] ) { explicit ArrayStorage( size_t size ) : positions( new Key[size] ) {
memset(positions, 0, size*sizeof(Key)); memset(positions, 0, size*sizeof(Key));
} }
@ -65,7 +65,7 @@ template< typename NodeID, typename Key >
class MapStorage { class MapStorage {
public: public:
MapStorage( size_t ) {} explicit MapStorage( size_t ) {}
Key &operator[]( NodeID node ) { Key &operator[]( NodeID node ) {
return nodes[node]; return nodes[node];
@ -87,7 +87,7 @@ class UnorderedMapStorage {
typedef typename UnorderedMapType::const_iterator UnorderedMapConstIterator; typedef typename UnorderedMapType::const_iterator UnorderedMapConstIterator;
public: public:
UnorderedMapStorage( size_t ) { explicit UnorderedMapStorage( size_t ) {
//hash table gets 1000 Buckets //hash table gets 1000 Buckets
nodes.rehash(1000); nodes.rehash(1000);
} }
@ -119,7 +119,7 @@ public:
typedef Weight WeightType; typedef Weight WeightType;
typedef Data DataType; typedef Data DataType;
BinaryHeap( size_t maxID ) explicit BinaryHeap( size_t maxID )
: :
nodeIndex( maxID ) nodeIndex( maxID )
{ {

View File

@ -40,7 +40,7 @@ template<typename Data>
class ConcurrentQueue { class ConcurrentQueue {
public: 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) { inline void push(const Data & data) {
boost::mutex::scoped_lock lock(m_mutex); boost::mutex::scoped_lock lock(m_mutex);

View File

@ -96,10 +96,10 @@ public:
DeallocatingVectorIterator() {} DeallocatingVectorIterator() {}
template<typename T2> 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(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> template<typename T2>
DeallocatingVectorIterator& operator=(const DeallocatingVectorIterator<T2> &r) { DeallocatingVectorIterator& operator=(const DeallocatingVectorIterator<T2> &r) {

View File

@ -57,7 +57,7 @@ class DynamicGraph {
}; };
//Constructs an empty graph with a given number of nodes. //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.reserve( m_numNodes );
m_nodes.resize( m_numNodes ); m_nodes.resize( m_numNodes );

View File

@ -40,7 +40,7 @@ public:
HashTable() : super() { } HashTable() : super() { }
HashTable(const unsigned size) : super(size) { } explicit HashTable(const unsigned size) : super(size) { }
inline void Add( KeyT const & key, ValueT const & value) { inline void Add( KeyT const & key, ValueT const & value) {
super::emplace(std::make_pair(key, value)); super::emplace(std::make_pair(key, value));

View File

@ -129,7 +129,7 @@ public:
} }
template<class EdgeT> template<class EdgeT>
EdgeBasedEdge(const EdgeT & myEdge ) : explicit EdgeBasedEdge(const EdgeT & myEdge ) :
m_source(myEdge.source), m_source(myEdge.source),
m_target(myEdge.target), m_target(myEdge.target),
m_edgeID(myEdge.data.via), m_edgeID(myEdge.data.via),

View File

@ -43,7 +43,7 @@ private:
std::list<CacheEntry> itemsInCache; std::list<CacheEntry> itemsInCache;
boost::unordered_map<KeyT, typename std::list<CacheEntry>::iterator > positionMap; boost::unordered_map<KeyT, typename std::list<CacheEntry>::iterator > positionMap;
public: public:
LRUCache(unsigned c) : capacity(c) {} explicit LRUCache(unsigned c) : capacity(c) {}
bool Holds(KeyT key) { bool Holds(KeyT key) {
if(positionMap.find(key) != positionMap.end()) { if(positionMap.find(key) != positionMap.end()) {

View File

@ -38,7 +38,7 @@ public:
* @param maxValue the value that corresponds to 100% * @param maxValue the value that corresponds to 100%
* @param step the progress is shown in steps of 'step' percent * @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); reinit(maxValue, step);
} }

View File

@ -25,8 +25,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef _NODE_COORDS_H #ifndef QUERY_NODE_H
#define _NODE_COORDS_H #define QUERY_NODE_H
#include "../typedefs.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; bool unused7:1;
} flags; } flags;
TurnRestriction(NodeID viaNode) : explicit TurnRestriction(NodeID viaNode) :
viaNode(viaNode), viaNode(viaNode),
fromNode(UINT_MAX), fromNode(UINT_MAX),
toNode(UINT_MAX) { toNode(UINT_MAX) {
} }
TurnRestriction(const bool isOnly = false) : explicit TurnRestriction(const bool isOnly = false) :
viaNode(UINT_MAX), viaNode(UINT_MAX),
fromNode(UINT_MAX), fromNode(UINT_MAX),
toNode(UINT_MAX) { toNode(UINT_MAX) {
@ -91,7 +90,7 @@ struct InputRestrictionContainer {
{ {
restriction.viaNode = vn; restriction.viaNode = vn;
} }
InputRestrictionContainer( explicit InputRestrictionContainer(
bool isOnly = false bool isOnly = false
) : ) :
fromWay(UINT_MAX), fromWay(UINT_MAX),

View File

@ -54,7 +54,7 @@ public:
ShortestPathRouting<DataFacadeT> shortest_path; ShortestPathRouting<DataFacadeT> shortest_path;
AlternativeRouting <DataFacadeT> alternative_path; AlternativeRouting <DataFacadeT> alternative_path;
SearchEngine( DataFacadeT * facade ) explicit SearchEngine( DataFacadeT * facade )
: :
facade (facade), facade (facade),
shortest_path (facade, engine_working_data), shortest_path (facade, engine_working_data),

View File

@ -41,7 +41,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
struct _HeapData { struct _HeapData {
NodeID parent; NodeID parent;
_HeapData( NodeID p ) : parent(p) { } /* explicit */ _HeapData( NodeID p ) : parent(p) { }
}; };
// typedef StaticGraph<QueryEdge::EdgeData> QueryGraph; // typedef StaticGraph<QueryEdge::EdgeData> QueryGraph;

View File

@ -41,7 +41,7 @@ template<typename DataT>
class ShMemIterator : public std::iterator<std::input_iterator_tag, DataT> { class ShMemIterator : public std::iterator<std::input_iterator_tag, DataT> {
DataT * p; DataT * p;
public: public:
ShMemIterator(DataT * x) : p(x) {} explicit ShMemIterator(DataT * x) : p(x) {}
ShMemIterator(const ShMemIterator & mit) : p(mit.p) {} ShMemIterator(const ShMemIterator & mit) : p(mit.p) {}
ShMemIterator& operator++() { ShMemIterator& operator++() {
++p; ++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( k > 0 );
BOOST_ASSERT ( points->size() > 0 ); BOOST_ASSERT ( points->size() > 0 );
size = points->size(); size = points->size();
@ -207,7 +207,7 @@ private:
}; };
class Less { class Less {
public: public:
Less( unsigned d ) { explicit Less( unsigned d ) {
dimension = d; dimension = d;
BOOST_ASSERT( dimension < k ); 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 ) { inline HashCell& operator[]( const NodeID node ) {
unsigned short position = fastHash(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 "ExtractionContainers.h"
#include "ExtractionHelperFunctions.h" #include "ExtractionHelperFunctions.h"
#include "ExtractionWay.h" #include "ExtractionWay.h"
#include "ExtractorCallbacks.h"
#include "../DataStructures/Restriction.h" #include "../DataStructures/Restriction.h"
#include "../Util/SimpleLogger.h" #include "../Util/SimpleLogger.h"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -207,7 +207,7 @@ public:
delete m_static_rtree; delete m_static_rtree;
} }
InternalDataFacade( const ServerPaths & server_paths ) { explicit InternalDataFacade( const ServerPaths & server_paths ) {
//generate paths of data files //generate paths of data files
if( server_paths.find("hsgrdata") == server_paths.end() ) { if( server_paths.find("hsgrdata") == server_paths.end() ) {
throw OSRMException("no hsgr file given in ini file"); 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/asio.hpp>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/make_shared.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <boost/thread.hpp> #include <boost/thread.hpp>
@ -72,7 +73,7 @@ public:
void Run() { void Run() {
std::vector<boost::shared_ptr<boost::thread> > threads; std::vector<boost::shared_ptr<boost::thread> > threads;
for (unsigned i = 0; i < threadPoolSize; ++i) { 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); threads.push_back(thread);
} }
for (unsigned i = 0; i < threads.size(); ++i) for (unsigned i = 0; i < threads.size(); ++i)