diff --git a/Code/Editor/Commands/CommandManager.cpp b/Code/Editor/Commands/CommandManager.cpp index 5f194971f5..4943621493 100644 --- a/Code/Editor/Commands/CommandManager.cpp +++ b/Code/Editor/Commands/CommandManager.cpp @@ -236,10 +236,7 @@ QString CEditorCommandManager::Execute(const AZStd::string& module, const AZStd: } else { - QString errMsg; - - errMsg = QStringLiteral("Error: Trying to execute a unknown command, '%1'!").arg(fullName.c_str()); - CryLogAlways(errMsg.toUtf8().data()); + CryLogAlways("Error: Trying to execute a unknown command, '%s'!", fullName.c_str()); } return ""; @@ -272,10 +269,7 @@ QString CEditorCommandManager::Execute(const AZStd::string& cmdLine) } else { - QString errMsg; - - errMsg = QStringLiteral("Error: Trying to execute a unknown command, '%1'!").arg(cmdLine.c_str()); - CryLogAlways(errMsg.toUtf8().data()); + CryLogAlways("Error: Trying to execute a unknown command, '%s'!", cmdLine.c_str()); } return ""; @@ -294,10 +288,7 @@ void CEditorCommandManager::Execute(int commandId) } else { - QString errMsg; - - errMsg = QStringLiteral("Error: Trying to execute a unknown command of ID '%1'!").arg(commandId); - CryLogAlways(errMsg.toUtf8().data()); + CryLogAlways("Error: Trying to execute a unknown command of ID '%d'!", commandId); } } diff --git a/Code/Editor/ConsoleDialog.cpp b/Code/Editor/ConsoleDialog.cpp index 2f1c3e6f58..7edb12c18c 100644 --- a/Code/Editor/ConsoleDialog.cpp +++ b/Code/Editor/ConsoleDialog.cpp @@ -36,7 +36,7 @@ void CConsoleDialog::SetInfoText(const char* text) { if (gEnv && gEnv->pLog) // before log system was initialized { - CryLogAlways(text); + CryLogAlways("%s", text); } } diff --git a/Code/Editor/LogFile.cpp b/Code/Editor/LogFile.cpp index 92186901d7..0812740efe 100644 --- a/Code/Editor/LogFile.cpp +++ b/Code/Editor/LogFile.cpp @@ -67,7 +67,7 @@ SANDBOX_API void ErrorV(const char* format, va_list argList) str += szBuffer; //CLogFile::WriteLine( str ); - CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_ERROR, str.toUtf8().data()); + CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_ERROR, "%s", str.toUtf8().data()); if (!CCryEditApp::instance()->IsInTestMode() && !CCryEditApp::instance()->IsInExportMode() && !CCryEditApp::instance()->IsInLevelLoadTestMode()) { @@ -95,7 +95,7 @@ SANDBOX_API void WarningV(const char* format, va_list argList) char szBuffer[MAX_LOGBUFFER_SIZE]; azvsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, format, argList); - CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_WARNING, szBuffer); + CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_WARNING, "%s", szBuffer); bool bNoUI = false; ICVar* pCVar = gEnv->pConsole->GetCVar("sys_no_crash_dialog"); @@ -478,7 +478,7 @@ void CLogFile::WriteString(const char* pszString) { if (gEnv && gEnv->pLog) { - gEnv->pLog->LogPlus(pszString); + gEnv->pLog->LogPlus("%s", pszString); } } diff --git a/Code/Editor/Objects/ObjectManager.cpp b/Code/Editor/Objects/ObjectManager.cpp index 30ee1fc57b..55b6fea57c 100644 --- a/Code/Editor/Objects/ObjectManager.cpp +++ b/Code/Editor/Objects/ObjectManager.cpp @@ -709,7 +709,7 @@ void CObjectManager::ShowDuplicationMsgWarning(CBaseObject* obj, const QString& ); // If id is taken. - CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_WARNING, sRenameWarning.toUtf8().data()); + CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_WARNING, "%s", sRenameWarning.toUtf8().data()); if (bShowMsgBox) { diff --git a/Code/Editor/Plugins/FFMPEGPlugin/main.cpp b/Code/Editor/Plugins/FFMPEGPlugin/main.cpp index ce0e91942b..847d426922 100644 --- a/Code/Editor/Plugins/FFMPEGPlugin/main.cpp +++ b/Code/Editor/Plugins/FFMPEGPlugin/main.cpp @@ -24,11 +24,9 @@ PLUGIN_API IPlugin* CreatePluginInstance(PLUGIN_INIT_PARAM* pInitParam) // Make sure the ffmpeg command can be executed before registering the command if (!CFFMPEGPlugin::RuntimeTest()) { - AZStd::string msg = - "FFMPEG plugin: Failed to execute FFmepg. Please run Setup Assistant, " + GetIEditor()->GetSystem()->GetILog()->Log("FFMPEG plugin: Failed to execute FFmepg. Please run Setup Assistant, " "go to the 'Optional software' section of the 'Install software' tab, " - "and make sure the FFmpeg executable is correctly configured."; - GetIEditor()->GetSystem()->GetILog()->Log(msg.c_str()); + "and make sure the FFmpeg executable is correctly configured."); } else { diff --git a/Code/Editor/PythonEditorFuncs.cpp b/Code/Editor/PythonEditorFuncs.cpp index 342cc607d7..200fd28f87 100644 --- a/Code/Editor/PythonEditorFuncs.cpp +++ b/Code/Editor/PythonEditorFuncs.cpp @@ -313,7 +313,7 @@ namespace { if (strcmp(pMessage, "") != 0) { - CryLogAlways(pMessage); + CryLogAlways("%s", pMessage); } } diff --git a/Code/Framework/AzManipulatorTestFramework/Include/AzManipulatorTestFramework/ActionDispatcher.h b/Code/Framework/AzManipulatorTestFramework/Include/AzManipulatorTestFramework/ActionDispatcher.h index 523e6a30a7..6ae09340e3 100644 --- a/Code/Framework/AzManipulatorTestFramework/Include/AzManipulatorTestFramework/ActionDispatcher.h +++ b/Code/Framework/AzManipulatorTestFramework/Include/AzManipulatorTestFramework/ActionDispatcher.h @@ -92,8 +92,7 @@ namespace AzManipulatorTestFramework { if (m_logging) { - AZStd::string message = AZStd::string::format(format, args...); - AZ_Printf("[ActionDispatcher] %s", message.c_str()); + AZ_Printf("ActionDispatcher", format, args...); } } diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl index cd9e4fc2b5..61f68197b6 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiCpuProfiler.inl @@ -288,11 +288,11 @@ namespace AZ continue; } - ImGui::Text(statistics->m_groupName.c_str()); + ImGui::Text("%s", statistics->m_groupName.c_str()); const ImVec2 topLeftBound = ImGui::GetItemRectMin(); ImGui::TableNextColumn(); - ImGui::Text(statistics->m_regionName.c_str()); + ImGui::Text("%s", statistics->m_regionName.c_str()); ImGui::TableNextColumn(); ImGui::Text("%.2f", CpuProfilerImGuiHelper::TicksToMs(statistics->m_runningAverageTicks)); @@ -313,7 +313,7 @@ namespace AZ if (ImGui::IsWindowHovered() && ImGui::IsMouseHoveringRect(topLeftBound, botRightBound, false)) { ImGui::BeginTooltip(); - ImGui::Text(statistics->GetExecutingThreadsLabel().c_str()); + ImGui::Text("%s", statistics->GetExecutingThreadsLabel().c_str()); ImGui::EndTooltip(); } } @@ -363,7 +363,7 @@ namespace AZ const auto ShowRow = [&ShowTimeInMs](const char* regionLabel, AZStd::sys_time_t duration) { - ImGui::Text(regionLabel); + ImGui::Text("%s", regionLabel); ImGui::NextColumn(); ShowTimeInMs(duration); diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl index 9b2f2b0dd9..80dcace2df 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiGpuProfiler.inl @@ -279,13 +279,13 @@ namespace AZ const AZStd::string totalPassCountLabel = AZStd::string::format("%s: %u", "Total Pass Count", static_cast(passEntryDatabase.size())); - ImGui::Text(totalPassCountLabel.c_str()); + ImGui::Text("%s", totalPassCountLabel.c_str()); // Display listed pass count. const AZStd::string listedPassCountLabel = AZStd::string::format("%s: %u", "Listed Pass Count", static_cast(m_passEntryReferences.size())); - ImGui::Text(listedPassCountLabel.c_str()); + ImGui::Text("%s", listedPassCountLabel.c_str()); } } @@ -404,7 +404,7 @@ namespace AZ passName = AZStd::string::format("%s (%s)", passName.c_str(), passTreeState); } - ImGui::Text(passName.c_str()); + ImGui::Text("%s", passName.c_str()); // Show a HoverMarker if the text is bigger than the column. const ImVec2 textSize = ImGui::CalcTextSize(passName.c_str()); @@ -480,7 +480,7 @@ namespace AZ } else { - ImGui::Text(label.c_str()); + ImGui::Text("%s", label.c_str()); } if (textColorChanged) @@ -683,7 +683,7 @@ namespace AZ // Draw the frame time (GPU). const AZStd::string formattedTimestamp = FormatTimestampLabel(gpuTimestamp.GetDurationInNanoseconds()); const AZStd::string headerFrameTime = AZStd::string::format("Total frame duration (GPU): %s", formattedTimestamp.c_str()); - ImGui::Text(headerFrameTime.c_str()); + ImGui::Text("%s", headerFrameTime.c_str()); // Draw the viewing option. ImGui::RadioButton("Hierarchical", reinterpret_cast(&m_viewType), static_cast(ProfilerViewType::Hierarchical)); @@ -810,7 +810,7 @@ namespace AZ { const int32_t timestampMetricUnitNumeric = static_cast(m_timestampMetricUnit); const AZStd::string metricUnitText = AZStd::string::format("Time in %s", MetricUnitText[timestampMetricUnitNumeric]); - ImGui::Text(metricUnitText.c_str()); + ImGui::Text("%s", metricUnitText.c_str()); ImGui::NextColumn(); } @@ -818,7 +818,7 @@ namespace AZ { const int32_t frameWorkloadViewNumeric = static_cast(m_frameWorkloadView); const AZStd::string frameWorkloadViewText = AZStd::string::format("Frame workload in %s FPS", FrameWorkloadUnit[frameWorkloadViewNumeric]); - ImGui::Text(frameWorkloadViewText.c_str()); + ImGui::Text("%s", frameWorkloadViewText.c_str()); ImGui::NextColumn(); } @@ -853,7 +853,7 @@ namespace AZ const int32_t frameWorkloadViewNumeric = static_cast(m_frameWorkloadView); const AZStd::string frameWorkloadViewText = AZStd::string::format("Frame workload in %s FPS", FrameWorkloadUnit[frameWorkloadViewNumeric]); - ImGui::Text(frameWorkloadViewText.c_str()); + ImGui::Text("%s", frameWorkloadViewText.c_str()); ImGui::NextColumn(); } @@ -907,7 +907,7 @@ namespace AZ } else { - ImGui::Text(entryTime.c_str()); + ImGui::Text("%s", entryTime.c_str()); ImGui::NextColumn(); DrawFrameWorkloadBar(NormalizeFrameWorkload(entry->m_interpolatedTimestampInNanoseconds)); ImGui::NextColumn(); @@ -927,7 +927,7 @@ namespace AZ if (entry->m_children.empty()) { // Draw the workload bar when it doesn't have children. - ImGui::Text(entry->m_name.GetCStr()); + ImGui::Text("%s", entry->m_name.GetCStr()); // Show a HoverMarker if the text is bigger than the column. createHoverMarker(entry->m_name.GetCStr()); @@ -991,9 +991,9 @@ namespace AZ } const AZStd::string entryTime = FormatTimestampLabel(entry->m_interpolatedTimestampInNanoseconds); - ImGui::Text(entry->m_name.GetCStr()); + ImGui::Text("%s", entry->m_name.GetCStr()); ImGui::NextColumn(); - ImGui::Text(entryTime.c_str()); + ImGui::Text("%s", entryTime.c_str()); ImGui::NextColumn(); DrawFrameWorkloadBar(NormalizeFrameWorkload(entry->m_interpolatedTimestampInNanoseconds)); ImGui::NextColumn(); @@ -1131,13 +1131,13 @@ namespace AZ continue; } - ImGui::Text(tableRow.m_parentPoolName.GetCStr()); + ImGui::Text("%s", tableRow.m_parentPoolName.GetCStr()); ImGui::TableNextColumn(); - ImGui::Text(tableRow.m_bufImgName.GetCStr()); + ImGui::Text("%s", tableRow.m_bufImgName.GetCStr()); ImGui::TableNextColumn(); ImGui::Text("%.4f", 1.0f * tableRow.m_sizeInBytes / GpuProfilerImGuiHelper::MB); ImGui::TableNextColumn(); - ImGui::Text(tableRow.m_bindFlags.c_str()); + ImGui::Text("%s", tableRow.m_bindFlags.c_str()); ImGui::TableNextColumn(); } } @@ -1244,20 +1244,20 @@ namespace AZ { if (ImGui::BeginChild(savedHeap.m_name.GetCStr(), { ImGui::GetWindowWidth() / m_savedHeaps.size(), 250 }), ImGuiWindowFlags_NoScrollbar) { - ImGui::Text(savedHeap.m_name.GetCStr()); + ImGui::Text("%s", savedHeap.m_name.GetCStr()); ImGui::Columns(2, "HeapData", true); - ImGui::Text("Resident (MB): "); + ImGui::Text("%s", "Resident (MB): "); ImGui::NextColumn(); ImGui::Text("%.2f", 1.0 * savedHeap.m_memoryUsage.m_residentInBytes.load() / GpuProfilerImGuiHelper::MB); ImGui::NextColumn(); - ImGui::Text("Reserved (MB): "); + ImGui::Text("%s", "Reserved (MB): "); ImGui::NextColumn(); ImGui::Text("%.2f", 1.0 * savedHeap.m_memoryUsage.m_reservedInBytes.load() / GpuProfilerImGuiHelper::MB); ImGui::NextColumn(); - ImGui::Text("Budget (MB): "); + ImGui::Text("%s", "Budget (MB): "); ImGui::NextColumn(); ImGui::Text("%.2f", 1.0 * savedHeap.m_memoryUsage.m_budgetInBytes / GpuProfilerImGuiHelper::MB); diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiPassTree.inl b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiPassTree.inl index a9eff68c7a..fa649ed47b 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiPassTree.inl +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiPassTree.inl @@ -100,7 +100,7 @@ namespace AZ::Render } } - ImGui::TextWrapped(m_attachmentReadbackInfo.c_str()); + ImGui::TextWrapped("%s", m_attachmentReadbackInfo.c_str()); } if (m_previewAttachment && m_selectedChanged) @@ -211,7 +211,7 @@ namespace AZ::Render else { // Only draw text (not selectable) if there is no attachment binded to the slot. - ImGui::Text(label.c_str()); + ImGui::Text("%s", label.c_str()); } } diff --git a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiShaderMetrics.inl b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiShaderMetrics.inl index 772be4d4a8..73517c66ca 100644 --- a/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiShaderMetrics.inl +++ b/Gems/Atom/Utils/Code/Include/Atom/Utils/ImGuiShaderMetrics.inl @@ -61,7 +61,7 @@ namespace AZ ImGui::Text("%d", request.m_requestCount); ImGui::NextColumn(); - ImGui::Text(request.m_shaderName.GetCStr()); + ImGui::Text("%s", request.m_shaderName.GetCStr()); ImGui::NextColumn(); ImGui::Text("%d", request.m_shaderVariantStableId.GetIndex()); diff --git a/Gems/Atom/Utils/Code/atom_utils_files.cmake b/Gems/Atom/Utils/Code/atom_utils_files.cmake index 06b78a49c4..b1f8170317 100644 --- a/Gems/Atom/Utils/Code/atom_utils_files.cmake +++ b/Gems/Atom/Utils/Code/atom_utils_files.cmake @@ -19,6 +19,8 @@ set(FILES Include/Atom/Utils/ImGuiPassTree.inl Include/Atom/Utils/ImGuiFrameVisualizer.h Include/Atom/Utils/ImGuiFrameVisualizer.inl + Include/Atom/Utils/ImGuiShaderMetrics.h + Include/Atom/Utils/ImGuiShaderMetrics.inl Include/Atom/Utils/ImGuiTransientAttachmentProfiler.h Include/Atom/Utils/ImGuiTransientAttachmentProfiler.inl Include/Atom/Utils/PpmFile.h diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/AtomFont.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/AtomFont.cpp index 8c88a49b12..5711e3ff6e 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/AtomFont.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/AtomFont.cpp @@ -731,20 +731,14 @@ IFFont* AZ::AtomFont::LoadFont(const char* fontName) font = NewFont(fontNameLower.c_str()); if (!font) { - AZStd::string errorMsg = "Error creating a new font named "; - errorMsg += fontNameLower; - errorMsg += "."; - CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_ERROR, errorMsg.c_str()); + CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_ERROR, "Error creating a new font named %s.", fontNameLower.c_str()); } else { // creating font adds one to its refcount so no need for AddRef here if (!font->Load(fontNameLower.c_str())) { - AZStd::string errorMsg = "Error loading a font from "; - errorMsg += fontNameLower; - errorMsg += "."; - CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_ERROR, errorMsg.c_str()); + CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_ERROR, "Error loading a font from %s.", fontNameLower.c_str()); font->Release(); font = nullptr; } @@ -792,8 +786,7 @@ bool AZ::AtomFont::AddFontFamilyToMaps(const char* fontFamilyFilename, const cha AZStd::to_lower(loweredFilename.begin(), loweredFilename.end()); if (m_fontFamilies.find(loweredFilename) != m_fontFamilies.end()) { - AZStd::string warnMsg = AZStd::string::format("Couldn't load Font Family '%s': already loaded", fontFamilyFilename); - CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, warnMsg.c_str()); + CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "Couldn't load Font Family '%s': already loaded", fontFamilyFilename); return false; } @@ -803,8 +796,7 @@ bool AZ::AtomFont::AddFontFamilyToMaps(const char* fontFamilyFilename, const cha AZStd::to_lower(loweredFontFamilyName.begin(), loweredFontFamilyName.end()); if (m_fontFamilies.find(loweredFontFamilyName) != m_fontFamilies.end()) { - AZStd::string warnMsg = AZStd::string::format("Couldn't load Font Family '%s': already loaded", fontFamilyName); - CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, warnMsg.c_str()); + CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "Couldn't load Font Family '%s': already loaded", fontFamilyName); return false; } diff --git a/Gems/AtomLyIntegration/AtomFont/Code/Source/FontRenderer.cpp b/Gems/AtomLyIntegration/AtomFont/Code/Source/FontRenderer.cpp index f1fc8be965..ed5e0e50bc 100644 --- a/Gems/AtomLyIntegration/AtomFont/Code/Source/FontRenderer.cpp +++ b/Gems/AtomLyIntegration/AtomFont/Code/Source/FontRenderer.cpp @@ -311,8 +311,7 @@ Vec2 AZ::FontRenderer::GetKerning(uint32_t leftGlyph, uint32_t rightGlyph) #if !defined(_RELEASE) if (0 != ftError) { - AZStd::string warnMsg = AZStd::string::format("FT_Get_Kerning returned %d", ftError); - CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, warnMsg.c_str()); + CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_WARNING, "FT_Get_Kerning returned %d", ftError); } #endif } diff --git a/Gems/AudioSystem/Code/Source/Engine/ATL.cpp b/Gems/AudioSystem/Code/Source/Engine/ATL.cpp index 8fbb8fffc0..e43f7beba7 100644 --- a/Gems/AudioSystem/Code/Source/Engine/ATL.cpp +++ b/Gems/AudioSystem/Code/Source/Engine/ATL.cpp @@ -2170,25 +2170,15 @@ namespace Audio const AZ::Color yellowColor(colorMax, colorMax, colorMin, 0.9f); const AZ::Color redColor(colorMax, colorMin, colorMin, 0.9f); - constexpr const char* tableHeaderNames[] = { - "ID", - "Name", - "Curr Used", - "Peak Used", - "%% of Used", - "Allocs", - "Frees", - }; - constexpr size_t numColumns = AZStd::size(tableHeaderNames); - constexpr float xTablePositions[numColumns] = { 0.f, 40.f, 300.f, 400.f, 500.f, 600.f, 700.f }; - float posY = fPosY; - - // Draw the header info: - for (int column = 0; column < numColumns; ++column) - { - auxGeom.Draw2dLabel(fPosX + xTablePositions[column], posY, textSize, color, false, tableHeaderNames[column]); - } + constexpr float xTablePositions[7] = { 0.f, 40.f, 300.f, 400.f, 500.f, 600.f, 700.f }; + auxGeom.Draw2dLabel(fPosX + xTablePositions[0], posY, textSize, color, false, "ID"); + auxGeom.Draw2dLabel(fPosX + xTablePositions[1], posY, textSize, color, false, "Name"); + auxGeom.Draw2dLabel(fPosX + xTablePositions[2], posY, textSize, color, false, "Curr Used"); + auxGeom.Draw2dLabel(fPosX + xTablePositions[3], posY, textSize, color, false, "Peak Used"); + auxGeom.Draw2dLabel(fPosX + xTablePositions[4], posY, textSize, color, false, "%% of Used"); + auxGeom.Draw2dLabel(fPosX + xTablePositions[5], posY, textSize, color, false, "Allocs"); + auxGeom.Draw2dLabel(fPosX + xTablePositions[6], posY, textSize, color, false, "Frees"); // Get the memory pool information... AZStd::vector poolInfos; @@ -2232,15 +2222,15 @@ namespace Audio auxGeom.Draw2dLabel(fPosX + xTablePositions[0], posY, textSize, color, false, "%d", poolInfo.m_poolId); // Name - auxGeom.Draw2dLabel(fPosX + xTablePositions[1], posY, textSize, color, false, poolInfo.m_poolName); + auxGeom.Draw2dLabel(fPosX + xTablePositions[1], posY, textSize, color, false, "%s", poolInfo.m_poolName); // Current Used (bytes) BytesToString(poolInfo.m_memoryUsed, buffer, bufferSize); - auxGeom.Draw2dLabel(fPosX + xTablePositions[2], posY, textSize, color, false, buffer); + auxGeom.Draw2dLabel(fPosX + xTablePositions[2], posY, textSize, color, false, "%s", buffer); // Peak Used (bytes) BytesToString(poolInfo.m_peakUsed, buffer, bufferSize); - auxGeom.Draw2dLabel(fPosX + xTablePositions[3], posY, textSize, color, false, buffer); + auxGeom.Draw2dLabel(fPosX + xTablePositions[3], posY, textSize, color, false, "%s", buffer); // % of Used (percent) auxGeom.Draw2dLabel(fPosX + xTablePositions[4], posY, textSize, color, false, "%.1f %%", percentUsed); @@ -2255,20 +2245,20 @@ namespace Audio whiteColor.StoreToFloat4(color); posY += (2.f * lineHeight); - auxGeom.Draw2dLabel(fPosX + xTablePositions[1], posY, textSize, color, false, tableHeaderNames[1]); - auxGeom.Draw2dLabel(fPosX + xTablePositions[1], posY + lineHeight, textSize, color, false, globalInfo.m_poolName); + auxGeom.Draw2dLabel(fPosX + xTablePositions[1], posY, textSize, color, false, "Name"); + auxGeom.Draw2dLabel(fPosX + xTablePositions[1], posY + lineHeight, textSize, color, false, "%s", globalInfo.m_poolName); auxGeom.Draw2dLabel(fPosX + xTablePositions[2], posY, textSize, color, false, "Total Used"); BytesToString(globalInfo.m_memoryUsed, buffer, bufferSize); - auxGeom.Draw2dLabel(fPosX + xTablePositions[2], posY + lineHeight, textSize, color, false, buffer); + auxGeom.Draw2dLabel(fPosX + xTablePositions[2], posY + lineHeight, textSize, color, false, "%s", buffer); auxGeom.Draw2dLabel(fPosX + xTablePositions[3], posY, textSize, color, false, "Total Peak"); BytesToString(totalPeak, buffer, bufferSize); - auxGeom.Draw2dLabel(fPosX + xTablePositions[3], posY + lineHeight, textSize, color, false, buffer); + auxGeom.Draw2dLabel(fPosX + xTablePositions[3], posY + lineHeight, textSize, color, false, "%s", buffer); auxGeom.Draw2dLabel(fPosX + xTablePositions[4], posY, textSize, color, false, "Total Size"); BytesToString(globalInfo.m_memoryReserved, buffer, bufferSize); - auxGeom.Draw2dLabel(fPosX + xTablePositions[4], posY + lineHeight, textSize, color, false, buffer); + auxGeom.Draw2dLabel(fPosX + xTablePositions[4], posY + lineHeight, textSize, color, false, "%s", buffer); auxGeom.Draw2dLabel(fPosX + xTablePositions[5], posY, textSize, color, false, "Total Allocs"); auxGeom.Draw2dLabel(fPosX + xTablePositions[5], posY + lineHeight, textSize, color, false, "%" PRIu64, totalAllocs); diff --git a/Gems/AudioSystem/Code/Source/Engine/FileCacheManager.cpp b/Gems/AudioSystem/Code/Source/Engine/FileCacheManager.cpp index b106c4f9d2..b7ed9229d8 100644 --- a/Gems/AudioSystem/Code/Source/Engine/FileCacheManager.cpp +++ b/Gems/AudioSystem/Code/Source/Engine/FileCacheManager.cpp @@ -446,13 +446,13 @@ namespace Audio } // Format: "relative/path/filename.ext (230 KiB) [2]" - AZStd::string displayString = AZStd::string::format("%s (%zu %s) [%zu]", + auxGeom.Draw2dLabel(positionX, positionY, entryDrawSize, color, false, + "%s (%zu %s) [%zu]", audioFileEntry->m_filePath.c_str(), fileSize, kiloBytes ? "KiB" : "Bytes", audioFileEntry->m_useCount); - auxGeom.Draw2dLabel(positionX, positionY, entryDrawSize, color, false, displayString.c_str()); color[3] = originalAlpha; positionY += entryStepSize; } diff --git a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp index 7f4877347f..2df6c9984b 100644 --- a/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp +++ b/Gems/ImGui/Code/Source/LYCommonMenu/ImGuiLYEntityOutliner.cpp @@ -84,99 +84,99 @@ namespace ImGui ImGui::Columns(3); ImGui::TextColored(m_displayName.m_color, "Display Name"); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_OnText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_OnText); ImGui::SameLine(); ImGui::Checkbox("##DisplayNameCB", &m_displayName.m_enabled); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_ColorText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_ColorText); ImGui::SameLine(); ImGui::ColorEdit4("##DisplayNameCol", reinterpret_cast(&m_displayName.m_color)); ImGui::NextColumn(); ImGui::TextColored(m_displayChildCount.m_color, "Display Child Count"); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_OnText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_OnText); ImGui::SameLine(); ImGui::Checkbox("##DisplayChildCountCB", &m_displayChildCount.m_enabled); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_ColorText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_ColorText); ImGui::SameLine(); ImGui::ColorEdit4("##DisplayChildCountCol", reinterpret_cast(&m_displayChildCount.m_color)); ImGui::NextColumn(); ImGui::TextColored(m_displayDescentdantCount.m_color, "Display Descendant Count"); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_OnText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_OnText); ImGui::SameLine(); ImGui::Checkbox("##DisplayDescendantCountCB", &m_displayDescentdantCount.m_enabled); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_ColorText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_ColorText); ImGui::SameLine(); ImGui::ColorEdit4("##DisplayDescendantCountCol", reinterpret_cast(&m_displayDescentdantCount.m_color)); ImGui::NextColumn(); ImGui::TextColored(m_displayEntityState.m_color, "Display Entity Status"); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_OnText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_OnText); ImGui::SameLine(); ImGui::Checkbox("##DisplayEntityStateCB", &m_displayEntityState.m_enabled); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_ColorText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_ColorText); ImGui::SameLine(); ImGui::ColorEdit4("##DisplayEntityStateCol", reinterpret_cast(&m_displayEntityState.m_color)); ImGui::NextColumn(); ImGui::TextColored(m_displayParentInfo.m_color, "Display Parent Info"); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_OnText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_OnText); ImGui::SameLine(); ImGui::Checkbox("##DisplayParentInfoCB", &m_displayParentInfo.m_enabled); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_ColorText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_ColorText); ImGui::SameLine(); ImGui::ColorEdit4("##DisplayParentInfoCol", reinterpret_cast(&m_displayParentInfo.m_color)); ImGui::NextColumn(); ImGui::TextColored(m_displayLocalPos.m_color, "Display Local Position"); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_OnText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_OnText); ImGui::SameLine(); ImGui::Checkbox("##DisplayLocalPosCB", &m_displayLocalPos.m_enabled); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_ColorText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_ColorText); ImGui::SameLine(); ImGui::ColorEdit4("##DisplayLocalPosCol", reinterpret_cast(&m_displayLocalPos.m_color)); ImGui::NextColumn(); ImGui::TextColored(m_displayLocalRotation.m_color, "Display Local Rotation"); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_OnText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_OnText); ImGui::SameLine(); ImGui::Checkbox("##DisplayLocalRotationCB", &m_displayLocalRotation.m_enabled); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_ColorText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_ColorText); ImGui::SameLine(); ImGui::ColorEdit4("##DisplayLocalRotationCol", reinterpret_cast(&m_displayLocalRotation.m_color)); ImGui::NextColumn(); ImGui::TextColored(m_displayWorldPos.m_color, "Display World Position"); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_OnText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_OnText); ImGui::SameLine(); ImGui::Checkbox("##DisplayWorldPosCB", &m_displayWorldPos.m_enabled); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_ColorText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_ColorText); ImGui::SameLine(); ImGui::ColorEdit4("##DisplayWorldPosCol", reinterpret_cast(&m_displayWorldPos.m_color)); ImGui::NextColumn(); ImGui::TextColored(m_displayWorldRotation.m_color, "Display World Rotation"); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_OnText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_OnText); ImGui::SameLine(); ImGui::Checkbox("##DisplayWorldRotationCB", &m_displayWorldRotation.m_enabled); ImGui::NextColumn(); - ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, s_ColorText); + ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "%s", s_ColorText); ImGui::SameLine(); ImGui::ColorEdit4("##DisplayWorldRotationCol", reinterpret_cast(&m_displayWorldRotation.m_color)); @@ -508,7 +508,7 @@ namespace ImGui } else if (sameLine) { - if (ImGui::TreeNode(childTreeNodeStr.c_str(), childTreeNodeStr.c_str())) + if (ImGui::TreeNode(childTreeNodeStr.c_str(), "%s", childTreeNodeStr.c_str())) { ImGuiUpdate_RecursivelyDisplayEntityInfoAndDecendants_DrawDisplayOptions(node, drawInspectButton, drawTargetButton, drawDebugButton, sameLine, drawComponents); @@ -528,7 +528,7 @@ namespace ImGui { ImGuiUpdate_RecursivelyDisplayEntityInfoAndDecendants_DrawDisplayOptions(node, drawInspectButton, drawTargetButton, drawDebugButton, sameLine, drawComponents); childTreeNodeStr = AZStd::string::format("Children ##%s", childTreeNodeStr.c_str()); - if (ImGui::TreeNode(childTreeNodeStr.c_str(), childTreeNodeStr.c_str())) + if (ImGui::TreeNode(childTreeNodeStr.c_str(), "%s", childTreeNodeStr.c_str())) { for (int i = 0; i < node->m_children.size(); i++) { @@ -542,7 +542,7 @@ namespace ImGui else if (!justDrawChildren) { ImGui::TextColored(ImGui::Colors::s_PlainLabelColor, "->"); ImGui::SameLine(); - ImGui::Text(childTreeNodeStr.c_str()); + ImGui::Text("%s", childTreeNodeStr.c_str()); ImGuiUpdate_RecursivelyDisplayEntityInfoAndDecendants_DrawDisplayOptions(node, drawInspectButton, drawTargetButton, drawDebugButton, sameLine, drawComponents); } } @@ -561,7 +561,7 @@ namespace ImGui { ImGui::SameLine(); } - ImGui::TextColored(m_displayName.m_color, entityName.c_str()); + ImGui::TextColored(m_displayName.m_color, "%s", entityName.c_str()); } // Draw EntityViewer Button @@ -762,7 +762,7 @@ namespace ImGui { // Draw collapsible menu for the components set AZStd::string uiLabel = AZStd::string::format("Components##%s", node->m_entityId.ToString().c_str()); - if (ImGui::TreeNode(uiLabel.c_str(), uiLabel.c_str())) + if (ImGui::TreeNode(uiLabel.c_str(), "%s", uiLabel.c_str())) { AZ::Entity::ComponentArrayType components = entity->GetComponents(); // we should sort our array of components based on their names. @@ -781,7 +781,7 @@ namespace ImGui bool hasDebug = ComponentHasDebug(component->RTTI_GetType()); // Draw a collapsible menu for each component uiLabel = AZStd::string::format("%s##%s", component->RTTI_GetTypeName(), node->m_entityId.ToString().c_str()); - if (ImGui::TreeNode(uiLabel.c_str(), uiLabel.c_str())) + if (ImGui::TreeNode(uiLabel.c_str(), "%s", uiLabel.c_str())) { if (hasDebug) { @@ -795,7 +795,7 @@ namespace ImGui // Draw a collapsible menu for all Reflected Properties uiLabel = AZStd::string::format("Reflected Properties##%s", node->m_entityId.ToString().c_str()); - if (ImGui::TreeNode(uiLabel.c_str(), uiLabel.c_str())) + if (ImGui::TreeNode(uiLabel.c_str(), "%s", uiLabel.c_str())) { AZ::SerializeContext *serializeContext = nullptr; AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationRequests::GetSerializeContext); @@ -820,7 +820,7 @@ namespace ImGui if (hasDebug) { uiLabel = AZStd::string::format("Debug##%s", node->m_entityId.ToString().c_str()); - if (ImGui::TreeNode(uiLabel.c_str(), uiLabel.c_str())) + if (ImGui::TreeNode(uiLabel.c_str(), "%s", uiLabel.c_str())) { // Attempt to draw any debug information for this component ImGuiUpdateDebugComponentListenerBus::Event(ImGuiEntComponentId(node->m_entityId, component->RTTI_GetType()) diff --git a/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp b/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp index cc4e70e010..2b31726d3e 100644 --- a/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp +++ b/Gems/LyShine/Code/Source/Animation/AzEntityNode.cpp @@ -256,20 +256,12 @@ const AZ::SerializeContext::ClassElement* CUiAnimAzEntityNode::ComputeOffsetFrom if (mismatch) { - AZStd::string warnMsg = "Data mismatch reading animation data for type "; - warnMsg += classData->m_typeId.ToString(); - warnMsg += ". The field \""; - warnMsg += paramData.GetName(); - if (!element) - { - warnMsg += "\" cannot be found."; - } - else - { - warnMsg += "\" has a different type to that in the animation data."; - } - warnMsg += " This part of the animation data will be ignored."; - CryWarning(VALIDATOR_MODULE_SHINE, VALIDATOR_WARNING, warnMsg.c_str()); + CryWarning(VALIDATOR_MODULE_SHINE, VALIDATOR_WARNING, + "Data mismatch reading animation data for type %s. The field \"%s\" %s. This part of the animation data will be ignored.", + classData->m_typeId.ToString().c_str(), + paramData.GetName(), + (!element ? "cannot be found" : "has a different type to that in the animation data") + ); return nullptr; } } diff --git a/Gems/LyShine/Code/Source/UiInteractableState.cpp b/Gems/LyShine/Code/Source/UiInteractableState.cpp index e81c48a43a..6027ecf3d7 100644 --- a/Gems/LyShine/Code/Source/UiInteractableState.cpp +++ b/Gems/LyShine/Code/Source/UiInteractableState.cpp @@ -575,10 +575,7 @@ void UiInteractableStateFont::SetFontPathname(const AZStd::string& pathname) fontFamily = gEnv->pCryFont->LoadFontFamily(fileName.c_str()); if (!fontFamily) { - AZStd::string errorMsg = "Error loading a font from "; - errorMsg += fileName.c_str(); - errorMsg += "."; - CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_ERROR, errorMsg.c_str()); + CryWarning(VALIDATOR_MODULE_SYSTEM, VALIDATOR_ERROR, "Error loading a font from %s.", fileName.c_str()); } }