diff --git a/src/scanner.cc b/src/scanner.cc index 6458031..058e48f 100644 --- a/src/scanner.cc +++ b/src/scanner.cc @@ -47,7 +47,7 @@ struct Scanner { unsigned i = 0; while (i < length) { - Tag tag { static_cast(buffer[i]), "" }; + Tag tag(static_cast(buffer[i]), ""); i++; if (tag.type == CUSTOM) { unsigned length = buffer[i++]; diff --git a/src/tag.h b/src/tag.h index 8eb1046..c4f48fb 100644 --- a/src/tag.h +++ b/src/tag.h @@ -303,6 +303,8 @@ struct Tag { TagType type; string custom_tag_name; + Tag(TagType type, const string &name) : type(type), custom_tag_name(name) {} + bool operator==(const Tag &other) const { if (type != other.type) return false; if (type == TagType::CUSTOM && custom_tag_name != other.custom_tag_name) return false; @@ -360,8 +362,9 @@ struct Tag { static inline Tag for_name(const string &name) { unordered_map::const_iterator type = TAG_TYPES_BY_TAG_NAME.find(name); if (type != TAG_TYPES_BY_TAG_NAME.end()) { - return Tag { type->second, "" }; + return Tag(type->second, string()); + } else { + return Tag(CUSTOM, name); } - return Tag { CUSTOM, name }; } };