瀏覽代碼

Fix various compile errors related to recent unused warnings and format security compile flags (#216)

Signed-off-by: Steve Pham <[email protected]>
Steve Pham 3 年之前
父節點
當前提交
c774520e27

+ 5 - 5
Gem/Code/Source/Automation/ScriptReporter.cpp

@@ -572,18 +572,18 @@ namespace AtomSampleViewer
                         {
                             resetTextHighlight();
 
-                            ImGui::Text(("Screenshot:        " + screenshotResult.m_screenshotFilePath).c_str());
+                            ImGui::Text("Screenshot:        %s", screenshotResult.m_screenshotFilePath.c_str());
 
                             ImGui::Spacing();
 
                             highlightTextIf(!screenshotPassed, HighlightFailed);
 
-                            ImGui::Text(("Official Baseline: " + screenshotResult.m_officialBaselineScreenshotFilePath).c_str());
+                            ImGui::Text("Official Baseline: %s", screenshotResult.m_officialBaselineScreenshotFilePath.c_str());
 
                             // Official Baseline Result
                             ImGui::Indent();
                             {
-                                ImGui::Text(screenshotResult.m_officialComparisonResult.GetSummaryString().c_str());
+                                ImGui::Text("%s", screenshotResult.m_officialComparisonResult.GetSummaryString().c_str());
 
                                 if (screenshotResult.m_officialComparisonResult.m_resultCode == ImageComparisonResult::ResultCode::ThresholdExceeded ||
                                     screenshotResult.m_officialComparisonResult.m_resultCode == ImageComparisonResult::ResultCode::Pass)
@@ -643,12 +643,12 @@ namespace AtomSampleViewer
 
                             highlightTextIf(localBaselineWarning, HighlightWarning);
 
-                            ImGui::Text(("Local Baseline:    " + screenshotResult.m_localBaselineScreenshotFilePath).c_str());
+                            ImGui::Text("Local Baseline:    %s", screenshotResult.m_localBaselineScreenshotFilePath.c_str());
 
                             // Local Baseline Result
                             ImGui::Indent();
                             {
-                                ImGui::Text(screenshotResult.m_localComparisonResult.GetSummaryString().c_str());
+                                ImGui::Text("%s", screenshotResult.m_localComparisonResult.GetSummaryString().c_str());
 
                                 resetTextHighlight();
 

+ 1 - 1
Gem/Code/Source/MaterialHotReloadTestComponent.cpp

@@ -287,7 +287,7 @@ namespace AtomSampleViewer
 
         ImGui::Text("Status:");
         ImGui::SameLine();
-        ImGui::Text(ToString(status));
+        ImGui::Text("%s", ToString(status));
 
         if (includeFileName)
         {

+ 1 - 1
Gem/Code/Source/Passes/RayTracingAmbientOcclusionPass.cpp

@@ -158,7 +158,7 @@ namespace AZ
 
             // Bind others for global srg
             const RHI::ShaderResourceGroupLayout* srgLayout = m_shaderResourceGroup->GetLayout();
-            RHI::ShaderInputImageIndex imageIndex;
+            
             RHI::ShaderInputBufferIndex bufferIndex;
             RHI::ShaderInputConstantIndex constantIndex;
 

+ 1 - 1
Gem/Code/Source/ProceduralSkinnedMesh.cpp

@@ -193,7 +193,7 @@ namespace AtomSampleViewer
 
             // Find the closest bone that is still below or equal to the current segment in height
             int boneIndexBelow = 0;
-            for (boneIndexBelow; boneIndexBelow < static_cast<int>(m_boneCount - 1); ++boneIndexBelow)
+            for (; boneIndexBelow < static_cast<int>(m_boneCount - 1); ++boneIndexBelow)
             {
                 // If the next bone is higher than the current height, we've found the below/above indices we're looking for
                 if (m_boneHeights[boneIndexBelow + 1] > currentSegmentHeight)

+ 0 - 2
Gem/Code/Source/RHI/SubpassExampleComponent.cpp

@@ -590,8 +590,6 @@ namespace AtomSampleViewer
         } };
 
         const float zNear = 1.0f, zFar = 100.0f;
-        const AZ::Vector3 up = AZ::Vector3(0.0f, 0.0f, 1.0f);
-        const AZ::Vector3 lookAt = AZ::Vector3(0.0f, 0.0f, 0.0f);
 
         // Camera
         float fieldOfView = AZ::Constants::Pi / 4.0f;

+ 0 - 5
Gem/Code/Source/SkinnedMeshExampleComponent.cpp

@@ -29,11 +29,6 @@
 
 namespace AtomSampleViewer
 {
-    namespace
-    {
-        static const char* const SkinnedMeshMaterial = "materials/defaultpbrmaterial.azmaterial";
-    }
-
     void SkinnedMeshExampleComponent::Reflect(AZ::ReflectContext* context)
     {
         if (AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(context))

+ 0 - 1
Gem/Code/Source/SponzaBenchmarkComponent.cpp

@@ -290,7 +290,6 @@ namespace AtomSampleViewer
 
                     const AZ::Vector3 position = cameraPathPoint.m_position.Lerp(nextCameraPathPoint.m_position, percentToNextPoint);
                     const AZ::Vector3 target = cameraPathPoint.m_target.Lerp(nextCameraPathPoint.m_target, percentToNextPoint);
-                    const AZ::Vector3 up = cameraPathPoint.m_up.Lerp(nextCameraPathPoint.m_up, percentToNextPoint);
 
                     const AZ::Transform transform = AZ::Transform::CreateLookAt(position, target, AZ::Transform::Axis::YPositive);
 

+ 1 - 1
Gem/Code/Source/StreamingImageExampleComponent.cpp

@@ -671,7 +671,7 @@ namespace AtomSampleViewer
             AZStd::vector<uint8_t> imageData;
             const uint32_t side = 1001;
             const uint32_t depth = 3;
-            const uint32_t colorIndex = static_cast<uint32_t>(-1);
+            
             createColorImageData({ 1.0f,0.0f,0.0f,0.0f }, side, side, imageData);
             createColorImageData({ 0.0f,1.0f,0.0f,0.0f }, side, side, imageData);
             createColorImageData({ 0.0f,0.0f,1.0f,0.0f }, side, side, imageData);

+ 1 - 1
Gem/Code/Source/Utils/ImGuiMessageBox.cpp

@@ -57,7 +57,7 @@ namespace AtomSampleViewer
 
             if (ImGui::BeginPopupModal(m_title.c_str(), nullptr, windowFlags))
             {
-                ImGui::Text(m_message.c_str());
+                ImGui::Text("%s", m_message.c_str());
 
                 ScriptableImGui::PushNameContext(m_title.c_str());
 

+ 1 - 1
Gem/Code/Source/Utils/ImGuiProgressList.cpp

@@ -73,7 +73,7 @@ namespace AtomSampleViewer
 
             if (ImGui::BeginPopupModal(m_title.c_str(), nullptr, windowFlags))
             {
-                ImGui::Text(m_description.c_str());
+                ImGui::Text("%s", m_description.c_str());
 
                 ScriptableImGui::PushNameContext(m_title.c_str());
 

+ 2 - 2
Gem/Code/Source/Utils/ImGuiShaderUtils.cpp

@@ -31,8 +31,8 @@ namespace AtomSampleViewer
             AZStd::string header = AZStd::string::format("%-*s |  Bits | Requested | Selected", longestOptionNameLength, "Option Name");
             AZStd::string divider{header.size(), '-'};
 
-            ImGui::Text(header.c_str());
-            ImGui::Text(divider.c_str());
+            ImGui::Text("%s", header.c_str());
+            ImGui::Text("%s", divider.c_str());
 
             for (size_t i = 0; i < shaderOptionDescriptors.size(); ++i)
             {