Skip to content

Commit e800c4f

Browse files
committed
Fix g++ compilation, use fmt::format instead
1 parent 14331bb commit e800c4f

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

src/main/dumpers/schemas/schemas.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
#include <unordered_set>
2828
#include <algorithm>
2929
#include "metadatalist.h"
30+
#include <optional>
31+
#include <cstring>
32+
#include <fmt/format.h>
3033

3134
namespace Dumpers::Schemas
3235
{
@@ -35,7 +38,7 @@ std::optional<std::string> GetMetadataValue(const SchemaMetadataEntryData_t& ent
3538
{
3639
const auto hashedName = hash_32_fnv1a_const(entry.m_pszName);
3740
if (std::ranges::find(string_metadata_entries, hashedName) != string_metadata_entries.end()) {
38-
return std::format("\"{}\"", *static_cast<const char**>(entry.m_pData));
41+
return fmt::format("\"{}\"", *static_cast<const char**>(entry.m_pData));
3942
}
4043
else if (std::ranges::find(integer_metadata_entries, hashedName) != integer_metadata_entries.end()) {
4144
int result;
@@ -52,10 +55,10 @@ std::optional<std::string> GetMetadataValue(const SchemaMetadataEntryData_t& ent
5255
char* result = static_cast<char*>(entry.m_pData);
5356
for (uint8_t i = 0; i < 8; ++i) {
5457
if (result[i] == '\0') {
55-
return std::format("\"{}\"", std::string(result, i));
58+
return fmt::format("\"{}\"", std::string(result, i));
5659
}
5760
}
58-
return std::format("\"{}\"", std::string(result, 8));
61+
return fmt::format("\"{}\"", std::string(result, 8));
5962
}
6063
return {};
6164
}
@@ -65,9 +68,8 @@ void OutputMetadataEntry(const SchemaMetadataEntryData_t& entry, std::ofstream&
6568
output << (tabulate ? "\t" : "") << "// " << entry.m_pszName;
6669
const auto metadataValue = GetMetadataValue(entry);
6770
if (metadataValue)
68-
{
6971
output << " = " << *metadataValue;
70-
}
72+
7173
output << "\n";
7274
}
7375

0 commit comments

Comments
 (0)