c++ style: use nullptr rather than NULL

This commit is contained in:
Dane Springmeyer 2016-04-05 15:27:32 -04:00
parent 2cbb9f480a
commit f8a8ec616a
8 changed files with 14 additions and 14 deletions

View file

@ -105,7 +105,7 @@ private:
inline ScriptRun::ScriptRun()
{
reset(NULL, 0, 0);
reset(nullptr, 0, 0);
}
inline ScriptRun::ScriptRun(const UChar chars[], int32_t length)

View file

@ -403,15 +403,15 @@ feature_ptr gdal_featureset::get_feature(mapnik::query const& q)
if( red->GetBand() == 1 && green->GetBand() == 2 && blue->GetBand() == 3 )
{
int nBandsToRead = 3;
if( alpha != NULL && alpha->GetBand() == 4 && !raster_has_nodata )
if( alpha != nullptr && alpha->GetBand() == 4 && !raster_has_nodata )
{
nBandsToRead = 4;
alpha = NULL; // to avoid reading it again afterwards
alpha = nullptr; // to avoid reading it again afterwards
}
raster_io_error = dataset_.RasterIO(GF_Read, x_off, y_off, width, height,
image.bytes(),
image.width(), image.height(), GDT_Byte,
nBandsToRead, NULL,
nBandsToRead, nullptr,
4, 4 * image.width(), 1);
if (raster_io_error == CE_Failure) {
throw datasource_exception(CPLGetLastErrorMsg());

View file

@ -371,7 +371,7 @@ void ogr_datasource::init(mapnik::parameters const& params)
}
mapnik::parameters & extra_params = desc_.get_extra_parameters();
OGRSpatialReference * srs_ref = layer->GetSpatialRef();
char * srs_output = NULL;
char * srs_output = nullptr;
if (srs_ref && srs_ref->exportToProj4( &srs_output ) == OGRERR_NONE ) {
extra_params["proj4"] = mapnik::util::trim_copy(srs_output);
}

View file

@ -257,7 +257,7 @@ pgraster_datasource::pgraster_datasource(parameters const& params)
if (srid_ == 0)
{
const char* srid_c = rs->getValue("srid");
if (srid_c != NULL)
if (srid_c != nullptr)
{
int result = 0;
const char * end = srid_c + std::strlen(srid_c);
@ -291,13 +291,13 @@ pgraster_datasource::pgraster_datasource(parameters const& params)
s.str("");
s << "SELECT ST_SRID(\"" << geometryColumn_ << "\") AS srid FROM "
<< populate_tokens(table_) << " WHERE \"" << geometryColumn_ << "\" IS NOT NULL LIMIT 1;";
<< populate_tokens(table_) << " WHERE \"" << geometryColumn_ << "\" IS NOT nullptr LIMIT 1;";
shared_ptr<ResultSet> rs = conn->executeQuery(s.str());
if (rs->next())
{
const char* srid_c = rs->getValue("srid");
if (srid_c != NULL)
if (srid_c != nullptr)
{
int result = 0;
const char * end = srid_c + std::strlen(srid_c);

View file

@ -66,7 +66,7 @@ read_uint16(const uint8_t** from, uint8_t littleEndian) {
/*
int16_t
read_int16(const uint8_t** from, uint8_t littleEndian) {
assert(NULL != from);
assert(nullptr != from);
return read_uint16(from, littleEndian);
}

View file

@ -105,7 +105,7 @@ bool freetype_engine::register_font_impl(std::string const& file_name,
streamRec.size = file.size();
streamRec.descriptor.pointer = file.get();
streamRec.read = ft_read_cb;
streamRec.close = NULL;
streamRec.close = nullptr;
args.flags = FT_OPEN_STREAM;
args.stream = &streamRec;
int num_faces = 0;
@ -269,7 +269,7 @@ bool freetype_engine::can_open(std::string const& face_name,
streamRec.size = file.size();
streamRec.descriptor.pointer = file.get();
streamRec.read = ft_read_cb;
streamRec.close = NULL;
streamRec.close = nullptr;
args.flags = FT_OPEN_STREAM;
args.stream = &streamRec;
// -1 is used to quickly check if the font file appears valid without iterating each face

View file

@ -108,7 +108,7 @@ void * PluginInfo::get_symbol(std::string const& sym_name) const
#ifdef MAPNIK_SUPPORTS_DLOPEN
return static_cast<void *>(dlsym(module_->dl, sym_name.c_str()));
#else
return NULL;
return nullptr;
#endif
}

View file

@ -124,7 +124,7 @@ unsigned int proj_transform::forward (geometry::line_string<double> & ls) const
geometry::point<double> * ptr = ls.data();
double * x = reinterpret_cast<double*>(ptr);
double * y = x + 1;
double * z = NULL;
double * z = nullptr;
if(!forward(x, y, z, size, 2))
{
return size;
@ -264,7 +264,7 @@ unsigned int proj_transform::backward (geometry::line_string<double> & ls) const
geometry::point<double> * ptr = ls.data();
double * x = reinterpret_cast<double*>(ptr);
double * y = x + 1;
double * z = NULL;
double * z = nullptr;
if(!backward(x, y, z, size, 2))
{
return size;