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
4c4fa682
Commit
4c4fa682
authored
Dec 20, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
input/Icy: use std::unique_ptr<Tag>
parent
43d2fd73
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
17 deletions
+11
-17
IcyInputStream.cxx
src/input/IcyInputStream.cxx
+7
-15
IcyInputStream.hxx
src/input/IcyInputStream.hxx
+4
-2
No files found.
src/input/IcyInputStream.cxx
View file @
4c4fa682
...
...
@@ -23,16 +23,11 @@
IcyInputStream
::
IcyInputStream
(
InputStream
*
_input
)
:
ProxyInputStream
(
_input
),
input_tag
(
nullptr
),
icy_tag
(
nullptr
),
override_offset
(
0
)
{
}
IcyInputStream
::~
IcyInputStream
()
{
delete
input_tag
;
delete
icy_tag
;
}
IcyInputStream
::~
IcyInputStream
()
=
default
;
void
IcyInputStream
::
Update
()
...
...
@@ -50,18 +45,15 @@ IcyInputStream::ReadTag()
if
(
!
IsEnabled
())
return
new_input_tag
;
if
(
new_input_tag
!=
nullptr
)
{
delete
input_tag
;
input_tag
=
new_input_tag
;
}
if
(
new_input_tag
!=
nullptr
)
input_tag
.
reset
(
new_input_tag
);
auto
new_icy_tag
=
parser
.
ReadTag
();
if
(
new_icy_tag
!=
nullptr
)
{
delete
icy_tag
;
icy_tag
=
new_icy_tag
.
release
();
}
const
bool
had_new_icy_tag
=
!!
new_icy_tag
;
if
(
new_icy_tag
!=
nullptr
)
icy_tag
=
std
::
move
(
new_icy_tag
);
if
(
new_input_tag
==
nullptr
&&
new_icy_tag
==
nullptr
)
if
(
new_input_tag
==
nullptr
&&
!
had_new_icy_tag
)
/* no change */
return
nullptr
;
...
...
src/input/IcyInputStream.hxx
View file @
4c4fa682
...
...
@@ -24,6 +24,8 @@
#include "IcyMetaDataParser.hxx"
#include "Compiler.h"
#include <memory>
struct
Tag
;
/**
...
...
@@ -35,12 +37,12 @@ class IcyInputStream final : public ProxyInputStream {
/**
* The #Tag object ready to be requested via ReadTag().
*/
Tag
*
input_tag
;
std
::
unique_ptr
<
Tag
>
input_tag
;
/**
* The #Tag object ready to be requested via ReadTag().
*/
Tag
*
icy_tag
;
std
::
unique_ptr
<
Tag
>
icy_tag
;
offset_type
override_offset
;
...
...
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