From: epg@pretzelnet.org <> Date: Mon, 7 Apr 2014 05:39:30 +0000 (-0700) Subject: looks like i got rid of ByteVectorSet on Mar 11 15:18 but didn't commit X-Git-Url: https://diplodocus.org/git/flac-archive/commitdiff_plain/23ac2dcb47526f2918420db60d608bf30ef73e29?hp=bd531dc419afa88698207095e564eb9519b9dfb0 looks like i got rid of ByteVectorSet on Mar 11 15:18 but didn't commit --- diff --git a/strip-tags.cc b/strip-tags.cc index 2f18cd0..fed0624 100644 --- a/strip-tags.cc +++ b/strip-tags.cc @@ -13,21 +13,18 @@ extern "C" { using std::cerr; using std::endl; -using std::shared_ptr; using std::vector; -typedef vector> ByteVectorSet; - static bool diag = true; static bool force_write = false; static bool strip_v1 = true; +template static bool -ByteVectorSet_has(const ByteVectorSet &set, - const TagLib::ByteVector &target) +vector_has(const vector &vector, const T &target) { - for (const auto vector : set) { - if (*vector == target) { + for (const auto &element : vector) { + if (element == target) { return true; } } @@ -36,7 +33,7 @@ ByteVectorSet_has(const ByteVectorSet &set, static bool delete_id3v2_frames(TagLib::MPEG::File &file, - const ByteVectorSet &delete_frame_ids) + const vector &delete_frame_ids) { TagLib::ID3v2::Tag *tag = file.ID3v2Tag(); // Build a list of frames to delete in delete_frames. @@ -46,7 +43,7 @@ delete_id3v2_frames(TagLib::MPEG::File &file, if (diag) { cerr << frameid; } - if (ByteVectorSet_has(delete_frame_ids, frameid)) { + if (vector_has(delete_frame_ids, frameid)) { cerr << " deleted" << endl; delete_frames.push_back(frame); continue; @@ -68,7 +65,7 @@ delete_id3v2_frames(TagLib::MPEG::File &file, static void strip_tags(TagLib::MPEG::File &file, - const ByteVectorSet &delete_frames, + const vector &delete_frames, char *fn) { bool changed = false; @@ -90,14 +87,13 @@ strip_tags(TagLib::MPEG::File &file, int main(int argc, char **argv) { - ByteVectorSet delete_frames; + vector delete_frames; int c; while ((c = getopt(argc, argv, "d:")) != -1) { switch (c) { case 'd': { - shared_ptr bv(new TagLib::ByteVector(optarg)); - delete_frames.push_back(bv); + delete_frames.emplace_back(optarg); } break; default: // getopt printed an error.