Fix some warnings

This commit is contained in:
Georg Hagen
2024-10-07 10:02:30 +02:00
parent 45b5fe2c26
commit f60b803bda
5 changed files with 10 additions and 7 deletions

View File

@@ -22,6 +22,8 @@ namespace OpenVulkano
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wswitch"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch"
constexpr mode_t GetFileType(std::filesystem::file_type type)
{
switch (type)
@@ -51,6 +53,7 @@ namespace OpenVulkano
}
return std::filesystem::file_type::unknown;
}
#pragma GCC diagnostic pop
#pragma clang diagnostic pop
template<bool BLOCK_WRITE = false>

View File

@@ -25,10 +25,10 @@ namespace OpenVulkano
float maxValue;
bool color, littleEndian;
PfmHeader() : width(0), height(0), maxValue(0), color(false), littleEndian(Utils::IsLittleEndian()) {}
PfmHeader() : width(0), height(0), maxValue(0), color(false), littleEndian(std::endian::native == std::endian::little) {}
PfmHeader(uint32_t width, uint32_t height, float maxValue, bool color) :
width(width), height(height), maxValue(maxValue), color(color), littleEndian(Utils::IsLittleEndian())
width(width), height(height), maxValue(maxValue), color(color), littleEndian(std::endian::native == std::endian::little)
{}
constexpr PfmHeader(uint32_t width, uint32_t height, float maxValue, bool color, bool littleEndian) :
@@ -46,7 +46,7 @@ namespace OpenVulkano
{
outStream << (pfmHeader.color ? "PF" : "Pf") << '\n';
outStream << pfmHeader.width << ' ' << pfmHeader.height << '\n';
if (pfmHeader.littleEndian) outStream << '-';
if constexpr (std::endian::native == std::endian::little) outStream << '-';
outStream << std::fixed << std::setprecision(1) << pfmHeader.maxValue << '\n';
return outStream;
}
@@ -96,7 +96,7 @@ namespace OpenVulkano
inStream >> header;
size_t size = header.GetElementCount();
if (Utils::IsLittleEndian() != header.littleEndian)
if ((std::endian::native == std::endian::little) != header.littleEndian)
{
char* data = reinterpret_cast<char*>(image.get());
for(size_t i = 0; i < size; i++)