fix check-structures-sanity compile on windows

develop
Ben Lubar 2020-03-12 10:02:21 -05:00
parent 469c49c8b9
commit 08d2ed577e
No known key found for this signature in database
GPG Key ID: 92939677AB59EDA4
2 changed files with 15 additions and 12 deletions

@ -580,7 +580,7 @@ void Checker::dispatch_buffer(const QueueItem & item, const CheckedStructure & c
auto identity = static_cast<container_identity *>(cs.identity); auto identity = static_cast<container_identity *>(cs.identity);
auto item_identity = identity->getItemType(); auto item_identity = identity->getItemType();
dispatch_item(item, CheckedStructure(item_identity, identity->byte_size() / item_identity->byte_size(), static_cast<enum_identity *>(identity->getIndexEnumType()), cs.inside_structure)); dispatch_item(item, CheckedStructure(item_identity, identity->byte_size() / item_identity->byte_size(), static_cast<enum_identity *>(identity->getIndexEnumType()), true));
} }
void Checker::dispatch_stl_ptr_vector(const QueueItem & item, const CheckedStructure & cs) void Checker::dispatch_stl_ptr_vector(const QueueItem & item, const CheckedStructure & cs)
{ {

@ -107,23 +107,26 @@ size_t CheckedStructure::full_size() const
return size; return size;
} }
#define RETURN_CACHED_WRAPPER(T, base, ...) \
static std::map<type_identity *, std::unique_ptr<T>> wrappers; \
auto it = wrappers.find(base); \
if (it != wrappers.end()) \
{ \
return it->second.get(); \
} \
return (wrappers[base] = dts::make_unique<T>(base __VA_OPT__(,) __VA_ARGS__)).get()
type_identity *Checker::wrap_in_stl_ptr_vector(type_identity *base) type_identity *Checker::wrap_in_stl_ptr_vector(type_identity *base)
{ {
RETURN_CACHED_WRAPPER(df::stl_ptr_vector_identity, base, nullptr); static std::map<type_identity *, std::unique_ptr<df::stl_ptr_vector_identity>> wrappers;
auto it = wrappers.find(base);
if (it != wrappers.end())
{
return it->second.get();
}
return (wrappers[base] = dts::make_unique<df::stl_ptr_vector_identity>(base, nullptr)).get();
} }
type_identity *Checker::wrap_in_pointer(type_identity *base) type_identity *Checker::wrap_in_pointer(type_identity *base)
{ {
RETURN_CACHED_WRAPPER(df::pointer_identity, base); static std::map<type_identity *, std::unique_ptr<df::pointer_identity>> wrappers;
auto it = wrappers.find(base);
if (it != wrappers.end())
{
return it->second.get();
}
return (wrappers[base] = dts::make_unique<df::pointer_identity>(base)).get();
} }
std::map<size_t, std::vector<std::string>> known_types_by_size; std::map<size_t, std::vector<std::string>> known_types_by_size;