Permalink
Browse files

Fixing warning detected by additional compiler flags

  • Loading branch information...
1 parent c14ceff commit ac588911bae96717e5c3df9ef67fe0e878af282b DennisOSRM committed Sep 19, 2012
@@ -24,7 +24,7 @@ CRC32::CRC32() : crc(0) {
crcFunction = detectBestCRC32C();
}
-unsigned CRC32::SoftwareBasedCRC32(char *str, unsigned len, unsigned crc) {
+unsigned CRC32::SoftwareBasedCRC32(char *str, unsigned len, unsigned ) {
boost::crc_optimal<32, 0x1EDC6F41, 0x0, 0x0, true, true> CRC32_Processor;
CRC32_Processor.process_bytes( str, len);
return CRC32_Processor.checksum();
@@ -35,7 +35,7 @@ class IteratorbasedCRC32 {
typedef boost::crc_optimal<32, 0x1EDC6F41, 0x0, 0x0, true, true> my_crc_32_type;
typedef unsigned (IteratorbasedCRC32::*CRC32CFunctionPtr)(char *str, unsigned len, unsigned crc);
- unsigned SoftwareBasedCRC32(char *str, unsigned len, unsigned crc){
+ unsigned SoftwareBasedCRC32(char *str, unsigned len, unsigned ){
boost::crc_optimal<32, 0x1EDC6F41, 0x0, 0x0, true, true> CRC32_Processor;
CRC32_Processor.process_bytes( str, len);
return CRC32_Processor.checksum();
@@ -99,7 +99,7 @@ class IteratorbasedCRC32 {
unsigned operator()( ContainerT_iterator iter, const ContainerT_iterator end) {
unsigned crc = 0;
while(iter != end) {
- char * data = (char*)&(*iter);
+ char * data = reinterpret_cast<char*>(&(*iter) );
crc =((*this).*(crcFunction))(data, sizeof(typename ContainerT::value_type*), crc);
++iter;
}
@@ -21,18 +21,17 @@ or see http://www.gnu.org/licenses/agpl.txt.
#ifndef CONTRACTOR_H_INCLUDED
#define CONTRACTOR_H_INCLUDED
#include <algorithm>
-#include <ctime>
#include <limits>
#include <queue>
#include <set>
#include <vector>
-#include <stxxl.h>
+#include <cfloat>
+#include <ctime>
#include <boost/shared_ptr.hpp>
#include "TemporaryStorage.h"
-
#include "../DataStructures/BinaryHeap.h"
#include "../DataStructures/DeallocatingVector.h"
#include "../DataStructures/DynamicGraph.h"
@@ -343,7 +342,7 @@ class Contractor {
#pragma omp for schedule ( guided )
for ( int i = 0; i < last; ++i ) {
const NodeID node = remainingNodes[i].first;
- remainingNodes[i].second = _IsIndependent( nodePriority, nodeData, data, node );
+ remainingNodes[i].second = _IsIndependent( nodePriority/*, nodeData*/, data, node );
}
}
_NodePartitionor functor;
@@ -700,7 +699,7 @@ class Contractor {
return true;
}
- bool _IsIndependent( const std::vector< float >& priorities, const std::vector< _PriorityData >& nodeData, _ThreadData* const data, NodeID node ) {
+ bool _IsIndependent( const std::vector< float >& priorities/*, const std::vector< _PriorityData >& nodeData*/, _ThreadData* const data, NodeID node ) {
const double priority = priorities[node];
std::vector< NodeID >& neighbours = data->neighbours;
@@ -716,7 +715,7 @@ class Contractor {
if ( priority > targetPriority )
return false;
//tie breaking
- if ( priority == targetPriority && bias(node, target) ) {
+ if ( fabs(priority - targetPriority) < FLT_EPSILON && bias(node, target) ) {
return false;
}
neighbours.push_back( target );
@@ -740,7 +739,7 @@ class Contractor {
if ( priority > targetPriority)
return false;
//tie breaking
- if ( priority == targetPriority && bias(node, target) ) {
+ if ( fabs(priority - targetPriority) < FLT_EPSILON && bias(node, target) ) {
return false;
}
}
@@ -21,7 +21,7 @@
#include "EdgeBasedGraphFactory.h"
template<>
-EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector<NodeBasedEdge> & inputEdges, std::vector<NodeID> & bn, std::vector<NodeID> & tl, std::vector<_Restriction> & irs, std::vector<NodeInfo> & nI, SpeedProfileProperties sp, std::string & srtm) : inputNodeInfoList(nI), numberOfTurnRestrictions(irs.size()), speedProfile(sp) {
+EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector<NodeBasedEdge> & inputEdges, std::vector<NodeID> & bn, std::vector<NodeID> & tl, std::vector<_Restriction> & irs, std::vector<NodeInfo> & nI, SpeedProfileProperties sp) : inputNodeInfoList(nI), numberOfTurnRestrictions(irs.size()), speedProfile(sp) {
BOOST_FOREACH(_Restriction & restriction, irs) {
std::pair<NodeID, NodeID> restrictionSource = std::make_pair(restriction.fromNode, restriction.viaNode);
unsigned index;
@@ -101,10 +101,12 @@ void EdgeBasedGraphFactory::GetEdgeBasedEdges(DeallocatingVector< EdgeBasedEdge
}
void EdgeBasedGraphFactory::GetEdgeBasedNodes( DeallocatingVector< EdgeBasedNode> & nodes) {
+#ifndef NDEBUG
BOOST_FOREACH(EdgeBasedNode & node, edgeBasedNodes){
assert(node.lat1 != INT_MAX); assert(node.lon1 != INT_MAX);
assert(node.lat2 != INT_MAX); assert(node.lon2 != INT_MAX);
}
+#endif
nodes.swap(edgeBasedNodes);
}
@@ -173,7 +175,7 @@ void EdgeBasedGraphFactory::Run(const char * originalEdgeDataFilename) {
std::queue<std::pair<NodeID, NodeID> > bfsQueue;
std::vector<unsigned> componentsIndex(_nodeBasedGraph->GetNumberOfNodes(), UINT_MAX);
std::vector<NodeID> vectorOfComponentSizes;
- unsigned currentComponent = 0, sizeOfCurrentComponent = 0, settledNodes = 0;
+ unsigned currentComponent = 0, sizeOfCurrentComponent = 0;
//put unexplorered node with parent pointer into queue
for(NodeID node = 0, endNodes = _nodeBasedGraph->GetNumberOfNodes(); node < endNodes; ++node) {
if(UINT_MAX == componentsIndex[node]) {
@@ -48,8 +48,6 @@
#include "../DataStructures/TurnInstructions.h"
#include "../Util/BaseConfiguration.h"
-//#include "../Util/SRTMLookup.h"
-
class EdgeBasedGraphFactory {
private:
struct _NodeBasedEdgeData {
@@ -76,7 +74,8 @@ class EdgeBasedGraphFactory {
typedef DynamicGraph< _NodeBasedEdgeData > _NodeBasedDynamicGraph;
typedef _NodeBasedDynamicGraph::InputEdge _NodeBasedEdge;
-
+ std::vector<NodeInfo> inputNodeInfoList;
+ unsigned numberOfTurnRestrictions;
public:
struct EdgeBasedNode {
bool operator<(const EdgeBasedNode & other) const {
@@ -118,7 +117,6 @@ class EdgeBasedGraphFactory {
DeallocatingVector<EdgeBasedEdge> edgeBasedEdges;
DeallocatingVector<EdgeBasedNode> edgeBasedNodes;
std::vector<OriginalEdgeData> originalEdgeData;
- std::vector<NodeInfo> inputNodeInfoList;
NodeID CheckForEmanatingIsOnlyTurn(const NodeID u, const NodeID v) const;
bool CheckIfTurnIsRestricted(const NodeID u, const NodeID v, const NodeID w) const;
@@ -130,11 +128,11 @@ class EdgeBasedGraphFactory {
template<class CoordinateT>
double GetAngleBetweenTwoEdges(const CoordinateT& A, const CoordinateT& C, const CoordinateT& B) const;
// SRTMLookup srtmLookup;
- unsigned numberOfTurnRestrictions;
+
public:
template< class InputEdgeT >
- explicit EdgeBasedGraphFactory(int nodes, std::vector<InputEdgeT> & inputEdges, std::vector<NodeID> & _bollardNodes, std::vector<NodeID> & trafficLights, std::vector<_Restriction> & inputRestrictions, std::vector<NodeInfo> & nI, SpeedProfileProperties speedProfile, std::string & srtm);
+ explicit EdgeBasedGraphFactory(int nodes, std::vector<InputEdgeT> & inputEdges, std::vector<NodeID> & _bollardNodes, std::vector<NodeID> & trafficLights, std::vector<_Restriction> & inputRestrictions, std::vector<NodeInfo> & nI, SpeedProfileProperties speedProfile);
void Run(const char * originalEdgeDataFilename);
void GetEdgeBasedEdges( DeallocatingVector< EdgeBasedEdge >& edges );
@@ -367,11 +367,11 @@ class NNGrid {
}
//write length of bucket
- memcpy(static_cast<char*>(static_cast<void*>(&(tmpBuffer[index+counter]))), static_cast<char*>(static_cast<void*>(&lengthOfBucket)), sizeof(lengthOfBucket));
+ memcpy((char*)&(tmpBuffer[index+counter]), (char*)&lengthOfBucket, sizeof(lengthOfBucket));
counter += sizeof(lengthOfBucket);
BOOST_FOREACH(const GridEntry & entry, vectorWithSameFileIndex) {
- char * data = static_cast<char*>(static_cast<void*>(&(entry.edge) ));
+ char * data = (char*)&(entry.edge);
memcpy(static_cast<char*>(static_cast<void*>(&(tmpBuffer[index+counter]) )), data, sizeof(entry.edge));
counter += sizeof(entry.edge);
}
@@ -120,7 +120,7 @@ class SearchEngine {
{}
~SearchEngine() {}
- inline const void GetCoordinatesForNodeID(NodeID id, _Coordinate& result) const {
+ inline void GetCoordinatesForNodeID(NodeID id, _Coordinate& result) const {
result.lat = _queryData.nodeHelpDesk->getLatitudeOfNode(id);
result.lon = _queryData.nodeHelpDesk->getLongitudeOfNode(id);
}
@@ -78,7 +78,7 @@ void DescriptionFactory::AppendUnencodedPolylineString(std::string &output) {
pc.printUnencodedString(pathDescription, output);
}
-void DescriptionFactory::Run(const SearchEngineT &sEngine, const unsigned zoomLevel, const unsigned duration) {
+void DescriptionFactory::Run(const SearchEngineT &sEngine, const unsigned zoomLevel) {
if(0 == pathDescription.size())
return;
@@ -77,7 +77,7 @@ class DescriptionFactory {
void SetStartSegment(const PhantomNode & startPhantom);
void SetEndSegment(const PhantomNode & startPhantom);
void AppendEncodedPolylineString(std::string & output, bool isEncoded);
- void Run(const SearchEngineT &sEngine, const unsigned zoomLevel, const unsigned duration);
+ void Run(const SearchEngineT &sEngine, const unsigned zoomLevel);
};
#endif /* DESCRIPTIONFACTORY_H_ */
@@ -87,7 +87,7 @@ class JSONDescriptor : public BaseDescriptor<SearchEngineT>{
"\"status_message\": \"Cannot find route between points\",";
}
- descriptionFactory.Run(sEngine, config.z, rawRoute.lengthOfShortestPath);
+ descriptionFactory.Run(sEngine, config.z);
reply.content += "\"route_geometry\": ";
if(config.geometry) {
descriptionFactory.AppendEncodedPolylineString(reply.content, config.encodeGeometry);
@@ -137,7 +137,7 @@ class JSONDescriptor : public BaseDescriptor<SearchEngineT>{
}
alternateDescriptionFactory.SetEndSegment(phantomNodes.targetPhantom);
}
- alternateDescriptionFactory.Run(sEngine, config.z, rawRoute.lengthOfAlternativePath);
+ alternateDescriptionFactory.Run(sEngine, config.z);
//give an array of alternative routes
reply.content += "\"alternative_geometries\": [";
@@ -78,7 +78,7 @@ bool ExtractorCallbacks::wayFunction(_Way &w) {
w.nameID = strit->second;
}
- if(-1 == w.speed){
+ if(fabs(-1. - w.speed) < FLT_EPSILON){
WARN("found way with bogus speed, id: " << w.id);
return true;
}
@@ -24,6 +24,8 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include <string>
#include <vector>
+#include <cfloat>
+
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/regex.hpp>
#include <boost/regex.hpp>
@@ -22,7 +22,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
#include "QueryObjectsStorage.h"
#include "../../Util/GraphLoader.h"
-QueryObjectsStorage::QueryObjectsStorage(std::string hsgrPath, std::string ramIndexPath, std::string fileIndexPath, std::string nodesPath, std::string edgesPath, std::string namesPath, std::string timestampPath, std::string psd) {
+QueryObjectsStorage::QueryObjectsStorage(std::string hsgrPath, std::string ramIndexPath, std::string fileIndexPath, std::string nodesPath, std::string edgesPath, std::string namesPath, std::string timestampPath) {
INFO("loading graph data");
std::ifstream hsgrInStream(hsgrPath.c_str(), std::ios::binary);
//Deserialize road network graph
@@ -39,7 +39,7 @@ struct QueryObjectsStorage {
std::string timestamp;
unsigned checkSum;
- QueryObjectsStorage(std::string hsgrPath, std::string ramIndexPath, std::string fileIndexPath, std::string nodesPath, std::string edgesPath, std::string namesPath, std::string timestampPath, std::string psd = "route");
+ QueryObjectsStorage(std::string hsgrPath, std::string ramIndexPath, std::string fileIndexPath, std::string nodesPath, std::string edgesPath, std::string namesPath, std::string timestampPath);
~QueryObjectsStorage();
};
@@ -70,7 +70,7 @@ std::string getFileAndLine (char * offset_end) {
}
-void crashHandler(int sig_num, siginfo_t * info, void * ucontext) {
+void crashHandler(int sig_num, siginfo_t * info, void * ) {
const size_t maxDepth = 100;
//size_t stackDepth;
@@ -136,8 +136,8 @@ void crashHandler(int sig_num, siginfo_t * info, void * ucontext) {
}
void installCrashHandler(std::string b) {
-#ifndef NDEBUG
binaryName = b;
+#ifndef NDEBUG
struct sigaction sigact;
sigemptyset(&sigact.sa_mask);
sigact.sa_sigaction = crashHandler;
@@ -151,6 +151,6 @@ void installCrashHandler(std::string b) {
#endif
}
#else
-inline void installCrashHandler(std::string b) {}
+inline void installCrashHandler(std::string ) {}
#endif
#endif /* LINUXSTACKTRACE_H_ */
View
@@ -151,7 +151,7 @@ int main (int argc, char *argv[]) {
*/
INFO("Generating edge-expanded graph representation");
- EdgeBasedGraphFactory * edgeBasedGraphFactory = new EdgeBasedGraphFactory (nodeBasedNodeNumber, edgeList, bollardNodes, trafficLightNodes, inputRestrictions, internalToExternalNodeMapping, speedProfile, SRTM_ROOT);
+ EdgeBasedGraphFactory * edgeBasedGraphFactory = new EdgeBasedGraphFactory (nodeBasedNodeNumber, edgeList, bollardNodes, trafficLightNodes, inputRestrictions, internalToExternalNodeMapping, speedProfile);
std::vector<ImportEdge>().swap(edgeList);
edgeBasedGraphFactory->Run(edgeOut);
std::vector<_Restriction>().swap(inputRestrictions);
View
@@ -64,7 +64,7 @@ BOOL WINAPI console_ctrl_handler(DWORD ctrl_type)
}
#endif
-int main (int argc, char *argv[]) {
+int main (int, char * argv[0]) {
#ifdef __linux__
if(!mlockall(MCL_CURRENT | MCL_FUTURE))
WARN("Process " << argv[0] << "could not be locked to RAM");

0 comments on commit ac58891

Please sign in to comment.