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

release-1.5.4.branch
Vreixo Formoso 15 years ago
parent f3c27e681f
commit c47e5a738d
  1. 2
      demo/iso_read.c
  2. 11
      src/fs_image.c
  3. 3
      src/libisofs.h

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

@ -1486,14 +1486,21 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
data->mode = opts->mode & ~S_IFMT;
data->messenger = messenger;
data->input_charset = strdup(opts->input_charset);
setlocale(LC_CTYPE, "");
data->local_charset = strdup(nl_langinfo(CODESET));
if (data->local_charset == NULL) {
ret = ISO_MEM_ERROR;
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->close = ifs_fs_close;

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

Loading…
Cancel
Save