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
99f4bce1
Commit
99f4bce1
authored
Dec 20, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IcyMetaDataParser: return std::unique_ptr<Tag>
parent
6b77ee9a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
13 deletions
+11
-13
IcyMetaDataParser.cxx
src/IcyMetaDataParser.cxx
+2
-4
IcyMetaDataParser.hxx
src/IcyMetaDataParser.hxx
+7
-7
IcyInputStream.cxx
src/input/IcyInputStream.cxx
+2
-2
No files found.
src/IcyMetaDataParser.cxx
View file @
99f4bce1
...
...
@@ -39,7 +39,7 @@ IcyMetaDataParser::Reset() noexcept
if
(
data_rest
==
0
&&
meta_size
>
0
)
delete
[]
meta_data
;
delete
tag
;
tag
.
reset
()
;
data_rest
=
data_size
;
meta_size
=
0
;
...
...
@@ -209,9 +209,7 @@ IcyMetaDataParser::Meta(const void *data, size_t length) noexcept
if
(
meta_position
==
meta_size
)
{
/* parse */
delete
tag
;
tag
=
icy_parse_tag
(
meta_data
,
meta_data
+
meta_size
).
release
();
tag
=
icy_parse_tag
(
meta_data
,
meta_data
+
meta_size
);
delete
[]
meta_data
;
/* change back to normal data mode */
...
...
src/IcyMetaDataParser.hxx
View file @
99f4bce1
...
...
@@ -20,9 +20,11 @@
#ifndef MPD_ICY_META_DATA_PARSER_HXX
#define MPD_ICY_META_DATA_PARSER_HXX
#include <stddef.h>
#include "tag/Tag.hxx"
#include <memory>
struct
Tag
;
#include <stddef.h>
class
IcyMetaDataParser
{
size_t
data_size
=
0
,
data_rest
;
...
...
@@ -30,7 +32,7 @@ class IcyMetaDataParser {
size_t
meta_size
,
meta_position
;
char
*
meta_data
;
Tag
*
tag
;
std
::
unique_ptr
<
Tag
>
tag
;
public
:
~
IcyMetaDataParser
()
noexcept
{
...
...
@@ -81,10 +83,8 @@ public:
*/
size_t
ParseInPlace
(
void
*
data
,
size_t
length
)
noexcept
;
Tag
*
ReadTag
()
noexcept
{
Tag
*
result
=
tag
;
tag
=
nullptr
;
return
result
;
std
::
unique_ptr
<
Tag
>
ReadTag
()
noexcept
{
return
std
::
exchange
(
tag
,
nullptr
);
}
};
...
...
src/input/IcyInputStream.cxx
View file @
99f4bce1
...
...
@@ -55,10 +55,10 @@ IcyInputStream::ReadTag()
input_tag
=
new_input_tag
;
}
Tag
*
new_icy_tag
=
parser
.
ReadTag
();
auto
new_icy_tag
=
parser
.
ReadTag
();
if
(
new_icy_tag
!=
nullptr
)
{
delete
icy_tag
;
icy_tag
=
new_icy_tag
;
icy_tag
=
new_icy_tag
.
release
()
;
}
if
(
new_input_tag
==
nullptr
&&
new_icy_tag
==
nullptr
)
...
...
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