aboutsummaryrefslogtreecommitdiffstats
path: root/src/archive/iso_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-14 23:53:04 +0100
committerMax Kellermann <max@duempel.org>2009-12-15 23:12:11 +0100
commit228b03edf8513aa1cdaf4e4647279cc580245555 (patch)
tree7f5b03a9727fb8c371885469296eb7f49f6fa68b /src/archive/iso_plugin.c
parentd000d31355c824a076324b647a3f056aab9ddabe (diff)
downloadmpd-228b03edf8513aa1cdaf4e4647279cc580245555.tar.gz
mpd-228b03edf8513aa1cdaf4e4647279cc580245555.tar.xz
mpd-228b03edf8513aa1cdaf4e4647279cc580245555.zip
input_stream: return errors with GError
Diffstat (limited to '')
-rw-r--r--src/archive/iso_plugin.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/archive/iso_plugin.c b/src/archive/iso_plugin.c
index b56653d56..a2880ba86 100644
--- a/src/archive/iso_plugin.c
+++ b/src/archive/iso_plugin.c
@@ -44,6 +44,12 @@ typedef struct {
static const struct input_plugin iso_inputplugin;
+static inline GQuark
+iso9660_quark(void)
+{
+ return g_quark_from_static_string("iso9660");
+}
+
/* archive open && listing routine */
static void
@@ -141,7 +147,7 @@ iso_close(struct archive_file *file)
static bool
iso_open_stream(struct archive_file *file, struct input_stream *is,
- const char *pathname)
+ const char *pathname, GError **error_r)
{
iso_context *context = (iso_context *) file;
//setup file ops
@@ -154,7 +160,8 @@ iso_open_stream(struct archive_file *file, struct input_stream *is,
context->statbuf = iso9660_ifs_stat_translate (context->iso, pathname);
if (context->statbuf == NULL) {
- g_warning("file %s not found in iso\n", pathname);
+ g_set_error(error_r, iso9660_quark(), 0,
+ "not found in the ISO file: %s", pathname);
return false;
}
context->cur_ofs = 0;
@@ -173,7 +180,7 @@ iso_is_close(struct input_stream *is)
static size_t
-iso_is_read(struct input_stream *is, void *ptr, size_t size)
+iso_is_read(struct input_stream *is, void *ptr, size_t size, GError **error_r)
{
iso_context *context = (iso_context *) is->data;
int toread, readed = 0;
@@ -197,9 +204,10 @@ iso_is_read(struct input_stream *is, void *ptr, size_t size)
context->statbuf->lsn + cur_block, no_blocks);
if (readed != no_blocks * ISO_BLOCKSIZE) {
- g_warning("error reading ISO file at lsn %lu\n",
- (long unsigned int) cur_block );
- return -1;
+ g_set_error(error_r, iso9660_quark(), 0,
+ "error reading ISO file at lsn %lu",
+ (long unsigned int) cur_block);
+ return 0;
}
if (left_bytes < size) {
readed = left_bytes;