Move code around

This commit is contained in:
Behdad Esfahbod 2011-09-16 01:16:41 -04:00
parent 7bf6ecd3bf
commit a75c1b1251
2 changed files with 26 additions and 21 deletions

View File

@ -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;
}

View File

@ -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,