Address some compiler warnings

This commit is contained in:
Thomas Krijnen
2025-10-08 14:18:17 +02:00
parent e15f222a19
commit 14c1b70768
3 changed files with 19 additions and 11 deletions
+17 -8
View File
@@ -38,7 +38,7 @@ namespace {
}
#ifdef IFOPSH_WITH_ROCKSDB
else {
T val;
T val = T{};
const bool is_header = entity_or_type->schema() == &Header_section_schema::get_schema();
if constexpr (
// the following types cannot be directly deserialized from rocksdb, but need to be constructed
@@ -51,6 +51,12 @@ namespace {
(is_header ? entity_or_type->name() : std::to_string(instance_name_)) + "|" +
std::to_string(index_), &str);
impl::deserialize(array_.db_ptr, str, val);
} else {
static_assert(
std::is_same_v<T, EnumerationReference> ||
std::is_same_v<std::remove_cv_t<std::remove_pointer_t<T>>, IfcUtil::IfcBaseClass>,
"RocksDB deserialization must be specialized for this EnumerationReference and IfcBaseClass*"
);
}
return val;
}
@@ -194,13 +200,15 @@ AttributeValue::operator IfcUtil::IfcBaseClass* () const
std::to_string(index_), &str);
size_t v;
memcpy(&v, str.data() + 2, sizeof(size_t));
if (str[1] == 'i') {
if (str.size() > 1 && str[1] == 'i') {
// entity reference, by #Name
return array_.db_ptr->assert_existance(v, IfcParse::impl::rocks_db_file_storage::entityinstance_ref);
} else if (str[1] == 't') {
} else if (str.size() > 1 && str[1] == 't') {
// type reference by Identity
return array_.db_ptr->assert_existance(v, IfcParse::impl::rocks_db_file_storage::typedecl_ref);
}
} else {
throw std::runtime_error("Invalid data encountered");
}
}
#endif
}
@@ -339,28 +347,28 @@ bool impl::serialize(std::string& val, const aggregate_of_aggregate_of_instance:
return true;
}
bool impl::serialize(std::string& val, const Blank& t)
bool impl::serialize(std::string& val, const Blank&)
{
val.resize(1);
val[0] = TypeEncoder::encode_type<Blank>();
return true;
}
bool impl::serialize(std::string& val, const Derived& t)
bool impl::serialize(std::string& val, const Derived&)
{
val.resize(1);
val[0] = TypeEncoder::encode_type<Derived>();
return true;
}
bool impl::serialize(std::string& val, const empty_aggregate_t& t)
bool impl::serialize(std::string& val, const empty_aggregate_t&)
{
val.resize(1);
val[0] = TypeEncoder::encode_type<empty_aggregate_t>();
return true;
}
bool impl::serialize(std::string& val, const empty_aggregate_of_aggregate_t& t)
bool impl::serialize(std::string& val, const empty_aggregate_of_aggregate_t&)
{
val.resize(1);
val[0] = TypeEncoder::encode_type<empty_aggregate_of_aggregate_t>();
@@ -397,6 +405,7 @@ bool impl::deserialize(IfcParse::impl::rocks_db_file_storage*, const std::string
} else {
return false;
}
return true;
}
bool impl::deserialize(IfcParse::impl::rocks_db_file_storage*, const std::string& val, boost::dynamic_bitset<>& t) {
+1 -2
View File
@@ -266,7 +266,6 @@ namespace impl {
if (val[0] != TypeEncoder::encode_type<T>()) {
return false;
}
auto s = (val.size() - 1) / sizeof(T);
memcpy(&t, val.data() + 1, sizeof(T));
return true;
}
@@ -404,7 +403,7 @@ public:
template<typename Visitor>
auto apply_visitor(void* storage, const IfcParse::declaration* decl, std::size_t identity, std::size_t index, Visitor&& visitor) const {
// @todo do we need visitation on all data/storage/attribute levels?
AttributeValue((IfcParse::impl::rocks_db_file_storage*)storage, identity, decl, index).apply_visitor(std::forward<Visitor>(visitor));
AttributeValue((IfcParse::impl::rocks_db_file_storage*)storage, identity, decl, (uint8_t) index).apply_visitor(std::forward<Visitor>(visitor));
}
#endif
};
+1 -1
View File
@@ -106,7 +106,7 @@ public:
return iterator(base_map_->find(k), &transform_);
}
size_t erase(const key_type& k) {
size_t erase(const key_type&) {
// @todo
return 0;
}