From 0594a2448440208efa0acac9a5d8d52d43108289 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 5 Jun 2012 20:35:40 -0400 Subject: [PATCH] Cleanup TRUE/FALSE vs true/false --- src/hb-atomic-private.hh | 4 +-- src/hb-blob.cc | 28 +++++++-------- src/hb-buffer-private.hh | 2 +- src/hb-buffer.cc | 38 ++++++++++---------- src/hb-buffer.h | 4 +-- src/hb-fallback-shape.cc | 2 +- src/hb-font.cc | 22 ++++++------ src/hb-ft.cc | 22 ++++++------ src/hb-glib.cc | 16 ++++----- src/hb-graphite2.cc | 8 ++--- src/hb-icu.cc | 30 ++++++++-------- src/hb-ot-layout.cc | 28 +++++++-------- src/hb-ot-shape-complex-private.hh | 2 +- src/hb-ot-shape-normalize.cc | 16 ++++----- src/hb-ot-shape.cc | 4 +-- src/hb-private.hh | 18 ++++------ src/hb-set.cc | 2 +- src/hb-set.h | 2 +- src/hb-shape.cc | 6 ++-- src/hb-tt-font.cc | 12 +++---- src/hb-unicode.cc | 8 ++--- src/hb-uniscribe.cc | 18 +++++----- src/main.cc | 2 +- util/hb-shape.cc | 2 +- util/helper-cairo.cc | 16 ++++----- util/main-font-text.hh | 2 +- util/options.cc | 58 +++++++++++++++--------------- util/options.hh | 2 +- util/view-cairo.hh | 2 +- 29 files changed, 185 insertions(+), 191 deletions(-) diff --git a/src/hb-atomic-private.hh b/src/hb-atomic-private.hh index 0e7ecae09..918852d18 100644 --- a/src/hb-atomic-private.hh +++ b/src/hb-atomic-private.hh @@ -94,7 +94,7 @@ typedef volatile int hb_atomic_int_t; #define hb_atomic_int_add(AI, V) (((AI) += (V)) - (V)) #define hb_atomic_ptr_get(P) ((void *) *(P)) -#define hb_atomic_ptr_cmpexch(P,O,N) (* (void * volatile *) (P) == (void *) (O) ? (* (void * volatile *) (P) = (void *) (N), TRUE) : FALSE) +#define hb_atomic_ptr_cmpexch(P,O,N) (* (void * volatile *) (P) == (void *) (O) ? (* (void * volatile *) (P) = (void *) (N), true) : false) #else /* HB_NO_MT */ @@ -103,7 +103,7 @@ typedef int hb_atomic_int_t; #define hb_atomic_int_add(AI, V) (((AI) += (V)) - (V)) #define hb_atomic_ptr_get(P) ((void *) *(P)) -#define hb_atomic_ptr_cmpexch(P,O,N) (* (void **) (P) == (void *) (O) ? (* (void **) (P) = (void *) (N), TRUE) : FALSE) +#define hb_atomic_ptr_cmpexch(P,O,N) (* (void **) (P) == (void *) (O) ? (* (void **) (P) = (void *) (N), true) : false) #endif diff --git a/src/hb-blob.cc b/src/hb-blob.cc index 04de76222..f90f97e78 100644 --- a/src/hb-blob.cc +++ b/src/hb-blob.cc @@ -132,7 +132,7 @@ hb_blob_get_empty (void) static const hb_blob_t _hb_blob_nil = { HB_OBJECT_HEADER_STATIC, - TRUE, /* immutable */ + true, /* immutable */ NULL, /* data */ 0, /* length */ @@ -185,7 +185,7 @@ hb_blob_make_immutable (hb_blob_t *blob) if (hb_object_is_inert (blob)) return; - blob->immutable = TRUE; + blob->immutable = true; } hb_bool_t @@ -244,7 +244,7 @@ _try_make_writable_inplace_unix (hb_blob_t *blob) if ((uintptr_t) -1L == pagesize) { DEBUG_MSG_FUNC (BLOB, blob, "failed to get pagesize: %s", strerror (errno)); - return FALSE; + return false; } DEBUG_MSG_FUNC (BLOB, blob, "pagesize is %lu", (unsigned long) pagesize); @@ -256,7 +256,7 @@ _try_make_writable_inplace_unix (hb_blob_t *blob) addr, addr+length, (unsigned long) length); if (-1 == mprotect ((void *) addr, length, PROT_READ | PROT_WRITE)) { DEBUG_MSG_FUNC (BLOB, blob, "mprotect failed: %s", strerror (errno)); - return FALSE; + return false; } blob->mode = HB_MEMORY_MODE_WRITABLE; @@ -264,9 +264,9 @@ _try_make_writable_inplace_unix (hb_blob_t *blob) DEBUG_MSG_FUNC (BLOB, blob, "successfully made [%p..%p] (%lu bytes) writable\n", addr, addr+length, (unsigned long) length); - return TRUE; + return true; #else - return FALSE; + return false; #endif } @@ -276,29 +276,29 @@ _try_writable_inplace (hb_blob_t *blob) DEBUG_MSG_FUNC (BLOB, blob, "making writable inplace\n"); if (_try_make_writable_inplace_unix (blob)) - return TRUE; + return true; DEBUG_MSG_FUNC (BLOB, blob, "making writable -> FAILED\n"); /* Failed to make writable inplace, mark that */ blob->mode = HB_MEMORY_MODE_READONLY; - return FALSE; + return false; } static bool _try_writable (hb_blob_t *blob) { if (blob->immutable) - return FALSE; + return false; if (blob->mode == HB_MEMORY_MODE_WRITABLE) - return TRUE; + return true; if (blob->mode == HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE && _try_writable_inplace (blob)) - return TRUE; + return true; if (blob->mode == HB_MEMORY_MODE_WRITABLE) - return TRUE; + return true; DEBUG_MSG_FUNC (BLOB, blob, "current data is -> %p\n", blob->data); @@ -307,7 +307,7 @@ _try_writable (hb_blob_t *blob) new_data = (char *) malloc (blob->length); if (unlikely (!new_data)) - return FALSE; + return false; DEBUG_MSG_FUNC (BLOB, blob, "dupped successfully -> %p\n", blob->data); @@ -318,7 +318,7 @@ _try_writable (hb_blob_t *blob) blob->user_data = new_data; blob->destroy = free; - return TRUE; + return true; } diff --git a/src/hb-buffer-private.hh b/src/hb-buffer-private.hh index e9e0f822b..fb1c80120 100644 --- a/src/hb-buffer-private.hh +++ b/src/hb-buffer-private.hh @@ -149,7 +149,7 @@ struct _hb_buffer_t { HB_INTERNAL bool enlarge (unsigned int size); inline bool ensure (unsigned int size) - { return likely (size <= allocated) ? TRUE : enlarge (size); } + { return likely (size <= allocated) ? true : enlarge (size); } HB_INTERNAL bool make_room_for (unsigned int num_in, unsigned int num_out); diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index c27cc1561..e2c34f14c 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -66,7 +66,7 @@ bool hb_buffer_t::enlarge (unsigned int size) { if (unlikely (in_error)) - return FALSE; + return false; unsigned int new_allocated = allocated; hb_glyph_position_t *new_pos = NULL; @@ -88,7 +88,7 @@ hb_buffer_t::enlarge (unsigned int size) done: if (unlikely (!new_pos || !new_info)) - in_error = TRUE; + in_error = true; if (likely (new_pos)) pos = new_pos; @@ -107,7 +107,7 @@ bool hb_buffer_t::make_room_for (unsigned int num_in, unsigned int num_out) { - if (unlikely (!ensure (out_len + num_out))) return FALSE; + if (unlikely (!ensure (out_len + num_out))) return false; if (out_info == info && out_len + num_out > idx + num_in) @@ -118,14 +118,14 @@ hb_buffer_t::make_room_for (unsigned int num_in, memcpy (out_info, info, out_len * sizeof (out_info[0])); } - return TRUE; + return true; } void * hb_buffer_t::get_scratch_buffer (unsigned int *size) { - have_output = FALSE; - have_positions = FALSE; + have_output = false; + have_positions = false; out_len = 0; *size = allocated * sizeof (pos[0]); return pos; @@ -146,9 +146,9 @@ hb_buffer_t::reset (void) hb_segment_properties_t default_props = _HB_BUFFER_PROPS_DEFAULT; props = default_props; - in_error = FALSE; - have_output = FALSE; - have_positions = FALSE; + in_error = false; + have_output = false; + have_positions = false; idx = 0; len = 0; @@ -186,8 +186,8 @@ hb_buffer_t::clear_output (void) if (unlikely (hb_object_is_inert (this))) return; - have_output = TRUE; - have_positions = FALSE; + have_output = true; + have_positions = false; out_len = 0; out_info = info; @@ -199,8 +199,8 @@ hb_buffer_t::clear_positions (void) if (unlikely (hb_object_is_inert (this))) return; - have_output = FALSE; - have_positions = TRUE; + have_output = false; + have_positions = true; memset (pos, 0, sizeof (pos[0]) * len); } @@ -211,7 +211,7 @@ hb_buffer_t::swap_buffers (void) if (unlikely (in_error)) return; assert (have_output); - have_output = FALSE; + have_output = false; if (out_info != info) { @@ -547,9 +547,9 @@ hb_buffer_get_empty (void) _HB_BUFFER_UNICODE_FUNCS_DEFAULT, _HB_BUFFER_PROPS_DEFAULT, - TRUE, /* in_error */ - TRUE, /* have_output */ - TRUE /* have_positions */ + true, /* in_error */ + true, /* have_output */ + true /* have_positions */ }; return const_cast (&_hb_buffer_nil); @@ -698,7 +698,7 @@ hb_buffer_set_length (hb_buffer_t *buffer, return length == 0; if (!buffer->ensure (length)) - return FALSE; + return false; /* Wipe the new space */ if (length > buffer->len) { @@ -708,7 +708,7 @@ hb_buffer_set_length (hb_buffer_t *buffer, } buffer->len = length; - return TRUE; + return true; } unsigned int diff --git a/src/hb-buffer.h b/src/hb-buffer.h index ca1bbf476..fe53197e0 100644 --- a/src/hb-buffer.h +++ b/src/hb-buffer.h @@ -121,13 +121,13 @@ hb_buffer_get_language (hb_buffer_t *buffer); void hb_buffer_reset (hb_buffer_t *buffer); -/* Returns FALSE if allocation failed */ +/* Returns false if allocation failed */ hb_bool_t hb_buffer_pre_allocate (hb_buffer_t *buffer, unsigned int size); -/* Returns FALSE if allocation has failed before */ +/* Returns false if allocation has failed before */ hb_bool_t hb_buffer_allocation_successful (hb_buffer_t *buffer); diff --git a/src/hb-fallback-shape.cc b/src/hb-fallback-shape.cc index 20ea43e7f..593988792 100644 --- a/src/hb-fallback-shape.cc +++ b/src/hb-fallback-shape.cc @@ -57,5 +57,5 @@ _hb_fallback_shape (hb_font_t *font, if (HB_DIRECTION_IS_BACKWARD (buffer->props.direction)) hb_buffer_reverse (buffer); - return TRUE; + return true; } diff --git a/src/hb-font.cc b/src/hb-font.cc index 783a2b046..109caff31 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -55,7 +55,7 @@ hb_font_get_glyph_nil (hb_font_t *font, return hb_font_get_glyph (font->parent, unicode, variation_selector, glyph); *glyph = 0; - return FALSE; + return false; } static hb_position_t @@ -98,7 +98,7 @@ hb_font_get_glyph_h_origin_nil (hb_font_t *font, } *x = *y = 0; - return FALSE; + return false; } static hb_bool_t @@ -117,7 +117,7 @@ hb_font_get_glyph_v_origin_nil (hb_font_t *font, } *x = *y = 0; - return FALSE; + return false; } static hb_position_t @@ -165,7 +165,7 @@ hb_font_get_glyph_extents_nil (hb_font_t *font, } memset (extents, 0, sizeof (*extents)); - return FALSE; + return false; } static hb_bool_t @@ -185,7 +185,7 @@ hb_font_get_glyph_contour_point_nil (hb_font_t *font, } *x = *y = 0; - return FALSE; + return false; } static hb_bool_t @@ -199,7 +199,7 @@ hb_font_get_glyph_name_nil (hb_font_t *font, return hb_font_get_glyph_name (font->parent, glyph, name, size); snprintf (name, size, "gid%u", glyph); - return FALSE; + return false; } static hb_bool_t @@ -213,14 +213,14 @@ hb_font_get_glyph_from_name_nil (hb_font_t *font, return hb_font_get_glyph_from_name (font->parent, name, len, glyph); *glyph = 0; - return FALSE; + return false; } static const hb_font_funcs_t _hb_font_funcs_nil = { HB_OBJECT_HEADER_STATIC, - TRUE, /* immutable */ + true, /* immutable */ { #define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_nil, @@ -292,7 +292,7 @@ hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs) if (hb_object_is_inert (ffuncs)) return; - ffuncs->immutable = TRUE; + ffuncs->immutable = true; } hb_bool_t @@ -581,7 +581,7 @@ hb_font_get_glyph_contour_point_for_origin (hb_font_t *font, static const hb_face_t _hb_face_nil = { HB_OBJECT_HEADER_STATIC, - TRUE, /* immutable */ + true, /* immutable */ NULL, /* reference_table */ NULL, /* user_data */ @@ -858,7 +858,7 @@ hb_font_get_empty (void) static const hb_font_t _hb_font_nil = { HB_OBJECT_HEADER_STATIC, - TRUE, /* immutable */ + true, /* immutable */ NULL, /* parent */ const_cast (&_hb_face_nil), diff --git a/src/hb-ft.cc b/src/hb-ft.cc index 20fb32e66..0589c9eaa 100644 --- a/src/hb-ft.cc +++ b/src/hb-ft.cc @@ -81,7 +81,7 @@ hb_ft_get_glyph (hb_font_t *font HB_UNUSED, if (unlikely (variation_selector)) { *glyph = FT_Face_GetCharVariantIndex (ft_face, unicode, variation_selector); if (*glyph) - return TRUE; + return true; } #endif @@ -132,7 +132,7 @@ hb_ft_get_glyph_h_origin (hb_font_t *font HB_UNUSED, void *user_data HB_UNUSED) { /* We always work in the horizontal coordinates. */ - return TRUE; + return true; } static hb_bool_t @@ -147,14 +147,14 @@ hb_ft_get_glyph_v_origin (hb_font_t *font HB_UNUSED, int load_flags = FT_LOAD_DEFAULT; if (unlikely (FT_Load_Glyph (ft_face, glyph, load_flags))) - return FALSE; + return false; /* Note: FreeType's vertical metrics grows downward while other FreeType coordinates * have a Y growing upward. Hence the extra negation. */ *x = ft_face->glyph->metrics.horiBearingX - ft_face->glyph->metrics.vertBearingX; *y = ft_face->glyph->metrics.horiBearingY - (-ft_face->glyph->metrics.vertBearingY); - return TRUE; + return true; } static hb_position_t @@ -195,13 +195,13 @@ hb_ft_get_glyph_extents (hb_font_t *font HB_UNUSED, int load_flags = FT_LOAD_DEFAULT; if (unlikely (FT_Load_Glyph (ft_face, glyph, load_flags))) - return FALSE; + return false; extents->x_bearing = ft_face->glyph->metrics.horiBearingX; extents->y_bearing = ft_face->glyph->metrics.horiBearingY; extents->width = ft_face->glyph->metrics.width; extents->height = ft_face->glyph->metrics.height; - return TRUE; + return true; } static hb_bool_t @@ -217,18 +217,18 @@ hb_ft_get_glyph_contour_point (hb_font_t *font HB_UNUSED, int load_flags = FT_LOAD_DEFAULT; if (unlikely (FT_Load_Glyph (ft_face, glyph, load_flags))) - return FALSE; + return false; if (unlikely (ft_face->glyph->format != FT_GLYPH_FORMAT_OUTLINE)) - return FALSE; + return false; if (unlikely (point_index >= (unsigned int) ft_face->glyph->outline.n_points)) - return FALSE; + return false; *x = ft_face->glyph->outline.points[point_index].x; *y = ft_face->glyph->outline.points[point_index].y; - return TRUE; + return true; } static hb_bool_t @@ -277,7 +277,7 @@ _hb_ft_get_font_funcs (void) static const hb_font_funcs_t ft_ffuncs = { HB_OBJECT_HEADER_STATIC, - TRUE, /* immutable */ + true, /* immutable */ { #define HB_FONT_FUNC_IMPLEMENT(name) hb_ft_get_##name, diff --git a/src/hb-glib.cc b/src/hb-glib.cc index 60f525908..6b655dd13 100644 --- a/src/hb-glib.cc +++ b/src/hb-glib.cc @@ -251,7 +251,7 @@ hb_glib_unicode_compose (hb_unicode_funcs_t *ufuncs HB_UNUSED, * sees it and makes sure it's compilable. */ if (!a || !b) - return FALSE; + return false; gchar utf8[12]; gchar *normalized; @@ -263,13 +263,13 @@ hb_glib_unicode_compose (hb_unicode_funcs_t *ufuncs HB_UNUSED, normalized = g_utf8_normalize (utf8, len, G_NORMALIZE_NFC); len = g_utf8_strlen (normalized, -1); if (unlikely (!len)) - return FALSE; + return false; if (len == 1) { *ab = g_utf8_get_char (normalized); - ret = TRUE; + ret = true; } else { - ret = FALSE; + ret = false; } g_free (normalized); @@ -299,7 +299,7 @@ hb_glib_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED, normalized = g_utf8_normalize (utf8, len, G_NORMALIZE_NFD); len = g_utf8_strlen (normalized, -1); if (unlikely (!len)) - return FALSE; + return false; if (len == 1) { *a = g_utf8_get_char (normalized); @@ -318,7 +318,7 @@ hb_glib_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED, *b = 0; } g_free (recomposed); - ret = TRUE; + ret = true; } else { /* If decomposed to more than two characters, take the last one, * and recompose the rest to get the first component. */ @@ -329,7 +329,7 @@ hb_glib_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED, /* We expect that recomposed has exactly one character now. */ *a = g_utf8_get_char (recomposed); g_free (recomposed); - ret = TRUE; + ret = true; } g_free (normalized); @@ -342,7 +342,7 @@ const hb_unicode_funcs_t _hb_glib_unicode_funcs = { HB_OBJECT_HEADER_STATIC, NULL, /* parent */ - TRUE, /* immutable */ + true, /* immutable */ { #define HB_UNICODE_FUNC_IMPLEMENT(name) hb_glib_unicode_##name, HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc index eab2eae72..3fa9f7989 100644 --- a/src/hb-graphite2.cc +++ b/src/hb-graphite2.cc @@ -159,7 +159,7 @@ _hb_gr_face_get_data (hb_face_t *face) if (unlikely (!hb_face_set_user_data (face, &hb_gr_data_key, data, (hb_destroy_func_t) _hb_gr_face_data_destroy, - FALSE))) + false))) { _hb_gr_face_data_destroy (data); data = (hb_gr_face_data_t *) hb_face_get_user_data (face, &hb_gr_data_key); @@ -198,7 +198,7 @@ _hb_gr_font_get_data (hb_font_t *font) if (unlikely (!hb_font_set_user_data (font, &hb_gr_data_key, data, (hb_destroy_func_t) _hb_gr_font_data_destroy, - FALSE))) + false))) { _hb_gr_font_data_destroy (data); data = (hb_gr_font_data_t *) hb_font_get_user_data (font, &hb_gr_data_key); @@ -225,14 +225,14 @@ _hb_graphite_shape (hb_font_t *font, * is not graphite! Shouldn't do. */ hb_gr_font_data_t *data = _hb_gr_font_get_data (font); - if (!data->grface) return FALSE; + if (!data->grface) return false; unsigned int charlen; hb_glyph_info_t *bufferi = hb_buffer_get_glyph_infos (buffer, &charlen); int success = 0; - if (!charlen) return TRUE; + if (!charlen) return true; const char *lang = hb_language_to_string (hb_buffer_get_language (buffer)); const char *lang_end = strchr (lang, '-'); diff --git a/src/hb-icu.cc b/src/hb-icu.cc index 01beb4aef..aead6dda0 100644 --- a/src/hb-icu.cc +++ b/src/hb-icu.cc @@ -172,7 +172,7 @@ hb_icu_unicode_compose (hb_unicode_funcs_t *ufuncs HB_UNUSED, void *user_data HB_UNUSED) { if (!a || !b) - return FALSE; + return false; UChar utf16[4], normalized[5]; int len; @@ -180,21 +180,21 @@ hb_icu_unicode_compose (hb_unicode_funcs_t *ufuncs HB_UNUSED, UErrorCode icu_err; len = 0; - err = FALSE; + err = false; U16_APPEND (utf16, len, ARRAY_LENGTH (utf16), a, err); - if (err) return FALSE; + if (err) return false; U16_APPEND (utf16, len, ARRAY_LENGTH (utf16), b, err); - if (err) return FALSE; + if (err) return false; icu_err = U_ZERO_ERROR; len = unorm_normalize (utf16, len, UNORM_NFC, 0, normalized, ARRAY_LENGTH (normalized), &icu_err); if (U_FAILURE (icu_err)) - return FALSE; + return false; if (u_countChar32 (normalized, len) == 1) { U16_GET_UNSAFE (normalized, 0, *ab); - ret = TRUE; + ret = true; } else { - ret = FALSE; + ret = false; } return ret; @@ -217,14 +217,14 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED, /* Watchout for the dragons. Err, watchout for macros changing len. */ len = 0; - err = FALSE; + err = false; U16_APPEND (utf16, len, ARRAY_LENGTH (utf16), ab, err); - if (err) return FALSE; + if (err) return false; icu_err = U_ZERO_ERROR; len = unorm_normalize (utf16, len, UNORM_NFD, 0, normalized, ARRAY_LENGTH (normalized), &icu_err); if (U_FAILURE (icu_err)) - return FALSE; + return false; len = u_countChar32 (normalized, len); @@ -244,14 +244,14 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED, icu_err = U_ZERO_ERROR; unorm_normalize (normalized, len, UNORM_NFC, 0, recomposed, ARRAY_LENGTH (recomposed), &icu_err); if (U_FAILURE (icu_err)) - return FALSE; + return false; hb_codepoint_t c; U16_GET_UNSAFE (recomposed, 0, c); if (c != *a && c != ab) { *a = c; *b = 0; } - ret = TRUE; + ret = true; } else { /* If decomposed to more than two characters, take the last one, * and recompose the rest to get the first component. */ @@ -260,10 +260,10 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED, icu_err = U_ZERO_ERROR; len = unorm_normalize (normalized, len, UNORM_NFC, 0, recomposed, ARRAY_LENGTH (recomposed), &icu_err); if (U_FAILURE (icu_err)) - return FALSE; + return false; /* We expect that recomposed has exactly one character now. */ U16_GET_UNSAFE (recomposed, 0, *a); - ret = TRUE; + ret = true; } return ret; @@ -275,7 +275,7 @@ const hb_unicode_funcs_t _hb_icu_unicode_funcs = { HB_OBJECT_HEADER_STATIC, NULL, /* parent */ - TRUE, /* immutable */ + true, /* immutable */ { #define HB_UNICODE_FUNC_IMPLEMENT(name) hb_icu_unicode_##name, HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index ded3dcc84..0621f86d3 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -232,19 +232,19 @@ hb_ot_layout_table_find_script (hb_face_t *face, const GSUBGPOS &g = get_gsubgpos_table (face, table_tag); if (g.find_script_index (script_tag, script_index)) - return TRUE; + return true; /* try finding 'DFLT' */ if (g.find_script_index (HB_OT_TAG_DEFAULT_SCRIPT, script_index)) - return FALSE; + return false; /* try with 'dflt'; MS site has had typos and many fonts use it now :(. * including many versions of DejaVu Sans Mono! */ if (g.find_script_index (HB_OT_TAG_DEFAULT_LANGUAGE, script_index)) - return FALSE; + return false; if (script_index) *script_index = HB_OT_LAYOUT_NO_SCRIPT_INDEX; - return FALSE; + return false; } hb_bool_t @@ -262,7 +262,7 @@ hb_ot_layout_table_choose_script (hb_face_t *face, if (g.find_script_index (*script_tags, script_index)) { if (chosen_script) *chosen_script = *script_tags; - return TRUE; + return true; } script_tags++; } @@ -271,14 +271,14 @@ hb_ot_layout_table_choose_script (hb_face_t *face, if (g.find_script_index (HB_OT_TAG_DEFAULT_SCRIPT, script_index)) { if (chosen_script) *chosen_script = HB_OT_TAG_DEFAULT_SCRIPT; - return FALSE; + return false; } /* try with 'dflt'; MS site has had typos and many fonts use it now :( */ if (g.find_script_index (HB_OT_TAG_DEFAULT_LANGUAGE, script_index)) { if (chosen_script) *chosen_script = HB_OT_TAG_DEFAULT_LANGUAGE; - return FALSE; + return false; } /* try with 'latn'; some old fonts put their features there even though @@ -287,13 +287,13 @@ hb_ot_layout_table_choose_script (hb_face_t *face, if (g.find_script_index (HB_OT_TAG_LATIN_SCRIPT, script_index)) { if (chosen_script) *chosen_script = HB_OT_TAG_LATIN_SCRIPT; - return FALSE; + return false; } if (script_index) *script_index = HB_OT_LAYOUT_NO_SCRIPT_INDEX; if (chosen_script) *chosen_script = HB_OT_LAYOUT_NO_SCRIPT_INDEX; - return FALSE; + return false; } unsigned int @@ -333,14 +333,14 @@ hb_ot_layout_script_find_language (hb_face_t *face, const Script &s = get_gsubgpos_table (face, table_tag).get_script (script_index); if (s.find_lang_sys_index (language_tag, language_index)) - return TRUE; + return true; /* try with 'dflt'; MS site has had typos and many fonts use it now :( */ if (s.find_lang_sys_index (HB_OT_TAG_DEFAULT_LANGUAGE, language_index)) - return FALSE; + return false; if (language_index) *language_index = HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX; - return FALSE; + return false; } hb_bool_t @@ -415,12 +415,12 @@ hb_ot_layout_language_find_feature (hb_face_t *face, if (feature_tag == g.get_feature_tag (f_index)) { if (feature_index) *feature_index = f_index; - return TRUE; + return true; } } if (feature_index) *feature_index = HB_OT_LAYOUT_NO_FEATURE_INDEX; - return FALSE; + return false; } unsigned int diff --git a/src/hb-ot-shape-complex-private.hh b/src/hb-ot-shape-complex-private.hh index ba962b591..d2f7959dc 100644 --- a/src/hb-ot-shape-complex-private.hh +++ b/src/hb-ot-shape-complex-private.hh @@ -253,7 +253,7 @@ hb_ot_shape_complex_collect_features (hb_ot_complex_shaper_t shaper, * * Called during shape_execute(). * - * Shapers should return TRUE if it prefers decomposed (NFD) input rather than precomposed (NFC). + * Shapers should return true if it prefers decomposed (NFD) input rather than precomposed (NFC). */ typedef hb_ot_shape_normalization_mode_t hb_ot_shape_complex_normalization_preference_func_t (void); diff --git a/src/hb-ot-shape-normalize.cc b/src/hb-ot-shape-normalize.cc index a9019fb72..562ba881f 100644 --- a/src/hb-ot-shape-normalize.cc +++ b/src/hb-ot-shape-normalize.cc @@ -84,7 +84,7 @@ decompose (hb_font_t *font, hb_buffer_t *buffer, if (!hb_unicode_decompose (buffer->unicode, ab, &a, &b) || (b && !hb_font_get_glyph (font, b, 0, &glyph))) - return FALSE; + return false; bool has_a = hb_font_get_glyph (font, a, 0, &glyph); if (shortest && has_a) { @@ -92,23 +92,23 @@ decompose (hb_font_t *font, hb_buffer_t *buffer, output_glyph (buffer, a); if (b) output_glyph (buffer, b); - return TRUE; + return true; } if (decompose (font, buffer, shortest, a)) { if (b) output_glyph (buffer, b); - return TRUE; + return true; } if (has_a) { output_glyph (buffer, a); if (b) output_glyph (buffer, b); - return TRUE; + return true; } - return FALSE; + return false; } static void @@ -149,7 +149,7 @@ decompose_multi_char_cluster (hb_font_t *font, hb_buffer_t *buffer, } while (buffer->idx < end) - decompose_current_glyph (font, buffer, FALSE); + decompose_current_glyph (font, buffer, false); } static int @@ -166,7 +166,7 @@ _hb_ot_shape_normalize (hb_font_t *font, hb_buffer_t *buffer, hb_ot_shape_normalization_mode_t mode) { bool recompose = mode != HB_OT_SHAPE_NORMALIZATION_MODE_DECOMPOSED; - bool has_multichar_clusters = FALSE; + bool has_multichar_clusters = false; unsigned int count; /* We do a fairly straightforward yet custom normalization process in three @@ -191,7 +191,7 @@ _hb_ot_shape_normalize (hb_font_t *font, hb_buffer_t *buffer, decompose_single_char_cluster (font, buffer, recompose); else { decompose_multi_char_cluster (font, buffer, end); - has_multichar_clusters = TRUE; + has_multichar_clusters = true; } } buffer->swap_buffers (); diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 8b1d67001..19cf680c6 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -327,7 +327,7 @@ hb_ot_position_complex (hb_ot_shape_context_t *c) &c->buffer->pos[i].y_offset); } - c->applied_position_complex = TRUE; + c->applied_position_complex = true; } hb_ot_layout_position_finish (c->buffer); @@ -490,7 +490,7 @@ _hb_ot_shape (hb_font_t *font, hb_ot_shape_plan_internal (&plan, font->face, &buffer->props, features, num_features); hb_ot_shape_execute (&plan, font, buffer, features, num_features); - return TRUE; + return true; } diff --git a/src/hb-private.hh b/src/hb-private.hh index 4a6166106..44b7314c0 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -61,12 +61,6 @@ # define NULL ((void *) 0) #endif -#undef FALSE -#define FALSE 0 - -#undef TRUE -#define TRUE 1 - /* Basics */ @@ -601,9 +595,9 @@ _hb_debug_msg<0> (const char *what HB_UNUSED, const char *message HB_UNUSED, ...) {} -#define DEBUG_MSG_LEVEL(WHAT, OBJ, LEVEL, LEVEL_DIR, ...) _hb_debug_msg (#WHAT, (OBJ), NULL, TRUE, (LEVEL), (LEVEL_DIR), __VA_ARGS__) -#define DEBUG_MSG(WHAT, OBJ, ...) _hb_debug_msg (#WHAT, (OBJ), NULL, FALSE, 0, 0, __VA_ARGS__) -#define DEBUG_MSG_FUNC(WHAT, OBJ, ...) _hb_debug_msg (#WHAT, (OBJ), HB_FUNC, FALSE, 0, 0, __VA_ARGS__) +#define DEBUG_MSG_LEVEL(WHAT, OBJ, LEVEL, LEVEL_DIR, ...) _hb_debug_msg (#WHAT, (OBJ), NULL, true, (LEVEL), (LEVEL_DIR), __VA_ARGS__) +#define DEBUG_MSG(WHAT, OBJ, ...) _hb_debug_msg (#WHAT, (OBJ), NULL, false, 0, 0, __VA_ARGS__) +#define DEBUG_MSG_FUNC(WHAT, OBJ, ...) _hb_debug_msg (#WHAT, (OBJ), HB_FUNC, false, 0, 0, __VA_ARGS__) /* @@ -623,14 +617,14 @@ struct hb_auto_trace_t { va_list ap; va_start (ap, message); - _hb_debug_msg_va (what, obj, func, TRUE, plevel ? *plevel : 0, +1, message, ap); + _hb_debug_msg_va (what, obj, func, true, plevel ? *plevel : 0, +1, message, ap); va_end (ap); } inline ~hb_auto_trace_t (void) { if (unlikely (!returned)) { fprintf (stderr, "OUCH, returned with no call to TRACE_RETURN. This is a bug, please report. Level was %d.\n", plevel ? *plevel : -1); - _hb_debug_msg (what, obj, NULL, TRUE, plevel ? *plevel : 1, -1, " "); + _hb_debug_msg (what, obj, NULL, true, plevel ? *plevel : 1, -1, " "); return; } @@ -644,7 +638,7 @@ struct hb_auto_trace_t { return v; } - _hb_debug_msg (what, obj, NULL, TRUE, plevel ? *plevel : 1, -1, "return %s", v ? "true" : "false"); + _hb_debug_msg (what, obj, NULL, true, plevel ? *plevel : 1, -1, "return %s", v ? "true" : "false"); if (plevel) --*plevel; plevel = NULL; returned = true; diff --git a/src/hb-set.cc b/src/hb-set.cc index a044199bf..4225e3c98 100644 --- a/src/hb-set.cc +++ b/src/hb-set.cc @@ -93,7 +93,7 @@ hb_set_get_user_data (hb_set_t *set, hb_bool_t hb_set_allocation_successful (hb_set_t *set HB_UNUSED) { - return TRUE; + return true; } void diff --git a/src/hb-set.h b/src/hb-set.h index 97e68e48e..9f849cf8a 100644 --- a/src/hb-set.h +++ b/src/hb-set.h @@ -63,7 +63,7 @@ hb_set_get_user_data (hb_set_t *set, hb_user_data_key_t *key); -/* Returns FALSE if allocation has failed before */ +/* Returns false if allocation has failed before */ hb_bool_t hb_set_allocation_successful (hb_set_t *set); diff --git a/src/hb-shape.cc b/src/hb-shape.cc index a8d6d0118..163a5bfb8 100644 --- a/src/hb-shape.cc +++ b/src/hb-shape.cc @@ -192,19 +192,19 @@ hb_shape_full (hb_font_t *font, const hb_shaper_pair_t *shapers = get_shapers (); for (unsigned int i = 0; i < ARRAY_LENGTH (all_shapers); i++) if (likely (shapers[i].func (font, buffer, features, num_features))) - return TRUE; + return true; } else { while (*shaper_list) { for (unsigned int i = 0; i < ARRAY_LENGTH (all_shapers); i++) if (0 == strcmp (*shaper_list, all_shapers[i].name)) { if (likely (all_shapers[i].func (font, buffer, features, num_features))) - return TRUE; + return true; break; } shaper_list++; } } - return FALSE; + return false; } void diff --git a/src/hb-tt-font.cc b/src/hb-tt-font.cc index b2f24f6e8..0055ae9cd 100644 --- a/src/hb-tt-font.cc +++ b/src/hb-tt-font.cc @@ -88,7 +88,7 @@ hb_font_get_glyph_nil (hb_font_t *font HB_UNUSED, return hb_font_get_glyph (font->parent, unicode, variation_selector, glyph); *glyph = 0; - return FALSE; + return false; } static hb_position_t @@ -133,7 +133,7 @@ hb_font_get_glyph_h_origin_nil (hb_font_t *font HB_UNUSED, } *x = *y = 0; - return FALSE; + return false; } static hb_bool_t @@ -154,7 +154,7 @@ hb_font_get_glyph_v_origin_nil (hb_font_t *font HB_UNUSED, } *x = *y = 0; - return FALSE; + return false; } static hb_position_t @@ -202,7 +202,7 @@ hb_font_get_glyph_extents_nil (hb_font_t *font HB_UNUSED, } memset (extents, 0, sizeof (*extents)); - return FALSE; + return false; } static hb_bool_t @@ -224,14 +224,14 @@ hb_font_get_glyph_contour_point_nil (hb_font_t *font HB_UNUSED, } *x = *y = 0; - return FALSE; + return false; } static hb_font_funcs_t _hb_font_funcs_nil = { HB_OBJECT_HEADER_STATIC, - TRUE, /* immutable */ + true, /* immutable */ { #define HB_FONT_FUNC_IMPLEMENT(name) hb_font_get_##name##_nil, diff --git a/src/hb-unicode.cc b/src/hb-unicode.cc index e96c0cfb2..1d6eacb0f 100644 --- a/src/hb-unicode.cc +++ b/src/hb-unicode.cc @@ -85,7 +85,7 @@ hb_unicode_compose_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED, hb_codepoint_t *ab HB_UNUSED, void *user_data HB_UNUSED) { - return FALSE; + return false; } static hb_bool_t @@ -95,7 +95,7 @@ hb_unicode_decompose_nil (hb_unicode_funcs_t *ufuncs HB_UNUSED, hb_codepoint_t *b HB_UNUSED, void *user_data HB_UNUSED) { - return FALSE; + return false; } @@ -136,7 +136,7 @@ const hb_unicode_funcs_t _hb_unicode_funcs_nil = { HB_OBJECT_HEADER_STATIC, NULL, /* parent */ - TRUE, /* immutable */ + true, /* immutable */ { #define HB_UNICODE_FUNC_IMPLEMENT(name) hb_unicode_##name##_nil, HB_UNICODE_FUNCS_IMPLEMENT_CALLBACKS @@ -195,7 +195,7 @@ hb_unicode_funcs_make_immutable (hb_unicode_funcs_t *ufuncs) if (hb_object_is_inert (ufuncs)) return; - ufuncs->immutable = TRUE; + ufuncs->immutable = true; } hb_bool_t diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc index 584d6412c..9f84a3cc4 100644 --- a/src/hb-uniscribe.cc +++ b/src/hb-uniscribe.cc @@ -77,18 +77,18 @@ populate_log_font (LOGFONTW *lf, if (unlikely (!len)) { DEBUG_MSG (UNISCRIBE, NULL, "Didn't find English name table entry"); - return FALSE; + return false; } if (unlikely (len >= LF_FACESIZE)) { DEBUG_MSG (UNISCRIBE, NULL, "Font name too long"); - return FALSE; + return false; } for (unsigned int i = 0; i < len; i++) lf->lfFaceName[i] = hb_be_uint16 (lf->lfFaceName[i]); lf->lfFaceName[len] = 0; - return TRUE; + return true; } @@ -133,7 +133,7 @@ _hb_uniscribe_face_get_data (hb_face_t *face) if (unlikely (!hb_face_set_user_data (face, &hb_uniscribe_data_key, data, (hb_destroy_func_t) _hb_uniscribe_face_data_destroy, - FALSE))) + false))) { _hb_uniscribe_face_data_destroy (data); data = (hb_uniscribe_face_data_t *) hb_face_get_user_data (face, &hb_uniscribe_data_key); @@ -190,7 +190,7 @@ _hb_uniscribe_font_get_data (hb_font_t *font) if (unlikely (!hb_font_set_user_data (font, &hb_uniscribe_data_key, data, (hb_destroy_func_t) _hb_uniscribe_font_data_destroy, - FALSE))) + false))) { _hb_uniscribe_font_data_destroy (data); data = (hb_uniscribe_font_data_t *) hb_font_get_user_data (font, &hb_uniscribe_data_key); @@ -233,7 +233,7 @@ _hb_uniscribe_shape (hb_font_t *font, #define FAIL(...) \ HB_STMT_START { \ DEBUG_MSG (UNISCRIBE, NULL, __VA_ARGS__); \ - return FALSE; \ + return false; \ } HB_STMT_END; hb_uniscribe_face_data_t *face_data = _hb_uniscribe_face_get_data (font->face); @@ -245,7 +245,7 @@ _hb_uniscribe_shape (hb_font_t *font, FAIL ("Couldn't get font font"); if (unlikely (!buffer->len)) - return TRUE; + return true; HRESULT hr; @@ -305,7 +305,7 @@ retry: int item_count; /* MinGW32 doesn't define fMergeNeutralItems, so we bruteforce */ - //bidi_control.fMergeNeutralItems = TRUE; + //bidi_control.fMergeNeutralItems = true; *(uint32_t*)&bidi_control |= 1<<24; bidi_state.uBidiLevel = HB_DIRECTION_IS_FORWARD (buffer->props.direction) ? 0 : 1; @@ -459,7 +459,7 @@ retry: } /* Wow, done! */ - return TRUE; + return true; } diff --git a/src/main.cc b/src/main.cc index 03b6e6ce9..07d3d69be 100644 --- a/src/main.cc +++ b/src/main.cc @@ -49,7 +49,7 @@ main (int argc, char **argv) int len = 0; #ifdef HAVE_GLIB - GMappedFile *mf = g_mapped_file_new (argv[1], FALSE, NULL); + GMappedFile *mf = g_mapped_file_new (argv[1], false, NULL); font_data = g_mapped_file_get_contents (mf); len = g_mapped_file_get_length (mf); #else diff --git a/util/hb-shape.cc b/util/hb-shape.cc index d459b8927..b23519bda 100644 --- a/util/hb-shape.cc +++ b/util/hb-shape.cc @@ -75,7 +75,7 @@ struct output_buffer_t void finish (const font_options_t *font_opts) { hb_font_destroy (font); - g_string_free (gs, TRUE); + g_string_free (gs, true); gs = NULL; font = NULL; } diff --git a/util/helper-cairo.cc b/util/helper-cairo.cc index 77fd1a6e0..0cdfd6350 100644 --- a/util/helper-cairo.cc +++ b/util/helper-cairo.cc @@ -50,7 +50,7 @@ _cairo_eps_surface_create_for_stream (cairo_write_func_t write_func, cairo_surface_t *surface; surface = cairo_ps_surface_create_for_stream (write_func, closure, width, height); - cairo_ps_surface_set_eps (surface, TRUE); + cairo_ps_surface_set_eps (surface, true); return surface; } @@ -121,7 +121,7 @@ finalize_ansi (finalize_closure_t *closure) closure->write_func, closure->closure); if (status != CAIRO_STATUS_SUCCESS) - fail (FALSE, "Failed to write output: %s", + fail (false, "Failed to write output: %s", cairo_status_to_string (status)); } @@ -150,7 +150,7 @@ _cairo_ansi_surface_create_for_stream (cairo_write_func_t write_func, } cairo_status_t status = cairo_surface_status (surface); if (status != CAIRO_STATUS_SUCCESS) - fail (FALSE, "Failed to create cairo surface: %s", + fail (false, "Failed to create cairo surface: %s", cairo_status_to_string (status)); finalize_closure_t *ansi_closure = g_new0 (finalize_closure_t, 1); @@ -179,7 +179,7 @@ finalize_png (finalize_closure_t *closure) closure->write_func, closure->closure); if (status != CAIRO_STATUS_SUCCESS) - fail (FALSE, "Failed to write output: %s", + fail (false, "Failed to write output: %s", cairo_status_to_string (status)); } @@ -208,7 +208,7 @@ _cairo_png_surface_create_for_stream (cairo_write_func_t write_func, } cairo_status_t status = cairo_surface_status (surface); if (status != CAIRO_STATUS_SUCCESS) - fail (FALSE, "Failed to create cairo surface: %s", + fail (false, "Failed to create cairo surface: %s", cairo_status_to_string (status)); finalize_closure_t *png_closure = g_new0 (finalize_closure_t, 1); @@ -240,7 +240,7 @@ stdio_write_func (void *closure, size -= ret; data += ret; if (size && ferror (fp)) - fail (FALSE, "Failed to write output: %s", strerror (errno)); + fail (false, "Failed to write output: %s", strerror (errno)); } return CAIRO_STATUS_SUCCESS; @@ -317,7 +317,7 @@ helper_cairo_create_context (double w, double h, else if (constructor2) surface = constructor2 (stdio_write_func, f, w, h, content); else - fail (FALSE, "Unknown output format `%s'", extension); + fail (false, "Unknown output format `%s'", extension); cairo_t *cr = cairo_create (surface); content = cairo_surface_get_content (surface); @@ -356,7 +356,7 @@ helper_cairo_destroy_context (cairo_t *cr) cairo_status_t status = cairo_status (cr); if (status != CAIRO_STATUS_SUCCESS) - fail (FALSE, "Failed: %s", + fail (false, "Failed: %s", cairo_status_to_string (status)); cairo_destroy (cr); } diff --git a/util/main-font-text.hh b/util/main-font-text.hh index 1dbaaff69..44e3bfbe7 100644 --- a/util/main-font-text.hh +++ b/util/main-font-text.hh @@ -49,7 +49,7 @@ struct main_font_text_t if (argc && !font_opts.font_file) font_opts.font_file = argv[0], argc--, argv++; if (argc && !input.text && !input.text_file) input.text = argv[0], argc--, argv++; if (argc) - fail (TRUE, "Too many arguments on the command line"); + fail (true, "Too many arguments on the command line"); if (!font_opts.font_file) options.usage (); if (!input.text && !input.text_file) diff --git a/util/options.cc b/util/options.cc index 785222be6..db1b24475 100644 --- a/util/options.cc +++ b/util/options.cc @@ -48,7 +48,7 @@ fail (hb_bool_t suggest_help, const char *format, ...) } -hb_bool_t debug = FALSE; +hb_bool_t debug = false; static gchar * shapers_to_string (void) @@ -62,7 +62,7 @@ shapers_to_string (void) } g_string_truncate (shapers, MAX (0, (gint)shapers->len - 1)); - return g_string_free (shapers, FALSE); + return g_string_free (shapers, false); } static G_GNUC_NORETURN gboolean @@ -141,10 +141,10 @@ option_parser_t::parse (int *argc, char ***argv) if (!g_option_context_parse (context, argc, argv, &parse_error)) { if (parse_error != NULL) { - fail (TRUE, "%s", parse_error->message); + fail (true, "%s", parse_error->message); //g_error_free (parse_error); } else - fail (TRUE, "Option parse error"); + fail (true, "Option parse error"); } } @@ -161,12 +161,12 @@ parse_margin (const char *name G_GNUC_UNUSED, case 1: m.r = m.t; case 2: m.b = m.t; case 3: m.l = m.r; - case 4: return TRUE; + case 4: return true; default: g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, "%s argument should be one to four space-separated numbers", name); - return FALSE; + return false; } } @@ -180,7 +180,7 @@ parse_shapers (const char *name G_GNUC_UNUSED, shape_options_t *shape_opts = (shape_options_t *) data; g_free (shape_opts->shapers); shape_opts->shapers = g_strsplit (arg, ",", 0); - return TRUE; + return true; } static G_GNUC_NORETURN gboolean @@ -213,10 +213,10 @@ parse_char (char **pp, char c) parse_space (pp); if (**pp != c) - return FALSE; + return false; (*pp)++; - return TRUE; + return true; } static hb_bool_t @@ -228,10 +228,10 @@ parse_uint (char **pp, unsigned int *pv) v = strtol (p, pp, 0); if (p == *pp) - return FALSE; + return false; *pv = v; - return TRUE; + return true; } @@ -245,7 +245,7 @@ parse_feature_value_prefix (char **pp, hb_feature_t *feature) feature->value = 1; } - return TRUE; + return true; } static hb_bool_t @@ -261,10 +261,10 @@ parse_feature_tag (char **pp, hb_feature_t *feature) #undef ISALNUM if (p == *pp) - return FALSE; + return false; feature->tag = hb_tag_from_string (p, *pp - p); - return TRUE; + return true; } static hb_bool_t @@ -278,7 +278,7 @@ parse_feature_indices (char **pp, hb_feature_t *feature) feature->end = (unsigned int) -1; if (!parse_char (pp, '[')) - return TRUE; + return true; has_start = parse_uint (pp, &feature->start); @@ -335,7 +335,7 @@ parse_features (const char *name G_GNUC_UNUSED, shape_opts->features = NULL; if (!*s) - return TRUE; + return true; /* count the features first, so we can allocate memory */ p = s; @@ -358,7 +358,7 @@ parse_features (const char *name G_GNUC_UNUSED, skip_one_feature (&p); } - return TRUE; + return true; } @@ -518,7 +518,7 @@ font_options_t::get_font (void) const /* This is a hell of a lot of code for just reading a file! */ if (!font_file) - fail (TRUE, "No font file set"); + fail (true, "No font file set"); if (0 == strcmp (font_file, "-")) { /* read it */ @@ -530,18 +530,18 @@ font_options_t::get_font (void) const while (!feof (stdin)) { size_t ret = fread (buf, 1, sizeof (buf), stdin); if (ferror (stdin)) - fail (FALSE, "Failed reading font from standard input: %s", + fail (false, "Failed reading font from standard input: %s", strerror (errno)); g_string_append_len (gs, buf, ret); } len = gs->len; - font_data = g_string_free (gs, FALSE); + font_data = g_string_free (gs, false); user_data = font_data; destroy = (hb_destroy_func_t) g_free; mm = HB_MEMORY_MODE_WRITABLE; } else { GError *error = NULL; - GMappedFile *mf = g_mapped_file_new (font_file, FALSE, &error); + GMappedFile *mf = g_mapped_file_new (font_file, false, &error); if (mf) { font_data = g_mapped_file_get_contents (mf); len = g_mapped_file_get_length (mf); @@ -552,7 +552,7 @@ font_options_t::get_font (void) const } else g_mapped_file_unref (mf); } else { - fail (FALSE, "%s", error->message); + fail (false, "%s", error->message); //g_error_free (error); } if (!len) { @@ -567,7 +567,7 @@ font_options_t::get_font (void) const user_data = (void *) font_data; mm = HB_MEMORY_MODE_WRITABLE; } else { - fail (FALSE, "%s", error->message); + fail (false, "%s", error->message); //g_error_free (error); } } @@ -626,7 +626,7 @@ text_options_t::get_line (unsigned int *len) if (!fp) { if (!text_file) - fail (TRUE, "At least one of text or text-file must be set"); + fail (true, "At least one of text or text-file must be set"); if (0 != strcmp (text_file, "-")) fp = fopen (text_file, "r"); @@ -634,7 +634,7 @@ text_options_t::get_line (unsigned int *len) fp = stdin; if (!fp) - fail (FALSE, "Failed opening text file `%s': %s", + fail (false, "Failed opening text file `%s': %s", text_file, strerror (errno)); gs = g_string_new (NULL); @@ -652,7 +652,7 @@ text_options_t::get_line (unsigned int *len) g_string_append_len (gs, buf, bytes); } if (ferror (fp)) - fail (FALSE, "Failed reading text: %s", + fail (false, "Failed reading text: %s", strerror (errno)); *len = gs->len; return !*len && feof (fp) ? NULL : gs->str; @@ -674,7 +674,7 @@ output_options_t::get_file_handle (void) fp = stdout; } if (!fp) - fail (FALSE, "Cannot open output file `%s': %s", + fail (false, "Cannot open output file `%s': %s", g_filename_display_name (output_file), strerror (errno)); return fp; @@ -687,8 +687,8 @@ parse_verbose (const char *name G_GNUC_UNUSED, GError **error G_GNUC_UNUSED) { format_options_t *format_opts = (format_options_t *) data; - format_opts->show_text = format_opts->show_unicode = format_opts->show_line_num = TRUE; - return TRUE; + format_opts->show_text = format_opts->show_unicode = format_opts->show_line_num = true; + return true; } void diff --git a/util/options.hh b/util/options.hh index 6e73a1c6c..9b7baa716 100644 --- a/util/options.hh +++ b/util/options.hh @@ -251,7 +251,7 @@ struct text_options_t : option_group_t } ~text_options_t (void) { if (gs) - g_string_free (gs, TRUE); + g_string_free (gs, true); if (fp) fclose (fp); } diff --git a/util/view-cairo.hh b/util/view-cairo.hh index 9b000b5dd..c62198496 100644 --- a/util/view-cairo.hh +++ b/util/view-cairo.hh @@ -42,7 +42,7 @@ struct view_cairo_t { void init (const font_options_t *font_opts) { - lines = g_array_new (FALSE, FALSE, sizeof (helper_cairo_line_t)); + lines = g_array_new (false, false, sizeof (helper_cairo_line_t)); scale = double (view_options.font_size) / hb_face_get_upem (hb_font_get_face (font_opts->get_font ())); } void new_line (void)