For API stablility reasons, make iso_read_opts private.

This commit is contained in:
Vreixo Formoso
2008-01-26 14:00:46 +01:00
parent 74c82d181b
commit 29058378fd
7 changed files with 285 additions and 115 deletions

View File

@ -24,17 +24,7 @@ int main(int argc, char **argv)
IsoFileSource *file;
struct stat info;
IsoDataSource *src;
struct iso_read_opts opts = {
0, /* block */
0, /* norock */
0, /* nojoliet */
0, /* noiso1999 */
0, /* preferjoliet */
0, /* uid; */
0, /* gid; */
0, /* mode */
"UTF-8" /* input_charset */
};
IsoReadOpts *opts;
if (argc != 3) {
fprintf(stderr, "Usage: isocat /path/to/image /path/to/file\n");
@ -53,11 +43,17 @@ int main(int argc, char **argv)
return 1;
}
res = iso_image_filesystem_new(src, &opts, 1, &fs);
res = iso_read_opts_new(&opts, 0);
if (res < 0) {
fprintf(stderr, "Error creating read options\n");
return 1;
}
res = iso_image_filesystem_new(src, opts, 1, &fs);
if (res < 0) {
fprintf(stderr, "Error creating filesystem\n");
return 1;
}
iso_read_opts_free(opts);
res = fs->get_by_path(fs, argv[2], &file);
if (res < 0) {

View File

@ -34,17 +34,7 @@ int main(int argc, char **argv)
int ret = 0;
struct iso_read_image_features features;
uint32_t ms_block;
struct iso_read_opts ropts = {
0, /* block */
0, /* norock */
0, /* nojoliet */
0, /* noiso1999 */
0, /* preferjoliet */
0, /* uid; */
0, /* gid; */
0, /* mode */
"UTF-8" /* input_charset */
};
IsoReadOpts *ropts;
if (argc < 3) {
usage(argv);
@ -106,14 +96,19 @@ int main(int argc, char **argv)
}
/* import previous image */
ropts.block = 0; /* image always start on first block */
result = iso_image_import(image, src, &ropts, &features);
ret = iso_read_opts_new(&ropts, 0);
if (ret < 0) {
fprintf(stderr, "Error creating read options\n");
return 1;
}
result = iso_image_import(image, src, ropts, &features);
iso_data_source_unref(src);
if (result < 0) {
printf ("Error importing previous session %d\n", result);
return 1;
}
iso_read_opts_free(ropts);
/* add new dir */
result = iso_tree_add_dir_rec(image, iso_image_get_root(image), argv[2]);
if (result < 0) {

View File

@ -28,17 +28,7 @@ int main(int argc, char **argv)
unsigned char buf[2048];
FILE *fd;
IsoWriteOpts *opts;
struct iso_read_opts ropts = {
0, /* block */
0, /* norock */
0, /* nojoliet */
0, /* noiso1999 */
0, /* preferjoliet */
0, /* uid; */
0, /* gid; */
0, /* mode */
"UTF-8" /* input_charset */
};
IsoReadOpts *ropts;
if (argc < 4) {
usage(argv);
@ -70,7 +60,13 @@ int main(int argc, char **argv)
iso_tree_set_ignore_hidden(image, 0);
/* import previous image */
result = iso_image_import(image, src, &ropts, NULL);
result = iso_read_opts_new(&ropts, 0);
if (result < 0) {
fprintf(stderr, "Error creating read options\n");
return 1;
}
result = iso_image_import(image, src, ropts, NULL);
iso_read_opts_free(ropts);
iso_data_source_unref(src);
if (result < 0) {
printf ("Error importing previous session %d\n", result);

View File

@ -28,18 +28,8 @@ int main(int argc, char **argv)
unsigned char buf[2048];
FILE *fd;
IsoWriteOpts *opts;
IsoReadOpts *ropts;
uint32_t ms_block;
struct iso_read_opts ropts = {
0, /* block */
0, /* norock */
0, /* nojoliet */
0, /* noiso1999 */
0, /* preferjoliet */
0, /* uid; */
0, /* gid; */
0, /* mode */
"UTF-8" /* input_charset */
};
if (argc < 6) {
usage(argv);
@ -71,8 +61,14 @@ int main(int argc, char **argv)
iso_tree_set_ignore_hidden(image, 0);
/* import previous image */
ropts.block = atoi(argv[1]);
result = iso_image_import(image, src, &ropts, NULL);
result = iso_read_opts_new(&ropts, 0);
if (result < 0) {
fprintf(stderr, "Error creating read options\n");
return 1;
}
iso_read_opts_set_start_block(ropts, atoi(argv[1]));
result = iso_image_import(image, src, ropts, NULL);
iso_read_opts_free(ropts);
iso_data_source_unref(src);
if (result < 0) {
printf ("Error importing previous session %d\n", result);

View File

@ -107,17 +107,7 @@ int main(int argc, char **argv)
IsoImageFilesystem *fs;
IsoDataSource *src;
IsoFileSource *root;
struct iso_read_opts opts = {
0, /* block */
0, /* norock */
0, /* nojoliet */
0, /* noiso1999 */
0, /* preferjoliet */
0, /* uid; */
0, /* gid; */
0444, /* mode */
NULL /* input_charset */
};
IsoReadOpts *ropts;
if (argc != 2) {
printf ("You need to specify a valid path\n");
@ -133,7 +123,13 @@ int main(int argc, char **argv)
return 1;
}
result = iso_image_filesystem_new(src, &opts, 1, &fs);
result = iso_read_opts_new(&ropts, 0);
if (result < 0) {
fprintf(stderr, "Error creating read options\n");
return 1;
}
result = iso_image_filesystem_new(src, ropts, 1, &fs);
iso_read_opts_free(ropts);
if (result < 0) {
printf ("Error creating filesystem\n");
return 1;