tag_get_handle for same tag and same default value returns MB_ALREADY_ALLOCATED when it shouldn't

Issue #131 resolved
Tim Tautges created an issue

When you attempt to call tag_get_handle with the same tag properties and the same default value, and do NOT pass the MB_TAG_EXCL option, you should get the same tag handle back and MB_SUCCESS. However, the code currently returns MB_ALREADY_ALLOCATED. The coding error is in TagInfo::equals_default_value:

return !memcmp( &data, get_default_value(), get_default_value_size() );

data is a void*, and points to the passed-in default value, so it should be passed directly to memcmp (w/o the &). If you do that, the attached code works.

Comments (3)

  1. Log in to comment