Skip to content

Commit fbc990f

Browse files
committed
Remove GCC 11 warnings
Change-Id: If1826b3d9f85aad3e5eb7a97d36f4546e2c6b18e
1 parent 4f4d1ff commit fbc990f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

driver/mysql_ps_resultset.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,10 @@ MySQL_Prepared_ResultSet::getStatement() const
956956
}
957957
/* }}} */
958958

959+
#if defined(__GNUC__) && !defined(__clang__)
960+
#pragma GCC diagnostic push
961+
#pragma GCC diagnostic ignored "-Wformat-truncation"
962+
#endif
959963

960964
/* {{{ MySQL_Prepared_ResultSet::getString() -I- */
961965
SQLString
@@ -1062,6 +1066,9 @@ MySQL_Prepared_ResultSet::getString(const uint32_t columnIndex) const
10621066
}
10631067
/* }}} */
10641068

1069+
#if defined(__GNUC__) && !defined(__clang__)
1070+
#pragma GCC diagnostic pop
1071+
#endif
10651072

10661073
/* {{{ MySQL_Prepared_ResultSet::getString() -I- */
10671074
SQLString

test/test_common.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ static void test_connection_0(boost::scoped_ptr<sql::Connection> & conn)
294294

295295
ensure("connection is closed", !conn->isClosed());
296296

297-
sprintf(buff, "KILL %d", rset1->getInt(1));
297+
snprintf(buff, sizeof(buff)-1, "KILL %d", rset1->getInt(1));
298298

299299
try {
300300
stmt1->execute(buff);
@@ -602,7 +602,6 @@ static void test_statement_5(boost::scoped_ptr<sql::Connection> & conn, boost::s
602602
try {
603603
boost::scoped_ptr<sql::ResultSet> rset(stmt->executeQuery("INSERT INTO test_function VALUES(2,200)"));
604604
ensure("NULL returned for result set", rset.get() == NULL);
605-
ensure_equal_int("Non-empty result set", false, rset->next());
606605
} catch (sql::SQLException &) {
607606
} catch (...) {
608607
printf("\n# ERR: Caught unknown exception at %s::%d\n", CPPCONN_FUNC, __LINE__);

0 commit comments

Comments
 (0)