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
486b5b6b
Commit
486b5b6b
authored
Aug 11, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs/io/TextFile: use AutoGunzipReader
Several MPD subsystems can now read gzipped files; for example, the database file can be gzipped.
parent
88a2f128
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
TextFile.cxx
src/fs/io/TextFile.cxx
+16
-1
TextFile.hxx
src/fs/io/TextFile.hxx
+7
-0
No files found.
src/fs/io/TextFile.cxx
View file @
486b5b6b
...
...
@@ -20,6 +20,7 @@
#include "config.h"
#include "TextFile.hxx"
#include "FileReader.hxx"
#include "AutoGunzipReader.hxx"
#include "BufferedReader.hxx"
#include "fs/Path.hxx"
...
...
@@ -27,8 +28,19 @@
TextFile
::
TextFile
(
Path
path_fs
,
Error
&
error
)
:
file_reader
(
new
FileReader
(
path_fs
,
error
)),
#ifdef HAVE_ZLIB
gunzip_reader
(
file_reader
->
IsDefined
()
?
new
AutoGunzipReader
(
*
file_reader
)
:
nullptr
),
#endif
buffered_reader
(
file_reader
->
IsDefined
()
?
new
BufferedReader
(
*
file_reader
)
?
new
BufferedReader
(
*
#ifdef HAVE_ZLIB
gunzip_reader
#else
file_reader
#endif
)
:
nullptr
)
{
}
...
...
@@ -36,6 +48,9 @@ TextFile::TextFile(Path path_fs, Error &error)
TextFile
::~
TextFile
()
{
delete
buffered_reader
;
#ifdef HAVE_ZLIB
delete
gunzip_reader
;
#endif
delete
file_reader
;
}
...
...
src/fs/io/TextFile.hxx
View file @
486b5b6b
...
...
@@ -20,6 +20,7 @@
#ifndef MPD_TEXT_FILE_HXX
#define MPD_TEXT_FILE_HXX
#include "check.h"
#include "Compiler.h"
#include <stddef.h>
...
...
@@ -27,10 +28,16 @@
class
Path
;
class
Error
;
class
FileReader
;
class
AutoGunzipReader
;
class
BufferedReader
;
class
TextFile
{
FileReader
*
const
file_reader
;
#ifdef HAVE_ZLIB
AutoGunzipReader
*
const
gunzip_reader
;
#endif
BufferedReader
*
const
buffered_reader
;
public
:
...
...
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