Fixing errors from static analysis

This commit is contained in:
Dennis Luxen 2013-06-27 11:44:32 -04:00
parent 1bcacfab74
commit 5c84c12f40
4 changed files with 98 additions and 78 deletions

View File

@ -474,7 +474,7 @@ public:
newEdge.data.id = data.id; newEdge.data.id = data.id;
} }
BOOST_ASSERT_MSG( BOOST_ASSERT_MSG(
newEdge.data.id <= INT_MAX, //2^31 newEdge.data.id != INT_MAX, //2^31
"edge id invalid" "edge id invalid"
); );
newEdge.data.forward = data.forward; newEdge.data.forward = data.forward;

View File

@ -56,6 +56,17 @@
class EdgeBasedGraphFactory : boost::noncopyable { class EdgeBasedGraphFactory : boost::noncopyable {
public: public:
struct EdgeBasedNode { struct EdgeBasedNode {
EdgeBasedNode() :
id(INT_MAX),
lat1(INT_MAX),
lat2(INT_MAX),
lon1(INT_MAX),
lon2(INT_MAX >> 1),
belongsToTinyComponent(false),
nameID(UINT_MAX),
weight(UINT_MAX >> 1),
ignoreInGrid(false)
{ }
bool operator<(const EdgeBasedNode & other) const { bool operator<(const EdgeBasedNode & other) const {
return other.id < id; return other.id < id;
} }

View File

@ -41,7 +41,12 @@ private:
DescriptionFactory alternateDescriptionFactory; DescriptionFactory alternateDescriptionFactory;
_Coordinate current; _Coordinate current;
unsigned numberOfEnteredRestrictedAreas; unsigned numberOfEnteredRestrictedAreas;
struct { struct RoundAbout{
RoundAbout() :
startIndex(INT_MAX),
nameID(INT_MAX),
leaveAtExit(INT_MAX)
{}
int startIndex; int startIndex;
int nameID; int nameID;
int leaveAtExit; int leaveAtExit;

View File

@ -39,6 +39,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
ExtractorCallbacks * extractCallBacks; ExtractorCallbacks * extractCallBacks;
int main (int argc, char *argv[]) { int main (int argc, char *argv[]) {
try {
double startup_time = get_timestamp(); double startup_time = get_timestamp();
if(argc < 2) { if(argc < 2) {
@ -123,4 +124,7 @@ int main (int argc, char *argv[]) {
<< "./osrm-prepare " << output_file_name << " " << restrictionsFileName << "./osrm-prepare " << output_file_name << " " << restrictionsFileName
<< std::endl; << std::endl;
return 0; return 0;
} catch(std::exception & e) {
WARN("unhandled exception: " << e.what());
}
} }