From 7b56849be41fdd342c8d92c243df6370a53c8305 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 18 Sep 2021 14:24:56 +0100 Subject: Add JT recommended warnings --- libmysqlpp/my-connection.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'libmysqlpp/my-connection.cpp') diff --git a/libmysqlpp/my-connection.cpp b/libmysqlpp/my-connection.cpp index 5828986..22ba809 100644 --- a/libmysqlpp/my-connection.cpp +++ b/libmysqlpp/my-connection.cpp @@ -8,22 +8,18 @@ #include #include -NAMEDFACTORY("mysql", MySQL::Connection, DB::ConnectionFactory); +NAMEDFACTORY("mysql", MySQL::Connection, DB::ConnectionFactory) MySQL::ConnectionError::ConnectionError(MYSQL * m) : MySQL::Error(m) { } class Opts { public: - Opts() - { - port = 3306; - } using OptString = std::optional; OptString server; OptString user; OptString password; OptString database; - unsigned int port; + unsigned int port {3306}; OptString unix_socket; OptString options; }; @@ -158,13 +154,13 @@ namespace MySQL { ctx->swapContext(); if (ctx->loadBufLen == ctx->bufOff) { // Nothing to do or error - return ctx->bufOff; + return static_cast(ctx->bufOff); } } auto copy = std::min(ctx->loadBufLen - ctx->bufOff, bufSize); memcpy(buf, ctx->loadBuf + ctx->bufOff, copy); ctx->bufOff += copy; - return copy; + return static_cast(copy); } static void @@ -215,7 +211,7 @@ MySQL::Connection::endBulkUpload(const char * msg) } ctx->loadBuf = nullptr; ctx->loadBufLen = 0; - ctx->bufOff = msg ? -1 : 0; + ctx->bufOff = msg ? static_cast(-1) : 0; // switch context with empty buffer fires finished ctx->swapContext(); // Check result @@ -245,5 +241,5 @@ MySQL::Connection::bulkUploadData(const char * data, size_t len) const int64_t MySQL::Connection::insertId() { - return mysql_insert_id(&conn); + return static_cast(mysql_insert_id(&conn)); } -- cgit v1.2.3