Rename a few files to be C++ sources
In anticipation for buffer revamp coming.
diff --git a/src/Makefile.am b/src/Makefile.am
index 7b10fe2..9c534a6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -12,16 +12,16 @@
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 @@
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 @@
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 bc562ba..1a3ac70 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 adec7c1..9588d5e 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 <string.h>
@@ -66,7 +66,7 @@
{
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 @@
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 @@
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 a2bc114..cc673ad 100644
--- a/src/hb-common.h
+++ b/src/hb-common.h
@@ -83,6 +83,7 @@
#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 97%
rename from src/hb-font-private.h
rename to src/hb-font-private.hh
index 2b024cc..ec07931 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 20aeb16..46b63a4 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 <string.h>
diff --git a/src/hb-ft.c b/src/hb-ft.cc
similarity index 96%
rename from src/hb-ft.c
rename to src/hb-ft.cc
index e6f3e84..5b911bc 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 @@
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 @@
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 @@
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 75cbc64..8c04150 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 517f9ef..d43a4c2 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 09c817d..066abbd 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 a9d4c57..e18222b 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 5908cdd..63186a3 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 7ff8166..61f67cd 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 97%
rename from src/hb-shape.c
rename to src/hb-shape.cc
index 6818891..ef10375 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 @@
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;