Merge pull request #1885 from joto/fix-last-fmt-issues

Fix last fmt issues
This commit is contained in:
Sarah Hoffmann
2023-01-15 14:43:11 +01:00
committed by GitHub
4 changed files with 9 additions and 12 deletions

View File

@ -398,12 +398,11 @@ pg_result_t table_connection_t::get_geom_by_id(osmium::item_type type,
{
assert(table().has_geom_column());
assert(m_db_connection);
std::string const id_str = fmt::to_string(id);
if (table().has_multicolumn_id_index()) {
return m_db_connection->exec_prepared(
"get_wkb", type_to_char(type), id_str.c_str());
return m_db_connection->exec_prepared("get_wkb", type_to_char(type),
id);
}
return m_db_connection->exec_prepared("get_wkb", id_str);
return m_db_connection->exec_prepared("get_wkb", id);
}
void table_connection_t::delete_rows_with(osmium::item_type type, osmid_t id)

View File

@ -15,9 +15,6 @@
#include <stdexcept>
// NOLINTNEXTLINE(google-global-names-in-headers,google-build-using-namespace)
using namespace fmt::literals;
template <typename S, typename... TArgs>
std::runtime_error fmt_error(S const &format_str, TArgs &&...args)
{

View File

@ -30,7 +30,7 @@ public:
void number(T value)
{
if (std::isfinite(value)) {
fmt::format_to(std::back_inserter(m_buffer), "{}"_format(value));
m_buffer += fmt::to_string(value);
} else {
null();
}
@ -39,7 +39,7 @@ public:
template <typename T, std::enable_if_t<std::is_integral_v<T>, bool> = true>
void number(T value)
{
fmt::format_to(std::back_inserter(m_buffer), "{}"_format(value));
m_buffer += fmt::to_string(value);
}
void string(char const *str)
@ -70,8 +70,8 @@ public:
break;
default:
if (c <= 0x1f) {
m_buffer.append(
R"(\u{:04x})"_format(static_cast<unsigned char>(c)));
m_buffer.append(fmt::format(R"(\u{:04x})",
static_cast<unsigned char>(c)));
} else {
m_buffer += c;
}

View File

@ -138,7 +138,8 @@ struct exec_arg
constexpr static std::size_t const buffers_needed = 1;
static char const *to_str(std::vector<std::string> *data, T param)
{
return data->emplace_back("{}"_format(std::forward<T>(param))).c_str();
return data->emplace_back(fmt::to_string(std::forward<T>(param)))
.c_str();
}
};