mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-23 16:48:06 +02:00
GH #3876: Replace sprintf with snprintf in Environment and NumberFormatter to avoid deprecation warnings
This commit is contained in:
@@ -18,8 +18,8 @@
|
||||
|
||||
|
||||
#include "Poco/Data/MySQL/MySQLException.h"
|
||||
#include <mysql.h>
|
||||
#include <stdio.h>
|
||||
#include "Poco/NumberFormatter.h"
|
||||
#include <mysql/mysql.h>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@@ -71,9 +71,7 @@ std::string ConnectionException::compose(const std::string& text, MYSQL* h)
|
||||
str += mysql_error(h);
|
||||
|
||||
str += "\t[mysql_errno]: ";
|
||||
char buff[30];
|
||||
sprintf(buff, "%d", mysql_errno(h));
|
||||
str += buff;
|
||||
Poco::NumberFormatter::append(str, mysql_errno(h));
|
||||
|
||||
str += "\t[mysql_sqlstate]: ";
|
||||
str += mysql_sqlstate(h);
|
||||
@@ -125,9 +123,7 @@ std::string StatementException::compose(const std::string& text, MYSQL_STMT* h,
|
||||
str += mysql_stmt_error(h);
|
||||
|
||||
str += "\t[mysql_stmt_errno]: ";
|
||||
char buff[30];
|
||||
sprintf(buff, "%d", mysql_stmt_errno(h));
|
||||
str += buff;
|
||||
Poco::NumberFormatter::append(str, mysql_stmt_errno(h));
|
||||
|
||||
str += "\t[mysql_stmt_sqlstate]: ";
|
||||
str += mysql_stmt_sqlstate(h);
|
||||
|
Reference in New Issue
Block a user