"Fix" warnings

This commit is contained in:
Simon Lübeß
2026-08-16 20:11:36 +02:00
parent 39d78ab4c1
commit 2a90374b5b
25 changed files with 53 additions and 45 deletions
+1 -1
View File
@@ -310,7 +310,7 @@ class AssetCache
Try!(compressedStream.TryRead(compressedData));
MemoryStream ms = new MemoryStream(asset.UncompressedByteCount);
ms.Memory.GrowUnitialized(asset.UncompressedByteCount);
ms.Memory.GrowUninitialized(asset.UncompressedByteCount);
LZ4.LZ4F_dctx* context;
LZ4.LZ4F_CreateDecompressionContext(out context);
@@ -630,7 +630,7 @@ static class DdsImporter
surfaces.Reserve(surfaceCount);
uint32 scanLineSize = 0;
uint32 slicePitch = 0;
//uint32 slicePitch = 0;
uint64 numBytes = 0;
uint32 blockSize = 0; // Block size in bytes.
@@ -97,7 +97,7 @@ class MaterialVariable
Result<int, Int.ParseError> rowsResult = int.Parse(rowsString);
if (rowsResult case .Err(let error))
if (rowsResult case .Err(var error))
{
switch (error)
{
@@ -114,7 +114,7 @@ class MaterialVariable
Result<int, Int.ParseError> columnsResult = int.Parse(columnsString);
if (columnsResult case .Err(let error))
if (columnsResult case .Err(out error))
{
switch (error)
{
@@ -226,7 +226,7 @@ extension ShaderCompiler
Try!(ShaderCodePreprocessor.ProcessFileContent(shaderCode, context.VsName, context.PsName, context.Variables, context.BufferNames, context.EngineBuffers));
using (let includer = PreprocessingIncluder(directory, context))
using (var includer = PreprocessingIncluder(directory, context))
{
var result = D3DCompiler.D3DCompile(code.Ptr, (.)code.Length, fileName.FullIdentifier.ToScopeCStr!(), nativeMacros, &includer, entryPoint.ToScopeCStr!(),
compileTarget.ToScopeCStr!(), DefaultCompileFlags /* Pass down compile flags? */, .None, &outShader._shaderBlob, &errorBlob);
@@ -205,14 +205,14 @@ class ShaderProcessor : IAssetProcessor
ProcessedShader.ConstantBufferEntry constantBufferEntry = .Default;
if (vsBufferResult case .Ok(let vsBuffer) && psBufferResult case .Ok(let psBuffer))
if (vsBufferResult case .Ok(var vsBuffer) && psBufferResult case .Ok(let psBuffer))
{
// Choose larger buffer
constantBufferEntry.ConstantBuffer = (vsBuffer.Size >= psBuffer.Size) ? vsBuffer : psBuffer;
constantBufferEntry.VertexShaderBindPoint = (.)vsBuffer.BindPoint;
constantBufferEntry.PixelShaderBindPoint = (.)psBuffer.BindPoint;
}
else if (vsBufferResult case .Ok(let vsBuffer))
else if (vsBufferResult case .Ok(out vsBuffer))
{
constantBufferEntry.ConstantBuffer = vsBuffer;
constantBufferEntry.VertexShaderBindPoint = (.)vsBuffer.BindPoint;
@@ -465,7 +465,7 @@ namespace GlitchyEditor.EditWindows
_selectedFiles.ClearAndDeleteItems();
}
if (currentDirectoryNode case .Ok(TreeNode<AssetNode> currentDirectory))
if (currentDirectoryNode case .Ok(out currentDirectory))
{
FileDropTarget(currentDirectory, .External);
}
@@ -168,7 +168,7 @@ namespace GlitchyEditor.EditWindows
let mousePos = (float2)ImGui.GetMousePos();
let globalToImGuiMouse = (float2)globalMousePosition - mousePos;
//let globalToImGuiMouse = (float2)globalMousePosition - mousePos;
let winPos = (float2)ImGui.GetWindowPos();
let regionMin = winPos + (float2)ImGui.GetWindowContentRegionMin();
@@ -119,11 +119,11 @@ class InspectorWindow : EditorWindow
{
ShowAssetProperties(assetHandle, editor);
}
else if (object case .Entity(let entityId))
else if (object case .Entity(var entityId))
{
ShowEntityProperties(entityId, editor);
}
else if (object case .Component(let entityId, let componentType))
else if (object case .Component(out entityId, let componentType))
{
ShowEntityProperties(entityId, editor, componentType);
}
@@ -156,7 +156,7 @@ class InspectorWindow : EditorWindow
if (assetFile.LoadedAsset != null)
{
// TODO: Where do we get the asset editor from?
if (let mat = assetFile.LoadedAsset as Material)
if (assetFile.LoadedAsset is Material)
{
MaterialEditor.ShowEditor(assetFile);
//ImGui.TextUnformatted(assetFile.LoadedAsset.Identifier);
+2 -2
View File
@@ -972,14 +972,14 @@ class EditorContentManager : IContentManager
{
Runtime.NotImplemented();
if (oldIdentifier == newIdentifier)
/*if (oldIdentifier == newIdentifier)
return;
Log.EngineLogger.Assert(_identiferToHandle.ContainsKey(newIdentifier), "An asset with the same identifier is already managed by this content manager.");
// Since all we do in order to track assets is add them to a dictionary we can simply unmanage and manage it again.
//UnmanageAsset(asset);
//ManageAsset(asset);
//ManageAsset(asset);*/
}
// TODO: obviously use a map or something...
+3 -3
View File
@@ -589,7 +589,7 @@ namespace GlitchyEditor
/// @remarks If the creation fails at any point the entire directory will be deleted.
private Result<void> CreateNewProject(StringView workspaceDirectory, StringView projectName)
{
if (Directory.CreateDirectory(workspaceDirectory) case .Err(let error))
if (Directory.CreateDirectory(workspaceDirectory) case .Err(var error))
{
Log.ClientLogger.Error($"Failed to create directory \"{workspaceDirectory}\". ({error})");
return .Err;
@@ -610,9 +610,9 @@ namespace GlitchyEditor
// If the project couldn't be created or initialization failed, we delete the workspace directory.
if (newProjectResult == .Err)
{
if (Directory.DelTree(workspaceDirectory) case .Err(let error))
if (Directory.DelTree(workspaceDirectory) case .Err(out error))
{
Log.EngineLogger.Error($"Failed to delete workspace ({workspaceDirectory}).");
Log.EngineLogger.Error($"Failed to delete workspace ({workspaceDirectory}). ({error})");
}
return .Err;
+2 -2
View File
@@ -276,10 +276,10 @@ namespace ImGui
const String[?] componentNames = .("X", "Y", "Z", "W");
const String[?] componentIds = .("##X", "##Y", "##Z", "##W");
static int mouseLockId = 0;
//static int mouseLockId = 0;
bool changed = false;
bool deactivated = false;
//bool deactivated = false;
if (!label.IsEmpty)
{
+1 -1
View File
@@ -311,7 +311,7 @@ namespace GlitchyEditor
switch (fieldType)
{
case typeof(bool):
let value = GetSettingValue!<bool>();
bool value = GetSettingValue!<bool>();
if (!ImGui.Checkbox(scope $"##{setting.Name}", &value))
break;