archive/zip: renamed plugin to "zzip"

This plugin is based on libzzip.
This commit is contained in:
Max Kellermann 2009-12-15 20:29:44 +01:00
parent 530e480748
commit c959148ed1
5 changed files with 45 additions and 43 deletions

View File

@ -354,8 +354,8 @@ if HAVE_BZ2
ARCHIVE_SRC += src/archive/bz2_plugin.c ARCHIVE_SRC += src/archive/bz2_plugin.c
endif endif
if HAVE_ZIP if HAVE_ZZIP
ARCHIVE_SRC += src/archive/zip_plugin.c ARCHIVE_SRC += src/archive/zzip_archive_plugin.c
endif endif
if HAVE_ISO if HAVE_ISO

2
NEWS
View File

@ -10,6 +10,8 @@ ver 0.16 (20??/??/??)
- "load" supports remote playlists (extm3u, pls, asx, xspf, lastfm://) - "load" supports remote playlists (extm3u, pls, asx, xspf, lastfm://)
- allow changing replay gain mode on-the-fly - allow changing replay gain mode on-the-fly
- omitting the range end is possible - omitting the range end is possible
* archive:
- zip: renamed plugin to "zzip"
* input: * input:
- lastfm: obsolete plugin removed - lastfm: obsolete plugin removed
* tags: * tags:

View File

@ -355,18 +355,18 @@ if test x$enable_bzip2 = xyes; then
AC_DEFINE(HAVE_BZ2, 1, [Define to have bz2 archive support]) AC_DEFINE(HAVE_BZ2, 1, [Define to have bz2 archive support])
fi fi
dnl zip dnl zzip
AC_ARG_ENABLE(zip, AC_ARG_ENABLE(zzip,
AS_HELP_STRING([--enable-zip], AS_HELP_STRING([--enable-zzip],
[enable zip archive support (default: disabled)]),, [enable zip archive support (default: disabled)]),,
enable_zip=no) enable_zzip=no)
MPD_AUTO_PKG(zip, ZZIP, [zziplib >= 0.13], MPD_AUTO_PKG(zzip, ZZIP, [zziplib >= 0.13],
[libzzip archive library], [libzzip not found]) [libzzip archive library], [libzzip not found])
AM_CONDITIONAL(HAVE_ZIP, test x$enable_zip = xyes) AM_CONDITIONAL(HAVE_ZZIP, test x$enable_zzip = xyes)
if test x$enable_zip = xyes; then if test x$enable_zzip = xyes; then
AC_DEFINE(HAVE_ZIP, 1, [Define to have zip archive support]) AC_DEFINE(HAVE_ZZIP, 1, [Define to have zip archive support])
fi fi
dnl iso9660 dnl iso9660
@ -386,7 +386,7 @@ fi
dnl archive API dnl archive API
if if
test x$enable_bzip2 = xyes || test x$enable_bzip2 = xyes ||
test x$enable_zip = xyes || test x$enable_zzip = xyes ||
test x$enable_iso9660 = xyes; then test x$enable_iso9660 = xyes; then
enable_archive=yes enable_archive=yes
AC_DEFINE(ENABLE_ARCHIVE, 1, [The archive API is available]) AC_DEFINE(ENABLE_ARCHIVE, 1, [The archive API is available])
@ -1625,7 +1625,7 @@ else
echo " ISO 9660 archives support .....disabled" echo " ISO 9660 archives support .....disabled"
fi fi
if test x$enable_zip = xyes; then if test x$enable_zzip = xyes; then
echo " ZIP archives support ..........enabled" echo " ZIP archives support ..........enabled"
else else
echo " ZIP archives support ..........disabled" echo " ZIP archives support ..........disabled"

View File

@ -38,12 +38,12 @@ typedef struct {
GSList *iter; GSList *iter;
} zip_context; } zip_context;
static const struct input_plugin zip_inputplugin; static const struct input_plugin zzip_input_plugin;
/* archive open && listing routine */ /* archive open && listing routine */
static struct archive_file * static struct archive_file *
zip_open(char * pathname) zzip_archive_open(char *pathname)
{ {
zip_context *context = g_malloc(sizeof(zip_context)); zip_context *context = g_malloc(sizeof(zip_context));
ZZIP_DIRENT dirent; ZZIP_DIRENT dirent;
@ -68,7 +68,7 @@ zip_open(char * pathname)
} }
static void static void
zip_scan_reset(struct archive_file *file) zzip_archive_scan_reset(struct archive_file *file)
{ {
zip_context *context = (zip_context *) file; zip_context *context = (zip_context *) file;
//reset iterator //reset iterator
@ -76,7 +76,7 @@ zip_scan_reset(struct archive_file *file)
} }
static char * static char *
zip_scan_next(struct archive_file *file) zzip_archive_scan_next(struct archive_file *file)
{ {
zip_context *context = (zip_context *) file; zip_context *context = (zip_context *) file;
char *data = NULL; char *data = NULL;
@ -89,7 +89,7 @@ zip_scan_next(struct archive_file *file)
} }
static void static void
zip_close(struct archive_file *file) zzip_archive_close(struct archive_file *file)
{ {
zip_context *context = (zip_context *) file; zip_context *context = (zip_context *) file;
if (context->list) { if (context->list) {
@ -107,14 +107,14 @@ zip_close(struct archive_file *file)
/* single archive handling */ /* single archive handling */
static bool static bool
zip_open_stream(struct archive_file *file, struct input_stream *is, zzip_archive_open_stream(struct archive_file *file, struct input_stream *is,
const char *pathname) const char *pathname)
{ {
zip_context *context = (zip_context *) file; zip_context *context = (zip_context *) file;
ZZIP_STAT z_stat; ZZIP_STAT z_stat;
//setup file ops //setup file ops
is->plugin = &zip_inputplugin; is->plugin = &zzip_input_plugin;
//insert back reference //insert back reference
is->data = context; is->data = context;
//we are seekable (but its not recommendent to do so) //we are seekable (but its not recommendent to do so)
@ -131,16 +131,16 @@ zip_open_stream(struct archive_file *file, struct input_stream *is,
} }
static void static void
zip_is_close(struct input_stream *is) zzip_input_close(struct input_stream *is)
{ {
zip_context *context = (zip_context *) is->data; zip_context *context = (zip_context *) is->data;
zzip_file_close (context->file); zzip_file_close (context->file);
zip_close((struct archive_file *)context); zzip_archive_close((struct archive_file *)context);
} }
static size_t static size_t
zip_is_read(struct input_stream *is, void *ptr, size_t size) zzip_input_read(struct input_stream *is, void *ptr, size_t size)
{ {
zip_context *context = (zip_context *) is->data; zip_context *context = (zip_context *) is->data;
int ret; int ret;
@ -153,15 +153,15 @@ zip_is_read(struct input_stream *is, void *ptr, size_t size)
} }
static bool static bool
zip_is_eof(struct input_stream *is) zzip_input_eof(struct input_stream *is)
{ {
zip_context *context = (zip_context *) is->data; zip_context *context = (zip_context *) is->data;
return ((size_t) zzip_tell(context->file) == context->length); return ((size_t) zzip_tell(context->file) == context->length);
} }
static bool static bool
zip_is_seek(G_GNUC_UNUSED struct input_stream *is, zzip_input_seek(G_GNUC_UNUSED struct input_stream *is,
G_GNUC_UNUSED goffset offset, G_GNUC_UNUSED int whence) G_GNUC_UNUSED goffset offset, G_GNUC_UNUSED int whence)
{ {
zip_context *context = (zip_context *) is->data; zip_context *context = (zip_context *) is->data;
zzip_off_t ofs = zzip_seek(context->file, offset, whence); zzip_off_t ofs = zzip_seek(context->file, offset, whence);
@ -174,24 +174,24 @@ zip_is_seek(G_GNUC_UNUSED struct input_stream *is,
/* exported structures */ /* exported structures */
static const char *const zip_extensions[] = { static const char *const zzip_archive_extensions[] = {
"zip", "zip",
NULL NULL
}; };
static const struct input_plugin zip_inputplugin = { static const struct input_plugin zzip_input_plugin = {
.close = zip_is_close, .close = zzip_input_close,
.read = zip_is_read, .read = zzip_input_read,
.eof = zip_is_eof, .eof = zzip_input_eof,
.seek = zip_is_seek, .seek = zzip_input_seek,
}; };
const struct archive_plugin zip_plugin = { const struct archive_plugin zzip_archive_plugin = {
.name = "zip", .name = "zzip",
.open = zip_open, .open = zzip_archive_open,
.scan_reset = zip_scan_reset, .scan_reset = zzip_archive_scan_reset,
.scan_next = zip_scan_next, .scan_next = zzip_archive_scan_next,
.open_stream = zip_open_stream, .open_stream = zzip_archive_open_stream,
.close = zip_close, .close = zzip_archive_close,
.suffixes = zip_extensions .suffixes = zzip_archive_extensions
}; };

View File

@ -26,15 +26,15 @@
#include <glib.h> #include <glib.h>
extern const struct archive_plugin bz2_plugin; extern const struct archive_plugin bz2_plugin;
extern const struct archive_plugin zip_plugin; extern const struct archive_plugin zzip_archive_plugin;
extern const struct archive_plugin iso_plugin; extern const struct archive_plugin iso_plugin;
static const struct archive_plugin *const archive_plugins[] = { static const struct archive_plugin *const archive_plugins[] = {
#ifdef HAVE_BZ2 #ifdef HAVE_BZ2
&bz2_plugin, &bz2_plugin,
#endif #endif
#ifdef HAVE_ZIP #ifdef HAVE_ZZIP
&zip_plugin, &zzip_archive_plugin,
#endif #endif
#ifdef HAVE_ISO #ifdef HAVE_ISO
&iso_plugin, &iso_plugin,