Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
71fee097
Commit
71fee097
authored
Dec 16, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
archive_plugin: use GError in the open() method
parent
f9af1a44
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
14 deletions
+23
-14
bz2_archive_plugin.c
src/archive/bz2_archive_plugin.c
+2
-3
iso9660_archive_plugin.c
src/archive/iso9660_archive_plugin.c
+3
-2
zzip_archive_plugin.c
src/archive/zzip_archive_plugin.c
+3
-2
archive_plugin.c
src/archive_plugin.c
+7
-2
archive_plugin.h
src/archive_plugin.h
+3
-2
archive_input_plugin.c
src/input/archive_input_plugin.c
+1
-1
update_walk.c
src/update_walk.c
+4
-2
No files found.
src/archive/bz2_archive_plugin.c
View file @
71fee097
...
@@ -98,7 +98,7 @@ bz2_destroy(struct bz2_archive_file *data)
...
@@ -98,7 +98,7 @@ bz2_destroy(struct bz2_archive_file *data)
/* archive open && listing routine */
/* archive open && listing routine */
static
struct
archive_file
*
static
struct
archive_file
*
bz2_open
(
const
char
*
pathname
)
bz2_open
(
const
char
*
pathname
,
GError
**
error_r
)
{
{
struct
bz2_archive_file
*
context
;
struct
bz2_archive_file
*
context
;
int
len
;
int
len
;
...
@@ -107,8 +107,7 @@ bz2_open(const char *pathname)
...
@@ -107,8 +107,7 @@ bz2_open(const char *pathname)
archive_file_init
(
&
context
->
base
,
&
bz2_archive_plugin
);
archive_file_init
(
&
context
->
base
,
&
bz2_archive_plugin
);
//open archive
//open archive
if
(
!
input_stream_open
(
&
context
->
istream
,
pathname
,
NULL
))
{
if
(
!
input_stream_open
(
&
context
->
istream
,
pathname
,
error_r
))
{
g_warning
(
"failed to open an bzip2 archive %s
\n
"
,
pathname
);
g_free
(
context
);
g_free
(
context
);
return
NULL
;
return
NULL
;
}
}
...
...
src/archive/iso9660_archive_plugin.c
View file @
71fee097
...
@@ -90,7 +90,7 @@ listdir_recur(const char *psz_path, struct iso9660_archive_file *context)
...
@@ -90,7 +90,7 @@ listdir_recur(const char *psz_path, struct iso9660_archive_file *context)
}
}
static
struct
archive_file
*
static
struct
archive_file
*
iso9660_archive_open
(
const
char
*
pathname
)
iso9660_archive_open
(
const
char
*
pathname
,
GError
**
error_r
)
{
{
struct
iso9660_archive_file
*
context
=
struct
iso9660_archive_file
*
context
=
g_new
(
struct
iso9660_archive_file
,
1
);
g_new
(
struct
iso9660_archive_file
,
1
);
...
@@ -102,7 +102,8 @@ iso9660_archive_open(const char *pathname)
...
@@ -102,7 +102,8 @@ iso9660_archive_open(const char *pathname)
/* open archive */
/* open archive */
context
->
iso
=
iso9660_open
(
pathname
);
context
->
iso
=
iso9660_open
(
pathname
);
if
(
context
->
iso
==
NULL
)
{
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
;
return
NULL
;
}
}
...
...
src/archive/zzip_archive_plugin.c
View file @
71fee097
...
@@ -52,7 +52,7 @@ zzip_quark(void)
...
@@ -52,7 +52,7 @@ zzip_quark(void)
/* archive open && listing routine */
/* archive open && listing routine */
static
struct
archive_file
*
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
));
struct
zzip_archive
*
context
=
g_malloc
(
sizeof
(
*
context
));
ZZIP_DIRENT
dirent
;
ZZIP_DIRENT
dirent
;
...
@@ -63,7 +63,8 @@ zzip_archive_open(const char *pathname)
...
@@ -63,7 +63,8 @@ zzip_archive_open(const char *pathname)
context
->
list
=
NULL
;
context
->
list
=
NULL
;
context
->
dir
=
zzip_dir_open
(
pathname
,
NULL
);
context
->
dir
=
zzip_dir_open
(
pathname
,
NULL
);
if
(
context
->
dir
==
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
;
return
NULL
;
}
}
...
...
src/archive_plugin.c
View file @
71fee097
...
@@ -23,15 +23,17 @@
...
@@ -23,15 +23,17 @@
#include <assert.h>
#include <assert.h>
struct
archive_file
*
struct
archive_file
*
archive_file_open
(
const
struct
archive_plugin
*
plugin
,
const
char
*
path
)
archive_file_open
(
const
struct
archive_plugin
*
plugin
,
const
char
*
path
,
GError
**
error_r
)
{
{
struct
archive_file
*
file
;
struct
archive_file
*
file
;
assert
(
plugin
!=
NULL
);
assert
(
plugin
!=
NULL
);
assert
(
plugin
->
open
!=
NULL
);
assert
(
plugin
->
open
!=
NULL
);
assert
(
path
!=
NULL
);
assert
(
path
!=
NULL
);
assert
(
error_r
==
NULL
||
*
error_r
==
NULL
);
file
=
plugin
->
open
(
path
);
file
=
plugin
->
open
(
path
,
error_r
);
if
(
file
!=
NULL
)
{
if
(
file
!=
NULL
)
{
assert
(
file
->
plugin
!=
NULL
);
assert
(
file
->
plugin
!=
NULL
);
...
@@ -39,6 +41,9 @@ archive_file_open(const struct archive_plugin *plugin, const char *path)
...
@@ -39,6 +41,9 @@ archive_file_open(const struct archive_plugin *plugin, const char *path)
assert
(
file
->
plugin
->
scan_reset
!=
NULL
);
assert
(
file
->
plugin
->
scan_reset
!=
NULL
);
assert
(
file
->
plugin
->
scan_next
!=
NULL
);
assert
(
file
->
plugin
->
scan_next
!=
NULL
);
assert
(
file
->
plugin
->
open_stream
!=
NULL
);
assert
(
file
->
plugin
->
open_stream
!=
NULL
);
assert
(
error_r
==
NULL
||
*
error_r
==
NULL
);
}
else
{
assert
(
error_r
==
NULL
||
*
error_r
!=
NULL
);
}
}
return
file
;
return
file
;
...
...
src/archive_plugin.h
View file @
71fee097
...
@@ -48,7 +48,7 @@ struct archive_plugin {
...
@@ -48,7 +48,7 @@ struct archive_plugin {
* returns pointer to handle used is all operations with this archive
* returns pointer to handle used is all operations with this archive
* or NULL when opening fails
* or NULL when opening fails
*/
*/
struct
archive_file
*
(
*
open
)(
const
char
*
path_fs
);
struct
archive_file
*
(
*
open
)(
const
char
*
path_fs
,
GError
**
error_r
);
/**
/**
* reset routine will move current read index in archive to default
* reset routine will move current read index in archive to default
...
@@ -90,7 +90,8 @@ struct archive_plugin {
...
@@ -90,7 +90,8 @@ struct archive_plugin {
};
};
struct
archive_file
*
struct
archive_file
*
archive_file_open
(
const
struct
archive_plugin
*
plugin
,
const
char
*
path
);
archive_file_open
(
const
struct
archive_plugin
*
plugin
,
const
char
*
path
,
GError
**
error_r
);
void
void
archive_file_close
(
struct
archive_file
*
file
);
archive_file_close
(
struct
archive_file
*
file
);
...
...
src/input/archive_input_plugin.c
View file @
71fee097
...
@@ -61,7 +61,7 @@ input_archive_open(struct input_stream *is, const char *pathname,
...
@@ -61,7 +61,7 @@ input_archive_open(struct input_stream *is, const char *pathname,
return
false
;
return
false
;
}
}
file
=
archive_file_open
(
arplug
,
archive
);
file
=
archive_file_open
(
arplug
,
archive
,
error_r
);
if
(
file
==
NULL
)
if
(
file
==
NULL
)
return
false
;
return
false
;
...
...
src/update_walk.c
View file @
71fee097
...
@@ -394,6 +394,7 @@ update_archive_file(struct directory *parent, const char *name,
...
@@ -394,6 +394,7 @@ update_archive_file(struct directory *parent, const char *name,
const
struct
stat
*
st
,
const
struct
stat
*
st
,
const
struct
archive_plugin
*
plugin
)
const
struct
archive_plugin
*
plugin
)
{
{
GError
*
error
=
NULL
;
char
*
path_fs
;
char
*
path_fs
;
struct
archive_file
*
file
;
struct
archive_file
*
file
;
struct
directory
*
directory
;
struct
directory
*
directory
;
...
@@ -409,10 +410,11 @@ update_archive_file(struct directory *parent, const char *name,
...
@@ -409,10 +410,11 @@ update_archive_file(struct directory *parent, const char *name,
path_fs
=
map_directory_child_fs
(
parent
,
name
);
path_fs
=
map_directory_child_fs
(
parent
,
name
);
/* open archive */
/* open archive */
file
=
archive_file_open
(
plugin
,
path_fs
);
file
=
archive_file_open
(
plugin
,
path_fs
,
&
error
);
if
(
file
==
NULL
)
{
if
(
file
==
NULL
)
{
g_warning
(
"unable to open archive %s"
,
path_fs
);
g_free
(
path_fs
);
g_free
(
path_fs
);
g_warning
(
"%s"
,
error
->
message
);
g_error_free
(
error
);
return
;
return
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment