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
94fffb33
Commit
94fffb33
authored
Jan 24, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
archive/*: convert to C++
parent
dc2e64c9
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
202 additions
and
162 deletions
+202
-162
Makefile.am
Makefile.am
+14
-15
ArchiveInternal.hxx
src/ArchiveInternal.hxx
+3
-3
ArchiveList.cxx
src/ArchiveList.cxx
+6
-6
ArchiveList.hxx
src/ArchiveList.hxx
+3
-3
ArchiveLookup.cxx
src/ArchiveLookup.cxx
+2
-2
ArchiveLookup.hxx
src/ArchiveLookup.hxx
+3
-9
ArchivePlugin.cxx
src/ArchivePlugin.cxx
+3
-3
ArchivePlugin.hxx
src/ArchivePlugin.hxx
+3
-5
CommandLine.cxx
src/CommandLine.cxx
+2
-2
InputRegistry.cxx
src/InputRegistry.cxx
+1
-1
Main.cxx
src/Main.cxx
+1
-3
UpdateArchive.cxx
src/UpdateArchive.cxx
+2
-5
Bzip2ArchivePlugin.cxx
src/archive/Bzip2ArchivePlugin.cxx
+47
-30
Bzip2ArchivePlugin.hxx
src/archive/Bzip2ArchivePlugin.hxx
+3
-3
Iso9660ArchivePlugin.cxx
src/archive/Iso9660ArchivePlugin.cxx
+29
-17
Iso9660ArchivePlugin.hxx
src/archive/Iso9660ArchivePlugin.hxx
+3
-3
ZzipArchivePlugin.cxx
src/archive/ZzipArchivePlugin.cxx
+51
-35
ZzipArchivePlugin.hxx
src/archive/ZzipArchivePlugin.hxx
+3
-3
ArchiveInputPlugin.cxx
src/input/ArchiveInputPlugin.cxx
+17
-6
ArchiveInputPlugin.hxx
src/input/ArchiveInputPlugin.hxx
+3
-3
dump_text_file.cxx
test/dump_text_file.cxx
+2
-2
run_input.cxx
test/run_input.cxx
+1
-3
No files found.
Makefile.am
View file @
94fffb33
...
...
@@ -130,14 +130,6 @@ mpd_headers = \
src/string_util.h
\
src/zeroconf.h src/zeroconf-internal.h
\
src/timer.h
\
src/archive_api.h
\
src/archive_internal.h
\
src/archive_list.h
\
src/archive_plugin.h
\
src/archive/bz2_archive_plugin.h
\
src/archive/iso9660_archive_plugin.h
\
src/archive/zzip_archive_plugin.h
\
src/input/archive_input_plugin.h
\
src/mpd_error.h
src_mpd_SOURCES
=
\
...
...
@@ -414,10 +406,11 @@ src_mpd_SOURCES += \
src/UpdateArchive.cxx src/UpdateArchive.hxx
libarchive_a_SOURCES
=
\
src/archive_api.c
\
src/archive_list.c
\
src/archive_plugin.c
\
src/input/archive_input_plugin.c
src/ArchiveLookup.cxx src/ArchiveLookup.hxx
\
src/ArchiveList.cxx src/ArchiveList.hxx
\
src/ArchivePlugin.cxx src/ArchivePlugin.hxx
\
src/ArchiveInternal.hxx
\
src/input/ArchiveInputPlugin.cxx src/input/ArchiveInputPlugin.hxx
libarchive_a_CPPFLAGS
=
$(AM_CPPFLAGS)
\
$(BZ2_CFLAGS)
\
$(ISO9660_CFLAGS)
\
...
...
@@ -430,15 +423,21 @@ ARCHIVE_LIBS = \
$(ZZIP_LIBS)
if
HAVE_BZ2
libarchive_a_SOURCES
+=
src/archive/bz2_archive_plugin.c
libarchive_a_SOURCES
+=
\
src/archive/Bzip2ArchivePlugin.cxx
\
src/archive/Bzip2ArchivePlugin.hxx
endif
if
HAVE_ZZIP
libarchive_a_SOURCES
+=
src/archive/zzip_archive_plugin.c
libarchive_a_SOURCES
+=
\
src/archive/ZzipArchivePlugin.cxx
\
src/archive/ZzipArchivePlugin.hxx
endif
if
HAVE_ISO9660
libarchive_a_SOURCES
+=
src/archive/iso9660_archive_plugin.c
libarchive_a_SOURCES
+=
\
src/archive/Iso9660ArchivePlugin.cxx
\
src/archive/Iso9660ArchivePlugin.hxx
endif
else
...
...
src/
archive_internal.h
→
src/
ArchiveInternal.hxx
View file @
94fffb33
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_ARCHIVE_INTERNAL_H
#define MPD_ARCHIVE_INTERNAL_H
#ifndef MPD_ARCHIVE_INTERNAL_H
XX
#define MPD_ARCHIVE_INTERNAL_H
XX
struct
archive_file
{
const
struct
archive_plugin
*
plugin
;
...
...
src/
archive_list.c
→
src/
ArchiveList.cxx
View file @
94fffb33
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -18,12 +18,12 @@
*/
#include "config.h"
#include "
archive_list.h
"
#include "
archive_plugin.h
"
#include "
ArchiveList.hxx
"
#include "
ArchivePlugin.hxx
"
#include "string_util.h"
#include "archive/
bz2_archive_plugin.h
"
#include "archive/
iso9660_archive_plugin.h
"
#include "archive/
zzip_archive_plugin.h
"
#include "archive/
Bzip2ArchivePlugin.hxx
"
#include "archive/
Iso9660ArchivePlugin.hxx
"
#include "archive/
ZzipArchivePlugin.hxx
"
#include <string.h>
#include <glib.h>
...
...
src/
archive_list.h
→
src/
ArchiveList.hxx
View file @
94fffb33
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_ARCHIVE_LIST_H
#define MPD_ARCHIVE_LIST_H
#ifndef MPD_ARCHIVE_LIST_H
XX
#define MPD_ARCHIVE_LIST_H
XX
struct
archive_plugin
;
...
...
src/
archive_api.c
→
src/
ArchiveLookup.cxx
View file @
94fffb33
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -18,7 +18,7 @@
*/
#include "config.h"
/* must be first for large file support */
#include "
archive_api.h
"
#include "
ArchiveLookup.hxx
"
#include <stdio.h>
...
...
src/
archive_api.h
→
src/
ArchiveLookup.hxx
View file @
94fffb33
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_ARCHIVE_
API_H
#define MPD_ARCHIVE_
API_H
#ifndef MPD_ARCHIVE_
LOOKUP_HXX
#define MPD_ARCHIVE_
LOOKUP_HXX
/*
* This is the public API which is used by archive plugins to
...
...
@@ -26,12 +26,6 @@
*
*/
#include "archive_internal.h"
#include "archive_plugin.h"
#include "input_stream.h"
#include <stdbool.h>
bool
archive_lookup
(
char
*
pathname
,
char
**
archive
,
char
**
inpath
,
char
**
suffix
);
#endif
...
...
src/
archive_plugin.c
→
src/
ArchivePlugin.cxx
View file @
94fffb33
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "
archive_plugin.h
"
#include "
archive_internal.h
"
#include "
ArchivePlugin.hxx
"
#include "
ArchiveInternal.hxx
"
#include <assert.h>
...
...
src/
archive_plugin.h
→
src/
ArchivePlugin.hxx
View file @
94fffb33
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,13 +17,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_ARCHIVE_PLUGIN_H
#define MPD_ARCHIVE_PLUGIN_H
#ifndef MPD_ARCHIVE_PLUGIN_H
XX
#define MPD_ARCHIVE_PLUGIN_H
XX
#include <glib.h>
#include <stdbool.h>
struct
input_stream
;
struct
archive_file
;
...
...
src/CommandLine.cxx
View file @
94fffb33
...
...
@@ -39,8 +39,8 @@
#endif
#ifdef ENABLE_ARCHIVE
#include "
archive_list.h
"
#include "
archive_plugin.h
"
#include "
ArchiveList.hxx
"
#include "
ArchivePlugin.hxx
"
#endif
#include <glib.h>
...
...
src/InputRegistry.cxx
View file @
94fffb33
...
...
@@ -22,7 +22,7 @@
#include "input/FileInputPlugin.hxx"
#ifdef ENABLE_ARCHIVE
#include "input/
archive_input_plugin.h
"
#include "input/
ArchiveInputPlugin.hxx
"
#endif
#ifdef ENABLE_CURL
...
...
src/Main.cxx
View file @
94fffb33
...
...
@@ -69,11 +69,9 @@ extern "C" {
#include "StickerDatabase.hxx"
#endif
extern
"C"
{
#ifdef ENABLE_ARCHIVE
#include "
archive_list.h
"
#include "
ArchiveList.hxx
"
#endif
}
#include <glib.h>
...
...
src/UpdateArchive.cxx
View file @
94fffb33
...
...
@@ -25,11 +25,8 @@
#include "song.h"
#include "Mapper.hxx"
#include "fs/Path.hxx"
extern
"C"
{
#include "archive_list.h"
#include "archive_plugin.h"
}
#include "ArchiveList.hxx"
#include "ArchivePlugin.hxx"
#include <glib.h>
...
...
src/archive/
bz2_archive_plugin.c
→
src/archive/
Bzip2ArchivePlugin.cxx
View file @
94fffb33
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -22,8 +22,9 @@
*/
#include "config.h"
#include "archive/bz2_archive_plugin.h"
#include "archive_api.h"
#include "Bzip2ArchivePlugin.hxx"
#include "ArchiveInternal.hxx"
#include "ArchivePlugin.hxx"
#include "input_internal.h"
#include "input_plugin.h"
#include "refcount.h"
...
...
@@ -47,6 +48,21 @@ struct bz2_archive_file {
char
*
name
;
bool
reset
;
struct
input_stream
*
istream
;
bz2_archive_file
()
{
archive_file_init
(
&
base
,
&
bz2_archive_plugin
);
refcount_init
(
&
ref
);
}
void
Unref
()
{
if
(
!
refcount_dec
(
&
ref
))
return
;
g_free
(
name
);
input_stream_close
(
istream
);
delete
this
;
}
};
struct
bz2_input_stream
{
...
...
@@ -61,7 +77,7 @@ struct bz2_input_stream {
char
buffer
[
5000
];
};
static
const
struct
input_plugin
bz2_inputplugin
;
extern
const
struct
input_plugin
bz2_inputplugin
;
static
inline
GQuark
bz2_quark
(
void
)
...
...
@@ -80,7 +96,7 @@ bz2_alloc(struct bz2_input_stream *data, GError **error_r)
data
->
bzstream
.
bzfree
=
NULL
;
data
->
bzstream
.
opaque
=
NULL
;
data
->
bzstream
.
next_in
=
(
void
*
)
data
->
buffer
;
data
->
bzstream
.
next_in
=
(
char
*
)
data
->
buffer
;
data
->
bzstream
.
avail_in
=
0
;
ret
=
BZ2_bzDecompressInit
(
&
data
->
bzstream
,
0
,
0
);
...
...
@@ -111,13 +127,9 @@ bz2_destroy(struct bz2_input_stream *data)
static
struct
archive_file
*
bz2_open
(
const
char
*
pathname
,
GError
**
error_r
)
{
struct
bz2_archive_file
*
context
;
struct
bz2_archive_file
*
context
=
new
bz2_archive_file
()
;
int
len
;
context
=
g_malloc
(
sizeof
(
*
context
));
archive_file_init
(
&
context
->
base
,
&
bz2_archive_plugin
);
refcount_init
(
&
context
->
ref
);
//open archive
static
GStaticMutex
mutex
=
G_STATIC_MUTEX_INIT
;
context
->
istream
=
input_stream_open
(
pathname
,
...
...
@@ -125,7 +137,7 @@ bz2_open(const char *pathname, GError **error_r)
NULL
,
error_r
);
if
(
context
->
istream
==
NULL
)
{
g_free
(
context
)
;
delete
context
;
return
NULL
;
}
...
...
@@ -166,13 +178,7 @@ bz2_close(struct archive_file *file)
{
struct
bz2_archive_file
*
context
=
(
struct
bz2_archive_file
*
)
file
;
if
(
!
refcount_dec
(
&
context
->
ref
))
return
;
g_free
(
context
->
name
);
input_stream_close
(
context
->
istream
);
g_free
(
context
);
context
->
Unref
();
}
/* single archive handling */
...
...
@@ -254,7 +260,7 @@ bz2_is_read(struct input_stream *is, void *ptr, size_t length,
return
0
;
bzstream
=
&
bis
->
bzstream
;
bzstream
->
next_out
=
ptr
;
bzstream
->
next_out
=
(
char
*
)
ptr
;
bzstream
->
avail_out
=
length
;
do
{
...
...
@@ -296,19 +302,30 @@ static const char *const bz2_extensions[] = {
NULL
};
static
const
struct
input_plugin
bz2_inputplugin
=
{
.
close
=
bz2_is_close
,
.
read
=
bz2_is_read
,
.
eof
=
bz2_is_eof
,
const
struct
input_plugin
bz2_inputplugin
=
{
nullptr
,
nullptr
,
nullptr
,
nullptr
,
bz2_is_close
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
bz2_is_read
,
bz2_is_eof
,
nullptr
,
};
const
struct
archive_plugin
bz2_archive_plugin
=
{
.
name
=
"bz2"
,
.
open
=
bz2_open
,
.
scan_reset
=
bz2_scan_reset
,
.
scan_next
=
bz2_scan_next
,
.
open_stream
=
bz2_open_stream
,
.
close
=
bz2_close
,
.
suffixes
=
bz2_extensions
"bz2"
,
nullptr
,
nullptr
,
bz2_open
,
bz2_scan_reset
,
bz2_scan_next
,
bz2_open_stream
,
bz2_close
,
bz2_extensions
,
};
src/archive/
bz2_archive_plugin.h
→
src/archive/
Bzip2ArchivePlugin.hxx
View file @
94fffb33
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_ARCHIVE_BZ2_H
#define MPD_ARCHIVE_BZ2_H
#ifndef MPD_ARCHIVE_BZ2_H
XX
#define MPD_ARCHIVE_BZ2_H
XX
extern
const
struct
archive_plugin
bz2_archive_plugin
;
...
...
src/archive/
iso9660_archive_plugin.c
→
src/archive/
Iso9660ArchivePlugin.cxx
View file @
94fffb33
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -22,8 +22,9 @@
*/
#include "config.h"
#include "archive/iso9660_archive_plugin.h"
#include "archive_api.h"
#include "Iso9660ArchivePlugin.hxx"
#include "ArchiveInternal.hxx"
#include "ArchivePlugin.hxx"
#include "input_internal.h"
#include "input_plugin.h"
#include "refcount.h"
...
...
@@ -46,7 +47,7 @@ struct iso9660_archive_file {
GSList
*
iter
;
};
static
const
struct
input_plugin
iso9660_input_plugin
;
extern
const
struct
input_plugin
iso9660_input_plugin
;
static
inline
GQuark
iso9660_quark
(
void
)
...
...
@@ -76,7 +77,7 @@ listdir_recur(const char *psz_path, struct iso9660_archive_file *context)
strcpy
(
pathname
,
psz_path
);
strcat
(
pathname
,
statbuf
->
filename
);
if
(
_STAT_DIR
==
statbuf
->
type
)
{
if
(
iso9660_stat_s
::
_STAT_DIR
==
statbuf
->
type
)
{
if
(
strcmp
(
statbuf
->
filename
,
"."
)
&&
strcmp
(
statbuf
->
filename
,
".."
))
{
strcat
(
pathname
,
"/"
);
listdir_recur
(
pathname
,
context
);
...
...
@@ -133,7 +134,7 @@ iso9660_archive_scan_next(struct archive_file *file)
char
*
data
=
NULL
;
if
(
context
->
iter
!=
NULL
)
{
///fetch data and goto next
data
=
context
->
iter
->
data
;
data
=
(
char
*
)
context
->
iter
->
data
;
context
->
iter
=
g_slist_next
(
context
->
iter
);
}
return
data
;
...
...
@@ -273,18 +274,29 @@ static const char *const iso9660_archive_extensions[] = {
NULL
};
static
const
struct
input_plugin
iso9660_input_plugin
=
{
.
close
=
iso9660_input_close
,
.
read
=
iso9660_input_read
,
.
eof
=
iso9660_input_eof
,
const
struct
input_plugin
iso9660_input_plugin
=
{
nullptr
,
nullptr
,
nullptr
,
nullptr
,
iso9660_input_close
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
iso9660_input_read
,
iso9660_input_eof
,
nullptr
,
};
const
struct
archive_plugin
iso9660_archive_plugin
=
{
.
name
=
"iso"
,
.
open
=
iso9660_archive_open
,
.
scan_reset
=
iso9660_archive_scan_reset
,
.
scan_next
=
iso9660_archive_scan_next
,
.
open_stream
=
iso9660_archive_open_stream
,
.
close
=
iso9660_archive_close
,
.
suffixes
=
iso9660_archive_extensions
"iso"
,
nullptr
,
nullptr
,
iso9660_archive_open
,
iso9660_archive_scan_reset
,
iso9660_archive_scan_next
,
iso9660_archive_open_stream
,
iso9660_archive_close
,
iso9660_archive_extensions
,
};
src/archive/
iso9660_archive_plugin.h
→
src/archive/
Iso9660ArchivePlugin.hxx
View file @
94fffb33
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_ARCHIVE_ISO9660_H
#define MPD_ARCHIVE_ISO9660_H
#ifndef MPD_ARCHIVE_ISO9660_H
XX
#define MPD_ARCHIVE_ISO9660_H
XX
extern
const
struct
archive_plugin
iso9660_archive_plugin
;
...
...
src/archive/
zzip_archive_plugin.c
→
src/archive/
ZzipArchivePlugin.cxx
View file @
94fffb33
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -22,9 +22,9 @@
*/
#include "config.h"
#include "
archive/zzip_archive_plugin.h
"
#include "
archive_api.h
"
#include "
archive_api.h
"
#include "
ZzipArchivePlugin.hxx
"
#include "
ArchiveInternal.hxx
"
#include "
ArchivePlugin.hxx
"
#include "input_internal.h"
#include "input_plugin.h"
#include "refcount.h"
...
...
@@ -41,9 +41,30 @@ struct zzip_archive {
ZZIP_DIR
*
dir
;
GSList
*
list
;
GSList
*
iter
;
zzip_archive
()
{
archive_file_init
(
&
base
,
&
zzip_archive_plugin
);
refcount_init
(
&
ref
);
}
void
Unref
()
{
if
(
!
refcount_dec
(
&
ref
))
return
;
if
(
list
)
{
//free list
for
(
GSList
*
tmp
=
list
;
tmp
!=
NULL
;
tmp
=
g_slist_next
(
tmp
))
g_free
(
tmp
->
data
);
g_slist_free
(
list
);
}
//close archive
zzip_dir_close
(
dir
);
delete
this
;
}
};
static
const
struct
input_plugin
zzip_input_plugin
;
extern
const
struct
input_plugin
zzip_input_plugin
;
static
inline
GQuark
zzip_quark
(
void
)
...
...
@@ -56,12 +77,9 @@ zzip_quark(void)
static
struct
archive_file
*
zzip_archive_open
(
const
char
*
pathname
,
GError
**
error_r
)
{
struct
zzip_archive
*
context
=
g_malloc
(
sizeof
(
*
context
)
);
struct
zzip_archive
*
context
=
new
zzip_archive
(
);
ZZIP_DIRENT
dirent
;
archive_file_init
(
&
context
->
base
,
&
zzip_archive_plugin
);
refcount_init
(
&
context
->
ref
);
// open archive
context
->
list
=
NULL
;
context
->
dir
=
zzip_dir_open
(
pathname
,
NULL
);
...
...
@@ -97,7 +115,7 @@ zzip_archive_scan_next(struct archive_file *file)
char
*
data
=
NULL
;
if
(
context
->
iter
!=
NULL
)
{
///fetch data and goto next
data
=
context
->
iter
->
data
;
data
=
(
char
*
)
context
->
iter
->
data
;
context
->
iter
=
g_slist_next
(
context
->
iter
);
}
return
data
;
...
...
@@ -108,19 +126,7 @@ zzip_archive_close(struct archive_file *file)
{
struct
zzip_archive
*
context
=
(
struct
zzip_archive
*
)
file
;
if
(
!
refcount_dec
(
&
context
->
ref
))
return
;
if
(
context
->
list
)
{
//free list
for
(
GSList
*
tmp
=
context
->
list
;
tmp
!=
NULL
;
tmp
=
g_slist_next
(
tmp
))
g_free
(
tmp
->
data
);
g_slist_free
(
context
->
list
);
}
//close archive
zzip_dir_close
(
context
->
dir
);
g_free
(
context
);
context
->
Unref
();
}
/* single archive handling */
...
...
@@ -228,19 +234,29 @@ static const char *const zzip_archive_extensions[] = {
NULL
};
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
input_plugin
zzip_input_plugin
=
{
nullptr
,
nullptr
,
nullptr
,
nullptr
,
zzip_input_close
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
zzip_input_read
,
zzip_input_eof
,
zzip_input_seek
,
};
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
"zzip"
,
nullptr
,
nullptr
,
zzip_archive_open
,
zzip_archive_scan_reset
,
zzip_archive_scan_next
,
zzip_archive_open_stream
,
zzip_archive_close
,
zzip_archive_extensions
,
};
src/archive/
zzip_archive_plugin.h
→
src/archive/
ZzipArchivePlugin.hxx
View file @
94fffb33
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_ARCHIVE_ZZIP_H
#define MPD_ARCHIVE_ZZIP_H
#ifndef MPD_ARCHIVE_ZZIP_H
XX
#define MPD_ARCHIVE_ZZIP_H
XX
extern
const
struct
archive_plugin
zzip_archive_plugin
;
...
...
src/input/
archive_input_plugin.c
→
src/input/
ArchiveInputPlugin.cxx
View file @
94fffb33
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -18,9 +18,10 @@
*/
#include "config.h"
#include "input/archive_input_plugin.h"
#include "archive_api.h"
#include "archive_list.h"
#include "ArchiveInputPlugin.hxx"
#include "ArchiveLookup.hxx"
#include "ArchiveList.hxx"
#include "ArchivePlugin.hxx"
#include "input_plugin.h"
#include <glib.h>
...
...
@@ -78,6 +79,16 @@ input_archive_open(const char *pathname,
}
const
struct
input_plugin
input_plugin_archive
=
{
.
name
=
"archive"
,
.
open
=
input_archive_open
,
"archive"
,
nullptr
,
nullptr
,
input_archive_open
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
nullptr
,
};
src/input/
archive_input_plugin.h
→
src/input/
ArchiveInputPlugin.hxx
View file @
94fffb33
/*
* Copyright (C) 2003-201
1
The Music Player Daemon Project
* Copyright (C) 2003-201
3
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -17,8 +17,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_INPUT_ARCHIVE_H
#define MPD_INPUT_ARCHIVE_H
#ifndef MPD_INPUT_ARCHIVE_H
XX
#define MPD_INPUT_ARCHIVE_H
XX
extern
const
struct
input_plugin
input_plugin_archive
;
...
...
test/dump_text_file.cxx
View file @
94fffb33
...
...
@@ -26,11 +26,11 @@
extern
"C"
{
#include "text_input_stream.h"
}
#ifdef ENABLE_ARCHIVE
#include "
archive_list.h
"
#include "
ArchiveList.hxx
"
#endif
}
#include <glib.h>
...
...
test/run_input.cxx
View file @
94fffb33
...
...
@@ -26,11 +26,9 @@
#include "InputInit.hxx"
#include "IOThread.hxx"
extern
"C"
{
#ifdef ENABLE_ARCHIVE
#include "
archive_list.h
"
#include "
ArchiveList.hxx
"
#endif
}
#include <glib.h>
...
...
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