From 22da7fd94d6318c52df69d70470a85464ffc533d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 12 May 2010 18:23:21 -0400 Subject: [PATCH] Rename a few files to be C++ sources In anticipation for buffer revamp coming. --- src/Makefile.am | 16 ++++++++-------- ...{hb-buffer-private.h => hb-buffer-private.hh} | 2 +- src/{hb-buffer.c => hb-buffer.cc} | 14 +++++++------- src/hb-common.h | 1 + src/{hb-font-private.h => hb-font-private.hh} | 2 +- src/hb-font.cc | 4 ++-- src/{hb-ft.c => hb-ft.cc} | 8 ++++---- src/hb-ot-layout-common-private.hh | 2 +- src/hb-ot-layout-gdef-private.hh | 2 +- src/hb-ot-layout-gsubgpos-private.hh | 2 +- ...-layout-private.h => hb-ot-layout-private.hh} | 2 +- src/hb-ot-layout.cc | 2 +- ...ot-shape-private.h => hb-ot-shape-private.hh} | 0 src/{hb-ot-shape.c => hb-ot-shape.cc} | 4 ++-- src/{hb-shape.c => hb-shape.cc} | 6 +++--- 15 files changed, 34 insertions(+), 33 deletions(-) rename src/{hb-buffer-private.h => hb-buffer-private.hh} (98%) rename src/{hb-buffer.c => hb-buffer.cc} (95%) rename src/{hb-font-private.h => hb-font-private.hh} (98%) rename src/{hb-ft.c => hb-ft.cc} (97%) rename src/{hb-ot-layout-private.h => hb-ot-layout-private.hh} (98%) rename src/{hb-ot-shape-private.h => hb-ot-shape-private.hh} (100%) rename src/{hb-ot-shape.c => hb-ot-shape.cc} (98%) rename src/{hb-shape.c => hb-shape.cc} (98%) diff --git a/src/Makefile.am b/src/Makefile.am index 7b10fe2ba..9c534a680 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,16 +12,16 @@ HBLIBS = HBSOURCES = \ hb-blob.c \ hb-blob-private.h \ - hb-buffer.c \ - hb-buffer-private.h \ + hb-buffer.cc \ + hb-buffer-private.hh \ hb-font.cc \ - hb-font-private.h \ + hb-font-private.hh \ hb-object-private.h \ hb-open-file-private.hh \ hb-open-type-private.hh \ hb-language.c \ hb-private.h \ - hb-shape.c \ + hb-shape.cc \ hb-unicode.c \ hb-unicode-private.h \ $(NULL) @@ -43,9 +43,9 @@ HBSOURCES += \ hb-ot-layout-gpos-private.hh \ hb-ot-layout-gsubgpos-private.hh \ hb-ot-layout-gsub-private.hh \ - hb-ot-layout-private.h \ - hb-ot-shape.c \ - hb-ot-shape-private.h \ + hb-ot-layout-private.hh \ + hb-ot-shape.cc \ + hb-ot-shape-private.hh \ hb-ot-tag.c \ $(NULL) HBHEADERS += \ @@ -80,7 +80,7 @@ if HAVE_FREETYPE HBCFLAGS += $(FREETYPE_CFLAGS) HBLIBS += $(FREETYPE_LIBS) HBSOURCES += \ - hb-ft.c \ + hb-ft.cc \ $(NULL) HBHEADERS += \ hb-ft.h \ diff --git a/src/hb-buffer-private.h b/src/hb-buffer-private.hh similarity index 98% rename from src/hb-buffer-private.h rename to src/hb-buffer-private.hh index bc562baf2..1a3ac708d 100644 --- a/src/hb-buffer-private.h +++ b/src/hb-buffer-private.hh @@ -1,6 +1,6 @@ /* * Copyright (C) 1998-2004 David Turner and Werner Lemberg - * Copyright (C) 2004,2007,2009 Red Hat, Inc. + * Copyright (C) 2004,2007,2009,2010 Red Hat, Inc. * * This is part of HarfBuzz, a text shaping library. * diff --git a/src/hb-buffer.c b/src/hb-buffer.cc similarity index 95% rename from src/hb-buffer.c rename to src/hb-buffer.cc index adec7c102..9588d5e19 100644 --- a/src/hb-buffer.c +++ b/src/hb-buffer.cc @@ -1,6 +1,6 @@ /* * Copyright (C) 1998-2004 David Turner and Werner Lemberg - * Copyright (C) 2004,2007 Red Hat, Inc. + * Copyright (C) 2004,2007,2009,2010 Red Hat, Inc. * * This is part of HarfBuzz, a text shaping library. * @@ -25,7 +25,7 @@ * Red Hat Author(s): Owen Taylor, Behdad Esfahbod */ -#include "hb-buffer-private.h" +#include "hb-buffer-private.hh" #include @@ -66,7 +66,7 @@ hb_buffer_ensure_separate (hb_buffer_t *buffer, unsigned int size) { assert (buffer->have_output); if (!buffer->positions) - buffer->positions = calloc (buffer->allocated, sizeof (buffer->positions[0])); + buffer->positions = (hb_internal_glyph_position_t *) calloc (buffer->allocated, sizeof (buffer->positions[0])); buffer->out_string = (hb_internal_glyph_info_t *) buffer->positions; memcpy (buffer->out_string, buffer->in_string, buffer->out_length * sizeof (buffer->out_string[0])); @@ -200,16 +200,16 @@ hb_buffer_ensure (hb_buffer_t *buffer, unsigned int size) new_allocated += (new_allocated >> 1) + 8; if (buffer->positions) - buffer->positions = realloc (buffer->positions, new_allocated * sizeof (buffer->positions[0])); + buffer->positions = (hb_internal_glyph_position_t *) realloc (buffer->positions, new_allocated * sizeof (buffer->positions[0])); if (buffer->out_string != buffer->in_string) { - buffer->in_string = realloc (buffer->in_string, new_allocated * sizeof (buffer->in_string[0])); + buffer->in_string = (hb_internal_glyph_info_t *) realloc (buffer->in_string, new_allocated * sizeof (buffer->in_string[0])); buffer->out_string = (hb_internal_glyph_info_t *) buffer->positions; } else { - buffer->in_string = realloc (buffer->in_string, new_allocated * sizeof (buffer->in_string[0])); + buffer->in_string = (hb_internal_glyph_info_t *) realloc (buffer->in_string, new_allocated * sizeof (buffer->in_string[0])); buffer->out_string = buffer->in_string; } @@ -260,7 +260,7 @@ hb_buffer_clear_positions (hb_buffer_t *buffer) if (unlikely (!buffer->positions)) { - buffer->positions = calloc (buffer->allocated, sizeof (buffer->positions[0])); + buffer->positions = (hb_internal_glyph_position_t *) calloc (buffer->allocated, sizeof (buffer->positions[0])); return; } diff --git a/src/hb-common.h b/src/hb-common.h index a2bc114c9..cc673ad13 100644 --- a/src/hb-common.h +++ b/src/hb-common.h @@ -83,6 +83,7 @@ typedef enum _hb_direction_t { #define HB_DIRECTION_IS_VERTICAL(dir) ((dir) == HB_DIRECTION_TTB || (dir) == HB_DIRECTION_BTT) #define HB_DIRECTION_IS_FORWARD(dir) ((dir) == HB_DIRECTION_LTR || (dir) == HB_DIRECTION_TTB) #define HB_DIRECTION_IS_BACKWARD(dir) ((dir) == HB_DIRECTION_RTL || (dir) == HB_DIRECTION_BTT) +#define HB_DIRECTION_REVERSE(dir) ((hb_direction_t) (((unsigned int) (dir)) ^ 1)) #endif /* HB_COMMON_H */ diff --git a/src/hb-font-private.h b/src/hb-font-private.hh similarity index 98% rename from src/hb-font-private.h rename to src/hb-font-private.hh index 2b024cc67..ec07931ed 100644 --- a/src/hb-font-private.h +++ b/src/hb-font-private.hh @@ -31,7 +31,7 @@ #include "hb-font.h" -#include "hb-ot-layout-private.h" +#include "hb-ot-layout-private.hh" HB_BEGIN_DECLS diff --git a/src/hb-font.cc b/src/hb-font.cc index 20aeb16a9..46b63a481 100644 --- a/src/hb-font.cc +++ b/src/hb-font.cc @@ -26,11 +26,11 @@ #include "hb-private.h" -#include "hb-font-private.h" +#include "hb-font-private.hh" #include "hb-blob-private.h" #include "hb-open-file-private.hh" -#include "hb-ot-layout-private.h" +#include "hb-ot-layout-private.hh" #include diff --git a/src/hb-ft.c b/src/hb-ft.cc similarity index 97% rename from src/hb-ft.c rename to src/hb-ft.cc index e6f3e8400..5b911bcf5 100644 --- a/src/hb-ft.c +++ b/src/hb-ft.cc @@ -29,7 +29,7 @@ #include "hb-ft.h" -#include "hb-font-private.h" +#include "hb-font-private.hh" #include FT_TRUETYPE_TABLES_H @@ -160,7 +160,7 @@ _get_table (hb_tag_t tag, void *user_data) return hb_blob_create_empty (); /* TODO Use FT_Memory? */ - buffer = malloc (length); + buffer = (FT_Byte *) malloc (length); if (buffer == NULL) return NULL; @@ -200,7 +200,7 @@ hb_ft_face_create (FT_Face ft_face, static void hb_ft_face_finalize (FT_Face ft_face) { - hb_face_destroy (ft_face->generic.data); + hb_face_destroy ((hb_face_t *) ft_face->generic.data); } hb_face_t * @@ -215,7 +215,7 @@ hb_ft_face_create_cached (FT_Face ft_face) ft_face->generic.finalizer = (FT_Generic_Finalizer) hb_ft_face_finalize; } - return hb_face_reference (ft_face->generic.data); + return hb_face_reference ((hb_face_t *) ft_face->generic.data); } diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index 75cbc64b7..8c04150aa 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_LAYOUT_COMMON_PRIVATE_HH #define HB_OT_LAYOUT_COMMON_PRIVATE_HH -#include "hb-ot-layout-private.h" +#include "hb-ot-layout-private.hh" #include "hb-open-type-private.hh" diff --git a/src/hb-ot-layout-gdef-private.hh b/src/hb-ot-layout-gdef-private.hh index 517f9efec..d43a4c2f1 100644 --- a/src/hb-ot-layout-gdef-private.hh +++ b/src/hb-ot-layout-gdef-private.hh @@ -29,7 +29,7 @@ #include "hb-ot-layout-common-private.hh" -#include "hb-font-private.h" +#include "hb-font-private.hh" /* diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 09c817dbe..066abbdb0 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -27,7 +27,7 @@ #ifndef HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH #define HB_OT_LAYOUT_GSUBGPOS_PRIVATE_HH -#include "hb-buffer-private.h" +#include "hb-buffer-private.hh" #include "hb-ot-layout-gdef-private.hh" diff --git a/src/hb-ot-layout-private.h b/src/hb-ot-layout-private.hh similarity index 98% rename from src/hb-ot-layout-private.h rename to src/hb-ot-layout-private.hh index a9d4c5747..e18222baf 100644 --- a/src/hb-ot-layout-private.h +++ b/src/hb-ot-layout-private.hh @@ -32,7 +32,7 @@ #include "hb-ot-layout.h" #include "hb-font.h" -#include "hb-buffer-private.h" +#include "hb-buffer-private.hh" HB_BEGIN_DECLS diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 5908cdd21..63186a3a4 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -28,7 +28,7 @@ #define HB_OT_LAYOUT_CC -#include "hb-ot-layout-private.h" +#include "hb-ot-layout-private.hh" #include "hb-ot-layout-gdef-private.hh" #include "hb-ot-layout-gsub-private.hh" diff --git a/src/hb-ot-shape-private.h b/src/hb-ot-shape-private.hh similarity index 100% rename from src/hb-ot-shape-private.h rename to src/hb-ot-shape-private.hh diff --git a/src/hb-ot-shape.c b/src/hb-ot-shape.cc similarity index 98% rename from src/hb-ot-shape.c rename to src/hb-ot-shape.cc index 7ff8166a0..61f67cd72 100644 --- a/src/hb-ot-shape.c +++ b/src/hb-ot-shape.cc @@ -24,9 +24,9 @@ * Red Hat Author(s): Behdad Esfahbod */ -#include "hb-ot-shape-private.h" +#include "hb-ot-shape-private.hh" -#include "hb-buffer-private.h" +#include "hb-buffer-private.hh" #include "hb-ot-layout.h" diff --git a/src/hb-shape.c b/src/hb-shape.cc similarity index 98% rename from src/hb-shape.c rename to src/hb-shape.cc index 6818891c7..ef10375b6 100644 --- a/src/hb-shape.c +++ b/src/hb-shape.cc @@ -28,9 +28,9 @@ #include "hb-shape.h" -#include "hb-buffer-private.h" +#include "hb-buffer-private.hh" -#include "hb-ot-shape-private.h" +#include "hb-ot-shape-private.hh" /* Prepare */ @@ -64,7 +64,7 @@ hb_ensure_native_direction (hb_buffer_t *buffer) original_direction != _hb_script_get_horizontal_direction (buffer->script)) { hb_buffer_reverse_clusters (buffer); - buffer->direction ^= 1; + buffer->direction = HB_DIRECTION_REVERSE (buffer->direction); } return original_direction;