From 5846884f86cae61c1b0c369c81427712fb97ed83 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Mon, 3 Jun 2019 15:00:25 +0700 Subject: [PATCH] test: Use nullptr in C++ code. (#1744) --- src/test-ot-color.cc | 8 ++++---- test/fuzzing/hb-shape-fuzzer.cc | 6 +++--- test/fuzzing/hb-subset-fuzzer.cc | 2 +- util/options-subset.cc | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/test-ot-color.cc b/src/test-ot-color.cc index 4050a664d..26931fed3 100644 --- a/src/test-ot-color.cc +++ b/src/test-ot-color.cc @@ -133,7 +133,7 @@ layered_glyph_dump (hb_face_t *face, cairo_font_face_t *cairo_face, unsigned int unsigned glyph_count = hb_face_get_glyph_count (face); for (hb_codepoint_t gid = 0; gid < glyph_count; ++gid) { - unsigned int num_layers = hb_ot_color_glyph_get_layers (face, gid, 0, NULL, NULL); + unsigned int num_layers = hb_ot_color_glyph_get_layers (face, gid, 0, nullptr, nullptr); if (!num_layers) continue; @@ -169,7 +169,7 @@ layered_glyph_dump (hb_face_t *face, cairo_font_face_t *cairo_face, unsigned int unsigned int palette_count = hb_ot_color_palette_get_count (face); for (unsigned int palette = 0; palette < palette_count; palette++) { - unsigned int num_colors = hb_ot_color_palette_get_colors (face, palette, 0, NULL, NULL); + unsigned int num_colors = hb_ot_color_palette_get_colors (face, palette, 0, nullptr, nullptr); if (!num_colors) continue; @@ -271,14 +271,14 @@ main (int argc, char **argv) FILE *font_name_file = fopen ("out/.dumped_font_name", "r"); - if (font_name_file != NULL) + if (font_name_file != nullptr) { fprintf (stderr, "Purge or move ./out folder in order to run a new dump\n"); exit (1); } font_name_file = fopen ("out/.dumped_font_name", "w"); - if (font_name_file == NULL) + if (font_name_file == nullptr) { fprintf (stderr, "./out is not accessible as a folder, create it please\n"); exit (1); diff --git a/test/fuzzing/hb-shape-fuzzer.cc b/test/fuzzing/hb-shape-fuzzer.cc index 5723db90c..64a6b12df 100644 --- a/test/fuzzing/hb-shape-fuzzer.cc +++ b/test/fuzzing/hb-shape-fuzzer.cc @@ -10,7 +10,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { hb_blob_t *blob = hb_blob_create ((const char *)data, size, - HB_MEMORY_MODE_READONLY, NULL, NULL); + HB_MEMORY_MODE_READONLY, nullptr, nullptr); hb_face_t *face = hb_face_create (blob, 0); hb_font_t *font = hb_font_create (face); hb_ot_font_set_funcs (font); @@ -21,7 +21,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) hb_buffer_t *buffer = hb_buffer_create (); hb_buffer_add_utf8 (buffer, text, -1, 0, -1); hb_buffer_guess_segment_properties (buffer); - hb_shape (font, buffer, NULL, 0); + hb_shape (font, buffer, nullptr, 0); hb_buffer_destroy (buffer); } @@ -34,7 +34,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) hb_buffer_t *buffer = hb_buffer_create (); hb_buffer_add_utf32 (buffer, text32, sizeof (text32) / sizeof (text32[0]), 0, -1); hb_buffer_guess_segment_properties (buffer); - hb_shape (font, buffer, NULL, 0); + hb_shape (font, buffer, nullptr, 0); hb_buffer_destroy (buffer); /* Misc calls on face. */ diff --git a/test/fuzzing/hb-subset-fuzzer.cc b/test/fuzzing/hb-subset-fuzzer.cc index 42ef0071e..73c95b2a6 100644 --- a/test/fuzzing/hb-subset-fuzzer.cc +++ b/test/fuzzing/hb-subset-fuzzer.cc @@ -53,7 +53,7 @@ trySubset (hb_face_t *face, extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { hb_blob_t *blob = hb_blob_create ((const char *)data, size, - HB_MEMORY_MODE_READONLY, NULL, NULL); + HB_MEMORY_MODE_READONLY, nullptr, nullptr); hb_face_t *face = hb_face_create (blob, 0); /* Just test this API here quickly. */ diff --git a/util/options-subset.cc b/util/options-subset.cc index f5c2229e1..b2f4db087 100644 --- a/util/options-subset.cc +++ b/util/options-subset.cc @@ -115,7 +115,7 @@ parse_drop_tables (const char *name, else hb_set_del (drop_tables, tag); - s = strtok(NULL, ", "); + s = strtok(nullptr, ", "); } return true;