Use nullptr instead of NULL
diff --git a/util/ansi-print.cc b/util/ansi-print.cc
index e0ce7b3..0daee1f 100644
--- a/util/ansi-print.cc
+++ b/util/ansi-print.cc
@@ -353,7 +353,7 @@
} else
qs += quad[i][j];
if (qs < score) {
- const char *c = NULL;
+ const char *c = nullptr;
bool inv = false;
switch (q) {
case 1: c = "▟"; inv = true; break;
diff --git a/util/hb-fc.cc b/util/hb-fc.cc
index e99b1ae..cb89991 100644
--- a/util/hb-fc.cc
+++ b/util/hb-fc.cc
@@ -82,7 +82,7 @@
{
hb_font_funcs_t *newfuncs = hb_font_funcs_create ();
- hb_font_funcs_set_glyph_func (newfuncs, hb_fc_get_glyph, NULL, NULL);
+ hb_font_funcs_set_glyph_func (newfuncs, hb_fc_get_glyph, nullptr, nullptr);
/* XXX MT-unsafe */
if (fc_ffuncs)
@@ -121,7 +121,7 @@
hb_bool_t
hb_fc_can_render (hb_font_t *font, const char *text)
{
- static const char *ot[] = {"ot", NULL};
+ static const char *ot[] = {"ot", nullptr};
hb_buffer_t *buffer = hb_buffer_create ();
hb_buffer_add_utf8 (buffer, text, -1, 0, -1);
@@ -132,7 +132,7 @@
* Might be better to force generic shaper perhaps. */
hb_buffer_guess_segment_properties (buffer);
- if (!hb_shape_full (font, buffer, NULL, 0, ot))
+ if (!hb_shape_full (font, buffer, nullptr, 0, ot))
abort (); /* hb-ot shaper not enabled? */
unsigned int len;
diff --git a/util/hb-ot-shape-closure.cc b/util/hb-ot-shape-closure.cc
index be71a89..77ca201 100644
--- a/util/hb-ot-shape-closure.cc
+++ b/util/hb-ot-shape-closure.cc
@@ -43,8 +43,8 @@
{
GOptionEntry entries[] =
{
- {"no-glyph-names", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &this->show_glyph_names, "Use glyph indices instead of names", NULL},
- {NULL}
+ {"no-glyph-names", 0, G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &this->show_glyph_names, "Use glyph indices instead of names", nullptr},
+ {nullptr}
};
parser->add_group (entries,
"format",
@@ -93,11 +93,11 @@
{
printf ("\n");
hb_font_destroy (font);
- font = NULL;
+ font = nullptr;
hb_set_destroy (glyphs);
- glyphs = NULL;
+ glyphs = nullptr;
hb_buffer_destroy (buffer);
- buffer = NULL;
+ buffer = nullptr;
}
bool failed;
diff --git a/util/hb-shape.cc b/util/hb-shape.cc
index 84931da..dc9f446 100644
--- a/util/hb-shape.cc
+++ b/util/hb-shape.cc
@@ -33,16 +33,16 @@
output_buffer_t (option_parser_t *parser)
: options (parser, hb_buffer_serialize_list_formats ()),
format (parser),
- gs (NULL),
+ gs (nullptr),
line_no (0),
- font (NULL),
+ font (nullptr),
output_format (HB_BUFFER_SERIALIZE_FORMAT_INVALID),
format_flags (HB_BUFFER_SERIALIZE_FLAG_DEFAULT) {}
void init (hb_buffer_t *buffer, const font_options_t *font_opts)
{
options.get_file_handle ();
- gs = g_string_new (NULL);
+ gs = g_string_new (nullptr);
line_no = 0;
font = hb_font_reference (font_opts->get_font ());
@@ -79,7 +79,7 @@
format_flags = (hb_buffer_serialize_flags_t) flags;
if (format.trace)
- hb_buffer_set_message_func (buffer, message_func, this, NULL);
+ hb_buffer_set_message_func (buffer, message_func, this, nullptr);
}
void new_line (void)
{
@@ -112,11 +112,11 @@
}
void finish (hb_buffer_t *buffer, const font_options_t *font_opts)
{
- hb_buffer_set_message_func (buffer, NULL, NULL, NULL);
+ hb_buffer_set_message_func (buffer, nullptr, nullptr, nullptr);
hb_font_destroy (font);
g_string_free (gs, true);
- gs = NULL;
- font = NULL;
+ gs = nullptr;
+ font = nullptr;
}
static hb_bool_t
diff --git a/util/helper-cairo.cc b/util/helper-cairo.cc
index 2e2952b..aac4171 100644
--- a/util/helper-cairo.cc
+++ b/util/helper-cairo.cc
@@ -79,7 +79,7 @@
/* We cannot use the FT_Face from hb_font_t, as doing so will confuse hb_font_t because
* cairo will reset the face size. As such, create new face...
* TODO Perhaps add API to hb-ft to encapsulate this code. */
- FT_Face ft_face = NULL;//hb_ft_font_get_face (font);
+ FT_Face ft_face = nullptr;//hb_ft_font_get_face (font);
if (!ft_face)
{
if (!ft_library)
@@ -325,7 +325,7 @@
"eps",
#endif
#endif
- NULL
+ nullptr
};
cairo_t *
@@ -337,12 +337,12 @@
cairo_surface_t *(*constructor) (cairo_write_func_t write_func,
void *closure,
double width,
- double height) = NULL;
+ double height) = nullptr;
cairo_surface_t *(*constructor2) (cairo_write_func_t write_func,
void *closure,
double width,
double height,
- cairo_content_t content) = NULL;
+ cairo_content_t content) = nullptr;
const char *extension = out_opts->output_format;
if (!extension) {
@@ -471,8 +471,8 @@
memset (l, 0, sizeof (*l));
l->num_glyphs = hb_buffer_get_length (buffer);
- hb_glyph_info_t *hb_glyph = hb_buffer_get_glyph_infos (buffer, NULL);
- hb_glyph_position_t *hb_position = hb_buffer_get_glyph_positions (buffer, NULL);
+ hb_glyph_info_t *hb_glyph = hb_buffer_get_glyph_infos (buffer, nullptr);
+ hb_glyph_position_t *hb_position = hb_buffer_get_glyph_positions (buffer, nullptr);
l->glyphs = cairo_glyph_allocate (l->num_glyphs + 1);
if (text) {
diff --git a/util/main-font-text.hh b/util/main-font-text.hh
index 51f1627..53478e7 100644
--- a/util/main-font-text.hh
+++ b/util/main-font-text.hh
@@ -35,9 +35,9 @@
locale_to_utf8 (char *s)
{
char *t;
- GError *error = NULL;
+ GError *error = nullptr;
- t = g_locale_to_utf8 (s, -1, NULL, NULL, &error);
+ t = g_locale_to_utf8 (s, -1, nullptr, nullptr, &error);
if (!t)
{
fail (true, "Failed converting text to UTF-8");
diff --git a/util/options.cc b/util/options.cc
index 5b0fb14..263d477 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -70,7 +70,7 @@
static gchar *
shapers_to_string (void)
{
- GString *shapers = g_string_new (NULL);
+ GString *shapers = g_string_new (nullptr);
const char **shaper_list = hb_shape_list_shapers ();
for (; *shaper_list; shaper_list++) {
@@ -106,11 +106,11 @@
GOptionEntry entries[] =
{
{"version", 0, G_OPTION_FLAG_NO_ARG,
- G_OPTION_ARG_CALLBACK, (gpointer) &show_version, "Show version numbers", NULL},
- {"debug", 0, 0, G_OPTION_ARG_NONE, &debug, "Free all resources before exit", NULL},
- {NULL}
+ G_OPTION_ARG_CALLBACK, (gpointer) &show_version, "Show version numbers", nullptr},
+ {"debug", 0, 0, G_OPTION_ARG_NONE, &debug, "Free all resources before exit", nullptr},
+ {nullptr}
};
- g_option_context_add_main_entries (context, entries, NULL);
+ g_option_context_add_main_entries (context, entries, nullptr);
}
static gboolean
@@ -121,7 +121,7 @@
{
option_group_t *option_group = (option_group_t *) data;
option_group->pre_parse (error);
- return *error == NULL;
+ return *error == nullptr;
}
static gboolean
@@ -132,7 +132,7 @@
{
option_group_t *option_group = static_cast<option_group_t *>(data);
option_group->post_parse (error);
- return *error == NULL;
+ return *error == nullptr;
}
void
@@ -143,7 +143,7 @@
option_group_t *option_group)
{
GOptionGroup *group = g_option_group_new (name, description, help_description,
- static_cast<gpointer>(option_group), NULL);
+ static_cast<gpointer>(option_group), nullptr);
g_option_group_add_entries (group, entries);
g_option_group_set_parse_hooks (group, pre_parse, post_parse);
g_option_context_add_group (context, group);
@@ -154,10 +154,10 @@
{
setlocale (LC_ALL, "");
- GError *parse_error = NULL;
+ GError *parse_error = nullptr;
if (!g_option_context_parse (context, argc, argv, &parse_error))
{
- if (parse_error != NULL) {
+ if (parse_error != nullptr) {
fail (true, "%s", parse_error->message);
//g_error_free (parse_error);
} else
@@ -225,7 +225,7 @@
shape_opts->num_features = 0;
g_free (shape_opts->features);
- shape_opts->features = NULL;
+ shape_opts->features = nullptr;
if (!*s)
return true;
@@ -250,7 +250,7 @@
char *end = strchr (p, ',');
if (hb_feature_from_string (p, end ? end - p : -1, &shape_opts->features[shape_opts->num_features]))
shape_opts->num_features++;
- p = end ? end + 1 : NULL;
+ p = end ? end + 1 : nullptr;
}
return true;
@@ -268,7 +268,7 @@
font_opts->num_variations = 0;
g_free (font_opts->variations);
- font_opts->variations = NULL;
+ font_opts->variations = nullptr;
if (!*s)
return true;
@@ -293,7 +293,7 @@
char *end = strchr (p, ',');
if (hb_variation_from_string (p, end ? end - p : -1, &font_opts->variations[font_opts->num_variations]))
font_opts->num_variations++;
- p = end ? end + 1 : NULL;
+ p = end ? end + 1 : nullptr;
}
return true;
@@ -334,7 +334,7 @@
return false;
}
- GString *gs = g_string_new (NULL);
+ GString *gs = g_string_new (nullptr);
char *s = (char *) arg;
char *p;
@@ -367,12 +367,12 @@
{
GOptionEntry entries[] =
{
- {"annotate", 0, 0, G_OPTION_ARG_NONE, &this->annotate, "Annotate output rendering", NULL},
+ {"annotate", 0, 0, G_OPTION_ARG_NONE, &this->annotate, "Annotate output rendering", nullptr},
{"background", 0, 0, G_OPTION_ARG_STRING, &this->back, "Set background color (default: " DEFAULT_BACK ")", "rrggbb/rrggbbaa"},
{"foreground", 0, 0, G_OPTION_ARG_STRING, &this->fore, "Set foreground color (default: " DEFAULT_FORE ")", "rrggbb/rrggbbaa"},
{"line-space", 0, 0, G_OPTION_ARG_DOUBLE, &this->line_space, "Set space between lines (default: 0)", "units"},
{"margin", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_margin, "Margin around output (default: " G_STRINGIFY(DEFAULT_MARGIN) ")","one to four numbers"},
- {NULL}
+ {nullptr}
};
parser->add_group (entries,
"view",
@@ -387,22 +387,22 @@
GOptionEntry entries[] =
{
{"list-shapers", 0, G_OPTION_FLAG_NO_ARG,
- G_OPTION_ARG_CALLBACK, (gpointer) &list_shapers, "List available shapers and quit", NULL},
+ G_OPTION_ARG_CALLBACK, (gpointer) &list_shapers, "List available shapers and quit", nullptr},
{"shaper", 0, G_OPTION_FLAG_HIDDEN,
- G_OPTION_ARG_CALLBACK, (gpointer) &parse_shapers, "Hidden duplicate of --shapers", NULL},
+ G_OPTION_ARG_CALLBACK, (gpointer) &parse_shapers, "Hidden duplicate of --shapers", nullptr},
{"shapers", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_shapers, "Set comma-separated list of shapers to try","list"},
{"direction", 0, 0, G_OPTION_ARG_STRING, &this->direction, "Set text direction (default: auto)", "ltr/rtl/ttb/btt"},
{"language", 0, 0, G_OPTION_ARG_STRING, &this->language, "Set text language (default: $LANG)", "langstr"},
{"script", 0, 0, G_OPTION_ARG_STRING, &this->script, "Set text script (default: auto)", "ISO-15924 tag"},
- {"bot", 0, 0, G_OPTION_ARG_NONE, &this->bot, "Treat text as beginning-of-paragraph", NULL},
- {"eot", 0, 0, G_OPTION_ARG_NONE, &this->eot, "Treat text as end-of-paragraph", NULL},
- {"preserve-default-ignorables",0, 0, G_OPTION_ARG_NONE, &this->preserve_default_ignorables, "Preserve Default-Ignorable characters", NULL},
- {"utf8-clusters", 0, 0, G_OPTION_ARG_NONE, &this->utf8_clusters, "Use UTF8 byte indices, not char indices", NULL},
+ {"bot", 0, 0, G_OPTION_ARG_NONE, &this->bot, "Treat text as beginning-of-paragraph", nullptr},
+ {"eot", 0, 0, G_OPTION_ARG_NONE, &this->eot, "Treat text as end-of-paragraph", nullptr},
+ {"preserve-default-ignorables",0, 0, G_OPTION_ARG_NONE, &this->preserve_default_ignorables, "Preserve Default-Ignorable characters", nullptr},
+ {"utf8-clusters", 0, 0, G_OPTION_ARG_NONE, &this->utf8_clusters, "Use UTF8 byte indices, not char indices", nullptr},
{"cluster-level", 0, 0, G_OPTION_ARG_INT, &this->cluster_level, "Cluster merging level (default: 0)", "0/1/2"},
- {"normalize-glyphs",0, 0, G_OPTION_ARG_NONE, &this->normalize_glyphs, "Rearrange glyph clusters in nominal order", NULL},
- {"verify", 0, 0, G_OPTION_ARG_NONE, &this->verify, "Perform sanity checks on shaping results", NULL},
+ {"normalize-glyphs",0, 0, G_OPTION_ARG_NONE, &this->normalize_glyphs, "Rearrange glyph clusters in nominal order", nullptr},
+ {"verify", 0, 0, G_OPTION_ARG_NONE, &this->verify, "Perform sanity checks on shaping results", nullptr},
{"num-iterations", 0, 0, G_OPTION_ARG_INT, &this->num_iterations, "Run shaper N times (default: 1)", "N"},
- {NULL}
+ {nullptr}
};
parser->add_group (entries,
"shape",
@@ -449,7 +449,7 @@
GOptionEntry entries2[] =
{
{"features", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_features, features_help, "list"},
- {NULL}
+ {nullptr}
};
parser->add_group (entries2,
"features",
@@ -483,12 +483,12 @@
void
font_options_t::add_options (option_parser_t *parser)
{
- char *text = NULL;
+ char *text = nullptr;
{
static_assert ((ARRAY_LENGTH_CONST (supported_font_funcs) > 0),
"No supported font-funcs found.");
- GString *s = g_string_new (NULL);
+ GString *s = g_string_new (nullptr);
g_string_printf (s, "Set font functions implementation to use (default: %s)\n\n Supported font function implementations are: %s",
supported_font_funcs[0].name,
supported_font_funcs[0].name);
@@ -517,7 +517,7 @@
{"font-size", 0, default_font_size ? 0 : G_OPTION_FLAG_HIDDEN,
G_OPTION_ARG_CALLBACK, (gpointer) &parse_font_size, font_size_text, "1/2 numbers or 'upem'"},
{"font-funcs", 0, 0, G_OPTION_ARG_STRING, &this->font_funcs, text, "impl"},
- {NULL}
+ {nullptr}
};
parser->add_group (entries,
"font",
@@ -540,7 +540,7 @@
GOptionEntry entries2[] =
{
{"variations", 0, 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_variations, variations_help, "list"},
- {NULL}
+ {nullptr}
};
parser->add_group (entries2,
"variations",
@@ -559,7 +559,7 @@
{"unicodes", 'u', 0, G_OPTION_ARG_CALLBACK, (gpointer) &parse_unicodes, "Set input Unicode codepoints", "list of hex numbers"},
{"text-before", 0, 0, G_OPTION_ARG_STRING, &this->text_before, "Set text context before each line", "string"},
{"text-after", 0, 0, G_OPTION_ARG_STRING, &this->text_after, "Set text context after each line", "string"},
- {NULL}
+ {nullptr}
};
parser->add_group (entries,
"text",
@@ -573,7 +573,7 @@
{
const char *text;
- if (NULL == supported_formats)
+ if (nullptr == supported_formats)
text = "Set output serialization format";
else
{
@@ -587,7 +587,7 @@
{
{"output-file", 'o', 0, G_OPTION_ARG_STRING, &this->output_file, "Set output file-name (default: stdout)","filename"},
{"output-format", 'O', 0, G_OPTION_ARG_STRING, &this->output_format, text, "format"},
- {NULL}
+ {nullptr}
};
parser->add_group (entries,
"output",
@@ -604,7 +604,7 @@
if (font)
return font;
- hb_blob_t *blob = NULL;
+ hb_blob_t *blob = nullptr;
/* Create the blob */
{
@@ -620,7 +620,7 @@
if (0 == strcmp (font_file, "-")) {
/* read it */
- GString *gs = g_string_new (NULL);
+ GString *gs = g_string_new (nullptr);
char buf[BUFSIZ];
#if defined(_WIN32) || defined(__CYGWIN__)
setmode (fileno (stdin), O_BINARY);
@@ -638,7 +638,7 @@
destroy = (hb_destroy_func_t) g_free;
mm = HB_MEMORY_MODE_WRITABLE;
} else {
- GError *error = NULL;
+ GError *error = nullptr;
GMappedFile *mf = g_mapped_file_new (font_file, false, &error);
if (mf) {
font_data = g_mapped_file_get_contents (mf);
@@ -657,7 +657,7 @@
/* GMappedFile is buggy, it doesn't fail if file isn't regular.
* Try reading.
* https://bugzilla.gnome.org/show_bug.cgi?id=659212 */
- GError *error = NULL;
+ GError *error = nullptr;
gsize l;
if (g_file_get_contents (font_file, &font_data, &l, &error)) {
len = l;
@@ -696,7 +696,7 @@
hb_font_set_variations (font, variations, num_variations);
- void (*set_font_funcs) (hb_font_t *) = NULL;
+ void (*set_font_funcs) (hb_font_t *) = nullptr;
if (!font_funcs)
{
set_font_funcs = supported_font_funcs[0].func;
@@ -711,7 +711,7 @@
}
if (!set_font_funcs)
{
- GString *s = g_string_new (NULL);
+ GString *s = g_string_new (nullptr);
for (unsigned int i = 0; i < ARRAY_LENGTH (supported_font_funcs); i++)
{
if (i)
@@ -742,7 +742,7 @@
if (!line_len) {
*len = 0;
- return NULL;
+ return nullptr;
}
const char *ret = line;
@@ -775,7 +775,7 @@
fail (false, "Failed opening text file `%s': %s",
text_file, strerror (errno));
- gs = g_string_new (NULL);
+ gs = g_string_new (nullptr);
}
g_string_set_size (gs, 0);
@@ -793,7 +793,7 @@
fail (false, "Failed reading text: %s",
strerror (errno));
*len = gs->len;
- return !*len && feof (fp) ? NULL : gs->str;
+ return !*len && feof (fp) ? nullptr : gs->str;
}
@@ -834,21 +834,21 @@
{
GOptionEntry entries[] =
{
- {"show-text", 0, 0, G_OPTION_ARG_NONE, &this->show_text, "Prefix each line of output with its corresponding input text", NULL},
- {"show-unicode", 0, 0, G_OPTION_ARG_NONE, &this->show_unicode, "Prefix each line of output with its corresponding input codepoint(s)", NULL},
- {"show-line-num", 0, 0, G_OPTION_ARG_NONE, &this->show_line_num, "Prefix each line of output with its corresponding input line number", NULL},
+ {"show-text", 0, 0, G_OPTION_ARG_NONE, &this->show_text, "Prefix each line of output with its corresponding input text", nullptr},
+ {"show-unicode", 0, 0, G_OPTION_ARG_NONE, &this->show_unicode, "Prefix each line of output with its corresponding input codepoint(s)", nullptr},
+ {"show-line-num", 0, 0, G_OPTION_ARG_NONE, &this->show_line_num, "Prefix each line of output with its corresponding input line number", nullptr},
{"verbose", 'v', G_OPTION_FLAG_NO_ARG,
- G_OPTION_ARG_CALLBACK, (gpointer) &parse_verbose, "Prefix each line of output with all of the above", NULL},
+ G_OPTION_ARG_CALLBACK, (gpointer) &parse_verbose, "Prefix each line of output with all of the above", nullptr},
{"no-glyph-names", 0, G_OPTION_FLAG_REVERSE,
- G_OPTION_ARG_NONE, &this->show_glyph_names, "Output glyph indices instead of names", NULL},
+ G_OPTION_ARG_NONE, &this->show_glyph_names, "Output glyph indices instead of names", nullptr},
{"no-positions", 0, G_OPTION_FLAG_REVERSE,
- G_OPTION_ARG_NONE, &this->show_positions, "Do not output glyph positions", NULL},
+ G_OPTION_ARG_NONE, &this->show_positions, "Do not output glyph positions", nullptr},
{"no-clusters", 0, G_OPTION_FLAG_REVERSE,
- G_OPTION_ARG_NONE, &this->show_clusters, "Do not output cluster indices", NULL},
- {"show-extents", 0, 0, G_OPTION_ARG_NONE, &this->show_extents, "Output glyph extents", NULL},
- {"show-flags", 0, 0, G_OPTION_ARG_NONE, &this->show_flags, "Output glyph flags", NULL},
- {"trace", 'V', 0, G_OPTION_ARG_NONE, &this->trace, "Output interim shaping results", NULL},
- {NULL}
+ G_OPTION_ARG_NONE, &this->show_clusters, "Do not output cluster indices", nullptr},
+ {"show-extents", 0, 0, G_OPTION_ARG_NONE, &this->show_extents, "Output glyph extents", nullptr},
+ {"show-flags", 0, 0, G_OPTION_ARG_NONE, &this->show_flags, "Output glyph flags", nullptr},
+ {"trace", 'V', 0, G_OPTION_ARG_NONE, &this->trace, "Output interim shaping results", nullptr},
+ {nullptr}
};
parser->add_group (entries,
"output-syntax",
@@ -865,7 +865,7 @@
GString *gs)
{
unsigned int num_glyphs = hb_buffer_get_length (buffer);
- hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, NULL);
+ hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, nullptr);
g_string_append_c (gs, '<');
for (unsigned int i = 0; i < num_glyphs; i++)
diff --git a/util/options.hh b/util/options.hh
index 60fc633..c2f37dc 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -90,7 +90,7 @@
}
~option_parser_t (void) {
g_option_context_free (context);
- g_ptr_array_foreach (to_free, (GFunc) g_free, NULL);
+ g_ptr_array_foreach (to_free, (GFunc) g_free, nullptr);
g_ptr_array_free (to_free, TRUE);
}
@@ -130,8 +130,8 @@
{
view_options_t (option_parser_t *parser) {
annotate = false;
- fore = NULL;
- back = NULL;
+ fore = nullptr;
+ back = nullptr;
line_space = 0;
margin.t = margin.r = margin.b = margin.l = DEFAULT_MARGIN;
@@ -159,11 +159,11 @@
{
shape_options_t (option_parser_t *parser)
{
- direction = language = script = NULL;
+ direction = language = script = nullptr;
bot = eot = preserve_default_ignorables = false;
- features = NULL;
+ features = nullptr;
num_features = 0;
- shapers = NULL;
+ shapers = nullptr;
utf8_clusters = false;
cluster_level = HB_BUFFER_CLUSTER_LEVEL_DEFAULT;
normalize_glyphs = false;
@@ -222,7 +222,7 @@
/* Reset cluster values to refer to Unicode character index
* instead of UTF-8 index. */
unsigned int num_glyphs = hb_buffer_get_length (buffer);
- hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, NULL);
+ hb_glyph_info_t *info = hb_buffer_get_glyph_infos (buffer, nullptr);
for (unsigned int i = 0; i < num_glyphs; i++)
{
info->cluster = i;
@@ -233,9 +233,9 @@
setup_buffer (buffer);
}
- hb_bool_t shape (hb_font_t *font, hb_buffer_t *buffer, const char **error=NULL)
+ hb_bool_t shape (hb_font_t *font, hb_buffer_t *buffer, const char **error=nullptr)
{
- hb_buffer_t *text_buffer = NULL;
+ hb_buffer_t *text_buffer = nullptr;
if (verify)
{
text_buffer = hb_buffer_create ();
@@ -264,7 +264,7 @@
bool verify_buffer (hb_buffer_t *buffer,
hb_buffer_t *text_buffer,
hb_font_t *font,
- const char **error=NULL)
+ const char **error=nullptr)
{
if (!verify_buffer_monotone (buffer, error))
return false;
@@ -273,7 +273,7 @@
return true;
}
- bool verify_buffer_monotone (hb_buffer_t *buffer, const char **error=NULL)
+ bool verify_buffer_monotone (hb_buffer_t *buffer, const char **error=nullptr)
{
/* Check that clusters are monotone. */
if (cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES ||
@@ -300,7 +300,7 @@
bool verify_buffer_safe_to_break (hb_buffer_t *buffer,
hb_buffer_t *text_buffer,
hb_font_t *font,
- const char **error=NULL)
+ const char **error=nullptr)
{
if (cluster_level != HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES &&
cluster_level != HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS)
@@ -448,16 +448,16 @@
int default_font_size_,
unsigned int subpixel_bits_)
{
- variations = NULL;
+ variations = nullptr;
num_variations = 0;
default_font_size = default_font_size_;
subpixel_bits = subpixel_bits_;
- font_file = NULL;
+ font_file = nullptr;
face_index = 0;
font_size_x = font_size_y = default_font_size;
- font_funcs = NULL;
+ font_funcs = nullptr;
- font = NULL;
+ font = nullptr;
add_options (parser);
}
@@ -490,15 +490,15 @@
struct text_options_t : option_group_t
{
text_options_t (option_parser_t *parser) {
- text_before = NULL;
- text_after = NULL;
+ text_before = nullptr;
+ text_after = nullptr;
- text = NULL;
- text_file = NULL;
+ text = nullptr;
+ text_file = nullptr;
- fp = NULL;
- gs = NULL;
- line = NULL;
+ fp = nullptr;
+ gs = nullptr;
+ line = nullptr;
line_len = (unsigned int) -1;
add_options (parser);
@@ -541,13 +541,13 @@
struct output_options_t : option_group_t
{
output_options_t (option_parser_t *parser,
- const char **supported_formats_ = NULL) {
- output_file = NULL;
- output_format = NULL;
+ const char **supported_formats_ = nullptr) {
+ output_file = nullptr;
+ output_format = nullptr;
supported_formats = supported_formats_;
explicit_output_format = false;
- fp = NULL;
+ fp = nullptr;
add_options (parser);
}
@@ -575,7 +575,7 @@
}
if (output_file && 0 == strcmp (output_file, "-"))
- output_file = NULL; /* STDOUT */
+ output_file = nullptr; /* STDOUT */
}
FILE *get_file_handle (void);
diff --git a/util/shape-consumer.hh b/util/shape-consumer.hh
index 0a09053..1aa30cd 100644
--- a/util/shape-consumer.hh
+++ b/util/shape-consumer.hh
@@ -37,8 +37,8 @@
: failed (false),
shaper (parser),
output (parser),
- font (NULL),
- buffer (NULL) {}
+ font (nullptr),
+ buffer (nullptr) {}
void init (hb_buffer_t *buffer_,
const font_options_t *font_opts)
@@ -58,7 +58,7 @@
for (unsigned int n = shaper.num_iterations; n; n--)
{
- const char *error = NULL;
+ const char *error = nullptr;
shaper.populate_buffer (buffer, text, text_len, text_before, text_after);
if (n == 1)
@@ -80,9 +80,9 @@
{
output.finish (buffer, font_opts);
hb_font_destroy (font);
- font = NULL;
+ font = nullptr;
hb_buffer_destroy (buffer);
- buffer = NULL;
+ buffer = nullptr;
}
public: