Replace more snprintf by UTIL_Format.

This commit is contained in:
Arkshine
2014-08-08 12:44:37 +02:00
parent c22bb12c1e
commit b47aa6871d
61 changed files with 417 additions and 72 deletions

View File

@ -11,16 +11,10 @@
// MySQL Module
//
#include <stdio.h>
#include <string.h>
#include "amxxmodule.h"
#include "MysqlDriver.h"
#include "MysqlDatabase.h"
#if defined WIN32
#define snprintf _snprintf
#define strncasecmp strnicmp
#endif
using namespace SourceMod;
bool MysqlDriver::IsCompatDriver(const char *namestring)
@ -53,7 +47,7 @@ IDatabase *MysqlDriver::_Connect(DatabaseInfo *info, int *errcode, char *error,
*errcode = -1;
if (error && maxlength)
{
snprintf(error, maxlength, "Initialization failed");
UTIL_Format(error, maxlength, "Initialization failed");
}
return NULL;
}
@ -78,7 +72,7 @@ IDatabase *MysqlDriver::_Connect(DatabaseInfo *info, int *errcode, char *error,
}
if (error && maxlength)
{
snprintf(error, maxlength, "%s", mysql_error(mysql));
UTIL_Format(error, maxlength, "%s", mysql_error(mysql));
}
return NULL;
}

View File

@ -11,16 +11,11 @@
// MySQL Module
//
#include <stdio.h>
#include <string.h>
#include "amxxmodule.h"
#include "MysqlQuery.h"
#include "MysqlDatabase.h"
#include "MysqlResultSet.h"
#if defined WIN32
#define snprintf _snprintf
#endif
using namespace SourceMod;
MysqlQuery::MysqlQuery(const char *querystring, MysqlDatabase *db) :
@ -95,7 +90,7 @@ bool MysqlQuery::ExecuteR(QueryInfo *info, char *error, size_t maxlength)
info->rs = NULL;
if (error && maxlength)
{
snprintf(error, maxlength, "%s", mysql_error(m_pDatabase->m_pMysql));
UTIL_Format(error, maxlength, "%s", mysql_error(m_pDatabase->m_pMysql));
}
}
else