diff --git a/ape/apefooter.cpp b/ape/apefooter.cpp index bde69782..5fc8c260 100644 --- a/ape/apefooter.cpp +++ b/ape/apefooter.cpp @@ -172,20 +172,24 @@ void Footer::parse(const ByteVector &data) // The first eight bytes, data[0..7], are the File Identifier, "APETAGEX". // Read the version number + d->version = data.mid(8, 4).toUInt(false); // Read the tag size + d->tagSize = data.mid(12, 4).toUInt(false); // Read the item count + d->itemCount = data.mid(16, 4).toUInt(false); // Read the flags + std::bitset<32> flags(data.mid(20, 4).toUInt(false)); - d->headerPresent = flags[31]; - d->footerPresent = !flags[30]; - d->isHeader = flags[29]; + d->headerPresent = flags[31]; + d->footerPresent = !flags[30]; + d->isHeader = flags[29]; } @@ -194,6 +198,7 @@ ByteVector Footer::render(bool isHeader) const ByteVector v; // add the file identifier -- "APETAGEX" + v.append(fileIdentifier()); // add the version number -- we always render a 2.000 tag regardless of what @@ -202,12 +207,15 @@ ByteVector Footer::render(bool isHeader) const v.append(ByteVector::fromUInt(2000, false)); // add the tag size + v.append(ByteVector::fromUInt(d->tagSize, false)); // add the item count + v.append(ByteVector::fromUInt(d->itemCount, false)); // render and add the flags + std::bitset<32> flags; flags[31] = d->headerPresent; @@ -217,6 +225,7 @@ ByteVector Footer::render(bool isHeader) const v.append(ByteVector::fromUInt(flags.to_ulong(), false)); // add the reserved 64bit + v.append(ByteVector::fromLongLong(0)); return v; diff --git a/ape/apetag.cpp b/ape/apetag.cpp index 94df2b13..0474ee7d 100644 --- a/ape/apetag.cpp +++ b/ape/apetag.cpp @@ -149,7 +149,7 @@ void APE::Tag::setGenre(const String &s) void APE::Tag::setYear(uint i) { - if(i <=0 ) + if(i <= 0) removeItem("YEAR"); else addValue("YEAR", String::number(i), true); @@ -157,7 +157,7 @@ void APE::Tag::setYear(uint i) void APE::Tag::setTrack(uint i) { - if(i <=0 ) + if(i <= 0) removeItem("TRACK"); else addValue("TRACK", String::number(i), true); diff --git a/fileref.cpp b/fileref.cpp index 4e72396f..2da2e71f 100644 --- a/fileref.cpp +++ b/fileref.cpp @@ -45,6 +45,11 @@ public: // public members //////////////////////////////////////////////////////////////////////////////// +FileRef::FileRef() +{ + d = new FileRefPrivate(0); +} + FileRef::FileRef(const char *fileName, bool readAudioProperties, AudioProperties::ReadStyle audioPropertiesStyle) { diff --git a/fileref.h b/fileref.h index 14789e08..ffa7864f 100644 --- a/fileref.h +++ b/fileref.h @@ -69,6 +69,8 @@ namespace TagLib { { public: + FileRef(); + /*! * Create a FileRef from \a fileName. If \a readAudioProperties is true then * the audio properties will be read using \a audioPropertiesStyle. If diff --git a/mpc/mpcproperties.cpp b/mpc/mpcproperties.cpp index 2c333edc..fb61b244 100644 --- a/mpc/mpcproperties.cpp +++ b/mpc/mpcproperties.cpp @@ -31,9 +31,9 @@ using namespace TagLib; class MPC::Properties::PropertiesPrivate { public: - PropertiesPrivate(const ByteVector &d, long st, ReadStyle s) : + PropertiesPrivate(const ByteVector &d, long length, ReadStyle s) : data(d), - streamLength(st), + streamLength(length), style(s), version(0), length(0), @@ -114,7 +114,7 @@ void MPC::Properties::read() unsigned int frames; if(d->version >= 7) { - frames = d->data.mid(4,4).toUInt(false); + frames = d->data.mid(4, 4).toUInt(false); std::bitset<32> flags = d->data.mid(8, 4).toUInt(true); d->sampleRate = sftable[flags[17] * 2 + flags[16]]; diff --git a/mpeg/id3v2/frames/uniquefileidentifierframe.cpp b/mpeg/id3v2/frames/uniquefileidentifierframe.cpp index 40cade00..0eee906c 100644 --- a/mpeg/id3v2/frames/uniquefileidentifierframe.cpp +++ b/mpeg/id3v2/frames/uniquefileidentifierframe.cpp @@ -33,6 +33,10 @@ public: ByteVector identifier; }; +//////////////////////////////////////////////////////////////////////////////// +// public methods +//////////////////////////////////////////////////////////////////////////////// + UniqueFileIdentifierFrame::UniqueFileIdentifierFrame(const ByteVector &data) : ID3v2::Frame(data) {