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
endif
if HAVE_ZIP
ARCHIVE_SRC += src/archive/zip_plugin.c
if HAVE_ZZIP
ARCHIVE_SRC += src/archive/zzip_archive_plugin.c
endif
if HAVE_ISO

2
NEWS
View File

@ -10,6 +10,8 @@ ver 0.16 (20??/??/??)
- "load" supports remote playlists (extm3u, pls, asx, xspf, lastfm://)
- allow changing replay gain mode on-the-fly
- omitting the range end is possible
* archive:
- zip: renamed plugin to "zzip"
* input:
- lastfm: obsolete plugin removed
* 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])
fi
dnl zip
AC_ARG_ENABLE(zip,
AS_HELP_STRING([--enable-zip],
dnl zzip
AC_ARG_ENABLE(zzip,
AS_HELP_STRING([--enable-zzip],
[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])
AM_CONDITIONAL(HAVE_ZIP, test x$enable_zip = xyes)
if test x$enable_zip = xyes; then
AC_DEFINE(HAVE_ZIP, 1, [Define to have zip archive support])
AM_CONDITIONAL(HAVE_ZZIP, test x$enable_zzip = xyes)
if test x$enable_zzip = xyes; then
AC_DEFINE(HAVE_ZZIP, 1, [Define to have zip archive support])
fi
dnl iso9660
@ -386,7 +386,7 @@ fi
dnl archive API
if
test x$enable_bzip2 = xyes ||
test x$enable_zip = xyes ||
test x$enable_zzip = xyes ||
test x$enable_iso9660 = xyes; then
enable_archive=yes
AC_DEFINE(ENABLE_ARCHIVE, 1, [The archive API is available])
@ -1625,7 +1625,7 @@ else
echo " ISO 9660 archives support .....disabled"
fi
if test x$enable_zip = xyes; then
if test x$enable_zzip = xyes; then
echo " ZIP archives support ..........enabled"
else
echo " ZIP archives support ..........disabled"

View File

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

View File

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