Removing unused parameters, fixing signed-unsigned comparisons

This commit is contained in:
DennisOSRM 2012-09-19 13:28:37 +02:00
parent b448177278
commit e3062cf3a2
2 changed files with 17 additions and 16 deletions

View File

@ -42,7 +42,7 @@ TemporaryStorage::~TemporaryStorage() {
void TemporaryStorage::removeAll() { void TemporaryStorage::removeAll() {
boost::mutex::scoped_lock lock(mutex); boost::mutex::scoped_lock lock(mutex);
try { try {
for(int slotID = 0; slotID < vectorOfStreamDatas.size(); ++slotID) for(unsigned slotID = 0; slotID < vectorOfStreamDatas.size(); ++slotID)
deallocateSlot(slotID); deallocateSlot(slotID);
} catch(boost::filesystem::filesystem_error & e) { } catch(boost::filesystem::filesystem_error & e) {
@ -127,7 +127,7 @@ boost::filesystem::fstream::pos_type TemporaryStorage::tell(int slotID) {
return position; return position;
} }
void TemporaryStorage::abort(boost::filesystem::filesystem_error& e) { void TemporaryStorage::abort(boost::filesystem::filesystem_error& ) {
removeAll(); removeAll();
// ERR("I/O Error occured: " << e.what()); // ERR("I/O Error occured: " << e.what());
} }

View File

@ -22,6 +22,7 @@ or see http://www.gnu.org/licenses/agpl.txt.
#define PBFPARSER_H_ #define PBFPARSER_H_
#include <zlib.h> #include <zlib.h>
#include <boost/make_shared.hpp>
#include <boost/ref.hpp> #include <boost/ref.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
@ -69,7 +70,7 @@ public:
PBFParser(const char * fileName) : myLuaState(NULL) { PBFParser(const char * fileName) : myLuaState(NULL) {
GOOGLE_PROTOBUF_VERIFY_VERSION; GOOGLE_PROTOBUF_VERIFY_VERSION;
//TODO: What is the bottleneck here? Filling the queue or reading the stuff from disk? //TODO: What is the bottleneck here? Filling the queue or reading the stuff from disk?
threadDataQueue.reset( new ConcurrentQueue<_ThreadData*>(2500) ); /* Max 2500 items in queue, hardcoded. */ threadDataQueue = boost::make_shared<ConcurrentQueue<_ThreadData*> >( 2500 ); /* Max 2500 items in queue, hardcoded. */
input.open(fileName, std::ios::in | std::ios::binary); input.open(fileName, std::ios::in | std::ios::binary);
if (!input) { if (!input) {
@ -194,6 +195,8 @@ public:
bool Parse() { bool Parse() {
// Start the read and parse threads // Start the read and parse threads
boost::thread readThread(boost::bind(&PBFParser::ReadData, this)); boost::thread readThread(boost::bind(&PBFParser::ReadData, this));
//Open several parse threads that are synchronized before call to
boost::thread parseThread(boost::bind(&PBFParser::ParseData, this)); boost::thread parseThread(boost::bind(&PBFParser::ParseData, this));
// Wait for the threads to finish // Wait for the threads to finish
@ -235,9 +238,8 @@ private:
} }
/** Pass the unpacked node to the LUA call back **/ /** Pass the unpacked node to the LUA call back **/
int ret = -1;
try { try {
ret = luabind::call_function<int>( luabind::call_function<int>(
myLuaState, myLuaState,
"node_function", "node_function",
boost::ref(n) boost::ref(n)
@ -255,7 +257,7 @@ private:
} }
} }
void parseNode(_ThreadData * threadData) { void parseNode(_ThreadData * ) {
ERR("Parsing of simple nodes not supported. PBF should use dense nodes"); ERR("Parsing of simple nodes not supported. PBF should use dense nodes");
// _Node n; // _Node n;
// if(!(*nodeCallback)(n)) // if(!(*nodeCallback)(n))
@ -343,25 +345,24 @@ private:
_Way w; _Way w;
w.id = inputWay.id(); w.id = inputWay.id();
unsigned pathNode(0); unsigned pathNode(0);
for(int i = 0; i < inputWay.refs_size(); i++) { for(int i = 0; i < inputWay.refs_size(); ++i) {
pathNode += inputWay.refs(i); pathNode += inputWay.refs(i);
w.path.push_back(pathNode); w.path.push_back(pathNode);
} }
assert(inputWay.keys_size() == inputWay.vals_size()); assert(inputWay.keys_size() == inputWay.vals_size());
for(int i = 0; i < inputWay.keys_size(); i++) { for(int i = 0; i < inputWay.keys_size(); ++i) {
const std::string key = threadData->PBFprimitiveBlock.stringtable().s(inputWay.keys(i)); const std::string key = threadData->PBFprimitiveBlock.stringtable().s(inputWay.keys(i));
const std::string val = threadData->PBFprimitiveBlock.stringtable().s(inputWay.vals(i)); const std::string val = threadData->PBFprimitiveBlock.stringtable().s(inputWay.vals(i));
w.keyVals.Add(key, val); w.keyVals.Add(key, val);
} }
/** Pass the unpacked way to the LUA call back **/ /** Pass the unpacked way to the LUA call back **/
int ret = -1;
try { try {
ret = luabind::call_function<int>( luabind::call_function<int>(
myLuaState, myLuaState,
"way_function", "way_function",
boost::ref(w), boost::ref(w),
w.path.size() w.path.size()
); );
if(!(*wayCallback)(w)) { if(!(*wayCallback)(w)) {
std::cerr << "[PBFParser] way not parsed" << std::endl; std::cerr << "[PBFParser] way not parsed" << std::endl;
@ -433,7 +434,7 @@ private:
return true; return true;
} }
bool unpackZLIB(std::fstream & stream, _ThreadData * threadData) { bool unpackZLIB(std::fstream &, _ThreadData * threadData) {
unsigned rawSize = threadData->PBFBlob.raw_size(); unsigned rawSize = threadData->PBFBlob.raw_size();
char* unpackedDataArray = (char*)malloc(rawSize); char* unpackedDataArray = (char*)malloc(rawSize);
z_stream compressedDataStream; z_stream compressedDataStream;
@ -474,7 +475,7 @@ private:
return true; return true;
} }
bool unpackLZMA(std::fstream & stream, _ThreadData * threadData) { bool unpackLZMA(std::fstream &, _ThreadData * ) {
return false; return false;
} }