From a5f11697f704a2eddb8ba211b516ce27a8fb8099 Mon Sep 17 00:00:00 2001 From: Scott Wheeler Date: Sun, 20 Dec 2020 18:07:21 +0100 Subject: [PATCH] Get things building again with C++98 --- taglib/mpeg/id3v2/id3v2tag.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/taglib/mpeg/id3v2/id3v2tag.cpp b/taglib/mpeg/id3v2/id3v2tag.cpp index 8ee477d0..2d102395 100644 --- a/taglib/mpeg/id3v2/id3v2tag.cpp +++ b/taglib/mpeg/id3v2/id3v2tag.cpp @@ -24,7 +24,6 @@ ***************************************************************************/ #include -#include #include #include @@ -55,6 +54,16 @@ namespace const long MinPaddingSize = 1024; const long MaxPaddingSize = 1024 * 1024; + + bool contains(const char **a, const ByteVector &v) + { + for(int i = 0; a[i]; i++) + { + if(v == a[i]) + return true; + } + return false; + } } class ID3v2::Tag::TagPrivate @@ -480,15 +489,15 @@ ByteVector ID3v2::Tag::render() const void ID3v2::Tag::downgradeFrames(FrameList *frames, FrameList *newFrames) const { #ifdef NO_ITUNES_HACKS - static const std::array unsupportedFrames = { + static const char *unsupportedFrames[] = { "ASPI", "EQU2", "RVA2", "SEEK", "SIGN", "TDRL", "TDTG", - "TMOO", "TPRO", "TSOA", "TSOT", "TSST", "TSOP" + "TMOO", "TPRO", "TSOA", "TSOT", "TSST", "TSOP", 0 }; #else // iTunes writes and reads TSOA, TSOT, TSOP to ID3v2.3. - static const std::array unsupportedFrames = { + static const char *unsupportedFrames[] = { "ASPI", "EQU2", "RVA2", "SEEK", "SIGN", "TDRL", "TDTG", - "TMOO", "TPRO", "TSST" + "TMOO", "TPRO", "TSST", 0 }; #endif ID3v2::TextIdentificationFrame *frameTDOR = 0; @@ -501,8 +510,7 @@ void ID3v2::Tag::downgradeFrames(FrameList *frames, FrameList *newFrames) const ID3v2::Frame *frame = *it; ByteVector frameID = frame->header()->frameID(); - if(std::find(unsupportedFrames.begin(), unsupportedFrames.end(), frameID) != - unsupportedFrames.end()) + if(contains(unsupportedFrames, frameID)) { debug("A frame that is not supported in ID3v2.3 \'" + String(frameID) + "\' has been discarded");