Skip to content

Commit 9087ce2

Browse files
authored
Merge pull request #1885 from joto/fix-last-fmt-issues
Fix last fmt issues
2 parents 75c7a11 + eb63366 commit 9087ce2

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

src/flex-table.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -398,12 +398,11 @@ pg_result_t table_connection_t::get_geom_by_id(osmium::item_type type,
398398
{
399399
assert(table().has_geom_column());
400400
assert(m_db_connection);
401-
std::string const id_str = fmt::to_string(id);
402401
if (table().has_multicolumn_id_index()) {
403-
return m_db_connection->exec_prepared(
404-
"get_wkb", type_to_char(type), id_str.c_str());
402+
return m_db_connection->exec_prepared("get_wkb", type_to_char(type),
403+
id);
405404
}
406-
return m_db_connection->exec_prepared("get_wkb", id_str);
405+
return m_db_connection->exec_prepared("get_wkb", id);
407406
}
408407

409408
void table_connection_t::delete_rows_with(osmium::item_type type, osmid_t id)

src/format.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515

1616
#include <stdexcept>
1717

18-
// NOLINTNEXTLINE(google-global-names-in-headers,google-build-using-namespace)
19-
using namespace fmt::literals;
20-
2118
template <typename S, typename... TArgs>
2219
std::runtime_error fmt_error(S const &format_str, TArgs &&...args)
2320
{

src/json-writer.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class json_writer_t
3030
void number(T value)
3131
{
3232
if (std::isfinite(value)) {
33-
fmt::format_to(std::back_inserter(m_buffer), "{}"_format(value));
33+
m_buffer += fmt::to_string(value);
3434
} else {
3535
null();
3636
}
@@ -39,7 +39,7 @@ class json_writer_t
3939
template <typename T, std::enable_if_t<std::is_integral_v<T>, bool> = true>
4040
void number(T value)
4141
{
42-
fmt::format_to(std::back_inserter(m_buffer), "{}"_format(value));
42+
m_buffer += fmt::to_string(value);
4343
}
4444

4545
void string(char const *str)
@@ -70,8 +70,8 @@ class json_writer_t
7070
break;
7171
default:
7272
if (c <= 0x1f) {
73-
m_buffer.append(
74-
R"(\u{:04x})"_format(static_cast<unsigned char>(c)));
73+
m_buffer.append(fmt::format(R"(\u{:04x})",
74+
static_cast<unsigned char>(c)));
7575
} else {
7676
m_buffer += c;
7777
}

src/pgsql.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ struct exec_arg
138138
constexpr static std::size_t const buffers_needed = 1;
139139
static char const *to_str(std::vector<std::string> *data, T param)
140140
{
141-
return data->emplace_back("{}"_format(std::forward<T>(param))).c_str();
141+
return data->emplace_back(fmt::to_string(std::forward<T>(param)))
142+
.c_str();
142143
}
143144
};
144145

0 commit comments

Comments
 (0)