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
9aec2f01
Commit
9aec2f01
authored
Dec 22, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
archive/File: eliminate Close(), make destructor virtual instead
parent
5da45508
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
4 additions
and
23 deletions
+4
-23
ArchiveFile.hxx
src/archive/ArchiveFile.hxx
+1
-8
Bzip2ArchivePlugin.cxx
src/archive/plugins/Bzip2ArchivePlugin.cxx
+0
-4
Iso9660ArchivePlugin.cxx
src/archive/plugins/Iso9660ArchivePlugin.cxx
+0
-4
ZzipArchivePlugin.cxx
src/archive/plugins/ZzipArchivePlugin.cxx
+0
-4
Archive.cxx
src/db/update/Archive.cxx
+1
-1
ArchiveInputPlugin.cxx
src/input/plugins/ArchiveInputPlugin.cxx
+1
-1
visit_archive.cxx
test/visit_archive.cxx
+1
-1
No files found.
src/archive/ArchiveFile.hxx
View file @
9aec2f01
...
...
@@ -22,19 +22,12 @@
class
Mutex
;
class
Cond
;
struct
ArchivePlugin
;
class
ArchiveVisitor
;
class
InputStream
;
class
ArchiveFile
{
protected
:
/**
* Use Close() instead of delete.
*/
~
ArchiveFile
()
{}
public
:
virtual
void
Close
()
=
0
;
virtual
~
ArchiveFile
()
noexcept
=
default
;
/**
* Visit all entries inside this archive.
...
...
src/archive/plugins/Bzip2ArchivePlugin.cxx
View file @
9aec2f01
...
...
@@ -49,10 +49,6 @@ public:
name
.
erase
(
len
-
4
);
}
virtual
void
Close
()
override
{
delete
this
;
}
virtual
void
Visit
(
ArchiveVisitor
&
visitor
)
override
{
visitor
.
VisitArchiveEntry
(
name
.
c_str
());
}
...
...
src/archive/plugins/Iso9660ArchivePlugin.cxx
View file @
9aec2f01
...
...
@@ -72,10 +72,6 @@ public:
void
Visit
(
char
*
path
,
size_t
length
,
size_t
capacity
,
ArchiveVisitor
&
visitor
);
virtual
void
Close
()
override
{
delete
this
;
}
virtual
void
Visit
(
ArchiveVisitor
&
visitor
)
override
;
InputStream
*
OpenStream
(
const
char
*
path
,
...
...
src/archive/plugins/ZzipArchivePlugin.cxx
View file @
9aec2f01
...
...
@@ -57,10 +57,6 @@ public:
ZzipArchiveFile
(
std
::
shared_ptr
<
ZzipDir
>
&&
_dir
)
:
dir
(
std
::
move
(
_dir
))
{}
virtual
void
Close
()
override
{
delete
this
;
}
virtual
void
Visit
(
ArchiveVisitor
&
visitor
)
override
;
InputStream
*
OpenStream
(
const
char
*
path
,
...
...
src/db/update/Archive.cxx
View file @
9aec2f01
...
...
@@ -177,7 +177,7 @@ UpdateWalk::UpdateArchiveFile(Directory &parent, const char *name,
UpdateArchiveVisitor
visitor
(
*
this
,
*
file
,
directory
);
file
->
Visit
(
visitor
);
file
->
Close
()
;
delete
file
;
}
bool
...
...
src/input/plugins/ArchiveInputPlugin.cxx
View file @
9aec2f01
...
...
@@ -63,7 +63,7 @@ OpenArchiveInputStream(Path path, Mutex &mutex, Cond &cond)
auto
file
=
archive_file_open
(
arplug
,
Path
::
FromFS
(
archive
));
AtScopeExit
(
file
)
{
file
->
Close
()
;
delete
file
;
};
return
InputStreamPtr
(
file
->
OpenStream
(
filename
,
mutex
,
cond
));
...
...
test/visit_archive.cxx
View file @
9aec2f01
...
...
@@ -93,7 +93,7 @@ try {
MyArchiveVisitor
visitor
;
file
->
Visit
(
visitor
);
file
->
Close
()
;
delete
file
;
return
result
;
}
catch
(
const
std
::
exception
&
e
)
{
...
...
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