From 21b533d448349b97e97efd71712a653ae99bc4e1 Mon Sep 17 00:00:00 2001 From: PulkoMandy Date: Mon, 24 Jul 2023 14:58:34 +0200 Subject: [PATCH] Bootloader FAT: remove unused variables The "longNameValid" variable already indicates if a long name is present and valid, and it is correctly handled, with the short name used as a fallback if the long name is either not present, or not encoded correctly. The "hasLongName" variable is useless since long names are already handled. The "partial" variable indeed indicates a partial read was done. There is nothing to do with that info, the read is already complete at this point and the correct data is read and returned to the caller. So I don't see why we should keep this variable. The "count" variable seems to serve no purpose and is easy to re-add if someone ever has a need for it. Change-Id: Ic7eb7f34a49243ecdb5dd3c6b29c3b90f3bece10 Reviewed-on: https://review.haiku-os.org/c/haiku/+/6739 Reviewed-by: Fredrik Holmqvist --- src/system/boot/loader/file_systems/fat/Directory.cpp | 2 -- src/system/boot/loader/file_systems/fat/Stream.cpp | 6 ------ 2 files changed, 8 deletions(-) diff --git a/src/system/boot/loader/file_systems/fat/Directory.cpp b/src/system/boot/loader/file_systems/fat/Directory.cpp index 8aa1e9f440..b533b0096d 100644 --- a/src/system/boot/loader/file_systems/fat/Directory.cpp +++ b/src/system/boot/loader/file_systems/fat/Directory.cpp @@ -554,7 +554,6 @@ Directory::GetNextEntry(void *cookie, uint8 mask, uint8 match) TRACE(("FASFS::Directory::%s(, %02x, %02x)\n", __FUNCTION__, mask, match)); struct dir_cookie *c = (struct dir_cookie *)cookie; - bool hasLongName = false; bool longNameValid = false; do { @@ -574,7 +573,6 @@ Directory::GetNextEntry(void *cookie, uint8 mask, uint8 match) uint8* nameEntry = (uint8*)&c->entry; if ((*nameEntry & 0x40) != 0) { c->ResetName(); - hasLongName = true; longNameValid = true; } diff --git a/src/system/boot/loader/file_systems/fat/Stream.cpp b/src/system/boot/loader/file_systems/fat/Stream.cpp index 958c35f6e2..ccce51de58 100644 --- a/src/system/boot/loader/file_systems/fat/Stream.cpp +++ b/src/system/boot/loader/file_systems/fat/Stream.cpp @@ -126,10 +126,7 @@ Stream::_FindCluster(off_t pos, uint32& _cluster) } if (!found) { #if 1 - uint32 count = (fSize + fVolume.ClusterSize() - 1) / fVolume.ClusterSize(); cluster = fFirstCluster; - if (fSize == UINT32_MAX) // it's a directory, try a large enough value - count = 10; for (i = 0; i < index && fVolume.IsValidCluster(cluster); i++) { if (fVolume.IsLastCluster(cluster)) break; @@ -308,8 +305,6 @@ Stream::ReadAt(off_t pos, void *_buffer, size_t *_length, off_t *diskOffset) // read the following complete blocks using cached_read(), // the last partial block is read using the generic Cache class - bool partial = false; - while (length > 0) { // offset is the offset to the current pos in the block_run @@ -321,7 +316,6 @@ Stream::ReadAt(off_t pos, void *_buffer, size_t *_length, off_t *diskOffset) } memcpy(buffer + bytesRead, block, length); bytesRead += length; - partial = true; break; }