Skip to content

Commit

Permalink
Fix nullpadding issue when reading certain id3v1 tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Paxxi committed May 14, 2016
1 parent 5cbac93 commit cdabf9d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
21 changes: 0 additions & 21 deletions xbmc/music/tags/TagLoaderTagLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,12 @@
#include "utils/URIUtils.h"
#include "utils/log.h"
#include "utils/StringUtils.h"
#include "utils/CharsetConverter.h"
#include "utils/Base64.h"
#include "settings/AdvancedSettings.h"

using namespace TagLib;
using namespace MUSIC_INFO;

template<class T>
class TagStringHandler : public T
{
public:
TagStringHandler() {}
virtual ~TagStringHandler() {}
virtual String parse(const ByteVector &data) const
{
std::string strSource(data.data(), data.size());
std::string strUTF8;
g_charsetConverter.unknownToUTF8(strSource, strUTF8);
return String(strUTF8, String::UTF8);
}
};

static const TagStringHandler<ID3v1::StringHandler> ID3v1StringHandler;
static const TagStringHandler<ID3v2::Latin1StringHandler> ID3v2StringHandler;

namespace
{
std::vector<std::string> StringListToVectorString(const StringList& stringList)
Expand Down Expand Up @@ -1006,8 +987,6 @@ bool CTagLoaderTagLib::Load(const std::string& strFileName, CMusicInfoTag& tag,
return false;
}

ID3v1::Tag::setStringHandler(&ID3v1StringHandler);
ID3v2::Tag::setLatin1StringHandler(&ID3v2StringHandler);
TagLib::File* file = nullptr;
TagLib::APE::File* apeFile = nullptr;
TagLib::ASF::File* asfFile = nullptr;
Expand Down
3 changes: 3 additions & 0 deletions xbmc/music/tags/TagLoaderTagLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

#include "ImusicInfoTagLoader.h"

#include <string>
#include <vector>

namespace MUSIC_INFO
{
class CMusicInfoTag;
Expand Down

0 comments on commit cdabf9d

Please sign in to comment.