Skip to content

Commit

Permalink
handle a default value for dates
Browse files Browse the repository at this point in the history
  • Loading branch information
robUx4 committed Dec 17, 2023
1 parent f713dd1 commit 1fbb1ed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ebml/EbmlElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ extern const EbmlSemanticContext Context_EbmlGlobal;
#define DEFINE_SEMANTIC_ITEM(m,u,c) EbmlSemantic(m, u, EBML_INFO(c)),
#define DEFINE_SEMANTIC_ITEM_UINT(m,u,d,c) EbmlSemantic(m, u, static_cast<std::uint64_t>(d), EBML_INFO(c)),
#define DEFINE_SEMANTIC_ITEM_SINT(m,u,d,c) EbmlSemantic(m, u, static_cast<std::int64_t>(d), EBML_INFO(c)),
#define DEFINE_SEMANTIC_ITEM_DATE(m,u,d,c) EbmlSemantic(m, u, static_cast<std::int64_t>(d,true), EBML_INFO(c)),
#define DEFINE_SEMANTIC_ITEM_DOUBLE(m,u,d,c) EbmlSemantic(m, u, static_cast<double>(d), EBML_INFO(c)),
#define DEFINE_SEMANTIC_ITEM_STRING(m,u,d,c) EbmlSemantic(m, u, static_cast<char*>(d), EBML_INFO(c)),
#define DEFINE_SEMANTIC_ITEM_UNISTRING(m,u,d,c) EbmlSemantic(m, u, static_cast<wchar_t*>(d), EBML_INFO(c)),
Expand Down Expand Up @@ -355,6 +356,7 @@ class EBML_DLL_API EbmlSemantic {
NO_DEFAULT,
UINTEGER,
SINTEGER,
DATE,
DOUBLE,
STRING,
UNISTRING,
Expand All @@ -371,7 +373,7 @@ class EBML_DLL_API EbmlSemantic {
constexpr DefaultValues(void) : u64(0), type(DefaultType::NO_DEFAULT) {}
constexpr DefaultValues(const DefaultValues &) = default;
constexpr DefaultValues(std::uint64_t u) : u64(u), type(DefaultType::UINTEGER) {}
constexpr DefaultValues(std::int64_t u) : u64(u), type(DefaultType::UINTEGER) {}
constexpr DefaultValues(std::int64_t u, bool date = false) : i64(u), type(date ? DefaultType::UINTEGER : DefaultType::DATE) {}
constexpr DefaultValues(double d) : f(d), type(DefaultType::DOUBLE) {}
constexpr DefaultValues(const char *d) : s(d), type(DefaultType::STRING) {}
constexpr DefaultValues(const wchar_t *d) : ws(d), type(DefaultType::UNISTRING) {}
Expand Down

0 comments on commit 1fbb1ed

Please sign in to comment.