diff --git a/emscripten/main.cpp b/emscripten/main.cpp index 4565a67d5..ffdef046b 100644 --- a/emscripten/main.cpp +++ b/emscripten/main.cpp @@ -28,7 +28,7 @@ public: } int width, height; - emscripten_get_canvas_size(&width, &height, NULL); + emscripten_get_canvas_size(&width, &height, nullptr); glfwSetMousePosCallback(mousemove); glfwSetMouseButtonCallback(mouseclick); diff --git a/include/llmr/geometry/vao.hpp b/include/llmr/geometry/vao.hpp index 6d710d831..49401e01d 100644 --- a/include/llmr/geometry/vao.hpp +++ b/include/llmr/geometry/vao.hpp @@ -42,7 +42,7 @@ private: // For debug reasons, we're storing the bind information so that we can // detect errors and report - void *buffer_ptr = NULL; + void *buffer_ptr = nullptr; char *offset_ptr = 0; }; diff --git a/include/llmr/renderer/fill_bucket.hpp b/include/llmr/renderer/fill_bucket.hpp index e980125b1..209e164e8 100644 --- a/include/llmr/renderer/fill_bucket.hpp +++ b/include/llmr/renderer/fill_bucket.hpp @@ -10,7 +10,7 @@ #include #ifndef BUFFER_OFFSET -#define BUFFER_OFFSET(i) ((char *)NULL + (i)) +#define BUFFER_OFFSET(i) ((char *)nullptr + (i)) #endif namespace llmr { diff --git a/include/llmr/util/pbf.hpp b/include/llmr/util/pbf.hpp index 5585d5c15..526bc68d3 100644 --- a/include/llmr/util/pbf.hpp +++ b/include/llmr/util/pbf.hpp @@ -46,8 +46,8 @@ struct pbf { inline void skipValue(uint32_t val); inline void skipBytes(uint32_t bytes); - const uint8_t *data = NULL; - const uint8_t *end = NULL; + const uint8_t *data = nullptr; + const uint8_t *end = nullptr; uint32_t value = 0; uint32_t tag = 0; }; @@ -60,8 +60,8 @@ pbf::pbf(const unsigned char *data, uint32_t length) } pbf::pbf() - : data(NULL), - end(NULL), + : data(nullptr), + end(nullptr), value(0), tag(0) { } @@ -185,4 +185,3 @@ void pbf::skipBytes(uint32_t bytes) { } // end namespace llmr #endif - diff --git a/src/geometry/debug_font.cpp b/src/geometry/debug_font.cpp index 5682d5118..cbf6687d0 100644 --- a/src/geometry/debug_font.cpp +++ b/src/geometry/debug_font.cpp @@ -97,7 +97,7 @@ int8_t simplex_93[] = { 5, 25, 7, 24, 8, 23, 9, 21, 9, 19, 8, 17, 7, 16, 6, 14, int8_t simplex_94[] = { 3, 6, 3, 8, 4, 11, 6, 12, 8, 12, 10, 11, 14, 8, 16, 7, 18, 7, 20, 8, 21, 10, -1, -1, 3, 8, 4, 10, 6, 11, 8, 11, 10, 10, 14, 7, 16, 6, 18, 6, 20, 7, 21, 10, 21, 12 }; struct glyph { - glyph() : width(0), length(0), data(NULL) { } + glyph() : width(0), length(0), data(nullptr) { } glyph(uint8_t width, uint8_t length, int8_t *data) : width(width), length(length), @@ -110,7 +110,7 @@ struct glyph { // Font data From Hershey Simplex Font // http://paulbourke.net/dataformats/hershey/ std::map simplex = { - { ' ', { 16, 0, NULL } }, + { ' ', { 16, 0, nullptr } }, { '!', { 10, sizeof(simplex_1), simplex_1 } }, { '"', { 16, sizeof(simplex_2), simplex_2 } }, { '#', { 21, sizeof(simplex_3), simplex_3 } }, diff --git a/src/map/tile.cpp b/src/map/tile.cpp index b7cf468d0..f274d0244 100644 --- a/src/map/tile.cpp +++ b/src/map/tile.cpp @@ -77,7 +77,7 @@ void Tile::request() { } }, []() { // TODO: Make sure this gets passed the correct map ID/pointer. - platform::restart(NULL); + platform::restart(nullptr); }); } @@ -162,7 +162,7 @@ std::shared_ptr Tile::createBucket(const VectorTile& tile, const BucketD // The layer specified in the bucket does not exist. Do nothing. } - return NULL; + return nullptr; } std::shared_ptr Tile::createFillBucket(const VectorTileLayer& layer, const BucketDescription& bucket_desc) { diff --git a/src/renderer/line_bucket.cpp b/src/renderer/line_bucket.cpp index 6e95a7bc6..970f6ad38 100644 --- a/src/renderer/line_bucket.cpp +++ b/src/renderer/line_bucket.cpp @@ -10,7 +10,7 @@ #include #include -#define BUFFER_OFFSET(i) ((char *)NULL + (i)) +#define BUFFER_OFFSET(i) ((char *)nullptr + (i)) #include diff --git a/src/renderer/painter.cpp b/src/renderer/painter.cpp index 8ec633d9b..22cb58368 100644 --- a/src/renderer/painter.cpp +++ b/src/renderer/painter.cpp @@ -17,7 +17,7 @@ using namespace llmr; -#define BUFFER_OFFSET(i) ((char *)NULL + (i)) +#define BUFFER_OFFSET(i) ((char *)nullptr + (i)) Painter::Painter(Transform& transform, Settings& settings, Style& style) : transform(transform), diff --git a/src/style/sprite.cpp b/src/style/sprite.cpp index 3a481a5d7..675deb27e 100644 --- a/src/style/sprite.cpp +++ b/src/style/sprite.cpp @@ -129,7 +129,7 @@ void Sprite::loadImage(const std::string& data) { return; } - png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, errorHandler, warningHandler); + png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, errorHandler, warningHandler); assert(png); png_infop info = png_create_info_struct(png); @@ -140,7 +140,7 @@ void Sprite::loadImage(const std::string& data) { try { png_set_read_fn(png, (png_voidp)&buffer, readCallback); png_read_info(png, info); - png_get_IHDR(png, info, (png_uint_32*)&width, (png_uint_32*)&height, &depth, &color, &interlace, NULL, NULL); + png_get_IHDR(png, info, (png_uint_32*)&width, (png_uint_32*)&height, &depth, &color, &interlace, nullptr, nullptr); bool alpha = (color & PNG_COLOR_MASK_ALPHA) || png_get_valid(png, info, PNG_INFO_tRNS); // From http://trac.mapnik.org/browser/trunk/src/png_reader.cpp @@ -187,10 +187,10 @@ void Sprite::loadImage(const std::string& data) { // Read image data png_read_image(png, row_pointers); - png_read_end(png, NULL); + png_read_end(png, nullptr); } catch (std::exception& e) { fprintf(stderr, "loading PNG failed: %s\n", e.what()); - png_destroy_read_struct(&png, &info, NULL); + png_destroy_read_struct(&png, &info, nullptr); img.clear(); width = 0; height = 0;