archive_plugin: use GError in the open() method
This commit is contained in:
@@ -98,7 +98,7 @@ bz2_destroy(struct bz2_archive_file *data)
|
||||
/* archive open && listing routine */
|
||||
|
||||
static struct archive_file *
|
||||
bz2_open(const char *pathname)
|
||||
bz2_open(const char *pathname, GError **error_r)
|
||||
{
|
||||
struct bz2_archive_file *context;
|
||||
int len;
|
||||
@@ -107,8 +107,7 @@ bz2_open(const char *pathname)
|
||||
archive_file_init(&context->base, &bz2_archive_plugin);
|
||||
|
||||
//open archive
|
||||
if (!input_stream_open(&context->istream, pathname, NULL)) {
|
||||
g_warning("failed to open an bzip2 archive %s\n",pathname);
|
||||
if (!input_stream_open(&context->istream, pathname, error_r)) {
|
||||
g_free(context);
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -90,7 +90,7 @@ listdir_recur(const char *psz_path, struct iso9660_archive_file *context)
|
||||
}
|
||||
|
||||
static struct archive_file *
|
||||
iso9660_archive_open(const char *pathname)
|
||||
iso9660_archive_open(const char *pathname, GError **error_r)
|
||||
{
|
||||
struct iso9660_archive_file *context =
|
||||
g_new(struct iso9660_archive_file, 1);
|
||||
@@ -102,7 +102,8 @@ iso9660_archive_open(const char *pathname)
|
||||
/* open archive */
|
||||
context->iso = iso9660_open (pathname);
|
||||
if (context->iso == NULL) {
|
||||
g_warning("iso %s open failed\n", pathname);
|
||||
g_set_error(error_r, iso9660_quark(), 0,
|
||||
"Failed to open ISO9660 file %s", pathname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@@ -52,7 +52,7 @@ zzip_quark(void)
|
||||
/* archive open && listing routine */
|
||||
|
||||
static struct archive_file *
|
||||
zzip_archive_open(const char *pathname)
|
||||
zzip_archive_open(const char *pathname, GError **error_r)
|
||||
{
|
||||
struct zzip_archive *context = g_malloc(sizeof(*context));
|
||||
ZZIP_DIRENT dirent;
|
||||
@@ -63,7 +63,8 @@ zzip_archive_open(const char *pathname)
|
||||
context->list = NULL;
|
||||
context->dir = zzip_dir_open(pathname, NULL);
|
||||
if (context->dir == NULL) {
|
||||
g_warning("zipfile %s open failed\n", pathname);
|
||||
g_set_error(error_r, zzip_quark(), 0,
|
||||
"Failed to open ZIP file %s", pathname);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user