From: Tsuda Kageyu Date: Tue, 23 Jun 2015 02:48:25 +0000 (+0900) Subject: ASF: Use CodecType enum instead of a magic number. X-Git-Tag: v1.10beta~47^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=472ce9f42cc835cc79e1ac70322801dd6ed8b1a8;p=taglib ASF: Use CodecType enum instead of a magic number. --- diff --git a/taglib/asf/asffile.cpp b/taglib/asf/asffile.cpp index 179649fa..3743fff1 100644 --- a/taglib/asf/asffile.cpp +++ b/taglib/asf/asffile.cpp @@ -154,6 +154,14 @@ class ASF::File::CodecListObject : public ASF::File::BaseObject public: ByteVector guid(); void parse(ASF::File *file, uint size); + +private: + enum CodecType + { + Video = 0x0001, + Audio = 0x0002, + Unknown = 0xFFFF + }; }; ASF::File::HeaderExtensionObject::~HeaderExtensionObject() @@ -409,7 +417,7 @@ void ASF::File::CodecListObject::parse(ASF::File *file, uint size) if(pos >= data.size()) break; - const int type = data.toUShort(pos, false); + const CodecType type = static_cast(data.toUShort(pos, false)); pos += 2; int nameLength = data.toUShort(pos, false); @@ -427,7 +435,7 @@ void ASF::File::CodecListObject::parse(ASF::File *file, uint size) const int infoLength = data.toUShort(pos, false); pos += 2 + infoLength * 2; - if(type == 2) { + if(type == Audio) { // First audio codec found. const String name(data.mid(namePos, nameLength * 2), String::UTF16LE);