Avoid using String::isNull() where it is considered to be confused with isEmpty().

This commit is contained in:
Tsuda Kageyu 2015-11-20 20:59:13 +09:00
parent 224f133d65
commit c4fe65787c
9 changed files with 14 additions and 20 deletions

View File

@ -195,7 +195,7 @@ PropertyMap APE::Tag::properties() const
String tagName = it->first.upper();
// if the item is Binary or Locator, or if the key is an invalid string,
// add to unsupportedData
if(it->second.type() != Item::Text || tagName.isNull())
if(it->second.type() != Item::Text || tagName.isEmpty())
properties.unsupportedData().append(it->first);
else {
// Some tags need to be handled specially
@ -232,7 +232,7 @@ PropertyMap APE::Tag::setProperties(const PropertyMap &origProps)
for(; remIt != itemListMap().end(); ++remIt) {
String key = remIt->first.upper();
// only remove if a) key is valid, b) type is text, c) key not contained in new properties
if(!key.isNull() && remIt->second.type() == APE::Item::Text && !properties.contains(key))
if(!key.isEmpty() && remIt->second.type() == APE::Item::Text && !properties.contains(key))
toRemove.append(remIt->first);
}

View File

@ -128,7 +128,7 @@ PropertyMap Mod::Tag::properties() const
PropertyMap properties;
properties["TITLE"] = d->title;
properties["COMMENT"] = d->comment;
if(!(d->trackerName.isNull()))
if(!(d->trackerName.isEmpty()))
properties["TRACKERNAME"] = d->trackerName;
return properties;
}

View File

@ -116,8 +116,6 @@ PropertyMap CommentsFrame::asProperties() const
PropertyMap map;
if(key.isEmpty() || key == "COMMENT")
map.insert("COMMENT", text());
else if(key.isNull())
map.unsupportedData().append(L"COMM/" + description());
else
map.insert("COMMENT:" + key, text());
return map;
@ -164,7 +162,7 @@ void CommentsFrame::parseFields(const ByteVector &data)
} else {
d->description = String(l.front(), d->textEncoding);
d->text = String(l.back(), d->textEncoding);
}
}
}
}

View File

@ -159,7 +159,7 @@ void SynchronizedLyricsFrame::parseFields(const ByteVector &data)
int pos = 6;
d->description = readStringField(data, d->textEncoding, &pos);
if(d->description.isNull())
if(d->description.isEmpty())
return;
/*
@ -190,7 +190,7 @@ void SynchronizedLyricsFrame::parseFields(const ByteVector &data)
}
}
String text = readStringField(data, enc, &pos);
if(text.isNull() || pos + 4 > end)
if(text.isEmpty() || pos + 4 > end)
return;
uint time = data.toUInt(pos, true);

View File

@ -292,7 +292,7 @@ PropertyMap TextIdentificationFrame::makeTMCLProperties() const
StringList l = fieldList();
for(StringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
String instrument = it->upper();
if(instrument.isNull()) {
if(instrument.isEmpty()) {
// instrument is not a valid key -> frame unsupported
map.clear();
map.unsupportedData().append(frameID());

View File

@ -119,8 +119,6 @@ PropertyMap UnsynchronizedLyricsFrame::asProperties() const
String key = description().upper();
if(key.isEmpty() || key.upper() == "LYRICS")
map.insert("LYRICS", text());
else if(key.isNull())
map.unsupportedData().append(L"USLT/" + description());
else
map.insert("LYRICS:" + key, text());
return map;
@ -164,7 +162,7 @@ void UnsynchronizedLyricsFrame::parseFields(const ByteVector &data)
} else {
d->description = String(l.front(), d->textEncoding);
d->text = String(l.back(), d->textEncoding);
}
}
}
}

View File

@ -159,8 +159,6 @@ PropertyMap UserUrlLinkFrame::asProperties() const
String key = description().upper();
if(key.isEmpty() || key.upper() == "URL")
map.insert("URL", url());
else if(key.isNull())
map.unsupportedData().append(L"WXXX/" + description());
else
map.insert("URL:" + key, url());
return map;

View File

@ -58,15 +58,15 @@ bool Tag::isEmpty() const
PropertyMap Tag::properties() const
{
PropertyMap map;
if(!(title().isNull()))
if(!(title().isEmpty()))
map["TITLE"].append(title());
if(!(artist().isNull()))
if(!(artist().isEmpty()))
map["ARTIST"].append(artist());
if(!(album().isNull()))
if(!(album().isEmpty()))
map["ALBUM"].append(album());
if(!(comment().isNull()))
if(!(comment().isEmpty()))
map["COMMENT"].append(comment());
if(!(genre().isNull()))
if(!(genre().isEmpty()))
map["GENRE"].append(genre());
if(!(year() == 0))
map["DATE"].append(String::number(year()));

View File

@ -35,7 +35,7 @@ PropertyMap::PropertyMap(const SimplePropertyMap &m)
{
for(SimplePropertyMap::ConstIterator it = m.begin(); it != m.end(); ++it){
String key = it->first.upper();
if(!key.isNull())
if(!key.isEmpty())
insert(it->first, it->second);
else
unsupported.append(it->first);