Let NULL input charset in image reading, that defaults to locale one.

This commit is contained in:
Vreixo Formoso 2008-01-05 16:01:21 +01:00
parent f3c27e681f
commit c47e5a738d
3 changed files with 13 additions and 3 deletions

View File

@ -120,7 +120,7 @@ int main(int argc, char **argv)
0, /* uid; */ 0, /* uid; */
0, /* gid; */ 0, /* gid; */
0, /* mode */ 0, /* mode */
"UTF-8" /* input_charset */ NULL /* input_charset */
}; };
if (argc != 2) { if (argc != 2) {

View File

@ -1486,14 +1486,21 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
data->mode = opts->mode & ~S_IFMT; data->mode = opts->mode & ~S_IFMT;
data->messenger = messenger; data->messenger = messenger;
data->input_charset = strdup(opts->input_charset);
setlocale(LC_CTYPE, ""); setlocale(LC_CTYPE, "");
data->local_charset = strdup(nl_langinfo(CODESET)); data->local_charset = strdup(nl_langinfo(CODESET));
if (data->local_charset == NULL) { if (data->local_charset == NULL) {
ret = ISO_MEM_ERROR; ret = ISO_MEM_ERROR;
goto fs_cleanup; goto fs_cleanup;
} }
if (opts->input_charset != NULL) {
data->input_charset = strdup(opts->input_charset);
} else {
data->input_charset = strdup(data->local_charset);
}
if (data->input_charset == NULL) {
ret = ISO_MEM_ERROR;
goto fs_cleanup;
}
ifs->open = ifs_fs_open; ifs->open = ifs_fs_open;
ifs->close = ifs_fs_close; ifs->close = ifs_fs_close;

View File

@ -278,6 +278,9 @@ struct iso_read_opts
//TODO differ file and dir mode //TODO differ file and dir mode
//option to convert names to lower case? //option to convert names to lower case?
/**
* Input charset for RR file names. NULL to use default locale charset.
*/
char *input_charset; char *input_charset;
}; };