Skip to content

Commit 4a0c580

Browse files
committed
fix: resolve compiler warnings for unused variables and unreachable code
1 parent f1ff9d6 commit 4a0c580

File tree

2 files changed

+19
-31
lines changed

2 files changed

+19
-31
lines changed

VirtualCore/Source/Utilities/VBDiskResizer.swift

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -804,11 +804,7 @@ public struct VBDiskResizer {
804804
// Strategy 2: Try using the limit parameter to resize up to the recovery partition
805805
NSLog("Attempting to resize main container up to recovery partition boundary")
806806

807-
// Calculate size: We need to leave space for the recovery partition
808-
// Extract the recovery partition size from the output
809-
let recoverySize: UInt64 = 5_400_000_000 // ~5.4 GB typical recovery size
810-
811-
// Get total disk size
807+
// Get total disk size (might be useful for debugging)
812808
let diskInfoProcess = Process()
813809
diskInfoProcess.executableURL = URL(fileURLWithPath: "/usr/sbin/diskutil")
814810
diskInfoProcess.arguments = ["info", deviceNode]
@@ -820,7 +816,7 @@ public struct VBDiskResizer {
820816
try diskInfoProcess.run()
821817
diskInfoProcess.waitUntilExit()
822818

823-
let diskInfoOutput = String(data: diskInfoPipe.fileHandleForReading.readDataToEndOfFile(), encoding: .utf8) ?? ""
819+
_ = diskInfoPipe.fileHandleForReading.readDataToEndOfFile()
824820

825821
// Try to resize leaving space for recovery
826822
let resizeProcess = Process()

VirtualUI/Source/VM Configuration/Sections/Storage/ManagedDiskImageEditor.swift

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -177,32 +177,24 @@ struct ManagedDiskImageEditor: View {
177177
isResizing = true
178178

179179
Task {
180-
do {
181-
await MainActor.run {
182-
image.size = newSize
183-
onSave(image)
184-
}
185-
186-
// The actual resize will happen automatically when VM starts or restarts
187-
// due to the size mismatch detection in checkAndResizeDiskImages()
180+
await MainActor.run {
181+
image.size = newSize
182+
onSave(image)
183+
}
184+
185+
// The actual resize will happen automatically when VM starts or restarts
186+
// due to the size mismatch detection in checkAndResizeDiskImages()
187+
188+
await MainActor.run {
189+
isResizing = false
188190

189-
await MainActor.run {
190-
isResizing = false
191-
192-
// Show informational alert
193-
let alert = NSAlert()
194-
alert.messageText = "Disk Resize in Progress"
195-
alert.informativeText = "The disk image is being resized to \(ByteCountFormatter.string(fromByteCount: Int64(newSize), countStyle: .file)). This may take several minutes depending on the disk size. The partition will be automatically expanded to use the new space."
196-
alert.alertStyle = .informational
197-
alert.addButton(withTitle: "OK")
198-
alert.runModal()
199-
}
200-
} catch {
201-
await MainActor.run {
202-
image.size = minimumSize
203-
isResizing = false
204-
NSAlert(error: error).runModal()
205-
}
191+
// Show informational alert
192+
let alert = NSAlert()
193+
alert.messageText = "Disk Resize in Progress"
194+
alert.informativeText = "The disk image is being resized to \(ByteCountFormatter.string(fromByteCount: Int64(newSize), countStyle: .file)). This may take several minutes depending on the disk size. The partition will be automatically expanded to use the new space."
195+
alert.alertStyle = .informational
196+
alert.addButton(withTitle: "OK")
197+
alert.runModal()
206198
}
207199
}
208200
}

0 commit comments

Comments
 (0)