test: Use nullptr in C++ code. (#1744)

This commit is contained in:
Bruce Mitchener 2019-06-03 15:00:25 +07:00 committed by Ebrahim Byagowi
parent 7c14b90145
commit 5846884f86
4 changed files with 9 additions and 9 deletions

View File

@ -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); unsigned glyph_count = hb_face_get_glyph_count (face);
for (hb_codepoint_t gid = 0; gid < glyph_count; ++gid) 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) if (!num_layers)
continue; 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); unsigned int palette_count = hb_ot_color_palette_get_count (face);
for (unsigned int palette = 0; palette < palette_count; palette++) 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) if (!num_colors)
continue; continue;
@ -271,14 +271,14 @@ main (int argc, char **argv)
FILE *font_name_file = fopen ("out/.dumped_font_name", "r"); 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"); fprintf (stderr, "Purge or move ./out folder in order to run a new dump\n");
exit (1); exit (1);
} }
font_name_file = fopen ("out/.dumped_font_name", "w"); 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"); fprintf (stderr, "./out is not accessible as a folder, create it please\n");
exit (1); exit (1);

View File

@ -10,7 +10,7 @@
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{ {
hb_blob_t *blob = hb_blob_create ((const char *)data, 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_face_t *face = hb_face_create (blob, 0);
hb_font_t *font = hb_font_create (face); hb_font_t *font = hb_font_create (face);
hb_ot_font_set_funcs (font); 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_t *buffer = hb_buffer_create ();
hb_buffer_add_utf8 (buffer, text, -1, 0, -1); hb_buffer_add_utf8 (buffer, text, -1, 0, -1);
hb_buffer_guess_segment_properties (buffer); hb_buffer_guess_segment_properties (buffer);
hb_shape (font, buffer, NULL, 0); hb_shape (font, buffer, nullptr, 0);
hb_buffer_destroy (buffer); 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_t *buffer = hb_buffer_create ();
hb_buffer_add_utf32 (buffer, text32, sizeof (text32) / sizeof (text32[0]), 0, -1); hb_buffer_add_utf32 (buffer, text32, sizeof (text32) / sizeof (text32[0]), 0, -1);
hb_buffer_guess_segment_properties (buffer); hb_buffer_guess_segment_properties (buffer);
hb_shape (font, buffer, NULL, 0); hb_shape (font, buffer, nullptr, 0);
hb_buffer_destroy (buffer); hb_buffer_destroy (buffer);
/* Misc calls on face. */ /* Misc calls on face. */

View File

@ -53,7 +53,7 @@ trySubset (hb_face_t *face,
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{ {
hb_blob_t *blob = hb_blob_create ((const char *)data, 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_face_t *face = hb_face_create (blob, 0);
/* Just test this API here quickly. */ /* Just test this API here quickly. */

View File

@ -115,7 +115,7 @@ parse_drop_tables (const char *name,
else else
hb_set_del (drop_tables, tag); hb_set_del (drop_tables, tag);
s = strtok(NULL, ", "); s = strtok(nullptr, ", ");
} }
return true; return true;