From d7ff2e0d651d6b0bc24cf2b173613d6386576bc4 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 17 Feb 2019 16:16:11 +0000 Subject: Enable hicpp checks and fix accordingly --- libpqpp/pq-column.cpp | 1 + libpqpp/pq-connection.cpp | 2 ++ libpqpp/pq-mock.cpp | 4 +++- libpqpp/pq-selectbase.cpp | 6 ++++-- 4 files changed, 10 insertions(+), 3 deletions(-) (limited to 'libpqpp') diff --git a/libpqpp/pq-column.cpp b/libpqpp/pq-column.cpp index addd002..e743e60 100644 --- a/libpqpp/pq-column.cpp +++ b/libpqpp/pq-column.cpp @@ -71,6 +71,7 @@ PQ::Column::apply(DB::HandleField & h) const { int days = 0, hours = 0, minutes = 0, seconds = 0, fractions = 0, flen1 = 0, flen2 = 0; const char * val = value(); + // NOLINTNEXTLINE(hicpp-vararg) if (sscanf(val, "%d %*[days] %d:%d:%d.%n%d%n", &days, &hours, &minutes, &seconds, &flen1, &fractions, &flen2) >= 4) { h.interval(boost::posix_time::time_duration((24 * days) + hours, minutes, seconds, fractions * (long)pow(10, boost::posix_time::time_res_traits::num_fractional_digits() + flen1 - flen2))); diff --git a/libpqpp/pq-connection.cpp b/libpqpp/pq-connection.cpp index f20dfb5..f767b57 100644 --- a/libpqpp/pq-connection.cpp +++ b/libpqpp/pq-connection.cpp @@ -13,6 +13,7 @@ NAMEDFACTORY("postgresql", PQ::Connection, DB::ConnectionFactory); static void setup() __attribute__((constructor(101))); static void setup() { + // NOLINTNEXTLINE(hicpp-no-array-decay) BOOST_ASSERT(PQisthreadsafe() == 1); PQinitOpenSSL(1, 0); } @@ -81,6 +82,7 @@ PQ::Connection::bulkUpdateStyle() const void PQ::Connection::ping() const { + // NOLINTNEXTLINE(hicpp-signed-bitwise) struct pollfd fd { PQsocket(conn), POLLRDHUP | POLLERR | POLLHUP | POLLNVAL, 0 }; if (PQstatus(conn) != CONNECTION_OK || poll(&fd, 1, 0)) { if (inTx()) { diff --git a/libpqpp/pq-mock.cpp b/libpqpp/pq-mock.cpp index 151f26d..414e02b 100644 --- a/libpqpp/pq-mock.cpp +++ b/libpqpp/pq-mock.cpp @@ -30,7 +30,9 @@ void Mock::SetTablesToUnlogged() const { auto c = std::static_pointer_cast(Mock::openConnection()); - if (c->serverVersion() < 90500) return; + if (c->serverVersion() < 90500) { + return; + } auto s = c->select(R"SQL( SELECT n.nspname, c.relname FROM pg_class c, pg_namespace n diff --git a/libpqpp/pq-selectbase.cpp b/libpqpp/pq-selectbase.cpp index 0950d37..93dee50 100644 --- a/libpqpp/pq-selectbase.cpp +++ b/libpqpp/pq-selectbase.cpp @@ -25,10 +25,12 @@ PQ::SelectBase::createColumns(PGresult * execRes) { unsigned int nFields = PQnfields(execRes); for (unsigned int f = 0; f < nFields; f += 1) { - if (binary) + if (binary) { insertColumn(std::make_unique(this, f)); - else + } + else { insertColumn(std::make_unique(this, f)); + } } } -- cgit v1.2.3