From 216c87cbb7228d9130eead5e374dfd7a11a96b98 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 18 Sep 2021 14:25:24 +0100 Subject: Add JT recommended warnings --- libpqpp/pq-column.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'libpqpp/pq-column.cpp') diff --git a/libpqpp/pq-column.cpp b/libpqpp/pq-column.cpp index e4d85d8..c1e0d40 100644 --- a/libpqpp/pq-column.cpp +++ b/libpqpp/pq-column.cpp @@ -5,7 +5,8 @@ #include PQ::Column::Column(const SelectBase * s, unsigned int i) : - DB::Column(PQfname(s->execRes, (int)i), i), sc(s), oid(PQftype(sc->execRes, (int)colNo)), buf(nullptr) + DB::Column(PQfname(s->execRes, static_cast(i)), i), sc(s), oid(PQftype(sc->execRes, static_cast(colNo))), + buf(nullptr) { } @@ -19,19 +20,19 @@ PQ::Column::~Column() bool PQ::Column::isNull() const { - return PQgetisnull(sc->execRes, (int)sc->tuple, (int)colNo); + return PQgetisnull(sc->execRes, static_cast(sc->tuple), static_cast(colNo)); } std::size_t PQ::Column::length() const { - return PQgetlength(sc->execRes, (int)sc->tuple, (int)colNo); + return static_cast(PQgetlength(sc->execRes, static_cast(sc->tuple), static_cast(colNo))); } const char * PQ::Column::value() const { - return PQgetvalue(sc->execRes, (int)sc->tuple, (int)colNo); + return PQgetvalue(sc->execRes, static_cast(sc->tuple), static_cast(colNo)); } void @@ -74,8 +75,8 @@ PQ::Column::apply(DB::HandleField & h) const >= 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))); + * static_cast(pow(10, + boost::posix_time::time_res_traits::num_fractional_digits() + flen1 - flen2)))); } else { h.interval(boost::posix_time::duration_from_string(val)); @@ -96,7 +97,7 @@ PQ::Column::apply(DB::HandleField & h) const PQfreemem(buf); } size_t len; - buf = PQunescapeBytea(valueAsPtr(), &len); + buf = PQunescapeBytea(reinterpret_cast(value()), &len); h.blob(DB::Blob(buf, len)); break; } -- cgit v1.2.3