Notes on removing field values with map.clear()

Yannis Calotychos ycalot at gmail.com
Tue Apr 12 11:33:38 BST 2022


Hello,

I’ve changed my code for removing tags to
	PropertyMap map
	map.erase(name_space);
And removing tags is working fine now.

thank you


> On 27 Mar 2022, at 6:05 PM, Urs Fleisch <urs.fleisch at gmail.com> wrote:
> 
> 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?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/taglib-devel/attachments/20220412/99d1e898/attachment.htm>


More information about the taglib-devel mailing list