Fixes issue #73.
This commit is contained in:
parent
f68d53ead6
commit
8a665bc044
@ -358,7 +358,7 @@ private:
|
||||
}
|
||||
|
||||
void loadBlock(_ThreadData * threadData) {
|
||||
blockCount++;
|
||||
++blockCount;
|
||||
threadData->currentGroupID = 0;
|
||||
threadData->currentEntityID = 0;
|
||||
}
|
||||
@ -380,14 +380,14 @@ private:
|
||||
if ( size > MAX_BLOB_HEADER_SIZE || size < 0 ) {
|
||||
return false;
|
||||
}
|
||||
char *data = (char*)malloc(size);
|
||||
char *data = new char[size];
|
||||
stream.read(data, size*sizeof(data[0]));
|
||||
|
||||
if ( !(threadData->PBFBlobHeader).ParseFromArray( data, size ) ){
|
||||
free(data);
|
||||
delete[] data;
|
||||
return false;
|
||||
}
|
||||
free(data);
|
||||
delete[] data;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -487,25 +487,26 @@ private:
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !readPBFBlobHeader(stream, threadData) )
|
||||
return false;
|
||||
|
||||
if ( threadData->PBFBlobHeader.type() != "OSMData" ) {
|
||||
std::cerr << "[error] invalid block type, found" << threadData->PBFBlobHeader.type().data() << "instead of OSMData" << std::endl;
|
||||
if ( !readPBFBlobHeader(stream, threadData) ){
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !readBlob(stream, threadData) )
|
||||
if ( threadData->PBFBlobHeader.type() != "OSMData" ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !readBlob(stream, threadData) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !threadData->PBFprimitiveBlock.ParseFromArray( &(threadData->charBuffer[0]), threadData-> charBuffer.size() ) ) {
|
||||
std::cerr << "[error] failed to parse PrimitiveBlock" << std::endl;
|
||||
ERR("failed to parse PrimitiveBlock");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static Endianness getMachineEndianness() {
|
||||
Endianness getMachineEndianness() const {
|
||||
int i(1);
|
||||
char *p = (char *) &i;
|
||||
if (p[0] == 1)
|
||||
|
@ -60,7 +60,7 @@ unsigned globalRestrictionCounter = 0;
|
||||
ExtractorCallbacks * extractCallBacks;
|
||||
|
||||
bool nodeFunction(_Node n);
|
||||
bool adressFunction(_Node n, HashTable<string, string> keyVals);
|
||||
bool adressFunction(_Node n, HashTable<string, string> & keyVals);
|
||||
bool restrictionFunction(_RawRestrictionContainer r);
|
||||
bool wayFunction(_Way w);
|
||||
|
||||
@ -190,10 +190,9 @@ int main (int argc, char *argv[]) {
|
||||
parser = new XMLParser(argv[1]);
|
||||
}
|
||||
parser->RegisterCallbacks(&nodeFunction, &restrictionFunction, &wayFunction, &adressFunction);
|
||||
GUARANTEE(parser->Init(), "Parser not initialized!");
|
||||
if(!parser->Init())
|
||||
INFO("Parser not initialized!");
|
||||
parser->Parse();
|
||||
DELETE(parser);
|
||||
stringMap.clear();
|
||||
|
||||
try {
|
||||
// INFO("raw no. of names: " << externalMemory.nameVector.size());
|
||||
@ -485,7 +484,9 @@ int main (int argc, char *argv[]) {
|
||||
cerr << "Caught Execption:" << e.what() << endl;
|
||||
return false;
|
||||
}
|
||||
DELETE(parser);
|
||||
|
||||
stringMap.clear();
|
||||
delete extractCallBacks;
|
||||
cout << "[extractor] finished." << endl;
|
||||
return 0;
|
||||
@ -496,7 +497,7 @@ bool nodeFunction(_Node n) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool adressFunction(_Node n, HashTable<string, string> keyVals){
|
||||
bool adressFunction(_Node n, HashTable<string, string> & keyVals){
|
||||
extractCallBacks->adressFunction(n, keyVals);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user