summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2019-02-17 16:16:11 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2019-02-17 16:16:11 +0000
commitd7ff2e0d651d6b0bc24cf2b173613d6386576bc4 (patch)
tree71a4cb0834503115ca84dc097a2b5394ac95cd99
parentModernize clang tidy fixes (diff)
downloadlibdbpp-postgresql-d7ff2e0d651d6b0bc24cf2b173613d6386576bc4.tar.bz2
libdbpp-postgresql-d7ff2e0d651d6b0bc24cf2b173613d6386576bc4.tar.xz
libdbpp-postgresql-d7ff2e0d651d6b0bc24cf2b173613d6386576bc4.zip
Enable hicpp checks and fix accordingly
-rw-r--r--libpqpp/pq-column.cpp1
-rw-r--r--libpqpp/pq-connection.cpp2
-rw-r--r--libpqpp/pq-mock.cpp4
-rw-r--r--libpqpp/pq-selectbase.cpp6
4 files changed, 10 insertions, 3 deletions
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<Connection>(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<BinaryColumn>(this, f));
- else
+ }
+ else {
insertColumn(std::make_unique<Column>(this, f));
+ }
}
}