Revert "Imported Upstream version 1.2.7"
[platform/upstream/harfbuzz.git] / util / options.hh
index 919e4f8..8b9b10e 100644 (file)
@@ -150,24 +150,19 @@ struct view_options_t : option_group_t
 {
   view_options_t (option_parser_t *parser) {
     annotate = false;
-    fore = NULL;
-    back = NULL;
+    fore = DEFAULT_FORE;
+    back = DEFAULT_BACK;
     line_space = 0;
     margin.t = margin.r = margin.b = margin.l = DEFAULT_MARGIN;
 
     add_options (parser);
   }
-  ~view_options_t (void)
-  {
-    g_free (fore);
-    g_free (back);
-  }
 
   void add_options (option_parser_t *parser);
 
   hb_bool_t annotate;
-  char *fore;
-  char *back;
+  const char *fore;
+  const char *back;
   double line_space;
   struct margin_t {
     double t, r, b, l;
@@ -185,7 +180,6 @@ struct shape_options_t : option_group_t
     num_features = 0;
     shapers = NULL;
     utf8_clusters = false;
-    cluster_level = HB_BUFFER_CLUSTER_LEVEL_DEFAULT;
     normalize_glyphs = false;
     num_iterations = 1;
 
@@ -193,9 +187,6 @@ struct shape_options_t : option_group_t
   }
   ~shape_options_t (void)
   {
-    g_free (direction);
-    g_free (language);
-    g_free (script);
     free (features);
     g_strfreev (shapers);
   }
@@ -211,7 +202,6 @@ struct shape_options_t : option_group_t
                         (bot ? HB_BUFFER_FLAG_BOT : 0) |
                         (eot ? HB_BUFFER_FLAG_EOT : 0) |
                         (preserve_default_ignorables ? HB_BUFFER_FLAG_PRESERVE_DEFAULT_IGNORABLES : 0)));
-    hb_buffer_set_cluster_level (buffer, cluster_level);
     hb_buffer_guess_segment_properties (buffer);
   }
 
@@ -262,9 +252,9 @@ struct shape_options_t : option_group_t
   }
 
   /* Buffer properties */
-  char *direction;
-  char *language;
-  char *script;
+  const char *direction;
+  const char *language;
+  const char *script;
 
   /* Buffer flags */
   hb_bool_t bot;
@@ -275,7 +265,6 @@ struct shape_options_t : option_group_t
   unsigned int num_features;
   char **shapers;
   hb_bool_t utf8_clusters;
-  hb_buffer_cluster_level_t cluster_level;
   hb_bool_t normalize_glyphs;
   unsigned int num_iterations;
 };
@@ -298,8 +287,6 @@ struct font_options_t : option_group_t
     add_options (parser);
   }
   ~font_options_t (void) {
-    g_free (font_file);
-    g_free (font_funcs);
     hb_font_destroy (font);
   }
 
@@ -307,13 +294,13 @@ struct font_options_t : option_group_t
 
   hb_font_t *get_font (void) const;
 
-  char *font_file;
+  const char *font_file;
   int face_index;
   int default_font_size;
   unsigned int subpixel_bits;
   mutable double font_size_x;
   mutable double font_size_y;
-  char *font_funcs;
+  const char *font_funcs;
 
   private:
   mutable hb_font_t *font;
@@ -331,16 +318,11 @@ struct text_options_t : option_group_t
 
     fp = NULL;
     gs = NULL;
-    line = NULL;
-    line_len = (unsigned int) -1;
+    text_len = (unsigned int) -1;
 
     add_options (parser);
   }
   ~text_options_t (void) {
-    g_free (text_before);
-    g_free (text_after);
-    g_free (text);
-    g_free (text_file);
     if (gs)
       g_string_free (gs, true);
     if (fp)
@@ -354,21 +336,21 @@ struct text_options_t : option_group_t
       g_set_error (error,
                   G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
                   "Only one of text and text-file can be set");
+
   };
 
   const char *get_line (unsigned int *len);
 
-  char *text_before;
-  char *text_after;
+  const char *text_before;
+  const char *text_after;
 
-  char *text;
-  char *text_file;
+  const char *text;
+  const char *text_file;
 
   private:
   FILE *fp;
   GString *gs;
-  char *line;
-  unsigned int line_len;
+  unsigned int text_len;
 };
 
 struct output_options_t : option_group_t
@@ -385,8 +367,6 @@ struct output_options_t : option_group_t
     add_options (parser);
   }
   ~output_options_t (void) {
-    g_free (output_file);
-    g_free (output_format);
     if (fp)
       fclose (fp);
   }
@@ -401,10 +381,7 @@ struct output_options_t : option_group_t
     if (output_file && !output_format) {
       output_format = strrchr (output_file, '.');
       if (output_format)
-      {
          output_format++; /* skip the dot */
-         output_format = strdup (output_format);
-      }
     }
 
     if (output_file && 0 == strcmp (output_file, "-"))
@@ -413,8 +390,8 @@ struct output_options_t : option_group_t
 
   FILE *get_file_handle (void);
 
-  char *output_file;
-  char *output_format;
+  const char *output_file;
+  const char *output_format;
   const char **supported_formats;
   bool explicit_output_format;
 
@@ -430,7 +407,6 @@ struct format_options_t : option_group_t
     show_text = false;
     show_unicode = false;
     show_line_num = false;
-    show_extents = false;
 
     add_options (parser);
   }
@@ -471,25 +447,7 @@ struct format_options_t : option_group_t
   hb_bool_t show_text;
   hb_bool_t show_unicode;
   hb_bool_t show_line_num;
-  hb_bool_t show_extents;
 };
 
-/* fallback implementation for scalbn()/scalbnf() for pre-2013 MSVC */
-#if defined (_MSC_VER) && (_MSC_VER < 1800)
-
-#ifndef FLT_RADIX
-#define FLT_RADIX 2
-#endif
-
-__inline long double scalbn (long double x, int exp)
-{
-  return x * (pow ((long double) FLT_RADIX, exp));
-}
-
-__inline float scalbnf (float x, int exp)
-{
-  return x * (pow ((float) FLT_RADIX, exp));
-}
-#endif
 
 #endif