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
530e4807
Commit
530e4807
authored
Dec 15, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v0.15.x'
Conflicts: src/archive/bz2_plugin.c src/archive_api.h src/input/file_input_plugin.c test/run_input.c
parents
95c3f283
9179f108
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
85 additions
and
45 deletions
+85
-45
NEWS
NEWS
+6
-0
bz2_plugin.c
src/archive/bz2_plugin.c
+3
-2
iso_plugin.c
src/archive/iso_plugin.c
+4
-1
zip_plugin.c
src/archive/zip_plugin.c
+4
-1
archive_plugin.h
src/archive_plugin.h
+3
-0
archive_input_plugin.c
src/input/archive_input_plugin.c
+1
-0
run_input.c
test/run_input.c
+64
-41
No files found.
NEWS
View file @
530e4807
...
...
@@ -79,6 +79,12 @@ ver 0.16 (20??/??/??)
ver 0.15.7 (2009/??/??)
* archive:
- close archive when stream is closed
- iso, zip: fixed memory leak in destructor
* input:
- file: don't fall back to parent directory
- archive: fixed memory leak in error handler
* tags:
- id3: fix ID3v1 charset conversion
* decoders:
...
...
src/archive/bz2_plugin.c
View file @
530e4807
...
...
@@ -144,8 +144,7 @@ bz2_close(struct archive_file *file)
{
bz2_context
*
context
=
(
bz2_context
*
)
file
;
if
(
context
->
name
)
g_free
(
context
->
name
);
g_free
(
context
->
name
);
input_stream_close
(
&
context
->
istream
);
g_free
(
context
);
...
...
@@ -179,6 +178,8 @@ bz2_is_close(struct input_stream *is)
bz2_context
*
context
=
(
bz2_context
*
)
is
->
data
;
bz2_destroy
(
context
);
is
->
data
=
NULL
;
bz2_close
((
struct
archive_file
*
)
context
);
}
static
bool
...
...
src/archive/iso_plugin.c
View file @
530e4807
...
...
@@ -133,7 +133,8 @@ iso_close(struct archive_file *file)
}
//close archive
iso9660_close
(
context
->
iso
);
context
->
iso
=
NULL
;
g_free
(
context
);
}
/* single archive handling */
...
...
@@ -166,6 +167,8 @@ iso_is_close(struct input_stream *is)
{
iso_context
*
context
=
(
iso_context
*
)
is
->
data
;
g_free
(
context
->
statbuf
);
iso_close
((
struct
archive_file
*
)
context
);
}
...
...
src/archive/zip_plugin.c
View file @
530e4807
...
...
@@ -100,7 +100,8 @@ zip_close(struct archive_file *file)
}
//close archive
zzip_dir_close
(
context
->
dir
);
context
->
dir
=
NULL
;
g_free
(
context
);
}
/* single archive handling */
...
...
@@ -134,6 +135,8 @@ zip_is_close(struct input_stream *is)
{
zip_context
*
context
=
(
zip_context
*
)
is
->
data
;
zzip_file_close
(
context
->
file
);
zip_close
((
struct
archive_file
*
)
context
);
}
static
size_t
...
...
src/archive_plugin.h
View file @
530e4807
...
...
@@ -65,6 +65,9 @@ struct archive_plugin {
/**
* Opens an input_stream of a file within the archive.
*
* If this function succeeds, then the #input_stream "owns"
* the archive file and will automatically close it.
*
* @param path the path within the archive
*/
bool
(
*
open_stream
)(
struct
archive_file
*
,
struct
input_stream
*
is
,
...
...
src/input/archive_input_plugin.c
View file @
530e4807
...
...
@@ -67,6 +67,7 @@ input_archive_open(struct input_stream *is, const char *pathname)
if
(
!
opened
)
{
g_warning
(
"open inarchive file %s failed
\n\n
"
,
filename
);
arplug
->
close
(
file
);
}
else
{
is
->
ready
=
true
;
}
...
...
test/run_input.c
View file @
530e4807
...
...
@@ -24,6 +24,10 @@
#include "tag_save.h"
#include "conf.h"
#ifdef ENABLE_ARCHIVE
#include "archive_list.h"
#endif
#include <glib.h>
#include <unistd.h>
...
...
@@ -38,46 +42,17 @@ my_log_func(const gchar *log_domain, G_GNUC_UNUSED GLogLevelFlags log_level,
g_printerr
(
"%s
\n
"
,
message
);
}
int
main
(
int
argc
,
char
**
argv
)
static
int
dump_input_stream
(
struct
input_stream
*
is
)
{
struct
input_stream
is
;
GError
*
error
=
NULL
;
bool
success
;
char
buffer
[
4096
];
size_t
num_read
;
ssize_t
num_written
;
if
(
argc
!=
2
)
{
g_printerr
(
"Usage: run_input URI
\n
"
);
return
1
;
}
/* wait until the stream becomes ready */
/* initialize GLib */
g_thread_init
(
NULL
);
g_log_set_default_handler
(
my_log_func
,
NULL
);
/* initialize MPD */
tag_pool_init
();
config_global_init
();
if
(
!
input_stream_global_init
(
&
error
))
{
g_warning
(
"%s"
,
error
->
message
);
g_error_free
(
error
);
return
2
;
}
/* open the stream and wait until it becomes ready */
success
=
input_stream_open
(
&
is
,
argv
[
1
]);
if
(
!
success
)
{
g_printerr
(
"input_stream_open() failed
\n
"
);
return
2
;
}
while
(
!
is
.
ready
)
{
int
ret
=
input_stream_buffer
(
&
is
);
while
(
!
is
->
ready
)
{
int
ret
=
input_stream_buffer
(
is
);
if
(
ret
<
0
)
/* error */
return
2
;
...
...
@@ -89,20 +64,20 @@ int main(int argc, char **argv)
/* print meta data */
if
(
is
.
mime
!=
NULL
)
g_printerr
(
"MIME type: %s
\n
"
,
is
.
mime
);
if
(
is
->
mime
!=
NULL
)
g_printerr
(
"MIME type: %s
\n
"
,
is
->
mime
);
/* read data and tags from the stream */
while
(
!
input_stream_eof
(
&
is
))
{
struct
tag
*
tag
=
input_stream_tag
(
&
is
);
while
(
!
input_stream_eof
(
is
))
{
struct
tag
*
tag
=
input_stream_tag
(
is
);
if
(
tag
!=
NULL
)
{
g_printerr
(
"Received a tag:
\n
"
);
tag_save
(
stderr
,
tag
);
tag_free
(
tag
);
}
num_read
=
input_stream_read
(
&
is
,
buffer
,
sizeof
(
buffer
));
num_read
=
input_stream_read
(
is
,
buffer
,
sizeof
(
buffer
));
if
(
num_read
==
0
)
break
;
...
...
@@ -111,12 +86,60 @@ int main(int argc, char **argv)
break
;
}
return
0
;
}
int
main
(
int
argc
,
char
**
argv
)
{
GError
*
error
=
NULL
;
struct
input_stream
is
;
int
ret
;
if
(
argc
!=
2
)
{
g_printerr
(
"Usage: run_input URI
\n
"
);
return
1
;
}
/* initialize GLib */
g_thread_init
(
NULL
);
g_log_set_default_handler
(
my_log_func
,
NULL
);
/* initialize MPD */
tag_pool_init
();
config_global_init
();
#ifdef ENABLE_ARCHIVE
archive_plugin_init_all
();
#endif
if
(
!
input_stream_global_init
(
&
error
))
{
g_warning
(
"%s"
,
error
->
message
);
g_error_free
(
error
);
return
2
;
}
/* open the stream and dump it */
if
(
input_stream_open
(
&
is
,
argv
[
1
]))
{
ret
=
dump_input_stream
(
&
is
);
input_stream_close
(
&
is
);
}
else
{
g_printerr
(
"input_stream_open() failed
\n
"
);
ret
=
2
;
}
/* deinitialize everything */
input_stream_close
(
&
is
);
input_stream_global_finish
();
#ifdef ENABLE_ARCHIVE
archive_plugin_deinit_all
();
#endif
config_global_finish
();
tag_pool_deinit
();
return
0
;
return
ret
;
}
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