Notes on removing field values with map.clear()

Urs Fleisch urs.fleisch at gmail.com
Sun Mar 27 16:05:11 BST 2022


I am not sure if I fully understand the problem. In an attempt to
reproduce the issue for MP4 files, I modified
`testPropertiesAllSupported()` in *test_mp4.cpp* so that after setting
all the properties (including those BMP, DISCNUMBER, TRACKNUMBER,
COMPILATiON mentioned in your message) all properties are cleared by
setting an empty map, and then checking if everything is really
cleared.

```
diff --git a/tests/test_mp4.cpp b/tests/test_mp4.cpp
index 14b23e1f..c57ac4b5 100644
--- a/tests/test_mp4.cpp
+++ b/tests/test_mp4.cpp
@@ -511,12 +511,23 @@ public:
      f.save();
    }
    {
-      const MP4::File f(copy.fileName().c_str());
+      MP4::File f(copy.fileName().c_str());
      PropertyMap properties = f.properties();
      if (tags != properties) {
        CPPUNIT_ASSERT_EQUAL(tags.toString(), properties.toString());
      }
      CPPUNIT_ASSERT(tags == properties);
+      f.setProperties(PropertyMap());
+      f.save();
+    }
+    {
+      const MP4::File f(copy.fileName().c_str());
+      PropertyMap properties = f.properties();
+      CPPUNIT_ASSERT(properties.isEmpty());
+      MP4::Tag *tag = f.tag();
+      CPPUNIT_ASSERT(tag->isEmpty());
+      const MP4::ItemMap &map = tag->itemMap();
+      CPPUNIT_ASSERT(map.isEmpty());
    }
  }
```

This test passes, so I do not see the problem. Where exactly are you
calling `map.clear()`? Could you provide some sample code to reproduce
the problem?


More information about the taglib-devel mailing list