提交 a75c1b12 编写于 作者: B Behdad Esfahbod

Move code around

上级 7bf6ecd3
......@@ -121,9 +121,10 @@ option_parser_t::parse (int *argc, char ***argv)
GError *parse_error = NULL;
if (!g_option_context_parse (context, argc, argv, &parse_error))
{
if (parse_error != NULL)
if (parse_error != NULL) {
fail (TRUE, "%s", parse_error->message);
else
//g_error_free (parse_error);
} else
fail (TRUE, "Option parse error");
}
}
......@@ -543,3 +544,25 @@ text_options_t::get_line (unsigned int *len)
*len = ret_len;
return ret;
}
FILE *
output_options_t::get_file_handle (void)
{
if (fp)
return fp;
if (output_file)
fp = fopen (output_file, "wb");
else {
#if HAVE_IO_H
_setmode (fileno (stdout), O_BINARY);
#endif
fp = stdout;
}
if (!fp)
fail (FALSE, "Cannot open output file `%s': %s",
g_filename_display_name (output_file), strerror (errno));
return fp;
}
......@@ -237,25 +237,7 @@ struct output_options_t : option_group_t
output_file = NULL; /* STDOUT */
}
FILE *get_file_handle (void)
{
if (fp)
return fp;
if (output_file)
fp = fopen (output_file, "wb");
else {
#if HAVE_IO_H
_setmode (fileno (stdout), O_BINARY);
#endif
fp = stdout;
}
if (!fp)
fail (FALSE, "Cannot open output file `%s': %s",
g_filename_display_name (output_file), strerror (errno));
return fp;
}
FILE *get_file_handle (void);
virtual void init (const font_options_t *font_opts) = 0;
virtual void consume_line (hb_buffer_t *buffer,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册