]> granicus.if.org Git - taglib/commitdiff
Use List::isEmpty() than size() > 0.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Fri, 6 Nov 2015 07:12:36 +0000 (16:12 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Fri, 6 Nov 2015 07:13:43 +0000 (16:13 +0900)
Small revision of pokowaka's fix. isEmpty() is a little better than size() > 0, since std::list::empty() is guaranteed to be an O(1) operation.

taglib/mp4/mp4tag.cpp

index 1c188720b2d842270b383c7dee11b5fc1556bd11..ce557c0ff87d0d40b442f1b58e4f62e65861ae72 100644 (file)
@@ -917,7 +917,7 @@ PropertyMap MP4::Tag::setProperties(const PropertyMap &props)
   for(; it != props.end(); ++it) {
     if(reverseKeyMap.contains(it->first)) {
       String name = reverseKeyMap[it->first];
-      if((it->first == "TRACKNUMBER" || it->first == "DISCNUMBER") && it->second.size() > 0) {
+      if((it->first == "TRACKNUMBER" || it->first == "DISCNUMBER") && !it->second.isEmpty()) {
         int first = 0, second = 0;
         StringList parts = StringList::split(it->second.front(), "/");
         if(parts.size() > 0) {
@@ -928,11 +928,11 @@ PropertyMap MP4::Tag::setProperties(const PropertyMap &props)
           d->items[name] = MP4::Item(first, second);
         }
       }
-      else if(it->first == "BPM" && it->second.size() > 0) {
+      else if(it->first == "BPM" && !it->second.isEmpty()) {
         int value = it->second.front().toInt();
         d->items[name] = MP4::Item(value);
       }
-      else if(it->first == "COMPILATION" && it->second.size() > 0) {
+      else if(it->first == "COMPILATION" && !it->second.isEmpty()) {
         bool value = (it->second.front().toInt() != 0);
         d->items[name] = MP4::Item(value);
       }