lib/xiph/VorbisComments: return std::unique_ptr<Tag>
This commit is contained in:
parent
71f1ec0bc8
commit
43d2fd73ab
@ -152,12 +152,11 @@ static void
|
|||||||
vorbis_send_comments(DecoderClient &client, InputStream &is,
|
vorbis_send_comments(DecoderClient &client, InputStream &is,
|
||||||
char **comments)
|
char **comments)
|
||||||
{
|
{
|
||||||
Tag *tag = vorbis_comments_to_tag(comments);
|
auto tag = vorbis_comments_to_tag(comments);
|
||||||
if (!tag)
|
if (!tag)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
client.SubmitTag(is, std::move(*tag));
|
client.SubmitTag(is, std::move(*tag));
|
||||||
delete tag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -100,12 +100,12 @@ vorbis_comments_scan(char **comments,
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Tag *
|
std::unique_ptr<Tag>
|
||||||
vorbis_comments_to_tag(char **comments) noexcept
|
vorbis_comments_to_tag(char **comments) noexcept
|
||||||
{
|
{
|
||||||
TagBuilder tag_builder;
|
TagBuilder tag_builder;
|
||||||
vorbis_comments_scan(comments, add_tag_handler, &tag_builder);
|
vorbis_comments_scan(comments, add_tag_handler, &tag_builder);
|
||||||
return tag_builder.empty()
|
return tag_builder.empty()
|
||||||
? nullptr
|
? nullptr
|
||||||
: tag_builder.CommitNew().release();
|
: tag_builder.CommitNew();
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
#include "check.h"
|
#include "check.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
struct ReplayGainInfo;
|
struct ReplayGainInfo;
|
||||||
struct TagHandler;
|
struct TagHandler;
|
||||||
struct Tag;
|
struct Tag;
|
||||||
@ -33,7 +35,7 @@ void
|
|||||||
vorbis_comments_scan(char **comments,
|
vorbis_comments_scan(char **comments,
|
||||||
const TagHandler &handler, void *handler_ctx);
|
const TagHandler &handler, void *handler_ctx);
|
||||||
|
|
||||||
Tag *
|
std::unique_ptr<Tag>
|
||||||
vorbis_comments_to_tag(char **comments) noexcept;
|
vorbis_comments_to_tag(char **comments) noexcept;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user