remove remaining NULL pointers by nullptrs
This commit is contained in:
parent
0c59ecfa14
commit
de7c56c6bc
@ -214,20 +214,20 @@ class TarjanSCC
|
||||
const char *pszDriverName = "ESRI Shapefile";
|
||||
OGRSFDriver *poDriver =
|
||||
OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(pszDriverName);
|
||||
if (NULL == poDriver)
|
||||
if (nullptr == poDriver)
|
||||
{
|
||||
throw OSRMException("ESRI Shapefile driver not available");
|
||||
}
|
||||
OGRDataSource *poDS = poDriver->CreateDataSource("component.shp", NULL);
|
||||
OGRDataSource *poDS = poDriver->CreateDataSource("component.shp", nullptr);
|
||||
|
||||
if (NULL == poDS)
|
||||
if (nullptr == poDS)
|
||||
{
|
||||
throw OSRMException("Creation of output file failed");
|
||||
}
|
||||
|
||||
OGRLayer *poLayer = poDS->CreateLayer("component", NULL, wkbLineString, NULL);
|
||||
OGRLayer *poLayer = poDS->CreateLayer("component", nullptr, wkbLineString, nullptr);
|
||||
|
||||
if (NULL == poLayer)
|
||||
if (nullptr == poLayer)
|
||||
{
|
||||
throw OSRMException("Layer creation failed.");
|
||||
}
|
||||
@ -325,15 +325,6 @@ class TarjanSCC
|
||||
SimpleLogger().Write() << "identified: " << component_size_vector.size()
|
||||
<< " many components, marking small components";
|
||||
|
||||
// TODO/C++11: prime candidate for lambda function
|
||||
// unsigned size_one_counter = 0;
|
||||
// for (unsigned i = 0, end = component_size_vector.size(); i < end; ++i)
|
||||
// {
|
||||
// if (1 == component_size_vector[i])
|
||||
// {
|
||||
// ++size_one_counter;
|
||||
// }
|
||||
// }
|
||||
unsigned size_one_counter = std::count_if(component_size_vector.begin(),
|
||||
component_size_vector.end(),
|
||||
[] (unsigned value) { return 1 == value;});
|
||||
|
@ -731,7 +731,7 @@ class Contractor
|
||||
|
||||
template <bool RUNSIMULATION>
|
||||
inline bool
|
||||
ContractNode(ContractorThreadData *data, NodeID node, ContractionStats *stats = NULL)
|
||||
ContractNode(ContractorThreadData *data, NodeID node, ContractionStats *stats = nullptr)
|
||||
{
|
||||
ContractorHeap &heap = data->heap;
|
||||
int inserted_edges_size = data->inserted_edges.size();
|
||||
@ -743,7 +743,7 @@ class Contractor
|
||||
const NodeID source = contractor_graph->GetTarget(in_edge);
|
||||
if (RUNSIMULATION)
|
||||
{
|
||||
BOOST_ASSERT(stats != NULL);
|
||||
BOOST_ASSERT(stats != nullptr);
|
||||
++stats->edges_deleted_count;
|
||||
stats->original_edges_deleted_count += in_data.originalEdges;
|
||||
}
|
||||
@ -796,7 +796,7 @@ class Contractor
|
||||
{
|
||||
if (RUNSIMULATION)
|
||||
{
|
||||
BOOST_ASSERT(stats != NULL);
|
||||
BOOST_ASSERT(stats != nullptr);
|
||||
stats->edges_added_count += 2;
|
||||
stats->original_edges_added_count +=
|
||||
2 * (out_data.originalEdges + in_data.originalEdges);
|
||||
|
@ -44,8 +44,8 @@ struct BZ2Context
|
||||
|
||||
int readFromBz2Stream(void *pointer, char *buffer, int len)
|
||||
{
|
||||
void *unusedTmpVoid = NULL;
|
||||
char *unusedTmp = NULL;
|
||||
void *unusedTmpVoid = nullptr;
|
||||
char *unusedTmp = nullptr;
|
||||
BZ2Context *context = (BZ2Context *)pointer;
|
||||
int read = 0;
|
||||
while (0 == read &&
|
||||
@ -76,7 +76,7 @@ int readFromBz2Stream(void *pointer, char *buffer, int len)
|
||||
{
|
||||
context->bz2 = BZ2_bzReadOpen(
|
||||
&context->error, context->file, 0, 0, context->unused, context->nUnused);
|
||||
BOOST_ASSERT_MSG(NULL != context->bz2, "Could not open file");
|
||||
BOOST_ASSERT_MSG(nullptr != context->bz2, "Could not open file");
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -107,12 +107,12 @@ xmlTextReaderPtr inputReaderFactory(const char *name)
|
||||
int error;
|
||||
context->bz2 =
|
||||
BZ2_bzReadOpen(&error, context->file, 0, 0, context->unused, context->nUnused);
|
||||
if (context->bz2 == NULL || context->file == NULL)
|
||||
if (context->bz2 == nullptr || context->file == nullptr)
|
||||
{
|
||||
delete context;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
return xmlReaderForIO(readFromBz2Stream, closeBz2Stream, (void *)context, NULL, NULL, 0);
|
||||
return xmlReaderForIO(readFromBz2Stream, closeBz2Stream, (void *)context, nullptr, nullptr, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ bool XMLParser::Parse()
|
||||
}
|
||||
|
||||
xmlChar *currentName = xmlTextReaderName(inputReader);
|
||||
if (currentName == NULL)
|
||||
if (currentName == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -115,7 +115,7 @@ InputRestrictionContainer XMLParser::ReadXMLRestriction()
|
||||
}
|
||||
const int child_depth = xmlTextReaderDepth(inputReader);
|
||||
xmlChar *child_name = xmlTextReaderName(inputReader);
|
||||
if (child_name == NULL)
|
||||
if (child_name == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -135,7 +135,7 @@ InputRestrictionContainer XMLParser::ReadXMLRestriction()
|
||||
{
|
||||
xmlChar *key = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"k");
|
||||
xmlChar *value = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"v");
|
||||
if (key != NULL && value != NULL)
|
||||
if (key != nullptr && value != nullptr)
|
||||
{
|
||||
if (xmlStrEqual(key, (const xmlChar *)"restriction") &&
|
||||
StringStartsWith((const char *)value, "only_"))
|
||||
@ -148,11 +148,11 @@ InputRestrictionContainer XMLParser::ReadXMLRestriction()
|
||||
}
|
||||
}
|
||||
|
||||
if (key != NULL)
|
||||
if (key != nullptr)
|
||||
{
|
||||
xmlFree(key);
|
||||
}
|
||||
if (value != NULL)
|
||||
if (value != nullptr)
|
||||
{
|
||||
xmlFree(value);
|
||||
}
|
||||
@ -160,7 +160,7 @@ InputRestrictionContainer XMLParser::ReadXMLRestriction()
|
||||
else if (xmlStrEqual(child_name, (const xmlChar *)"member") == 1)
|
||||
{
|
||||
xmlChar *ref = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"ref");
|
||||
if (ref != NULL)
|
||||
if (ref != nullptr)
|
||||
{
|
||||
xmlChar *role = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"role");
|
||||
xmlChar *type = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"type");
|
||||
@ -181,15 +181,15 @@ InputRestrictionContainer XMLParser::ReadXMLRestriction()
|
||||
restriction.restriction.viaNode = StringToUint((const char *)ref);
|
||||
}
|
||||
|
||||
if (NULL != type)
|
||||
if (nullptr != type)
|
||||
{
|
||||
xmlFree(type);
|
||||
}
|
||||
if (NULL != role)
|
||||
if (nullptr != role)
|
||||
{
|
||||
xmlFree(role);
|
||||
}
|
||||
if (NULL != ref)
|
||||
if (nullptr != ref)
|
||||
{
|
||||
xmlFree(ref);
|
||||
}
|
||||
@ -222,7 +222,7 @@ ExtractionWay XMLParser::ReadXMLWay()
|
||||
}
|
||||
const int child_depth = xmlTextReaderDepth(inputReader);
|
||||
xmlChar *child_name = xmlTextReaderName(inputReader);
|
||||
if (child_name == NULL)
|
||||
if (child_name == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -247,15 +247,15 @@ ExtractionWay XMLParser::ReadXMLWay()
|
||||
xmlChar *key = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"k");
|
||||
xmlChar *value = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"v");
|
||||
|
||||
if (key != NULL && value != NULL)
|
||||
if (key != nullptr && value != nullptr)
|
||||
{
|
||||
way.keyVals.Add(std::string((char *)key), std::string((char *)value));
|
||||
}
|
||||
if (key != NULL)
|
||||
if (key != nullptr)
|
||||
{
|
||||
xmlFree(key);
|
||||
}
|
||||
if (value != NULL)
|
||||
if (value != nullptr)
|
||||
{
|
||||
xmlFree(value);
|
||||
}
|
||||
@ -263,7 +263,7 @@ ExtractionWay XMLParser::ReadXMLWay()
|
||||
else if (xmlStrEqual(child_name, (const xmlChar *)"nd") == 1)
|
||||
{
|
||||
xmlChar *ref = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"ref");
|
||||
if (ref != NULL)
|
||||
if (ref != nullptr)
|
||||
{
|
||||
way.path.push_back(StringToUint((const char *)ref));
|
||||
xmlFree(ref);
|
||||
@ -279,19 +279,19 @@ ImportNode XMLParser::ReadXMLNode()
|
||||
ImportNode node;
|
||||
|
||||
xmlChar *attribute = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"lat");
|
||||
if (attribute != NULL)
|
||||
if (attribute != nullptr)
|
||||
{
|
||||
node.lat = static_cast<int>(COORDINATE_PRECISION * StringToDouble((const char *)attribute));
|
||||
xmlFree(attribute);
|
||||
}
|
||||
attribute = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"lon");
|
||||
if (attribute != NULL)
|
||||
if (attribute != nullptr)
|
||||
{
|
||||
node.lon = static_cast<int>(COORDINATE_PRECISION * StringToDouble((const char *)attribute));
|
||||
xmlFree(attribute);
|
||||
}
|
||||
attribute = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"id");
|
||||
if (attribute != NULL)
|
||||
if (attribute != nullptr)
|
||||
{
|
||||
node.node_id = StringToUint((const char *)attribute);
|
||||
xmlFree(attribute);
|
||||
@ -312,7 +312,7 @@ ImportNode XMLParser::ReadXMLNode()
|
||||
}
|
||||
const int child_depth = xmlTextReaderDepth(inputReader);
|
||||
xmlChar *child_name = xmlTextReaderName(inputReader);
|
||||
if (child_name == NULL)
|
||||
if (child_name == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -333,15 +333,15 @@ ImportNode XMLParser::ReadXMLNode()
|
||||
{
|
||||
xmlChar *key = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"k");
|
||||
xmlChar *value = xmlTextReaderGetAttribute(inputReader, (const xmlChar *)"v");
|
||||
if (key != NULL && value != NULL)
|
||||
if (key != nullptr && value != nullptr)
|
||||
{
|
||||
node.keyVals.Add(std::string((char *)(key)), std::string((char *)(value)));
|
||||
}
|
||||
if (key != NULL)
|
||||
if (key != nullptr)
|
||||
{
|
||||
xmlFree(key);
|
||||
}
|
||||
if (value != NULL)
|
||||
if (value != nullptr)
|
||||
{
|
||||
xmlFree(value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user