[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Wed Mar 19 15:39:02 PDT 2014


 util/hb-shape.cc     |    6 +++---
 util/helper-cairo.cc |   21 ++++++++++++---------
 util/helper-cairo.hh |    2 +-
 util/options.cc      |    6 +++++-
 util/options.hh      |    6 +++---
 5 files changed, 24 insertions(+), 17 deletions(-)

New commits:
commit ea5e8a02eb83ad19f3009b0008893f77ce113118
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Mar 19 15:38:02 2014 -0700

    [util] Plug minor leak

diff --git a/util/hb-shape.cc b/util/hb-shape.cc
index c239f0d..b7d2ca6 100644
--- a/util/hb-shape.cc
+++ b/util/hb-shape.cc
@@ -31,8 +31,7 @@
 struct output_buffer_t
 {
   output_buffer_t (option_parser_t *parser)
-		  : options (parser,
-			     g_strjoinv ("/", (gchar**) hb_buffer_serialize_list_formats ())),
+		  : options (parser, hb_buffer_serialize_list_formats ()),
 		    format (parser),
 		    gs (NULL),
 		    line_no (0),
@@ -53,7 +52,8 @@ struct output_buffer_t
     {
       if (options.explicit_output_format)
 	fail (false, "Unknown output format `%s'; supported formats are: %s",
-	      options.output_format, options.supported_formats);
+	      options.output_format,
+	      g_strjoinv ("/", const_cast<char**> (options.supported_formats)));
       else
 	/* Just default to TEXT if not explicitly requested and the
 	 * file extension is not recognized. */
diff --git a/util/helper-cairo.cc b/util/helper-cairo.cc
index bc44e8e..0ecf7f4 100644
--- a/util/helper-cairo.cc
+++ b/util/helper-cairo.cc
@@ -246,24 +246,26 @@ stdio_write_func (void                *closure,
   return CAIRO_STATUS_SUCCESS;
 }
 
-const char helper_cairo_supported_formats[] =
-  "ansi"
+const char *helper_cairo_supported_formats[] =
+{
+  "ansi",
   #ifdef CAIRO_HAS_PNG_FUNCTIONS
-  "/png"
+  "png",
   #endif
   #ifdef CAIRO_HAS_SVG_SURFACE
-  "/svg"
+  "svg",
   #endif
   #ifdef CAIRO_HAS_PDF_SURFACE
-  "/pdf"
+  "pdf",
   #endif
   #ifdef CAIRO_HAS_PS_SURFACE
-  "/ps"
+  "ps",
    #ifdef HAS_EPS
-    "/eps"
+    "eps",
    #endif
   #endif
-;
+  NULL
+};
 
 cairo_t *
 helper_cairo_create_context (double w, double h,
@@ -343,7 +345,8 @@ helper_cairo_create_context (double w, double h,
     surface = constructor2 (stdio_write_func, f, w, h, content);
   else
     fail (false, "Unknown output format `%s'; supported formats are: %s%s",
-	  extension, helper_cairo_supported_formats,
+	  extension,
+	  g_strjoinv ("/", const_cast<char**> (helper_cairo_supported_formats)),
 	  out_opts->explicit_output_format ? "" :
 	  "\nTry setting format using --output-format");
 
diff --git a/util/helper-cairo.hh b/util/helper-cairo.hh
index b2ac9e4..567777e 100644
--- a/util/helper-cairo.hh
+++ b/util/helper-cairo.hh
@@ -36,7 +36,7 @@ cairo_scaled_font_t *
 helper_cairo_create_scaled_font (const font_options_t *font_opts,
 				 double font_size);
 
-extern const char helper_cairo_supported_formats[];
+extern const char *helper_cairo_supported_formats[];
 
 cairo_t *
 helper_cairo_create_context (double w, double h,
diff --git a/util/options.cc b/util/options.cc
index c55feb2..835add7 100644
--- a/util/options.cc
+++ b/util/options.cc
@@ -374,7 +374,11 @@ output_options_t::add_options (option_parser_t *parser)
   if (NULL == supported_formats)
     text = "Set output format";
   else
-    text = text_free = g_strdup_printf ("Set output format\n\n    Supported formats are: %s", supported_formats);
+  {
+    char *items = g_strjoinv ("/", const_cast<char **> (supported_formats));
+    text = text_free = g_strdup_printf ("Set output format\n\n    Supported formats are: %s", items);
+    g_free (items);
+  }
 
   GOptionEntry entries[] =
   {
diff --git a/util/options.hh b/util/options.hh
index e32f9c9..a236a5d 100644
--- a/util/options.hh
+++ b/util/options.hh
@@ -65,7 +65,7 @@ template <typename Type> static inline Type MIN (const Type &a, const Type &b) {
 template <typename Type> static inline Type MAX (const Type &a, const Type &b) { return a > b ? a : b; }
 
 
-void fail (hb_bool_t suggest_help, const char *format, ...) G_GNUC_NORETURN;
+void fail (hb_bool_t suggest_help, const char *format, ...) G_GNUC_NORETURN G_GNUC_PRINTF (2, 3);
 
 
 extern hb_bool_t debug;
@@ -318,7 +318,7 @@ struct text_options_t : option_group_t
 struct output_options_t : option_group_t
 {
   output_options_t (option_parser_t *parser,
-		    const char *supported_formats_ = NULL) {
+		    const char **supported_formats_ = NULL) {
     output_file = NULL;
     output_format = NULL;
     supported_formats = supported_formats_;
@@ -354,7 +354,7 @@ struct output_options_t : option_group_t
 
   const char *output_file;
   const char *output_format;
-  const char *supported_formats;
+  const char **supported_formats;
   bool explicit_output_format;
 
   mutable FILE *fp;


More information about the HarfBuzz mailing list