Skip to content

Commit 2615174

Browse files
iwwuigcbot
authored andcommitted
Replace C functions
Replaced C functions "strlen" and "sprintf"
1 parent 03d0eac commit 2615174

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

IGC/common/Stats.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ void TimeStats::printTime( ShaderType type, ShaderHash hash, void* context ) con
664664
void TimeStats::printSumTime() const
665665
{
666666
// If using regkey to turn on timestats, CorpusName is not initialized properly
667-
if (strlen(IGC::Debug::GetShaderCorpusName()) == 0)
667+
if (sizeof(IGC::Debug::GetShaderCorpusName()) == 0)
668668
{
669669
std::stringstream corpusName;
670670
corpusName << m_totalShaderCount << " shaders";
@@ -1040,11 +1040,11 @@ void TimeStats::printTimeCSV( std::string const& corpusName ) const
10401040
IGC_ASSERT_MESSAGE(m_isPostProcessed, "Print functions should only be called on a Post-Processed TimeStats object");
10411041

10421042
std::string subFile = "TimeStat_";
1043-
if (strlen(IGC::Debug::GetShaderCorpusName()) == 0)
1043+
if (sizeof(IGC::Debug::GetShaderCorpusName()) == 0)
10441044
subFile += "Shaders";
10451045
else
10461046
subFile += IGC::Debug::GetShaderCorpusName();
1047-
const std::string outputFilePath =
1047+
const std::string outputFilePath =
10481048
#if defined(__linux__)
10491049
subFile + ".csv";
10501050
#else
@@ -1104,7 +1104,7 @@ void TimeStats::printPerPassTimeCSV(std::string const& corpusName) const
11041104
}
11051105

11061106
std::string subFile = "TimeStatPerPass_";
1107-
if (strlen(IGC::Debug::GetShaderCorpusName()) == 0)
1107+
if (sizeof(IGC::Debug::GetShaderCorpusName()) == 0)
11081108
subFile += "Shaders";
11091109
else
11101110
subFile += IGC::Debug::GetShaderCorpusName();
@@ -1267,7 +1267,8 @@ void CMemoryReport::DumpMemoryStats( ShaderType type, ShaderHash hash )
12671267
shaderName = shaderName.substr(shaderName.find_last_of("\\") + 1, shaderName.size());
12681268
}
12691269

1270-
sprintf(m_DumpMemoryStatsFileName, "%s", shaderName.c_str());
1270+
sprintf_s(m_DumpMemoryStatsFileName, sizeof(m_DumpMemoryStatsFileName),
1271+
"%s", shaderName.c_str());
12711272

12721273
iSTD::FileWrite( csvFileGlobal, "%s,%u", m_DumpMemoryStatsFileName, g_MemoryReport.m_Stat.HeapUsedPeak/1024 );
12731274
iSTD::FileWrite( csvFileAllocs, "%s,%u", m_DumpMemoryStatsFileName, g_MemoryReport.m_Stat.NumAllocations );

0 commit comments

Comments
 (0)