Fix formatting

This commit is contained in:
Jonas Kvinge 2019-11-13 19:53:42 +01:00
parent 40be3331e0
commit ba9617449f
8 changed files with 181 additions and 186 deletions

View File

@ -55,75 +55,75 @@ namespace TagLib {
*
* \deprecated
*/
TAGLIB_DEPRECATED Properties(File *file, ReadStyle style = Average);
TAGLIB_DEPRECATED Properties(File* file, ReadStyle style = Average);
/*!
* Create an instance of APE::Properties with the data read from the
* APE::File \a file.
*/
Properties(File *file, long streamLength, ReadStyle style = Average);
/*!
* Create an instance of APE::Properties with the data read from the
* APE::File \a file.
*/
Properties(File* file, long streamLength, ReadStyle style = Average);
/*!
* Destroys this APE::Properties instance.
*/
virtual ~Properties();
/*!
* Destroys this APE::Properties instance.
*/
virtual ~Properties();
/*!
* Returns the length of the file in seconds. The length is rounded down to
* the nearest whole second.
*
* \note This method is just an alias of lengthInSeconds().
*
* \deprecated
*/
TAGLIB_DEPRECATED virtual int length() const;
/*!
* Returns the length of the file in seconds. The length is rounded down
* to the nearest whole second.
*
* \note This method is just an alias of lengthInSeconds().
*
* \deprecated
*/
TAGLIB_DEPRECATED virtual int length() const;
/*!
* Returns the length of the file in seconds. The length is rounded down to
* the nearest whole second.
*
* \see lengthInMilliseconds()
*/
// BIC: make virtual
int lengthInSeconds() const;
/*!
* Returns the length of the file in seconds. The length is rounded down
* to the nearest whole second.
*
* \see lengthInMilliseconds()
*/
// BIC: make virtual
int lengthInSeconds() const;
/*!
* Returns the length of the file in milliseconds.
*
* \see lengthInSeconds()
*/
// BIC: make virtual
int lengthInMilliseconds() const;
/*!
* Returns the length of the file in milliseconds.
*
* \see lengthInSeconds()
*/
// BIC: make virtual
int lengthInMilliseconds() const;
/*!
* Returns the average bit rate of the file in kb/s.
*/
virtual int bitrate() const;
/*!
* Returns the average bit rate of the file in kb/s.
*/
virtual int bitrate() const;
/*!
* Returns the sample rate in Hz.
*/
virtual int sampleRate() const;
/*!
* Returns the sample rate in Hz.
*/
virtual int sampleRate() const;
/*!
* Returns the number of audio channels.
*/
virtual int channels() const;
/*!
* Returns the number of audio channels.
*/
virtual int channels() const;
/*!
* Returns the number of bits per audio sample.
*/
int bitsPerSample() const;
/*!
* Returns the number of bits per audio sample.
*/
int bitsPerSample() const;
/*!
* Returns the total number of audio samples in file.
*/
unsigned int sampleFrames() const;
/*!
* Returns the total number of audio samples in file.
*/
unsigned int sampleFrames() const;
/*!
* Returns APE version.
*/
int version() const;
/*!
* Returns APE version.
*/
int version() const;
private:
Properties(const Properties &);

View File

@ -240,7 +240,8 @@ namespace TagLib {
* \see ID3v2FrameFactory
* \deprecated This value should be passed in via the constructor
*/
TAGLIB_DEPRECATED void setID3v2FrameFactory(const ID3v2::FrameFactory *factory);
TAGLIB_DEPRECATED void setID3v2FrameFactory(
const ID3v2::FrameFactory* factory);
/*!
* Returns the block of data used by FLAC::Properties for parsing the
@ -248,7 +249,7 @@ namespace TagLib {
*
* \deprecated Always returns an empty vector.
*/
TAGLIB_DEPRECATED ByteVector streamInfoData(); // BIC: remove
TAGLIB_DEPRECATED ByteVector streamInfoData(); // BIC: remove
/*!
* Returns the length of the audio-stream, used by FLAC::Properties for

View File

@ -175,11 +175,11 @@ MP4::Properties::read(File *file, Atoms *atoms)
debug("MP4: Atom 'trak.mdia.mdhd' is smaller than expected");
return;
}
unit = data.toUInt(28U);
unit = data.toUInt(28U);
length = data.toLongLong(32U);
}
else {
if(data.size() < 24 + 8) {
if (data.size() < 24 + 8) {
debug("MP4: Atom 'trak.mdia.mdhd' is smaller than expected");
return;
}

View File

@ -73,13 +73,12 @@ MP4::Tag::Tag(TagLib::File *file, MP4::Atoms *atoms) :
else if(atom->name == "cpil" || atom->name == "pgap" || atom->name == "pcst" ||
atom->name == "hdvd" || atom->name == "shwm") {
parseBool(atom);
}
else if(atom->name == "tmpo" || atom->name == "\251mvi" || atom->name == "\251mvc") {
} else if (atom->name == "tmpo" || atom->name == "\251mvi" ||
atom->name == "\251mvc") {
parseInt(atom);
}
else if(atom->name == "rate") {
} else if (atom->name == "rate") {
AtomDataList data = parseData2(atom);
if(!data.isEmpty()) {
if (!data.isEmpty()) {
AtomData val = data[0];
if (val.type == TypeUTF8) {
addItem(atom->name, StringList(String(val.data, String::UTF8)));
@ -87,10 +86,10 @@ MP4::Tag::Tag(TagLib::File *file, MP4::Atoms *atoms) :
addItem(atom->name, (int)(val.data.toShort()));
}
}
}
else if(atom->name == "tvsn" || atom->name == "tves" || atom->name == "cnID" ||
atom->name == "sfID" || atom->name == "atID" || atom->name == "geID" ||
atom->name == "cmID") {
} else if (atom->name == "tvsn" || atom->name == "tves" ||
atom->name == "cnID" || atom->name == "sfID" ||
atom->name == "atID" || atom->name == "geID" ||
atom->name == "cmID") {
parseUInt(atom);
}
else if(atom->name == "plID") {
@ -490,23 +489,19 @@ MP4::Tag::save()
else if(name == "cpil" || name == "pgap" || name == "pcst" || name == "hdvd" ||
name == "shwm") {
data.append(renderBool(name.data(String::Latin1), it->second));
}
else if(name == "tmpo" || name == "\251mvi" || name == "\251mvc") {
} else if (name == "tmpo" || name == "\251mvi" || name == "\251mvc") {
data.append(renderInt(name.data(String::Latin1), it->second));
}
else if (name == "rate") {
} else if (name == "rate") {
const MP4::Item& item = it->second;
StringList value = item.toStringList();
if (value.isEmpty()) {
data.append(renderInt(name.data(String::Latin1), item));
}
else {
} else {
data.append(renderText(name.data(String::Latin1), item));
}
}
else if(name == "tvsn" || name == "tves" || name == "cnID" ||
name == "sfID" || name == "atID" || name == "geID" ||
name == "cmID") {
} else if (name == "tvsn" || name == "tves" || name == "cnID" ||
name == "sfID" || name == "atID" || name == "geID" ||
name == "cmID") {
data.append(renderUInt(name.data(String::Latin1), it->second));
}
else if(name == "plID") {
@ -807,8 +802,7 @@ MP4::Tag::setYear(unsigned int value)
{
if (value == 0) {
d->items.erase("\251day");
}
else {
} else {
d->items["\251day"] = StringList(String::number(value));
}
}
@ -818,8 +812,7 @@ MP4::Tag::setTrack(unsigned int value)
{
if (value == 0) {
d->items.erase("trkn");
}
else {
} else {
d->items["trkn"] = MP4::Item(value, 0);
}
}

View File

@ -42,112 +42,112 @@ namespace TagLib {
/*!
* \deprecated
*/
TAGLIB_DEPRECATED typedef TagLib::Map<String, Item> ItemListMap;
typedef TagLib::Map<String, Item> ItemMap;
TAGLIB_DEPRECATED typedef TagLib::Map<String, Item> ItemListMap;
typedef TagLib::Map<String, Item> ItemMap;
class TAGLIB_EXPORT Tag: public TagLib::Tag
{
public:
Tag();
Tag(TagLib::File *file, Atoms *atoms);
virtual ~Tag();
bool save();
class TAGLIB_EXPORT Tag : public TagLib::Tag {
public:
Tag();
Tag(TagLib::File* file, Atoms* atoms);
virtual ~Tag();
bool save();
virtual String title() const;
virtual String artist() const;
virtual String album() const;
virtual String comment() const;
virtual String genre() const;
virtual unsigned int year() const;
virtual unsigned int track() const;
virtual String title() const;
virtual String artist() const;
virtual String album() const;
virtual String comment() const;
virtual String genre() const;
virtual unsigned int year() const;
virtual unsigned int track() const;
virtual void setTitle(const String &value);
virtual void setArtist(const String &value);
virtual void setAlbum(const String &value);
virtual void setComment(const String &value);
virtual void setGenre(const String &value);
virtual void setYear(unsigned int value);
virtual void setTrack(unsigned int value);
virtual void setTitle(const String& value);
virtual void setArtist(const String& value);
virtual void setAlbum(const String& value);
virtual void setComment(const String& value);
virtual void setGenre(const String& value);
virtual void setYear(unsigned int value);
virtual void setTrack(unsigned int value);
virtual bool isEmpty() const;
virtual bool isEmpty() const;
/*!
* \deprecated Use the item() and setItem() API instead
*/
TAGLIB_DEPRECATED ItemMap &itemListMap();
/*!
* \deprecated Use the item() and setItem() API instead
*/
TAGLIB_DEPRECATED ItemMap& itemListMap();
/*!
* Returns a string-keyed map of the MP4::Items for this tag.
*/
const ItemMap &itemMap() const;
/*!
* Returns a string-keyed map of the MP4::Items for this tag.
*/
const ItemMap& itemMap() const;
/*!
* \return The item, if any, corresponding to \a key.
*/
Item item(const String &key) const;
/*!
* \return The item, if any, corresponding to \a key.
*/
Item item(const String& key) const;
/*!
* Sets the value of \a key to \a value, overwriting any previous value.
*/
void setItem(const String &key, const Item &value);
/*!
* Sets the value of \a key to \a value, overwriting any previous value.
*/
void setItem(const String& key, const Item& value);
/*!
* Removes the entry with \a key from the tag, or does nothing if it does
* not exist.
*/
void removeItem(const String &key);
/*!
* Removes the entry with \a key from the tag, or does nothing if it does
* not exist.
*/
void removeItem(const String& key);
/*!
* \return True if the tag contains an entry for \a key.
*/
bool contains(const String &key) const;
/*!
* \return True if the tag contains an entry for \a key.
*/
bool contains(const String& key) const;
PropertyMap properties() const;
void removeUnsupportedProperties(const StringList& properties);
PropertyMap setProperties(const PropertyMap &properties);
PropertyMap properties() const;
void removeUnsupportedProperties(const StringList& properties);
PropertyMap setProperties(const PropertyMap& properties);
private:
AtomDataList parseData2(const Atom *atom, int expectedFlags = -1,
bool freeForm = false);
ByteVectorList parseData(const Atom *atom, int expectedFlags = -1,
bool freeForm = false);
void parseText(const Atom *atom, int expectedFlags = 1);
void parseFreeForm(const Atom *atom);
void parseInt(const Atom *atom);
void parseByte(const Atom *atom);
void parseUInt(const Atom *atom);
void parseLongLong(const Atom *atom);
void parseGnre(const Atom *atom);
void parseIntPair(const Atom *atom);
void parseBool(const Atom *atom);
void parseCovr(const Atom *atom);
private:
AtomDataList parseData2(const Atom* atom, int expectedFlags = -1,
bool freeForm = false);
ByteVectorList parseData(const Atom* atom, int expectedFlags = -1,
bool freeForm = false);
void parseText(const Atom* atom, int expectedFlags = 1);
void parseFreeForm(const Atom* atom);
void parseInt(const Atom* atom);
void parseByte(const Atom* atom);
void parseUInt(const Atom* atom);
void parseLongLong(const Atom* atom);
void parseGnre(const Atom* atom);
void parseIntPair(const Atom* atom);
void parseBool(const Atom* atom);
void parseCovr(const Atom* atom);
ByteVector padIlst(const ByteVector &data, int length = -1) const;
ByteVector renderAtom(const ByteVector &name, const ByteVector &data) const;
ByteVector renderData(const ByteVector &name, int flags,
const ByteVectorList &data) const;
ByteVector renderText(const ByteVector &name, const Item &item,
int flags = TypeUTF8) const;
ByteVector renderFreeForm(const String &name, const Item &item) const;
ByteVector renderBool(const ByteVector &name, const Item &item) const;
ByteVector renderInt(const ByteVector &name, const Item &item) const;
ByteVector renderByte(const ByteVector &name, const Item &item) const;
ByteVector renderUInt(const ByteVector &name, const Item &item) const;
ByteVector renderLongLong(const ByteVector &name, const Item &item) const;
ByteVector renderIntPair(const ByteVector &name, const Item &item) const;
ByteVector renderIntPairNoTrailing(const ByteVector &name, const Item &item) const;
ByteVector renderCovr(const ByteVector &name, const Item &item) const;
ByteVector padIlst(const ByteVector& data, int length = -1) const;
ByteVector renderAtom(const ByteVector& name, const ByteVector& data) const;
ByteVector renderData(const ByteVector& name, int flags,
const ByteVectorList& data) const;
ByteVector renderText(const ByteVector& name, const Item& item,
int flags = TypeUTF8) const;
ByteVector renderFreeForm(const String& name, const Item& item) const;
ByteVector renderBool(const ByteVector& name, const Item& item) const;
ByteVector renderInt(const ByteVector& name, const Item& item) const;
ByteVector renderByte(const ByteVector& name, const Item& item) const;
ByteVector renderUInt(const ByteVector& name, const Item& item) const;
ByteVector renderLongLong(const ByteVector& name, const Item& item) const;
ByteVector renderIntPair(const ByteVector& name, const Item& item) const;
ByteVector renderIntPairNoTrailing(const ByteVector& name,
const Item& item) const;
ByteVector renderCovr(const ByteVector& name, const Item& item) const;
void updateParents(const AtomList &path, long delta, int ignore = 0);
void updateOffsets(long delta, long offset);
void updateParents(const AtomList& path, long delta, int ignore = 0);
void updateOffsets(long delta, long offset);
void saveNew(ByteVector data);
void saveExisting(ByteVector data, const AtomList &path);
void saveNew(ByteVector data);
void saveExisting(ByteVector data, const AtomList& path);
void addItem(const String &name, const Item &value);
void addItem(const String& name, const Item& value);
class TagPrivate;
TagPrivate *d;
class TagPrivate;
TagPrivate* d;
};
}

View File

@ -267,7 +267,8 @@ void ChapterFrame::parseFields(const ByteVector &data)
return;
while(embPos < size - header()->size()) {
Frame *frame = FrameFactory::instance()->createFrame(data.mid(pos + embPos), d->tagHeader);
Frame* frame = FrameFactory::instance()->createFrame(data.mid(pos + embPos),
d->tagHeader);
if(!frame)
return;

View File

@ -54,17 +54,15 @@ public:
namespace {
// These functions are needed to try to aim for backward compatibility with
// an API that previously (unreasonably) required null bytes to be appended
// at the end of identifiers explicitly by the API user.
// These functions are needed to try to aim for backward compatibility with
// an API that previously (unreasonably) required null bytes to be appended
// at the end of identifiers explicitly by the API user.
// BIC: remove these
// BIC: remove these
ByteVector &strip(ByteVector &b)
{
if(b.endsWith('\0'))
b.resize(b.size() - 1);
return b;
ByteVector& strip(ByteVector& b) {
if (b.endsWith('\0')) b.resize(b.size() - 1);
return b;
}
ByteVectorList &strip(ByteVectorList &l)
@ -304,7 +302,8 @@ void TableOfContentsFrame::parseFields(const ByteVector &data)
return;
while(embPos < size - header()->size()) {
Frame *frame = FrameFactory::instance()->createFrame(data.mid(pos + embPos), d->tagHeader);
Frame* frame = FrameFactory::instance()->createFrame(data.mid(pos + embPos),
d->tagHeader);
if(!frame)
return;

View File

@ -277,7 +277,8 @@ PropertyMap TextIdentificationFrame::makeTIPLProperties() const
break;
}
if(!found){
// invalid involved role -> mark whole frame as unsupported in order to be consistent with writing
// invalid involved role -> mark whole frame as unsupported in order to be
// consistent with writing
map.clear();
map.unsupportedData().append(frameID());
return map;