From ac588911bae96717e5c3df9ef67fe0e878af282b Mon Sep 17 00:00:00 2001 From: DennisOSRM Date: Wed, 19 Sep 2012 13:48:04 +0200 Subject: [PATCH] Fixing warning detected by additional compiler flags --- Algorithms/CRC32.cpp | 2 +- Algorithms/IteratorBasedCRC32.h | 4 ++-- Contractor/Contractor.h | 13 ++++++------- Contractor/EdgeBasedGraphFactory.cpp | 6 ++++-- Contractor/EdgeBasedGraphFactory.h | 10 ++++------ DataStructures/NNGrid.h | 4 ++-- DataStructures/SearchEngine.h | 2 +- Descriptors/DescriptionFactory.cpp | 2 +- Descriptors/DescriptionFactory.h | 2 +- Descriptors/JSONDescriptor.h | 4 ++-- Extractor/ExtractorCallbacks.cpp | 2 +- Extractor/ExtractorCallbacks.h | 2 ++ Server/DataStructures/QueryObjectsStorage.cpp | 2 +- Server/DataStructures/QueryObjectsStorage.h | 2 +- Util/LinuxStackTrace.h | 6 +++--- createHierarchy.cpp | 2 +- routed.cpp | 2 +- 17 files changed, 34 insertions(+), 33 deletions(-) diff --git a/Algorithms/CRC32.cpp b/Algorithms/CRC32.cpp index b2329e641..d2f821cb4 100644 --- a/Algorithms/CRC32.cpp +++ b/Algorithms/CRC32.cpp @@ -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(); diff --git a/Algorithms/IteratorBasedCRC32.h b/Algorithms/IteratorBasedCRC32.h index 7e23a0edb..4999754c9 100644 --- a/Algorithms/IteratorBasedCRC32.h +++ b/Algorithms/IteratorBasedCRC32.h @@ -35,7 +35,7 @@ private: 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 @@ public: unsigned operator()( ContainerT_iterator iter, const ContainerT_iterator end) { unsigned crc = 0; while(iter != end) { - char * data = (char*)&(*iter); + char * data = reinterpret_cast(&(*iter) ); crc =((*this).*(crcFunction))(data, sizeof(typename ContainerT::value_type*), crc); ++iter; } diff --git a/Contractor/Contractor.h b/Contractor/Contractor.h index badc4afb8..efe88d114 100644 --- a/Contractor/Contractor.h +++ b/Contractor/Contractor.h @@ -21,18 +21,17 @@ or see http://www.gnu.org/licenses/agpl.txt. #ifndef CONTRACTOR_H_INCLUDED #define CONTRACTOR_H_INCLUDED #include -#include #include #include #include #include -#include +#include +#include #include #include "TemporaryStorage.h" - #include "../DataStructures/BinaryHeap.h" #include "../DataStructures/DeallocatingVector.h" #include "../DataStructures/DynamicGraph.h" @@ -343,7 +342,7 @@ public: #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 @@ private: 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 @@ private: 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 @@ private: if ( priority > targetPriority) return false; //tie breaking - if ( priority == targetPriority && bias(node, target) ) { + if ( fabs(priority - targetPriority) < FLT_EPSILON && bias(node, target) ) { return false; } } diff --git a/Contractor/EdgeBasedGraphFactory.cpp b/Contractor/EdgeBasedGraphFactory.cpp index 03ebb93cf..0f879cca4 100644 --- a/Contractor/EdgeBasedGraphFactory.cpp +++ b/Contractor/EdgeBasedGraphFactory.cpp @@ -21,7 +21,7 @@ #include "EdgeBasedGraphFactory.h" template<> -EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector & inputEdges, std::vector & bn, std::vector & tl, std::vector<_Restriction> & irs, std::vector & nI, SpeedProfileProperties sp, std::string & srtm) : inputNodeInfoList(nI), numberOfTurnRestrictions(irs.size()), speedProfile(sp) { +EdgeBasedGraphFactory::EdgeBasedGraphFactory(int nodes, std::vector & inputEdges, std::vector & bn, std::vector & tl, std::vector<_Restriction> & irs, std::vector & nI, SpeedProfileProperties sp) : inputNodeInfoList(nI), numberOfTurnRestrictions(irs.size()), speedProfile(sp) { BOOST_FOREACH(_Restriction & restriction, irs) { std::pair 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 > bfsQueue; std::vector componentsIndex(_nodeBasedGraph->GetNumberOfNodes(), UINT_MAX); std::vector 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]) { diff --git a/Contractor/EdgeBasedGraphFactory.h b/Contractor/EdgeBasedGraphFactory.h index 27b4c7589..0fa0bb252 100644 --- a/Contractor/EdgeBasedGraphFactory.h +++ b/Contractor/EdgeBasedGraphFactory.h @@ -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 @@ private: typedef DynamicGraph< _NodeBasedEdgeData > _NodeBasedDynamicGraph; typedef _NodeBasedDynamicGraph::InputEdge _NodeBasedEdge; - + std::vector inputNodeInfoList; + unsigned numberOfTurnRestrictions; public: struct EdgeBasedNode { bool operator<(const EdgeBasedNode & other) const { @@ -118,7 +117,6 @@ private: DeallocatingVector edgeBasedEdges; DeallocatingVector edgeBasedNodes; std::vector originalEdgeData; - std::vector 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 @@ private: template 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 & inputEdges, std::vector & _bollardNodes, std::vector & trafficLights, std::vector<_Restriction> & inputRestrictions, std::vector & nI, SpeedProfileProperties speedProfile, std::string & srtm); + explicit EdgeBasedGraphFactory(int nodes, std::vector & inputEdges, std::vector & _bollardNodes, std::vector & trafficLights, std::vector<_Restriction> & inputRestrictions, std::vector & nI, SpeedProfileProperties speedProfile); void Run(const char * originalEdgeDataFilename); void GetEdgeBasedEdges( DeallocatingVector< EdgeBasedEdge >& edges ); diff --git a/DataStructures/NNGrid.h b/DataStructures/NNGrid.h index 17c40dd06..80170295d 100644 --- a/DataStructures/NNGrid.h +++ b/DataStructures/NNGrid.h @@ -367,11 +367,11 @@ private: } //write length of bucket - memcpy(static_cast(static_cast(&(tmpBuffer[index+counter]))), static_cast(static_cast(&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(static_cast(&(entry.edge) )); + char * data = (char*)&(entry.edge); memcpy(static_cast(static_cast(&(tmpBuffer[index+counter]) )), data, sizeof(entry.edge)); counter += sizeof(entry.edge); } diff --git a/DataStructures/SearchEngine.h b/DataStructures/SearchEngine.h index d39500b03..d0cf25191 100644 --- a/DataStructures/SearchEngine.h +++ b/DataStructures/SearchEngine.h @@ -120,7 +120,7 @@ public: {} ~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); } diff --git a/Descriptors/DescriptionFactory.cpp b/Descriptors/DescriptionFactory.cpp index a51aa14f3..7bab37f81 100644 --- a/Descriptors/DescriptionFactory.cpp +++ b/Descriptors/DescriptionFactory.cpp @@ -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; diff --git a/Descriptors/DescriptionFactory.h b/Descriptors/DescriptionFactory.h index fbd9e1215..07b640dfb 100644 --- a/Descriptors/DescriptionFactory.h +++ b/Descriptors/DescriptionFactory.h @@ -77,7 +77,7 @@ public: 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_ */ diff --git a/Descriptors/JSONDescriptor.h b/Descriptors/JSONDescriptor.h index a0f2acf17..967c72640 100644 --- a/Descriptors/JSONDescriptor.h +++ b/Descriptors/JSONDescriptor.h @@ -87,7 +87,7 @@ public: "\"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 @@ public: } 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\": ["; diff --git a/Extractor/ExtractorCallbacks.cpp b/Extractor/ExtractorCallbacks.cpp index 218a285d2..a8f3d9a9b 100644 --- a/Extractor/ExtractorCallbacks.cpp +++ b/Extractor/ExtractorCallbacks.cpp @@ -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; } diff --git a/Extractor/ExtractorCallbacks.h b/Extractor/ExtractorCallbacks.h index ddf64cb9d..70f812ec2 100644 --- a/Extractor/ExtractorCallbacks.h +++ b/Extractor/ExtractorCallbacks.h @@ -24,6 +24,8 @@ or see http://www.gnu.org/licenses/agpl.txt. #include #include +#include + #include #include #include diff --git a/Server/DataStructures/QueryObjectsStorage.cpp b/Server/DataStructures/QueryObjectsStorage.cpp index 6e47ad8af..a9ec8d788 100644 --- a/Server/DataStructures/QueryObjectsStorage.cpp +++ b/Server/DataStructures/QueryObjectsStorage.cpp @@ -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 diff --git a/Server/DataStructures/QueryObjectsStorage.h b/Server/DataStructures/QueryObjectsStorage.h index 3f8eaa424..be8bba073 100644 --- a/Server/DataStructures/QueryObjectsStorage.h +++ b/Server/DataStructures/QueryObjectsStorage.h @@ -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(); }; diff --git a/Util/LinuxStackTrace.h b/Util/LinuxStackTrace.h index 765539726..a3a23a7c5 100644 --- a/Util/LinuxStackTrace.h +++ b/Util/LinuxStackTrace.h @@ -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_ */ diff --git a/createHierarchy.cpp b/createHierarchy.cpp index b94bb11f7..c4682c4e2 100644 --- a/createHierarchy.cpp +++ b/createHierarchy.cpp @@ -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().swap(edgeList); edgeBasedGraphFactory->Run(edgeOut); std::vector<_Restriction>().swap(inputRestrictions); diff --git a/routed.cpp b/routed.cpp index 95e0e3129..497e6b49b 100644 --- a/routed.cpp +++ b/routed.cpp @@ -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");