Scott's silly nitpicks...

git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@345141 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
This commit is contained in:
Scott Wheeler
2004-09-09 00:28:57 +00:00
parent e10bc468c8
commit a51d1cb117
6 changed files with 28 additions and 8 deletions

View File

@ -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;

View File

@ -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);

View File

@ -45,6 +45,11 @@ public:
// public members
////////////////////////////////////////////////////////////////////////////////
FileRef::FileRef()
{
d = new FileRefPrivate(0);
}
FileRef::FileRef(const char *fileName, bool readAudioProperties,
AudioProperties::ReadStyle audioPropertiesStyle)
{

View File

@ -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

View File

@ -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]];

View File

@ -33,6 +33,10 @@ public:
ByteVector identifier;
};
////////////////////////////////////////////////////////////////////////////////
// public methods
////////////////////////////////////////////////////////////////////////////////
UniqueFileIdentifierFrame::UniqueFileIdentifierFrame(const ByteVector &data) :
ID3v2::Frame(data)
{