Fixed issue with clang complaining about sprintf being depreciated

This commit is contained in:
slinky55
2022-09-30 00:34:33 -04:00
parent 4b65d65af3
commit e2e45f7a14
6 changed files with 9 additions and 9 deletions

View File

@@ -67,7 +67,7 @@ static void ReportWarning(const char *msg, ...) {
va_start(args, msg);
char szBuffer[3000];
const int iLen = vsprintf(szBuffer, msg, args);
const int iLen = vsnprintf(szBuffer, 3000, msg, args);
ai_assert(iLen > 0);
va_end(args);

View File

@@ -1228,7 +1228,7 @@ void FBXExporter::WriteObjects ()
"Version", int32_t(101), outstream, binary, indent
);
char layerName[8];
sprintf(layerName, "COLOR_%d", colorChannelIndex);
snprintf(layerName, 8, "COLOR_%d", colorChannelIndex);
FBX::Node::WritePropertyNode(
"Name", (const char*)layerName, outstream, binary, indent
);

View File

@@ -99,7 +99,7 @@ MD5Parser::MD5Parser(char *_buffer, unsigned int _fileSize) : buffer(_buffer), b
// Report warning to the log stream
/*static*/ void MD5Parser::ReportWarning(const char *warn, unsigned int line) {
char szBuffer[1024];
::sprintf(szBuffer, "[MD5] Line %u: %s", line, warn);
::snprintf(szBuffer, 1024, "[MD5] Line %u: %s", line, warn);
ASSIMP_LOG_WARN(szBuffer);
}

View File

@@ -298,7 +298,7 @@ void MDLImporter::SizeCheck(const void *szPos, const char *szFile, unsigned int
}
char szBuffer[1024];
::sprintf(szBuffer, "Invalid MDL file. The file is too small "
::snprintf(szBuffer, 1024, "Invalid MDL file. The file is too small "
"or contains invalid data (File: %s Line: %u)",
szFilePtr, iLine);

View File

@@ -80,7 +80,7 @@ AI_WONT_RETURN void ValidateDSProcess::ReportError(const char *msg, ...) {
va_start(args, msg);
char szBuffer[3000];
const int iLen = vsprintf(szBuffer, msg, args);
const int iLen = vsnprintf(szBuffer, 3000, msg, args);
ai_assert(iLen > 0);
va_end(args);
@@ -95,7 +95,7 @@ void ValidateDSProcess::ReportWarning(const char *msg, ...) {
va_start(args, msg);
char szBuffer[3000];
const int iLen = vsprintf(szBuffer, msg, args);
const int iLen = vsnprintf(szBuffer, 3000, msg, args);
ai_assert(iLen > 0);
va_end(args);