mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Merge pull request #776 from mathbunnyru/small_improvements
Small improvements
This commit is contained in:
commit
f80a7c0d83
@ -191,7 +191,7 @@ void APE::Tag::setGenre(const String &s)
|
||||
|
||||
void APE::Tag::setYear(unsigned int i)
|
||||
{
|
||||
if(i <= 0)
|
||||
if(i == 0)
|
||||
removeItem("YEAR");
|
||||
else
|
||||
addValue("YEAR", String::number(i), true);
|
||||
@ -199,7 +199,7 @@ void APE::Tag::setYear(unsigned int i)
|
||||
|
||||
void APE::Tag::setTrack(unsigned int i)
|
||||
{
|
||||
if(i <= 0)
|
||||
if(i == 0)
|
||||
removeItem("TRACK");
|
||||
else
|
||||
addValue("TRACK", String::number(i), true);
|
||||
|
@ -113,7 +113,7 @@ namespace TagLib
|
||||
/*!
|
||||
* Copies the contents of \a other into this item.
|
||||
*/
|
||||
ASF::Attribute &operator=(const Attribute &other);
|
||||
Attribute &operator=(const Attribute &other);
|
||||
|
||||
/*!
|
||||
* Exchanges the content of the Attribute by the content of \a other.
|
||||
|
@ -948,10 +948,10 @@ PropertyMap MP4::Tag::setProperties(const PropertyMap &props)
|
||||
if(reverseKeyMap.contains(it->first)) {
|
||||
String name = reverseKeyMap[it->first];
|
||||
if((it->first == "TRACKNUMBER" || it->first == "DISCNUMBER") && !it->second.isEmpty()) {
|
||||
int first = 0, second = 0;
|
||||
StringList parts = StringList::split(it->second.front(), "/");
|
||||
if(!parts.isEmpty()) {
|
||||
first = parts[0].toInt();
|
||||
int first = parts[0].toInt();
|
||||
int second = 0;
|
||||
if(parts.size() > 1) {
|
||||
second = parts[1].toInt();
|
||||
}
|
||||
|
@ -36,7 +36,9 @@ class TableOfContentsFrame::TableOfContentsFramePrivate
|
||||
{
|
||||
public:
|
||||
TableOfContentsFramePrivate() :
|
||||
tagHeader(0)
|
||||
tagHeader(0),
|
||||
isTopLevel(false),
|
||||
isOrdered(false)
|
||||
{
|
||||
embeddedFrameList.setAutoDelete(true);
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ class ID3v2::Tag::TagPrivate
|
||||
{
|
||||
public:
|
||||
TagPrivate() :
|
||||
factory(0),
|
||||
file(0),
|
||||
tagOffset(0),
|
||||
extendedHeader(0),
|
||||
@ -286,7 +287,7 @@ void ID3v2::Tag::setGenre(const String &s)
|
||||
|
||||
void ID3v2::Tag::setYear(unsigned int i)
|
||||
{
|
||||
if(i <= 0) {
|
||||
if(i == 0) {
|
||||
removeFrames("TDRC");
|
||||
return;
|
||||
}
|
||||
@ -295,7 +296,7 @@ void ID3v2::Tag::setYear(unsigned int i)
|
||||
|
||||
void ID3v2::Tag::setTrack(unsigned int i)
|
||||
{
|
||||
if(i <= 0) {
|
||||
if(i == 0) {
|
||||
removeFrames("TRCK");
|
||||
return;
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ ByteVector String::data(Type t) const
|
||||
ByteVector v(size(), 0);
|
||||
char *p = v.data();
|
||||
|
||||
for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++)
|
||||
for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); ++it)
|
||||
*p++ = static_cast<char>(*it);
|
||||
|
||||
return v;
|
||||
@ -537,7 +537,7 @@ ByteVector String::data(Type t) const
|
||||
*p++ = '\xff';
|
||||
*p++ = '\xfe';
|
||||
|
||||
for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++) {
|
||||
for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); ++it) {
|
||||
*p++ = static_cast<char>(*it & 0xff);
|
||||
*p++ = static_cast<char>(*it >> 8);
|
||||
}
|
||||
@ -549,7 +549,7 @@ ByteVector String::data(Type t) const
|
||||
ByteVector v(size() * 2, 0);
|
||||
char *p = v.data();
|
||||
|
||||
for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++) {
|
||||
for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); ++it) {
|
||||
*p++ = static_cast<char>(*it >> 8);
|
||||
*p++ = static_cast<char>(*it & 0xff);
|
||||
}
|
||||
@ -561,7 +561,7 @@ ByteVector String::data(Type t) const
|
||||
ByteVector v(size() * 2, 0);
|
||||
char *p = v.data();
|
||||
|
||||
for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++) {
|
||||
for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); ++it) {
|
||||
*p++ = static_cast<char>(*it & 0xff);
|
||||
*p++ = static_cast<char>(*it >> 8);
|
||||
}
|
||||
@ -611,7 +611,7 @@ String String::stripWhiteSpace() const
|
||||
|
||||
bool String::isLatin1() const
|
||||
{
|
||||
for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++) {
|
||||
for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); ++it) {
|
||||
if(*it >= 256)
|
||||
return false;
|
||||
}
|
||||
@ -620,7 +620,7 @@ bool String::isLatin1() const
|
||||
|
||||
bool String::isAscii() const
|
||||
{
|
||||
for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); it++) {
|
||||
for(wstring::const_iterator it = d->data.begin(); it != d->data.end(); ++it) {
|
||||
if(*it >= 128)
|
||||
return false;
|
||||
}
|
||||
|
@ -586,9 +586,9 @@ void XM::File::read(bool)
|
||||
unsigned int count = 4 + instrument.read(*this, instrumentHeaderSize - 4U);
|
||||
READ_ASSERT(count == std::min(instrumentHeaderSize, (unsigned long)instrument.size() + 4));
|
||||
|
||||
unsigned long sampleHeaderSize = 0;
|
||||
long offset = 0;
|
||||
if(sampleCount > 0) {
|
||||
unsigned long sampleHeaderSize = 0;
|
||||
sumSampleCount += sampleCount;
|
||||
// wouldn't know which header size to assume otherwise:
|
||||
READ_ASSERT(instrumentHeaderSize >= count + 4 && readU32L(sampleHeaderSize));
|
||||
|
Loading…
Reference in New Issue
Block a user