From 1b257f754718f94674fc62aaada9fa2b3307b449 Mon Sep 17 00:00:00 2001 From: Dennis Luxen Date: Mon, 28 Apr 2014 13:03:20 +0200 Subject: [PATCH] fix inverted logic --- extractor.cpp | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/extractor.cpp b/extractor.cpp index b9dcd1dde..68703c995 100644 --- a/extractor.cpp +++ b/extractor.cpp @@ -162,24 +162,32 @@ int main (int argc, char *argv[]) { file_has_pbf_format = true; } } - if(pos==std::string::npos) { + if (pos==std::string::npos) + { pos = output_file_name.find(".pbf"); - if(pos!=std::string::npos) { + if (pos!=std::string::npos) + { file_has_pbf_format = true; } } - if(pos!=std::string::npos) { - output_file_name.replace(pos, 8, ".osrm"); - restrictionsFileName.replace(pos, 8, ".osrm.restrictions"); - } else { - pos=output_file_name.find(".osm"); - if(pos!=std::string::npos) { - output_file_name.replace(pos, 5, ".osrm"); - restrictionsFileName.replace(pos, 5, ".osrm.restrictions"); - } else { + if (pos == std::string::npos) + { + pos = output_file_name.find(".osm"); + if (pos == std::string::npos) + { output_file_name.append(".osrm"); restrictionsFileName.append(".osrm.restrictions"); } + else + { + output_file_name.replace(pos, 5, ".osrm"); + restrictionsFileName.replace(pos, 5, ".osrm.restrictions"); + } + } + else + { + output_file_name.replace(pos, 8, ".osrm"); + restrictionsFileName.replace(pos, 8, ".osrm.restrictions"); } boost::unordered_map stringMap;