diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-08-10 18:14:30 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-08-10 18:14:30 +0100 |
commit | ee2e68f44f7b9ee099f98b668257b5d57a86a695 (patch) | |
tree | d7593729cdb2dcad097c7a801f0c39c8d59381c0 /lib/output | |
parent | Tests, fixes, improvements to WritePqCopyStream (diff) | |
download | mygrate-ee2e68f44f7b9ee099f98b668257b5d57a86a695.tar.bz2 mygrate-ee2e68f44f7b9ee099f98b668257b5d57a86a695.tar.xz mygrate-ee2e68f44f7b9ee099f98b668257b5d57a86a695.zip |
Enable numeric conversion warning and fix the fallout
Diffstat (limited to 'lib/output')
-rw-r--r-- | lib/output/pq/pqRecordSet.cpp | 4 | ||||
-rw-r--r-- | lib/output/pq/pqStmt.cpp | 2 | ||||
-rw-r--r-- | lib/output/pq/writePqCopyStrm.cpp | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/lib/output/pq/pqRecordSet.cpp b/lib/output/pq/pqRecordSet.cpp index 71ddee4..e25c571 100644 --- a/lib/output/pq/pqRecordSet.cpp +++ b/lib/output/pq/pqRecordSet.cpp @@ -18,13 +18,13 @@ namespace MyGrate::Output::Pq { std::size_t PqRecordSet::rows() const { - return PQntuples(res.get()); + return boost::numeric_cast<std::size_t>(PQntuples(res.get())); } std::size_t PqRecordSet::columns() const { - return PQnfields(res.get()); + return boost::numeric_cast<std::size_t>(PQnfields(res.get())); } DbValue diff --git a/lib/output/pq/pqStmt.cpp b/lib/output/pq/pqStmt.cpp index eb3c32d..c6399e4 100644 --- a/lib/output/pq/pqStmt.cpp +++ b/lib/output/pq/pqStmt.cpp @@ -53,7 +53,7 @@ namespace MyGrate::Output::Pq { if (const auto i = c->stmts.find(q); i != c->stmts.end()) { return i->second; } - auto nam {scprintf<"pst%0x">(c->stmts.size())}; + auto nam {scprintf<"pst%0lx">(c->stmts.size())}; ResPtr res {PQprepare(c->conn.get(), nam.c_str(), q, (int)n, nullptr), PQclear}; verify<PqErr>(PQresultStatus(res.get()) == PGRES_COMMAND_OK, q, c->conn.get()); return c->stmts.emplace(q, std::move(nam)).first->second; diff --git a/lib/output/pq/writePqCopyStrm.cpp b/lib/output/pq/writePqCopyStrm.cpp index 4664e6b..984b4fd 100644 --- a/lib/output/pq/writePqCopyStrm.cpp +++ b/lib/output/pq/writePqCopyStrm.cpp @@ -56,7 +56,7 @@ namespace MyGrate::Output::Pq { return std::iscntrl(c); }); if (esc != pos) { - fwrite(pos, esc - pos, 1, out); + fwrite(pos, boost::numeric_cast<size_t>(esc - pos), 1, out); pos = esc; } while (pos != v.end() && std::iscntrl(*pos)) { @@ -77,7 +77,7 @@ namespace MyGrate::Output::Pq { static constexpr const auto hex {[] { std::array<std::array<char, 2>, 256> h {}; std::array<char, 16> hc {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; - for (int x {}; x < 256; x += 1) { + for (decltype(h)::size_type x {}; x < 256; x += 1) { h[x] = {hc[x >> 4], hc[x & 0xF]}; } return h; |