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
cb3042ff
Commit
cb3042ff
authored
Dec 20, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tag/Builder: CommitNew() returns std::unique_ptr<Tag>
parent
d293aaf9
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
16 additions
and
14 deletions
+16
-14
IcyMetaDataParser.cxx
src/IcyMetaDataParser.cxx
+2
-2
CurlInputPlugin.cxx
src/input/plugins/CurlInputPlugin.cxx
+2
-1
VorbisComments.cxx
src/lib/xiph/VorbisComments.cxx
+2
-1
Builder.cxx
src/tag/Builder.cxx
+2
-2
Builder.hxx
src/tag/Builder.hxx
+2
-1
Id3Scan.cxx
src/tag/Id3Scan.cxx
+2
-1
Tag.cxx
src/tag/Tag.cxx
+1
-1
test_icy_parser.cxx
test/test_icy_parser.cxx
+3
-5
No files found.
src/IcyMetaDataParser.cxx
View file @
cb3042ff
...
...
@@ -115,7 +115,7 @@ find_end_quote(char *p, char *const end)
}
}
static
Tag
*
static
std
::
unique_ptr
<
Tag
>
icy_parse_tag
(
char
*
p
,
char
*
const
end
)
{
assert
(
p
!=
nullptr
);
...
...
@@ -210,7 +210,7 @@ IcyMetaDataParser::Meta(const void *data, size_t length)
delete
tag
;
tag
=
icy_parse_tag
(
meta_data
,
meta_data
+
meta_size
);
tag
=
icy_parse_tag
(
meta_data
,
meta_data
+
meta_size
)
.
release
()
;
delete
[]
meta_data
;
/* change back to normal data mode */
...
...
src/input/plugins/CurlInputPlugin.cxx
View file @
cb3042ff
...
...
@@ -31,6 +31,7 @@
#include "config/ConfigGlobal.hxx"
#include "config/Block.hxx"
#include "tag/Builder.hxx"
#include "tag/Tag.hxx"
#include "event/Call.hxx"
#include "event/Loop.hxx"
#include "thread/Cond.hxx"
...
...
@@ -222,7 +223,7 @@ CurlInputStream::OnHeaders(unsigned status,
TagBuilder
tag_builder
;
tag_builder
.
AddItem
(
TAG_NAME
,
i
->
second
.
c_str
());
SetTag
(
tag_builder
.
CommitNew
());
SetTag
(
tag_builder
.
CommitNew
()
.
release
()
);
}
if
(
!
icy
->
IsEnabled
())
{
...
...
src/lib/xiph/VorbisComments.cxx
View file @
cb3042ff
...
...
@@ -23,6 +23,7 @@
#include "tag/Table.hxx"
#include "tag/Handler.hxx"
#include "tag/Builder.hxx"
#include "tag/Tag.hxx"
#include "tag/VorbisComment.hxx"
#include "tag/ReplayGain.hxx"
#include "ReplayGainInfo.hxx"
...
...
@@ -106,5 +107,5 @@ vorbis_comments_to_tag(char **comments) noexcept
vorbis_comments_scan
(
comments
,
add_tag_handler
,
&
tag_builder
);
return
tag_builder
.
empty
()
?
nullptr
:
tag_builder
.
CommitNew
();
:
tag_builder
.
CommitNew
()
.
release
()
;
}
src/tag/Builder.cxx
View file @
cb3042ff
...
...
@@ -144,10 +144,10 @@ TagBuilder::Commit()
return
tag
;
}
Tag
*
std
::
unique_ptr
<
Tag
>
TagBuilder
::
CommitNew
()
{
Tag
*
tag
=
new
Tag
(
);
std
::
unique_ptr
<
Tag
>
tag
(
new
Tag
()
);
Commit
(
*
tag
);
return
tag
;
}
...
...
src/tag/Builder.hxx
View file @
cb3042ff
...
...
@@ -25,6 +25,7 @@
#include "Compiler.h"
#include <vector>
#include <memory>
struct
StringView
;
struct
TagItem
;
...
...
@@ -105,7 +106,7 @@ public:
* returned object is owned by the caller. This object is
* empty afterwards.
*/
Tag
*
CommitNew
();
std
::
unique_ptr
<
Tag
>
CommitNew
();
void
SetDuration
(
SignedSongTime
_duration
)
{
duration
=
_duration
;
...
...
src/tag/Id3Scan.cxx
View file @
cb3042ff
...
...
@@ -23,6 +23,7 @@
#include "Handler.hxx"
#include "Table.hxx"
#include "Builder.hxx"
#include "Tag.hxx"
#include "Id3MusicBrainz.hxx"
#include "util/Alloc.hxx"
#include "util/ScopeExit.hxx"
...
...
@@ -336,7 +337,7 @@ tag_id3_import(struct id3_tag *tag)
scan_id3_tag
(
tag
,
add_tag_handler
,
&
tag_builder
);
return
tag_builder
.
empty
()
?
nullptr
:
tag_builder
.
CommitNew
();
:
tag_builder
.
CommitNew
()
.
release
()
;
}
bool
...
...
src/tag/Tag.cxx
View file @
cb3042ff
...
...
@@ -60,7 +60,7 @@ Tag::Merge(const Tag &base, const Tag &add)
{
TagBuilder
builder
(
add
);
builder
.
Complement
(
base
);
return
builder
.
CommitNew
();
return
builder
.
CommitNew
()
.
release
()
;
}
Tag
*
...
...
test/test_icy_parser.cxx
View file @
cb3042ff
...
...
@@ -17,7 +17,7 @@
#include <string.h>
static
Tag
*
static
std
::
unique_ptr
<
Tag
>
icy_parse_tag
(
const
char
*
p
)
{
char
*
q
=
strdup
(
p
);
...
...
@@ -38,17 +38,15 @@ CompareTagTitle(const Tag &tag, const std::string &title)
static
void
TestIcyParserTitle
(
const
char
*
input
,
const
char
*
title
)
{
Tag
*
tag
=
icy_parse_tag
(
input
);
const
auto
tag
=
icy_parse_tag
(
input
);
CompareTagTitle
(
*
tag
,
title
);
delete
tag
;
}
static
void
TestIcyParserEmpty
(
const
char
*
input
)
{
Tag
*
tag
=
icy_parse_tag
(
input
);
const
auto
tag
=
icy_parse_tag
(
input
);
CPPUNIT_ASSERT_EQUAL
(
uint16_t
(
0
),
tag
->
num_items
);
delete
tag
;
}
class
IcyTest
:
public
CppUnit
::
TestFixture
{
...
...
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